From d6b59d7215fa35db4f223a7760fc70dd1d77175e Mon Sep 17 00:00:00 2001 From: Emil Martinec Date: Sat, 13 Nov 2010 15:41:08 -0600 Subject: [PATCH] Fixes for auto-exposure, restoring histogram to curves, and labelling of colors in HSV equalizer. --- rtdata/languages/default | 4 ++-- rtdata/profiles/crisp.pp3 | 2 +- rtdata/profiles/default.pp3 | 2 +- rtdata/profiles/neutral.pp3 | 3 +-- rtengine/curves.cc | 3 +-- rtengine/improccoordinator.cc | 9 +++++++++ rtengine/improcfun.cc | 8 ++++---- rtengine/rawimagesource.cc | 26 +++++++++++++++----------- 8 files changed, 34 insertions(+), 23 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 7e38788af..7a7d28b99 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -634,8 +634,8 @@ TP_HLREC_LABEL;Highlight Reconstruction TP_HLREC_LUMINANCE;Luminance Recovery TP_HLREC_METHOD;Method: TP_HSVEQUALIZER1;Red -TP_HSVEQUALIZER2;Orange -TP_HSVEQUALIZER3;Yellow +TP_HSVEQUALIZER2;Yellow +TP_HSVEQUALIZER3;Lime TP_HSVEQUALIZER4;Green TP_HSVEQUALIZER5;Aqua TP_HSVEQUALIZER6;Blue diff --git a/rtdata/profiles/crisp.pp3 b/rtdata/profiles/crisp.pp3 index 04fdbf642..796ef0caf 100644 --- a/rtdata/profiles/crisp.pp3 +++ b/rtdata/profiles/crisp.pp3 @@ -4,7 +4,7 @@ Version=20101111 [Exposure] Auto=true -Clip=0.01 +Clip=0.0001 Compensation=0 Brightness=0 Contrast=12 diff --git a/rtdata/profiles/default.pp3 b/rtdata/profiles/default.pp3 index ae5bcc611..7c1080193 100644 --- a/rtdata/profiles/default.pp3 +++ b/rtdata/profiles/default.pp3 @@ -4,7 +4,7 @@ Version=20101111 [Exposure] Auto=true -Clip=0.01 +Clip=0.0001 Compensation=0 Brightness=0 Contrast=0 diff --git a/rtdata/profiles/neutral.pp3 b/rtdata/profiles/neutral.pp3 index e2fa6c34a..6f444edf9 100644 --- a/rtdata/profiles/neutral.pp3 +++ b/rtdata/profiles/neutral.pp3 @@ -1,10 +1,9 @@ - [Version] Version=20101111 [Exposure] Auto=false -Clip=0.001 +Clip=0.0001 Compensation=0 Brightness=0 Contrast=0 diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 5d24e90a0..5a5b93d2a 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -734,8 +734,7 @@ void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, dou // apply custom/parametric/NURBS curve, if any if (tcurve) { if (outBeforeCCurveHistogram) { - cum *= (float)val/val0; - float hval = brightcurve->getVal (cum); + float hval = shCurve[(int)(hlCurve[i])]*(float)val/(65535*val0); //if (needigamma) // hval = igamma2 (hval); int hi = (int)(255.0*CLIPD(hval)); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 770eb4135..9483955e5 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -389,6 +389,15 @@ void ImProcCoordinator::updateHistograms (int x1, int y1, int x2, int y2) { for (int i=y1; iL[i][j]/256]++; + + /*for (int i=0; i<256; i++) { + Lhist[i] = (int)(256*sqrt(Lhist[i])); + rhist[i] = (int)(256*sqrt(rhist[i])); + ghist[i] = (int)(256*sqrt(ghist[i])); + bhist[i] = (int)(256*sqrt(bhist[i])); + bcrgbhist[i] = (int)(256*sqrt(bcrgbhist[i])); + bcLhist[i] = (int)(256*sqrt(bcLhist[i])); + }*/ } void ImProcCoordinator::progress (Glib::ustring str, int pr) { diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index e2fd17fa6..6eb2a0dea 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -615,7 +615,7 @@ void ImProcFunctions::getAutoExp (unsigned int* histogram, int histcompr, doubl double corr = pow(2.0, expcomp); // black point selection is based on the linear result (yielding better visual results) - bl = (int)(shc /* * corr*/); + bl = (int)(shc * corr); // compute the white point of the exp. compensated gamma corrected image double awg = (int)(CurveFactory::gamma2 (aw * corr / 65536.0) * 65536.0); @@ -624,17 +624,17 @@ void ImProcFunctions::getAutoExp (unsigned int* histogram, int histcompr, doubl for (int i=0; i<65536>>histcompr; i++) gavg += histogram[i] * CurveFactory::gamma2((int)(corr*(i<width-border; } if (ri->filters) - for (int j=start; j>histcompr]+=2; - else*/ - histogram[rawData[i][j]>>histcompr]+=4; - else - for (int j=start; j<3*end; j++) { - histogram[rawData[i][j+0]>>histcompr]++; - histogram[rawData[i][j+1]>>histcompr]+=2; - histogram[rawData[i][j+2]>>histcompr]++; - } + for (int j=start; j>histcompr]+=4; + else if (ISRED(ri,i,j)) + histogram[CLIP((int)(camwb_red*rawData[i][j]))>>histcompr]+=4; + else if (ISBLUE(ri,i,j)) + histogram[CLIP((int)(camwb_blue*rawData[i][j]))>>histcompr]+=4; + } else { + for (int j=start; j<3*end; j++) { + histogram[CLIP((int)(rawData[i][j+0]>>histcompr))]++; + histogram[CLIP((int)(rawData[i][j+1]>>histcompr))]+=2; + histogram[CLIP((int)(rawData[i][j+2]>>histcompr))]++; + } + } + } return 1; }