Skip to content

Halide::BoundaryConditions::repeat_edge: How to repeat left, bottom, right, and top elemets of Buffer instead of only Bottom and right? #8208

Answered by abadams
FabianSchuetze asked this question in Q&A
Discussion options

You must be logged in to vote

repeat_edge will pad on all sides. However, unlike ReplicationPad, repeat_edge also preserves the coordinate system in that f(x, y) before = f(x, y) after if (x, y) is in-bounds. So (0, 0) before is still (0, 0) after, and I think that might be what's tripping you up. To match ReplicationPad, try adding a translation:

Func f = repeat_edge(input);
Func translate;
translate(x, y) = f(x-1, y-1);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@FabianSchuetze
Comment options

Answer selected by FabianSchuetze
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants