diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index a071160bb..004423ba3 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -23,9 +23,9 @@ // //////////////////////////////////////////////////////////////// +#include +#include - -#include #include "../rtgui/threadutils.h" #include "rtengine.h" @@ -163,9 +163,6 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int { - MyTime t1e, t2e ; - t1e.set(); - #ifdef _DEBUG // init variables to display Munsell corrections MunsellDebugInfo* MunsDebugInfo = new MunsellDebugInfo(); @@ -219,10 +216,6 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int cp.tonemap = true; } - /*else if(params->wavelet.TMmethod=="std") {cp.TMmeth=1;cp.tonemap=true;} - else if(params->wavelet.TMmethod=="high") {cp.TMmeth=2;cp.tonemap=true;} - else if(params->wavelet.TMmethod=="lowhigh") {cp.TMmeth=3;cp.tonemap=true;} - */ if(params->wavelet.TMmethod == "cont") { cp.contmet = 1; } else if(params->wavelet.TMmethod == "tm") { @@ -1314,15 +1307,7 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int delete dsttmp; } - if (settings->verbose) { - t2e.set(); - printf("Wavelet performed in %d usec:\n", t2e.etime(t1e)); - } - -}//end o - - - +} #undef TS #undef fTS @@ -1460,7 +1445,6 @@ void ImProcFunctions::Eval2 (float ** WavCoeffs_L, int level, struct cont_param for (int dir = 1; dir < 4; dir++) { Aver(WavCoeffs_L[dir], W_L * H_L, avLP[dir], avLN[dir], maxL[dir], minL[dir]); Sigma(WavCoeffs_L[dir], W_L * H_L, avLP[dir], avLN[dir], sigP[dir], sigN[dir]); - // printf("dir=%d level=%d avLP=%f max=%f avLN=%f min=%f sigP=%f sigN=%f\n",dir,level,avLP[dir] ,maxL[dir], avLN[dir] ,minL[dir], sigP[dir], sigN[dir]); } AvL = 0.f; @@ -1501,9 +1485,6 @@ void ImProcFunctions::Eval2 (float ** WavCoeffs_L, int level, struct cont_param sigmaN[level] = SN; MaxP[level] = maxLP; MaxN[level] = maxLN; - // if(params->wavelet.CLmethod!="all") {//display only if user choose different from all - // printf("Ind=%d Level=%d MadL=%f AvL=%f AvN=%f SL=%f SN=%f maxP=%f maxN=%f\n",ind, level,MADL,mean[level],meanN[level],sigma[level],sigmaN[level],MaxP[level],MaxN[level]); - // } } float *ImProcFunctions::ContrastDR(float *Source, int skip, struct cont_params &cp, int W_L, int H_L, float Compression, float DetailBoost, float max0, float min0, float ave, float ah, float bh, float al, float bl, float factorx, float *Contrast) @@ -1520,27 +1501,7 @@ float *ImProcFunctions::ContrastDR(float *Source, int skip, struct cont_params & #endif for (int i = 0; i < W_L * H_L; i++) { //contrast - /* - //source between 0 and 1 - if(Source[i] < 1.f) { - float prov; - if( 32768.f*Source[i]> ave) { - float kh = ah*(Source[i]*100.f)+bh; - prov=32768.f*Source[i]; - Contrast[i]=ave+kh*(Source[i]*32768.f-ave); - } else { - float kl = al*(Source[i]*100.f)+bl; - prov=32768.f*Source[i]; - Contrast[i]=ave-kl*(ave-Source[i]*32768.f); - } - float diflc=Contrast[i]-prov; - diflc*=factorx; - Contrast[i] = (prov + diflc)/32768.f; - //contrast between 0 and 1 - } - */ Contrast[i] = Source[i] ; - } return Contrast; @@ -1608,9 +1569,6 @@ SSEFUNCTION float *ImProcFunctions::CompressDR(float *Source, int skip, struct c temp = (Compression - 1.0f) / 20.f; } -// printf("temp=%f \n", temp); - - #ifdef __SSE2__ #ifdef _RT_NESTED_OPENMP #pragma omp parallel @@ -2682,6 +2640,8 @@ void ImProcFunctions::finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0, void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschitz, int maxlvl, LabImage * labco, float ** varhue, float **varchrom, float ** WavCoeffs_L, float * WavCoeffs_L0, int level, int dir, struct cont_params &cp, int W_L, int H_L, int skip, float *mean, float *meanN, float *sigma, float *sigmaN, float *MaxP, float *MaxN, const WavCurve & wavCLVCcurve, const WavOpacityCurveW & waOpacityCurveW, FlatCurve* ChCurve, bool Chutili) { + assert (level >= 0); + assert (maxlvl > level); static const float scales[10] = {1.f, 2.f, 4.f, 8.f, 16.f, 32.f, 64.f, 128.f, 256.f, 512.f}; float scaleskip[10]; @@ -2694,17 +2654,11 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float t_r = settings->top_right; float t_l = settings->top_left; float b_r = settings->bot_right; - float b_l = settings->bot_left; float edd = settings->ed_detec; - float eddlow = settings->ed_low; float eddstrength = settings->ed_detecStr; float aedstr = (eddstrength - 1.f) / 90.f; float bedstr = 1.f - 10.f * aedstr; - bool refi = false; - - // if(cp.lev0s > 0.f || cp.lev1s > 0.f || cp.lev2s > 0.f) refi=true; - // if(cp.val > 0 || refi) {//edge if(cp.val > 0 && cp.edgeena) { float * koe; float maxkoe = 0.f; @@ -2718,7 +2672,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit maxkoe = 0.f; - if(cp.detectedge) {// + if(cp.detectedge) { float** tmC; int borderL = 1; tmC = new float*[H_L]; @@ -2779,8 +2733,6 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit } } - //printf("maxkoe=%f \n",maxkoe); - for (int i = 0; i < H_L; i++) { delete [] tmC[i]; } @@ -2840,9 +2792,6 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit } } - float coefsd = 0.85f; //arbitray value to reduce effect after sigma in all case - float coefmean = 0.85f; //arbitray value to reduce effect after sigma in all case -// edge = 1.f + value * exp (expkoef);//estimate edge "pseudo variance" //take into account local contrast float refin = value * exp (expkoef); @@ -2868,7 +2817,6 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float edgePrecalc = 1.f + refin; //estimate edge "pseudo variance" - //bool exa=false; if(cp.EDmet == 2) { //curve // if(exa) {//curve float insigma = 0.666f; //SD @@ -2883,7 +2831,6 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit float absciss; float kinterm; float kmul; - // for (int i=0; iL[ii*2][jj*2]; - LL100=LL100init=LL/327.68f; - LL100res=WavCoeffs_L0[i]/327.68f; - float delta=fabs(LL100init-LL100res)/(maxlvl/2); - for(int ml=0;ml