From 373f826dbe8ef266f1b94eeaa1950a7e89196c3f Mon Sep 17 00:00:00 2001 From: Emil Martinec Date: Sun, 24 Oct 2010 08:35:56 -0500 Subject: [PATCH] Another patch for highlight rolloff. Fixes black spots issue. --- rtengine/curves.cc | 2 +- rtengine/improcfun.cc | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 9236b8e51..c289e78e2 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -735,7 +735,7 @@ void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, dou float toneslope=(shouldery-toey)/(shoulderx-toex); if (shoulderx<1) {//a>1; positive EC //move shoulder down if there is highlight rolloff - shouldery = shouldery-(0.2)*(hlcompr/100.0); + shouldery = shouldery-(0.3)*(hlcompr/100.0); shoulderx = shoulderx - (1-shouldery)/toneslope; } else {//a<1; negative EC //if (shoulderx>1) { diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 8b6f7c58a..8107175f7 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -324,19 +324,19 @@ void ImProcFunctions::rgbProc (Image16* working, LabImage* lab, int* tonecurve1, /*r = tonecurve[r]; g = tonecurve[g]; b = tonecurve[b];*/ - //int Y = (int)(0.299*r + 0.587*g + 0.114*b); - //float tonefactor = (Y>0 ? (float)tonecurve[Y]/Y : 0); - float rtonefactor = (r>0 ? (float)tonecurve1[r]/r : 0); - float gtonefactor = (g>0 ? (float)tonecurve1[g]/g : 0); - float btonefactor = (b>0 ? (float)tonecurve1[b]/b : 0); - float tonefactor = MIN(rtonefactor, MIN(gtonefactor,btonefactor)); + int Y = (int)(0.299*r + 0.587*g + 0.114*b); + float tonefactor = (Y>0 ? (float)tonecurve1[Y]/Y : 1); + /*float rtonefactor = (r>0 ? (float)tonecurve1[r]/r : 1); + float gtonefactor = (g>0 ? (float)tonecurve1[g]/g : 1); + float btonefactor = (b>0 ? (float)tonecurve1[b]/b : 1); + float tonefactor = MIN(rtonefactor, MIN(gtonefactor,btonefactor));*/ r *= tonefactor; g *= tonefactor; b *= tonefactor; - r = tonecurve2[r]; - g = tonecurve2[g]; - b = tonecurve2[b]; + r = tonecurve2[CLIP(r)]; + g = tonecurve2[CLIP(g)]; + b = tonecurve2[CLIP(b)]; int x = (toxyz[0][0] * r + toxyz[1][0] * g + toxyz[2][0] * b) >> 15; int y = (toxyz[0][1] * r + toxyz[1][1] * g + toxyz[2][1] * b) >> 15;