From 6bea422836dba1243b59baf4ff2f641d16337aad Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Tue, 24 Apr 2018 14:59:46 +0200 Subject: [PATCH] shadows/highlights: add a bit more contrast in the shadows --- rtengine/ipshadowshighlights.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/rtengine/ipshadowshighlights.cc b/rtengine/ipshadowshighlights.cc index 0cf710f25..c9eb9d058 100644 --- a/rtengine/ipshadowshighlights.cc +++ b/rtengine/ipshadowshighlights.cc @@ -68,11 +68,25 @@ void ImProcFunctions::shadowsHighlights(LabImage *lab) const float gamma = hl ? base : 1.f / base; LUTf f(32768); + const float contrast = std::pow(2.f, float(amount)/100.f); + DiagonalCurve sh_contrast({ + DCT_NURBS, + 0, 0, + 0.125, std::pow(0.125 / 0.25, contrast) * 0.25, + 0.25, 0.25, + 0.375, std::pow(0.375 / 0.25, contrast) * 0.25, + 1, 1 + }); #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif for (int l = 0; l < 32768; ++l) { - f[l] = std::pow(l / 32768.f, gamma) * 32768.f; + auto base = std::pow(l / 32768.f, gamma); + if (!hl) { + // get a bit more contrast in the shadows + base = sh_contrast.getVal(base); + } + f[l] = base * 32768.f; } #ifdef _OPENMP