6 Replies Latest reply on Sep 14, 2014 2:41 AM by ahmed

    A few questions about images


      What are the size limits of image memory on AMD cards?  I have an 8 MB image

      that I would like to work with.


      Also, suppose I want to do a YUV transform on an image.

      Since images are read only or write only, is it faster to:

      1) use single buffer in global memory


      2) create two images, one source read only, and one destination write only, and do

      YUV transform from source to destination


      Also, can I convert a write only image to a read only image?



        • Re: A few questions about images

          8MB are fine. IIRC someone reported problems with allocating 1GB image.


          you don't need "convert" image from read to write only. the restriction is on for single kernel invocation. you can use image as read in first invocation and as write in next. just to be sure that you mark image with proper flags during creation (CL_MEM_READ_ONLY, CL_WRITE_ONLY, CL_MEM_READ_WRITE).

            • Re: A few questions about images

              THanks.  So, if I create two images with CL_MEM_READ_WRITE flag, then I can


              1) run kernel 1, read from image1 and write to image 2

              2) run kernel 2, read from image 2, and write to image1



                • Re: A few questions about images


                  • Re: A few questions about images

                    Yes. A CL_MEM_READ_WRITE image can be read from or written to from a kernel but not both (in OpenCL 1.x; in OpenCL 2.x it is possible to do both).


                    Maximum device image size is available using CL_DEVICE_IMAGE2D_MAX_WIDTH & CL_DEVICE_IMAGE2D_MAX_HEIGHT. The OpenCL 1.1 specification says the minimum is 2K x 2K. Modern devices provide 4K, 8K, 16K or even 32K pixel width and/or tall images (but you'll likely run out of memory if you try both dimensions that large at once).


                    Since OpenCL doesn't have a YUV image type and YUV layout are frequently sub-sampled in chroma and/or have planar layouts, you'll likely need a Buffer (not an Image) to store them.

                      • Re: A few questions about images

                        Thanks, guys. @dithermaster: there is no subsampling involved: this is the first step in jpeg 2000 compression:

                        RGB channels are converted to YUV. So, I should be able to use an image.

                        One twist: after RGB to YUV conversion, each channel is processed separately by subsequent kernels..


                        So, it looks like I need 4 images:


                        RGB read only

                        Y greyscale write only

                        U greyscale write only

                        V greyscale write only


                        The kernel will read (r,g,b) from the source image and store (y,u,v) to the three images respectively.


                        Next step is a wavelet transform, but each channel is transformed separately. So, my second kernel will treat

                        the three Y,U and V images as read only, and transform to another set of three images.

                  • Re: A few questions about images


                    Please, if there is someone help me to find BOOKS about (Image Processing) working with AMD Card and AMPC++ Library