diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-01-20 12:46:21 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-01-20 13:02:35 +0300 |
commit | 02fad7dca4adc5e248440c98293cdf713f25d39d (patch) | |
tree | d7fa2006fe00f04453645612edb437369409a1a2 | |
parent | bffd824800d34166d617e4f6c22880d1583d880c (diff) |
Fix T42844: Compositor scale offset
Different interpolation methods in compositor could lead to 0.5 pixel offset in
final renders. This is because of some inconsistency in integer coordinates
which might mean pixel corner or pixel center.
Should be all fine now.
5 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h index 70b4dec2bed..320de3d67cd 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.h +++ b/source/blender/compositor/intern/COM_MemoryBuffer.h @@ -259,7 +259,7 @@ public: float u = x; float v = y; this->wrap_pixel(u, v, extend_x, extend_y); - BLI_bilinear_interpolation_fl(this->m_buffer, result, this->m_width, this->m_height, this->m_num_channels, u, v); + BLI_bilinear_interpolation_fl(this->m_buffer, result, this->m_width, this->m_height, this->m_num_channels, u - 0.5f, v - 0.5f); } void readEWA(float *result, const float uv[2], const float derivatives[2][2], PixelSampler sampler); diff --git a/source/blender/compositor/operations/COM_ImageOperation.cpp b/source/blender/compositor/operations/COM_ImageOperation.cpp index 2733c483146..ff0ffe27b42 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.cpp +++ b/source/blender/compositor/operations/COM_ImageOperation.cpp @@ -119,10 +119,10 @@ static void sampleImageAtLocation(ImBuf *ibuf, float x, float y, PixelSampler sa nearest_interpolation_color(ibuf, NULL, color, x, y); break; case COM_PS_BILINEAR: - bilinear_interpolation_color(ibuf, NULL, color, x, y); + bilinear_interpolation_color(ibuf, NULL, color, x - 0.5f, y - 0.5f); break; case COM_PS_BICUBIC: - bicubic_interpolation_color(ibuf, NULL, color, x, y); + bicubic_interpolation_color(ibuf, NULL, color, x - 0.5f, y - 0.5f); break; } } @@ -133,10 +133,10 @@ static void sampleImageAtLocation(ImBuf *ibuf, float x, float y, PixelSampler sa nearest_interpolation_color(ibuf, byte_color, NULL, x, y); break; case COM_PS_BILINEAR: - bilinear_interpolation_color(ibuf, byte_color, NULL, x, y); + bilinear_interpolation_color(ibuf, byte_color, NULL, x - 0.5f, y - 0.5f); break; case COM_PS_BICUBIC: - bicubic_interpolation_color(ibuf, byte_color, NULL, x, y); + bicubic_interpolation_color(ibuf, byte_color, NULL, x - 0.5f, y - 0.5f); break; } rgba_uchar_to_float(color, byte_color); diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.cpp b/source/blender/compositor/operations/COM_MovieClipOperation.cpp index 9a184ae1216..2ed498d1303 100644 --- a/source/blender/compositor/operations/COM_MovieClipOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieClipOperation.cpp @@ -103,10 +103,10 @@ void MovieClipBaseOperation::executePixelSampled(float output[4], float x, float nearest_interpolation_color(ibuf, NULL, output, x, y); break; case COM_PS_BILINEAR: - bilinear_interpolation_color(ibuf, NULL, output, x, y); + bilinear_interpolation_color(ibuf, NULL, output, x - 0.5f, y - 0.5f); break; case COM_PS_BICUBIC: - bicubic_interpolation_color(ibuf, NULL, output, x, y); + bicubic_interpolation_color(ibuf, NULL, output, x - 0.5f, y - 0.5f); break; } } diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp index 23fba5a7999..35ab20fb122 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp @@ -54,10 +54,10 @@ void MultilayerColorOperation::executePixelSampled(float output[4], float x, flo nearest_interpolation_color(this->m_buffer, NULL, output, x, y); break; case COM_PS_BILINEAR: - bilinear_interpolation_color(this->m_buffer, NULL, output, x, y); + bilinear_interpolation_color(this->m_buffer, NULL, output, x - 0.5f, y - 0.5f); break; case COM_PS_BICUBIC: - bicubic_interpolation_color(this->m_buffer, NULL, output, x, y); + bicubic_interpolation_color(this->m_buffer, NULL, output, x - 0.5f, y - 0.5f); break; } } diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cpp b/source/blender/compositor/operations/COM_RenderLayersProg.cpp index f1990453fc6..8e778e44a79 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersProg.cpp @@ -104,11 +104,11 @@ void RenderLayersBaseProg::doInterpolation(float output[4], float x, float y, Pi } case COM_PS_BILINEAR: - BLI_bilinear_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x, y); + BLI_bilinear_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x - 0.5f, y - 0.5f); break; case COM_PS_BICUBIC: - BLI_bicubic_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x, y); + BLI_bicubic_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x - 0.5f, y - 0.5f); break; } } |