Fix: Border bicubic interpolation is wrong around edges
The BLI bicubic interpolation function with border boundary is wrong around edges. It returns zero, where interpolated values should exist. This is due to a wrong early exit condition, where only a 2x2 window is assumed instead of the 4x4 window considered by bicubic interpolation. To fix this, assume a 2 pixel region in the early exit condition for both directions. Pull Request: https://projects.blender.org/blender/blender/pulls/131320
This commit is contained in:
@@ -174,11 +174,11 @@ BLI_INLINE void bicubic_interpolation(const T *src_buffer,
|
||||
int iv = int(floor(v));
|
||||
|
||||
/* Sample area entirely outside image in border mode? */
|
||||
if (wrap_u == InterpWrapMode::Border && (iu + 1 < 0 || iu > width - 1)) {
|
||||
if (wrap_u == InterpWrapMode::Border && (iu + 2 < 0 || iu > width)) {
|
||||
memset(output, 0, size_t(components) * sizeof(T));
|
||||
return;
|
||||
}
|
||||
if (wrap_v == InterpWrapMode::Border && (iv + 1 < 0 || iv > height - 1)) {
|
||||
if (wrap_v == InterpWrapMode::Border && (iv + 2 < 0 || iv > height)) {
|
||||
memset(output, 0, size_t(components) * sizeof(T));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user