diff --git a/rtdata/languages/default b/rtdata/languages/default index 5e4c82da9..20848b742 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -907,6 +907,8 @@ HISTORY_MSG_653;Local - SH mask chroma HISTORY_MSG_654;Local - SH mask gamma HISTORY_MSG_655;Local - SH mask slope HISTORY_MSG_656;Local - Color soft radius +HISTORY_MSG_657;Local - Retinex soft radius +HISTORY_MSG_658;Local - CBDL soft radius HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 13e8c01da..10c09fb0f 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -250,6 +250,7 @@ public: bool showSharpMask = false); void chromiLuminanceCurve(PipetteBuffer *pipetteBuffer, int pW, LabImage* lold, LabImage* lnew, LUTf &acurve, LUTf &bcurve, LUTf & satcurve, LUTf & satclcurve, LUTf &clcurve, LUTf &curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, bool clcutili, LUTu &histCCurve, LUTu &histLurve); void vibrance(LabImage* lab); //Jacques' vibrance + void softprocess(LabImage* bufcolorig, float ** buflight, /* float ** bufchro, float ** buf_a, float ** buf_b, */ float rad, int bfh, int bfw, int sk, bool multiThread); // void colorCurve (LabImage* lold, LabImage* lnew); void sharpening(LabImage* lab, const procparams::SharpeningParams &sharpenParam, bool showMask = false); void sharpeningcam(CieImage* ncie, float** buffer, bool showMask = false); diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 74272b312..1867aecd9 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -155,6 +155,8 @@ struct local_params { float slomaexp; float softradiusexp; float softradiuscol; + float softradiuscb; + float softradiusret; float blendmaexp; float radmaSH; float blendmaSH; @@ -499,6 +501,8 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall float slomaskexpo = ((float) locallab.spots.at(sp).slomaskexp); float softradiusexpo = ((float) locallab.spots.at(sp).softradiusexp); float softradiuscolor = ((float) locallab.spots.at(sp).softradiuscol); + float softradiusreti = ((float) locallab.spots.at(sp).softradiusret); + float softradiuscbdl = ((float) locallab.spots.at(sp).softradiuscb); float blendmaskSH = ((float) locallab.spots.at(sp).blendmaskSH) / 100.f ; float radmaskSH = ((float) locallab.spots.at(sp).radmaskSH); float chromaskSH = ((float) locallab.spots.at(sp).chromaskSH); @@ -563,6 +567,8 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.slomaexp = slomaskexpo; lp.softradiusexp = softradiusexpo; lp.softradiuscol = softradiuscolor; + lp.softradiusret = softradiusreti; + lp.softradiuscb = softradiuscbdl; lp.struexc = structexclude; lp.blendmaexp = blendmaskexpo; lp.blendmaSH = blendmaskSH; @@ -1061,6 +1067,55 @@ void ImProcFunctions::ciecamloc_02float(int sp, LabImage* lab, LabImage* dest) #endif } +void ImProcFunctions::softprocess(LabImage* bufcolorig, float ** buflight, /* float ** bufchro, float ** buf_a, float ** buf_b,*/ float rad, int bfh, int bfw, int sk, bool multiThread) +{ + float maxlig = -50000.f; + float minlig = 50000.f; + + for (int ir = 0; ir < bfh; ir++) + for (int jr = 0; jr < bfw; jr++) { + if (buflight[ir][jr] > maxlig) { + maxlig = buflight[ir][jr]; + } + + if (buflight[ir][jr] < minlig) { + minlig = buflight[ir][jr]; + } + } + + + array2D blesoft(bfw, bfh); + array2D guidsoft(bfw, bfh); + +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) +#endif + + for (int ir = 0; ir < bfh; ir++) + for (int jr = 0; jr < bfw; jr++) { + blesoft[ir][jr] = LIM01((buflight[ir][jr] - minlig) / (100.f - minlig)); + guidsoft[ir][jr] = ((bufcolorig->L[ir][jr]) / 32768.f); + + } + + guidedFilter(guidsoft, blesoft, blesoft, rad * 10.f / sk, 0.04, multiThread, 4); //lp.softradiuscol + +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) +#endif + + for (int ir = 0; ir < bfh; ir++) + for (int jr = 0; jr < bfw; jr++) { + buflight[ir][jr] = ((100.f - minlig) * blesoft[ir][jr]) + minlig; + } + + guidsoft(0, 0); + blesoft(0, 0); + +} + + + void ImProcFunctions::vibrancelocal(int sp, int bfw, int bfh, LabImage* lab, LabImage* dest, bool & localskutili, LUTf & sklocalcurve) { @@ -5112,9 +5167,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o bufreserv->L[loy - begy][lox - begx] = reserved->L[y][x]; bufreserv->a[loy - begy][lox - begx] = reserved->a[y][x]; bufreserv->b[loy - begy][lox - begx] = reserved->b[y][x]; - bufexclu->L[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas - bufexclu->a[loy - begy][lox - begx] = original->a[y][x];//fill square buffer with datas - bufexclu->b[loy - begy][lox - begx] = original->b[y][x];//fill square buffer with datas + bufexclu->L[loy - begy][lox - begx] = original->L[y][x]; + bufexclu->a[loy - begy][lox - begx] = original->a[y][x]; + bufexclu->b[loy - begy][lox - begx] = original->b[y][x]; } } @@ -5129,7 +5184,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o int loy = cy + y; if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - bufsob->L[loy - begy][lox - begx] = reserved->L[y][x];//fill square buffer with datas + bufsob->L[loy - begy][lox - begx] = reserved->L[y][x]; } } @@ -5288,9 +5343,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o int loy = cy + y; if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - bufgb->L[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas - bufgb->a[loy - begy][lox - begx] = original->a[y][x];//fill square buffer with datas - bufgb->b[loy - begy][lox - begx] = original->b[y][x];//fill square buffer with datas + bufgb->L[loy - begy][lox - begx] = original->L[y][x]; + bufgb->a[loy - begy][lox - begx] = original->a[y][x]; + bufgb->b[loy - begy][lox - begx] = original->b[y][x]; } } @@ -5435,9 +5490,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o int loy = cy + y; if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - bufwv->L[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas - bufwv->a[loy - begy][lox - begx] = original->a[y][x];//fill square buffer with datas - bufwv->b[loy - begy][lox - begx] = original->b[y][x];//fill square buffer with datas + bufwv->L[loy - begy][lox - begx] = original->L[y][x]; + bufwv->a[loy - begy][lox - begx] = original->a[y][x]; + bufwv->b[loy - begy][lox - begx] = original->b[y][x]; } } @@ -6031,9 +6086,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o int loy = cy + y; if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - bufwv.L[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas - bufwv.a[loy - begy][lox - begx] = original->a[y][x];//fill square buffer with datas - bufwv.b[loy - begy][lox - begx] = original->b[y][x];//fill square buffer with datas + bufwv.L[loy - begy][lox - begx] = original->L[y][x]; + bufwv.a[loy - begy][lox - begx] = original->a[y][x]; + bufwv.b[loy - begy][lox - begx] = original->b[y][x]; } } @@ -6557,9 +6612,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - bufexporig->L[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas - bufexporig->a[loy - begy][lox - begx] = original->a[y][x];//fill square buffer with datas - bufexporig->b[loy - begy][lox - begx] = original->b[y][x];//fill square buffer with datas + bufexporig->L[loy - begy][lox - begx] = original->L[y][x]; + bufexporig->a[loy - begy][lox - begx] = original->a[y][x]; + bufexporig->b[loy - begy][lox - begx] = original->b[y][x]; } } @@ -6574,14 +6629,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o #pragma omp parallel for schedule(dynamic,16) #endif - /* - for (int y = 0; y < transformed->H ; y++) //{ - for (int x = 0; x < transformed->W; x++) { - int lox = cx + x; - int loy = cy + y; - */ - // if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - for (int ir = 0; ir < bfh; ir++) //fill with 0 + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { float rL; @@ -6657,9 +6705,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o int loy = cy + y; if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - bufgb->L[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas - bufgb->a[loy - begy][lox - begx] = original->a[y][x];//fill square buffer with datas - bufgb->b[loy - begy][lox - begx] = original->b[y][x];//fill square buffer with datas + bufgb->L[loy - begy][lox - begx] = original->L[y][x]; + bufgb->a[loy - begy][lox - begx] = original->a[y][x]; + bufgb->b[loy - begy][lox - begx] = original->b[y][x]; } } @@ -6727,6 +6775,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o JaggedArray bufsh(bfw, bfh); LabImage *loctemp = nullptr; LabImage *loctempch = nullptr; + LabImage *origcbdl = nullptr; float b_l = -5.f; float t_l = 25.f; @@ -6741,6 +6790,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o if (call <= 3) { //call from simpleprocess dcrop improcc loctemp = new LabImage(bfw, bfh); loctempch = new LabImage(bfw, bfh); + origcbdl = new LabImage(bfw, bfh); #ifdef _OPENMP #pragma omp parallel for @@ -6758,6 +6808,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o loctempch->L[ir][jr] = 0.f; loctempch->a[ir][jr] = 0.f; loctempch->b[ir][jr] = 0.f; + origcbdl->L[ir][jr] = 0.f; + origcbdl->a[ir][jr] = 0.f; + origcbdl->b[ir][jr] = 0.f; } @@ -6776,7 +6829,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o int loy = cy + y; if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - bufsh[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas + bufsh[loy - begy][lox - begx] = original->L[y][x]; bufchr[loy - begy][lox - begx] = sqrt(SQR(original->a[y][x]) + SQR(original->b[y][x])); loctemp->L[loy - begy][lox - begx] = original->L[y][x]; loctemp->a[loy - begy][lox - begx] = original->a[y][x]; @@ -6784,33 +6837,54 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o loctempch->L[loy - begy][lox - begx] = original->L[y][x]; loctempch->a[loy - begy][lox - begx] = original->a[y][x]; loctempch->b[loy - begy][lox - begx] = original->b[y][x]; + origcbdl->L[loy - begy][lox - begx] = original->L[y][x]; + origcbdl->a[loy - begy][lox - begx] = original->a[y][x]; + origcbdl->b[loy - begy][lox - begx] = original->b[y][x]; } } ImProcFunctions::cbdl_local_temp(bufsh, bufsh, loctemp->L, bfw, bfh, lp.mulloc, 1.f, lp.threshol, skinprot, false, b_l, t_l, t_r, b_r, choice, sk); + /* + #ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) + #endif + for (int y = 0; y < transformed->H ; y++) //{ + for (int x = 0; x < transformed->W; x++) { + int lox = cx + x; + int loy = cy + y; + + if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { + float rL; + rL = CLIPRET((loctemp->L[loy - begy][lox - begx] - original->L[y][x]) / 330.f); + + buflight[loy - begy][lox - begx] = rL; + } + } + */ #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif - for (int y = 0; y < transformed->H ; y++) //{ - for (int x = 0; x < transformed->W; x++) { - int lox = cx + x; - int loy = cy + y; + for (int ir = 0; ir < bfh; ir++) + for (int jr = 0; jr < bfw; jr++) { - if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - float rL; - rL = CLIPRET((loctemp->L[loy - begy][lox - begx] - original->L[y][x]) / 330.f); + float rL; + rL = CLIPRET((loctemp->L[ir][jr] - origcbdl->L[ir][jr]) / 330.f); - buflight[loy - begy][lox - begx] = rL; - } + buflight[ir][jr] = rL; } + if (lp.softradiuscb > 0.f) { + softprocess(origcbdl, buflight, lp.softradiuscb, bfh, bfw, sk, multiThread); + } + transit_shapedetect(6, loctemp, nullptr, buflight, bufchrom, nullptr, nullptr, nullptr, false, hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); delete loctemp; + delete origcbdl; //chroma CBDL begin here if (lp.chromacb > 0.f) { @@ -6937,6 +7011,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o double ts = lp.slomaSH; double gamm2 = lp.gammaSH; GammaValues g_a; + if (gamm2 < 1.) { std::swap(pwr, gamm); } @@ -6996,6 +7071,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o bufexporig->L[loy - begy][lox - begx] = original->L[y][x]; } } + //printf("fab=%f \n", fab); #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) @@ -7064,11 +7140,12 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o if (lp.radmaSH > 0.f) { guidedFilter(guid, ble, ble, lp.radmaSH * 10.f / sk, 0.001, multiThread, 4); } + #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif - for (int ir = 0; ir < bfh; ir++) + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { float L_; bufmaskblurSH->L[ir][jr] = LIM01(ble[ir][jr]) * 32768.f; @@ -7122,12 +7199,12 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - bufexporig->L[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas - bufexporig->a[loy - begy][lox - begx] = original->a[y][x];//fill square buffer with datas - bufexporig->b[loy - begy][lox - begx] = original->b[y][x];//fill square buffer with datas - bufexpfin->L[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas - bufexpfin->a[loy - begy][lox - begx] = original->a[y][x];//fill square buffer with datas - bufexpfin->b[loy - begy][lox - begx] = original->b[y][x];//fill square buffer with datas + bufexporig->L[loy - begy][lox - begx] = original->L[y][x]; + bufexporig->a[loy - begy][lox - begx] = original->a[y][x]; + bufexporig->b[loy - begy][lox - begx] = original->b[y][x]; + bufexpfin->L[loy - begy][lox - begx] = original->L[y][x]; + bufexpfin->a[loy - begy][lox - begx] = original->a[y][x]; + bufexpfin->b[loy - begy][lox - begx] = original->b[y][x]; } } @@ -7138,7 +7215,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o #pragma omp parallel for schedule(dynamic,16) #endif - for (int ir = 0; ir < bfh; ir++) //fill with 0 + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { float rL; @@ -7232,9 +7309,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - bufexporig->L[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas - bufexporig->a[loy - begy][lox - begx] = original->a[y][x];//fill square buffer with datas - bufexporig->b[loy - begy][lox - begx] = original->b[y][x];//fill square buffer with datas + bufexporig->L[loy - begy][lox - begx] = original->L[y][x]; + bufexporig->a[loy - begy][lox - begx] = original->a[y][x]; + bufexporig->b[loy - begy][lox - begx] = original->b[y][x]; } } @@ -7247,7 +7324,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o #pragma omp parallel for schedule(dynamic,16) #endif - for (int ir = 0; ir < bfh; ir++) //fill with 0 + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { float rL; @@ -7305,7 +7382,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o int loy = cy + y; if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - bufloca->L[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas + bufloca->L[loy - begy][lox - begx] = original->L[y][x]; } } @@ -7350,7 +7427,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o int loy = cy + y; if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - bufsh[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas + bufsh[loy - begy][lox - begx] = original->L[y][x]; } } @@ -7429,9 +7506,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o int loy = cy + y; if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) { - bufreti->L[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas - bufreti->a[loy - begy][lox - begx] = original->a[y][x];//fill square buffer with datas - bufreti->b[loy - begy][lox - begx] = original->b[y][x];//fill square buffer with datas + bufreti->L[loy - begy][lox - begx] = original->L[y][x]; + bufreti->a[loy - begy][lox - begx] = original->a[y][x]; + bufreti->b[loy - begy][lox - begx] = original->b[y][x]; } } @@ -7551,6 +7628,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } } + if (lp.softradiusret > 0.f) { + softprocess(bufreti, buflight, lp.softradiusret, Hd, Wd, sk, multiThread); + } //new shape detection @@ -7811,6 +7891,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o double ts = lp.slomaexp; double gamm2 = lp.gammaexp; GammaValues g_a; + if (gamm2 < 1.) { std::swap(pwr, gamm); } @@ -8015,7 +8096,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o #pragma omp parallel for schedule(dynamic,16) #endif - for (int ir = 0; ir < bfh; ir++) //fill with 0 + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { float lighn = bufexporig->L[ir][jr]; @@ -8099,50 +8180,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } if (lp.softradiusexp > 0.f) { - float maxlig = -50000.f; - float minlig = 50000.f; - - for (int ir = 0; ir < bfh; ir++) - for (int jr = 0; jr < bfw; jr++) { - if (buflight[ir][jr] > maxlig) { - maxlig = buflight[ir][jr]; - } - - if (buflight[ir][jr] < minlig) { - minlig = buflight[ir][jr]; - } - } - - // printf("maxlig=%f minlig=%f\n", maxlig, minlig); - - array2D blesoft(bfw, bfh); - array2D guidsoft(bfw, bfh); - -#ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) -#endif - - for (int ir = 0; ir < bfh; ir++) - for (int jr = 0; jr < bfw; jr++) { - blesoft[ir][jr] = LIM01((buflight[ir][jr] - minlig) / (100.f - minlig)); - guidsoft[ir][jr] = ((bufexporig->L[ir][jr]) / 32768.f); - - } - - guidedFilter(guidsoft, blesoft, blesoft, lp.softradiusexp * 10.f / sk, 0.04, multiThread, 4); //lp.softradiusexp - -#ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) -#endif - - for (int ir = 0; ir < bfh; ir++) - for (int jr = 0; jr < bfw; jr++) { - buflight[ir][jr] = ((100.f - minlig) * blesoft[ir][jr]) + minlig; - } - - guidsoft(0, 0); - blesoft(0, 0); - + softprocess(bufexporig, buflight, lp.softradiusexp, bfh, bfw, sk, multiThread); } } @@ -8474,7 +8512,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o #pragma omp parallel for schedule(dynamic,16) #endif - for (int ir = 0; ir < bfh; ir++) //fill with 0 + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { float L_; bufmaskblurcol->L[ir][jr] = LIM01(ble[ir][jr]) * 32768.f; @@ -8521,7 +8559,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o #pragma omp parallel for schedule(dynamic,16) #endif - for (int ir = 0; ir < bfh; ir++) //fill with 0 + for (int ir = 0; ir < bfh; ir++) for (int jr = 0; jr < bfw; jr++) { bufcolcalc->a[ir][jr] = bufcolorig->a[ir][jr]; @@ -8633,50 +8671,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o delete bufcolcalc; if (lp.softradiuscol > 0.f) { - float maxlig = -50000.f; - float minlig = 50000.f; - - for (int ir = 0; ir < bfh; ir++) - for (int jr = 0; jr < bfw; jr++) { - if (buflight[ir][jr] > maxlig) { - maxlig = buflight[ir][jr]; - } - - if (buflight[ir][jr] < minlig) { - minlig = buflight[ir][jr]; - } - } - - - array2D blesoft(bfw, bfh); - array2D guidsoft(bfw, bfh); - -#ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) -#endif - - for (int ir = 0; ir < bfh; ir++) - for (int jr = 0; jr < bfw; jr++) { - blesoft[ir][jr] = LIM01((buflight[ir][jr] - minlig) / (100.f - minlig)); - guidsoft[ir][jr] = ((bufcolorig->L[ir][jr]) / 32768.f); - - } - - guidedFilter(guidsoft, blesoft, blesoft, lp.softradiuscol * 10.f / sk, 0.04, multiThread, 4); //lp.softradiuscol - -#ifdef _OPENMP - #pragma omp parallel for schedule(dynamic,16) -#endif - - for (int ir = 0; ir < bfh; ir++) - for (int jr = 0; jr < bfw; jr++) { - buflight[ir][jr] = ((100.f - minlig) * blesoft[ir][jr]) + minlig; - } - - guidsoft(0, 0); - blesoft(0, 0); - + softprocess(bufcolorig, buflight, lp.softradiuscol, bfh, bfw, sk, multiThread); } + } transit_shapedetect(0, bufcolorig, originalmaskcol, buflight, bufchro, buf_a, buf_b, bufhh, HHutili, hueref, chromaref, lumaref, sobelref, meansob, blend2, lp, original, transformed, cx, cy, sk); diff --git a/rtengine/procevents.h b/rtengine/procevents.h index b7b23b285..c7c82b890 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -683,6 +683,8 @@ enum ProcEventCode { EvlocallabgammaskSH = 653, EvlocallabslomaskSH = 654, Evlocallabsoftradiuscol = 655, + Evlocallabsoftradiusret = 656, + Evlocallabsoftradiuscb = 657, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 1e56a5f8d..8be506374 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2472,6 +2472,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : sensih(15), localTgaincurve{(double)FCT_MinMaxCPoints, 0.0, 0.12, 0.35, 0.35, 0.70, 0.50, 0.35, 0.35, 1.00, 0.12, 0.35, 0.35}, inversret(false), + softradiusret(5.0), // Sharpening expsharp(false), sharcontrast(20), @@ -2495,6 +2496,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : chromacbdl(0), threshold(0.2), sensicb(15), + softradiuscb(5.0), // Denoise expdenoi(false), noiselumf(0), @@ -2651,6 +2653,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && sensih == other.sensih && localTgaincurve == other.localTgaincurve && inversret == other.inversret + && softradiusret == other.softradiusret // Sharpening && expsharp == other.expsharp && sharcontrast == other.sharcontrast @@ -2684,6 +2687,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && chromacbdl == other.chromacbdl && threshold == other.threshold && sensicb == other.sensicb + && softradiuscb == other.softradiuscb // Denoise && expdenoi == other.expdenoi && noiselumf == other.noiselumf @@ -3787,6 +3791,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensih, "Locallab", "Sensih_" + std::to_string(i), spot.sensih, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).localTgaincurve, "Locallab", "TgainCurve_" + std::to_string(i), spot.localTgaincurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).inversret, "Locallab", "Inversret_" + std::to_string(i), spot.inversret, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).softradiusret, "Locallab", "Softradiusret_" + std::to_string(i), spot.softradiusret, keyFile); // Sharpening saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expsharp, "Locallab", "Expsharp_" + std::to_string(i), spot.expsharp, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sharcontrast, "Locallab", "Sharcontrast_" + std::to_string(i), spot.sharcontrast, keyFile); @@ -3814,6 +3819,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).chromacbdl, "Locallab", "Chromacbdl_" + std::to_string(i), spot.chromacbdl, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).threshold, "Locallab", "Threshold_" + std::to_string(i), spot.threshold, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensicb, "Locallab", "Sensicb_" + std::to_string(i), spot.sensicb, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).softradiuscb, "Locallab", "Softradiuscb_" + std::to_string(i), spot.softradiuscb, keyFile); // Denoise saveToKeyfile(!pedited || pedited->locallab.spots.at(i).expdenoi, "Locallab", "Expdenoi_" + std::to_string(i), spot.expdenoi, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).noiselumf, "Locallab", "noiselumf_" + std::to_string(i), spot.noiselumf, keyFile); @@ -5063,6 +5069,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Sensih_" + std::to_string(i), pedited, spot.sensih, spotEdited.sensih); assignFromKeyfile(keyFile, "Locallab", "TgainCurve_" + std::to_string(i), pedited, spot.localTgaincurve, spotEdited.localTgaincurve); assignFromKeyfile(keyFile, "Locallab", "Inversret_" + std::to_string(i), pedited, spot.inversret, spotEdited.inversret); + assignFromKeyfile(keyFile, "Locallab", "Softradiusret_" + std::to_string(i), pedited, spot.softradiusret, spotEdited.softradiusret); // Sharpening assignFromKeyfile(keyFile, "Locallab", "Expsharp_" + std::to_string(i), pedited, spot.expsharp, spotEdited.expsharp); assignFromKeyfile(keyFile, "Locallab", "Sharcontrast_" + std::to_string(i), pedited, spot.sharcontrast, spotEdited.sharcontrast); @@ -5090,6 +5097,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Chromacbdl_" + std::to_string(i), pedited, spot.chromacbdl, spotEdited.chromacbdl); assignFromKeyfile(keyFile, "Locallab", "Threshold_" + std::to_string(i), pedited, spot.threshold, spotEdited.threshold); assignFromKeyfile(keyFile, "Locallab", "Sensicb_" + std::to_string(i), pedited, spot.sensicb, spotEdited.sensicb); + assignFromKeyfile(keyFile, "Locallab", "Softradiuscb_" + std::to_string(i), pedited, spot.softradiuscb, spotEdited.softradiuscb); // Denoise assignFromKeyfile(keyFile, "Locallab", "Expdenoi_" + std::to_string(i), pedited, spot.expdenoi, spotEdited.expdenoi); assignFromKeyfile(keyFile, "Locallab", "noiselumf_" + std::to_string(i), pedited, spot.noiselumf, spotEdited.noiselumf); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 4ad5839c5..dba783868 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1073,6 +1073,7 @@ struct LocallabParams { int sensih; std::vector localTgaincurve; bool inversret; + double softradiusret; // Sharpening bool expsharp; int sharcontrast; @@ -1096,6 +1097,7 @@ struct LocallabParams { int chromacbdl; double threshold; int sensicb; + double softradiuscb; // Denoise bool expdenoi; int noiselumf; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 70643fad4..d3dc43d60 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -682,7 +682,9 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //EvLocallabchromaskSH LUMINANCECURVE, //EvLocallabgammaskSH LUMINANCECURVE, //EvLocallabslomaskSH - LUMINANCECURVE //EvLocallabsoftradiuscol + LUMINANCECURVE, //EvLocallabsoftradiuscol + LUMINANCECURVE, //EvLocallabsoftradiusret + LUMINANCECURVE //EvLocallabsoftradiuscb }; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 9abed1252..20fc36cdb 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -145,6 +145,7 @@ Locallab::Locallab(): vart(Gtk::manage(new Adjuster(M("TP_LOCALLAB_VART"), 50, 500, 1, 200))), dehaz(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DEHAZ"), 0, 100, 1, 0))), sensih(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIH"), 0, 100, 1, 15))), + softradiusret(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), 0.0, 100.0, 0.1, 5.))), // Sharpening sharcontrast(Gtk::manage(new Adjuster(M("TP_SHARPENING_CONTRAST"), 0, 200, 1, 20))), sharradius(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SHARRADIUS"), 0.42, 3.50, 0.01, 0.42))), @@ -163,6 +164,7 @@ Locallab::Locallab(): chromacbdl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMACBDL"), 0, 300, 1, 0))), threshold(Gtk::manage(new Adjuster(M("TP_DIRPYREQUALIZER_THRESHOLD"), 0, 1., 0.01, 0.2))), sensicb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSICB"), 0, 100, 1, 15))), + softradiuscb(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), 0.0, 100.0, 0.1, 5.))), // Denoise noiselumf(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMFINE"), MINCHRO, MAXCHRO, 1, 0))), noiselumc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMCOARSE"), MINCHRO, MAXCHROCC, 1, 0))), @@ -788,6 +790,7 @@ Locallab::Locallab(): sensih->set_tooltip_text(M("TP_LOCALLAB_SENSIH_TOOLTIP")); sensih->setAdjusterListener(this); + softradiusret->setAdjusterListener(this); LocalcurveEditorgainT->setCurveListener(this); @@ -807,6 +810,7 @@ Locallab::Locallab(): retiBox->pack_start(*neigh); retiBox->pack_start(*vart); retiBox->pack_start(*dehaz); + retiBox->pack_start(*softradiusret); retiBox->pack_start(*sensih); retiBox->pack_start(*LocalcurveEditorgainT, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor retiBox->pack_start(*inversret); @@ -920,6 +924,7 @@ Locallab::Locallab(): sensicb->set_tooltip_text(M("TP_LOCALLAB_SENSIH_TOOLTIP")); sensicb->setAdjusterListener(this); + softradiuscb->setAdjusterListener(this); ToolParamBlock* const cbdlBox = Gtk::manage(new ToolParamBlock()); Gtk::HBox* buttonBox = Gtk::manage(new Gtk::HBox(true, 10)); @@ -939,6 +944,7 @@ Locallab::Locallab(): cbdlBox->pack_start(*separator, Gtk::PACK_SHRINK, 2); cbdlBox->pack_start(*chromacbdl); cbdlBox->pack_start(*threshold); + cbdlBox->pack_start(*softradiuscb); cbdlBox->pack_start(*sensicb); expcbdl->add(*cbdlBox); expcbdl->setLevel(2); @@ -1819,6 +1825,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).sensih = sensih->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).localTgaincurve = cTgainshape->getCurve(); pp->locallab.spots.at(pp->locallab.selspot).inversret = inversret->get_active(); + pp->locallab.spots.at(pp->locallab.selspot).softradiusret = softradiusret->getValue(); // Sharpening pp->locallab.spots.at(pp->locallab.selspot).expsharp = expsharp->getEnabled(); pp->locallab.spots.at(pp->locallab.selspot).sharcontrast = sharcontrast->getIntValue(); @@ -1846,6 +1853,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).chromacbdl = chromacbdl->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).threshold = threshold->getValue(); pp->locallab.spots.at(pp->locallab.selspot).sensicb = sensicb->getIntValue(); + pp->locallab.spots.at(pp->locallab.selspot).softradiuscb = softradiuscb->getValue(); // Denoise pp->locallab.spots.at(pp->locallab.selspot).expdenoi = expdenoi->getEnabled(); pp->locallab.spots.at(pp->locallab.selspot).noiselumf = noiselumf->getIntValue(); @@ -1998,6 +2006,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).sensih = pe->locallab.spots.at(pp->locallab.selspot).sensih || sensih->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).localTgaincurve = pe->locallab.spots.at(pp->locallab.selspot).localTgaincurve || !cTgainshape->isUnChanged(); pe->locallab.spots.at(pp->locallab.selspot).inversret = pe->locallab.spots.at(pp->locallab.selspot).inversret || !inversret->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).softradiusret = pe->locallab.spots.at(pp->locallab.selspot).softradiusret || softradiusret->getEditedState(); // Sharpening pe->locallab.spots.at(pp->locallab.selspot).expsharp = pe->locallab.spots.at(pp->locallab.selspot).expsharp || !expsharp->get_inconsistent(); pe->locallab.spots.at(pp->locallab.selspot).sharcontrast = pe->locallab.spots.at(pp->locallab.selspot).sharcontrast || sharcontrast->getEditedState(); @@ -2025,6 +2034,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).chromacbdl = pe->locallab.spots.at(pp->locallab.selspot).chromacbdl || chromacbdl->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).threshold = pe->locallab.spots.at(pp->locallab.selspot).threshold || threshold->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).sensicb = pe->locallab.spots.at(pp->locallab.selspot).sensicb || sensicb->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).softradiuscb = pe->locallab.spots.at(pp->locallab.selspot).softradiuscb || softradiuscb->getEditedState(); // Denoise pe->locallab.spots.at(pp->locallab.selspot).expdenoi = pe->locallab.spots.at(pp->locallab.selspot).expdenoi || !expdenoi->get_inconsistent(); pe->locallab.spots.at(pp->locallab.selspot).noiselumf = pe->locallab.spots.at(pp->locallab.selspot).noiselumf || noiselumf->getEditedState(); @@ -2179,6 +2189,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).sensih = pedited->locallab.spots.at(pp->locallab.selspot).sensih || sensih->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).localTgaincurve = pedited->locallab.spots.at(pp->locallab.selspot).localTgaincurve || !cTgainshape->isUnChanged(); pedited->locallab.spots.at(pp->locallab.selspot).inversret = pedited->locallab.spots.at(pp->locallab.selspot).inversret || !inversret->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).softradiusret = pedited->locallab.spots.at(pp->locallab.selspot).softradiusret || softradiusret->getEditedState(); // Sharpening pedited->locallab.spots.at(pp->locallab.selspot).expsharp = pedited->locallab.spots.at(pp->locallab.selspot).expsharp || !expsharp->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).sharcontrast = pedited->locallab.spots.at(pp->locallab.selspot).sharcontrast || sharcontrast->getEditedState(); @@ -2206,6 +2217,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).chromacbdl = pedited->locallab.spots.at(pp->locallab.selspot).chromacbdl || chromacbdl->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).threshold = pedited->locallab.spots.at(pp->locallab.selspot).threshold || threshold->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).sensicb = pedited->locallab.spots.at(pp->locallab.selspot).sensicb || sensicb->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).softradiuscb = pedited->locallab.spots.at(pp->locallab.selspot).softradiuscb || softradiuscb->getEditedState(); // Denoise pedited->locallab.spots.at(pp->locallab.selspot).expdenoi = pedited->locallab.spots.at(pp->locallab.selspot).expdenoi || !expdenoi->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).noiselumf = pedited->locallab.spots.at(pp->locallab.selspot).noiselumf || noiselumf->getEditedState(); @@ -2898,12 +2910,16 @@ void Locallab::inversretChanged() // Update Retinex GUI according to inversret button state (to be compliant with updateSpecificGUIState function) if (multiImage && inversret->get_inconsistent()) { sensih->show(); + softradiusret->show(); + } else if (inversret->get_active()) { sensih->show(); dehaz->show(); + softradiuscol->hide(); } else { sensih->show(); dehaz->show(); + softradiusret->show(); } if (getEnabled() && expreti->getEnabled()) { @@ -3059,6 +3075,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe vart->setDefault((double)defSpot->vart); dehaz->setDefault((double)defSpot->dehaz); sensih->setDefault((double)defSpot->sensih); + softradiusret->setDefault(defSpot->softradiusret); // Sharpening sharcontrast->setDefault((double)defSpot->sharcontrast); sharradius->setDefault(defSpot->sharradius); @@ -3082,6 +3099,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe chromacbdl->setDefault((double)defSpot->chromacbdl); threshold->setDefault(defSpot->threshold); sensicb->setDefault((double)defSpot->sensicb); + softradiuscb->setDefault(defSpot->softradiuscb); // Denoise noiselumf->setDefault((double)defSpot->noiselumf); noiselumc->setDefault((double)defSpot->noiselumc); @@ -3167,6 +3185,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe vart->setDefaultEditedState(Irrelevant); dehaz->setDefaultEditedState(Irrelevant); sensih->setDefaultEditedState(Irrelevant); + softradiusret->setDefaultEditedState(Irrelevant); // Sharpening sharcontrast->setDefaultEditedState(Irrelevant); sharradius->setDefaultEditedState(Irrelevant); @@ -3190,6 +3209,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe chromacbdl->setDefaultEditedState(Irrelevant); threshold->setDefaultEditedState(Irrelevant); sensicb->setDefaultEditedState(Irrelevant); + softradiuscb->setDefaultEditedState(Irrelevant); // Denoise noiselumf->setDefaultEditedState(Irrelevant); noiselumc->setDefaultEditedState(Irrelevant); @@ -3279,6 +3299,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe vart->setDefaultEditedState(defSpotState->vart ? Edited : UnEdited); dehaz->setDefaultEditedState(defSpotState->dehaz ? Edited : UnEdited); sensih->setDefaultEditedState(defSpotState->sensih ? Edited : UnEdited); + softradiusret->setDefaultEditedState(defSpotState->softradiusret ? Edited : UnEdited); // Sharpening sharcontrast->setDefaultEditedState(defSpotState->sharcontrast ? Edited : UnEdited); sharradius->setDefaultEditedState(defSpotState->sharradius ? Edited : UnEdited); @@ -3302,6 +3323,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe chromacbdl->setDefaultEditedState(defSpotState->chromacbdl ? Edited : UnEdited); threshold->setDefaultEditedState(defSpotState->threshold ? Edited : UnEdited); sensicb->setDefaultEditedState(defSpotState->sensicb ? Edited : UnEdited); + softradiuscb->setDefaultEditedState(defSpotState->softradiuscb ? Edited : UnEdited); // Denoise noiselumf->setDefaultEditedState(defSpotState->noiselumf ? Edited : UnEdited); noiselumc->setDefaultEditedState(defSpotState->noiselumc ? Edited : UnEdited); @@ -3760,6 +3782,13 @@ void Locallab::adjusterChanged(Adjuster * a, double newval) listener->panelChanged(Evlocallabsensih, sensih->getTextValue()); } } + + if (a == softradiusret) { + if (listener) { + listener->panelChanged(Evlocallabsoftradiusret, softradiusret->getTextValue()); + } + } + } // Sharpening @@ -3871,6 +3900,13 @@ void Locallab::adjusterChanged(Adjuster * a, double newval) listener->panelChanged(Evlocallabsensicb, sensicb->getTextValue()); } } + + if (a == softradiuscb) { + if (listener) { + listener->panelChanged(Evlocallabsoftradiuscb, softradiuscb->getTextValue()); + } + } + } // Denoise @@ -4060,6 +4096,7 @@ void Locallab::setBatchMode(bool batchMode) vart->showEditedCB(); dehaz->showEditedCB(); sensih->showEditedCB(); + softradiusret->showEditedCB(); // Sharpening sharradius->showEditedCB(); sharamount->showEditedCB(); @@ -4081,6 +4118,7 @@ void Locallab::setBatchMode(bool batchMode) chromacbdl->showEditedCB(); threshold->showEditedCB(); sensicb->showEditedCB(); + softradiuscb->showEditedCB(); // Denoise noiselumf->showEditedCB(); noiselumc->showEditedCB(); @@ -4491,6 +4529,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con sensih->setValue(pp->locallab.spots.at(index).sensih); cTgainshape->setCurve(pp->locallab.spots.at(index).localTgaincurve); inversret->set_active(pp->locallab.spots.at(index).inversret); + softradiusret->setValue(pp->locallab.spots.at(index).softradiusret); // Sharpening expsharp->setEnabled(pp->locallab.spots.at(index).expsharp); @@ -4521,6 +4560,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con chromacbdl->setValue(pp->locallab.spots.at(index).chromacbdl); threshold->setValue(pp->locallab.spots.at(index).threshold); sensicb->setValue(pp->locallab.spots.at(index).sensicb); + softradiuscb->setValue(pp->locallab.spots.at(index).softradiuscb); // Denoise expdenoi->setEnabled(pp->locallab.spots.at(index).expdenoi); @@ -4708,6 +4748,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con sensih->setEditedState(spotState->sensih ? Edited : UnEdited); cTgainshape->setUnChanged(!spotState->localTgaincurve); inversret->set_inconsistent(multiImage && !spotState->inversret); + softradiusret->setEditedState(spotState->softradiusret ? Edited : UnEdited); // Sharpening expsharp->set_inconsistent(!spotState->expsharp); @@ -4738,6 +4779,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con chromacbdl->setEditedState(spotState->chromacbdl ? Edited : UnEdited); threshold->setEditedState(spotState->threshold ? Edited : UnEdited); sensicb->setEditedState(spotState->sensicb ? Edited : UnEdited); + softradiuscb->setEditedState(spotState->softradiuscb ? Edited : UnEdited); // Denoise expdenoi->set_inconsistent(!spotState->expdenoi); @@ -4893,10 +4935,13 @@ void Locallab::updateSpecificGUIState() // Update Retinex GUI according to inversret button state (to be compliant with inversretChanged function) if (multiImage && inversret->get_inconsistent()) { sensih->show(); + softradiusret->show(); } else if (inversret->get_active()) { sensih->show(); + softradiusret->hide(); } else { sensih->show(); + softradiusret->show(); } // Update Sharpening GUI according to inverssha button state (to be compliant with inversshaChanged function) diff --git a/rtgui/locallab.h b/rtgui/locallab.h index cd7a5d5d8..347604e40 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -163,6 +163,7 @@ private: Adjuster* const vart; Adjuster* const dehaz; Adjuster* const sensih; + Adjuster* const softradiusret; // Sharpening Adjuster* const sharcontrast; Adjuster* const sharradius; @@ -182,6 +183,7 @@ private: Adjuster* const chromacbdl; Adjuster* const threshold; Adjuster* const sensicb; + Adjuster* const softradiuscb; // Denoise Adjuster* const noiselumf; Adjuster* const noiselumc; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 5e1f35baa..26b7190e9 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1061,6 +1061,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).sensih = locallab.spots.at(j).sensih && pSpot.sensih == otherSpot.sensih; locallab.spots.at(j).localTgaincurve = locallab.spots.at(j).localTgaincurve && pSpot.localTgaincurve == otherSpot.localTgaincurve; locallab.spots.at(j).inversret = locallab.spots.at(j).inversret && pSpot.inversret == otherSpot.inversret; + locallab.spots.at(j).softradiusret = locallab.spots.at(j).softradiusret && pSpot.softradiusret == otherSpot.softradiusret; // Sharpening locallab.spots.at(j).expsharp = locallab.spots.at(j).expsharp && pSpot.expsharp == otherSpot.expsharp; locallab.spots.at(j).sharcontrast = locallab.spots.at(j).sharcontrast && pSpot.sharcontrast == otherSpot.sharcontrast; @@ -1088,6 +1089,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).chromacbdl = locallab.spots.at(j).chromacbdl && pSpot.chromacbdl == otherSpot.chromacbdl; locallab.spots.at(j).threshold = locallab.spots.at(j).threshold && pSpot.threshold == otherSpot.threshold; locallab.spots.at(j).sensicb = locallab.spots.at(j).sensicb && pSpot.sensicb == otherSpot.sensicb; + locallab.spots.at(j).softradiuscb = locallab.spots.at(j).softradiuscb && pSpot.softradiuscb == otherSpot.softradiuscb; // Denoise locallab.spots.at(j).expdenoi = locallab.spots.at(j).expdenoi && pSpot.expdenoi == otherSpot.expdenoi; locallab.spots.at(j).noiselumf = locallab.spots.at(j).noiselumf && pSpot.noiselumf == otherSpot.noiselumf; @@ -3027,6 +3029,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).sensih = mods.locallab.spots.at(i).sensih; } + if (locallab.spots.at(i).softradiusret) { + toEdit.locallab.spots.at(i).softradiusret = mods.locallab.spots.at(i).softradiusret; + } + if (locallab.spots.at(i).localTgaincurve) { toEdit.locallab.spots.at(i).localTgaincurve = mods.locallab.spots.at(i).localTgaincurve; } @@ -3120,6 +3126,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).sensicb = mods.locallab.spots.at(i).sensicb; } + if (locallab.spots.at(i).softradiuscb) { + toEdit.locallab.spots.at(i).softradiuscb = mods.locallab.spots.at(i).softradiuscb; + } + // Denoise if (locallab.spots.at(i).expdenoi) { toEdit.locallab.spots.at(i).expdenoi = mods.locallab.spots.at(i).expdenoi; @@ -4245,6 +4255,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : sensih(v), localTgaincurve(v), inversret(v), + softradiusret(v), // Sharpening expsharp(v), sharcontrast(v), @@ -4268,6 +4279,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : chromacbdl(v), threshold(v), sensicb(v), + softradiuscb(v), // Denoise expdenoi(v), noiselumf(v), @@ -4421,6 +4433,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) sensih = v; localTgaincurve = v; inversret = v; + softradiusret = v; // Sharpening expsharp = v; sharcontrast = v; @@ -4448,6 +4461,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) chromacbdl = v; threshold = v; sensicb = v; + softradiuscb = v; // Denoise expdenoi = v; noiselumf = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index db0e2fe4a..616b9ec39 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -488,6 +488,7 @@ public: bool sensih; bool localTgaincurve; bool inversret; + bool softradiusret; // Sharpening bool expsharp; bool sharcontrast; @@ -511,6 +512,7 @@ public: bool chromacbdl; bool threshold; bool sensicb; + bool softradiuscb; // Denoise bool expdenoi; bool noiselumf;