From 5fbeda7efd62e251dac2af881de9fe042f30a7a7 Mon Sep 17 00:00:00 2001 From: Monique Dewanchand Date: Fri, 1 Jun 2012 11:50:32 +0000 Subject: Optimize Gaussian blurs --- .../operations/COM_GaussianBokehBlurOperation.cpp | 31 +++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp') diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp index af10791590b..b5d175729f3 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp @@ -34,11 +34,20 @@ GaussianBokehBlurOperation::GaussianBokehBlurOperation(): BlurBaseOperation() void *GaussianBokehBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { - updateGauss(memoryBuffers); + if (!sizeavailable) { + updateGauss(memoryBuffers); + } void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers); return buffer; } +void GaussianBokehBlurOperation::initExecution() +{ + if (this->sizeavailable) { + updateGauss(NULL); + } +} + void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { if (this->gausstab == NULL) { @@ -51,8 +60,9 @@ void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) int j, i; const float width = this->getWidth(); const float height = this->getHeight(); - updateSize(memoryBuffers); - + if (!sizeavailable) { + updateSize(memoryBuffers); + } radxf = size*(float)this->data->sizex; if (radxf>width/2.0f) radxf = width/2.0f; @@ -163,19 +173,20 @@ bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, R return true; } else { - if (this->gausstab) { + if (this->sizeavailable && this->gausstab != NULL) { + newInput.xmin = 0; + newInput.ymin = 0; + newInput.xmax = this->getWidth(); + newInput.ymax = this->getHeight(); + } + else { int addx = radx; int addy = rady; newInput.xmax = input->xmax + addx; newInput.xmin = input->xmin - addx; newInput.ymax = input->ymax + addy; newInput.ymin = input->ymin - addy; - } - else { - newInput.xmin = 0; - newInput.ymin = 0; - newInput.xmax = this->getWidth(); - newInput.ymax = this->getHeight(); + } return BlurBaseOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } -- cgit v1.2.3