OpenCL™规范 5.3.1.1. 图像格式描述符

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 and image_channel_order must be a power of two.

  • ​image_channel_data_type描述了信道数据类型的大小。支持的值列表在“图像通道数据类型”表中进行了说明。由image_channel_data_type和image_channel _order确定的每个元素的位数必须是2的幂。

Table 24. List of supported Image Channel Order Values

表24 支持的图像通道顺序值列表

Image Channel Order

图像通道顺序

Description

描述

CL_RCL_A,

Single channel image formats where the single channel represents a RED or ALPHA component.

单通道图像格式,其中单通道表示RED或ALPHA组件。

CL_DEPTH

missing before version 2.0.

2.0版本之前丢失。

Also supported if the cl_khr_depth_images extension is supported.


如果支持cl_khr_depth_images扩展名,也支持。

A single channel image format where the single channel represents a DEPTH component.

单通道图像格式,其中单通道表示DEPTH组件。

CL_LUMINANCE

A single channel image format where the single channel represents a LUMINANCE value. The LUMINANCE value is replicated into the REDGREEN, and BLUE components.

单通道图像格式,其中单通道表示亮度值。LUMINANCE值将复制到“红色”、“绿色”和“蓝色”组件中。

CL_INTENSITY,

A single channel image format where the single channel represents an INTENSITY value. The INTENSITY value is replicated into the REDGREENBLUE, and ALPHA components.

单通道图像格式,其中单通道表示强度值。INTENSITY值被复制到RED、GREEN、BLUE和ALPHA组件中。

CL_RGCL_RA

Two channel image formats. The first channel always represents a RED component. The second channel represents a GREEN component or an ALPHA component.

双通道图像格式。第一个通道始终表示RED组件。第二通道表示绿色成分或ALPHA成分。

CL_Rx

missing before version 1.1.

在版本1.1之前丢失。

A two channel image format, where the first channel represents a RED component and the second channel is ignored.

双通道图像格式,其中第一个通道表示RED分量,第二个通道被忽略。

CL_DEPTH_STENCIL

provided by the cl_khr_gl_depth_images extension.

由cl_khr_gl_depth_images扩展提供。

A two channel image format, where the first channel represents a DEPTH component and the second channel represents a stencil component. This format can only be used if the image channel data type is CL_UNORM_INT24 or CL_FLOAT.

​双通道图像格式,其中第一个通道表示DEPTH组件,第二个通道表示模具组件。只有当图像通道数据类型为CL_UNORM_INT24或CL_FLOAT时,才能使用此格式。

See Restrictions on Depth/Stencil Images.


请参见深度/模具图像的限制。

CL_RGB

A three channel image format, where the three channels represent REDGREEN, and BLUE components.

三通道图像格式,其中三个通道表示红色、绿色和蓝色分量。

CL_RGx

missing before version 1.1.

在版本1.1之前丢失。

A three channel image format, where the first two channels represent RED and GREEN components and the third channel is ignored.

三通道图像格式,其中前两个通道表示红色和绿色分量,第三个通道被忽略。

CL_RGBACL_ARGBCL_BGRACL_ABGR

CL_ABGR is missing before version 2.0.

版本2.0之前缺少CL_ABGR。

Four channel image formats, where the four channels represent REDGREENBLUE, and ALPHA components.

四种通道图像格式,其中四种通道表示红色、绿色、蓝色和ALPHA分量。

CL_RGBx

missing before version 1.1.

在版本1.1之前丢失。

A four channel image format, where the first three channels represent REDGREEN, and BLUE components and the fourth channel is ignored.

四通道图像格式,其中前三个通道表示红色、绿色和蓝色分量,第四个通道被忽略。

CL_sRGB

missing before version 2.0.

2.0版本之前丢失。

A three channel image format, where the three channels represent REDGREEN, and BLUE components in the sRGB color space.

三通道图像格式,其中三个通道表示sRGB颜色空间中的红色、绿色和蓝色分量。

CL_sRGBACL_sBGRA

missing before version 2.0.

2.0版本之前丢失。

Four channel image formats, where the first three channels represent REDGREEN, and BLUE components in the sRGB color space. The fourth channel represents an ALPHA component.

四通道图像格式,其中前三个通道表示sRGB颜色空间中的红色、绿色和蓝色分量。第四个通道表示ALPHA组件。

CL_sRGBx

missing before version 2.0.

2.0版本之前丢失。

A four channel image format, where the three channels represent REDGREEN, and BLUE components in the sRGB color space. The fourth channel is ignored.

四通道图像格式,其中三个通道表示sRGB颜色空间中的红色、绿色和蓝色分量。第四个通道被忽略。

Table 25. List of supported Image Channel Data Types

表25 支持的图像通道数据类型列表

Image Channel Data TypeDescription

CL_SNORM_INT8

Each channel component is a normalized signed 8-bit integer value

每个通道分量都是一个标准化的带符号8位整数值

CL_SNORM_INT16

Each channel component is a normalized signed 16-bit integer value

每个通道分量都是一个标准化的有符号16位整数值

CL_UNORM_INT8

Each channel component is a normalized unsigned 8-bit integer value

每个通道分量都是一个标准化的无符号8位整数值

CL_UNORM_INT16

Also supported if the cl_khr_depth_images extension is supported.
如果支持cl_khr_depth_images扩展名,也支持。

Each channel component is a normalized unsigned 16-bit integer value

每个通道分量都是一个标准化的无符号16位整数值

CL_UNORM_SHORT_565

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。

CL_UNORM_SHORT_555

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。

CL_UNORM_INT_101010

Represents a normalized x-10-10-10 4-channel xRGB image. The channel order must be CL_RGB or CL_RGBx.


表示标准化的x-10-10-10 4通道xRGB图像。通道顺序必须是CL_RGB或CL_RGBx。

CL_UNORM_INT_101010_2

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.


表示标准化的10-10-10-2四通道RGBA图像。通道顺序必须为CL_RGBA。

CL_SIGNED_INT8

Each channel component is an unnormalized signed 8-bit integer value

每个通道组件都是一个未规范化的带符号8位整数值

CL_SIGNED_INT16

Each channel component is an unnormalized signed 16-bit integer value

每个通道分量都是一个未规范化的有符号16位整数值

CL_SIGNED_INT32

Each channel component is an unnormalized signed 32-bit integer value

每个通道组件都是一个未规范化的有符号32位整数值

CL_UNSIGNED_INT8

Each channel component is an unnormalized unsigned 8-bit integer value

每个通道组件都是一个未规范化的无符号8位整数值

CL_UNSIGNED_INT16

Each channel component is an unnormalized unsigned 16-bit integer value

每个通道分量都是一个未规范化的无符号16位整数值

CL_UNORM_INT24

provided by the cl_khr_gl_depth_images extension.

由cl_khr_gl_depth_images扩展提供。

Each channel component is a normalized unsigned 24-bit integer value

每个通道分量都是一个标准化的无符号24位整数值

CL_UNSIGNED_INT32

Each channel component is an unnormalized unsigned 32-bit integer value

每个通道组件都是一个未规范化的无符号32位整数值

CL_HALF_FLOAT

Each channel component is a 16-bit half-float value

每个通道组件都是一个16位半浮点值

CL_FLOAT

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_565CL_UNORM_SHORT_555CL_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 clCreateImageclCreateImageWithPropertiesclCreateImage2D, 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内存对象。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值