From 04971bdd96130950a5b4981beda33d26ea4ab3c0 Mon Sep 17 00:00:00 2001 From: Emil Martinec Date: Sun, 4 Mar 2012 12:21:01 -0600 Subject: [PATCH] Fixed gamma call in deprecated dirpyrdenoise code. --- rtengine/FTblockDNchroma.cc | 7 +++++-- rtengine/cplx_wavelet_level.h | 2 +- rtengine/dirpyrLab_denoise.cc | 14 +++++++------- rtengine/improccoordinator.cc | 3 +-- rtengine/simpleprocess.cc | 3 +++ 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/rtengine/FTblockDNchroma.cc b/rtengine/FTblockDNchroma.cc index e988c80f4..074aa8d65 100644 --- a/rtengine/FTblockDNchroma.cc +++ b/rtengine/FTblockDNchroma.cc @@ -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 diff --git a/rtengine/cplx_wavelet_level.h b/rtengine/cplx_wavelet_level.h index 23d1f4976..fccdfd83a 100644 --- a/rtengine/cplx_wavelet_level.h +++ b/rtengine/cplx_wavelet_level.h @@ -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; jgetVal(val))); @@ -132,7 +132,7 @@ namespace rtengine { //#pragma omp parallel for if (multiThread) for (int i=0; iH; i++) { for (int j=0; jW; 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); } diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 082c4d805..c7c8c83a6 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -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); } diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 5791a53d3..a7c41e9cc 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -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);