Inner loop optimization of blur node

This commit is contained in:
Jeroen Bakker
2012-07-13 12:50:10 +00:00
parent 9987a8fca7
commit 6eacb5791d
3 changed files with 6 additions and 5 deletions

View File

@@ -138,8 +138,10 @@ void GaussianBokehBlurOperation::executePixel(float *color, int x, int y, void *
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];

View File

@@ -92,12 +92,10 @@ void GaussianXBlurOperation::executePixel(float *color, int x, int y, void *data
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;

View File

@@ -94,9 +94,10 @@ void GaussianYBlurOperation::executePixel(float *color, int x, int y, void *data
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;