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_GaussianYBlurOperation.cpp | 30 ++++++++++++++++------ 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp') diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp index faef152dc31..1760a281785 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp @@ -35,11 +35,25 @@ GaussianYBlurOperation::GaussianYBlurOperation(): BlurBaseOperation() void *GaussianYBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { - updateGauss(memoryBuffers); + if (!this->sizeavailable) { + updateGauss(memoryBuffers); + } void *buffer = getInputOperation(0)->initializeTileData(NULL, memoryBuffers); return buffer; } +void GaussianYBlurOperation::initExecution() +{ + if (this->sizeavailable) { + float rad = size*this->data->sizex; + if (rad<1) + rad = 1; + + this->rad = rad; + this->gausstab = BlurBaseOperation::make_gausstab(rad); + } +} + void GaussianYBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { if (this->gausstab == NULL) { @@ -115,18 +129,18 @@ bool GaussianYBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadB return true; } else { - if (this->gausstab == NULL) { - newInput.xmax = this->getWidth(); - newInput.xmin = 0; - newInput.ymax = this->getHeight(); - newInput.ymin = 0; - } - else { + if (this->sizeavailable && this->gausstab != NULL) { newInput.xmax = input->xmax; newInput.xmin = input->xmin; newInput.ymax = input->ymax + rad; newInput.ymin = input->ymin - rad; } + else { + newInput.xmax = this->getWidth(); + newInput.xmin = 0; + newInput.ymax = this->getHeight(); + newInput.ymin = 0; + } return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } } -- cgit v1.2.3