Changed behavior of "Shadow compression" to shadow recovery; now 0 on the slider is black clipping, 50 is no compression, 100 is shadow expansion. Implemented a rudimentary highlight desaturation to prevent color shifts under exposure compensation, along the lines of relative colorimetric rendering intent.

This commit is contained in:
Emil Martinec 2010-10-27 20:53:52 -05:00
parent 9a05fd7af3
commit 6770a2c4a0
4 changed files with 33 additions and 9 deletions

View File

@ -603,15 +603,15 @@ TP_EXPOSURE_AUTOLEVELS;Auto Levels
TP_EXPOSURE_BLACKLEVEL;Black TP_EXPOSURE_BLACKLEVEL;Black
TP_EXPOSURE_BRIGHTNESS;Brightness TP_EXPOSURE_BRIGHTNESS;Brightness
TP_EXPOSURE_CLIP;Clip TP_EXPOSURE_CLIP;Clip
TP_EXPOSURE_COMPRHIGHLIGHTS;Highlight rolloff TP_EXPOSURE_COMPRHIGHLIGHTS;Highlight recovery
TP_EXPOSURE_COMPRSHADOWS;Shadow compression TP_EXPOSURE_COMPRSHADOWS;Shadow recovery
TP_EXPOSURE_CONTRAST;Contrast TP_EXPOSURE_CONTRAST;Contrast
TP_EXPOSURE_CURVEEDITOR;Tone Curve TP_EXPOSURE_CURVEEDITOR;Tone Curve
TP_EXPOSURE_EXPCOMP;Exp. Comp. TP_EXPOSURE_EXPCOMP;Exp. Comp.
TP_EXPOSURE_LABEL;Exposure TP_EXPOSURE_LABEL;Exposure
TP_HLREC_CIELAB;CIELab Blending TP_HLREC_CIELAB;CIELab Blending
TP_HLREC_COLOR;Color Propagation TP_HLREC_COLOR;Color Propagation
TP_HLREC_LABEL;Highlight Recovery TP_HLREC_LABEL;Highlight Reconstruction
TP_HLREC_LUMINANCE;Luminance Recovery TP_HLREC_LUMINANCE;Luminance Recovery
TP_HLREC_METHOD;Method: TP_HLREC_METHOD;Method:
TP_ICM_FILEDLGFILTERANY;Any files TP_ICM_FILEDLGFILTERANY;Any files

View File

@ -694,7 +694,7 @@ void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, dou
double def_mul = pow (2.0, defmul); double def_mul = pow (2.0, defmul);
printf ("def_mul= %f ecomp= %f black= %f hlcompr= %f shcompr= %f br= %f contr= %f defmul= %f gamma= %f, skip= %d \n",def_mul,ecomp,black,hlcompr,shcompr,br,contr,defmul,gamma_,skip); //printf ("def_mul= %f ecomp= %f black= %f hlcompr= %f shcompr= %f br= %f contr= %f defmul= %f gamma= %f, skip= %d \n",def_mul,ecomp,black,hlcompr,shcompr,br,contr,defmul,gamma_,skip);
// compute parameters of the gamma curve // compute parameters of the gamma curve
double start = exp(gamma_*log( -0.099 / ((1.0/gamma_-1.0)*1.099 ))); double start = exp(gamma_*log( -0.099 / ((1.0/gamma_-1.0)*1.099 )));
@ -729,7 +729,7 @@ void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, dou
std::vector<double> basecurvePoints; std::vector<double> basecurvePoints;
basecurvePoints.push_back((double)((CurveType)NURBS)); basecurvePoints.push_back((double)((CurveType)NURBS));
float toex = MIN(1,black/(a*def_mul)); float toex = MIN(1,black/(a*def_mul));
float toey = MAX(0,toex*a*def_mul*(1-shcompr/50.0)); float toey = MAX(0,toex*a*def_mul*(shcompr/25.0-1));
float shoulderx = 1/(a*def_mul);//point in x at which line of slope a starting at (0,0) reaches y=1 float shoulderx = 1/(a*def_mul);//point in x at which line of slope a starting at (0,0) reaches y=1
float shouldery=1; float shouldery=1;
float toneslope=(shouldery-toey)/(shoulderx-toex); float toneslope=(shouldery-toey)/(shoulderx-toex);
@ -752,7 +752,7 @@ void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, dou
shouldery = toey + (1-toex)*a; shouldery = toey + (1-toex)*a;
}*/ }*/
basecurvePoints.push_back(MAX(0,0.99*toex*(shcompr/50.0-1))); //black point. Value in [0 ; 1] range basecurvePoints.push_back(MAX(0,0.99*toex*(1-shcompr/25.0))); //black point. Value in [0 ; 1] range
basecurvePoints.push_back(0); //black point. Value in [0 ; 1] range basecurvePoints.push_back(0); //black point. Value in [0 ; 1] range
basecurvePoints.push_back(toex); //toe point basecurvePoints.push_back(toex); //toe point

