diff options
7 files changed, 15 insertions, 12 deletions
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp index 3b8fbd6d708..d227f9cc4bb 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp @@ -259,7 +259,10 @@ float clipuv(float x, float limit) return x; } -void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float dy) +/** + * \note \a sampler at the moment is either 'COM_PS_NEAREST' or not, other values won't matter. + */ +void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float dy, PixelSampler sampler) { const int width = this->getWidth(), height = this->getHeight(); @@ -280,7 +283,7 @@ void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float // Use a different radius based on interpolation switch, just enough to anti-alias when interpolation is off, // and slightly larger to make result a bit smoother than bilinear interpolation when interpolation is on // (minimum values: const float rmin = intpol ? 1.f : 0.5f;) - const float rmin = 1.5625f / ff2; + const float rmin = ((sampler != COM_PS_NEAREST) ? 1.5625f : 0.765625f) / ff2; imp2radangle(A, B, C, F, &a, &b, &th, &ecc); if ((b2 = b * b) < rmin) { if ((a2 = a * a) < rmin) { diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h index 5d0d9c97450..d176298578f 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.h +++ b/source/blender/compositor/intern/COM_MemoryBuffer.h @@ -202,7 +202,7 @@ public: - void readEWA(float result[4], float fx, float fy, float dx, float dy); + void readEWA(float result[4], float fx, float fy, float dx, float dy, PixelSampler sampler); /** * @brief is this MemoryBuffer a temporarily buffer (based on an area, not on a chunk) diff --git a/source/blender/compositor/intern/COM_SocketReader.h b/source/blender/compositor/intern/COM_SocketReader.h index 279ca8ebdb8..01e1403b021 100644 --- a/source/blender/compositor/intern/COM_SocketReader.h +++ b/source/blender/compositor/intern/COM_SocketReader.h @@ -88,7 +88,7 @@ protected: * @param dy * @param inputBuffers chunks that can be read by their ReadBufferOperation. */ - virtual void executePixel(float output[4], float x, float y, float dx, float dy) {} + virtual void executePixel(float output[4], float x, float y, float dx, float dy, PixelSampler sampler) {} public: inline void read(float *result, float x, float y, PixelSampler sampler) { @@ -97,8 +97,8 @@ public: inline void read(float *result, int x, int y, void *chunkData) { executePixel(result, x, y, chunkData); } - inline void read(float *result, float x, float y, float dx, float dy) { - executePixel(result, x, y, dx, dy); + inline void read(float *result, float x, float y, float dx, float dy, PixelSampler sampler) { + executePixel(result, x, y, dx, dy, sampler); } virtual void *initializeTileData(rcti *rect) { return 0; } diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cpp b/source/blender/compositor/operations/COM_DisplaceOperation.cpp index 39f0ac7874b..31608c88274 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.cpp +++ b/source/blender/compositor/operations/COM_DisplaceOperation.cpp @@ -95,8 +95,8 @@ void DisplaceOperation::executePixel(float output[4], int x, int y, void *data) dxt = signf(dxt) * maxf(fabsf(dxt), DISPLACE_EPSILON) / this->getWidth(); dyt = signf(dyt) * maxf(fabsf(dyt), DISPLACE_EPSILON) / this->getHeight(); - /* EWA filtering */ - this->m_inputColorProgram->read(output, u, v, dxt, dyt); + /* EWA filtering (without nearest it gets blurry with NO distortion) */ + this->m_inputColorProgram->read(output, u, v, dxt, dyt, COM_PS_NEAREST); } void DisplaceOperation::deinitExecution() diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp index 1a441b0ac9a..fe6ebcebf97 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.cpp +++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp @@ -107,7 +107,7 @@ void MapUVOperation::executePixel(float output[4], float x, float y, PixelSample u = inputUV[0] * this->m_inputColorProgram->getWidth(); v = inputUV[1] * this->m_inputColorProgram->getHeight(); - this->m_inputColorProgram->read(output, u, v, dx, dy); + this->m_inputColorProgram->read(output, u, v, dx, dy, COM_PS_NEAREST); /* "premul" */ if (alpha < 1.0f) { diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp index a2385f79c04..03d41edda64 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp @@ -59,9 +59,9 @@ void ReadBufferOperation::executePixel(float output[4], float x, float y, PixelS } } -void ReadBufferOperation::executePixel(float output[4], float x, float y, float dx, float dy) +void ReadBufferOperation::executePixel(float output[4], float x, float y, float dx, float dy, PixelSampler sampler) { - m_buffer->readEWA(output, x, y, dx, dy); + m_buffer->readEWA(output, x, y, dx, dy, sampler); } bool ReadBufferOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.h b/source/blender/compositor/operations/COM_ReadBufferOperation.h index 7958a4aee6b..7e3ac147ee3 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.h +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.h @@ -40,7 +40,7 @@ public: void *initializeTileData(rcti *rect); void executePixel(float output[4], float x, float y, PixelSampler sampler); - void executePixel(float output[4], float x, float y, float dx, float dy); + void executePixel(float output[4], float x, float y, float dx, float dy, PixelSampler sampler); const bool isReadBufferOperation() const { return true; } void setOffset(unsigned int offset) { this->m_offset = offset; } unsigned int getOffset() { return this->m_offset; } |