5.3.1.1. Image Format Descriptor
5.3.1.1. 图像格式描述符
The cl_image_format image format descriptor structure describes an image format, and is defined as:
cl_image_format图像格式描述符结构描述图像格式,并定义为:
// Provided by CL_VERSION_1_0
typedef struct cl_image_format {
cl_channel_order image_channel_order;
cl_channel_type image_channel_data_type;
} cl_image_format;
-
image_channel_order specifies the number of channels and the channel layout i.e. the memory layout in which channels are stored in the image. Valid values are described in the Image Channel Order table.
-
image_channel_order指定通道的数量和通道布局,即在图像中存储通道的存储器布局。有效值在“图像通道顺序”表中进行了说明。
-
image_channel_data_type describes the size of the channel data type. The list of supported values is described in the Image Channel Data Types table. The number of bits per element determined by the
image_channel_data_type
andimage_channel_order
must be a power of two. -
image_channel_data_type描述了信道数据类型的大小。支持的值列表在“图像通道数据类型”表中进行了说明。由image_channel_data_type和image_channel _order确定的每个元素的位数必须是2的幂。
Image Channel Order 图像通道顺序 | Description 描述 |
---|---|
Single channel image formats where the single channel represents a 单通道图像格式,其中单通道表示RED或ALPHA组件。 | |
missing before version 2.0. 2.0版本之前丢失。 Also supported if the cl_khr_depth_images extension is supported. | A single channel image format where the single channel represents a 单通道图像格式,其中单通道表示DEPTH组件。 |
A single channel image format where the single channel represents a 单通道图像格式,其中单通道表示亮度值。LUMINANCE值将复制到“红色”、“绿色”和“蓝色”组件中。 | |
A single channel image format where the single channel represents an 单通道图像格式,其中单通道表示强度值。INTENSITY值被复制到RED、GREEN、BLUE和ALPHA组件中。 | |
Two channel image formats. The first channel always represents a 双通道图像格式。第一个通道始终表示RED组件。第二通道表示绿色成分或 | |
missing before version 1.1. 在版本1.1之前丢失。 | A two channel image format, where the first channel represents a 双通道图像格式,其中第一个通道表示RED分量,第二个通道被忽略。 |
provided by the 由cl_khr_gl_depth_images扩展提供。 | A two channel image format, where the first channel represents a 双通道图像格式,其中第一个通道表示DEPTH组件,第二个通道表示模具组件。只有当图像通道数据类型为CL_UNORM_INT24或CL_FLOAT时,才能使用此格式。 See Restrictions on Depth/Stencil Images. |
A three channel image format, where the three channels represent 三通道图像格式,其中三个通道表示红色、绿色和蓝色分量。 | |
missing before version 1.1. 在版本1.1之前丢失。 | A three channel image format, where the first two channels represent 三通道图像格式,其中前两个通道表示红色和绿色分量,第三个通道被忽略。 |
CL_RGBA, CL_ARGB, CL_BGRA, CL_ABGR CL_ABGR is missing before version 2.0. 版本2.0之前缺少CL_ABGR。 | Four channel image formats, where the four channels represent 四种通道图像格式,其中四种通道表示红色、绿色、蓝色和 |
missing before version 1.1. 在版本1.1之前丢失。 | A four channel image format, where the first three channels represent 四通道图像格式,其中前三个通道表示红色、绿色和蓝色分量,第四个通道被忽略。 |
missing before version 2.0. 2.0版本之前丢失。 | A three channel image format, where the three channels represent 三通道图像格式,其中三个通道表示sRGB颜色空间中的红色、绿色和蓝色分量。 |
missing before version 2.0. 2.0版本之前丢失。 | Four channel image formats, where the first three channels represent 四通道图像格式,其中前三个通道表示sRGB颜色空间中的红色、绿色和蓝色分量。第四个通道表示ALPHA组件。 |
missing before version 2.0. 2.0版本之前丢失。 | A four channel image format, where the three channels represent 四通道图像格式,其中三个通道表示sRGB颜色空间中的红色、绿色和蓝色分量。第四个通道被忽略。 |
Image Channel Data Type | Description |
---|---|
Each channel component is a normalized signed 8-bit integer value 每个通道分量都是一个标准化的带符号8位整数值 | |
Each channel component is a normalized signed 16-bit integer value 每个通道分量都是一个标准化的有符号16位整数值 | |
Each channel component is a normalized unsigned 8-bit integer value 每个通道分量都是一个标准化的无符号8位整数值 | |
Also supported if the cl_khr_depth_images extension is supported. | Each channel component is a normalized unsigned 16-bit integer value 每个通道分量都是一个标准化的无符号16位整数值 |
Represents a normalized 5-6-5 3-channel RGB image. The channel order must be CL_RGB or CL_RGBx. 表示标准化的5-6-5 3通道RGB图像。通道顺序必须是CL_RGB或CL_RGBx。 | |
Represents a normalized x-5-5-5 4-channel xRGB image. The channel order must be CL_RGB or CL_RGBx. 表示标准化的x-5-5-5 4通道xRGB图像。通道顺序必须是CL_RGB或CL_RGBx。 | |
Represents a normalized x-10-10-10 4-channel xRGB image. The channel order must be CL_RGB or CL_RGBx. | |
missing before version 2.1. 2.1版之前缺失。 | Represents a normalized 10-10-10-2 four-channel RGBA image. The channel order must be CL_RGBA. |
Each channel component is an unnormalized signed 8-bit integer value 每个通道组件都是一个未规范化的带符号8位整数值 | |
Each channel component is an unnormalized signed 16-bit integer value 每个通道分量都是一个未规范化的有符号16位整数值 | |
Each channel component is an unnormalized signed 32-bit integer value 每个通道组件都是一个未规范化的有符号32位整数值 | |
Each channel component is an unnormalized unsigned 8-bit integer value 每个通道组件都是一个未规范化的无符号8位整数值 | |
Each channel component is an unnormalized unsigned 16-bit integer value 每个通道分量都是一个未规范化的无符号16位整数值 | |
provided by the 由cl_khr_gl_depth_images扩展提供。 | Each channel component is a normalized unsigned 24-bit integer value 每个通道分量都是一个标准化的无符号24位整数值 |
Each channel component is an unnormalized unsigned 32-bit integer value 每个通道组件都是一个未规范化的无符号32位整数值 | |
Each channel component is a 16-bit half-float value 每个通道组件都是一个16位半浮点值 | |
Also supported if the cl_khr_depth_images extension is supported. 如果支持cl_khr_depth_images扩展名,也支持。 | Each channel component is a single precision floating-point value 每个通道组件都是一个单精度浮点值 |
For example, to specify a normalized unsigned 8-bit / channel RGBA image, image_channel_order
= CL_RGBA, and image_channel_data_type
= CL_UNORM_INT8. The memory layout of this image format is described below:
例如,要指定标准化的无符号8位/通道RGBA图像,image_channel_order=CL_RGBA,image_channel_data_type=CL_UNORM_INT8。此图像格式的内存布局描述如下:
R | G | B | A | … |
with the corresponding byte offsets
具有相应的字节偏移
0 | 1 | 2 | 3 | … |
Similar, if image_channel_order
= CL_RGBA and image_channel_data_type
= CL_SIGNED_INT16, the memory layout of this image format is described below:
类似地,如果image_channel_order=CL_RGBA并且image_channel _data_type=CL_SIGNED_INT16,则该图像格式的存储器布局描述如下:
R | G | B | A | … |
with the corresponding byte offsets
具有相应的字节偏移
0 | 2 | 4 | 6 | … |
image_channel_data_type
values of CL_UNORM_SHORT_565, CL_UNORM_SHORT_555, CL_UNORM_INT_101010, and CL_UNORM_INT_101010_2 are special cases of packed image formats where the channels of each element are packed into a single unsigned short or unsigned int. For these special packed image formats, the channels are normally packed with the first channel in the most significant bits of the bitfield, and successive channels occupying progressively less significant locations. For CL_UNORM_SHORT_565, R is in bits 15:11, G is in bits 10:5 and B is in bits 4:0. For CL_UNORM_SHORT_555, bit 15 is undefined, R is in bits 14:10, G in bits 9:5 and B in bits 4:0. For CL_UNORM_INT_101010, bits 31:30 are undefined, R is in bits 29:20, G in bits 19:10 and B in bits 9:0. For CL_UNORM_INT_101010_2, R is in bits 31:22, G in bits 21:12, B in bits 11:2 and A in bits 1:0.
CL_UNORM_SHORT_565、CL_UNORS_SHORT_555、CL_UNORM_INT_101010和CL_UNORM_INT_101010_2的image_channel_data_type值是压缩图像格式的特殊情况,其中每个元素的通道被压缩成单个无符号短或无符号INT。对于这些特殊的压缩图像格式,通道通常与位字段的最高有效位中的第一个通道一起压缩,并且连续的通道逐渐占据较低有效位置。对于CL_UNORM_SHORT_565,R在位15:11,G在位10:5,B在位4:0。对于CL_UNORM_SHORT_555,位15未定义,R在位14:10,G在位9:5,B在位4:0。对于CL_UNORM_INT_101010,位31:30未定义,R在位29:20,G在位19:10,B在位9:0。对于CL_UNORM_INT_101010_2,R在位31:22,G在位21:12,B在位11:2,A在位1:0。
OpenCL implementations must maintain the minimum precision specified by the number of bits in image_channel_data_type
. If the image format specified by image_channel_order
, and image_channel_data_type
cannot be supported by the OpenCL implementation, then the call to clCreateImage, clCreateImageWithProperties, clCreateImage2D, or clCreateImage3D will return a NULL
memory object.
OpenCL实现必须保持由image_channel_data_type中的位数指定的最小精度。如果OpenCL实现不支持由image_channel_order和image_channel _data_type指定的图像格式,则对clCreateImage、clCreateImageWithProperties、clCreateImage 2D或clCreateImage3D的调用将返回NULL内存对象。