View File

@ -324,15 +324,39 @@ void ImProcFunctions::rgbProc (Image16* working, LabImage* lab, int* tonecurve1,
/*r = tonecurve[r]; /*r = tonecurve[r];
g = tonecurve[g]; g = tonecurve[g];
b = tonecurve[b];*/ b = tonecurve[b];*/
int Y = (int)(0.299*r + 0.587*g + 0.114*b); int Y = (0.299*r + 0.587*g + 0.114*b);
float tonefactor = (Y>0 ? (float)tonecurve1[Y]/Y : 1); int Ynew = tonecurve1[Y];
float tonefactor = (Y>0 ? (float)Ynew/Y : 1);
r *= tonefactor; r *= tonefactor;
g *= tonefactor; g *= tonefactor;
b *= tonefactor; b *= tonefactor;
float maxfactor = 1;
if (r>65535)
maxfactor = MIN(maxfactor, (float)(65535.0f-Ynew)/(r-Ynew));
if (g>65535)
maxfactor = MIN(maxfactor, (float)(65535.0f-Ynew)/(g-Ynew));
if (b>65535)
maxfactor = MIN(maxfactor, (float)(65535.0f-Ynew)/(b-Ynew));
if (r<0)
maxfactor = MIN(maxfactor, ((float)Ynew)/(Ynew-r));
if (g<0)
maxfactor = MIN(maxfactor, ((float)Ynew)/(Ynew-g));
if (b<0)
maxfactor = MIN(maxfactor, ((float)Ynew)/(Ynew-b));
float U = (float)(-0.14713*r - 0.28886*g + 0.436*b)*maxfactor;
float V = (float)(0.615*r - 0.51499*g - 0.10001*b)*maxfactor;
r = CLIP(Ynew + 1.13983*V);
g = CLIP(Ynew - 0.39465*U - 0.58060*V);
b = CLIP(Ynew + 2.03211*U);
r = tonecurve2[CLIP(r)]; r = tonecurve2[CLIP(r)];
g = tonecurve2[CLIP(g)]; g = tonecurve2[CLIP(g)];
b = tonecurve2[CLIP(b)]; b = tonecurve2[CLIP(b)];
int x = (toxyz[0][0] * r + toxyz[1][0] * g + toxyz[2][0] * b) >> 15; 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; int y = (toxyz[0][1] * r + toxyz[1][1] * g + toxyz[2][1] * b) >> 15;

View File

@ -57,7 +57,7 @@ ToneCurve::ToneCurve () : ToolPanel(), expAdd(false), blackAdd(false), brAdd(fal
//----------- Black Level ---------------------------------- //----------- Black Level ----------------------------------
black = Gtk::manage (new Adjuster (M("TP_EXPOSURE_BLACKLEVEL"), 0, 16384, 1, 0)); black = Gtk::manage (new Adjuster (M("TP_EXPOSURE_BLACKLEVEL"), 0, 16384, 1, 0));
pack_start (*black); pack_start (*black);
shcompr = Gtk::manage (new Adjuster (M("TP_EXPOSURE_COMPRSHADOWS"), -100, 100, 1, 50)); shcompr = Gtk::manage (new Adjuster (M("TP_EXPOSURE_COMPRSHADOWS"), 0, 100, 1, 25));
pack_start (*shcompr); pack_start (*shcompr);
pack_start (*Gtk::manage (new Gtk::HSeparator())); pack_start (*Gtk::manage (new Gtk::HSeparator()));