Improvements in highlight rolloff behavior.

This commit is contained in:
Emil Martinec
2010-10-23 07:44:06 -05:00
parent 0980afc2b6
commit 3f8d4732e3
3 changed files with 10 additions and 10 deletions

View File

@@ -694,7 +694,7 @@ void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, dou
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
double start = exp(gamma_*log( -0.099 / ((1.0/gamma_-1.0)*1.099 )));
@@ -729,17 +729,16 @@ void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, dou
std::vector<double> basecurvePoints;
basecurvePoints.push_back((double)((CurveType)NURBS));
float toex = MIN(1,black/a);
float toey = MAX(0,toex*a*(1-shcompr/100.0));
float toey = toex*a*(1-shcompr/100.0);
float shoulderx = 1/a;//point in x at which line of slope a starting at (0,0) reaches y=1
float shouldery=1;
/*float toneslope=(shouldery-toey)/(shoulderx-toex);
float toneslope=(shouldery-toey)/(shoulderx-toex);
if (shoulderx<1) {//a>1; positive EC
//move shoulder down if there is highlight rolloff
shouldery = MAX(0.4*toey+0.6*shouldery, shouldery-(0.8)*(hlcompr/100.0));
shoulderx = MAX(0.4*toex+0.6*shoulderx, shoulderx - (1-shouldery)/toneslope);
shouldery = shouldery-(0.3)*(hlcompr/100.0);
shoulderx = shoulderx - (1-shouldery)/toneslope;
} else {//a<1; negative EC
*/
if (shoulderx>1) {
//if (shoulderx>1) {
shoulderx = 1;
shouldery = a;
}
@@ -767,7 +766,9 @@ void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, dou
basecurvePoints.push_back(shoulderx); //shoulder point
basecurvePoints.push_back(shouldery); //value at shoulder point
if (shoulderx<1) {
basecurvePoints.push_back(1-0.95*(1-shoulderx)*(1-hlcompr/100.0)); // white point
basecurvePoints.push_back(1-0.95*(1-shoulderx)*(1-hlcompr/105.0)); // lead into point
basecurvePoints.push_back(1); // value near white point
basecurvePoints.push_back(1); // white point
basecurvePoints.push_back(1); // value at white point
}
}

View File

@@ -334,6 +334,7 @@ void ImProcFunctions::rgbProc (Image16* working, LabImage* lab, int* tonecurve,
z = CLIPTO(z,0,2*65536-1);
int L = cacheL[y];
//int L = cacheL[tonecurve[y]];//for luminance tone curve, use this (and comment out rgb tonecurves)
lab->L[i][j] = L;
lab->a[i][j] = CLIPC(((cachea[x] - cachea[y]) * chroma_scale) >> 15);
lab->b[i][j] = CLIPC(((cacheb[y] - cacheb[z]) * chroma_scale) >> 15);

View File

@@ -46,8 +46,6 @@ LCurve::LCurve () : ToolPanel(), brAdd(false), contrAdd(false), satAdd(false) {
Gtk::HBox* abox = Gtk::manage (new Gtk::HBox ());
abox->set_border_width (2);
// brightness = Gtk::manage (new Adjuster (M("TP_LUMACURVE_BRIGHTNESS"), -100, 100, 0.01, 0));
//contrast = Gtk::manage (new Adjuster (M("TP_LUMACURVE_CONTRAST"), -100, 100, 1, 0));
brightness = Gtk::manage (new Adjuster (M("TP_LABCURVE_BRIGHTNESS"), -100, 100, 0.01, 0));
contrast = Gtk::manage (new Adjuster (M("TP_LABCURVE_CONTRAST"), -100, 100, 1, 0));
saturation = Gtk::manage (new Adjuster (M("TP_LABCURVE_SATURATION"), -100, 100, 1, 0));