Let's say I want to do an operation (e.g. addition) between two images where each pixel in image Img1 has a corresponding pixel in image Img2. The correspondence vector is stored in a tuple Delta. Basically, something like this:
Img(x, y) = Img1(x, y) + Img2(x + Delta[0](x, y), y + Delta[1](x, y));
This is a memory gather operation. What would be the best way to do describe such a pattern in Halide? How to schedule it?
Delta( c, x, y ) = select( c == 0, xdelta, ydelta ); Delta.unroll(c);That at least puts the two values next to each other in memory.