Additional Median filter for Denoise issue2423

This commit is contained in:
jdc
2014-06-25 13:36:08 +02:00
parent 3d0a164941
commit 7636502a7c
10 changed files with 528 additions and 129 deletions

View File

@@ -474,7 +474,8 @@ HISTORY_MSG_251;B&W - Algorithm
HISTORY_MSG_252;CbDL Skin Tones HISTORY_MSG_252;CbDL Skin Tones
HISTORY_MSG_253;CbDL Reduce artifacts HISTORY_MSG_253;CbDL Reduce artifacts
HISTORY_MSG_254;CbDL - Hueskin HISTORY_MSG_254;CbDL - Hueskin
HISTORY_MSG_255;CbDL - Algorithm HISTORY_MSG_255;NR - median
HISTORY_MSG_256;NR - median method
HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT;Add
HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: <b>Alt-s</b> HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: <b>Alt-s</b>
HISTORY_SNAPSHOTS;Snapshots HISTORY_SNAPSHOTS;Snapshots
@@ -1069,6 +1070,8 @@ 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_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;Enhanced mode
TP_DIRPYRDENOISE_ENH_TOOLTIP;Increases noise reduction quality at the expense of a 20% processing time increase. 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_GAMMA;Gamma 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_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 TP_DIRPYRDENOISE_LABEL;Noise Reduction
@@ -1080,6 +1083,12 @@ TP_DIRPYRDENOISE_METHOD_TOOLTIP;For raw images either RGB or Lab methods can be
TP_DIRPYRDENOISE_PERF;RGB mode (raw images) TP_DIRPYRDENOISE_PERF;RGB mode (raw images)
TP_DIRPYRDENOISE_RED;Chrominance - Red-Green TP_DIRPYRDENOISE_RED;Chrominance - Red-Green
TP_DIRPYRDENOISE_RGB;RGB 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_DIRPYREQUALIZER_ALGO;Algorithm Skin TP_DIRPYREQUALIZER_ALGO;Algorithm Skin
TP_DIRPYREQUALIZER_ALGO_FI;Fine TP_DIRPYREQUALIZER_ALGO_FI;Fine
TP_DIRPYREQUALIZER_ALGO_LA;Large TP_DIRPYREQUALIZER_ALGO_LA;Large

View File

