Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-06-13 00:04:55 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-13 00:04:55 +0400
commite1241030db424ce10e9fee04076ff7e209eac98c (patch)
treeac8e1a81a81fa130e166366c6b93587e77e4188f /source/blender/compositor/operations/COM_BokehBlurOperation.cpp
parent7fec7070d7fcf7bde53768e555b40b57ef4a7552 (diff)
yse BLI_math for the compositor in more places.
Diffstat (limited to 'source/blender/compositor/operations/COM_BokehBlurOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_BokehBlurOperation.cpp29
1 files changed, 9 insertions, 20 deletions
diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
index b4811c89dc5..67e24496cbe 100644
--- a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp
@@ -79,14 +79,7 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *
inputBoundingBoxReader->read(tempBoundingBox, x, y, COM_PS_NEAREST, inputBuffers);
if (tempBoundingBox[0] >0.0f) {
- tempColor[0] = 0;
- tempColor[1] = 0;
- tempColor[2] = 0;
- tempColor[3] = 0;
- float overallmultiplyerr = 0;
- float overallmultiplyerg = 0;
- float overallmultiplyerb = 0;
- float overallmultiplyera = 0;
+ float overallmultiplyer[4] = {0.0f, 0.0f, 0.0f, 0.0f};
MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
float *buffer = inputBuffer->getBuffer();
int bufferwidth = inputBuffer->getWidth();
@@ -103,6 +96,8 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *
maxy = min(maxy, inputBuffer->getRect()->ymax);
maxx = min(maxx, inputBuffer->getRect()->xmax);
+ zero_v4(tempColor);
+
int step = getStep();
int offsetadd = getOffsetAdd();
@@ -113,21 +108,15 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *
float u = this->bokehMidX - (nx-x) *m;
float v = this->bokehMidY - (ny-y) *m;
inputBokehProgram->read(bokeh, u, v, COM_PS_NEAREST, inputBuffers);
- tempColor[0] += bokeh[0] * buffer[bufferindex];
- tempColor[1] += bokeh[1] * buffer[bufferindex+1];
- tempColor[2] += bokeh[2]* buffer[bufferindex+2];
- tempColor[3] += bokeh[3]* buffer[bufferindex+3];
- overallmultiplyerr += bokeh[0];
- overallmultiplyerg += bokeh[1];
- overallmultiplyerb += bokeh[2];
- overallmultiplyera += bokeh[3];
+ madd_v4_v4v4(tempColor, bokeh, &buffer[bufferindex]);
+ add_v4_v4(overallmultiplyer, bokeh);
bufferindex +=offsetadd;
}
}
- color[0] = tempColor[0] * (1.0f / overallmultiplyerr);
- color[1] = tempColor[1] * (1.0f / overallmultiplyerg);
- color[2] = tempColor[2] * (1.0f / overallmultiplyerb);
- color[3] = tempColor[3] * (1.0f / overallmultiplyera);
+ color[0] = tempColor[0] * (1.0f / overallmultiplyer[0]);
+ color[1] = tempColor[1] * (1.0f / overallmultiplyer[1]);
+ color[2] = tempColor[2] * (1.0f / overallmultiplyer[2]);
+ color[3] = tempColor[3] * (1.0f / overallmultiplyer[3]);
}
else {
inputProgram->read(color, x, y, COM_PS_NEAREST, inputBuffers);