From de285245308b302ffb630d9b43d520cb6e93d9ba Mon Sep 17 00:00:00 2001 From: Emil Martinec Date: Wed, 28 Sep 2011 13:14:51 -0500 Subject: [PATCH] Slight change to impulse denoise at higher slider settings. In the previous version, values above about 80 lead to unpleasant 'blotchy' appearance. This patch attempts to smooth that out by increasing the sampling radius at large values of the slider; lower settings are unaffected. --- rtengine/impulse_denoise.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rtengine/impulse_denoise.h b/rtengine/impulse_denoise.h index 1efd45334..01b9d7106 100644 --- a/rtengine/impulse_denoise.h +++ b/rtengine/impulse_denoise.h @@ -65,14 +65,16 @@ void ImProcFunctions::impulse_nr (LabImage* lab, double thresh) { AlignedBuffer* buffer = new AlignedBuffer (MAX(width,height)); - gaussHorizontal (lab->L, lpf, buffer, width, height, 2.0, false /*multiThread*/); - gaussVertical (lpf, lpf, buffer, width, height, 2.0, false); + gaussHorizontal (lab->L, lpf, buffer, width, height, MAX(2.0,thresh-1.0), false /*multiThread*/); + gaussVertical (lpf, lpf, buffer, width, height, MAX(2.0,thresh-1.0), false); delete buffer; //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + float impthr = MAX(1.0,5.5-thresh); + for (int i=0; i < height; i++) for (int j=0; j < width; j++) { @@ -83,7 +85,7 @@ void ImProcFunctions::impulse_nr (LabImage* lab, double thresh) { hfnbrave += fabs(lab->L[i1][j1]-lpf[i1][j1]); } hfnbrave = (hfnbrave-hpfabs)/24; - hpfabs>(hfnbrave*(5.5-thresh)) ? impish[i][j]=1 : impish[i][j]=0; + hpfabs>(hfnbrave*impthr) ? impish[i][j]=1 : impish[i][j]=0; }//now impulsive values have been identified