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:
authorPhilipp Oeser <info@graphics-engineer.com>2019-07-31 13:22:42 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2019-07-31 17:29:51 +0300
commit8dd95abb2ff9160d95808507f70b4233546e9f65 (patch)
tree700fdc494ab01e531b383342ac21c2221c456c40 /source/blender/compositor/operations
parent200c9f37d64a4aac5bffde2f12ba4638af0a87b1 (diff)
Fix T67808: Bright/Contrast node wrong for negative contrast
strange nobody noticed since 2012... thx @jenkm for spotting Reviewers: brecht Subscribers: jenkm Maniphest Tasks: T67808 Differential Revision: https://developer.blender.org/D5378
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r--source/blender/compositor/operations/COM_BrightnessOperation.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.cpp b/source/blender/compositor/operations/COM_BrightnessOperation.cpp
index 81df85daf28..d0bab5aa4d9 100644
--- a/source/blender/compositor/operations/COM_BrightnessOperation.cpp
+++ b/source/blender/compositor/operations/COM_BrightnessOperation.cpp
@@ -56,19 +56,19 @@ void BrightnessOperation::executePixelSampled(float output[4],
float contrast = inputContrast[0];
brightness /= 100.0f;
float delta = contrast / 200.0f;
- a = 1.0f - delta * 2.0f;
/*
* The algorithm is by Werner D. Streidt
* (http://visca.com/ffactory/archives/5-99/msg00021.html)
* Extracted of OpenCV demhist.c
*/
if (contrast > 0) {
- a = 1.0f / a;
+ a = 1.0f / (1.0f - delta * 2.0f);
b = a * (brightness - delta);
}
else {
delta *= -1;
- b = a * (brightness + delta);
+ a = 1.0f - delta * 2.0f;
+ b = a * brightness + delta;
}
if (this->m_use_premultiply) {
premul_to_straight_v4(inputValue);