3 Replies Latest reply on Dec 11, 2010 11:16 AM by nou

    Image convolution

    Manticore

           In all the presentations,the image's width and length are multiple of work group sizes. What do you do when this is not the case?Do you send all the image and process only the (height-height%work_size_y)*(width-width%work_size_x) part of the image?I ask because i want to optimise some of the functions in OpenCV,like cvSobel.If i apply the function on several adjacent ROIs there will be strips of pixels at the borders that haven't been processed.

      Thank you

        • Image convolution
          nou

          just execute smallest multiple of workgroup size which is equal or greater than image size. and use clamp addresation. after execution just throw away result outside of original size.

            • Image convolution
              Manticore

              Thank you for the response. But i don't quite understand what is the clamp addressation.I use extra work groups for the remainders of the image?if so, the local memory used by the work group will be,for a width remainder,(width_remainder+filter_size-1)*(work_group_size_y+filter_size-1)?

                • Image convolution
                  nou

                  read documentation about samplers. if you don't use images then you must image coordinate clamp manualy.

                  size of workgroup must be same for whole NDRange. for example you want process image with size 100x100. and you use workgroup size 16x16. then you use global size 112x112. output image will be 112x112 too and after that you run your kernel you just crop it to original size. you must of course clamp coordinate so you do not read outside of source image.