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:
Diffstat (limited to 'source/blender/compositor/operations/COM_GammaOperation.cc')
-rw-r--r--source/blender/compositor/operations/COM_GammaOperation.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_GammaOperation.cc b/source/blender/compositor/operations/COM_GammaOperation.cc
index 343e335070a..396d3942b06 100644
--- a/source/blender/compositor/operations/COM_GammaOperation.cc
+++ b/source/blender/compositor/operations/COM_GammaOperation.cc
@@ -28,6 +28,7 @@ GammaOperation::GammaOperation()
this->addOutputSocket(DataType::Color);
this->m_inputProgram = nullptr;
this->m_inputGammaProgram = nullptr;
+ flags.can_be_constant = true;
}
void GammaOperation::initExecution()
{
@@ -51,6 +52,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;