From 2fde6e562ad52cff16c098651377d20a0e35b8cd Mon Sep 17 00:00:00 2001 From: rom9 <4711834+rom9@users.noreply.github.com> Date: Sun, 23 Jun 2019 22:21:24 +0200 Subject: [PATCH] The "dual-spot" exponents calculation feature now honors the master (green) exponent set by the user, and adjusts red and blue based on the ratios between the new, "guessed" exponents. This way, if the user has chosen a different master exponent than the default, using the feature just alters the color characteristic of the conversion, while keeping the same contrast level. --- rtengine/filmnegativeproc.cc | 4 ++-- rtgui/filmnegative.cc | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/rtengine/filmnegativeproc.cc b/rtengine/filmnegativeproc.cc index f5a231c05..eed10fdc4 100644 --- a/rtengine/filmnegativeproc.cc +++ b/rtengine/filmnegativeproc.cc @@ -151,9 +151,9 @@ bool rtengine::RawImageSource::getFilmNegativeExponents(Coord2D spotA, Coord2D s // compared to the ratio in the reference channel (green) for (int ch = 0; ch < 3; ++ch) { if (ch == 1) { - newExps[ch] = 2.f; // Green is the reference channel + newExps[ch] = 1.f; // Green is the reference channel } else { - newExps[ch] = CLAMP(2.f * logBase(clearVals[ch] / denseVals[ch], denseGreenRatio), 0.3f, 6.f); + newExps[ch] = CLAMP(logBase(clearVals[ch] / denseVals[ch], denseGreenRatio), 0.3f, 6.f); } } diff --git a/rtgui/filmnegative.cc b/rtgui/filmnegative.cc index 36f2e7c34..d84c1bd0a 100644 --- a/rtgui/filmnegative.cc +++ b/rtgui/filmnegative.cc @@ -273,11 +273,12 @@ bool FilmNegative::button1Pressed(int modifierKey) std::array newExps; if (fnp->getFilmNegativeExponents(refSpotCoords[0], refSpotCoords[1], newExps)) { disableListener(); - redExp->setValue(newExps[0]); - greenExp->setValue(newExps[1]); - blueExp->setValue(newExps[2]); - redRatio = redExp->getValue() / greenExp->getValue(); - blueRatio = blueExp->getValue() / greenExp->getValue(); + // Leaving green exponent unchanged, setting red and blue exponents based on + // the ratios between newly calculated exponents. + redRatio = newExps[0] / newExps[1]; + blueRatio = newExps[2] / newExps[1]; + redExp->setValue(greenExp->getValue() * redRatio); + blueExp->setValue(greenExp->getValue() * blueRatio); enableListener(); if (listener && getEnabled()) {