diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-08 20:46:12 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-08 20:46:12 +0400 |
commit | 2a78c2d30405d17d804125e903e3fbec0f10d582 (patch) | |
tree | fd4f766bb4710cbbcecbc5c6049a529b8d8312fd /source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp | |
parent | bd3ec606517f0ca02d503a1856963b0a2ddc32e1 (diff) |
improvement to the DOF node, after blurring the radius buffer (derived from the depth), overlay with the original so pixels in focus are not mixed with out of focus pixels.
Diffstat (limited to 'source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp index 7ef363f5c4a..a7b5b5de6b5 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp @@ -277,6 +277,28 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect) MemoryBuffer *newBuf = (MemoryBuffer *)this->m_inputprogram->initializeTileData(rect); MemoryBuffer *copy = newBuf->duplicate(); FastGaussianBlurOperation::IIR_gauss(copy, this->m_sigma, 0, 3); + + if (this->m_overlay == FAST_GAUSS_OVERLAY_MIN) { + float *src = newBuf->getBuffer(); + float *dst = copy->getBuffer(); + for (int i = copy->getWidth() * copy->getHeight() * COM_NUMBER_OF_CHANNELS; i != 0; i--, src++, dst++) { + if (*src < *dst) { + *dst = *src; + } + } + } + else if (this->m_overlay == FAST_GAUSS_OVERLAY_MAX) { + float *src = newBuf->getBuffer(); + float *dst = copy->getBuffer(); + for (int i = copy->getWidth() * copy->getHeight() * COM_NUMBER_OF_CHANNELS; i != 0; i--, src++, dst++) { + if (*src > *dst) { + *dst = *src; + } + } + } + +// newBuf-> + this->m_iirgaus = copy; } unlockMutex(); |