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:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp72
1 files changed, 40 insertions, 32 deletions
diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
index 5b048dfe405..48807e9218d 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp
@@ -19,58 +19,66 @@
#include "COM_ColorBalanceLGGOperation.h"
#include "BLI_math.h"
-
inline float colorbalance_lgg(float in, float lift_lgg, float gamma_inv, float gain)
{
- /* 1:1 match with the sequencer with linear/srgb conversions, the conversion isnt pretty
- * but best keep it this way, sice testing for durian shows a similar calculation
- * without lin/srgb conversions gives bad results (over-saturated shadows) with colors
- * slightly below 1.0. some correction can be done but it ends up looking bad for shadows or lighter tones - campbell */
- float x = (((linearrgb_to_srgb(in) - 1.0f) * lift_lgg) + 1.0f) * gain;
+ /* 1:1 match with the sequencer with linear/srgb conversions, the conversion isnt pretty
+ * but best keep it this way, sice testing for durian shows a similar calculation
+ * without lin/srgb conversions gives bad results (over-saturated shadows) with colors
+ * slightly below 1.0. some correction can be done but it ends up looking bad for shadows or lighter tones - campbell */
+ float x = (((linearrgb_to_srgb(in) - 1.0f) * lift_lgg) + 1.0f) * gain;
- /* prevent NaN */
- if (x < 0.0f) x = 0.0f;
+ /* prevent NaN */
+ if (x < 0.0f)
+ x = 0.0f;
- return powf(srgb_to_linearrgb(x), gamma_inv);
+ return powf(srgb_to_linearrgb(x), gamma_inv);
}
ColorBalanceLGGOperation::ColorBalanceLGGOperation() : NodeOperation()
{
- this->addInputSocket(COM_DT_VALUE);
- this->addInputSocket(COM_DT_COLOR);
- this->addOutputSocket(COM_DT_COLOR);
- this->m_inputValueOperation = NULL;
- this->m_inputColorOperation = NULL;
- this->setResolutionInputSocketIndex(1);
+ this->addInputSocket(COM_DT_VALUE);
+ this->addInputSocket(COM_DT_COLOR);
+ this->addOutputSocket(COM_DT_COLOR);
+ this->m_inputValueOperation = NULL;
+ this->m_inputColorOperation = NULL;
+ this->setResolutionInputSocketIndex(1);
}
void ColorBalanceLGGOperation::initExecution()
{
- this->m_inputValueOperation = this->getInputSocketReader(0);
- this->m_inputColorOperation = this->getInputSocketReader(1);
+ this->m_inputValueOperation = this->getInputSocketReader(0);
+ this->m_inputColorOperation = this->getInputSocketReader(1);
}
-void ColorBalanceLGGOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
+void ColorBalanceLGGOperation::executePixelSampled(float output[4],
+ float x,
+ float y,
+ PixelSampler sampler)
{
- float inputColor[4];
- float value[4];
-
- this->m_inputValueOperation->readSampled(value, x, y, sampler);
- this->m_inputColorOperation->readSampled(inputColor, x, y, sampler);
+ float inputColor[4];
+ float value[4];
- float fac = value[0];
- fac = min(1.0f, fac);
- const float mfac = 1.0f - fac;
+ this->m_inputValueOperation->readSampled(value, x, y, sampler);
+ this->m_inputColorOperation->readSampled(inputColor, x, y, sampler);
- output[0] = mfac * inputColor[0] + fac * colorbalance_lgg(inputColor[0], this->m_lift[0], this->m_gamma_inv[0], this->m_gain[0]);
- output[1] = mfac * inputColor[1] + fac * colorbalance_lgg(inputColor[1], this->m_lift[1], this->m_gamma_inv[1], this->m_gain[1]);
- output[2] = mfac * inputColor[2] + fac * colorbalance_lgg(inputColor[2], this->m_lift[2], this->m_gamma_inv[2], this->m_gain[2]);
- output[3] = inputColor[3];
+ float fac = value[0];
+ fac = min(1.0f, fac);
+ const float mfac = 1.0f - fac;
+ output[0] = mfac * inputColor[0] +
+ fac * colorbalance_lgg(
+ inputColor[0], this->m_lift[0], this->m_gamma_inv[0], this->m_gain[0]);
+ output[1] = mfac * inputColor[1] +
+ fac * colorbalance_lgg(
+ inputColor[1], this->m_lift[1], this->m_gamma_inv[1], this->m_gain[1]);
+ output[2] = mfac * inputColor[2] +
+ fac * colorbalance_lgg(
+ inputColor[2], this->m_lift[2], this->m_gamma_inv[2], this->m_gain[2]);
+ output[3] = inputColor[3];
}
void ColorBalanceLGGOperation::deinitExecution()
{
- this->m_inputValueOperation = NULL;
- this->m_inputColorOperation = NULL;
+ this->m_inputValueOperation = NULL;
+ this->m_inputColorOperation = NULL;
}