I need to move a region from a texture to another location. If the two blocks don't overlap, there's not problem there. I know Halide is the right solution but I can't figure out how to wait for a read before writing to an overlapping pixel... I could iterate one way or the other depending on the direction of the move, but I couldn't find a way to express that in Halide. Is Halide able to understand these subtleties?
Asked
Active
Viewed 129 times
1 Answers
1
The way to iterate in the reverse direction is to invert an RDom:
RDom range(0, width);
f(width - range.x) = g(width - range.x); // Copy value going from higher addresses to lower.
(Providing syntactic sugar for this has been on the todo list for a while. I think we've talked about scheduling directives for reversing loops as well. In that case, you'd use specialize to decide which direction handles the overlap correctly and dispatch to the appropriate schedule. At present however, the RDom subtracted from the extent method is probably the only option.)

Zalman Stern
- 3,161
- 12
- 18
-
Thank you! Is there any way to take a `Input
` from a generator and get the extents just from that, or do I have the pass the width/height as parameters? – Philippe Paré Apr 28 '17 at 12:09 -
With `Input
` you have to pass any extents as parameters. With `Input – Zalman Stern Apr 28 '17 at 16:00>` you should be able to use the extent accessors such as `width()`.