[Bf-blender-cvs] [8dd95abb2ff] master: Fix T67808: Bright/Contrast node wrong for negative contrast
Philipp Oeser
noreply at git.blender.org
Wed Jul 31 16:38:27 CEST 2019
Commit: 8dd95abb2ff9160d95808507f70b4233546e9f65
Author: Philipp Oeser
Date: Wed Jul 31 12:22:42 2019 +0200
Branches: master
https://developer.blender.org/rB8dd95abb2ff9160d95808507f70b4233546e9f65
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
===================================================================
M source/blender/compositor/operations/COM_BrightnessOperation.cpp
===================================================================
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);
More information about the Bf-blender-cvs
mailing list