From 81088b960de6966e0428bed3fcd61debbc1d3095 Mon Sep 17 00:00:00 2001 From: jdc Date: Mon, 7 Jul 2014 20:29:19 +0200 Subject: [PATCH] Improving medians Denoise issue2423 --- rtdata/languages/default | 29 +++- rtengine/FTblockDN.cc | 305 +++++++++++++++++++++++++++++++++-- rtengine/procevents.h | 5 +- rtengine/procparams.cc | 18 ++- rtengine/procparams.h | 3 + rtengine/refreshmap.cc | 5 +- rtgui/addsetids.h | 3 +- rtgui/batchtoolpanelcoord.cc | 4 +- rtgui/dirpyrdenoise.cc | 155 +++++++++++++++++- rtgui/dirpyrdenoise.h | 11 +- rtgui/options.cc | 1 + rtgui/paramsedited.cc | 9 ++ rtgui/paramsedited.h | 3 + rtgui/preferences.cc | 1 + 14 files changed, 512 insertions(+), 40 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 4d8ede071..87cc60940 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -505,6 +505,10 @@ HISTORY_MSG_281;Color Toning - Sat. Protection HISTORY_MSG_282;Color Toning - Sat. Threshold HISTORY_MSG_283;Color Toning - Str. Protection HISTORY_MSG_284;Color Toning - Auto saturation +HISTORY_MSG_285;NR - median type Lab +HISTORY_MSG_286;NR - median method +HISTORY_MSG_287;NR - median type RGB +HISTORY_MSG_288;NR - median iterations HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOTS;Snapshots @@ -1152,8 +1156,9 @@ TP_DIRPYRDENOISE_CHROMA;Chrominance - Master TP_DIRPYRDENOISE_ENABLED_TOOLTIP;Can be used on raw and non-raw images.\n\nFor non-raw images noise reduction of luminance depends on the gamma of the input color profile. An sRGB gamma is assumed, thus if the image uses an input color profile of a different gamma, the effects of luminance noise reduction will differ. TP_DIRPYRDENOISE_ENH;Enhanced mode TP_DIRPYRDENOISE_ENH_TOOLTIP;Increases noise reduction quality at the expense of a 20% processing time increase. -TP_DIRPYRDENOISE_MED;Median -TP_DIRPYRDENOISE_MED_TOOLTIP;Add a median 3x3 soft or 3x3 standard or 5x5 strong at the end of threatment - Increases noise reduction at the expense of a 4% to 10% processing time increase. +TP_DIRPYRDENOISE_MED;Median - Luminance only +TP_DIRPYRDENOISE_MET_TOOLTIP;Choice of median type : median 3x3 or 3x3 strong or 5x5 (RGB) or 5x5 strong or 7x7 (L only and Lab)in the threatment - Increases noise reduction. +TP_DIRPYRDENOISE_METM_TOOLTIP;Add a median - in mode "Luminance only" or "Lab" just after wavelet\nOr in mode "RGB" at the end TP_DIRPYRDENOISE_GAMMA;Gamma TP_DIRPYRDENOISE_GAMMA_TOOLTIP;Gamma varies noise reduction strength across the range of tones. Smaller values will target shadows, while larger values will stretch the effect to the brighter tones. TP_DIRPYRDENOISE_LABEL;Noise Reduction @@ -1165,12 +1170,20 @@ TP_DIRPYRDENOISE_METHOD_TOOLTIP;For raw images either RGB or Lab methods can be TP_DIRPYRDENOISE_PERF;RGB mode (raw images) TP_DIRPYRDENOISE_RED;Chrominance - Red-Green TP_DIRPYRDENOISE_RGB;RGB -TP_DIRPYRDENOISE_MEDMETHOD;Median Method -TP_DIRPYRDENOISE_SOFT;3x3 soft -TP_DIRPYRDENOISE_33;3x3 standard -TP_DIRPYRDENOISE_55;5x5 -TP_DIRPYRDENOISE_55SOFT;5x5 soft -TP_DIRPYRDENOISE_MET_TOOLTIP;allow different denoise: soft preserve detail, 3x3 standard, 5x5 soft, 5x5 +TP_DIRPYRDENOISE_MEDMETHOD;Median type +TP_DIRPYRDENOISE_METHODMED;Median Method +TP_DIRPYRDENOISE_LM;Luminance only +TP_DIRPYRDENOISE_LABM;Lab +TP_DIRPYRDENOISE_RGBM;RGB +TP_DIRPYRDENOISE_NONE;None +TP_DIRPYRDENOISE_SOFT;3x3 +TP_DIRPYRDENOISE_33;3x3 strong +TP_DIRPYRDENOISE_55;5x5 strong +TP_DIRPYRDENOISE_55SOFT;5x5 +TP_DIRPYRDENOISE_77;7x7 'slow' +TP_DIRPYRDENOISE_MED_TOOLTIP;If enabled median for luminance (Lab) after wavelet, if desabled RGB at the end of threatment. +TP_DIRPYRDENOISE_PASSE;Iterations +TP_DIRPYRDENOISE_PASSES_TOOLTIP;Often, it is better to do iterations, with small median, than one with big ! TP_DIRPYREQUALIZER_ALGO;Algorithm Skin TP_DIRPYREQUALIZER_ALGO_FI;Fine TP_DIRPYREQUALIZER_ALGO_LA;Large diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index 8b1df4315..4a339e366 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -140,7 +140,7 @@ namespace rtengine { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - extern const Settings* settings; +extern const Settings* settings; // Median calculation using quicksort float fq_sort2(float arr[], int n) @@ -187,6 +187,27 @@ float fq_sort2(float arr[], int n) } } +float media(float *elements, int N) +{ + int i,j,min; + float temp; + + // Order elements (only half of them) + for (i = 0; i < (N >> 1) + 1; ++i) + { + // Find position of minimum element + min = i; + for (j = i + 1; j < N; ++j) + if (elements[j] < elements[min]) + min = j; + // Put found minimum element in its place + temp = elements[i]; + elements[i] = elements[min]; + elements[min] = temp; + } + // Get result - the middle element + return elements[N >> 1]; +} void ImProcFunctions::RGB_denoise(Imagefloat * src, Imagefloat * dst, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const procparams::DefringeParams & defringe, const double expcomp) @@ -213,14 +234,14 @@ float fq_sort2(float arr[], int n) const short int imheight=src->height, imwidth=src->width; - if (dnparams.luma==0 && dnparams.chroma==0 && !dnparams.median) { + if (dnparams.luma==0 && dnparams.chroma==0 && dnparams.methodmed=="none" ) { //nothing to do; copy src to dst or do nothing in case src == dst if(src != dst) memcpy(dst->data,src->data,dst->width*dst->height*3*sizeof(float)); return; } - if (dnparams.luma!=0 || dnparams.chroma!=0) { + if (dnparams.luma!=0 || dnparams.chroma!=0 || dnparams.methodmed=="Lab" || dnparams.methodmed=="Lonly") { perf=false; if(dnparams.dmethod=="RGB") perf=true;//RGB mode //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -552,8 +573,9 @@ float fq_sort2(float arr[], int n) //binary 1 or 0 for each level, eg subsampling = 0 means no subsampling, 1 means subsample //the first level only, 7 means subsample the first three levels, etc. float noisevarL = (float) (SQR((dnparams.luma/125.0)*(1.+ dnparams.luma/25.0))); - + //printf("noisL=%f \n",noisevarL); float interm_med= (float) dnparams.chroma/10.0; + //printf("inter=%f\n",interm_med); float intermred, intermblue; if(dnparams.redchro > 0.) intermred=0.0014f* (float)SQR(dnparams.redchro); else intermred= (float) dnparams.redchro/7.0;//increase slower than linear for more sensit float intermred2=(float) dnparams.redchro/7.0; @@ -566,8 +588,10 @@ float fq_sort2(float arr[], int n) float realblue = interm_med + intermblue; if (realblue < 0.f) realblue=0.01f; float realblue2 = interm_med + intermblue2; if (realblue2 < 0.f) realblue2=0.01f; float noisevarab_b = SQR(realblue); - - + bool execwavelet=true; + if(noisevarL < 0.00007f && interm_med < 0.1f && (dnparams.methodmed=="Lab" || dnparams.methodmed=="Lonly")) execwavelet=false;//do not exec wavelet if sliders luminance and chroma are very small and median need + //we considered user don't want wavelet + if(execwavelet) {//gain time if user choose only median sliders L <=1 slider chrom master < 1 { // enclosing this code in a block frees about 120 MB before allocating 20 MB after this block (measured with D700 NEF) wavelet_decomposition* Ldecomp; wavelet_decomposition* adecomp; @@ -597,7 +621,7 @@ float fq_sort2(float arr[], int n) bdecomp->reconstruct(labdn->data+2*datalen); delete bdecomp; } - + } //TODO: at this point wavelet coefficients storage can be freed //Issue 1680: Done now @@ -606,7 +630,256 @@ float fq_sort2(float arr[], int n) impulse_nr (labdn, MIN(50.0f,(float)dnparams.luma)/20.0f); } //PF_correct_RT(dst, dst, defringe.radius, defringe.threshold); + + int metchoice=0; + if(dnparams.methodmed=="Lonly") metchoice=1; + else if(dnparams.methodmed=="Lab") metchoice=2; + + //median on Luminance Lab only + if(metchoice==1 || metchoice ==2) { + for(int iteration=1;iteration<=dnparams.passes;iteration++){ + //printf("pas=%i\n",iteration); + int wid=labdn->W; + int hei=labdn->H; + float** tmL; + tmL = new float*[hei]; + for (int i=0; iL[i][j] ,labdn->L[i-1][j], labdn->L[i+1][j] ,labdn->L[i][j+1],labdn->L[i][j-1], tmL[i][j]);//3x3 soft + } + else + for (int j=1; j impluse denoise !I let here to get trace + /* pp[0] = labdn->L[i][j-1] ; + pp[1] = labdn->L[i-1][j] ; + pp[2] = labdn->L[i][j] ; + pp[3] = labdn->L[i+1][j] ; + pp[4] = labdn->L[i][j+1] ; + // Get median + results[0] = media(pp, 5); + // Pick up x-window elements + pp[0] = labdn->L[i-1][j-1] ; + pp[1] = labdn->L[i+1][j-1] ; + pp[2] = labdn->L[i][j] ; + pp[3] = labdn->L[i-1][j+1] ; + pp[4] = labdn->L[i+1][j+1] ; + // Get median + results[1] = media(pp, 5); + // Pick up leading element + results[2] = labdn->L[i][j] ;; + // Get result + tmL[i][j] = media(results, 3); + */ + med3(labdn->L[i][j] ,labdn->L[i-1][j], labdn->L[i+1][j] ,labdn->L[i][j+1],labdn->L[i][j-1], labdn->L[i-1][j-1],labdn->L[i-1][j+1],labdn->L[i+1][j-1],labdn->L[i+1][j+1],tmL[i][j]);//3x3 soft + } + } + } + else { + for (int i=borderL; iL[i+ii][j+jj]; + } + } + fq_sort2(pp,49); + tmL[i][j]=pp[24];//7x7 + } + else if(methmedL == 3) + for (int j=2; jL[i][j],labdn->L[i-1][j],labdn->L[i+1][j],labdn->L[i][j+1],labdn->L[i][j-1],labdn->L[i-1][j-1],labdn->L[i-1][j+1], labdn->L[i+1][j-1],labdn->L[i+1][j+1], + labdn->L[i-2][j],labdn->L[i+2][j],labdn->L[i][j+2],labdn->L[i][j-2],labdn->L[i-2][j-2],labdn->L[i-2][j+2],labdn->L[i+2][j-2],labdn->L[i+2][j+2], + labdn->L[i-2][j+1],labdn->L[i+2][j+1],labdn->L[i-1][j+2],labdn->L[i-1][j-2],labdn->L[i-2][j-1],labdn->L[i+2][j-1],labdn->L[i+1][j+2],labdn->L[i+1][j-2], + tmL[i][j]);//5x5 + } + else + for (int j=2; jL[i][j];pp[1]=labdn->L[i-1][j]; pp[2]=labdn->L[i+1][j];pp[3]=labdn->L[i][j+1];pp[4]=labdn->L[i][j-1];pp[5]=labdn->L[i-1][j-1];pp[6]=labdn->L[i-1][j+1]; + pp[7]=labdn->L[i+1][j-1];pp[8]=labdn->L[i+1][j+1];pp[9]=labdn->L[i+2][j];pp[10]=labdn->L[i-2][j];pp[11]=labdn->L[i][j+2];pp[12]=labdn->L[i][j-2]; + fq_sort2(pp,13); + tmL[i][j]=pp[6];//5x5 soft + } + } + } + + for(int i = borderL; i < hei-borderL; i++ ) { + for(int j = borderL; j < wid-borderL; j++) { + labdn->L[i][j] = tmL[i][j]; + } + } +//a + if(metchoice==2) { + if(methmedL < 2) { + for (int i=1; ia[i][j] ,labdn->a[i-1][j], labdn->a[i+1][j] ,labdn->a[i][j+1],labdn->a[i][j-1], tmL[i][j]);//3x3 soft + } + else + for (int j=1; ja[i][j] ,labdn->a[i-1][j], labdn->a[i+1][j] ,labdn->a[i][j+1],labdn->a[i][j-1], labdn->a[i-1][j-1],labdn->a[i-1][j+1],labdn->a[i+1][j-1],labdn->a[i+1][j+1],tmL[i][j]);//3x3 soft + } + } + } + else { + for (int i=borderL; ia[i+ii][j+jj]; + } + } + fq_sort2(pp,49); + tmL[i][j]=pp[24];//7x7 + } + else if(methmedL == 3) + for (int j=2; ja[i][j],labdn->a[i-1][j],labdn->a[i+1][j],labdn->a[i][j+1],labdn->a[i][j-1],labdn->a[i-1][j-1],labdn->a[i-1][j+1], labdn->a[i+1][j-1],labdn->a[i+1][j+1], + labdn->a[i-2][j],labdn->a[i+2][j],labdn->a[i][j+2],labdn->a[i][j-2],labdn->a[i-2][j-2],labdn->a[i-2][j+2],labdn->a[i+2][j-2],labdn->a[i+2][j+2], + labdn->a[i-2][j+1],labdn->a[i+2][j+1],labdn->a[i-1][j+2],labdn->a[i-1][j-2],labdn->a[i-2][j-1],labdn->a[i+2][j-1],labdn->a[i+1][j+2],labdn->a[i+1][j-2], + tmL[i][j]);//5x5 + } + else + for (int j=2; ja[i][j];pp[1]=labdn->a[i-1][j]; pp[2]=labdn->a[i+1][j];pp[3]=labdn->a[i][j+1];pp[4]=labdn->a[i][j-1];pp[5]=labdn->a[i-1][j-1];pp[6]=labdn->a[i-1][j+1]; + pp[7]=labdn->a[i+1][j-1];pp[8]=labdn->a[i+1][j+1];pp[9]=labdn->a[i+2][j];pp[10]=labdn->a[i-2][j];pp[11]=labdn->a[i][j+2];pp[12]=labdn->a[i][j-2]; + fq_sort2(pp,13); + tmL[i][j]=pp[6];//5x5 soft + } + /* for (int j=3; ja[i+ii][j+jj]; + } + pp[kk+1]=labdn->a[i-3][j-3];pp[kk+2]=labdn->a[i-3][j+3];pp[kk+3]=labdn->a[i+3][j-3];pp[kk+4]=labdn->a[i+3][j+3]; + pp[kk+5]=labdn->a[i-3][j];pp[kk+6]=labdn->a[i+3][j];pp[kk+7]=labdn->a[i][j-3];pp[kk+8]=labdn->a[i][j+3]; + + } + fq_sort2(pp,33); + tmL[i][j]=pp[16];//7x7 + } + */ + } + } + + + for(int i = borderL; i < hei-borderL; i++ ) { + for(int j = borderL; j < wid-borderL; j++) { + labdn->a[i][j] = tmL[i][j]; + } + } + + +//b + if(methmedL < 2) { + for (int i=1; ib[i][j] ,labdn->b[i-1][j], labdn->b[i+1][j] ,labdn->b[i][j+1],labdn->b[i][j-1], tmL[i][j]);//3x3 soft + } + else + for (int j=1; jb[i][j] ,labdn->b[i-1][j], labdn->b[i+1][j] ,labdn->b[i][j+1],labdn->b[i][j-1], labdn->b[i-1][j-1],labdn->b[i-1][j+1],labdn->b[i+1][j-1],labdn->b[i+1][j+1],tmL[i][j]);//3x3 soft + } + } + } + else { + for (int i=borderL; ib[i+ii][j+jj]; + } + } + fq_sort2(pp,49); + tmL[i][j]=pp[24];//7x7 + + + } + else if(methmedL == 3) + for (int j=2; jb[i][j],labdn->b[i-1][j],labdn->b[i+1][j],labdn->b[i][j+1],labdn->b[i][j-1],labdn->b[i-1][j-1],labdn->b[i-1][j+1], labdn->b[i+1][j-1],labdn->b[i+1][j+1], + labdn->b[i-2][j],labdn->b[i+2][j],labdn->b[i][j+2],labdn->b[i][j-2],labdn->b[i-2][j-2],labdn->b[i-2][j+2],labdn->b[i+2][j-2],labdn->b[i+2][j+2], + labdn->b[i-2][j+1],labdn->b[i+2][j+1],labdn->b[i-1][j+2],labdn->b[i-1][j-2],labdn->b[i-2][j-1],labdn->b[i+2][j-1],labdn->b[i+1][j+2],labdn->b[i+1][j-2], + tmL[i][j]);//5x5 + + } + else + for (int j=2; jb[i+ii][j+jj]; + } + pp[kk+1]=labdn->b[i-3][j-3];pp[kk+2]=labdn->b[i-3][j+3];pp[kk+3]=labdn->b[i+3][j-3];pp[kk+4]=labdn->b[i+3][j+3]; + pp[kk+5]=labdn->b[i-3][j];pp[kk+6]=labdn->b[i+3][j];pp[kk+7]=labdn->b[i][j-3];pp[kk+8]=labdn->b[i][j+3]; + + } + fq_sort2(pp,33); + tmL[i][j]=pp[16];//7x7 + */ + + + pp[0]=labdn->b[i][j];pp[1]=labdn->b[i-1][j]; pp[2]=labdn->b[i+1][j];pp[3]=labdn->b[i][j+1];pp[4]=labdn->b[i][j-1];pp[5]=labdn->b[i-1][j-1];pp[6]=labdn->b[i-1][j+1]; + pp[7]=labdn->b[i+1][j-1];pp[8]=labdn->b[i+1][j+1];pp[9]=labdn->b[i+2][j];pp[10]=labdn->b[i-2][j];pp[11]=labdn->b[i][j+2];pp[12]=labdn->b[i][j-2]; + fq_sort2(pp,13); + tmL[i][j]=pp[6];//5x5 soft + + } + } + } + + + for(int i = borderL; i < hei-borderL; i++ ) { + for(int j = borderL; j < wid-borderL; j++) { + labdn->b[i][j] = tmL[i][j]; + } + } + } + + for (int i=0; i Lwavdn(width,height); float * Lwavdnptr = Lwavdn; @@ -884,8 +1157,8 @@ float fq_sort2(float arr[], int n) } - //median 3x3 in complement - if(dnparams.median) { + //median 3x3 in complement on RGB + if(dnparams.methodmed=="RGB") { int wid=dst->width, hei=dst->height; float** tm; tm = new float*[hei]; @@ -900,19 +1173,20 @@ float fq_sort2(float arr[], int n) int methmed=0; int border = 1; - if(dnparams.medmethod=="soft") + if(dnparams.rgbmethod=="soft") methmed=0; - else if(dnparams.medmethod=="33") + else if(dnparams.rgbmethod=="33") methmed=1; - else if(dnparams.medmethod=="55") { + else if(dnparams.rgbmethod=="55") { methmed = 3; border = 2; } - else if(dnparams.medmethod=="55soft") { + else if(dnparams.rgbmethod=="55soft") { methmed = 2; border = 2; } +for(int iteration=1;iteration<=dnparams.passes;iteration++){ #pragma omp parallel { @@ -1045,11 +1319,12 @@ float fq_sort2(float arr[], int n) } } } - +} for (int i=0; idirpyrDenoise.chroma) keyFile.set_double ("Directional Pyramid Denoising", "Chroma", dirpyrDenoise.chroma); if (!pedited || pedited->dirpyrDenoise.dmethod) keyFile.set_string ("Directional Pyramid Denoising", "Method", dirpyrDenoise.dmethod); if (!pedited || pedited->dirpyrDenoise.medmethod) keyFile.set_string ("Directional Pyramid Denoising", "MedMethod", dirpyrDenoise.medmethod); - if (!pedited || pedited->dirpyrDenoise.redchro) keyFile.set_double ("Directional Pyramid Denoising", "Redchro", dirpyrDenoise.redchro); + if (!pedited || pedited->dirpyrDenoise.rgbmethod) keyFile.set_string ("Directional Pyramid Denoising", "RGBMethod", dirpyrDenoise.rgbmethod); + if (!pedited || pedited->dirpyrDenoise.methodmed) keyFile.set_string ("Directional Pyramid Denoising", "MethodMed", dirpyrDenoise.methodmed); + if (!pedited || pedited->dirpyrDenoise.redchro) keyFile.set_double ("Directional Pyramid Denoising", "Redchro", dirpyrDenoise.redchro); if (!pedited || pedited->dirpyrDenoise.bluechro)keyFile.set_double ("Directional Pyramid Denoising", "Bluechro", dirpyrDenoise.bluechro); if (!pedited || pedited->dirpyrDenoise.gamma) keyFile.set_double ("Directional Pyramid Denoising", "Gamma", dirpyrDenoise.gamma); + if (!pedited || pedited->dirpyrDenoise.passes) keyFile.set_integer ("Directional Pyramid Denoising", "Passes", dirpyrDenoise.passes); //Save epd. if (!pedited || pedited->epd.enabled) keyFile.set_boolean ("EPD", "Enabled", epd.enabled); @@ -1859,10 +1865,13 @@ if (keyFile.has_group ("Directional Pyramid Denoising")) {//TODO: No longer an a if (keyFile.has_key ("Directional Pyramid Denoising", "Chroma")) { dirpyrDenoise.chroma = keyFile.get_double ("Directional Pyramid Denoising", "Chroma"); if (pedited) pedited->dirpyrDenoise.chroma = true; } if (keyFile.has_key ("Directional Pyramid Denoising", "Method")) {dirpyrDenoise.dmethod = keyFile.get_string ("Directional Pyramid Denoising", "Method"); if (pedited) pedited->dirpyrDenoise.dmethod = true; } if (keyFile.has_key ("Directional Pyramid Denoising", "MedMethod")) {dirpyrDenoise.medmethod = keyFile.get_string ("Directional Pyramid Denoising", "MedMethod"); if (pedited) pedited->dirpyrDenoise.medmethod = true; } + if (keyFile.has_key ("Directional Pyramid Denoising", "MethodMed")) {dirpyrDenoise.methodmed = keyFile.get_string ("Directional Pyramid Denoising", "MethodMed"); if (pedited) pedited->dirpyrDenoise.methodmed = true; } + if (keyFile.has_key ("Directional Pyramid Denoising", "RGBMethod")) {dirpyrDenoise.rgbmethod = keyFile.get_string ("Directional Pyramid Denoising", "RGBMethod"); if (pedited) pedited->dirpyrDenoise.rgbmethod = true; } if (keyFile.has_key ("Directional Pyramid Denoising", "Redchro")) { dirpyrDenoise.redchro = keyFile.get_double ("Directional Pyramid Denoising", "Redchro"); if (pedited) pedited->dirpyrDenoise.redchro = true; } if (keyFile.has_key ("Directional Pyramid Denoising", "Bluechro")) { dirpyrDenoise.bluechro = keyFile.get_double ("Directional Pyramid Denoising", "Bluechro"); if (pedited) pedited->dirpyrDenoise.bluechro = true; } if (keyFile.has_key ("Directional Pyramid Denoising", "Gamma")) { dirpyrDenoise.gamma = keyFile.get_double ("Directional Pyramid Denoising", "Gamma"); if (pedited) pedited->dirpyrDenoise.gamma = true; } + if (keyFile.has_key ("Directional Pyramid Denoising", "Passes")) { dirpyrDenoise.passes = keyFile.get_integer ("Directional Pyramid Denoising", "Passes"); if (pedited) pedited->dirpyrDenoise.passes = true; } } //Load EPD. @@ -2327,9 +2336,12 @@ bool ProcParams::operator== (const ProcParams& other) { && dirpyrDenoise.chroma == other.dirpyrDenoise.chroma && dirpyrDenoise.dmethod == other.dirpyrDenoise.dmethod && dirpyrDenoise.medmethod == other.dirpyrDenoise.medmethod + && dirpyrDenoise.methodmed == other.dirpyrDenoise.methodmed + && dirpyrDenoise.rgbmethod == other.dirpyrDenoise.rgbmethod && dirpyrDenoise.redchro == other.dirpyrDenoise.redchro && dirpyrDenoise.bluechro == other.dirpyrDenoise.bluechro && dirpyrDenoise.gamma == other.dirpyrDenoise.gamma + && dirpyrDenoise.passes == other.dirpyrDenoise.passes && epd.enabled == other.epd.enabled && epd.strength == other.epd.strength && epd.edgeStopping == other.epd.edgeStopping diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 427949130..e22722038 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -549,6 +549,9 @@ class DirPyrDenoiseParams { double gamma; Glib::ustring dmethod; Glib::ustring medmethod; + Glib::ustring methodmed; + Glib::ustring rgbmethod; + int passes; }; //EPD related parameters. diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 19f05c9e9..b2aa9b6e1 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -305,7 +305,10 @@ RGBCURVE, // EvColorToningHighights RGBCURVE, // EvColorToningSatProtection RGBCURVE, // EvColorToningSatThreshold RGBCURVE, //EvColorToningStrProtection -RGBCURVE //EvColorToningautosat +RGBCURVE, //EvColorToningautosat +ALLNORAW, //EvDPDNmetmed +ALLNORAW, //EvDPDNrgbmet +ALLNORAW //EvDPDNpasses //LUMINANCECURVE // EvCATsharpcie diff --git a/rtgui/addsetids.h b/rtgui/addsetids.h index ebd6fcfbb..98235c0df 100644 --- a/rtgui/addsetids.h +++ b/rtgui/addsetids.h @@ -82,8 +82,9 @@ #define ADDSET_COLORTONING_SATOPACITY 74 #define ADDSET_COLORTONING_BALANCE 75 #define ADDSET_COLORTONING_STRPROTECT 76 +#define ADDSET_DIRPYRDN_PASSES 77 // When adding items, make sure to update ADDSET_PARAM_NUM -#define ADDSET_PARAM_NUM 77 // THIS IS USED AS A DELIMITER!! +#define ADDSET_PARAM_NUM 78 // THIS IS USED AS A DELIMITER!! #endif diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc index dfd227753..5cdb62441 100644 --- a/rtgui/batchtoolpanelcoord.cc +++ b/rtgui/batchtoolpanelcoord.cc @@ -147,7 +147,7 @@ void BatchToolPanelCoordinator::initSession () { shadowshighlights->setAdjusterBehavior (false, false, false); dirpyrequalizer->setAdjusterBehavior (false, false, false); - dirpyrdenoise->setAdjusterBehavior (false, false,false,false,false,false); + dirpyrdenoise->setAdjusterBehavior (false, false,false,false,false,false, false); preprocess->setAdjusterBehavior (false, false); rawcacorrection->setAdjusterBehavior (false); rawexposure->setAdjusterBehavior (false, false, false); @@ -179,7 +179,7 @@ void BatchToolPanelCoordinator::initSession () { blackwhite->setAdjusterBehavior (options.baBehav[ADDSET_BLACKWHITE_HUES],options.baBehav[ADDSET_BLACKWHITE_GAMMA]); shadowshighlights->setAdjusterBehavior (options.baBehav[ADDSET_SH_HIGHLIGHTS], options.baBehav[ADDSET_SH_SHADOWS], options.baBehav[ADDSET_SH_LOCALCONTRAST]); dirpyrequalizer->setAdjusterBehavior (options.baBehav[ADDSET_DIRPYREQ], options.baBehav[ADDSET_DIRPYREQ_THRESHOLD], options.baBehav[ADDSET_DIRPYREQ_SKINPROTECT]); - dirpyrdenoise->setAdjusterBehavior (options.baBehav[ADDSET_DIRPYRDN_LUMA],options.baBehav[ADDSET_DIRPYRDN_LUMDET],options.baBehav[ADDSET_DIRPYRDN_CHROMA],options.baBehav[ADDSET_DIRPYRDN_CHROMARED],options.baBehav[ADDSET_DIRPYRDN_CHROMABLUE], options.baBehav[ADDSET_DIRPYRDN_GAMMA]); + dirpyrdenoise->setAdjusterBehavior (options.baBehav[ADDSET_DIRPYRDN_LUMA],options.baBehav[ADDSET_DIRPYRDN_LUMDET],options.baBehav[ADDSET_DIRPYRDN_CHROMA],options.baBehav[ADDSET_DIRPYRDN_CHROMARED],options.baBehav[ADDSET_DIRPYRDN_CHROMABLUE], options.baBehav[ADDSET_DIRPYRDN_GAMMA], options.baBehav[ADDSET_DIRPYRDN_PASSES]); preprocess->setAdjusterBehavior (options.baBehav[ADDSET_PREPROCESS_LINEDENOISE], options.baBehav[ADDSET_PREPROCESS_GREENEQUIL]); rawcacorrection->setAdjusterBehavior (options.baBehav[ADDSET_RAWCACORR]); rawexposure->setAdjusterBehavior (options.baBehav[ADDSET_RAWEXPOS_LINEAR], options.baBehav[ADDSET_RAWEXPOS_PRESER], options.baBehav[ADDSET_RAWEXPOS_BLACKS]); diff --git a/rtgui/dirpyrdenoise.cc b/rtgui/dirpyrdenoise.cc index 5c98dc2bb..680244081 100644 --- a/rtgui/dirpyrdenoise.cc +++ b/rtgui/dirpyrdenoise.cc @@ -47,7 +47,11 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this), lastenhance(false) { gamma = Gtk::manage (new Adjuster (M("TP_DIRPYRDENOISE_GAMMA"), 1.0, 3.0, 0.01, 1.7)); gamma->set_tooltip_text (M("TP_DIRPYRDENOISE_GAMMA_TOOLTIP")); - + + passes = Gtk::manage (new Adjuster (M("TP_DIRPYRDENOISE_PASSE"), 1.0, 3.0, 1., 1.)); + passes->set_tooltip_text (M("TP_DIRPYRDENOISE_PASSES_TOOLTIP")); + + Gtk::HBox* hb1 = Gtk::manage (new Gtk::HBox ()); hb1->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_DIRPYRDENOISE_METHOD") +": ")),Gtk::PACK_SHRINK, 4); hb1->set_tooltip_markup (M("TP_DIRPYRDENOISE_METHOD_TOOLTIP")); @@ -73,6 +77,7 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this), lastenhance(false) { bluechro->setAdjusterListener (this); gamma->setAdjusterListener (this); + passes->setAdjusterListener (this); luma->show(); Ldetail->show(); @@ -82,27 +87,59 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this), lastenhance(false) { // perform->show(); gamma->show(); // perform->set_active (true); + passes->show(); enhance = Gtk::manage (new Gtk::CheckButton (M("TP_DIRPYRDENOISE_ENH"))); enhance->set_active (false); enhance->set_tooltip_text (M("TP_DIRPYRDENOISE_ENH_TOOLTIP")); median = Gtk::manage (new Gtk::CheckButton (M("TP_DIRPYRDENOISE_MED"))); - median->set_active (false); + median->set_active (true); median->set_tooltip_text (M("TP_DIRPYRDENOISE_MED_TOOLTIP")); + + Gtk::HSeparator *hsep2 = Gtk::manage (new Gtk::HSeparator()); + hsep2->show (); + + methodmed = Gtk::manage (new MyComboBoxText ()); + methodmed->append_text (M("TP_DIRPYRDENOISE_NONE")); + methodmed->append_text (M("TP_DIRPYRDENOISE_LM")); + methodmed->append_text (M("TP_DIRPYRDENOISE_LABM")); + methodmed->append_text (M("TP_DIRPYRDENOISE_RGBM")); + methodmed->set_active (0); + methodmed->set_tooltip_text (M("TP_DIRPYRDENOISE_METM_TOOLTIP")); + methodmedconn = methodmed->signal_changed().connect ( sigc::mem_fun(*this, &DirPyrDenoise::methodmedChanged) ); + + rgbmethod = Gtk::manage (new MyComboBoxText ()); + rgbmethod->append_text (M("TP_DIRPYRDENOISE_SOFT")); + rgbmethod->append_text (M("TP_DIRPYRDENOISE_33")); + rgbmethod->append_text (M("TP_DIRPYRDENOISE_55SOFT")); + rgbmethod->set_active (0); + rgbmethod->set_tooltip_text (M("TP_DIRPYRDENOISE_MET_TOOLTIP")); + rgbmethodconn = rgbmethod->signal_changed().connect ( sigc::mem_fun(*this, &DirPyrDenoise::rgbmethodChanged) ); + + medmethod = Gtk::manage (new MyComboBoxText ()); medmethod->append_text (M("TP_DIRPYRDENOISE_SOFT")); medmethod->append_text (M("TP_DIRPYRDENOISE_33")); medmethod->append_text (M("TP_DIRPYRDENOISE_55SOFT")); medmethod->append_text (M("TP_DIRPYRDENOISE_55")); + medmethod->append_text (M("TP_DIRPYRDENOISE_77")); medmethod->set_active (0); medmethod->set_tooltip_text (M("TP_DIRPYRDENOISE_MET_TOOLTIP")); medmethodconn = medmethod->signal_changed().connect ( sigc::mem_fun(*this, &DirPyrDenoise::medmethodChanged) ); + ctboxm = Gtk::manage (new Gtk::HBox ()); + Gtk::Label* labmm = Gtk::manage (new Gtk::Label (M("TP_DIRPYRDENOISE_METHODMED"))); + ctboxm->pack_start (*labmm, Gtk::PACK_SHRINK, 4); + ctbox = Gtk::manage (new Gtk::HBox ()); Gtk::Label* labm = Gtk::manage (new Gtk::Label (M("TP_DIRPYRDENOISE_MEDMETHOD"))); ctbox->pack_start (*labm, Gtk::PACK_SHRINK, 4); + + ctboxrgb = Gtk::manage (new Gtk::HBox ()); + Gtk::Label* labrgb = Gtk::manage (new Gtk::Label (M("TP_DIRPYRDENOISE_MEDMETHOD"))); + ctboxrgb->pack_start (*labrgb, Gtk::PACK_SHRINK, 4); pack_start (*luma); pack_start (*Ldetail); @@ -112,14 +149,23 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this), lastenhance(false) { pack_start (*gamma); pack_start (*enhance); - pack_start (*median); + + pack_start (*hsep2); + + ctboxm->pack_start (*methodmed); ctbox->pack_start (*medmethod); + ctboxrgb->pack_start (*rgbmethod); + pack_start (*ctboxm); pack_start (*ctbox); + pack_start (*ctboxrgb); + pack_start (*passes); + +// pack_start (*median); // pack_start (*perform); enhanConn = enhance->signal_toggled().connect( sigc::mem_fun(*this, &DirPyrDenoise::enhanceChanged) ); medianConn = median->signal_toggled().connect( sigc::mem_fun(*this, &DirPyrDenoise::medianChanged) ); - + ctboxrgb->hide(); } void DirPyrDenoise::read (const ProcParams* pp, const ParamsEdited* pedited) { @@ -128,14 +174,29 @@ void DirPyrDenoise::read (const ProcParams* pp, const ParamsEdited* pedited) { dmethodconn.block(true); enaConn.block (true); medmethodconn.block(true); + rgbmethodconn.block(true); + methodmedconn.block(true); dmethod->set_active (0); if (pp->dirpyrDenoise.dmethod=="RGB") dmethod->set_active (0); else if (pp->dirpyrDenoise.dmethod=="Lab") dmethod->set_active (1); + + methodmed->set_active (0); + if (pp->dirpyrDenoise.methodmed=="none") + methodmed->set_active (0); + else if (pp->dirpyrDenoise.methodmed=="Lonly") + methodmed->set_active (1); + else if (pp->dirpyrDenoise.methodmed=="Lab") + methodmed->set_active (2); + else if (pp->dirpyrDenoise.methodmed=="RGB") + methodmed->set_active (3); + methodmedChanged(); medmethod->set_active (0); +// if (pp->dirpyrDenoise.medmethod=="none") +// medmethod->set_active (0); if (pp->dirpyrDenoise.medmethod=="soft") medmethod->set_active (0); else if (pp->dirpyrDenoise.medmethod=="33") @@ -144,14 +205,31 @@ void DirPyrDenoise::read (const ProcParams* pp, const ParamsEdited* pedited) { medmethod->set_active (2); else if (pp->dirpyrDenoise.medmethod=="55") medmethod->set_active (3); + else if (pp->dirpyrDenoise.medmethod=="77") + medmethod->set_active (4); + medmethodChanged(); + rgbmethod->set_active (0); +// if (pp->dirpyrDenoise.medmethod=="none") +// medmethod->set_active (0); + if (pp->dirpyrDenoise.rgbmethod=="soft") + rgbmethod->set_active (0); + else if (pp->dirpyrDenoise.rgbmethod=="33") + rgbmethod->set_active (1); + else if (pp->dirpyrDenoise.rgbmethod=="55soft") + rgbmethod->set_active (2); + rgbmethodChanged(); if (pedited) { if (!pedited->dirpyrDenoise.dmethod) dmethod->set_active (2); - if (!pedited->dirpyrDenoise.medmethod) + if (!pedited->dirpyrDenoise.rgbmethod) + rgbmethod->set_active (2); + if (!pedited->dirpyrDenoise.medmethod) medmethod->set_active (4); + if (!pedited->dirpyrDenoise.methodmed) + methodmed->set_active (3); luma->setEditedState (pedited->dirpyrDenoise.luma ? Edited : UnEdited); Ldetail->setEditedState (pedited->dirpyrDenoise.Ldetail ? Edited : UnEdited); @@ -160,6 +238,7 @@ void DirPyrDenoise::read (const ProcParams* pp, const ParamsEdited* pedited) { bluechro->setEditedState (pedited->dirpyrDenoise.bluechro ? Edited : UnEdited); gamma->setEditedState (pedited->dirpyrDenoise.gamma ? Edited : UnEdited); + passes->setEditedState (pedited->dirpyrDenoise.passes ? Edited : UnEdited); enabled->set_inconsistent (!pedited->dirpyrDenoise.enabled); enhance->set_inconsistent (!pedited->dirpyrDenoise.enhance); median->set_inconsistent (!pedited->dirpyrDenoise.median); @@ -183,11 +262,15 @@ void DirPyrDenoise::read (const ProcParams* pp, const ParamsEdited* pedited) { bluechro->setValue (pp->dirpyrDenoise.bluechro); gamma->setValue (pp->dirpyrDenoise.gamma); + passes->setValue (pp->dirpyrDenoise.passes); enaConn.block (false); dmethodconn.block(false); medmethodconn.block(false); + rgbmethodconn.block(false); + methodmedconn.block(false); enableListener (); + } void DirPyrDenoise::write (ProcParams* pp, ParamsEdited* pedited) { @@ -198,6 +281,7 @@ void DirPyrDenoise::write (ProcParams* pp, ParamsEdited* pedited) { pp->dirpyrDenoise.redchro = redchro->getValue (); pp->dirpyrDenoise.bluechro = bluechro->getValue (); pp->dirpyrDenoise.gamma = gamma->getValue (); + pp->dirpyrDenoise.passes = passes->getValue (); pp->dirpyrDenoise.enabled = enabled->get_active(); pp->dirpyrDenoise.enhance = enhance->get_active(); // pp->dirpyrDenoise.perform = perform->get_active(); @@ -205,13 +289,16 @@ void DirPyrDenoise::write (ProcParams* pp, ParamsEdited* pedited) { if (pedited) { pedited->dirpyrDenoise.dmethod = dmethod->get_active_row_number() != 2; - pedited->dirpyrDenoise.medmethod = medmethod->get_active_row_number() != 3; + pedited->dirpyrDenoise.medmethod = medmethod->get_active_row_number() != 4; + pedited->dirpyrDenoise.rgbmethod = rgbmethod->get_active_row_number() != 2; + pedited->dirpyrDenoise.methodmed = methodmed->get_active_row_number() != 3; pedited->dirpyrDenoise.luma = luma->getEditedState (); pedited->dirpyrDenoise.Ldetail = Ldetail->getEditedState (); pedited->dirpyrDenoise.chroma = chroma->getEditedState (); pedited->dirpyrDenoise.redchro = redchro->getEditedState (); pedited->dirpyrDenoise.bluechro = bluechro->getEditedState (); pedited->dirpyrDenoise.gamma = gamma->getEditedState (); + pedited->dirpyrDenoise.passes = passes->getEditedState (); pedited->dirpyrDenoise.enabled = !enabled->get_inconsistent(); pedited->dirpyrDenoise.enhance = !enhance->get_inconsistent(); pedited->dirpyrDenoise.median = !median->get_inconsistent(); @@ -221,7 +308,20 @@ void DirPyrDenoise::write (ProcParams* pp, ParamsEdited* pedited) { pp->dirpyrDenoise.dmethod = "RGB"; else if (dmethod->get_active_row_number()==1) pp->dirpyrDenoise.dmethod = "Lab"; + + if (methodmed->get_active_row_number()==0) + pp->dirpyrDenoise.methodmed = "none"; + else if (methodmed->get_active_row_number()==1) + pp->dirpyrDenoise.methodmed = "Lonly"; + else if (methodmed->get_active_row_number()==2) + pp->dirpyrDenoise.methodmed = "Lab"; + else if (methodmed->get_active_row_number()==3) + pp->dirpyrDenoise.methodmed = "RGB"; + + + // if (medmethod->get_active_row_number()==0) + // pp->dirpyrDenoise.medmethod = "none"; if (medmethod->get_active_row_number()==0) pp->dirpyrDenoise.medmethod = "soft"; else if (medmethod->get_active_row_number()==1) @@ -230,6 +330,15 @@ void DirPyrDenoise::write (ProcParams* pp, ParamsEdited* pedited) { pp->dirpyrDenoise.medmethod = "55soft"; else if (medmethod->get_active_row_number()==3) pp->dirpyrDenoise.medmethod = "55"; + else if (medmethod->get_active_row_number()==4) + pp->dirpyrDenoise.medmethod = "77"; + + if (rgbmethod->get_active_row_number()==0) + pp->dirpyrDenoise.rgbmethod = "soft"; + else if (rgbmethod->get_active_row_number()==1) + pp->dirpyrDenoise.rgbmethod = "33"; + else if (rgbmethod->get_active_row_number()==2) + pp->dirpyrDenoise.rgbmethod = "55soft"; } @@ -241,12 +350,31 @@ void DirPyrDenoise::dmethodChanged () { } void DirPyrDenoise::medmethodChanged () { - + + if (listener && (multiImage||enabled->get_active()) ) { listener->panelChanged (EvDPDNmedmet, medmethod->get_active_text ()); } } +void DirPyrDenoise::rgbmethodChanged () { + ctboxrgb->hide(); + if(methodmed->get_active_row_number()==3) ctboxrgb->show(); + if (listener && (multiImage||enabled->get_active()) ) { + listener->panelChanged (EvDPDNrgbmet, rgbmethod->get_active_text ()); + } +} + + + +void DirPyrDenoise::methodmedChanged () { + if(methodmed->get_active_row_number()==3) {ctboxrgb->show();ctbox->hide();} + else {ctboxrgb->hide();ctbox->show();} + + if (listener && (multiImage||enabled->get_active()) ) { + listener->panelChanged (EvDPDNmetmed, methodmed->get_active_text ()); + } +} void DirPyrDenoise::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) { @@ -256,6 +384,7 @@ void DirPyrDenoise::setDefaults (const ProcParams* defParams, const ParamsEdited redchro->setDefault (defParams->dirpyrDenoise.redchro); bluechro->setDefault (defParams->dirpyrDenoise.bluechro); gamma->setDefault (defParams->dirpyrDenoise.gamma); + passes->setDefault (defParams->dirpyrDenoise.passes); if (pedited) { luma->setDefaultEditedState (pedited->dirpyrDenoise.luma ? Edited : UnEdited); @@ -264,6 +393,7 @@ void DirPyrDenoise::setDefaults (const ProcParams* defParams, const ParamsEdited redchro->setDefaultEditedState (pedited->dirpyrDenoise.redchro ? Edited : UnEdited); bluechro->setDefaultEditedState (pedited->dirpyrDenoise.bluechro ? Edited : UnEdited); gamma->setDefaultEditedState (pedited->dirpyrDenoise.gamma ? Edited : UnEdited); + passes->setDefaultEditedState (pedited->dirpyrDenoise.passes ? Edited : UnEdited); } else { luma->setDefaultEditedState (Irrelevant); @@ -272,6 +402,7 @@ void DirPyrDenoise::setDefaults (const ProcParams* defParams, const ParamsEdited redchro->setDefaultEditedState (Irrelevant); bluechro->setDefaultEditedState (Irrelevant); gamma->setDefaultEditedState (Irrelevant); + passes->setDefaultEditedState (Irrelevant); } } @@ -293,6 +424,8 @@ void DirPyrDenoise::adjusterChanged (Adjuster* a, double newval) { listener->panelChanged (EvDPDNbluechro, costr); else if (a==gamma) listener->panelChanged (EvDPDNGamma, costr); + else if (a==passes) + listener->panelChanged (EvDPDNpasses, costr); } } @@ -399,12 +532,15 @@ void DirPyrDenoise::setBatchMode (bool batchMode) { redchro->showEditedCB (); bluechro->showEditedCB (); gamma->showEditedCB (); + passes->showEditedCB (); dmethod->append_text (M("GENERAL_UNCHANGED")); medmethod->append_text (M("GENERAL_UNCHANGED")); + methodmed->append_text (M("GENERAL_UNCHANGED")); + rgbmethod->append_text (M("GENERAL_UNCHANGED")); } -void DirPyrDenoise::setAdjusterBehavior (bool lumaadd, bool lumdetadd, bool chromaadd, bool chromaredadd, bool chromablueadd, bool gammaadd) { +void DirPyrDenoise::setAdjusterBehavior (bool lumaadd, bool lumdetadd, bool chromaadd, bool chromaredadd, bool chromablueadd, bool gammaadd, bool passesadd) { luma->setAddMode(lumaadd); Ldetail->setAddMode(lumdetadd); @@ -412,6 +548,8 @@ void DirPyrDenoise::setAdjusterBehavior (bool lumaadd, bool lumdetadd, bool chro redchro->setAddMode(chromaredadd); bluechro->setAddMode(chromablueadd); gamma->setAddMode(gammaadd); + passes->setAddMode(passesadd); + } void DirPyrDenoise::trimValues (rtengine::procparams::ProcParams* pp) { @@ -422,4 +560,5 @@ void DirPyrDenoise::trimValues (rtengine::procparams::ProcParams* pp) { redchro->trimValue(pp->dirpyrDenoise.redchro); bluechro->trimValue(pp->dirpyrDenoise.bluechro); gamma->trimValue(pp->dirpyrDenoise.gamma); + passes->trimValue(pp->dirpyrDenoise.passes); } diff --git a/rtgui/dirpyrdenoise.h b/rtgui/dirpyrdenoise.h index 60ba9bc05..88d5e88ed 100644 --- a/rtgui/dirpyrdenoise.h +++ b/rtgui/dirpyrdenoise.h @@ -32,6 +32,7 @@ class DirPyrDenoise : public ToolParamBlock, public AdjusterListener, public Fol Adjuster* redchro; Adjuster* bluechro; Adjuster* gamma; + Adjuster* passes; Gtk::CheckButton* enabled; bool lastEnabled; @@ -50,6 +51,12 @@ class DirPyrDenoise : public ToolParamBlock, public AdjusterListener, public Fol MyComboBoxText* medmethod; sigc::connection medmethodconn; Gtk::HBox* ctbox; + MyComboBoxText* methodmed; + sigc::connection methodmedconn; + Gtk::HBox* ctboxm; + MyComboBoxText* rgbmethod; + sigc::connection rgbmethodconn; + Gtk::HBox* ctboxrgb; public: @@ -68,8 +75,10 @@ class DirPyrDenoise : public ToolParamBlock, public AdjusterListener, public Fol // void perform_toggled (); void dmethodChanged (); void medmethodChanged (); + void methodmedChanged (); + void rgbmethodChanged (); - void setAdjusterBehavior (bool lumaadd, bool lumdetadd, bool chromaadd, bool chromaredadd, bool chromablueadd, bool gammaadd); + void setAdjusterBehavior (bool lumaadd, bool lumdetadd, bool chromaadd, bool chromaredadd, bool chromablueadd, bool gammaadd, bool passesadd); void trimValues (rtengine::procparams::ProcParams* pp); }; diff --git a/rtgui/options.cc b/rtgui/options.cc index 9346b3816..3dc2f59ad 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -487,6 +487,7 @@ void Options::setDefaults () { 0, // ADDSET_DIRPYREQ_THRESHOLD 0, // ADDSET_DIRPYREQ_SKINPROTECT 0, // ADDSET_COLORTONING_SPLIT + 0, //ADDSET_DIRPYRDN_PASSES }; baBehav = std::vector (babehav, babehav+ADDSET_PARAM_NUM); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 1117b37a8..1e880634d 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -188,8 +188,11 @@ void ParamsEdited::set (bool v) { dirpyrDenoise.redchro = v; dirpyrDenoise.bluechro = v; dirpyrDenoise.gamma = v; + dirpyrDenoise.passes = v; dirpyrDenoise.dmethod = v; dirpyrDenoise.medmethod = v; + dirpyrDenoise.methodmed = v; + dirpyrDenoise.rgbmethod = v; epd.enabled = v; epd.strength = v; epd.edgeStopping = v; @@ -504,8 +507,11 @@ void ParamsEdited::initFrom (const std::vector dirpyrDenoise.redchro = dirpyrDenoise.redchro && p.dirpyrDenoise.redchro == other.dirpyrDenoise.redchro; dirpyrDenoise.bluechro = dirpyrDenoise.bluechro && p.dirpyrDenoise.bluechro == other.dirpyrDenoise.bluechro; dirpyrDenoise.gamma = dirpyrDenoise.gamma && p.dirpyrDenoise.gamma == other.dirpyrDenoise.gamma; + dirpyrDenoise.passes = dirpyrDenoise.passes && p.dirpyrDenoise.passes == other.dirpyrDenoise.passes; dirpyrDenoise.dmethod = dirpyrDenoise.dmethod && p.dirpyrDenoise.dmethod == other.dirpyrDenoise.dmethod; dirpyrDenoise.medmethod = dirpyrDenoise.medmethod && p.dirpyrDenoise.medmethod == other.dirpyrDenoise.medmethod; + dirpyrDenoise.methodmed = dirpyrDenoise.methodmed && p.dirpyrDenoise.methodmed == other.dirpyrDenoise.methodmed; + dirpyrDenoise.rgbmethod = dirpyrDenoise.rgbmethod && p.dirpyrDenoise.rgbmethod == other.dirpyrDenoise.rgbmethod; epd.enabled = epd.enabled && p.epd.enabled == other.epd.enabled; epd.strength = epd.strength && p.epd.strength == other.epd.strength; @@ -823,9 +829,12 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (dirpyrDenoise.redchro) toEdit.dirpyrDenoise.redchro = dontforceSet && options.baBehav[ADDSET_DIRPYRDN_CHROMARED] ? toEdit.dirpyrDenoise.redchro + mods.dirpyrDenoise.redchro : mods.dirpyrDenoise.redchro; if (dirpyrDenoise.bluechro) toEdit.dirpyrDenoise.bluechro = dontforceSet && options.baBehav[ADDSET_DIRPYRDN_CHROMABLUE] ? toEdit.dirpyrDenoise.bluechro + mods.dirpyrDenoise.bluechro : mods.dirpyrDenoise.bluechro; if (dirpyrDenoise.gamma) toEdit.dirpyrDenoise.gamma = dontforceSet && options.baBehav[ADDSET_DIRPYRDN_GAMMA] ? toEdit.dirpyrDenoise.gamma + mods.dirpyrDenoise.gamma : mods.dirpyrDenoise.gamma; + if (dirpyrDenoise.passes) toEdit.dirpyrDenoise.passes = dontforceSet && options.baBehav[ADDSET_DIRPYRDN_PASSES] ? toEdit.dirpyrDenoise.passes + mods.dirpyrDenoise.passes : mods.dirpyrDenoise.passes; // if (dirpyrDenoise.perform) toEdit.dirpyrDenoise.perform = mods.dirpyrDenoise.perform; if (dirpyrDenoise.dmethod) toEdit.dirpyrDenoise.dmethod = mods.dirpyrDenoise.dmethod; if (dirpyrDenoise.medmethod) toEdit.dirpyrDenoise.medmethod = mods.dirpyrDenoise.medmethod; + if (dirpyrDenoise.methodmed) toEdit.dirpyrDenoise.methodmed = mods.dirpyrDenoise.methodmed; + if (dirpyrDenoise.rgbmethod) toEdit.dirpyrDenoise.rgbmethod = mods.dirpyrDenoise.rgbmethod; if (epd.enabled) toEdit.epd.enabled = mods.epd.enabled; if (epd.strength) toEdit.epd.strength = mods.epd.strength; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 65776f351..ddbec2e13 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -275,6 +275,9 @@ public: // bool perform; bool dmethod; bool medmethod; + bool methodmed; + bool rgbmethod; + bool passes; }; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 2f1180016..cb59f7492 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -199,6 +199,7 @@ Gtk::Widget* Preferences::getBatchProcPanel () { appendBehavList (mi, M("TP_DIRPYRDENOISE_RED"), ADDSET_DIRPYRDN_CHROMARED, true); appendBehavList (mi, M("TP_DIRPYRDENOISE_BLUE"), ADDSET_DIRPYRDN_CHROMABLUE, true); appendBehavList (mi, M("TP_DIRPYRDENOISE_GAMMA"), ADDSET_DIRPYRDN_GAMMA, true); + appendBehavList (mi, M("TP_DIRPYRDENOISE_PASSE"), ADDSET_DIRPYRDN_PASSES, true); mi = behModel->append (); mi->set_value (behavColumns.label, M("TP_WBALANCE_LABEL"));