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 | |
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')
-rw-r--r-- | source/blender/compositor/operations/COM_GammaOperation.cc | 14 | ||||
-rw-r--r-- | source/blender/compositor/operations/COM_GammaOperation.h | 6 |
2 files changed, 18 insertions, 2 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; diff --git a/source/blender/compositor/operations/COM_GammaOperation.h b/source/blender/compositor/operations/COM_GammaOperation.h index 034046106d6..713d3d8484f 100644 --- a/source/blender/compositor/operations/COM_GammaOperation.h +++ b/source/blender/compositor/operations/COM_GammaOperation.h @@ -18,11 +18,11 @@ #pragma once -#include "COM_NodeOperation.h" +#include "COM_MultiThreadedRowOperation.h" namespace blender::compositor { -class GammaOperation : public NodeOperation { +class GammaOperation : public MultiThreadedRowOperation { private: /** * Cached reference to the inputProgram @@ -47,6 +47,8 @@ class GammaOperation : public NodeOperation { * Deinitialize the execution */ void deinitExecution() override; + + void update_memory_buffer_row(PixelCursor &p) override; }; } // namespace blender::compositor |