diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-08-27 19:50:40 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-08-27 19:50:40 +0300 |
commit | 3ec81b814c995b585f19c97cf87fee5b7195382b (patch) | |
tree | 96cbd444cb74192e26656315b54519725b667a48 /source/blender/compositor/intern/COM_MemoryBuffer.cpp | |
parent | 9b3fa880a5d567a45215c464764f089aa3e77347 (diff) |
Fix T45617: Map UV node produces image artifacts
Basically filtering was happening twice, first time by applying weights of EWA
filter itself and then by applying subpixel offset while reading pixel values.
Diffstat (limited to 'source/blender/compositor/intern/COM_MemoryBuffer.cpp')
-rw-r--r-- | source/blender/compositor/intern/COM_MemoryBuffer.cpp | 38 |
1 files changed, 4 insertions, 34 deletions
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp index 2dbf0a6aa46..162e08a95a6 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp @@ -195,45 +195,15 @@ void MemoryBuffer::addPixel(int x, int y, const float color[4]) } } -typedef struct ReadEWAData { - MemoryBuffer *buffer; - PixelSampler sampler; - float ufac, vfac; -} ReadEWAData; - static void read_ewa_pixel_sampled(void *userdata, int x, int y, float result[4]) { - ReadEWAData *data = (ReadEWAData *) userdata; - switch (data->sampler) { - case COM_PS_NEAREST: - data->buffer->read(result, x, y); - break; - case COM_PS_BILINEAR: - data->buffer->readBilinear(result, - (float)x + data->ufac, - (float)y + data->vfac); - break; - case COM_PS_BICUBIC: - /* TOOD(sergey): no readBicubic method yet */ - data->buffer->readBilinear(result, - (float)x + data->ufac, - (float)y + data->vfac); - break; - default: - zero_v4(result); - break; - } + MemoryBuffer *buffer = (MemoryBuffer *) userdata; + buffer->read(result, x, y); } -void MemoryBuffer::readEWA(float *result, const float uv[2], const float derivatives[2][2], PixelSampler sampler) +void MemoryBuffer::readEWA(float *result, const float uv[2], const float derivatives[2][2]) { BLI_assert(this->m_datatype == COM_DT_COLOR); - ReadEWAData data; - data.buffer = this; - data.sampler = sampler; - data.ufac = uv[0] - floorf(uv[0]); - data.vfac = uv[1] - floorf(uv[1]); - int width = this->getWidth(), height = this->getHeight(); /* TODO(sergey): Render pipeline uses normalized coordinates and derivatives, * but compositor uses pixel space. For now let's just divide the values and @@ -248,6 +218,6 @@ void MemoryBuffer::readEWA(float *result, const float uv[2], const float derivat true, uv_normal, du_normal, dv_normal, read_ewa_pixel_sampled, - &data, + this, result); } |