[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48891] trunk/blender/source/blender/ compositor/operations: Inner loop optimization of blur node
Jeroen Bakker
j.bakker at atmind.nl
Fri Jul 13 14:50:10 CEST 2012
Revision: 48891
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48891
Author: jbakker
Date: 2012-07-13 12:50:10 +0000 (Fri, 13 Jul 2012)
Log Message:
-----------
Inner loop optimization of blur node
Modified Paths:
--------------
trunk/blender/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
Modified: trunk/blender/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp 2012-07-13 12:24:42 UTC (rev 48890)
+++ trunk/blender/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp 2012-07-13 12:50:10 UTC (rev 48891)
@@ -138,8 +138,10 @@
int index;
int step = QualityStepHelper::getStep();
int offsetadd = QualityStepHelper::getOffsetAdd();
+ const int addConst = (minx - x + this->m_radx);
+ const int mulConst = (this->m_radx * 2 + 1);
for (int ny = miny; ny < maxy; ny += step) {
- index = ((ny - y) + this->m_rady) * (this->m_radx * 2 + 1) + (minx - x + this->m_radx);
+ index = ((ny - y) + this->m_rady) * mulConst + addConst;
int bufferindex = ((minx - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth);
for (int nx = minx; nx < maxx; nx += step) {
const float multiplier = this->m_gausstab[index];
Modified: trunk/blender/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp 2012-07-13 12:24:42 UTC (rev 48890)
+++ trunk/blender/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp 2012-07-13 12:50:10 UTC (rev 48891)
@@ -92,12 +92,10 @@
maxy = min(maxy, inputBuffer->getRect()->ymax);
maxx = min(maxx, inputBuffer->getRect()->xmax);
- int index;
int step = getStep();
int offsetadd = getOffsetAdd();
int bufferindex = ((minx - bufferstartx) * 4) + ((miny - bufferstarty) * 4 * bufferwidth);
- for (int nx = minx; nx < maxx; nx += step) {
- index = (nx - x) + this->m_rad;
+ for (int nx = minx, index = (minx - x) + this->m_rad; nx < maxx; nx += step, index += step) {
const float multiplier = this->m_gausstab[index];
madd_v4_v4fl(color_accum, &buffer[bufferindex], multiplier);
multiplier_accum += multiplier;
Modified: trunk/blender/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp 2012-07-13 12:24:42 UTC (rev 48890)
+++ trunk/blender/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp 2012-07-13 12:50:10 UTC (rev 48891)
@@ -94,9 +94,10 @@
int index;
int step = getStep();
+ const int bufferIndexx = ((minx - bufferstartx) * 4) ;
for (int ny = miny; ny < maxy; ny += step) {
index = (ny - y) + this->m_rad;
- int bufferindex = ((minx - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth);
+ int bufferindex = bufferIndexx + ((ny - bufferstarty) * 4 * bufferwidth);
const float multiplier = this->m_gausstab[index];
madd_v4_v4fl(color_accum, &buffer[bufferindex], multiplier);
multiplier_accum += multiplier;
More information about the Bf-blender-cvs
mailing list