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:
authorJeroen Bakker <j.bakker@atmind.nl>2015-01-19 20:13:26 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2015-01-19 20:17:50 +0300
commit35d3b6316b21ad9ae7eb96a7a541c4051eae3441 (patch)
treedd4eea63f9229d87041e2f5a5679d05f1360afea /source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
parenta8fa291b8c539da7669463ef622d5c61ee9c90e7 (diff)
D627: Memory usage optimization for the compositor.
The compostor used a fixed size of 4 floats to hold pixel data. this patch will select size of a pixel based on its type. It uses 1 float for Value, 3 float for vector and 4 floats for color data types. When benchmarking on shots (opening shot of caminandes) we get a reduction of memory of 30% and a tiny speedup as less data transformations needs to take place (but these are negligable. More information of the patch can be found on https://developer.blender.org/D627 and http://wiki.blender.org/index.php/Dev:Ref/Proposals/Compositor2014_p1.1_TD Developers: jbakker & mdewanchand Thanks for Sergey for his indept review.
Diffstat (limited to 'source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
index 4b81001fdab..4809efd7436 100644
--- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
@@ -137,30 +137,33 @@ void VariableSizeBokehBlurOperation::executePixel(float output[4], int x, int y,
copy_v4_fl(multiplier_accum, 1.0f);
float size_center = tempSize[0] * scalar;
- const int addXStep = QualityStepHelper::getStep() * COM_NUMBER_OF_CHANNELS;
-
+ const int addXStepValue = QualityStepHelper::getStep();
+ const int addYStepValue = addXStepValue;
+ const int addXStepColor = addXStepValue * COM_NUM_CHANNELS_COLOR;
+
if (size_center > this->m_threshold) {
- for (int ny = miny; ny < maxy; ny += QualityStepHelper::getStep()) {
+ for (int ny = miny; ny < maxy; ny += addYStepValue) {
float dy = ny - y;
- int offsetNy = ny * inputSizeBuffer->getWidth() * COM_NUMBER_OF_CHANNELS;
- int offsetNxNy = offsetNy + (minx * COM_NUMBER_OF_CHANNELS);
- for (int nx = minx; nx < maxx; nx += QualityStepHelper::getStep()) {
+ int offsetValueNy = ny * inputSizeBuffer->getWidth();
+ int offsetValueNxNy = offsetValueNy + (minx);
+ int offsetColorNxNy = offsetValueNxNy * COM_NUM_CHANNELS_COLOR;
+ for (int nx = minx; nx < maxx; nx += addXStepValue) {
if (nx != x || ny != y) {
- float size = min(inputSizeFloatBuffer[offsetNxNy] * scalar, size_center);
+ float size = min(inputSizeFloatBuffer[offsetValueNxNy] * scalar, size_center);
if (size > this->m_threshold) {
float dx = nx - x;
if (size > fabsf(dx) && size > fabsf(dy)) {
float uv[2] = {
- (float)(COM_BLUR_BOKEH_PIXELS / 2) + (dx / size) * (float)((COM_BLUR_BOKEH_PIXELS / 2) - 1),
- (float)(COM_BLUR_BOKEH_PIXELS / 2) + (dy / size) * (float)((COM_BLUR_BOKEH_PIXELS / 2) - 1)};
- inputBokehBuffer->readNoCheck(bokeh, uv[0], uv[1]);
- madd_v4_v4v4(color_accum, bokeh, &inputProgramFloatBuffer[offsetNxNy]);
+ (float)(COM_BLUR_BOKEH_PIXELS / 2) + (dx / size) * (float)((COM_BLUR_BOKEH_PIXELS / 2) - 1),
+ (float)(COM_BLUR_BOKEH_PIXELS / 2) + (dy / size) * (float)((COM_BLUR_BOKEH_PIXELS / 2) - 1)};
+ inputBokehBuffer->read(bokeh, uv[0], uv[1]);
+ madd_v4_v4v4(color_accum, bokeh, &inputProgramFloatBuffer[offsetColorNxNy]);
add_v4_v4(multiplier_accum, bokeh);
}
}
}
- offsetNxNy += addXStep;
- }
+ offsetColorNxNy += addXStepColor;
+ offsetValueNxNy += addXStepValue; }
}
}