The Khronos Group - a non-profit industry consortium to develop, publish and promote open standard, royalty-free media authoring and acceleration standards for desktop and handheld devices, combined with conformance qualification programs for platform and device interoperability.

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

16bits per channel RGB Image

Hello,

I'm trying to process Image in OpenCl...

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[W*H*3]) ) and proceeds it in an program...to for example add some contrast...

Re: 16bits per channel RGB Image

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.

Re: 16bits per channel RGB Image

Originally Posted by sapym

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[W*H*3]) ) and proceeds it in an program...to for example add some contrast...

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.