From 24f0bff0ab26b47b5a123d6de9e4f363ef2391b7 Mon Sep 17 00:00:00 2001 From: Lawrence Lee <45837045+Lawrence37@users.noreply.github.com> Date: Mon, 29 May 2023 15:49:58 -0700 Subject: [PATCH] Fix L*a*b* curves histogram and pipette scaling Use correct horizontal scale for chroma histogram. Fix pipette values for chroma, a*, and b*. --- rtengine/improcfun.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index c3e11c076..f984e8d71 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -4176,9 +4176,6 @@ void ImProcFunctions::chromiLuminanceCurve(PipetteBuffer *pipetteBuffer, int pW, } - const float histLFactor = pW != 1 ? histLCurve.getSize() / 100.f : 1.f; - const float histCFactor = pW != 1 ? histCCurve.getSize() / 48000.f : 1.f; - float adjustr = 1.0f; // if(params->labCurve.avoidclip ){ @@ -4200,6 +4197,9 @@ void ImProcFunctions::chromiLuminanceCurve(PipetteBuffer *pipetteBuffer, int pW, adjustr = 1.8f; } + const float histLFactor = pW != 1 ? histLCurve.getSize() / 100.f : 1.f; + const float histCFactor = pW != 1 ? histCCurve.getSize() * adjustr / 65536.f : 1.f; + // reference to the params structure has to be done outside of the parallelization to avoid CPU cache problem const bool highlight = params->toneCurve.hrenabled; //Get the value if "highlight reconstruction" is activated const int chromaticity = params->labCurve.chromaticity; @@ -4359,11 +4359,11 @@ void ImProcFunctions::chromiLuminanceCurve(PipetteBuffer *pipetteBuffer, int pW, if (editPipette) { if (editID == EUID_Lab_aCurve) { // Lab a pipette - float chromapipa = lold->a[i][j] + (32768.f * 1.28f); - editWhatever->v(i, j) = LIM01 ((chromapipa) / (65536.f * 1.28f)); + float chromapipa = lold->a[i][j] + 32768.f; + editWhatever->v(i, j) = LIM01 ((chromapipa) / (65536.f)); } else if (editID == EUID_Lab_bCurve) { //Lab b pipette - float chromapipb = lold->b[i][j] + (32768.f * 1.28f); - editWhatever->v(i, j) = LIM01 ((chromapipb) / (65536.f * 1.28f)); + float chromapipb = lold->b[i][j] + 32768.f; + editWhatever->v(i, j) = LIM01 ((chromapipb) / (65536.f)); } } @@ -4602,7 +4602,7 @@ void ImProcFunctions::chromiLuminanceCurve(PipetteBuffer *pipetteBuffer, int pW, // I have placed C=f(C) after all C treatments to assure maximum amplitude of "C" if (editPipette && editID == EUID_Lab_CCurve) { float chromapip = sqrt(SQR(atmp) + SQR(btmp) + 0.001f); - editWhatever->v(i, j) = LIM01 ((chromapip) / (48000.f)); + editWhatever->v(i, j) = LIM01 ((chromapip) / (65536.f / adjustr)); }//Lab C=f(C) pipette if (ccut) { @@ -4669,7 +4669,7 @@ void ImProcFunctions::chromiLuminanceCurve(PipetteBuffer *pipetteBuffer, int pW, if (editPipette && editID == EUID_Lab_LCCurve) { float chromapiplc = sqrt(SQR(atmp) + SQR(btmp) + 0.001f); - editWhatever->v(i, j) = LIM01 ((chromapiplc) / (48000.f)); + editWhatever->v(i, j) = LIM01 ((chromapiplc) / (65536.f / adjustr)); }//Lab L=f(C) pipette