Only problem : my Images are 16-bits per channel images…
Is there anyone that has an idea or an example…of let’s say an opencl example which from an unsigned short * which contains the pixels values ( unsigned short Tab_Pixels[WH3]) ) and proceeds it in an program…to for example add some contrast…
It does not use unsigned short *, but anyway in OpenCL 1.0 (not in 1.1) you can’t write in an unsigned short buffer without the “Byte adressable store” extension. So perhaps you’ll have to put them as integer.
Does section 5.2.4.1 of the 1.0 Specification Revision 48, “Image Format Descriptor,” help you?
Host Code:
If you have an image, you should also have a image format descriptor.
Set the image_channel_data_type to be CL_UNSIGNED_INT16, inside this descriptor.
If you have a 16-bit / channel RGBA image and want to process these pixel values as floating-point values in your OpenCL kernel then create the image with
In your CL kernel, you call read_imagef to read from this image. The implementation will read 16-bit/channel pixel values and convert them to float. Similarly write_imagef will take a float4 color value and convert them to the appropriate channel format which in this case will be 16-bits/channel.
If you want to read the data as integer values instead then
image_format.image_channel_data_type = CL_UNSIGNED_INT16 or CL_SIGNED_INT16 depending on whether the data you want to read is an unsigned or signed 16-bit integer.
In the CL kernel you call read_imageui or read_imagei which will return a 4-component integer vector. Similarly write_imageui or write_imagei will take a 4-component integer vector and convert them to the appropriate channel format.