From 8dd95abb2ff9160d95808507f70b4233546e9f65 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Wed, 31 Jul 2019 12:22:42 +0200 Subject: 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 --- source/blender/compositor/operations/COM_BrightnessOperation.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/compositor/operations') 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); -- cgit v1.2.3