diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-07-05 20:53:39 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-07-06 00:36:43 +0300 |
commit | c94877ae3d38f2bd0a772caa09ad84647641b7f3 (patch) | |
tree | 3a073727ee128d34aede8d618ef7c212dccc2281 /source/blender/compositor/operations/COM_GammaOperation.cc | |
parent | 00c6cbb985adee795270a27676fb1bc6820651a4 (diff) |
Compositor: Full frame Gamma node
Adds full frame implementation to this node operation.
No functional changes.
1.5x faster than tiled fallback.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D11767
Diffstat (limited to 'source/blender/compositor/operations/COM_GammaOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_GammaOperation.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_GammaOperation.cc b/source/blender/compositor/operations/COM_GammaOperation.cc index 343e335070a..7083c677f03 100644 --- a/source/blender/compositor/operations/COM_GammaOperation.cc +++ b/source/blender/compositor/operations/COM_GammaOperation.cc @@ -51,6 +51,20 @@ void GammaOperation::executePixelSampled(float output[4], float x, float y, Pixe output[3] = inputValue[3]; } +void GammaOperation::update_memory_buffer_row(PixelCursor &p) +{ + for (; p.out < p.row_end; p.next()) { + const float *in_value = p.ins[0]; + const float *in_gamma = p.ins[1]; + const float gamma = in_gamma[0]; + /* Check for negative to avoid nan's. */ + p.out[0] = in_value[0] > 0.0f ? powf(in_value[0], gamma) : in_value[0]; + p.out[1] = in_value[1] > 0.0f ? powf(in_value[1], gamma) : in_value[1]; + p.out[2] = in_value[2] > 0.0f ? powf(in_value[2], gamma) : in_value[2]; + p.out[3] = in_value[3]; + } +} + void GammaOperation::deinitExecution() { this->m_inputProgram = nullptr; |