Patch to fix behavior of Exposure slider. Corresponding bugfix for autoexposure.

This commit is contained in:
Emil Martinec
2010-07-31 02:11:54 -05:00
parent db4de44e30
commit e39dd457dd
3 changed files with 21 additions and 6 deletions

View File

@@ -69,7 +69,7 @@ void RawImageSource::amaze_demosaic_RT() {
static const float eps=1e-5, epssq=1e-10; //tolerance to avoid dividing by zero
//adaptive ratios threshold
static const float arthresh=-0.75;
static const float arthresh=0.75;
//nyquist texture test threshold
static const float nyqthresh=0.5;
//diagonal interpolation test threshold
@@ -798,16 +798,19 @@ void RawImageSource::amaze_demosaic_RT() {
ve=fabs(0.5-hvwtalt);
if (vo<ve) {hvwt[indx]=hvwtalt;}//a better result was obtained from the neighbors
//if (hvwt[indx]<0.25) hvwt[indx]=0.0;
//if (hvwt[indx]>0.75) hvwt[indx]=1.0;
Dgrb[indx][0] = (hcd[indx]*(1-hvwt[indx]) + vcd[indx]*hvwt[indx]);//evaluate color differences
//if (hvwt[indx]<0.5) Dgrb[indx][0]=hcd[indx];
//if (hvwt[indx]>0.5) Dgrb[indx][0]=vcd[indx];
rgb[indx][1] = cfa[indx] + Dgrb[indx][0];//evaluate G (finally!)
//local curvature in G (preparation for nyquist refinement step)
if (nyquist[indx]) {
Dgrbh2[indx] = SQR(rgb[indx][1] - 0.5*(rgb[indx-1][1]+rgb[indx+1][1]));
Dgrbv2[indx] = SQR(rgb[indx][1] - 0.5*(rgb[indx-v1][1]+rgb[indx+v1][1]));
} else {
Dgrbh2[indx] = Dgrbv2[indx] = 0;
}
}

View File

@@ -446,6 +446,9 @@ void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, dou
// clear array that stores histogram valid before applying the custom curve
if (outBeforeCCurveHistogram)
memset (outBeforeCCurveHistogram, 0, 256*sizeof(int));
//float atmp=a;
//a = 1;
for (int i=0; i<=0xffff; i+= i<0xffff-skip ? skip : 1 ) {
@@ -454,13 +457,20 @@ void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, dou
// apply default multiplier (that is >1 if highlight recovery is on)
val *= def_mul;
//exposure compensation
//val *= atmp;
//black *= atmp;
//D *= atmp;
// gamma correction
if (gamma_>0)
val = gamma (val, gamma_, start, slope, mul, add);
// apply base curve, thus, exposure compensation and black point with shadow and highlight protection
val = basecurve (val, a, black, D, hlcompr/100.0, shcompr/100.0);
// gamma correction
if (gamma_>0)
val = gamma (val, gamma_, start, slope, mul, add);
// apply brightness curve
val = brightness (val, br/100.0);

View File

@@ -490,6 +490,8 @@ void ImProcFunctions::getAutoExp (unsigned int* histogram, int histcompr, doubl
if (awg < maxaw)
awg = maxaw;
}
awg = CurveFactory::igamma2 (awg); //need to inverse gamma transform to get correct exposure compensation parameter
br = log(65535.0 / (awg-bl)) / log(2.0);
if (br<0)