Fixed gamma call in deprecated dirpyrdenoise code.

This commit is contained in:
Emil Martinec
2012-03-04 12:21:01 -06:00
parent 16947d6450
commit 04971bdd96
5 changed files with 17 additions and 12 deletions

View File

@@ -1023,8 +1023,11 @@ void ImProcFunctions::FixImpulse_ab(LabImage * src, LabImage * dst, double radiu
//WavCoeffs_a[dir][coeffloc_ab] *= edgefactor*(coeff_a>2 ? 1 : (coeff_a<1 ? 0 : (coeff_a - 1)));
//WavCoeffs_b[dir][coeffloc_ab] *= edgefactor*(coeff_b>2 ? 1 : (coeff_b<1 ? 0 : (coeff_b - 1)));
WavCoeffs_a[dir][coeffloc_ab] *= SQR(1-exp(-(mag_a/mad_a)-(mag_L/(9*mad_L))));
WavCoeffs_b[dir][coeffloc_ab] *= SQR(1-exp(-(mag_b/mad_b)-(mag_L/(9*mad_L))));
//float satfactor_a = mad_a/(mad_a+0.5*SQR(WavCoeffs_a[0][coeffloc_ab]));
//float satfactor_b = mad_b/(mad_b+0.5*SQR(WavCoeffs_b[0][coeffloc_ab]));
WavCoeffs_a[dir][coeffloc_ab] *= SQR(1-exp(-(mag_a/mad_a)-(mag_L/(9*mad_L)))/*satfactor_a*/);
WavCoeffs_b[dir][coeffloc_ab] *= SQR(1-exp(-(mag_b/mad_b)-(mag_L/(9*mad_L)))/*satfactor_b*/);
}
}//now chrominance coefficients are denoised

View File

@@ -557,7 +557,7 @@ namespace rtengine {
T *tmpLo = new T[m_w*m_h2];
T *tmpHi = new T[m_w*m_h2];
T *buffer = new T[MAX(m_w,m_h)];
T *buffer = new T[MAX(m_w,m_h)+2*m_pad];
/* filter along columns */
for (int j=0; j<m_w; j++) {

View File

@@ -114,7 +114,7 @@ namespace rtengine {
//LUTf Lcurve(65536);
//LUTf abcurve(65536);
for (int i=0; i<65536; i++) {
int g = (int)(CurveFactory::gamma((double)i/65535.0, gam, gamthresh, gamslope, 1.0, 0.0) * 65535.0);
int g = (int)(Color::gamma((double)i/65535.0, gam, gamthresh, gamslope, 1.0, 0.0) * 65535.0);
gamcurve[i] = CLIP(g);
/*float val = (float)i/65535.0;
float Lval = (2*(lumacurve->getVal(val)));
@@ -132,7 +132,7 @@ namespace rtengine {
//#pragma omp parallel for if (multiThread)
for (int i=0; i<src->H; i++) {
for (int j=0; j<src->W; j++) {
//src->L[i][j] = CurveFactory::flinterp(gamcurve,src->L[i][j]);
//src->L[i][j] = Color::flinterp(gamcurve,src->L[i][j]);
src->L[i][j] = gamcurve[src->L[i][j]];
}
}
@@ -150,11 +150,11 @@ namespace rtengine {
//set up NR weight functions
//gamma correction for chroma in shadows
float nrwtl_norm = ((CurveFactory::gamma((double)65535.0/65535.0, gam, gamthresh, gamslope, 1.0, 0.0)) -
(CurveFactory::gamma((double)75535.0/65535.0, gam, gamthresh, gamslope, 1.0, 0.0)));
float nrwtl_norm = ((Color::gamma((double)65535.0/65535.0, gam, gamthresh, gamslope, 1.0, 0.0)) -
(Color::gamma((double)75535.0/65535.0, gam, gamthresh, gamslope, 1.0, 0.0)));
for (int i=0; i<65536; i++) {
nrwt_l[i] = ((CurveFactory::gamma((double)i/65535.0, gam, gamthresh, gamslope, 1.0, 0.0) -
CurveFactory::gamma((double)(i+10000)/65535.0, gam, gamthresh, gamslope, 1.0, 0.0)) )/nrwtl_norm;
nrwt_l[i] = ((Color::gamma((double)i/65535.0, gam, gamthresh, gamslope, 1.0, 0.0) -
Color::gamma((double)(i+10000)/65535.0, gam, gamthresh, gamslope, 1.0, 0.0)) )/nrwtl_norm;
//if (i % 100 ==0) printf("%d %f \n",i,nrwt_l[i]);
}
@@ -262,7 +262,7 @@ namespace rtengine {
float igamthresh = gamthresh*gamslope;
float igamslope = 1/gamslope;
for (int i=0; i<65536; i++) {
gamcurve[i] = (CurveFactory::gamma((float)i/65535.0, igam, igamthresh, igamslope, 1.0, 0.0) * 65535.0);
gamcurve[i] = (Color::gamma((float)i/65535.0, igam, igamthresh, igamslope, 1.0, 0.0) * 65535.0);
}

View File

@@ -190,8 +190,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
ipf.getAutoExp (aehist, aehistcompr, clip, params.dirpyrDenoise.expcomp, brightness, contrast, black, hlcompr, hlcomprthresh);
if (todo & M_LINDENOISE) {
printf("denoising!\n");
// @Emil: put your luminance denoise tool here ; of course, at this stage, you only have an ImageFloat, no LabImage yet...
//printf("denoising!\n");
if (scale==1 && params.dirpyrDenoise.enabled) {
ipf.RGB_denoise(orig_prev, orig_prev, params.dirpyrDenoise, params.defringe);
}

View File

@@ -111,6 +111,9 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
imgsrc->getImage (currWB, tr, baseImg, pp, params.hlrecovery, params.icm, params.raw);
if (pl) pl->setProgress (0.45);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// start tile processing...???
// perform luma denoise
LabImage* labView = new LabImage (fw,fh);