zoukankan      html  css  js  c++  java
  • image_channel_data_type含义

    在穿件image对象的时候,需要传入一个cl_image_format参数,该参数结果包含image_channel_orderimage_channel_data_type两个成员。前一个成员表示的是image对象含有的内容及其顺序,如下表
    i49I7q.jpg
    这个很好理解,表示是的image对象的数据表示了哪些图像通道内容以及其顺序。
    然后image_channel_data_type的可用值如下:
    i49vu9.jpg
    这个成员表示了两层含义:

    • 后面部分表示每一个channel的数据在实际物理内存中是如何存储,比如INT8, SHORT_565, FLOAT等,可能更加实际一点的理解的话就是:如果把这个image对象的数据用在host上处理的话,应该按照什么样的数据类型来解读这些数据。
    • 前面部分表示这些数据要以什么样的格式来在kernel中读写,比如UNORM则表示要以0~1.0范围的浮点来读写,对应read_imagefwrite_imagef, SIGNED则表示要以对应的有符号整数范围来读写,对应read_imageiwrite_imageiHALF则表示以half float来读写,对应read_imagefwrite_imagef

    例如:

    • CL_UNORM_INT8:数据的实际物理存储为8位的int类型,但是在kernel中应该以read_imagefwrite_imagef来进行读写操作,且值的范围为0~1.0(如果是SNORM则为-1.0~1.0). 而这之间的转换则由GPU中专用的硬件完成,效率相当高
    • CL_SIGNED_INT16:数据的实际物理存储为16为的int,在kernel中以以read_imageiwrite_imagei来进行读写操作.

    参考

    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.

  • 相关阅读:
    jsfl 常用自定义方法
    jsfl 常用方法
    Java 跨平台原理
    JDK、JRE 和 JVM 的区别
    win10 中安装 JDK8 以及环境配置
    JDK 14 都已经发布了,Java 8 依然是我的最爱
    DOS 命令大全用法详解
    《Java程序设计基础》 第4章手记
    堆和栈的区别
    CC#JavaPython 基本数据类型比较
  • 原文地址:https://www.cnblogs.com/willhua/p/9899120.html
Copyright © 2011-2022 走看看