@@ -40,7 +40,7 @@
#include "boxblur.h" #include "boxblur.h"
#include "rt_math.h" #include "rt_math.h"
#include "mytime.h" #include "mytime.h"
#include "sleef.c" #include "sleef.c"
#include "opthelper.h" #include "opthelper.h"
#ifdef _OPENMP #ifdef _OPENMP
@@ -62,6 +62,65 @@
#define epsilon 0.001f/(TS*TS) //tolerance #define epsilon 0.001f/(TS*TS) //tolerance
#define PIX_SORT(a,b) { if ((a)>(b)) {temp=(a);(a)=(b);(b)=temp;} }
#define med3(a0,a1,a2,a3,a4,a5,a6,a7,a8,median) { \
pp[0]=a0; pp[1]=a1; pp[2]=a2; pp[3]=a3; pp[4]=a4; pp[5]=a5; pp[6]=a6; pp[7]=a7; pp[8]=a8; \
PIX_SORT(pp[1],pp[2]); PIX_SORT(pp[4],pp[5]); PIX_SORT(pp[7],pp[8]); \
PIX_SORT(pp[0],pp[1]); PIX_SORT(pp[3],pp[4]); PIX_SORT(pp[6],pp[7]); \
PIX_SORT(pp[1],pp[2]); PIX_SORT(pp[4],pp[5]); PIX_SORT(pp[7],pp[8]); \
PIX_SORT(pp[0],pp[3]); PIX_SORT(pp[5],pp[8]); PIX_SORT(pp[4],pp[7]); \
PIX_SORT(pp[3],pp[6]); PIX_SORT(pp[1],pp[4]); PIX_SORT(pp[2],pp[5]); \
PIX_SORT(pp[4],pp[7]); PIX_SORT(pp[4],pp[2]); PIX_SORT(pp[6],pp[4]); \
PIX_SORT(pp[4],pp[2]); median=pp[4];} //pp4 = median
#define med2(a0,a1,a2,a3,a4,median) { \
pp[0]=a0; pp[1]=a1; pp[2]=a2; pp[3]=a3; pp[4]=a4; \
PIX_SORT(pp[0],pp[1]) ; PIX_SORT(pp[3],pp[4]) ; PIX_SORT(pp[0],pp[3]) ;\
PIX_SORT(pp[1],pp[4]) ; PIX_SORT(pp[1],pp[2]) ; PIX_SORT(pp[2],pp[3]) ;\
PIX_SORT(pp[1],pp[2]) ; median=pp[2] ;}
#define med5(a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,median) { \
pp[0]=a0; pp[1]=a1; pp[2]=a2; pp[3]=a3; pp[4]=a4; pp[5]=a5; pp[6]=a6; pp[7]=a7; pp[8]=a8; pp[9]=a9; pp[10]=a10; pp[11]=a11; pp[12]=a12; \
pp[13]=a13; pp[14]=a14; pp[15]=a15; pp[16]=a16; pp[17]=a17; pp[18]=a18; pp[19]=a19; pp[20]=a20; pp[21]=a21; pp[22]=a22; pp[23]=a23; pp[24]=a24; \
PIX_SORT(pp[0], pp[1]) ; PIX_SORT(pp[3], pp[4]) ; PIX_SORT(pp[2], pp[4]) ;\
PIX_SORT(pp[2], pp[3]) ; PIX_SORT(pp[6], pp[7]) ; PIX_SORT(pp[5], pp[7]) ;\
PIX_SORT(pp[5], pp[6]) ; PIX_SORT(pp[9], pp[10]) ; PIX_SORT(pp[8], pp[10]) ;\
PIX_SORT(pp[8], pp[9]) ; PIX_SORT(pp[12], pp[13]) ; PIX_SORT(pp[11], pp[13]) ;\
PIX_SORT(pp[11], pp[12]) ; PIX_SORT(pp[15], pp[16]) ; PIX_SORT(pp[14], pp[16]) ;\
PIX_SORT(pp[14], pp[15]) ; PIX_SORT(pp[18], pp[19]) ; PIX_SORT(pp[17], pp[19]) ;\
PIX_SORT(pp[17], pp[18]) ; PIX_SORT(pp[21], pp[22]) ; PIX_SORT(pp[20], pp[22]) ;\
PIX_SORT(pp[20], pp[21]) ; PIX_SORT(pp[23], pp[24]) ; PIX_SORT(pp[2], pp[5]) ;\
PIX_SORT(pp[3], pp[6]) ; PIX_SORT(pp[0], pp[6]) ; PIX_SORT(pp[0], pp[3]) ;\
PIX_SORT(pp[4], pp[7]) ; PIX_SORT(pp[1], pp[7]) ; PIX_SORT(pp[1], pp[4]) ;\
PIX_SORT(pp[11], pp[14]) ; PIX_SORT(pp[8], pp[14]) ; PIX_SORT(pp[8], pp[11]) ;\
PIX_SORT(pp[12], pp[15]) ; PIX_SORT(pp[9], pp[15]) ; PIX_SORT(pp[9], pp[12]) ;\
PIX_SORT(pp[13], pp[16]) ; PIX_SORT(pp[10], pp[16]) ; PIX_SORT(pp[10], pp[13]) ;\
PIX_SORT(pp[20], pp[23]) ; PIX_SORT(pp[17], pp[23]) ; PIX_SORT(pp[17], pp[20]) ;\
PIX_SORT(pp[21], pp[24]) ; PIX_SORT(pp[18], pp[24]) ; PIX_SORT(pp[18], pp[21]) ;\
PIX_SORT(pp[19], pp[22]) ; PIX_SORT(pp[8], pp[17]) ; PIX_SORT(pp[9], pp[18]) ;\
PIX_SORT(pp[0], pp[18]) ; PIX_SORT(pp[0], pp[9]) ; PIX_SORT(pp[10], pp[19]) ;\
PIX_SORT(pp[1], pp[19]) ; PIX_SORT(pp[1], pp[10]) ; PIX_SORT(pp[11], pp[20]) ;\
PIX_SORT(pp[2], pp[20]) ; PIX_SORT(pp[2], pp[11]) ; PIX_SORT(pp[12], pp[21]) ;\
PIX_SORT(pp[3], pp[21]) ; PIX_SORT(pp[3], pp[12]) ; PIX_SORT(pp[13], pp[22]) ;\
PIX_SORT(pp[4], pp[22]) ; PIX_SORT(pp[4], pp[13]) ; PIX_SORT(pp[14], pp[23]) ;\
PIX_SORT(pp[5], pp[23]) ; PIX_SORT(pp[5], pp[14]) ; PIX_SORT(pp[15], pp[24]) ;\
PIX_SORT(pp[6], pp[24]) ; PIX_SORT(pp[6], pp[15]) ; PIX_SORT(pp[7], pp[16]) ;\
PIX_SORT(pp[7], pp[19]) ; PIX_SORT(pp[13], pp[21]) ; PIX_SORT(pp[15], pp[23]) ;\
PIX_SORT(pp[7], pp[13]) ; PIX_SORT(pp[7], pp[15]) ; PIX_SORT(pp[1], pp[9]) ;\
PIX_SORT(pp[3], pp[11]) ; PIX_SORT(pp[5], pp[17]) ; PIX_SORT(pp[11], pp[17]) ;\
PIX_SORT(pp[9], pp[17]) ; PIX_SORT(pp[4], pp[10]) ; PIX_SORT(pp[6], pp[12]) ;\
PIX_SORT(pp[7], pp[14]) ; PIX_SORT(pp[4], pp[6]) ; PIX_SORT(pp[4], pp[7]) ;\
PIX_SORT(pp[12], pp[14]) ; PIX_SORT(pp[10], pp[14]) ; PIX_SORT(pp[6], pp[7]) ;\
PIX_SORT(pp[10], pp[12]) ; PIX_SORT(pp[6], pp[10]) ; PIX_SORT(pp[6], pp[17]) ;\
PIX_SORT(pp[12], pp[17]) ; PIX_SORT(pp[7], pp[17]) ; PIX_SORT(pp[7], pp[10]) ;\
PIX_SORT(pp[12], pp[18]) ; PIX_SORT(pp[7], pp[12]) ; PIX_SORT(pp[10], pp[18]) ;\
PIX_SORT(pp[12], pp[20]) ; PIX_SORT(pp[10], pp[20]) ; PIX_SORT(pp[10], pp[12]) ;\
median=pp[12];}
#define ELEM_FLOAT_SWAP(a,b) { register float t=(a);(a)=(b);(b)=t; }
namespace rtengine { namespace rtengine {
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -83,14 +142,58 @@ namespace rtengine {
extern const Settings* settings; extern const Settings* settings;
// Median calculation using quicksort
float fq_sort2(float arr[], int n)
{
int low, high ;
int median;
int middle, ll, hh;
low = 0 ; high = n-1 ; median = (low + high) / 2;
for (;;) {
if (high <= low)
return arr[median] ;
if (high == low + 1) {
if (arr[low] > arr[high])
ELEM_FLOAT_SWAP(arr[low], arr[high]) ;
return arr[median] ;
}
middle = (low + high) / 2;
if (arr[middle] > arr[high]) ELEM_FLOAT_SWAP(arr[middle], arr[high]) ;
if (arr[low] > arr[high]) ELEM_FLOAT_SWAP(arr[low], arr[high]) ;
if (arr[middle] > arr[low]) ELEM_FLOAT_SWAP(arr[middle], arr[low]) ;
ELEM_FLOAT_SWAP(arr[middle], arr[low+1]) ;
ll = low + 1;
hh = high;
for (;;) {
do ll++; while (arr[low] > arr[ll]) ;
do hh--; while (arr[hh] > arr[low]) ;
if (hh < ll)
break;
ELEM_FLOAT_SWAP(arr[ll], arr[hh]) ;
}
ELEM_FLOAT_SWAP(arr[low], arr[hh]) ;
if (hh <= median)
low = ll;
if (hh >= median)
high = hh - 1;
}
}
void ImProcFunctions::RGB_denoise(Imagefloat * src, Imagefloat * dst, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const procparams::DefringeParams & defringe, const double expcomp) void ImProcFunctions::RGB_denoise(Imagefloat * src, Imagefloat * dst, bool isRAW, const procparams::DirPyrDenoiseParams & dnparams, const procparams::DefringeParams & defringe, const double expcomp)
{ {
//#ifdef _DEBUG //#ifdef _DEBUG
// MyTime t1e,t2e; MyTime t1e,t2e;
// t1e.set(); t1e.set();
//#endif //#endif
static MyMutex FftwMutex; static MyMutex FftwMutex;
@@ -108,13 +211,16 @@ namespace rtengine {
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
const short int imheight=src->height, imwidth=src->width; const short int imheight=src->height, imwidth=src->width;
if (dnparams.luma==0 && dnparams.chroma==0) { if (dnparams.luma==0 && dnparams.chroma==0 && !dnparams.median) {
//nothing to do; copy src to dst //nothing to do; copy src to dst or do nothing in case src == dst
memcpy(dst->data,src->data,dst->width*dst->height*3*sizeof(float)); if(src != dst)
memcpy(dst->data,src->data,dst->width*dst->height*3*sizeof(float));
return; return;
} }
if (dnparams.luma!=0 || dnparams.chroma!=0) {
perf=false; perf=false;
if(dnparams.dmethod=="RGB") perf=true;//RGB mode if(dnparams.dmethod=="RGB") perf=true;//RGB mode
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -165,6 +271,7 @@ namespace rtengine {
float incr=1.f; float incr=1.f;
float noisevar_Ldetail = SQR((float)(SQR(100.-dnparams.Ldetail) + 50.*(100.-dnparams.Ldetail)) * TS * 0.5f * incr); float noisevar_Ldetail = SQR((float)(SQR(100.-dnparams.Ldetail) + 50.*(100.-dnparams.Ldetail)) * TS * 0.5f * incr);
bool enhance_denoise = dnparams.enhance; bool enhance_denoise = dnparams.enhance;
// bool median_denoise = dnparams.median;
int gamlab = settings->denoiselabgamma;//gamma lab essentialy for Luminance detail int gamlab = settings->denoiselabgamma;//gamma lab essentialy for Luminance detail
if(gamlab > 2) gamlab=2; if(gamlab > 2) gamlab=2;
if(settings->verbose) printf("Denoise Lab=%i\n",gamlab); if(settings->verbose) printf("Denoise Lab=%i\n",gamlab);
@@ -173,7 +280,7 @@ namespace rtengine {
array2D<float> tilemask_out(TS,TS); array2D<float> tilemask_out(TS,TS);
const int border = MAX(2,TS/16); const int border = MAX(2,TS/16);
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp parallel for #pragma omp parallel for
#endif #endif
@@ -294,9 +401,9 @@ namespace rtengine {
{ {
Lblox = (float*) fftwf_malloc(max_numblox_W*TS*TS*sizeof(float)); Lblox = (float*) fftwf_malloc(max_numblox_W*TS*TS*sizeof(float));
fLblox = (float*) fftwf_malloc(max_numblox_W*TS*TS*sizeof(float)); fLblox = (float*) fftwf_malloc(max_numblox_W*TS*TS*sizeof(float));
} }
float * nbrwt = new float[TS*TS]; float * nbrwt = new float[TS*TS];
float * blurbuffer = new float[TS*TS]; float * blurbuffer = new float[TS*TS];
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp for schedule(dynamic) collapse(2) #pragma omp for schedule(dynamic) collapse(2)
@@ -321,7 +428,7 @@ namespace rtengine {
//TODO: implement using AlignedBufferMP //TODO: implement using AlignedBufferMP
//fill tile from image; convert RGB to "luma/chroma" //fill tile from image; convert RGB to "luma/chroma"
if (isRAW) {//image is raw; use channel differences for chroma channels if (isRAW) {//image is raw; use channel differences for chroma channels
if(!perf){//lab mode if(!perf){//lab mode
//modification Jacques feb 2013 //modification Jacques feb 2013
for (int i=tiletop/*, i1=0*/; i<tilebottom; i++/*, i1++*/) { for (int i=tiletop/*, i1=0*/; i<tilebottom; i++/*, i1++*/) {
int i1 = i - tiletop; int i1 = i - tiletop;
@@ -768,18 +875,188 @@ namespace rtengine {
} }
delete dsttmp; delete dsttmp;
// destroy the plans // destroy the plans
fftwf_destroy_plan( plan_forward_blox[0] ); fftwf_destroy_plan( plan_forward_blox[0] );
fftwf_destroy_plan( plan_backward_blox[0] ); fftwf_destroy_plan( plan_backward_blox[0] );
fftwf_destroy_plan( plan_forward_blox[1] ); fftwf_destroy_plan( plan_forward_blox[1] );
fftwf_destroy_plan( plan_backward_blox[1] ); fftwf_destroy_plan( plan_backward_blox[1] );
fftwf_cleanup(); fftwf_cleanup();
}
//median 3x3 in complement
if(dnparams.median) {
int wid=dst->width, hei=dst->height;
float** tm;
tm = new float*[hei];
for (int i=0; i<hei; i++)
tm[i] = new float[wid];
Imagefloat *source;
if (dnparams.luma==0 && dnparams.chroma==0)
source = dst;
else
source = src;
int methmed=0;
int border = 1;
if(dnparams.medmethod=="soft")
methmed=0;
else if(dnparams.medmethod=="33")
methmed=1;
else if(dnparams.medmethod=="55") {
methmed = 3;
border = 2;
}
else if(dnparams.medmethod=="55soft") {
methmed = 2;
border = 2;
}
#pragma omp parallel
{
if(methmed < 2) {
#pragma omp for
for (int i=1; i<hei-1; i++) {
float pp[9],temp;
if(methmed == 0)
for (int j=1; j<wid-1; j++) {
med2(source->r(i,j),source->r(i-1,j),source->r(i+1,j),source->r(i,j+1),source->r(i,j-1),tm[i][j]);//3x3 soft
}
else
for (int j=1; j<wid-1; j++) {
med3(source->r(i,j),source->r(i-1,j),source->r(i+1,j),source->r(i,j+1),source->r(i,j-1),source->r(i-1,j-1),source->r(i-1,j+1),source->r(i+1,j-1),source->r(i+1,j+1),tm[i][j]);//3x3
}
}
} else {
#pragma omp for
for (int i=2; i<hei-2; i++) {
float pp[25],temp;
if(methmed == 3)
for (int j=2; j<wid-2; j++) {
med5(source->r(i,j),source->r(i-1,j),source->r(i+1,j),source->r(i,j+1),source->r(i,j-1),source->r(i-1,j-1),source->r(i-1,j+1),source->r(i+1,j-1),source->r(i+1,j+1),
source->r(i-2,j),source->r(i+2,j),source->r(i,j+2),source->r(i,j-2),source->r(i-2,j-2),source->r(i-2,j+2),source->r(i+2,j-2),source->r(i+2,j+2),
source->r(i-2,j+1),source->r(i+2,j+1),source->r(i-1,j+2),source->r(i-1,j-2),source->r(i-2,j-1),source->r(i+2,j-1),source->r(i+1,j+2),source->r(i+1,j-2),
tm[i][j]);//5x5
}
else
for (int j=2; j<wid-2; j++) {
pp[0]=source->r(i,j);pp[1]=source->r(i-1,j); pp[2]=source->r(i+1,j);pp[3]=source->r(i,j+1);pp[4]=source->r(i,j-1);pp[5]=source->r(i-1,j-1);pp[6]=source->r(i-1,j+1);
pp[7]=source->r(i+1,j-1);pp[8]=source->r(i+1,j+1);pp[9]=source->r(i+2,j);pp[10]=source->r(i-2,j);pp[11]=source->r(i,j+2);pp[12]=source->r(i,j-2);
fq_sort2(pp,13);
tm[i][j]=pp[6];//5x5 soft
}
}
}
#ifdef _OPENMP
#pragma omp for nowait
#endif
for(int i = border; i < hei-border; i++ ) {
for(int j = border; j < wid-border; j++) {
dst->r(i,j) = tm[i][j];
}
}
if(methmed < 2) {
#pragma omp for
for (int i=1; i<hei-1; i++) {
float pp[9],temp;
if(methmed == 0)
for (int j=1; j<wid-1; j++) {
med2(source->b(i,j),source->b(i-1,j),source->b(i+1,j),source->b(i,j+1),source->b(i,j-1),tm[i][j]);
}
else
for (int j=1; j<wid-1; j++) {
med3(source->b(i,j),source->b(i-1,j),source->b(i+1,j),source->b(i,j+1),source->b(i,j-1),source->b(i-1,j-1),source->b(i-1,j+1),source->b(i+1,j-1),source->b(i+1,j+1),tm[i][j]);
}
}
} else {
#pragma omp for
for (int i=2; i<hei-2; i++) {
float pp[25],temp;
if(methmed == 3)
for (int j=2; j<wid-2; j++) {
med5(source->b(i,j),source->b(i-1,j),source->b(i+1,j),source->b(i,j+1),source->b(i,j-1),source->b(i-1,j-1),source->b(i-1,j+1),source->b(i+1,j-1),source->b(i+1,j+1),
source->b(i-2,j),source->b(i+2,j),source->b(i,j+2),source->b(i,j-2),source->b(i-2,j-2),source->b(i-2,j+2),source->b(i+2,j-2),source->b(i+2,j+2),
source->b(i-2,j+1),source->b(i+2,j+1),source->b(i-1,j+2),source->b(i-1,j-2),source->b(i-2,j-1),source->b(i+2,j-1),source->b(i+1,j+2),source->b(i+1,j-2),
tm[i][j]);//5x5
}
else
for (int j=2; j<wid-2; j++) {
pp[0]=source->b(i,j);pp[1]=source->b(i-1,j); pp[2]=source->b(i+1,j);pp[3]=source->b(i,j+1);pp[4]=source->b(i,j-1);pp[5]=source->b(i-1,j-1);pp[6]=source->b(i-1,j+1);
pp[7]=source->b(i+1,j-1);pp[8]=source->b(i+1,j+1);pp[9]=source->b(i+2,j);pp[10]=source->b(i-2,j);pp[11]=source->b(i,j+2);pp[12]=source->b(i,j-2);
fq_sort2(pp,13);
tm[i][j]=pp[6];//5x5 soft
}
}
}
#ifdef _OPENMP
#pragma omp for nowait
#endif
for(int i = border; i < hei-border; i++ ) {
for(int j = border; j < wid-border; j++) {
dst->b(i,j) = tm[i][j];
}
}
if(methmed < 2) {
#pragma omp for
for (int i=1; i<hei-1; i++) {
float pp[9],temp;
if(methmed == 0)
for (int j=1; j<wid-1; j++) {
med2(source->g(i,j),source->g(i-1,j),source->g(i+1,j),source->g(i,j+1),source->g(i,j-1),tm[i][j]);
}
else
for (int j=1; j<wid-1; j++) {
med3(source->g(i,j),source->g(i-1,j),source->g(i+1,j),source->g(i,j+1),source->g(i,j-1),source->g(i-1,j-1),source->g(i-1,j+1),source->g(i+1,j-1),source->g(i+1,j+1),tm[i][j]);
}
}
} else {
#pragma omp for
for (int i=2; i<hei-2; i++) {
float pp[25],temp;
if(methmed == 3)
for (int j=2; j<wid-2; j++) {
med5(source->g(i,j),source->g(i-1,j),source->g(i+1,j),source->g(i,j+1),source->g(i,j-1),source->g(i-1,j-1),source->g(i-1,j+1),source->g(i+1,j-1),source->g(i+1,j+1),
source->g(i-2,j),source->g(i+2,j),source->g(i,j+2),source->g(i,j-2),source->g(i-2,j-2),source->g(i-2,j+2),source->g(i+2,j-2),source->g(i+2,j+2),
source->g(i-2,j+1),source->g(i+2,j+1),source->g(i-1,j+2),source->g(i-1,j-2),source->g(i-2,j-1),source->g(i+2,j-1),source->g(i+1,j+2),source->g(i+1,j-2),
tm[i][j]);//5x5
}
else
for (int j=2; j<wid-2; j++) {
pp[0]=source->g(i,j);pp[1]=source->g(i-1,j); pp[2]=source->g(i+1,j);pp[3]=source->g(i,j+1);pp[4]=source->g(i,j-1);pp[5]=source->g(i-1,j-1);pp[6]=source->g(i-1,j+1);
pp[7]=source->g(i+1,j-1);pp[8]=source->g(i+1,j+1);pp[9]=source->g(i+2,j);pp[10]=source->g(i-2,j);pp[11]=source->g(i,j+2);pp[12]=source->g(i,j-2);
fq_sort2(pp,13);
tm[i][j]=pp[6];//5x5 soft
}
}
}
#ifdef _OPENMP
#pragma omp for
#endif
for(int i = border; i < hei-border; i++ ) {
for(int j = border; j < wid-border; j++) {
dst->g(i,j) = tm[i][j];
}
}
}
for (int i=0; i<hei; i++)
delete [] tm[i];
delete [] tm;
}
//end median
//#ifdef _DEBUG //#ifdef _DEBUG
// if (settings->verbose) { if (settings->verbose) {
// t2e.set(); t2e.set();
// printf("Denoise performed in %d usec:\n", t2e.etime(t1e)); printf("Denoise performed in %d usec:\n", t2e.etime(t1e));
// } }
//#endif //#endif
}//end of main RGB_denoise }//end of main RGB_denoise
@@ -890,13 +1167,13 @@ SSEFUNCTION void ImProcFunctions::RGBtile_denoise (float * fLblox, int hblproc,
return (( (median-1) + (datalen/2-count_)/((float)(count-count_)) )/0.6745); return (( (median-1) + (datalen/2-count_)/((float)(count-count_)) )/0.6745);
} }
float ImProcFunctions::Mad( float * RESTRICT DataList, int datalen, int * RESTRICT histo) { float ImProcFunctions::Mad( float * RESTRICT DataList, int datalen, int * RESTRICT histo) {
//computes Median Absolute Deviation //computes Median Absolute Deviation
//DataList values should mostly have abs val < 65535 //DataList values should mostly have abs val < 65535
for (int i=0; i<65536; i++) for (int i=0; i<65536; i++)
histo[i]=0; histo[i]=0;
//calculate histogram of absolute values of HH wavelet coeffs //calculate histogram of absolute values of HH wavelet coeffs
@@ -916,7 +1193,7 @@ SSEFUNCTION void ImProcFunctions::RGBtile_denoise (float * fLblox, int hblproc,
// interpolate // interpolate
return (( (median-1) + (datalen/2-count_)/((float)(count-count_)) )/0.6745); return (( (median-1) + (datalen/2-count_)/((float)(count-count_)) )/0.6745);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -951,7 +1228,7 @@ SSEFUNCTION void ImProcFunctions::WaveletDenoiseAll_BiShrink(wavelet_decompositi
madL[lvl][dir-1] = SQR(Mad(WavCoeffs_L[dir], Wlvl_L*Hlvl_L, madHisto)); madL[lvl][dir-1] = SQR(Mad(WavCoeffs_L[dir], Wlvl_L*Hlvl_L, madHisto));
mada[lvl][dir-1] = SQR(Mad(WavCoeffs_a[dir], Wlvl_ab*Hlvl_ab, madHisto)); mada[lvl][dir-1] = SQR(Mad(WavCoeffs_a[dir], Wlvl_ab*Hlvl_ab, madHisto));
madb[lvl][dir-1] = SQR(Mad(WavCoeffs_b[dir], Wlvl_ab*Hlvl_ab, madHisto)); madb[lvl][dir-1] = SQR(Mad(WavCoeffs_b[dir], Wlvl_ab*Hlvl_ab, madHisto));
} }
} }
delete [] madHisto; delete [] madHisto;
@@ -982,8 +1259,8 @@ SSEFUNCTION void ImProcFunctions::WaveletDenoiseAll_BiShrink(wavelet_decompositi
//float ** WavPars_b = WaveletCoeffs_b.level_coeffs(lvl+1); //float ** WavPars_b = WaveletCoeffs_b.level_coeffs(lvl+1);
//simple wavelet shrinkage //simple wavelet shrinkage
float * sfave = new float[Wlvl_L*Hlvl_L]; float * sfave = new float[Wlvl_L*Hlvl_L];
float * WavCoeffsLtemp = new float[Hlvl_ab*Wlvl_ab]; float * WavCoeffsLtemp = new float[Hlvl_ab*Wlvl_ab];
// array2D<float> edge(Wlvl_L,Hlvl_L); // array2D<float> edge(Wlvl_L,Hlvl_L);
@@ -992,8 +1269,8 @@ SSEFUNCTION void ImProcFunctions::WaveletDenoiseAll_BiShrink(wavelet_decompositi
for (int dir=1; dir<4; dir++) { for (int dir=1; dir<4; dir++) {
float mad_L = madL[lvl][dir-1]; float mad_L = madL[lvl][dir-1];
float mad_a = noisevar_abr*mada[lvl][dir-1]; float mad_a = noisevar_abr*mada[lvl][dir-1];
float mad_b = noisevar_abb*madb[lvl][dir-1]; float mad_b = noisevar_abb*madb[lvl][dir-1];
//float mad_Lpar = madL[lvl+1][dir-1]; //float mad_Lpar = madL[lvl+1][dir-1];
//float mad_apar = mada[lvl+1][dir-1]; //float mad_apar = mada[lvl+1][dir-1];
@@ -1003,37 +1280,37 @@ SSEFUNCTION void ImProcFunctions::WaveletDenoiseAll_BiShrink(wavelet_decompositi
// float skip_L_ratio = WaveletCoeffs_L.level_stride(lvl+1)/skip_L; // float skip_L_ratio = WaveletCoeffs_L.level_stride(lvl+1)/skip_L;
if (noisevar_abr>0.01f || noisevar_abb>0.01f) { if (noisevar_abr>0.01f || noisevar_abb>0.01f) {
for(int i=0;i<Hlvl_ab;i++) for(int i=0;i<Hlvl_ab;i++)
for(int j=0;j<Wlvl_ab;j++) for(int j=0;j<Wlvl_ab;j++)
WavCoeffsLtemp[i*Wlvl_ab+j] = WavCoeffs_L[dir][((i*skip_L)/skip_ab)*Wlvl_L + ((j*skip_L)/skip_ab)]; WavCoeffsLtemp[i*Wlvl_ab+j] = WavCoeffs_L[dir][((i*skip_L)/skip_ab)*Wlvl_L + ((j*skip_L)/skip_ab)];
#ifdef __SSE2__ #ifdef __SSE2__
int j; int j;
__m128 onev = _mm_set1_ps(1.f); __m128 onev = _mm_set1_ps(1.f);
__m128 mad_Lm9v = _mm_set1_ps(mad_L * 9.f); __m128 mad_Lm9v = _mm_set1_ps(mad_L * 9.f);
__m128 mad_av = _mm_set1_ps(mad_a); __m128 mad_av = _mm_set1_ps(mad_a);
__m128 mad_bv = _mm_set1_ps(mad_b); __m128 mad_bv = _mm_set1_ps(mad_b);
__m128 epsv = _mm_set1_ps(eps); __m128 epsv = _mm_set1_ps(eps);
__m128 mag_Lv, mag_av, mag_bv; __m128 mag_Lv, mag_av, mag_bv;
__m128 tempav, tempbv; __m128 tempav, tempbv;
for (int i=0; i<Hlvl_ab; i++) { for (int i=0; i<Hlvl_ab; i++) {
int coeffloc_ab = i*Wlvl_ab; int coeffloc_ab = i*Wlvl_ab;
for (j=0; j<Wlvl_ab-3; j+=4, coeffloc_ab+=4) { for (j=0; j<Wlvl_ab-3; j+=4, coeffloc_ab+=4) {
tempav = LVFU(WavCoeffs_a[dir][coeffloc_ab]); tempav = LVFU(WavCoeffs_a[dir][coeffloc_ab]);
tempbv = LVFU(WavCoeffs_b[dir][coeffloc_ab]); tempbv = LVFU(WavCoeffs_b[dir][coeffloc_ab]);
mag_Lv = LVFU(WavCoeffsLtemp[coeffloc_ab]); mag_Lv = LVFU(WavCoeffsLtemp[coeffloc_ab]);
mag_av = SQRV(tempav)+epsv; mag_av = SQRV(tempav)+epsv;
mag_bv = SQRV(tempbv)+epsv; mag_bv = SQRV(tempbv)+epsv;
mag_Lv = SQRV(mag_Lv) + epsv; mag_Lv = SQRV(mag_Lv) + epsv;
_mm_storeu_ps(&WavCoeffs_a[dir][coeffloc_ab], tempav * SQRV((onev-xexpf(-(mag_av/mad_av)-(mag_Lv/mad_Lm9v))))); _mm_storeu_ps(&WavCoeffs_a[dir][coeffloc_ab], tempav * SQRV((onev-xexpf(-(mag_av/mad_av)-(mag_Lv/mad_Lm9v)))));
_mm_storeu_ps(&WavCoeffs_b[dir][coeffloc_ab], tempbv * SQRV((onev-xexpf(-(mag_bv/mad_bv)-(mag_Lv/mad_Lm9v))))); _mm_storeu_ps(&WavCoeffs_b[dir][coeffloc_ab], tempbv * SQRV((onev-xexpf(-(mag_bv/mad_bv)-(mag_Lv/mad_Lm9v)))));
} }
for (; j<Wlvl_ab; j++,coeffloc_ab++) { for (; j<Wlvl_ab; j++,coeffloc_ab++) {
float mag_L = SQR(WavCoeffsLtemp[coeffloc_ab ])+eps; float mag_L = SQR(WavCoeffsLtemp[coeffloc_ab ])+eps;
float mag_a = SQR(WavCoeffs_a[dir][coeffloc_ab])+eps; float mag_a = SQR(WavCoeffs_a[dir][coeffloc_ab])+eps;
float mag_b = SQR(WavCoeffs_b[dir][coeffloc_ab])+eps; float mag_b = SQR(WavCoeffs_b[dir][coeffloc_ab])+eps;
WavCoeffs_a[dir][coeffloc_ab] *= SQR(1.f-xexpf(-(mag_a/mad_a)-(mag_L/(9.f*mad_L)))/*satfactor_a*/); WavCoeffs_a[dir][coeffloc_ab] *= SQR(1.f-xexpf(-(mag_a/mad_a)-(mag_L/(9.f*mad_L)))/*satfactor_a*/);
WavCoeffs_b[dir][coeffloc_ab] *= SQR(1.f-xexpf(-(mag_b/mad_b)-(mag_L/(9.f*mad_L)))/*satfactor_b*/); WavCoeffs_b[dir][coeffloc_ab] *= SQR(1.f-xexpf(-(mag_b/mad_b)-(mag_L/(9.f*mad_L)))/*satfactor_b*/);
} }
}//now chrominance coefficients are denoised }//now chrominance coefficients are denoised
#else #else
//printf(" dir=%d mad_L=%f mad_a=%f mad_b=%f \n",dir,sqrt(mad_L),sqrt(mad_a),sqrt(mad_b)); //printf(" dir=%d mad_L=%f mad_a=%f mad_b=%f \n",dir,sqrt(mad_L),sqrt(mad_a),sqrt(mad_b));
@@ -1066,24 +1343,24 @@ SSEFUNCTION void ImProcFunctions::WaveletDenoiseAll_BiShrink(wavelet_decompositi
WavCoeffs_b[dir][coeffloc_ab] *= SQR(1.f-xexpf(-(mag_b/mad_b)-(mag_L/(9.f*mad_L)))/*satfactor_b*/); WavCoeffs_b[dir][coeffloc_ab] *= SQR(1.f-xexpf(-(mag_b/mad_b)-(mag_L/(9.f*mad_L)))/*satfactor_b*/);
} }
}//now chrominance coefficients are denoised }//now chrominance coefficients are denoised
#endif #endif
} }
if (noisevar_L>0.01f) { if (noisevar_L>0.01f) {
mad_L *= noisevar_L*5.f/(lvl+1); mad_L *= noisevar_L*5.f/(lvl+1);
#ifdef __SSE2__ #ifdef __SSE2__
int j; int j;
__m128 mad_Lv = _mm_set1_ps(mad_L); __m128 mad_Lv = _mm_set1_ps(mad_L);
__m128 mad_Lm9v = _mm_set1_ps(mad_L * 9.f); __m128 mad_Lm9v = _mm_set1_ps(mad_L * 9.f);
__m128 epsv = _mm_set1_ps(eps); __m128 epsv = _mm_set1_ps(eps);
__m128 mag_Lv; __m128 mag_Lv;
for (int i=0; i<Hlvl_L; i++) { for (int i=0; i<Hlvl_L; i++) {
int coeffloc_L = i*Wlvl_L; int coeffloc_L = i*Wlvl_L;
for (j=0; j<Wlvl_L-3; j+=4,coeffloc_L+=4) { for (j=0; j<Wlvl_L-3; j+=4,coeffloc_L+=4) {
mag_Lv = SQRV(LVFU(WavCoeffs_L[dir][coeffloc_L])); mag_Lv = SQRV(LVFU(WavCoeffs_L[dir][coeffloc_L]));
_mm_storeu_ps(&sfave[coeffloc_L], mag_Lv / ( mag_Lv + mad_Lv * xexpf(-mag_Lv/mad_Lm9v )+ epsv)); _mm_storeu_ps(&sfave[coeffloc_L], mag_Lv / ( mag_Lv + mad_Lv * xexpf(-mag_Lv/mad_Lm9v )+ epsv));
} }
for (; j<Wlvl_L; j++, coeffloc_L++) { for (; j<Wlvl_L; j++, coeffloc_L++) {
float mag_L = SQR(WavCoeffs_L[dir][coeffloc_L]); float mag_L = SQR(WavCoeffs_L[dir][coeffloc_L]);
sfave[coeffloc_L] = mag_L/(mag_L+mad_L*xexpf(-mag_L/(9.f*mad_L))+eps); sfave[coeffloc_L] = mag_L/(mag_L+mad_L*xexpf(-mag_L/(9.f*mad_L))+eps);
@@ -1111,23 +1388,23 @@ SSEFUNCTION void ImProcFunctions::WaveletDenoiseAll_BiShrink(wavelet_decompositi
//gaussVertical<float> (edge, edge, buffer, Wlvl_L, Hlvl_L, 1<<(lvl+1), false); //gaussVertical<float> (edge, edge, buffer, Wlvl_L, Hlvl_L, 1<<(lvl+1), false);
boxblur(sfave, sfave, lvl+2, lvl+2, Wlvl_L, Hlvl_L);//increase smoothness by locally averaging shrinkage boxblur(sfave, sfave, lvl+2, lvl+2, Wlvl_L, Hlvl_L);//increase smoothness by locally averaging shrinkage
#ifdef __SSE2__ #ifdef __SSE2__
__m128 tempLv; __m128 tempLv;
__m128 tempL2v; __m128 tempL2v;
__m128 sf_Lv; __m128 sf_Lv;
for (int i=0; i<Hlvl_L; i++) { for (int i=0; i<Hlvl_L; i++) {
int coeffloc_L = i*Wlvl_L; int coeffloc_L = i*Wlvl_L;
for (j=0; j<Wlvl_L-3; j+=4,coeffloc_L+=4) { for (j=0; j<Wlvl_L-3; j+=4,coeffloc_L+=4) {
tempLv = LVFU(WavCoeffs_L[dir][coeffloc_L]); tempLv = LVFU(WavCoeffs_L[dir][coeffloc_L]);
mag_Lv = SQRV(tempLv); mag_Lv = SQRV(tempLv);
tempL2v = LVFU(sfave[coeffloc_L]); tempL2v = LVFU(sfave[coeffloc_L]);
sf_Lv = mag_Lv/(mag_Lv + mad_Lv*xexpf(-mag_Lv/mad_Lm9v)+epsv); sf_Lv = mag_Lv/(mag_Lv + mad_Lv*xexpf(-mag_Lv/mad_Lm9v)+epsv);
_mm_storeu_ps(&WavCoeffs_L[dir][coeffloc_L], tempLv * (SQRV(tempL2v)+SQRV(sf_Lv))/(tempL2v+sf_Lv+epsv)); _mm_storeu_ps(&WavCoeffs_L[dir][coeffloc_L], tempLv * (SQRV(tempL2v)+SQRV(sf_Lv))/(tempL2v+sf_Lv+epsv));
//use smoothed shrinkage unless local shrinkage is much less //use smoothed shrinkage unless local shrinkage is much less
}//now luminance coeffs are denoised }//now luminance coeffs are denoised
for (; j<Wlvl_L; j++,coeffloc_L++) { for (; j<Wlvl_L; j++,coeffloc_L++) {
float mag_L = SQR(WavCoeffs_L[dir][coeffloc_L]); float mag_L = SQR(WavCoeffs_L[dir][coeffloc_L]);
float sf_L = mag_L/(mag_L + mad_L*xexpf(-mag_L/(9.f*mad_L))+eps); float sf_L = mag_L/(mag_L + mad_L*xexpf(-mag_L/(9.f*mad_L))+eps);
@@ -1137,8 +1414,8 @@ SSEFUNCTION void ImProcFunctions::WaveletDenoiseAll_BiShrink(wavelet_decompositi
}//now luminance coeffs are denoised }//now luminance coeffs are denoised
} }
#else #else
for (int i=0; i<Hlvl_L; i++) for (int i=0; i<Hlvl_L; i++)
for (int j=0; j<Wlvl_L; j++) { for (int j=0; j<Wlvl_L; j++) {
@@ -1158,7 +1435,7 @@ SSEFUNCTION void ImProcFunctions::WaveletDenoiseAll_BiShrink(wavelet_decompositi
#endif #endif
} }
} }
delete[] WavCoeffsLtemp; delete[] WavCoeffsLtemp;
delete[] sfave; delete[] sfave;
@@ -1193,7 +1470,7 @@ SSEFUNCTION void ImProcFunctions::WaveletDenoiseAll_BiShrink(wavelet_decompositi
float ** WavCoeffs_b = WaveletCoeffs_b.level_coeffs(lvl); float ** WavCoeffs_b = WaveletCoeffs_b.level_coeffs(lvl);
// printf("Hab : %d\n", Hlvl_ab); // printf("Hab : %d\n", Hlvl_ab);
// printf("Wab : %d\n", Wlvl_ab); // printf("Wab : %d\n", Wlvl_ab);
ShrinkAll(WavCoeffs_L, WavCoeffs_a, WavCoeffs_b, lvl, Wlvl_L, Hlvl_L, Wlvl_ab, Hlvl_ab, ShrinkAll(WavCoeffs_L, WavCoeffs_a, WavCoeffs_b, lvl, Wlvl_L, Hlvl_L, Wlvl_ab, Hlvl_ab,
skip_L, skip_ab, noisevar_L, noisevar_abr, noisevar_abb, noi); skip_L, skip_ab, noisevar_L, noisevar_abr, noisevar_abb, noi);
@@ -1204,7 +1481,7 @@ SSEFUNCTION void ImProcFunctions::WaveletDenoiseAll_BiShrink(wavelet_decompositi
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SSEFUNCTION void ImProcFunctions::ShrinkAll(float ** WavCoeffs_L, float ** WavCoeffs_a, float ** WavCoeffs_b, int level, SSEFUNCTION void ImProcFunctions::ShrinkAll(float ** WavCoeffs_L, float ** WavCoeffs_a, float ** WavCoeffs_b, int level,
int W_L, int H_L, int W_ab, int H_ab,int skip_L, int skip_ab, float noisevar_L, float noisevar_abr, float noisevar_abb, LabImage * noi, int W_L, int H_L, int W_ab, int H_ab,int skip_L, int skip_ab, float noisevar_L, float noisevar_abr, float noisevar_abb, LabImage * noi,
float * madaa, float * madab, float * madaL, bool madCalculated) float * madaa, float * madab, float * madaL, bool madCalculated)
{ {
@@ -1212,25 +1489,25 @@ SSEFUNCTION void ImProcFunctions::ShrinkAll(float ** WavCoeffs_L, float ** WavCo
const float eps = 0.01f; const float eps = 0.01f;
float * sfave = new float[W_L*H_L]; float * sfave = new float[W_L*H_L];
float * sfavea = new float[W_L*H_L]; float * sfavea = new float[W_L*H_L];
float * sfaveb = new float[W_L*H_L]; float * sfaveb = new float[W_L*H_L];
float * WavCoeffsLtemp = new float[H_ab*W_ab]; float * WavCoeffsLtemp = new float[H_ab*W_ab];
// int max; // int max;
//printf("\n level=%d \n",level); //printf("\n level=%d \n",level);
for (int dir=1; dir<4; dir++) { for (int dir=1; dir<4; dir++) {
float mada, madb, madL; float mada, madb, madL;
if(madCalculated) { if(madCalculated) {
mada = madaa[dir-1]; mada = madaa[dir-1];
madb = madab[dir-1]; madb = madab[dir-1];
madL = madaL[dir-1] ; madL = madaL[dir-1] ;
} else { } else {
int * madHisto = new int[65536]; int * madHisto = new int[65536];
mada = SQR(Mad(WavCoeffs_a[dir], W_ab*H_ab, madHisto)); mada = SQR(Mad(WavCoeffs_a[dir], W_ab*H_ab, madHisto));
madb = SQR(Mad(WavCoeffs_b[dir], W_ab*H_ab, madHisto)); madb = SQR(Mad(WavCoeffs_b[dir], W_ab*H_ab, madHisto));
madL = SQR(Mad(WavCoeffs_L[dir], W_L*H_L, madHisto)); madL = SQR(Mad(WavCoeffs_L[dir], W_L*H_L, madHisto));
delete [] madHisto; delete [] madHisto;
} }
// printf(" dir=%d mad_L=%f mad_a=%f mad_b=%f skip_ab=%i \n",dir,sqrt(madL),sqrt(mada),sqrt(madb), skip_ab); // printf(" dir=%d mad_L=%f mad_a=%f mad_b=%f skip_ab=%i \n",dir,sqrt(madL),sqrt(mada),sqrt(madb), skip_ab);
@@ -1239,39 +1516,39 @@ SSEFUNCTION void ImProcFunctions::ShrinkAll(float ** WavCoeffs_L, float ** WavCo
float mad_a = mada*noisevar_abr; // noisevar_abr between 0..2.25=default 100=middle value ==> 582=max float mad_a = mada*noisevar_abr; // noisevar_abr between 0..2.25=default 100=middle value ==> 582=max
float mad_b = madb*noisevar_abb; float mad_b = madb*noisevar_abb;
if (noisevar_abr>0.01f || noisevar_abb>0.01f) { if (noisevar_abr>0.01f || noisevar_abb>0.01f) {
for(int i=0;i<H_ab;i++) for(int i=0;i<H_ab;i++)
for(int j=0;j<W_ab;j++) for(int j=0;j<W_ab;j++)
WavCoeffsLtemp[i*W_ab+j] = WavCoeffs_L[dir][((i*skip_L)/skip_ab)*W_L + ((j*skip_L)/skip_ab)]; WavCoeffsLtemp[i*W_ab+j] = WavCoeffs_L[dir][((i*skip_L)/skip_ab)*W_L + ((j*skip_L)/skip_ab)];
#ifdef __SSE2__ #ifdef __SSE2__
int j; int j;
__m128 onev = _mm_set1_ps(1.f); __m128 onev = _mm_set1_ps(1.f);
__m128 madLm9v = _mm_set1_ps(madL * 9.f); __m128 madLm9v = _mm_set1_ps(madL * 9.f);
__m128 mad_av = _mm_set1_ps(mad_a); __m128 mad_av = _mm_set1_ps(mad_a);
__m128 mad_bv = _mm_set1_ps(mad_b); __m128 mad_bv = _mm_set1_ps(mad_b);
__m128 epsv = _mm_set1_ps(eps); __m128 epsv = _mm_set1_ps(eps);
__m128 mag_Lv, mag_av, mag_bv; __m128 mag_Lv, mag_av, mag_bv;
for (int i=0; i<H_ab; i++) { for (int i=0; i<H_ab; i++) {
int coeffloc_ab = i*W_ab; int coeffloc_ab = i*W_ab;
for (j=0; j<W_ab-3; j+=4, coeffloc_ab+=4) { for (j=0; j<W_ab-3; j+=4, coeffloc_ab+=4) {
mag_Lv = LVFU(WavCoeffsLtemp[coeffloc_ab]); mag_Lv = LVFU(WavCoeffsLtemp[coeffloc_ab]);
mag_av = SQRV(LVFU(WavCoeffs_a[dir][coeffloc_ab]))+epsv; mag_av = SQRV(LVFU(WavCoeffs_a[dir][coeffloc_ab]))+epsv;
mag_bv = SQRV(LVFU(WavCoeffs_b[dir][coeffloc_ab]))+epsv; mag_bv = SQRV(LVFU(WavCoeffs_b[dir][coeffloc_ab]))+epsv;
mag_Lv = SQRV(mag_Lv) + epsv; mag_Lv = SQRV(mag_Lv) + epsv;
_mm_storeu_ps(&sfavea[coeffloc_ab], (onev-xexpf(-(mag_av/mad_av)-(mag_Lv/madLm9v)))); _mm_storeu_ps(&sfavea[coeffloc_ab], (onev-xexpf(-(mag_av/mad_av)-(mag_Lv/madLm9v))));
_mm_storeu_ps(&sfaveb[coeffloc_ab], (onev-xexpf(-(mag_bv/mad_bv)-(mag_Lv/madLm9v)))); _mm_storeu_ps(&sfaveb[coeffloc_ab], (onev-xexpf(-(mag_bv/mad_bv)-(mag_Lv/madLm9v))));
} }
for (; j<W_ab; j++,coeffloc_ab++) { for (; j<W_ab; j++,coeffloc_ab++) {
float mag_L = SQR(WavCoeffsLtemp[coeffloc_ab])+eps; float mag_L = SQR(WavCoeffsLtemp[coeffloc_ab])+eps;
float mag_a = SQR(WavCoeffs_a[dir][coeffloc_ab])+eps; float mag_a = SQR(WavCoeffs_a[dir][coeffloc_ab])+eps;
float mag_b = SQR(WavCoeffs_b[dir][coeffloc_ab])+eps; float mag_b = SQR(WavCoeffs_b[dir][coeffloc_ab])+eps;
sfavea[coeffloc_ab] = (1.f-xexpf(-(mag_a/mad_a)-(mag_L/(9.f*madL)))); sfavea[coeffloc_ab] = (1.f-xexpf(-(mag_a/mad_a)-(mag_L/(9.f*madL))));
sfaveb[coeffloc_ab] = (1.f-xexpf(-(mag_b/mad_b)-(mag_L/(9.f*madL)))); sfaveb[coeffloc_ab] = (1.f-xexpf(-(mag_b/mad_b)-(mag_L/(9.f*madL))));
} }
}//now chrominance coefficients are denoised }//now chrominance coefficients are denoised
#else #else
for (int i=0; i<H_ab; i++) { for (int i=0; i<H_ab; i++) {
for (int j=0; j<W_ab; j++) { for (int j=0; j<W_ab; j++) {
int coeffloc_ab = i*W_ab+j; int coeffloc_ab = i*W_ab+j;
int coeffloc_L = ((i*skip_L)/skip_ab)*W_L + ((j*skip_L)/skip_ab); int coeffloc_L = ((i*skip_L)/skip_ab)*W_L + ((j*skip_L)/skip_ab);
@@ -1283,32 +1560,32 @@ SSEFUNCTION void ImProcFunctions::ShrinkAll(float ** WavCoeffs_L, float ** WavCo
// 'firm' threshold of chroma coefficients // 'firm' threshold of chroma coefficients
//WavCoeffs_a[dir][coeffloc_ab] *= (1-exp(-(mag_a/mad_a)-(mag_L/(9*madL))));//(coeff_a>2*thresh_a ? 1 : (coeff_a<thresh_a ? 0 : (coeff_a/thresh_a - 1))); //WavCoeffs_a[dir][coeffloc_ab] *= (1-exp(-(mag_a/mad_a)-(mag_L/(9*madL))));//(coeff_a>2*thresh_a ? 1 : (coeff_a<thresh_a ? 0 : (coeff_a/thresh_a - 1)));
//WavCoeffs_b[dir][coeffloc_ab] *= (1-exp(-(mag_b/mad_b)-(mag_L/(9*madL))));//(coeff_b>2*thresh_b ? 1 : (coeff_b<thresh_b ? 0 : (coeff_b/thresh_b - 1))); //WavCoeffs_b[dir][coeffloc_ab] *= (1-exp(-(mag_b/mad_b)-(mag_L/(9*madL))));//(coeff_b>2*thresh_b ? 1 : (coeff_b<thresh_b ? 0 : (coeff_b/thresh_b - 1)));
} }
}//now chrominance coefficients are denoised }//now chrominance coefficients are denoised
#endif #endif
boxblur(sfavea, sfavea, level+2, level+2, W_ab, H_ab);//increase smoothness by locally averaging shrinkage boxblur(sfavea, sfavea, level+2, level+2, W_ab, H_ab);//increase smoothness by locally averaging shrinkage
boxblur(sfaveb, sfaveb, level+2, level+2, W_ab, H_ab);//increase smoothness by locally averaging shrinkage boxblur(sfaveb, sfaveb, level+2, level+2, W_ab, H_ab);//increase smoothness by locally averaging shrinkage
#ifdef __SSE2__ #ifdef __SSE2__
__m128 sfav, sfbv; __m128 sfav, sfbv;
__m128 sfaveav, sfavebv; __m128 sfaveav, sfavebv;
for (int i=0; i<H_ab; i++) { for (int i=0; i<H_ab; i++) {
int coeffloc_ab = i*W_ab; int coeffloc_ab = i*W_ab;
for (j=0; j<W_ab-3; j+=4,coeffloc_ab+=4) { for (j=0; j<W_ab-3; j+=4,coeffloc_ab+=4) {
mag_Lv = LVFU(WavCoeffsLtemp[coeffloc_ab]); mag_Lv = LVFU(WavCoeffsLtemp[coeffloc_ab]);
mag_av = SQRV(LVFU(WavCoeffs_a[dir][coeffloc_ab]))+epsv; mag_av = SQRV(LVFU(WavCoeffs_a[dir][coeffloc_ab]))+epsv;
mag_bv = SQRV(LVFU(WavCoeffs_b[dir][coeffloc_ab]))+epsv; mag_bv = SQRV(LVFU(WavCoeffs_b[dir][coeffloc_ab]))+epsv;
mag_Lv = SQRV(mag_Lv) + epsv; mag_Lv = SQRV(mag_Lv) + epsv;
sfav = (onev - xexpf(-(mag_av/mad_av)-(mag_Lv/madLm9v))); sfav = (onev - xexpf(-(mag_av/mad_av)-(mag_Lv/madLm9v)));
sfbv = (onev - xexpf(-(mag_bv/mad_bv)-(mag_Lv/madLm9v))); sfbv = (onev - xexpf(-(mag_bv/mad_bv)-(mag_Lv/madLm9v)));
sfaveav = LVFU(sfavea[coeffloc_ab]); sfaveav = LVFU(sfavea[coeffloc_ab]);
sfavebv = LVFU(sfaveb[coeffloc_ab]); sfavebv = LVFU(sfaveb[coeffloc_ab]);
//use smoothed shrinkage unless local shrinkage is much less //use smoothed shrinkage unless local shrinkage is much less
_mm_storeu_ps( &WavCoeffs_a[dir][coeffloc_ab], LVFU(WavCoeffs_a[dir][coeffloc_ab]) * (SQRV(sfaveav)+SQRV(sfav))/(sfaveav+sfav+epsv)); _mm_storeu_ps( &WavCoeffs_a[dir][coeffloc_ab], LVFU(WavCoeffs_a[dir][coeffloc_ab]) * (SQRV(sfaveav)+SQRV(sfav))/(sfaveav+sfav+epsv));
_mm_storeu_ps( &WavCoeffs_b[dir][coeffloc_ab], LVFU(WavCoeffs_b[dir][coeffloc_ab]) * (SQRV(sfavebv)+SQRV(sfbv))/(sfavebv+sfbv+epsv)); _mm_storeu_ps( &WavCoeffs_b[dir][coeffloc_ab], LVFU(WavCoeffs_b[dir][coeffloc_ab]) * (SQRV(sfavebv)+SQRV(sfbv))/(sfavebv+sfbv+epsv));
}//now chrominance coefficients are denoised }//now chrominance coefficients are denoised
for (; j<W_ab; j++,coeffloc_ab++) { for (; j<W_ab; j++,coeffloc_ab++) {
//modification Jacques feb 2013 //modification Jacques feb 2013
float mag_L = SQR(WavCoeffsLtemp[coeffloc_ab])+eps; float mag_L = SQR(WavCoeffsLtemp[coeffloc_ab])+eps;
@@ -1323,8 +1600,8 @@ SSEFUNCTION void ImProcFunctions::ShrinkAll(float ** WavCoeffs_L, float ** WavCo
WavCoeffs_a[dir][coeffloc_ab] *= (SQR(sfavea[coeffloc_ab])+SQR(sfa))/(sfavea[coeffloc_ab]+sfa+eps); WavCoeffs_a[dir][coeffloc_ab] *= (SQR(sfavea[coeffloc_ab])+SQR(sfa))/(sfavea[coeffloc_ab]+sfa+eps);
WavCoeffs_b[dir][coeffloc_ab] *= (SQR(sfaveb[coeffloc_ab])+SQR(sfb))/(sfaveb[coeffloc_ab]+sfb+eps); WavCoeffs_b[dir][coeffloc_ab] *= (SQR(sfaveb[coeffloc_ab])+SQR(sfb))/(sfaveb[coeffloc_ab]+sfb+eps);
}//now chrominance coefficients are denoised }//now chrominance coefficients are denoised
} }
#else #else
for (int i=0; i<H_ab; i++) { for (int i=0; i<H_ab; i++) {
for (int j=0; j<W_ab; j++) { for (int j=0; j<W_ab; j++) {
@@ -1344,8 +1621,8 @@ SSEFUNCTION void ImProcFunctions::ShrinkAll(float ** WavCoeffs_L, float ** WavCo
WavCoeffs_a[dir][coeffloc_ab] *= (SQR(sfavea[coeffloc_ab])+SQR(sfa))/(sfavea[coeffloc_ab]+sfa+eps); WavCoeffs_a[dir][coeffloc_ab] *= (SQR(sfavea[coeffloc_ab])+SQR(sfa))/(sfavea[coeffloc_ab]+sfa+eps);
WavCoeffs_b[dir][coeffloc_ab] *= (SQR(sfaveb[coeffloc_ab])+SQR(sfb))/(sfaveb[coeffloc_ab]+sfb+eps); WavCoeffs_b[dir][coeffloc_ab] *= (SQR(sfaveb[coeffloc_ab])+SQR(sfb))/(sfaveb[coeffloc_ab]+sfb+eps);
}//now chrominance coefficients are denoised }//now chrominance coefficients are denoised
} }
#endif #endif
} }
@@ -1403,10 +1680,10 @@ SSEFUNCTION void ImProcFunctions::ShrinkAll(float ** WavCoeffs_L, float ** WavCo
} }
} }
delete[] sfave; delete[] sfave;
delete[] sfavea; delete[] sfavea;
delete[] sfaveb; delete[] sfaveb;
delete[] WavCoeffsLtemp; delete[] WavCoeffsLtemp;
} }

View File

@@ -278,8 +278,9 @@ enum ProcEvent {
EvDirPyrEqlgamutlab=252, EvDirPyrEqlgamutlab=252,
EvDirPyrEqualizerHueskin=253, EvDirPyrEqualizerHueskin=253,
// EvDirPyrEqualizeralg=254, // EvDirPyrEqualizeralg=254,
EvDPDNmedian=254,
NUMOFEVENTS=254 EvDPDNmedmet=255,
NUMOFEVENTS=256
}; };
} }
#endif #endif

View File

@@ -301,13 +301,15 @@ void ProcParams::setDefaults () {
dirpyrDenoise.enabled = false; dirpyrDenoise.enabled = false;
dirpyrDenoise.enhance = false; dirpyrDenoise.enhance = false;
// dirpyrDenoise.perform = false; // dirpyrDenoise.perform = false;
dirpyrDenoise.luma = 0; dirpyrDenoise.median = false;
dirpyrDenoise.luma = 0;
dirpyrDenoise.Ldetail = 50; dirpyrDenoise.Ldetail = 50;
dirpyrDenoise.chroma = 15; dirpyrDenoise.chroma = 15;
dirpyrDenoise.redchro = 0; dirpyrDenoise.redchro = 0;
dirpyrDenoise.bluechro = 0; dirpyrDenoise.bluechro = 0;
dirpyrDenoise.gamma = 1.7; dirpyrDenoise.gamma = 1.7;
dirpyrDenoise.dmethod = "RGB"; dirpyrDenoise.dmethod = "RGB";
dirpyrDenoise.medmethod = "soft";
epd.enabled = false; epd.enabled = false;
epd.strength = 0.25; epd.strength = 0.25;
@@ -888,11 +890,13 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol
// save dirpyrDenoise // save dirpyrDenoise
if (!pedited || pedited->dirpyrDenoise.enabled) keyFile.set_boolean ("Directional Pyramid Denoising", "Enabled", dirpyrDenoise.enabled); if (!pedited || pedited->dirpyrDenoise.enabled) keyFile.set_boolean ("Directional Pyramid Denoising", "Enabled", dirpyrDenoise.enabled);
if (!pedited || pedited->dirpyrDenoise.enhance) keyFile.set_boolean ("Directional Pyramid Denoising", "Enhance", dirpyrDenoise.enhance); if (!pedited || pedited->dirpyrDenoise.enhance) keyFile.set_boolean ("Directional Pyramid Denoising", "Enhance", dirpyrDenoise.enhance);
if (!pedited || pedited->dirpyrDenoise.median) keyFile.set_boolean ("Directional Pyramid Denoising", "Median", dirpyrDenoise.median);
// if (!pedited || pedited->dirpyrDenoise.perform) keyFile.set_boolean ("Directional Pyramid Denoising", "Perform", dirpyrDenoise.perform); // if (!pedited || pedited->dirpyrDenoise.perform) keyFile.set_boolean ("Directional Pyramid Denoising", "Perform", dirpyrDenoise.perform);
if (!pedited || pedited->dirpyrDenoise.luma) keyFile.set_double ("Directional Pyramid Denoising", "Luma", dirpyrDenoise.luma); if (!pedited || pedited->dirpyrDenoise.luma) keyFile.set_double ("Directional Pyramid Denoising", "Luma", dirpyrDenoise.luma);
if (!pedited || pedited->dirpyrDenoise.Ldetail) keyFile.set_double ("Directional Pyramid Denoising", "Ldetail", dirpyrDenoise.Ldetail); if (!pedited || pedited->dirpyrDenoise.Ldetail) keyFile.set_double ("Directional Pyramid Denoising", "Ldetail", dirpyrDenoise.Ldetail);
if (!pedited || pedited->dirpyrDenoise.chroma) keyFile.set_double ("Directional Pyramid Denoising", "Chroma", dirpyrDenoise.chroma); if (!pedited || pedited->dirpyrDenoise.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.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.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.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.gamma) keyFile.set_double ("Directional Pyramid Denoising", "Gamma", dirpyrDenoise.gamma);
@@ -1482,11 +1486,13 @@ if (keyFile.has_group ("Impulse Denoising")) {
if (keyFile.has_group ("Directional Pyramid Denoising")) {//TODO: No longer an accurate description for FT denoise if (keyFile.has_group ("Directional Pyramid Denoising")) {//TODO: No longer an accurate description for FT denoise
if (keyFile.has_key ("Directional Pyramid Denoising", "Enabled")) { dirpyrDenoise.enabled = keyFile.get_boolean ("Directional Pyramid Denoising", "Enabled"); if (pedited) pedited->dirpyrDenoise.enabled = true; } if (keyFile.has_key ("Directional Pyramid Denoising", "Enabled")) { dirpyrDenoise.enabled = keyFile.get_boolean ("Directional Pyramid Denoising", "Enabled"); if (pedited) pedited->dirpyrDenoise.enabled = true; }
if (keyFile.has_key ("Directional Pyramid Denoising", "Enhance")) { dirpyrDenoise.enhance = keyFile.get_boolean ("Directional Pyramid Denoising", "Enhance"); if (pedited) pedited->dirpyrDenoise.enhance = true; } if (keyFile.has_key ("Directional Pyramid Denoising", "Enhance")) { dirpyrDenoise.enhance = keyFile.get_boolean ("Directional Pyramid Denoising", "Enhance"); if (pedited) pedited->dirpyrDenoise.enhance = true; }
if (keyFile.has_key ("Directional Pyramid Denoising", "Median")) { dirpyrDenoise.median = keyFile.get_boolean ("Directional Pyramid Denoising", "Median"); if (pedited) pedited->dirpyrDenoise.median = true; }
// if (keyFile.has_key ("Directional Pyramid Denoising", "Perform")) { dirpyrDenoise.perform = keyFile.get_boolean ("Directional Pyramid Denoising", "Perform"); if (pedited) pedited->dirpyrDenoise.perform = true; } // if (keyFile.has_key ("Directional Pyramid Denoising", "Perform")) { dirpyrDenoise.perform = keyFile.get_boolean ("Directional Pyramid Denoising", "Perform"); if (pedited) pedited->dirpyrDenoise.perform = true; }
if (keyFile.has_key ("Directional Pyramid Denoising", "Luma")) { dirpyrDenoise.luma = keyFile.get_double ("Directional Pyramid Denoising", "Luma"); if (pedited) pedited->dirpyrDenoise.luma = true; } if (keyFile.has_key ("Directional Pyramid Denoising", "Luma")) { dirpyrDenoise.luma = keyFile.get_double ("Directional Pyramid Denoising", "Luma"); if (pedited) pedited->dirpyrDenoise.luma = true; }
if (keyFile.has_key ("Directional Pyramid Denoising", "Ldetail")) { dirpyrDenoise.Ldetail = keyFile.get_double ("Directional Pyramid Denoising", "Ldetail"); if (pedited) pedited->dirpyrDenoise.Ldetail = true; } if (keyFile.has_key ("Directional Pyramid Denoising", "Ldetail")) { dirpyrDenoise.Ldetail = keyFile.get_double ("Directional Pyramid Denoising", "Ldetail"); if (pedited) pedited->dirpyrDenoise.Ldetail = true; }
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", "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", "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", "Redchro")) { dirpyrDenoise.redchro = keyFile.get_double ("Directional Pyramid Denoising", "Redchro"); if (pedited) pedited->dirpyrDenoise.redchro = 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", "Bluechro")) { dirpyrDenoise.bluechro = keyFile.get_double ("Directional Pyramid Denoising", "Bluechro"); if (pedited) pedited->dirpyrDenoise.bluechro = true; }
@@ -1910,11 +1916,13 @@ bool ProcParams::operator== (const ProcParams& other) {
&& impulseDenoise.thresh == other.impulseDenoise.thresh && impulseDenoise.thresh == other.impulseDenoise.thresh
&& dirpyrDenoise.enabled == other.dirpyrDenoise.enabled && dirpyrDenoise.enabled == other.dirpyrDenoise.enabled
&& dirpyrDenoise.enhance == other.dirpyrDenoise.enhance && dirpyrDenoise.enhance == other.dirpyrDenoise.enhance
&& dirpyrDenoise.median == other.dirpyrDenoise.median
// && dirpyrDenoise.perform == other.dirpyrDenoise.perform // && dirpyrDenoise.perform == other.dirpyrDenoise.perform
&& dirpyrDenoise.luma == other.dirpyrDenoise.luma && dirpyrDenoise.luma == other.dirpyrDenoise.luma
&& dirpyrDenoise.Ldetail == other.dirpyrDenoise.Ldetail && dirpyrDenoise.Ldetail == other.dirpyrDenoise.Ldetail
&& dirpyrDenoise.chroma == other.dirpyrDenoise.chroma && dirpyrDenoise.chroma == other.dirpyrDenoise.chroma
&& dirpyrDenoise.dmethod == other.dirpyrDenoise.dmethod && dirpyrDenoise.dmethod == other.dirpyrDenoise.dmethod
&& dirpyrDenoise.medmethod == other.dirpyrDenoise.medmethod
&& dirpyrDenoise.redchro == other.dirpyrDenoise.redchro && dirpyrDenoise.redchro == other.dirpyrDenoise.redchro
&& dirpyrDenoise.bluechro == other.dirpyrDenoise.bluechro && dirpyrDenoise.bluechro == other.dirpyrDenoise.bluechro
&& dirpyrDenoise.gamma == other.dirpyrDenoise.gamma && dirpyrDenoise.gamma == other.dirpyrDenoise.gamma

View File

@@ -473,6 +473,7 @@ class DirPyrDenoiseParams {
public: public:
bool enabled; bool enabled;
bool enhance; bool enhance;
bool median;
bool perform; bool perform;
double luma; double luma;
@@ -482,6 +483,7 @@ class DirPyrDenoiseParams {
double bluechro; double bluechro;
double gamma; double gamma;
Glib::ustring dmethod; Glib::ustring dmethod;
Glib::ustring medmethod;
}; };
//EPD related parameters. //EPD related parameters.

View File

@@ -273,7 +273,9 @@ ALLNORAW, // EvDPDNenhance
RGBCURVE, // EvBWMethodalg RGBCURVE, // EvBWMethodalg
DIRPYREQUALIZER, // EvDirPyrEqualizerSkin DIRPYREQUALIZER, // EvDirPyrEqualizerSkin
DIRPYREQUALIZER, // EvDirPyrEqlgamutlab DIRPYREQUALIZER, // EvDirPyrEqlgamutlab
DIRPYREQUALIZER // EvDirPyrEqualizerHueskin DIRPYREQUALIZER, // EvDirPyrEqualizerHueskin
ALLNORAW, // EvDPDNmedian
ALLNORAW //EvDPDNmedmet
//DIRPYREQUALIZER // EvDirPyrEqualizeralg //DIRPYREQUALIZER // EvDirPyrEqualizeralg
//LUMINANCECURVE // EvCATsharpcie //LUMINANCECURVE // EvCATsharpcie

View File

@@ -87,6 +87,22 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this), lastenhance(false) {
enhance->set_active (false); enhance->set_active (false);
enhance->set_tooltip_text (M("TP_DIRPYRDENOISE_ENH_TOOLTIP")); 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_tooltip_text (M("TP_DIRPYRDENOISE_MED_TOOLTIP"));
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->set_active (0);
medmethod->set_tooltip_text (M("TP_DIRPYRDENOISE_MET_TOOLTIP"));
medmethodconn = medmethod->signal_changed().connect ( sigc::mem_fun(*this, &DirPyrDenoise::medmethodChanged) );
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);
pack_start (*luma); pack_start (*luma);
pack_start (*Ldetail); pack_start (*Ldetail);
@@ -96,9 +112,13 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this), lastenhance(false) {
pack_start (*gamma); pack_start (*gamma);
pack_start (*enhance); pack_start (*enhance);
pack_start (*median);
ctbox->pack_start (*medmethod);
pack_start (*ctbox);
// pack_start (*perform); // pack_start (*perform);
enhanConn = enhance->signal_toggled().connect( sigc::mem_fun(*this, &DirPyrDenoise::enhanceChanged) ); enhanConn = enhance->signal_toggled().connect( sigc::mem_fun(*this, &DirPyrDenoise::enhanceChanged) );
medianConn = median->signal_toggled().connect( sigc::mem_fun(*this, &DirPyrDenoise::medianChanged) );
} }
@@ -107,16 +127,32 @@ void DirPyrDenoise::read (const ProcParams* pp, const ParamsEdited* pedited) {
disableListener (); disableListener ();
dmethodconn.block(true); dmethodconn.block(true);
enaConn.block (true); enaConn.block (true);
medmethodconn.block(true);
dmethod->set_active (0); dmethod->set_active (0);
if (pp->dirpyrDenoise.dmethod=="RGB") if (pp->dirpyrDenoise.dmethod=="RGB")
dmethod->set_active (0); dmethod->set_active (0);
else if (pp->dirpyrDenoise.dmethod=="Lab") else if (pp->dirpyrDenoise.dmethod=="Lab")
dmethod->set_active (1); dmethod->set_active (1);
medmethod->set_active (0);
if (pp->dirpyrDenoise.medmethod=="soft")
medmethod->set_active (0);
else if (pp->dirpyrDenoise.medmethod=="33")
medmethod->set_active (1);
else if (pp->dirpyrDenoise.medmethod=="55soft")
medmethod->set_active (2);
else if (pp->dirpyrDenoise.medmethod=="55")
medmethod->set_active (3);
if (pedited) { if (pedited) {
if (!pedited->dirpyrDenoise.dmethod) if (!pedited->dirpyrDenoise.dmethod)
dmethod->set_active (2); dmethod->set_active (2);
if (!pedited->dirpyrDenoise.medmethod)
medmethod->set_active (4);
luma->setEditedState (pedited->dirpyrDenoise.luma ? Edited : UnEdited); luma->setEditedState (pedited->dirpyrDenoise.luma ? Edited : UnEdited);
Ldetail->setEditedState (pedited->dirpyrDenoise.Ldetail ? Edited : UnEdited); Ldetail->setEditedState (pedited->dirpyrDenoise.Ldetail ? Edited : UnEdited);
chroma->setEditedState (pedited->dirpyrDenoise.chroma ? Edited : UnEdited); chroma->setEditedState (pedited->dirpyrDenoise.chroma ? Edited : UnEdited);
@@ -126,15 +162,18 @@ void DirPyrDenoise::read (const ProcParams* pp, const ParamsEdited* pedited) {
gamma->setEditedState (pedited->dirpyrDenoise.gamma ? Edited : UnEdited); gamma->setEditedState (pedited->dirpyrDenoise.gamma ? Edited : UnEdited);
enabled->set_inconsistent (!pedited->dirpyrDenoise.enabled); enabled->set_inconsistent (!pedited->dirpyrDenoise.enabled);
enhance->set_inconsistent (!pedited->dirpyrDenoise.enhance); enhance->set_inconsistent (!pedited->dirpyrDenoise.enhance);
median->set_inconsistent (!pedited->dirpyrDenoise.median);
// perform->set_inconsistent (!pedited->dirpyrDenoise.perform); // perform->set_inconsistent (!pedited->dirpyrDenoise.perform);
} }
// perfconn.block (true); // perfconn.block (true);
enabled->set_active (pp->dirpyrDenoise.enabled); enabled->set_active (pp->dirpyrDenoise.enabled);
enhance->set_active (pp->dirpyrDenoise.enhance); enhance->set_active (pp->dirpyrDenoise.enhance);
// perform->set_active (pp->dirpyrDenoise.perform); // perform->set_active (pp->dirpyrDenoise.perform);
median->set_active (pp->dirpyrDenoise.median);
// perfconn.block (false); // perfconn.block (false);
lastEnabled = pp->dirpyrDenoise.enabled; lastEnabled = pp->dirpyrDenoise.enabled;
lastmedian = pp->dirpyrDenoise.median;
lastenhance = pp->dirpyrDenoise.enhance; lastenhance = pp->dirpyrDenoise.enhance;
// lastperform = pp->dirpyrDenoise.perform; // lastperform = pp->dirpyrDenoise.perform;
luma->setValue (pp->dirpyrDenoise.luma); luma->setValue (pp->dirpyrDenoise.luma);
@@ -147,6 +186,7 @@ void DirPyrDenoise::read (const ProcParams* pp, const ParamsEdited* pedited) {
enaConn.block (false); enaConn.block (false);
dmethodconn.block(false); dmethodconn.block(false);
medmethodconn.block(false);
enableListener (); enableListener ();
} }
@@ -161,9 +201,11 @@ void DirPyrDenoise::write (ProcParams* pp, ParamsEdited* pedited) {
pp->dirpyrDenoise.enabled = enabled->get_active(); pp->dirpyrDenoise.enabled = enabled->get_active();
pp->dirpyrDenoise.enhance = enhance->get_active(); pp->dirpyrDenoise.enhance = enhance->get_active();
// pp->dirpyrDenoise.perform = perform->get_active(); // pp->dirpyrDenoise.perform = perform->get_active();
pp->dirpyrDenoise.median = median->get_active();
if (pedited) { if (pedited) {
pedited->dirpyrDenoise.dmethod = dmethod->get_active_row_number() != 2; pedited->dirpyrDenoise.dmethod = dmethod->get_active_row_number() != 2;
pedited->dirpyrDenoise.medmethod = medmethod->get_active_row_number() != 3;
pedited->dirpyrDenoise.luma = luma->getEditedState (); pedited->dirpyrDenoise.luma = luma->getEditedState ();
pedited->dirpyrDenoise.Ldetail = Ldetail->getEditedState (); pedited->dirpyrDenoise.Ldetail = Ldetail->getEditedState ();
pedited->dirpyrDenoise.chroma = chroma->getEditedState (); pedited->dirpyrDenoise.chroma = chroma->getEditedState ();
@@ -172,12 +214,23 @@ void DirPyrDenoise::write (ProcParams* pp, ParamsEdited* pedited) {
pedited->dirpyrDenoise.gamma = gamma->getEditedState (); pedited->dirpyrDenoise.gamma = gamma->getEditedState ();
pedited->dirpyrDenoise.enabled = !enabled->get_inconsistent(); pedited->dirpyrDenoise.enabled = !enabled->get_inconsistent();
pedited->dirpyrDenoise.enhance = !enhance->get_inconsistent(); pedited->dirpyrDenoise.enhance = !enhance->get_inconsistent();
pedited->dirpyrDenoise.median = !median->get_inconsistent();
// pedited->dirpyrDenoise.perform = !perform->get_inconsistent(); // pedited->dirpyrDenoise.perform = !perform->get_inconsistent();
} }
if (dmethod->get_active_row_number()==0) if (dmethod->get_active_row_number()==0)
pp->dirpyrDenoise.dmethod = "RGB"; pp->dirpyrDenoise.dmethod = "RGB";
else if (dmethod->get_active_row_number()==1) else if (dmethod->get_active_row_number()==1)
pp->dirpyrDenoise.dmethod = "Lab"; pp->dirpyrDenoise.dmethod = "Lab";
if (medmethod->get_active_row_number()==0)
pp->dirpyrDenoise.medmethod = "soft";
else if (medmethod->get_active_row_number()==1)
pp->dirpyrDenoise.medmethod = "33";
else if (medmethod->get_active_row_number()==2)
pp->dirpyrDenoise.medmethod = "55soft";
else if (medmethod->get_active_row_number()==3)
pp->dirpyrDenoise.medmethod = "55";
} }
void DirPyrDenoise::dmethodChanged () { void DirPyrDenoise::dmethodChanged () {
@@ -187,6 +240,12 @@ void DirPyrDenoise::dmethodChanged () {
} }
} }
void DirPyrDenoise::medmethodChanged () {
if (listener && (multiImage||enabled->get_active()) ) {
listener->panelChanged (EvDPDNmedmet, medmethod->get_active_text ());
}
}
void DirPyrDenoise::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) { void DirPyrDenoise::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) {
@@ -283,6 +342,29 @@ void DirPyrDenoise::enhanceChanged () {
} }
} }
void DirPyrDenoise::medianChanged () {
if (batchMode) {
if (median->get_inconsistent()) {
median->set_inconsistent (false);
medianConn.block (true);
median->set_active (false);
medianConn.block (false);
}
else if (lastmedian)
median->set_inconsistent (true);
lastmedian = median->get_active ();
}
if (listener) {
if (median->get_active ())
listener->panelChanged (EvDPDNmedian, M("GENERAL_ENABLED"));
else
listener->panelChanged (EvDPDNmedian, M("GENERAL_DISABLED"));
}
}
/* /*
void DirPyrDenoise::perform_toggled () { void DirPyrDenoise::perform_toggled () {
@@ -318,6 +400,8 @@ void DirPyrDenoise::setBatchMode (bool batchMode) {
bluechro->showEditedCB (); bluechro->showEditedCB ();
gamma->showEditedCB (); gamma->showEditedCB ();
dmethod->append_text (M("GENERAL_UNCHANGED")); dmethod->append_text (M("GENERAL_UNCHANGED"));
medmethod->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) {

View File

@@ -38,13 +38,18 @@ class DirPyrDenoise : public ToolParamBlock, public AdjusterListener, public Fol
sigc::connection enaConn; sigc::connection enaConn;
Gtk::CheckButton* enhance; Gtk::CheckButton* enhance;
bool lastenhance; bool lastenhance;
sigc::connection enhanConn; sigc::connection enhanConn, medianConn;
Gtk::CheckButton* median;
bool lastmedian;
// Gtk::CheckButton* perform; // Gtk::CheckButton* perform;
// bool lastperform; // bool lastperform;
// sigc::connection perfconn; // sigc::connection perfconn;
MyComboBoxText* dmethod; MyComboBoxText* dmethod;
sigc::connection dmethodconn; sigc::connection dmethodconn;
MyComboBoxText* medmethod;
sigc::connection medmethodconn;
Gtk::HBox* ctbox;
public: public:
@@ -59,8 +64,10 @@ class DirPyrDenoise : public ToolParamBlock, public AdjusterListener, public Fol
void adjusterChanged (Adjuster* a, double newval); void adjusterChanged (Adjuster* a, double newval);
void enabledChanged (); void enabledChanged ();
void enhanceChanged (); void enhanceChanged ();
void medianChanged ();
// void perform_toggled (); // void perform_toggled ();
void dmethodChanged (); void dmethodChanged ();
void medmethodChanged ();
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);
void trimValues (rtengine::procparams::ProcParams* pp); void trimValues (rtengine::procparams::ProcParams* pp);

View File

@@ -154,6 +154,7 @@ void ParamsEdited::set (bool v) {
dirpyrDenoise.enabled = v; dirpyrDenoise.enabled = v;
dirpyrDenoise.enhance = v; dirpyrDenoise.enhance = v;
// dirpyrDenoise.perform = v; // dirpyrDenoise.perform = v;
dirpyrDenoise.median = v;
dirpyrDenoise.luma = v; dirpyrDenoise.luma = v;
dirpyrDenoise.Ldetail = v; dirpyrDenoise.Ldetail = v;
dirpyrDenoise.chroma = v; dirpyrDenoise.chroma = v;
@@ -161,6 +162,7 @@ void ParamsEdited::set (bool v) {
dirpyrDenoise.bluechro = v; dirpyrDenoise.bluechro = v;
dirpyrDenoise.gamma = v; dirpyrDenoise.gamma = v;
dirpyrDenoise.dmethod = v; dirpyrDenoise.dmethod = v;
dirpyrDenoise.medmethod = v;
epd.enabled = v; epd.enabled = v;
epd.strength = v; epd.strength = v;
epd.edgeStopping = v; epd.edgeStopping = v;
@@ -441,6 +443,7 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
dirpyrDenoise.enabled = dirpyrDenoise.enabled && p.dirpyrDenoise.enabled == other.dirpyrDenoise.enabled; dirpyrDenoise.enabled = dirpyrDenoise.enabled && p.dirpyrDenoise.enabled == other.dirpyrDenoise.enabled;
dirpyrDenoise.enhance = dirpyrDenoise.enhance && p.dirpyrDenoise.enhance == other.dirpyrDenoise.enhance; dirpyrDenoise.enhance = dirpyrDenoise.enhance && p.dirpyrDenoise.enhance == other.dirpyrDenoise.enhance;
dirpyrDenoise.median = dirpyrDenoise.median && p.dirpyrDenoise.median == other.dirpyrDenoise.median;
// dirpyrDenoise.perform = dirpyrDenoise.perform && p.dirpyrDenoise.perform == other.dirpyrDenoise.perform; // dirpyrDenoise.perform = dirpyrDenoise.perform && p.dirpyrDenoise.perform == other.dirpyrDenoise.perform;
dirpyrDenoise.luma = dirpyrDenoise.luma && p.dirpyrDenoise.luma == other.dirpyrDenoise.luma; dirpyrDenoise.luma = dirpyrDenoise.luma && p.dirpyrDenoise.luma == other.dirpyrDenoise.luma;
dirpyrDenoise.Ldetail = dirpyrDenoise.Ldetail && p.dirpyrDenoise.Ldetail == other.dirpyrDenoise.Ldetail; dirpyrDenoise.Ldetail = dirpyrDenoise.Ldetail && p.dirpyrDenoise.Ldetail == other.dirpyrDenoise.Ldetail;
@@ -449,6 +452,7 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
dirpyrDenoise.bluechro = dirpyrDenoise.bluechro && p.dirpyrDenoise.bluechro == other.dirpyrDenoise.bluechro; dirpyrDenoise.bluechro = dirpyrDenoise.bluechro && p.dirpyrDenoise.bluechro == other.dirpyrDenoise.bluechro;
dirpyrDenoise.gamma = dirpyrDenoise.gamma && p.dirpyrDenoise.gamma == other.dirpyrDenoise.gamma; dirpyrDenoise.gamma = dirpyrDenoise.gamma && p.dirpyrDenoise.gamma == other.dirpyrDenoise.gamma;
dirpyrDenoise.dmethod = dirpyrDenoise.dmethod && p.dirpyrDenoise.dmethod == other.dirpyrDenoise.dmethod; dirpyrDenoise.dmethod = dirpyrDenoise.dmethod && p.dirpyrDenoise.dmethod == other.dirpyrDenoise.dmethod;
dirpyrDenoise.medmethod = dirpyrDenoise.medmethod && p.dirpyrDenoise.medmethod == other.dirpyrDenoise.medmethod;
epd.enabled = epd.enabled && p.epd.enabled == other.epd.enabled; epd.enabled = epd.enabled && p.epd.enabled == other.epd.enabled;
epd.strength = epd.strength && p.epd.strength == other.epd.strength; epd.strength = epd.strength && p.epd.strength == other.epd.strength;
@@ -728,6 +732,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
if (dirpyrDenoise.enabled) toEdit.dirpyrDenoise.enabled = mods.dirpyrDenoise.enabled; if (dirpyrDenoise.enabled) toEdit.dirpyrDenoise.enabled = mods.dirpyrDenoise.enabled;
if (dirpyrDenoise.enhance) toEdit.dirpyrDenoise.enhance = mods.dirpyrDenoise.enhance; if (dirpyrDenoise.enhance) toEdit.dirpyrDenoise.enhance = mods.dirpyrDenoise.enhance;
if (dirpyrDenoise.median) toEdit.dirpyrDenoise.median = mods.dirpyrDenoise.median;
if (dirpyrDenoise.luma) toEdit.dirpyrDenoise.luma = dontforceSet && options.baBehav[ADDSET_DIRPYRDN_LUMA] ? toEdit.dirpyrDenoise.luma + mods.dirpyrDenoise.luma : mods.dirpyrDenoise.luma; if (dirpyrDenoise.luma) toEdit.dirpyrDenoise.luma = dontforceSet && options.baBehav[ADDSET_DIRPYRDN_LUMA] ? toEdit.dirpyrDenoise.luma + mods.dirpyrDenoise.luma : mods.dirpyrDenoise.luma;
if (dirpyrDenoise.Ldetail) toEdit.dirpyrDenoise.Ldetail = dontforceSet && options.baBehav[ADDSET_DIRPYRDN_LUMDET] ? toEdit.dirpyrDenoise.Ldetail + mods.dirpyrDenoise.Ldetail : mods.dirpyrDenoise.Ldetail; if (dirpyrDenoise.Ldetail) toEdit.dirpyrDenoise.Ldetail = dontforceSet && options.baBehav[ADDSET_DIRPYRDN_LUMDET] ? toEdit.dirpyrDenoise.Ldetail + mods.dirpyrDenoise.Ldetail : mods.dirpyrDenoise.Ldetail;
if (dirpyrDenoise.chroma) toEdit.dirpyrDenoise.chroma = dontforceSet && options.baBehav[ADDSET_DIRPYRDN_CHROMA] ? toEdit.dirpyrDenoise.chroma + mods.dirpyrDenoise.chroma : mods.dirpyrDenoise.chroma; if (dirpyrDenoise.chroma) toEdit.dirpyrDenoise.chroma = dontforceSet && options.baBehav[ADDSET_DIRPYRDN_CHROMA] ? toEdit.dirpyrDenoise.chroma + mods.dirpyrDenoise.chroma : mods.dirpyrDenoise.chroma;
@@ -736,6 +741,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
if (dirpyrDenoise.gamma) toEdit.dirpyrDenoise.gamma = dontforceSet && options.baBehav[ADDSET_DIRPYRDN_GAMMA] ? toEdit.dirpyrDenoise.gamma + mods.dirpyrDenoise.gamma : mods.dirpyrDenoise.gamma; if (dirpyrDenoise.gamma) toEdit.dirpyrDenoise.gamma = dontforceSet && options.baBehav[ADDSET_DIRPYRDN_GAMMA] ? toEdit.dirpyrDenoise.gamma + mods.dirpyrDenoise.gamma : mods.dirpyrDenoise.gamma;
// if (dirpyrDenoise.perform) toEdit.dirpyrDenoise.perform = mods.dirpyrDenoise.perform; // if (dirpyrDenoise.perform) toEdit.dirpyrDenoise.perform = mods.dirpyrDenoise.perform;
if (dirpyrDenoise.dmethod) toEdit.dirpyrDenoise.dmethod = mods.dirpyrDenoise.dmethod; if (dirpyrDenoise.dmethod) toEdit.dirpyrDenoise.dmethod = mods.dirpyrDenoise.dmethod;
if (dirpyrDenoise.medmethod) toEdit.dirpyrDenoise.medmethod = mods.dirpyrDenoise.medmethod;
if (epd.enabled) toEdit.epd.enabled = mods.epd.enabled; if (epd.enabled) toEdit.epd.enabled = mods.epd.enabled;
if (epd.strength) toEdit.epd.strength = mods.epd.strength; if (epd.strength) toEdit.epd.strength = mods.epd.strength;

View File

@@ -234,6 +234,7 @@ class DirPyrDenoiseParamsEdited {
public: public:
bool enabled; bool enabled;
bool enhance; bool enhance;
bool median;
bool Ldetail; bool Ldetail;
bool luma; bool luma;
bool chroma; bool chroma;
@@ -242,6 +243,8 @@ public:
bool gamma; bool gamma;
// bool perform; // bool perform;
bool dmethod; bool dmethod;
bool medmethod;
}; };
class EPDParamsEdited{ class EPDParamsEdited{