Clover Git
OpenCL 1.1 software implementation
Public Member Functions | Static Public Member Functions | Private Attributes

Coal::Image2D Class Reference

2D image More...

#include <memobject.h>

Inheritance diagram for Coal::Image2D:
Collaboration diagram for Coal::Image2D:

List of all members.

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

Detailed Description

2D image

Definition at line 193 of file memobject.h.


Constructor & Destructor Documentation

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.

Parameters:
ctxparent Coal::Context
widthwidth of the image
heightheight of the image
row_pitchnumber of bytes in a row of pixels. If 0, defaults to width * pixel_size()
formatimage format
host_ptrhost pointer
flagsmemory flags
errcode_retreturn code

Definition at line 474 of file memobject.cpp.

References format(), p_format, p_row_pitch, pixel_size(), and row_pitch().

Referenced by type().


Member Function Documentation

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
size_t Image2D::height ( ) const
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);
Parameters:
param_nameName of the property to retrieve
param_value_sizeSize of the application-allocated buffer in which to put the value.
param_valuePointer to an application-allocated buffer where the property data will be stored. Ignored if NULL.
param_value_size_retSize of the value retrieved, ignored if NULL.
Returns:
CL_SUCCESS in case of success, otherwise a CL error code.

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_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_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]
size_t Image2D::width ( ) const

Member Data Documentation

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().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines