Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning of CL_UNORM_INT8 for cl_image_format.image_channel_data_type, and its diffrence with other data types

Tags:

gpgpu

opencl

everyone! I'm not really clear about the meaning of CL_UNORM_INT8, which is one of the available choice of value of cl_image_format.image_channel_data_type; what's specific about this type, and what's its difference with CL_UNSIGNED_INT8?

like image 232
Hawk Rong Avatar asked Mar 15 '23 06:03

Hawk Rong


1 Answers

As far as storage is concerned, these types are identical. In both cases, each pixel channel value will be stored as an 8-bit integer, with values in the range 0-255. The difference comes when reading/writing the image from a kernel.

For the CL_UNSIGNED_INT8 type, you will use the read_imageui and write_imageui functions to access the image. These functions will return (or accept) an unsigned integer, with values in the same range as the storage type.

For the CL_UNORM_INT8 type, you will use the read_imagef and write_imagef functions to access to the image. These functions will return (or accept) a normalised floating point value, in the range 0.0f - 1.0f. Some devices (e.g. most GPUs) have hardware support for normalising texture values, so the conversion between integer and normalised floating point values will be very efficient.

like image 156
jprice Avatar answered Apr 28 '23 03:04

jprice