diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-21 12:30:45 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-21 12:30:45 +0400 |
commit | 988df245519352ab80d8ad488660a0a2f7a963d3 (patch) | |
tree | 91f0e61c6543d0eda2af9794d5a7938b6e583072 /source/blender/compositor/operations/COM_ColorCurveOperation.cpp | |
parent | 49d3766ceb17082fd64cdc0f01224237f1098564 (diff) |
compositor color curve was MEM_dupallocN'ing the curve for every pixel calculation (when there were black or white inputs on the curve node).
avoid allocation by using local vars for black/white storage & curve calculation.
Diffstat (limited to 'source/blender/compositor/operations/COM_ColorCurveOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_ColorCurveOperation.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp index ff2cf96d0ad..81205514040 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp @@ -61,34 +61,39 @@ void ColorCurveOperation::initExecution() void ColorCurveOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) { CurveMapping *cumap = this->m_curveMapping; - CurveMapping *workingCopy = (CurveMapping *)MEM_dupallocN(cumap); - float black[4]; - float white[4]; float fac[4]; float image[4]; + /* local versions of cumap->black, cumap->white, cumap->bwmul */ + float black[4]; + float white[4]; + float bwmul[3]; + this->m_inputBlackProgram->read(black, x, y, sampler); this->m_inputWhiteProgram->read(white, x, y, sampler); - curvemapping_set_black_white(workingCopy, black, white); + /* get our own local bwmul value, + * since we can't be threadsafe and use cumap->bwmul & friends */ + curvemapping_set_black_white_ex(black, white, bwmul); this->m_inputFacProgram->read(fac, x, y, sampler); this->m_inputImageProgram->read(image, x, y, sampler); if (*fac >= 1.0f) { - curvemapping_evaluate_premulRGBF(workingCopy, output, image); + curvemapping_evaluate_premulRGBF_ex(cumap, output, image, + black, bwmul); } else if (*fac <= 0.0f) { copy_v3_v3(output, image); } else { float col[4]; - curvemapping_evaluate_premulRGBF(workingCopy, col, image); + curvemapping_evaluate_premulRGBF_ex(cumap, col, image, + black, bwmul); interp_v3_v3v3(output, image, col, *fac); } output[3] = image[3]; - MEM_freeN(workingCopy); } void ColorCurveOperation::deinitExecution() |