From f3c2ce642563b45b776d0b3f1e47f7172db752ae Mon Sep 17 00:00:00 2001 From: jdc Date: Sat, 21 Dec 2013 08:38:17 +0100 Subject: [PATCH] Fixed Artifacts when moving the L curve blackpoint issue2144 --- rtengine/curves.cc | 6 +++--- rtengine/improcfun.cc | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 8b55718ed..68dab3c7a 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -356,8 +356,8 @@ void CurveFactory::curveCL ( bool & clcutili,const std::vector& clcurveP LUTf dCcurve(65536,0); float val; - for (int i=0; i<48000; i++) { //# 32768*1.414 approximation maxi for chroma - dCcurve[i] = (float)i / 47999.0; + for (int i=0; i<50000; i++) { //# 32768*1.414 approximation maxi for chroma + dCcurve[i] = (float)i / 49999.0; } if (outBeforeCLurveHistogram) @@ -373,7 +373,7 @@ void CurveFactory::curveCL ( bool & clcutili,const std::vector& clcurveP if (dCurve && !dCurve->isIdentity()) {needed = true;clcutili=true;} } - for (int i=0; i<=48000; i++) {//32768*1.414 + ... + for (int i=0; i<=50000; i++) {//32768*1.414 + ... float val; if (histNeededCL) { float hval = dCcurve[i]; diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index f11a7efc7..41ae60059 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -3019,8 +3019,9 @@ void ImProcFunctions::chromiLuminanceCurve (int pW, LabImage* lold, LabImage* ln float Chprov=CC; float Chprov1=CC; float memChprov=Chprov; - float Lprov2=LL; + float Lin=lold->L[i][j]; + float Lprov2=Lin; lnew->L[i][j] = curve[Lin]; float Lprov1=(lnew->L[i][j])/327.68f; float chromaChfactor=1.0f; @@ -3158,10 +3159,12 @@ void ImProcFunctions::chromiLuminanceCurve (int pW, LabImage* lold, LabImage* ln btmp *= factor; } + if (!bwToning && clut) { // begin C=f(L) float factorskin,factorsat,factor,factorskinext,interm; float chroma = sqrt(SQR(atmp)+SQR(btmp)+0.001f); - float chromaCfactor=(clcurve[Lprov1*327.68f])/(Lprov1*327.68f);//apply C=f(L) + // float chromaCfactor=(clcurve[Lprov1*327.68f])/(Lprov1*327.68f);//apply C=f(L) + float chromaCfactor=(clcurve[Lprov2*327.68f])/(Lprov2*327.68f);//apply C=f(L) float curf=0.7f;//empirical coeff because curve is more progressive float scale = 100.0f/100.1f;//reduction in normal zone for curve C float scaleext=1.0f;//reduction in transition zone for curve C @@ -3193,7 +3196,7 @@ void ImProcFunctions::chromiLuminanceCurve (int pW, LabImage* lold, LabImage* ln btmp *= factor; } // end C=f(L) - + // I have placed C=f(C) after all C treatments to assure maximum amplitude of "C" if (!bwToning && ccut) { float factorskin,factorsat,factor,factorskinext,interm;