Clover Git
OpenCL 1.1 software implementation
|
2D image More...
#include <memobject.h>
Public Member Functions | |
Image2D (Context *ctx, size_t width, size_t height, size_t row_pitch, const cl_image_format *format, void *host_ptr, cl_mem_flags flags, cl_int *errcode_ret) | |
Constructor. | |
virtual size_t | size () const |
Size in bytes. | |
virtual Type | type () const |
Return that we are a Coal::MemObject::Image2D . | |
size_t | width () const |
Width. | |
size_t | height () const |
Height. | |
size_t | row_pitch () const |
Size in bytes of a row of pixels. | |
virtual size_t | slice_pitch () const |
Size in bytes of the image. | |
const cl_image_format & | format () const |
Image format descriptor. | |
cl_int | imageInfo (cl_image_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret) const |
Information about this image object. | |
size_t | pixel_size () const |
Pixel size of this image. | |
size_t | element_size () const |
Channel size of this image. | |
unsigned int | channels () const |
Number of channels of this image. | |
Static Public Member Functions | |
static size_t | element_size (const cl_image_format &format) |
Size in bytes of each channel of format . | |
static unsigned int | channels (const cl_image_format &format) |
Number of channels of format . | |
static size_t | pixel_size (const cl_image_format &format) |
Size in bytes of a pixel in format . | |
Private Attributes | |
size_t | p_width |
size_t | p_height |
size_t | p_row_pitch |
cl_image_format | p_format |
2D image
Definition at line 193 of file memobject.h.
Image2D::Image2D | ( | Context * | ctx, |
size_t | width, | ||
size_t | height, | ||
size_t | row_pitch, | ||
const cl_image_format * | format, | ||
void * | host_ptr, | ||
cl_mem_flags | flags, | ||
cl_int * | errcode_ret | ||
) |
Constructor.
ctx | parent Coal::Context |
width | width of the image |
height | height of the image |
row_pitch | number of bytes in a row of pixels. If 0, defaults to width * pixel_size() |
format | image format |
host_ptr | host pointer |
flags | memory flags |
errcode_ret | return code |
Definition at line 474 of file memobject.cpp.
References format(), p_format, p_row_pitch, pixel_size(), and row_pitch().
Referenced by type().
unsigned int Image2D::channels | ( | const cl_image_format & | format | ) | [static] |
Number of channels of format
.
Definition at line 716 of file memobject.cpp.
Referenced by Coal::CPUKernelWorkGroup::readImageImplI(), and Coal::CPUKernelWorkGroup::writeImageImpl().
unsigned int Image2D::channels | ( | ) | const |
Number of channels of this image.
Definition at line 774 of file memobject.cpp.
References p_format.
Referenced by pixel_size().
size_t Image2D::element_size | ( | const cl_image_format & | format | ) | [static] |
Size in bytes of each channel of format
.
Definition at line 685 of file memobject.cpp.
size_t Image2D::element_size | ( | ) | const |
Channel size of this image.
Definition at line 764 of file memobject.cpp.
References p_format.
Referenced by imageInfo(), and pixel_size().
const cl_image_format & Image2D::format | ( | ) | const |
Image format descriptor.
Definition at line 614 of file memobject.cpp.
References p_format.
Referenced by Coal::CopyImageEvent::CopyImageEvent(), get_image_channel_data_type(), get_image_channel_order(), Image2D(), image_data(), imageInfo(), Coal::CPUKernelWorkGroup::readImageImplI(), and Coal::CPUKernelWorkGroup::writeImageImpl().
size_t Image2D::height | ( | ) | const |
Height.
Definition at line 598 of file memobject.cpp.
References p_height.
Referenced by get_image_height(), handle_address_mode(), imageInfo(), Coal::KernelEvent::KernelEvent(), Coal::CPUKernelWorkGroup::readImageImplF(), and size().
cl_int Image2D::imageInfo | ( | cl_image_info | param_name, |
size_t | param_value_size, | ||
void * | param_value, | ||
size_t * | param_value_size_ret | ||
) | const |
Information about this image object.
This function is also usable for Coal::Image3D
objects as it does casting when necessary in order to give information when needed.
This function is used to retrieve information about an object. Sometimes, the size of the data retrieved is unknown (for example, a string). The application can call this function twice, the first time to get the size, then it allocates a buffer, and finally get the data.
const char *string = 0; size_t len; object->info(FOO_PROPERTY_STRING, 0, 0, &len); string = std::malloc(len); object->info(FOO_PROPERTY_STRING, len, string, 0);
param_name | Name of the property to retrieve |
param_value_size | Size of the application-allocated buffer in which to put the value. |
param_value | Pointer to an application-allocated buffer where the property data will be stored. Ignored if NULL. |
param_value_size_ret | Size of the value retrieved, ignored if NULL. |
Definition at line 619 of file memobject.cpp.
References Coal::Image3D::depth(), element_size(), format(), height(), p_format, row_pitch(), SIMPLE_ASSIGN, Coal::Image3D::slice_pitch(), type(), and width().
Referenced by clGetImageInfo().
size_t Image2D::pixel_size | ( | const cl_image_format & | format | ) | [static] |
Size in bytes of a pixel in format
.
Definition at line 750 of file memobject.cpp.
References channels(), and element_size().
Referenced by Coal::CopyBufferToImageEvent::CopyBufferToImageEvent(), Coal::CopyImageToBufferEvent::CopyImageToBufferEvent(), Coal::CPUKernelWorkGroup::getImageData(), Coal::CPUDevice::initEventDeviceData(), and Coal::MapImageEvent::MapImageEvent().
size_t Image2D::pixel_size | ( | ) | const |
Pixel size of this image.
Definition at line 769 of file memobject.cpp.
References p_format.
Referenced by Image2D().
size_t Image2D::row_pitch | ( | ) | const |
Size in bytes of a row of pixels.
Definition at line 603 of file memobject.cpp.
References p_row_pitch.
Referenced by Coal::CPUKernelWorkGroup::getImageData(), Image2D(), Coal::Image3D::Image3D(), imageInfo(), Coal::CPUDevice::initEventDeviceData(), Coal::MapImageEvent::MapImageEvent(), and size().
size_t Image2D::size | ( | ) | const [virtual] |
Size in bytes.
Implements Coal::MemObject.
Reimplemented in Coal::Image3D.
Definition at line 583 of file memobject.cpp.
References height(), and row_pitch().
Referenced by Coal::MapImageEvent::MapImageEvent(), and slice_pitch().
size_t Image2D::slice_pitch | ( | ) | const [virtual] |
Size in bytes of the image.
Reimplemented in Coal::Image3D.
Definition at line 608 of file memobject.cpp.
References size().
Referenced by Coal::CPUKernelWorkGroup::getImageData(), Coal::CPUDevice::initEventDeviceData(), and Coal::MapImageEvent::MapImageEvent().
MemObject::Type Image2D::type | ( | ) | const [virtual] |
Return that we are a Coal::MemObject::Image2D
.
Implements Coal::MemObject.
Reimplemented in Coal::Image3D.
Definition at line 588 of file memobject.cpp.
References Image2D().
Referenced by clEnqueueMapImage(), Coal::CopyBufferToImageEvent::CopyBufferToImageEvent(), Coal::CopyImageEvent::CopyImageEvent(), Coal::CopyImageToBufferEvent::CopyImageToBufferEvent(), handle_address_mode(), imageInfo(), Coal::MapImageEvent::MapImageEvent(), Coal::CPUKernelWorkGroup::readImageImplF(), and Coal::ReadWriteImageEvent::ReadWriteImageEvent().
size_t Image2D::width | ( | ) | const |
Width.
Definition at line 593 of file memobject.cpp.
References p_width.
Referenced by get_image_width(), handle_address_mode(), imageInfo(), Coal::KernelEvent::KernelEvent(), and Coal::CPUKernelWorkGroup::readImageImplF().
cl_image_format Coal::Image2D::p_format [private] |
Definition at line 242 of file memobject.h.
Referenced by channels(), element_size(), format(), Image2D(), imageInfo(), and pixel_size().
size_t Coal::Image2D::p_height [private] |
Definition at line 241 of file memobject.h.
Referenced by height().
size_t Coal::Image2D::p_row_pitch [private] |
Definition at line 241 of file memobject.h.
Referenced by Image2D(), and row_pitch().
size_t Coal::Image2D::p_width [private] |
Definition at line 241 of file memobject.h.
Referenced by width().