HDK
|
#include <CE_Image.h>
Public Types | |
enum | StorageType { INT8 = 0, INT16, INT32, FLOAT16, FLOAT32 } |
Public Member Functions | |
CE_Image () | |
Creates a new uninitialized object. Call setSize() to allocate memory. More... | |
~CE_Image () | |
bool | copy (const CE_Image &other, bool force=false) |
void | swap (CE_Image &other) |
Swaps the backing buffers between the two objects. More... | |
SYS_FORCE_INLINE bool | isValid () const |
Returns true if this buffer is allocated and usable. More... | |
void | setSize (int width, int height, int channels, StorageType storage) |
Resizes this buffer; allocated memory is uninitialized. More... | |
void | match (const CE_Image &other) |
template<typename T > | |
void | initFromVoxels (const UT_VoxelArray< T > &src) |
void | destroy () |
void | readIn (const void *src, bool blocking=true) |
void | writeOut (void *dst, bool blocking=true) const |
template<typename T > | |
void | matchAndCopyToVoxels (UT_VoxelArray< T > &dest) const |
const cl::Buffer & | buffer () const |
Returns this buffer descriptor. More... | |
int64 | totalMemory () const |
Total memory in bytes needed to hold this image's data. More... | |
int | getWidth () const |
Returns the image's width. More... | |
int | getHeight () const |
Returns the image's height. More... | |
int | getChannels () const |
Returns the number of channels per pixel. More... | |
StorageType | getStorage () const |
Identifies the type of data stored for each channel of every pixel. More... | |
cl::KernelFunctor | bind (cl::Kernel k) const |
Bind a 2D kernel with one work item per pixel. More... | |
void | setValue (const UT_Vector4F &val) |
Sets this buffer to the given constant value. More... | |
bool | indexToPos (int x, int y, int z, UT_Vector3F &pos) const |
Static Public Member Functions | |
static const char * | getName (StorageType) |
Protected Attributes | |
cl::Buffer | myBuffer |
OpenCL descriptor for the actual GPU buffer. More... | |
int | myWidth |
Sizes of the buffer. More... | |
int | myHeight |
int | myChannels |
StorageType | myStorage |
This class represents OpenCL storage of an image (a 2-dimensional rectangular grid of pixels with 1-4 floating point channels).
Definition at line 22 of file CE_Image.h.
Type of data stored in this buffer. This enum must be in sync with storage types defined in the imx.h OpenCL header.
Enumerator | |
---|---|
INT8 | |
INT16 | |
INT32 | |
FLOAT16 | |
FLOAT32 |
Definition at line 27 of file CE_Image.h.
CE_Image::CE_Image | ( | ) |
Creates a new uninitialized object. Call setSize() to allocate memory.
CE_Image::~CE_Image | ( | ) |
cl::KernelFunctor CE_Image::bind | ( | cl::Kernel | k | ) | const |
Bind a 2D kernel with one work item per pixel.
|
inline |
Returns this buffer descriptor.
Definition at line 96 of file CE_Image.h.
Copies data into this image from other. If sizes are different between the two,
void CE_Image::destroy | ( | ) |
Releases memory held by this buffer. setSize() must be called to make this object usable again.
|
inline |
Returns the number of channels per pixel.
Definition at line 117 of file CE_Image.h.
|
inline |
Returns the image's height.
Definition at line 111 of file CE_Image.h.
|
static |
|
inline |
Identifies the type of data stored for each channel of every pixel.
Definition at line 123 of file CE_Image.h.
|
inline |
Returns the image's width.
Definition at line 105 of file CE_Image.h.
bool CE_Image::indexToPos | ( | int | x, |
int | y, | ||
int | z, | ||
UT_Vector3F & | pos | ||
) | const |
Converts the given voxel coordinates to the normalized [0..1]^3 space in the same way as done in UT_VoxelArray.
void CE_Image::initFromVoxels | ( | const UT_VoxelArray< T > & | src | ) |
Resizes this buffer to match the voxel array and copies its data into the image. Z-resolution of src should be 1. Number of channels is set based on T (which can be float, UT_Vector2F, UT_Vector3F, UT_Vector4F, or int64).
|
inline |
Returns true if this buffer is allocated and usable.
Definition at line 55 of file CE_Image.h.
Resizes this buffer to match the other image. Allocated memory is not initialized.
void CE_Image::matchAndCopyToVoxels | ( | UT_VoxelArray< T > & | dest | ) | const |
Resizes dest to match dimensions of this image (its Z-resolution is set to 1). Number of channels in this image should equal tuple size of T. This function also downloads the image's data into dest.
Upload data into this image from src. If blocking is true, the copying will be complete by the time the function returns; otherwise, the operation is simply queued up.
void CE_Image::setSize | ( | int | width, |
int | height, | ||
int | channels, | ||
StorageType | storage | ||
) |
Resizes this buffer; allocated memory is uninitialized.
void CE_Image::setValue | ( | const UT_Vector4F & | val | ) |
Sets this buffer to the given constant value.
int64 CE_Image::totalMemory | ( | ) | const |
Total memory in bytes needed to hold this image's data.
Download data from this image into dst. If blocking is true, the copying will be complete by the time the function returns; otherwise, the operation is only queued up.
|
protected |
OpenCL descriptor for the actual GPU buffer.
Definition at line 140 of file CE_Image.h.
|
protected |
Definition at line 144 of file CE_Image.h.
|
protected |
Definition at line 143 of file CE_Image.h.
|
protected |
Definition at line 145 of file CE_Image.h.
|
protected |
Sizes of the buffer.
Definition at line 142 of file CE_Image.h.