diff options
Diffstat (limited to 'source/blender/compositor')
11 files changed, 256 insertions, 96 deletions
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp index 572308dd87f..0aae8853795 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp @@ -121,7 +121,7 @@ void MemoryBuffer::writePixel(int x, int y, const float color[4]) if (x >= this->m_rect.xmin && x < this->m_rect.xmax && y >= this->m_rect.ymin && y < this->m_rect.ymax) { - const int offset = (this->m_chunkWidth * y + x) * COM_NUMBER_OF_CHANNELS; + const int offset = (this->m_chunkWidth * (y-this->m_rect.ymin) + x-this->m_rect.xmin) * COM_NUMBER_OF_CHANNELS; copy_v4_v4(&this->m_buffer[offset], color); } } @@ -131,7 +131,7 @@ void MemoryBuffer::addPixel(int x, int y, const float color[4]) if (x >= this->m_rect.xmin && x < this->m_rect.xmax && y >= this->m_rect.ymin && y < this->m_rect.ymax) { - const int offset = (this->m_chunkWidth * y + x) * COM_NUMBER_OF_CHANNELS; + const int offset = (this->m_chunkWidth * (y-this->m_rect.ymin) + x-this->m_rect.xmin) * COM_NUMBER_OF_CHANNELS; add_v4_v4(&this->m_buffer[offset], color); } } diff --git a/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp b/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp index a6f81410b74..0496974c64f 100644 --- a/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp +++ b/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp @@ -35,7 +35,7 @@ void SingleThreadedNodeOperation::initExecution() void SingleThreadedNodeOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) { - this->m_cachedInstance->read(color, x, y); + this->m_cachedInstance->readNoCheck(color, x, y); } void SingleThreadedNodeOperation::deinitExecution() diff --git a/source/blender/compositor/nodes/COM_DefocusNode.cpp b/source/blender/compositor/nodes/COM_DefocusNode.cpp index 05bf907af5a..65825a60b50 100644 --- a/source/blender/compositor/nodes/COM_DefocusNode.cpp +++ b/source/blender/compositor/nodes/COM_DefocusNode.cpp @@ -99,9 +99,7 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext #ifdef COM_DEFOCUS_SEARCH InverseSearchRadiusOperation *search = new InverseSearchRadiusOperation(); addLink(graph, radiusOperation->getOutputSocket(0), search->getInputSocket(0)); - addLink(graph, depthOperation, search->getInputSocket(1)); search->setMaxBlur(data->maxblur); - search->setThreshold(data->bthresh); graph->addOperation(search); #endif VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation(); @@ -116,7 +114,7 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext addLink(graph, bokeh->getOutputSocket(), operation->getInputSocket(1)); addLink(graph, radiusOperation->getOutputSocket(), operation->getInputSocket(2)); #ifdef COM_DEFOCUS_SEARCH - addLink(graph, search->getOutputSocket(), operation->getInputSocket(4)); + addLink(graph, search->getOutputSocket(), operation->getInputSocket(3)); #endif if (data->gamco) { GammaCorrectOperation *correct = new GammaCorrectOperation(); diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp index ac91d3336e2..a9e8de25297 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp @@ -194,3 +194,156 @@ bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, R return BlurBaseOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } } + +// reference image +GaussianBokehBlurReferenceOperation::GaussianBokehBlurReferenceOperation() : NodeOperation() +{ + this->addInputSocket(COM_DT_COLOR); + this->addInputSocket(COM_DT_VALUE); + this->addOutputSocket(COM_DT_COLOR); + this->setComplex(true); + this->m_gausstab = NULL; + this->m_inputImage = NULL; + this->m_inputSize = NULL; +} + +void *GaussianBokehBlurReferenceOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ + void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers); + return buffer; +} + +void GaussianBokehBlurReferenceOperation::initExecution() +{ + // setup gaustab + this->m_data->image_in_width = this->getWidth(); + this->m_data->image_in_height = this->getHeight(); + if (this->m_data->relative) { + switch (this->m_data->aspect) { + case CMP_NODE_BLUR_ASPECT_NONE: + this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_width); + this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_height); + break; + case CMP_NODE_BLUR_ASPECT_Y: + this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_width); + this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_width); + break; + case CMP_NODE_BLUR_ASPECT_X: + this->m_data->sizex = (int)(this->m_data->percentx * 0.01f * this->m_data->image_in_height); + this->m_data->sizey = (int)(this->m_data->percenty * 0.01f * this->m_data->image_in_height); + break; + } + } + + updateGauss(); + this->m_inputImage = this->getInputSocketReader(0); + this->m_inputSize = this->getInputSocketReader(1); +} + +void GaussianBokehBlurReferenceOperation::updateGauss() +{ + int n; + float *dgauss; + float *ddgauss; + int j, i; + + n = (2 * radx + 1) * (2 * rady + 1); + + /* create a full filter image */ + ddgauss = new float[n]; + dgauss = ddgauss; + for (j = -rady; j <= rady; j++) { + for (i = -radx; i <= radx; i++, dgauss++) { + float fj = (float)j / radyf; + float fi = (float)i / radxf; + float dist = sqrt(fj * fj + fi * fi); + *dgauss = RE_filter_value(this->m_data->filtertype, dist); + } + } + this->m_gausstab = ddgauss; +} + +void GaussianBokehBlurReferenceOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ + float tempColor[4]; + float tempSize[4]; + tempColor[0] = 0; + tempColor[1] = 0; + tempColor[2] = 0; + tempColor[3] = 0; + float multiplier_accum = 0; + MemoryBuffer *inputBuffer = (MemoryBuffer *)data; + float *buffer = inputBuffer->getBuffer(); + int bufferwidth = inputBuffer->getWidth(); + int bufferstartx = inputBuffer->getRect()->xmin; + int bufferstarty = inputBuffer->getRect()->ymin; + this->m_inputSize->read(tempSize, x, y, inputBuffers, data); + float size = tempSize[0]; + CLAMP(size, 0.0f, 1.0f); + float sizeX = ceil(this->m_data->sizex * size); + float sizeY = ceil(this->m_data->sizey * size); + + if (sizeX <= 0.5f && sizeY <= 0.5f) { + this->m_inputImage->read(color, x, y, inputBuffers, data); + return; + } + + int miny = y - sizeY; + int maxy = y + sizeY; + int minx = x - sizeX; + int maxx = x + sizeX; + miny = max(miny, inputBuffer->getRect()->ymin); + minx = max(minx, inputBuffer->getRect()->xmin); + maxy = min(maxy, inputBuffer->getRect()->ymax); + maxx = min(maxx, inputBuffer->getRect()->xmax); + + int step = QualityStepHelper::getStep(); + int offsetadd = QualityStepHelper::getOffsetAdd(); + for (int ny = miny; ny < maxy; ny += step) { + int u = ny - y; + float uf = ((u/sizeY)*radyf)+radyf; + int indexu = uf * (radx*2+1); + int bufferindex = ((minx - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth); + for (int nx = minx; nx < maxx; nx += step) { + int v = nx - x; + float vf = ((v/sizeX)*radxf)+radxf; + int index = indexu + vf; + const float multiplier = this->m_gausstab[index]; + madd_v4_v4fl(tempColor, &buffer[bufferindex], multiplier); + multiplier_accum += multiplier; + index += step; + bufferindex += offsetadd; + } + } + + mul_v4_v4fl(color, tempColor, 1.0f / multiplier_accum); +} + +void GaussianBokehBlurReferenceOperation::deinitExecution() +{ + delete [] this->m_gausstab; + this->m_gausstab = NULL; + this->m_inputImage = NULL; + this->m_inputSize = NULL; + +} + +bool GaussianBokehBlurReferenceOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ + rcti newInput; + NodeOperation *operation = this->getInputOperation(1); + + if (operation->determineDependingAreaOfInterest(input, readOperation, output)) { + return true; + } + else { + int addx = this->m_data->sizex+2; + int addy = this->m_data->sizey+2; + newInput.xmax = input->xmax + addx; + newInput.xmin = input->xmin - addx; + newInput.ymax = input->ymax + addy; + newInput.ymin = input->ymin - addy; + return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + } +} + diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp index d18dd17528d..70148da46db 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp @@ -118,17 +118,19 @@ void GaussianXBlurOperation::deinitExecution() bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; - rcti sizeInput; - sizeInput.xmin = 0; - sizeInput.ymin = 0; - sizeInput.xmax = 5; - sizeInput.ymax = 5; - NodeOperation *operation = this->getInputOperation(1); - if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { - return true; + if (!this->m_sizeavailable) { + rcti sizeInput; + sizeInput.xmin = 0; + sizeInput.ymin = 0; + sizeInput.xmax = 5; + sizeInput.ymax = 5; + NodeOperation *operation = this->getInputOperation(1); + if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { + return true; + } } - else { + { if (this->m_sizeavailable && this->m_gausstab != NULL) { newInput.xmax = input->xmax + this->m_rad; newInput.xmin = input->xmin - this->m_rad; diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp index d2d30da8ddf..478495ec3be 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp @@ -116,17 +116,19 @@ void GaussianYBlurOperation::deinitExecution() bool GaussianYBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; - rcti sizeInput; - sizeInput.xmin = 0; - sizeInput.ymin = 0; - sizeInput.xmax = 5; - sizeInput.ymax = 5; - NodeOperation *operation = this->getInputOperation(1); - if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { - return true; + if (!m_sizeavailable) { + rcti sizeInput; + sizeInput.xmin = 0; + sizeInput.ymin = 0; + sizeInput.xmax = 5; + sizeInput.ymax = 5; + NodeOperation *operation = this->getInputOperation(1); + if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { + return true; + } } - else { + { if (this->m_sizeavailable && this->m_gausstab != NULL) { newInput.xmax = input->xmax; newInput.xmin = input->xmin; diff --git a/source/blender/compositor/operations/COM_MixBaseOperation.cpp b/source/blender/compositor/operations/COM_MixBaseOperation.cpp index 9e0ae0c6ee8..df9297c568b 100644 --- a/source/blender/compositor/operations/COM_MixBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MixBaseOperation.cpp @@ -45,12 +45,13 @@ void MixBaseOperation::executePixel(float *outputColor, float x, float y, PixelS { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler, inputBuffers); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler, inputBuffers); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler, inputBuffers); + this->m_inputValueOperation->read(inputValue, x, y, sampler, inputBuffers); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler, inputBuffers); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } @@ -93,13 +94,3 @@ void MixBaseOperation::determineResolution(unsigned int resolution[], unsigned i } NodeOperation::determineResolution(resolution, preferredResolution); } - -void MixBaseOperation::clampIfNeeded(float *color) -{ - if (this->m_useClamp) { - CLAMP(color[0], 0.0f, 1.0f); - CLAMP(color[1], 0.0f, 1.0f); - CLAMP(color[2], 0.0f, 1.0f); - CLAMP(color[3], 0.0f, 1.0f); - } -} diff --git a/source/blender/compositor/operations/COM_MixBaseOperation.h b/source/blender/compositor/operations/COM_MixBaseOperation.h index 05301fd0378..1bba2818017 100644 --- a/source/blender/compositor/operations/COM_MixBaseOperation.h +++ b/source/blender/compositor/operations/COM_MixBaseOperation.h @@ -40,7 +40,16 @@ protected: bool m_valueAlphaMultiply; bool m_useClamp; - void clampIfNeeded(float *color); + inline void clampIfNeeded(float *color) + { + if (m_useClamp) { + CLAMP(color[0], 0.0f, 1.0f); + CLAMP(color[1], 0.0f, 1.0f); + CLAMP(color[2], 0.0f, 1.0f); + CLAMP(color[3], 0.0f, 1.0f); + } + } + public: /** * Default constructor diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl b/source/blender/compositor/operations/COM_OpenCLKernels.cl index cbbb4d0b3f2..4f43650370d 100644 --- a/source/blender/compositor/operations/COM_OpenCLKernels.cl +++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl @@ -112,7 +112,7 @@ __kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2 tempSize = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0; if (tempSize > threshold) { if (tempSize >= fabs(dx) && tempSize >= fabs(dy)) { - float2 uv = { 256.0f + dx * 256.0f / tempSize, 256.0f + dy * 256.0f / tempSize}; + float2 uv = { 256.0f + dx * 255.0f / tempSize, 256.0f + dy * 255.0f / tempSize}; bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv); readColor = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate); color_accum += bokeh*readColor; diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp index 5d17526185b..99a8e563c69 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp @@ -57,7 +57,7 @@ void VariableSizeBokehBlurOperation::initExecution() this->m_inputBokehProgram = getInputSocketReader(1); this->m_inputSizeProgram = getInputSocketReader(2); #ifdef COM_DEFOCUS_SEARCH - this->m_inputSearchProgram = getInputSocketReader(4); + this->m_inputSearchProgram = getInputSocketReader(3); #endif QualityStepHelper::initExecution(COM_QH_INCREASE); } @@ -93,7 +93,7 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me #ifdef COM_DEFOCUS_SEARCH float search[4]; - this->inputSearchProgram->read(search, x/InverseSearchRadiusOperation::DIVIDER, y / InverseSearchRadiusOperation::DIVIDER, inputBuffers, NULL); + this->m_inputSearchProgram->read(search, x/InverseSearchRadiusOperation::DIVIDER, y / InverseSearchRadiusOperation::DIVIDER, inputBuffers, NULL); int minx = search[0]; int miny = search[1]; int maxx = search[2]; @@ -127,8 +127,8 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me float fsize = fabsf(size); float dx = nx - x; if (fsize > fabsf(dx) && fsize > fabsf(dy)) { - float u = (256.0f + (dx/size) * 256.0f); - float v = (256.0f + (dy/size) * 256.0f); + float u = (256.0f + (dx/size) * 255.0f); + float v = (256.0f + (dy/size) * 255.0f); inputBokehBuffer->readNoCheck(bokeh, u, v); madd_v4_v4v4(color_accum, bokeh, &inputProgramFloatBuffer[offsetNxNy]); add_v4_v4(multiplier_accum, bokeh); @@ -211,7 +211,7 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *inpu searchInput.xmin = (input->xmin / InverseSearchRadiusOperation::DIVIDER) - 1; searchInput.ymax = (input->ymax / InverseSearchRadiusOperation::DIVIDER) + 1; searchInput.ymin = (input->ymin / InverseSearchRadiusOperation::DIVIDER) - 1; - operation = getInputOperation(4); + operation = getInputOperation(3); if (operation->determineDependingAreaOfInterest(&searchInput, readOperation, output) ) { return true; } @@ -228,65 +228,74 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *inpu InverseSearchRadiusOperation::InverseSearchRadiusOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE, COM_SC_NO_RESIZE); // radius - this->addInputSocket(COM_DT_VALUE, COM_SC_NO_RESIZE); // depth this->addOutputSocket(COM_DT_COLOR); this->setComplex(true); - this->inputRadius = NULL; - this->inputDepth = NULL; + this->m_inputRadius = NULL; } void InverseSearchRadiusOperation::initExecution() { - this->inputRadius = this->getInputSocketReader(0); - this->inputDepth = this->getInputSocketReader(1); + this->m_inputRadius = this->getInputSocketReader(0); } void* InverseSearchRadiusOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { MemoryBuffer * data = new MemoryBuffer(NULL, rect); + float* buffer = data->getBuffer(); int x, y; - float width = this->inputRadius->getWidth(); - float height = this->inputRadius->getHeight(); - - for (x = rect->xmin; x < rect->xmax ; x++) { - for (y = rect->ymin; y < rect->ymax ; y++) { - float[4] temp; + int width = this->m_inputRadius->getWidth(); + int height = this->m_inputRadius->getHeight(); + float temp[4]; + int offset = 0; + for (y = rect->ymin; y < rect->ymax ; y++) { + for (x = rect->xmin; x < rect->xmax ; x++) { int rx = x * DIVIDER; int ry = y * DIVIDER; - this->inputRadius->read(temp, rx, ry, memoryBuffers, NULL); - float centerRadius = temp[0]; - this->inputDepth->read(temp, rx, ry, memoryBuffers, NULL); - float centerDepth = temp[0]; - t[0] = MAX2(rx - this->maxBlur, 0.0f); - t[1] = MAX2(ry - this->maxBlur, 0.0f); - t[2] = MIN2(rx + this->maxBlur, width); - t[3] = MIN2(ry + this->maxBlur, height); - int minx = t[0]; - int miny = t[1]; - int maxx = t[2]; - int maxy = t[3]; - int sminx = rx; - int smaxx = rx; - int sminy = ry; - int smaxy = ry; - for (int nx = minx ; nx < maxx ; nx ++) { - for (int ny = miny ; ny < maxy ; ny ++) { - this->inputRadius->read(temp, nx, ny, memoryBuffers, NULL); - if (nx < rx && temp[0]) - - } - } - float t[4]; - data->writePixel(x, y, t); + buffer[offset] = MAX2(rx - m_maxBlur, 0); + buffer[offset+1] = MAX2(ry- m_maxBlur, 0); + buffer[offset+2] = MIN2(rx+DIVIDER + m_maxBlur, width); + buffer[offset+3] = MIN2(ry+DIVIDER + m_maxBlur, height); + offset += 4; } } +// for (x = rect->xmin; x < rect->xmax ; x++) { +// for (y = rect->ymin; y < rect->ymax ; y++) { +// int rx = x * DIVIDER; +// int ry = y * DIVIDER; +// float radius = 0.0f; +// float maxx = x; +// float maxy = y; + +// for (int x2 = 0 ; x2 < DIVIDER ; x2 ++) { +// for (int y2 = 0 ; y2 < DIVIDER ; y2 ++) { +// this->m_inputRadius->read(temp, rx+x2, ry+y2, COM_PS_NEAREST, NULL); +// if (radius < temp[0]) { +// radius = temp[0]; +// maxx = x2; +// maxy = y2; +// } +// } +// } +// int impactRadius = ceil(radius / DIVIDER); +// for (int x2 = x - impactRadius ; x2 < x + impactRadius ; x2 ++) { +// for (int y2 = y - impactRadius ; y2 < y + impactRadius ; y2 ++) { +// data->read(temp, x2, y2); +// temp[0] = MIN2(temp[0], maxx); +// temp[1] = MIN2(temp[1], maxy); +// temp[2] = MAX2(temp[2], maxx); +// temp[3] = MAX2(temp[3], maxy); +// data->writePixel(x2, y2, temp); +// } +// } +// } +// } return data; } void InverseSearchRadiusOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) { MemoryBuffer *buffer = (MemoryBuffer*)data; - buffer->read(color, x, y); + buffer->readNoCheck(color, x, y); } void InverseSearchRadiusOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) @@ -299,8 +308,7 @@ void InverseSearchRadiusOperation::deinitializeTileData(rcti *rect, MemoryBuffer void InverseSearchRadiusOperation::deinitExecution() { - this->inputRadius = NULL; - this->inputDepth = NULL; + this->m_inputRadius = NULL; } void InverseSearchRadiusOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) @@ -313,10 +321,10 @@ void InverseSearchRadiusOperation::determineResolution(unsigned int resolution[] bool InverseSearchRadiusOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti newRect; - newRect.ymin = input->ymin*DIVIDER; - newRect.ymax = input->ymax*DIVIDER; - newRect.xmin = input->xmin*DIVIDER; - newRect.xmax = input->xmax*DIVIDER; + newRect.ymin = input->ymin*DIVIDER - m_maxBlur; + newRect.ymax = input->ymax*DIVIDER + m_maxBlur; + newRect.xmin = input->xmin*DIVIDER - m_maxBlur; + newRect.xmax = input->xmax*DIVIDER + m_maxBlur; return NodeOperation::determineDependingAreaOfInterest(&newRect, readOperation, output); } #endif diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h index 0ecfb5a542c..f283e60572e 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h @@ -25,6 +25,7 @@ #include "COM_NodeOperation.h" #include "COM_QualityStepHelper.h" +//#define COM_DEFOCUS_SEARCH class VariableSizeBokehBlurOperation : public NodeOperation, public QualityStepHelper { private: @@ -34,7 +35,7 @@ private: SocketReader *m_inputBokehProgram; SocketReader *m_inputSizeProgram; #ifdef COM_DEFOCUS_SEARCH - SocketReader *inputSearchProgram; + SocketReader *m_inputSearchProgram; #endif public: @@ -71,10 +72,8 @@ public: #ifdef COM_DEFOCUS_SEARCH class InverseSearchRadiusOperation : public NodeOperation { private: - int maxBlur; - float threshold; - SocketReader *inputDepth; - SocketReader *inputRadius; + int m_maxBlur; + SocketReader *m_inputRadius; public: static const int DIVIDER = 4; @@ -100,9 +99,7 @@ public: bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]); - void setMaxBlur(int maxRadius) { this->maxBlur = maxRadius; } - - void setThreshold(float threshold) { this->threshold = threshold; } + void setMaxBlur(int maxRadius) { this->m_maxBlur = maxRadius; } }; #endif #endif |