Results 1 to 4 of 4

Thread: Convolution with Wrapped Edges

  1. #1
    Junior Member
    Join Date
    Nov 2009

    Convolution with Wrapped Edges

    Hi everyone,

    I'm trying to implement a simple iterated convolution kernel with edge wrapping. I have a few questions about how to do this most effectively.

    What is the best way to implement edge wrapping in a kernel? Should I use modulo? Should I limit my buffers to widths/heights that are powers of two and use a bitwise and? Or should I avoid this altogether and use a larger buffer and copy the left edge to the right side and vice versa? If so, what's the best way to do this?

  2. #2

    Re: Convolution with Wrapped Edges

    How about using a sampler variable that has CLK_ADDRESS_REPEAT set?

  3. #3
    Senior Member
    Join Date
    Jul 2009
    Northern Europe

    Re: Convolution with Wrapped Edges

    Paul is right if your input is an image. Just set the sampler to wrap. If you are using buffers and/or blocking into local memory you'll have to handle it yourself. In the case of using local memory you can just load the extra data for the edges. In general you'll want to have separate code-paths for the edge case/body case so you don't pay the conditional/modulo overhead on every calculation.)

  4. #4

    Re: Convolution with Wrapped Edges


    I'm in this situation. I work with buffers of 3D image (~maybe~ will working with image2D, 3D later) and I want to know if
    - using "gentype fmod (gentype x, gentype y)" will be fast enough? What"s the cost?
    - using array(local, or global) with border value will be better than fmod ?

    Exemple for border value with image[5][8] :
    arrayY[5]={0, 8, 16,24,32}

    What is your knowledge/experience ?
    Thank you!

Similar Threads

  1. Block edges updates
    By arthur.sw in forum OpenCL - parallel programming of heterogeneous systems
    Replies: 8
    Last Post: 04-08-2011, 12:10 AM
  2. Re: block edges
    By arthur.sw in forum OpenCL - parallel programming of heterogeneous systems
    Replies: 0
    Last Post: 04-07-2011, 05:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts