From 3603cad47239e08676c41bcdb4ff306565368593 Mon Sep 17 00:00:00 2001 From: Desmis Date: Thu, 8 Aug 2019 13:54:30 +0200 Subject: [PATCH] Improve deltaE Blur-Noise add 2 methods Blur --- rtdata/languages/default | 14 +- rtengine/improcfun.h | 4 +- rtengine/iplocallab.cc | 272 +++++++++++++++++++++++++++++++++++---- rtengine/procevents.h | 7 +- rtengine/procparams.cc | 20 +++ rtengine/procparams.h | 5 + rtengine/refreshmap.cc | 7 +- rtgui/locallab.cc | 226 +++++++++++++++++++++++++++++++- rtgui/locallab.h | 11 +- rtgui/paramsedited.cc | 35 +++++ rtgui/paramsedited.h | 5 + 11 files changed, 576 insertions(+), 30 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index b6848212f..628a74df6 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -969,6 +969,11 @@ HISTORY_MSG_726;Local - Blur mask radius HISTORY_MSG_727;Local - Blur mask chroma HISTORY_MSG_728;Local - Blur mask gamma HISTORY_MSG_729;Local - Blur mask slope +HISTORY_MSG_730;Local - Blur method +HISTORY_MSG_731;Local - median method +HISTORY_MSG_732;Local - median iterations +HISTORY_MSG_733;Local - soft radius +HISTORY_MSG_734;Local - threshold HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -2023,7 +2028,7 @@ TP_LENSPROFILE_USE_CA;Chromatic aberration TP_LENSPROFILE_USE_GEOMETRIC;Geometric distortion TP_LENSPROFILE_USE_HEADER;Correct TP_LENSPROFILE_USE_VIGNETTING;Vignetting -TP_LOCALLAB_ACTIV;Blur luminance only +TP_LOCALLAB_ACTIV;Luminance only TP_LOCALLAB_ADJ;Equalizer blue-red TP_LOCALLAB_AMOUNT;Amount TP_LOCALLAB_ARTIF;Shape detection @@ -2032,9 +2037,14 @@ TP_LOCALLAB_AVOID;Avoid color shift TP_LOCALLAB_BALAN;Balance deltaE ab-L TP_LOCALLAB_BILATERAL;Bilateral filter TP_LOCALLAB_BLENDMASKCOL;Blend +TP_LOCALLAB_BLUR;Gaussian Blur and Noise +TP_LOCALLAB_BLMED;Median +TP_LOCALLAB_BLGUID;Guided Filter Luminance +TP_LOCALLAB_GUIDBL;Soft radius +TP_LOCALLAB_EPSBL;Threshold TP_LOCALLAB_SCALERETI;Scale TP_LOCALLAB_BLMETHOD_TOOLTIP;Normal - direct blur and noise with all settings.\nInverse - Inverse blur and noise without scope and whithout enhanced algorithm.\nSymmetric - inverse blur and noise with all settings. Be careful some results may be curious -TP_LOCALLAB_BLUFR;Blur & Noise +TP_LOCALLAB_BLUFR;Smooth - Blur & Noise TP_LOCALLAB_BLURDE;Blur Shape detection TP_LOCALLAB_BLNORM;Normal TP_LOCALLAB_BLINV;Inverse diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 9d3961d92..bb746f9fc 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -321,9 +321,9 @@ public: int llExpMask, int llSHMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask); void addGaNoise(LabImage *lab, LabImage *dst, const float mean, const float variance, const int sk); void BlurNoise_Localold(int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy); - void InverseBlurNoise_Local(LabImage * originalmask, const struct local_params& lp, const float hueref, const float chromaref, const float lumaref, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy, int sk); + void InverseBlurNoise_Local(LabImage * originalmask, float **bufchro, const struct local_params& lp, const float hueref, const float chromaref, const float lumaref, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy, int sk); void InverseReti_Local(const struct local_params& lp, const float hueref, const float chromaref, const float lumaref, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy, int chro, int sk); - void BlurNoise_Local(LabImage* tmp1, LabImage * originalmask, const float hueref, const float chromaref, const float lumaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy, int sk); + void BlurNoise_Local(LabImage* tmp1, LabImage * originalmask, float **bufchro, const float hueref, const float chromaref, const float lumaref, const local_params& lp, LabImage* original, LabImage* transformed, int cx, int cy, int sk); static void strcurv_data(std::string retistr, int *s_datc, int &siz); void blendstruc(int bfw, int bfh, LabImage* bufcolorig, float radius, float stru, array2D & blend2, int sk, bool multiThread); diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index ec47e387a..ae1a731ae 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -246,6 +246,9 @@ struct local_params { double shblurr; double rad; double stren; + int it; + int guidb; + float epsb; int trans; float transweak; float transgrad; @@ -280,6 +283,8 @@ struct local_params { int expmet; int softmet; int blurmet; + int blmet; + int medmet; int locmet; float noiself; float noiself0; @@ -526,6 +531,23 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.softmet = 1; } + if (locallab.spots.at(sp).blMethod == "blur") { + lp.blmet = 0; + } else if (locallab.spots.at(sp).blMethod == "med") { + lp.blmet = 1; + } else if (locallab.spots.at(sp).blMethod == "guid") { + lp.blmet = 2; + } + + if (locallab.spots.at(sp).medMethod == "33") { + lp.medmet = 0; + } else if (locallab.spots.at(sp).medMethod == "55") { + lp.medmet = 1; + } else if (locallab.spots.at(sp).medMethod == "77") { + lp.medmet = 2; + } else if (locallab.spots.at(sp).medMethod == "99") { + lp.medmet = 3; + } if (locallab.spots.at(sp).blurMethod == "norm") { lp.blurmet = 0; @@ -617,6 +639,9 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall float local_transitweak = (float)locallab.spots.at(sp).transitweak; float local_transitgrad = (float)locallab.spots.at(sp).transitgrad; float radius = (float) locallab.spots.at(sp).radius; + int itera = locallab.spots.at(sp).itera; + int guidbl = locallab.spots.at(sp).guidbl; + float epsbl = (float) locallab.spots.at(sp).epsbl; double sharradius = ((double) locallab.spots.at(sp).sharradius); sharradius = CLIP42_35(sharradius); float lcamount = ((float) locallab.spots.at(sp).lcamount); @@ -722,7 +747,9 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.chromabl = chromaskbl; lp.gammabl = gammaskbl; lp.slomabl = slomaskbl; - + lp.it = itera; + lp.guidb = guidbl; + lp.epsb = 0.01f * epsbl; lp.struexp = structexpo; lp.blurexp = blurexpo; lp.blurcol = blurcolor; @@ -1588,7 +1615,7 @@ void ImProcFunctions::DeNoise_Local(int call, const struct local_params& lp, in } } -void ImProcFunctions::BlurNoise_Local(LabImage *tmp1, LabImage * originalmask, const float hueref, const float chromaref, const float lumaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int sk) +void ImProcFunctions::BlurNoise_Local(LabImage *tmp1, LabImage * originalmask, float **bufchro, const float hueref, const float chromaref, const float lumaref, const local_params & lp, LabImage * original, LabImage * transformed, int cx, int cy, int sk) { //local BLUR BENCHFUN @@ -1679,11 +1706,20 @@ void ImProcFunctions::BlurNoise_Local(LabImage *tmp1, LabImage * originalmask, c float reducdE; calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, lp.sensbn, reducdE); + const float clc = (previewbl) ? settings->previewselection * 100.f : bufchro[y - ystart][x - xstart]; + const float realstrchdE = reducdE * clc; + float flia = 1.f; + float flib = 1.f; + const float chra = tmp1->a[y - ystart][x - xstart]; + const float chrb = tmp1->b[y - ystart][x - xstart]; const float difL = (tmp1->L[y - ystart][x - xstart] - original->L[y][x]) * localFactor * reducdE; transformed->L[y][x] = CLIP(original->L[y][x] + difL); - const float difa = (tmp1->a[y - ystart][x - xstart] - original->a[y][x]) * localFactor * reducdE;; - const float difb = (tmp1->b[y - ystart][x - xstart] - original->b[y][x]) * localFactor * reducdE;; + flia = flib = ((100.f + realstrchdE) / 100.f); + float difa = chra * flia - original->a[y][x]; + float difb = chrb * flib - original->b[y][x]; + difa *= localFactor; + difb *= localFactor; if (!lp.actsp) { transformed->a[y][x] = CLIPC(original->a[y][x] + difa); @@ -1830,7 +1866,7 @@ void ImProcFunctions::InverseReti_Local(const struct local_params & lp, const fl -void ImProcFunctions::InverseBlurNoise_Local(LabImage * originalmask, const struct local_params & lp, const float hueref, const float chromaref, const float lumaref, LabImage * original, LabImage * transformed, const LabImage * const tmp1, int cx, int cy, int sk) +void ImProcFunctions::InverseBlurNoise_Local(LabImage * originalmask, float **bufchro, const struct local_params & lp, const float hueref, const float chromaref, const float lumaref, LabImage * original, LabImage * transformed, const LabImage * const tmp1, int cx, int cy, int sk) { // BENCHFUN //inverse local blur and noise @@ -1907,20 +1943,30 @@ void ImProcFunctions::InverseBlurNoise_Local(LabImage * originalmask, const stru calcTransitionrect(lox, loy, ach, lp, zone, localFactor); } + const float clc = (previewbl) ? settings->previewselection * 100.f : bufchro[y][x]; + float dE = sqrt(kab * SQR(refa - maskptr->a[y][x] / 327.68f) + kab * SQR(refb - maskptr->b[y][x] / 327.68f) + kL * SQR(lumaref - maskptr->L[y][x] / 327.68f)); float reducdE; calcreducdE(dE, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, lp.sensbn, reducdE); + const float realstrchdE = reducdE * clc; switch (zone) { + case 0: { // outside selection and outside transition zone => full effect, no transition float difL = tmp1->L[y][x] - original->L[y][x]; transformed->L[y][x] = CLIP(original->L[y][x] + difL * reducdE); float difa = tmp1->a[y][x] - original->a[y][x]; float difb = tmp1->b[y][x] - original->b[y][x]; + float flia = 1.f, flib = 1.f; + flia = flib = ((100.f + realstrchdE) / 100.f); + const float chra = tmp1->a[y][x]; + const float chrb = tmp1->b[y][x]; if (!lp.actsp) { - transformed->a[y][x] = CLIPC(tmp1->a[y][x]); - transformed->b[y][x] = CLIPC(tmp1->b[y][x]); + difa = chra * flia - original->a[y][x]; + difb = chrb * flib - original->b[y][x]; + transformed->a[y][x] = CLIPC(original->a[y][x] + difa); + transformed->b[y][x] = CLIPC(original->b[y][x] + difb); } if (blshow) { @@ -1939,18 +1985,24 @@ void ImProcFunctions::InverseBlurNoise_Local(LabImage * originalmask, const stru float difL = tmp1->L[y][x] - original->L[y][x]; float difa = tmp1->a[y][x] - original->a[y][x]; float difb = tmp1->b[y][x] - original->b[y][x]; + float flia = 1.f, flib = 1.f; + flia = flib = ((100.f + realstrchdE) / 100.f); + const float chra = tmp1->a[y][x]; + const float chrb = tmp1->b[y][x]; float factorx = 1.f - localFactor; difL *= factorx; - difa *= factorx; - difb *= factorx; transformed->L[y][x] = CLIP(original->L[y][x] + difL * reducdE); if (!lp.actsp) { - + difa = chra * flia - original->a[y][x]; + difb = chrb * flib - original->b[y][x]; + difa *= factorx; + difb *= factorx; transformed->a[y][x] = CLIPC(original->a[y][x] + difa); transformed->b[y][x] = CLIPC(original->b[y][x] + difb); + } if (blshow) { @@ -6436,8 +6488,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o //Blur and noise - if (((radius >= 1.5 * GAUSS_SKIP && lp.rad > 1.) || lp.stren > 0.1 || lp.showmaskblmet == 2 || lp.enablMask || lp.showmaskblmet == 3 || lp.showmaskblmet == 4) && lp.blurena) { // radius < GAUSS_SKIP means no gauss, just copy of original image + if (((radius >= 1.5 * GAUSS_SKIP && lp.rad > 1.) || lp.stren > 0.1 || lp.blmet == 1 || lp.guidb > 0.f || lp.showmaskblmet == 2 || lp.enablMask || lp.showmaskblmet == 3 || lp.showmaskblmet == 4) && lp.blurena) { // radius < GAUSS_SKIP means no gauss, just copy of original image std::unique_ptr tmp1; + std::unique_ptr tmp2; const int ystart = std::max(static_cast(lp.yc - lp.lyT) - cy, 0); const int yend = std::min(static_cast(lp.yc + lp.ly) - cy, original->H); const int xstart = std::max(static_cast(lp.xc - lp.lxL) - cx, 0); @@ -6446,6 +6499,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o const int bfw = xend - xstart; const int GW = transformed->W; const int GH = transformed->H; + JaggedArray bufchroi(GW, GH); + std::unique_ptr bufgbi(new LabImage(GW, GH)); + JaggedArray bufchro(bfw, bfh); //here mask is used with plein image for normal and inverse std::unique_ptr bufmaskorigbl; @@ -6580,7 +6636,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o if (lp.showmaskblmet == 0 || lp.showmaskblmet == 1 || lp.showmaskblmet == 2 || lp.showmaskblmet == 4 || lp.enablMask) { - if (call <= 3 && lp.blurmet == 0) { + if (lp.blurmet == 0) { if (bfw > 0 && bfh > 0) { tmp1.reset(new LabImage(bfw, bfh)); #ifdef _OPENMP @@ -6596,12 +6652,25 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } } - } else { + } else if (lp.blurmet == 1) { tmp1.reset(new LabImage(transformed->W, transformed->H)); + tmp2.reset(new LabImage(transformed->W, transformed->H)); + + for (int y = 0; y < GH ; y++) { + for (int x = 0; x < GW; x++) { + tmp2->L[y][x] = original->L[y][x]; + tmp2->a[y][x] = original->a[y][x]; + tmp2->b[y][x] = original->b[y][x]; + bufgbi->L[y][x] = original->L[y][x]; + bufgbi->a[y][x] = original->a[y][x]; + bufgbi->b[y][x] = original->b[y][x]; + } + } + } - if (lp.blurmet == 0) { + if (lp.blurmet == 0 && lp.blmet == 0) { #ifdef _OPENMP #pragma omp parallel #endif @@ -6612,7 +6681,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o gaussianBlur(tmp1->b, tmp1->b, bfw, bfh, radius); } - } else { + } else if (lp.blurmet == 1 && lp.blmet == 0) { #ifdef _OPENMP #pragma omp parallel @@ -6624,18 +6693,177 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } } - if (tmp1.get() && lp.stren > 0.1f) { + + + if (tmp1.get() && lp.stren > 0.1f && lp.blmet == 0) { float mean = 0.f;//0 best result float variance = lp.stren ; addGaNoise(tmp1.get(), tmp1.get(), mean, variance, sk) ; } - if (lp.blurmet == 0) { //blur and noise (center) - if (tmp1.get()) { - BlurNoise_Local(tmp1.get(), originalmaskbl.get(), hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk); + Median medianTypeL = Median::TYPE_3X3_STRONG; + Median medianTypeAB = Median::TYPE_3X3_STRONG; + + if (lp.medmet == 0) { + medianTypeL = medianTypeAB = Median::TYPE_3X3_STRONG; + } else if (lp.medmet == 1) { + medianTypeL = medianTypeAB = Median::TYPE_5X5_STRONG; + } else if (lp.medmet == 2) { + medianTypeL = medianTypeAB = Median::TYPE_7X7; + } else if (lp.medmet == 3) { + medianTypeL = medianTypeAB = Median::TYPE_9X9; + } + + if (lp.blurmet == 0 && lp.blmet == 1) { + float** tmL; + int wid = bfw; + int hei = bfh; + tmL = new float*[hei]; + + for (int i = 0; i < hei; ++i) { + tmL[i] = new float[wid]; + } + + Median_Denoise(tmp1->L, tmp1->L, bfw, bfh, medianTypeL, lp.it, multiThread, tmL); + + if (!lp.actsp) { + Median_Denoise(tmp1->a, tmp1->a, bfw, bfh, medianTypeAB, lp.it, multiThread, tmL); + Median_Denoise(tmp1->b, tmp1->b, bfw, bfh, medianTypeAB, lp.it, multiThread, tmL); + } + + for (int i = 0; i < hei; ++i) { + delete[] tmL[i]; + } + + delete[] tmL; + + } else if (lp.blurmet == 1 && lp.blmet == 1) { + float** tmL; + int wid = GW; + int hei = GH; + tmL = new float*[hei]; + + for (int i = 0; i < hei; ++i) { + tmL[i] = new float[wid]; + } + + Median_Denoise(tmp2->L, tmp1->L, GW, GH, medianTypeL, lp.it, multiThread, tmL); + + if (!lp.actsp) { + Median_Denoise(tmp2->a, tmp1->a, GW, GH, medianTypeAB, lp.it, multiThread, tmL); + Median_Denoise(tmp2->b, tmp1->b, GW, GH, medianTypeAB, lp.it, multiThread, tmL); + } + + for (int i = 0; i < hei; ++i) { + delete[] tmL[i]; + } + + delete[] tmL; + } + + if (lp.blurmet == 0 && lp.blmet == 2) { + if (lp.guidb > 0.f) { + lp.actsp = true; +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) +#endif + + for (int y = ystart; y < yend ; y++) { + for (int x = xstart; x < xend; x++) { + tmp1->L[y - ystart][x - xstart] = original->L[y][x]; + bufgb->L[y - ystart][x - xstart] = original->L[y][x]; + } + } + + double thresM = 0.05 * lp.epsb; + double thresm = 0.001 * lp.epsb; + softproc(bufgb.get(), tmp1.get(), lp.guidb, bfh, bfw, thresM, thresm, 0.0001f, sk, multiThread); + } + + } else if (lp.blurmet == 1 && lp.blmet == 2) { + if (lp.guidb > 0.f) { + lp.actsp = true; +#ifdef _OPENMP + #pragma omp parallel for schedule(dynamic,16) +#endif + + for (int y = 0; y < GH ; y++) { + for (int x = 0; x < GH; x++) { + tmp1->L[y][x] = original->L[y][x]; + tmp2->L[y][x] = original->L[y][x]; + } + } + + double thresM = 0.05 * lp.epsb; + double thresm = 0.001 * lp.epsb; + softproc(tmp2.get(), tmp1.get(), lp.guidb, GH, GW, thresM, thresm, 0.0001f, sk, multiThread); + } + + } + + if (lp.blurmet == 0) { + float minC = sqrt(SQR(tmp1->a[0][0]) + SQR(tmp1->b[0][0])) - sqrt(SQR(bufgb->a[0][0]) + SQR(bufgb->b[0][0])); + float maxC = minC; +#ifdef _OPENMP + #pragma omp parallel for reduction(max:maxC) reduction(min:minC) schedule(dynamic,16) +#endif + + for (int ir = 0; ir < bfh; ir++) { + for (int jr = 0; jr < bfw; jr++) { + bufchro[ir][jr] = sqrt(SQR(tmp1->a[ir][jr]) + SQR(tmp1->b[ir][jr])) - sqrt(SQR(bufgb->a[ir][jr]) + SQR(bufgb->b[ir][jr])); + minC = rtengine::min(minC, bufchro[ir][jr]); + maxC = rtengine::max(maxC, bufchro[ir][jr]); + } + } + + float coefC = 0.01f * (max(fabs(minC), fabs(maxC))); +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int y = 0; y < bfh; y++) { + for (int x = 0; x < bfw; x++) { + bufchro[y][x] /= coefC; + } + } + + } else if (lp.blurmet == 1) { + float minC = sqrt(SQR(tmp1->a[0][0]) + SQR(tmp1->b[0][0])) - sqrt(SQR(bufgbi->a[0][0]) + SQR(bufgbi->b[0][0])); + float maxC = minC; +#ifdef _OPENMP + #pragma omp parallel for reduction(max:maxC) reduction(min:minC) schedule(dynamic,16) +#endif + + for (int ir = 0; ir < GH; ir++) { + for (int jr = 0; jr < GW; jr++) { + bufchroi[ir][jr] = sqrt(SQR(tmp1->a[ir][jr]) + SQR(tmp1->b[ir][jr])) - sqrt(SQR(bufgbi->a[ir][jr]) + SQR(bufgbi->b[ir][jr])); + minC = rtengine::min(minC, bufchroi[ir][jr]); + maxC = rtengine::max(maxC, bufchroi[ir][jr]); + } + } + + float coefC = 0.01f * (max(fabs(minC), fabs(maxC))); +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int y = 0; y < GH; y++) { + for (int x = 0; x < GW; x++) { + bufchroi[y][x] /= coefC; + } + } + + } + + if (lp.blurmet == 0) { //blur and noise (center) + + if (tmp1.get()) { + BlurNoise_Local(tmp1.get(), originalmaskbl.get(), bufchro, hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk); + } + } else if (lp.blurmet == 1) { + if (tmp1.get()) { + InverseBlurNoise_Local(originalmaskbl.get(), bufchroi, lp, hueref, chromaref, lumaref, original, transformed, tmp1.get(), cx, cy, sk); } - } else { - InverseBlurNoise_Local(originalmaskbl.get(), lp, hueref, chromaref, lumaref, original, transformed, tmp1.get(), cx, cy, sk); } } } @@ -6868,7 +7096,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o float maxC = minC; #ifdef _OPENMP - #pragma omp parallel for reduction(max:maxL) reduction(min:minL) schedule(dynamic,16) + #pragma omp parallel for reduction(max:maxL) reduction(min:minL) reduction(max:maxC) reduction(min:minC) schedule(dynamic,16) #endif for (int ir = 0; ir < bfh; ir++) { diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 77e075fb3..17d8cb80a 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -745,7 +745,7 @@ enum ProcEventCode { EvlocallablocalcontMethod = 715, EvlocallabwavCurve = 716, Evlocallablevelwav = 717, - Evlocallabresidcont = 718, + Evlocallabresidcont = 718, EvlocallabCCmaskblshape = 719, EvlocallabLLmaskblshape = 720, EvlocallabHHmaskblshape = 721, @@ -756,6 +756,11 @@ enum ProcEventCode { Evlocallabchromaskbl = 726, Evlocallabgammaskbl = 727, Evlocallabslomaskbl = 728, + EvlocallabblMethod = 729, + EvlocallabmedMethod = 730, + Evlocallabitera = 731, + Evlocallabguidbl = 732, + Evlocallabepsbl = 733, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index f438d7036..fd835fddc 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2460,7 +2460,12 @@ LocallabParams::LocallabSpot::LocallabSpot() : radius(1.0), strength(0), sensibn(40), + itera(1), + guidbl(0), + epsbl(1), + blMethod("blur"), blurMethod("norm"), + medMethod("33"), activlum(false), CCmaskblcurve{(double)FCT_MinMaxCPoints, 0.0, 1.0, 0.35, 0.35, 0.50, 1.0, 0.35, 0.35, 1.0, 1.0, 0.35, 0.35 }, LLmaskblcurve{(double)FCT_MinMaxCPoints, 0.0, 1.0, 0.35, 0.35, 0.50, 1.0, 0.35, 0.35, 1.0, 1.0, 0.35, 0.35}, @@ -2706,7 +2711,12 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && radius == other.radius && strength == other.strength && sensibn == other.sensibn + && itera == other.itera + && guidbl == other.guidbl + && epsbl == other.epsbl + && blMethod == other.blMethod && blurMethod == other.blurMethod + && medMethod == other.medMethod && activlum == other.activlum && CCmaskblcurve == other.CCmaskblcurve && LLmaskblcurve == other.LLmaskblcurve @@ -3933,7 +3943,12 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).radius, "Locallab", "Radius_" + std::to_string(i), spot.radius, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).strength, "Locallab", "Strength_" + std::to_string(i), spot.strength, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensibn, "Locallab", "Sensibn_" + std::to_string(i), spot.sensibn, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).itera, "Locallab", "Iteramed_" + std::to_string(i), spot.itera, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).guidbl, "Locallab", "Guidbl_" + std::to_string(i), spot.guidbl, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).epsbl, "Locallab", "Epsbl_" + std::to_string(i), spot.epsbl, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blMethod, "Locallab", "BlMethod_" + std::to_string(i), spot.blMethod, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blurMethod, "Locallab", "BlurMethod_" + std::to_string(i), spot.blurMethod, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).medMethod, "Locallab", "MedMethod_" + std::to_string(i), spot.medMethod, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).activlum, "Locallab", "activlum_" + std::to_string(i), spot.activlum, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).CCmaskblcurve, "Locallab", "CCmaskblCurve_" + std::to_string(i), spot.CCmaskblcurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).LLmaskblcurve, "Locallab", "LLmaskblCurve_" + std::to_string(i), spot.LLmaskblcurve, keyFile); @@ -5282,7 +5297,12 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Radius_" + std::to_string(i), pedited, spot.radius, spotEdited.radius); assignFromKeyfile(keyFile, "Locallab", "Strength_" + std::to_string(i), pedited, spot.strength, spotEdited.strength); assignFromKeyfile(keyFile, "Locallab", "Sensibn_" + std::to_string(i), pedited, spot.sensibn, spotEdited.sensibn); + assignFromKeyfile(keyFile, "Locallab", "Iteramed_" + std::to_string(i), pedited, spot.itera, spotEdited.itera); + assignFromKeyfile(keyFile, "Locallab", "Guidbl_" + std::to_string(i), pedited, spot.guidbl, spotEdited.guidbl); + assignFromKeyfile(keyFile, "Locallab", "Epsbl_" + std::to_string(i), pedited, spot.epsbl, spotEdited.epsbl); + assignFromKeyfile(keyFile, "Locallab", "BlMethod_" + std::to_string(i), pedited, spot.blMethod, spotEdited.blMethod); assignFromKeyfile(keyFile, "Locallab", "BlurMethod_" + std::to_string(i), pedited, spot.blurMethod, spotEdited.blurMethod); + assignFromKeyfile(keyFile, "Locallab", "MedMethod_" + std::to_string(i), pedited, spot.medMethod, spotEdited.medMethod); assignFromKeyfile(keyFile, "Locallab", "activlum_" + std::to_string(i), pedited, spot.activlum, spotEdited.activlum); assignFromKeyfile(keyFile, "Locallab", "CCmaskblCurve_" + std::to_string(i), pedited, spot.CCmaskblcurve, spotEdited.CCmaskblcurve); assignFromKeyfile(keyFile, "Locallab", "LLmaskblCurve_" + std::to_string(i), pedited, spot.LLmaskblcurve, spotEdited.LLmaskblcurve); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 13db8399e..09f7c1f97 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1061,7 +1061,12 @@ struct LocallabParams { double radius; int strength; int sensibn; + int itera; + int guidbl; + int epsbl; + Glib::ustring blMethod; Glib::ustring blurMethod; + Glib::ustring medMethod; bool activlum; std::vector CCmaskblcurve; std::vector LLmaskblcurve; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 7f4ffa75e..006942df8 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -755,7 +755,12 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //Evlocallabradmaskbl LUMINANCECURVE, //Evlocallabchromaskbl LUMINANCECURVE, //Evlocallabgammaskbl - LUMINANCECURVE //Evlocallabslomaskbl + LUMINANCECURVE, //Evlocallabslomaskbl + LUMINANCECURVE, // EvlocallabblMethod + LUMINANCECURVE, // EvlocallabmedMethod + LUMINANCECURVE, // Evlocallabitera + LUMINANCECURVE, // Evlocallabguidbl + LUMINANCECURVE // Evlocallabepsbl }; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 41aaf097b..209d5f0bf 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -134,7 +134,8 @@ Locallab::Locallab(): expshadhigh(Gtk::manage(new MyExpander(true, M("TP_LOCALLAB_SHADHIGH")))), expvibrance(Gtk::manage(new MyExpander(true, M("TP_LOCALLAB_VIBRANCE")))), expsoft(Gtk::manage(new MyExpander(true, M("TP_LOCALLAB_SOFT")))), - expblur(Gtk::manage(new MyExpander(true, M("TP_LOCALLAB_BLUFR")))), +// expblur(Gtk::manage(new MyExpander(true, M("TP_LOCALLAB_BLUFR")))), + expblur(Gtk::manage(new MyExpander(true, Gtk::manage(new Gtk::HBox())))), exptonemap(Gtk::manage(new MyExpander(true, Gtk::manage(new Gtk::HBox())))), expreti(Gtk::manage(new MyExpander(true, Gtk::manage(new Gtk::HBox())))), expsharp(Gtk::manage(new MyExpander(true, Gtk::manage(new Gtk::HBox())))), @@ -235,6 +236,9 @@ Locallab::Locallab(): // Blur & Noise radius(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADIUS"), 1.0, 100.0, 0.1, 1.0))), strength(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRENGTH"), 0, 100, 1, 0))), + itera(Gtk::manage(new Adjuster(M("TP_DIRPYRDENOISE_MEDIAN_PASSES"), 1, 4, 1, 1))), + guidbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GUIDBL"), 0, 100, 0, 1))), + epsbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_EPSBL"), 0, 100, 0, 1))), sensibn(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIBN"), 0, 100, 1, 40))), blendmaskbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKCOL"), -100, 100, 1, 0))), radmaskbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADMASKCOL"), 0.0, 100.0, 0.1, 10.))), @@ -368,6 +372,8 @@ Locallab::Locallab(): softMethod(Gtk::manage(new MyComboBoxText())), showmasksoftMethod(Gtk::manage(new MyComboBoxText())), //Blur + blMethod(Gtk::manage(new MyComboBoxText())), + medMethod(Gtk::manage(new MyComboBoxText())), showmaskblMethod(Gtk::manage(new MyComboBoxText())), //TM showmasktmMethod(Gtk::manage(new MyComboBoxText())), @@ -1034,9 +1040,35 @@ Locallab::Locallab(): // Blur & Noise + Gtk::HBox* const BLTitleHBox = Gtk::manage(new Gtk::HBox()); + Gtk::Label* const BLLabel = Gtk::manage(new Gtk::Label()); + BLLabel->set_markup(Glib::ustring("") + escapeHtmlChars(M("TP_LOCALLAB_BLUFR")) + Glib::ustring("")); + BLLabel->set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_CENTER); + BLTitleHBox->pack_start(*BLLabel, Gtk::PACK_EXPAND_WIDGET, 0); + RTImage *BLImage = Gtk::manage(new RTImage("one-to-one-small.png")); + + if (showtooltip) { + BLImage->set_tooltip_text(M("TP_GENERAL_11SCALE_TOOLTIP")); + } + + BLTitleHBox->pack_end(*BLImage, Gtk::PACK_SHRINK, 0); + expblur->setLabel(BLTitleHBox); + expblur->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expblur)); enableblurConn = expblur->signal_enabled_toggled().connect(sigc::bind(sigc::mem_fun(this, &Locallab::enableToggled), expblur)); + blMethod->append(M("TP_LOCALLAB_BLUR")); + blMethod->append(M("TP_LOCALLAB_BLMED")); + blMethod->append(M("TP_LOCALLAB_BLGUID")); + blMethod->set_active(0); + + if (showtooltip) { +// blMethod->set_tooltip_markup(M("TP_LOCALLAB_BLUMETHOD_TOOLTIP")); + } + + blMethodConn = blMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::blMethodChanged)); + + radius->setAdjusterListener(this); strength->setAdjusterListener(this); @@ -1046,6 +1078,11 @@ Locallab::Locallab(): } sensibn->setAdjusterListener(this); + + itera->setAdjusterListener(this); + guidbl->setAdjusterListener(this); + epsbl->setAdjusterListener(this); + setExpandAlignProperties(expmaskbl, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); expmaskbl->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expmaskbl)); expmaskbl->setLevel(2); @@ -1101,6 +1138,18 @@ Locallab::Locallab(): showmaskblMethodConn = showmaskblMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::showmaskblMethodChanged)); + medMethod->append(M("TP_DIRPYRDENOISE_TYPE_3X3")); + medMethod->append(M("TP_DIRPYRDENOISE_TYPE_5X5")); + medMethod->append(M("TP_DIRPYRDENOISE_TYPE_7X7")); + medMethod->append(M("TP_DIRPYRDENOISE_TYPE_9X9")); + + medMethod->set_active(0); + + if (showtooltip) { +// medMethod->set_tooltip_markup(M("TP_LOCALLAB_MEDMETHOD_TOOLTIP")); + } + + medMethodConn = medMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::medMethodChanged)); blurMethod->append(M("TP_LOCALLAB_BLNORM")); @@ -1132,8 +1181,13 @@ Locallab::Locallab(): expmaskbl->add(*maskblBox, false); ToolParamBlock* const blurrBox = Gtk::manage(new ToolParamBlock()); + blurrBox->pack_start(*blMethod); blurrBox->pack_start(*radius); blurrBox->pack_start(*strength); + blurrBox->pack_start(*medMethod); + blurrBox->pack_start(*itera); + blurrBox->pack_start(*guidbl); + blurrBox->pack_start(*epsbl); blurrBox->pack_start(*sensibn); blurrBox->pack_start(*blurMethod); blurrBox->pack_start(*activlum); @@ -2744,6 +2798,27 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).radius = radius->getValue(); pp->locallab.spots.at(pp->locallab.selspot).strength = strength->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).sensibn = sensibn->getIntValue(); + pp->locallab.spots.at(pp->locallab.selspot).itera = itera->getIntValue(); + pp->locallab.spots.at(pp->locallab.selspot).guidbl = guidbl->getIntValue(); + pp->locallab.spots.at(pp->locallab.selspot).epsbl = epsbl->getIntValue(); + + if (blMethod->get_active_row_number() == 0) { + pp->locallab.spots.at(pp->locallab.selspot).blMethod = "blur"; + } else if (blMethod->get_active_row_number() == 1) { + pp->locallab.spots.at(pp->locallab.selspot).blMethod = "med"; + } else if (blMethod->get_active_row_number() == 2) { + pp->locallab.spots.at(pp->locallab.selspot).blMethod = "guid"; + } + + if (medMethod->get_active_row_number() == 0) { + pp->locallab.spots.at(pp->locallab.selspot).medMethod = "33"; + } else if (medMethod->get_active_row_number() == 1) { + pp->locallab.spots.at(pp->locallab.selspot).medMethod = "55"; + } else if (medMethod->get_active_row_number() == 2) { + pp->locallab.spots.at(pp->locallab.selspot).medMethod = "77"; + } else if (medMethod->get_active_row_number() == 3) { + pp->locallab.spots.at(pp->locallab.selspot).medMethod = "99"; + } if (blurMethod->get_active_row_number() == 0) { @@ -3015,7 +3090,12 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).radius = pe->locallab.spots.at(pp->locallab.selspot).radius || radius->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).strength = pe->locallab.spots.at(pp->locallab.selspot).strength || strength->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).sensibn = pe->locallab.spots.at(pp->locallab.selspot).sensibn || sensibn->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).itera = pe->locallab.spots.at(pp->locallab.selspot).itera || itera->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).guidbl = pe->locallab.spots.at(pp->locallab.selspot).guidbl || guidbl->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).epsbl = pe->locallab.spots.at(pp->locallab.selspot).epsbl || epsbl->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).blMethod = pe->locallab.spots.at(pp->locallab.selspot).blMethod || blMethod->get_active_text() != M("GENERAL_UNCHANGED"); pe->locallab.spots.at(pp->locallab.selspot).blurMethod = pe->locallab.spots.at(pp->locallab.selspot).blurMethod || blurMethod->get_active_text() != M("GENERAL_UNCHANGED"); + pe->locallab.spots.at(pp->locallab.selspot).medMethod = pe->locallab.spots.at(pp->locallab.selspot).medMethod || medMethod->get_active_text() != M("GENERAL_UNCHANGED"); pe->locallab.spots.at(pp->locallab.selspot).activlum = pe->locallab.spots.at(pp->locallab.selspot).activlum || !activlum->get_inconsistent(); pe->locallab.spots.at(pp->locallab.selspot).CCmaskblcurve = pe->locallab.spots.at(pp->locallab.selspot).CCmaskblcurve || !CCmaskblshape->isUnChanged(); pe->locallab.spots.at(pp->locallab.selspot).LLmaskblcurve = pe->locallab.spots.at(pp->locallab.selspot).LLmaskblcurve || !LLmaskblshape->isUnChanged(); @@ -3265,7 +3345,12 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).radius = pedited->locallab.spots.at(pp->locallab.selspot).radius || radius->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).strength = pedited->locallab.spots.at(pp->locallab.selspot).strength || strength->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).sensibn = pedited->locallab.spots.at(pp->locallab.selspot).sensibn || sensibn->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).itera = pedited->locallab.spots.at(pp->locallab.selspot).itera || itera->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).guidbl = pedited->locallab.spots.at(pp->locallab.selspot).guidbl || guidbl->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).epsbl = pedited->locallab.spots.at(pp->locallab.selspot).epsbl || epsbl->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).blMethod = pedited->locallab.spots.at(pp->locallab.selspot).blMethod || blMethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->locallab.spots.at(pp->locallab.selspot).blurMethod = pedited->locallab.spots.at(pp->locallab.selspot).blurMethod || blurMethod->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->locallab.spots.at(pp->locallab.selspot).medMethod = pedited->locallab.spots.at(pp->locallab.selspot).medMethod || medMethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->locallab.spots.at(pp->locallab.selspot).activlum = pedited->locallab.spots.at(pp->locallab.selspot).activlum || !activlum->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).CCmaskblcurve = pedited->locallab.spots.at(pp->locallab.selspot).CCmaskblcurve || !CCmaskblshape->isUnChanged(); pedited->locallab.spots.at(pp->locallab.selspot).LLmaskblcurve = pedited->locallab.spots.at(pp->locallab.selspot).LLmaskblcurve || !LLmaskblshape->isUnChanged(); @@ -3759,6 +3844,41 @@ void Locallab::softMethodChanged() } } } +void Locallab::blMethodChanged() +{ + // printf("blMethodChanged\n"); + if (blMethod->get_active_row_number() == 0) { + radius->show(); + strength->show(); + itera->hide(); + medMethod->hide(); + guidbl->hide(); + epsbl->hide(); + activlum->show(); + } else if (blMethod->get_active_row_number() == 1) { + radius->hide(); + strength->hide(); + itera->show(); + medMethod->show(); + guidbl->hide(); + epsbl->hide(); + activlum->show(); + } else if (blMethod->get_active_row_number() == 2) { + radius->hide(); + strength->hide(); + itera->hide(); + medMethod->hide(); + guidbl->show(); + epsbl->show(); + activlum->hide(); + } + + if (getEnabled() && expblur->getEnabled()) { + if (listener) { + listener->panelChanged(EvlocallabblMethod, blMethod->get_active_text()); + } + } +} void Locallab::blurMethodChanged() @@ -3777,6 +3897,16 @@ void Locallab::blurMethodChanged() } } +void Locallab::medMethodChanged() +{ + + if (getEnabled() && expblur->getEnabled()) { + if (listener) { + listener->panelChanged(EvlocallabmedMethod, medMethod->get_active_text()); + } + } +} + void Locallab::qualitycurveMethodChanged() { // printf("qualitycurveMethodChanged\n"); @@ -4759,6 +4889,9 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe radius->setDefault(defSpot->radius); strength->setDefault((double)defSpot->strength); sensibn->setDefault((double)defSpot->sensibn); + itera->setDefault((double)defSpot->itera); + guidbl->setDefault((double)defSpot->guidbl); + epsbl->setDefault((double)defSpot->epsbl); blendmaskbl->setDefault((double)defSpot->blendmaskbl); radmaskbl->setDefault(defSpot->radmaskbl); chromaskbl->setDefault(defSpot->chromaskbl); @@ -4909,6 +5042,9 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe radius->setDefaultEditedState(Irrelevant); strength->setDefaultEditedState(Irrelevant); sensibn->setDefaultEditedState(Irrelevant); + itera->setDefaultEditedState(Irrelevant); + guidbl->setDefaultEditedState(Irrelevant); + epsbl->setDefaultEditedState(Irrelevant); blendmaskbl->setDefaultEditedState(Irrelevant); radmaskbl->setDefaultEditedState(Irrelevant); chromaskbl->setDefaultEditedState(Irrelevant); @@ -5063,6 +5199,9 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe radius->setDefaultEditedState(defSpotState->radius ? Edited : UnEdited); strength->setDefaultEditedState(defSpotState->strength ? Edited : UnEdited); sensibn->setDefaultEditedState(defSpotState->sensibn ? Edited : UnEdited); + itera->setDefaultEditedState(defSpotState->itera ? Edited : UnEdited); + guidbl->setDefaultEditedState(defSpotState->guidbl ? Edited : UnEdited); + epsbl->setDefaultEditedState(defSpotState->epsbl ? Edited : UnEdited); blendmaskbl->setDefaultEditedState(defSpotState->blendmaskbl ? Edited : UnEdited); radmaskbl->setDefaultEditedState(defSpotState->radmaskbl ? Edited : UnEdited); chromaskbl->setDefaultEditedState(defSpotState->chromaskbl ? Edited : UnEdited); @@ -5559,6 +5698,24 @@ void Locallab::adjusterChanged(Adjuster * a, double newval) } } + if (a == itera) { + if (listener) { + listener->panelChanged(Evlocallabitera, itera->getTextValue()); + } + } + + if (a == guidbl) { + if (listener) { + listener->panelChanged(Evlocallabguidbl, guidbl->getTextValue()); + } + } + + if (a == epsbl) { + if (listener) { + listener->panelChanged(Evlocallabepsbl, epsbl->getTextValue()); + } + } + if (a == blendmaskbl) { if (listener) { listener->panelChanged(Evlocallabblendmaskbl, blendmaskbl->getTextValue()); @@ -6139,6 +6296,9 @@ void Locallab::setBatchMode(bool batchMode) streng->showEditedCB(); strength->showEditedCB(); sensibn->showEditedCB(); + itera->showEditedCB(); + guidbl->showEditedCB(); + epsbl->showEditedCB(); blendmaskbl->showEditedCB(); radmaskbl->showEditedCB(); chromaskbl->showEditedCB(); @@ -6231,7 +6391,9 @@ void Locallab::setBatchMode(bool batchMode) // softlight softMethod->append(M("GENERAL_UNCHANGED")); // Blur & Noise + blMethod->append(M("GENERAL_UNCHANGED")); blurMethod->append(M("GENERAL_UNCHANGED")); + medMethod->append(M("GENERAL_UNCHANGED")); // Retinex retinexMethod->append(M("GENERAL_UNCHANGED")); @@ -6411,7 +6573,9 @@ void Locallab::enableListener() showmasksoftMethodConn.block(false); // Blur & Noise enableblurConn.block(false); + blMethodConn.block(false); blurMethodConn.block(false); + medMethodConn.block(false); activlumConn.block(false); enablMaskConn.block(false); showmaskblMethodConn.block(false); @@ -6479,7 +6643,9 @@ void Locallab::disableListener() showmasksoftMethodConn.block(true); // Blur & Noise enableblurConn.block(true); + blMethodConn.block(true); blurMethodConn.block(true); + medMethodConn.block(true); activlumConn.block(true); enablMaskConn.block(true); showmaskblMethodConn.block(true); @@ -6652,6 +6818,17 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con radius->setValue(pp->locallab.spots.at(index).radius); strength->setValue(pp->locallab.spots.at(index).strength); sensibn->setValue(pp->locallab.spots.at(index).sensibn); + itera->setValue(pp->locallab.spots.at(index).itera); + guidbl->setValue(pp->locallab.spots.at(index).guidbl); + epsbl->setValue(pp->locallab.spots.at(index).epsbl); + + if (pp->locallab.spots.at(index).blMethod == "blur") { + blMethod->set_active(0); + } else if (pp->locallab.spots.at(index).blMethod == "med") { + blMethod->set_active(1); + } else if (pp->locallab.spots.at(index).blMethod == "guid") { + blMethod->set_active(2); + } if (pp->locallab.spots.at(index).blurMethod == "norm") { blurMethod->set_active(0); @@ -6661,6 +6838,16 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con // expmaskbl->hide(); } + if (pp->locallab.spots.at(index).medMethod == "33") { + medMethod->set_active(0); + } else if (pp->locallab.spots.at(index).medMethod == "55") { + medMethod->set_active(1); + } else if (pp->locallab.spots.at(index).medMethod == "77") { + medMethod->set_active(2); + } else if (pp->locallab.spots.at(index).medMethod == "99") { + medMethod->set_active(3); + } + activlum->set_active(pp->locallab.spots.at(index).activlum); CCmaskblshape->setCurve(pp->locallab.spots.at(index).CCmaskblcurve); LLmaskblshape->setCurve(pp->locallab.spots.at(index).LLmaskblcurve); @@ -6955,11 +7142,22 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con radius->setEditedState(spotState->radius ? Edited : UnEdited); strength->setEditedState(spotState->strength ? Edited : UnEdited); sensibn->setEditedState(spotState->sensibn ? Edited : UnEdited); + itera->setEditedState(spotState->itera ? Edited : UnEdited); + guidbl->setEditedState(spotState->guidbl ? Edited : UnEdited); + epsbl->setEditedState(spotState->epsbl ? Edited : UnEdited); + + if (!spotState->blMethod) { + blMethod->set_active_text(M("GENERAL_UNCHANGED")); + } if (!spotState->blurMethod) { blurMethod->set_active_text(M("GENERAL_UNCHANGED")); } + if (!spotState->medMethod) { + medMethod->set_active_text(M("GENERAL_UNCHANGED")); + } + activlum->set_inconsistent(multiImage && !spotState->activlum); CCmaskblshape->setUnChanged(!spotState->CCmaskblcurve); LLmaskblshape->setUnChanged(!spotState->LLmaskblcurve); @@ -7226,6 +7424,32 @@ void Locallab::updateSpecificGUIState() pdeFrame->show(); } + if (blMethod->get_active_row_number() == 0) { + radius->show(); + strength->show(); + itera->hide(); + medMethod->hide(); + guidbl->hide(); + epsbl->hide(); + activlum->show(); + } else if (blMethod->get_active_row_number() == 1) { + radius->hide(); + strength->hide(); + itera->show(); + medMethod->show(); + guidbl->hide(); + epsbl->hide(); + activlum->show(); + } else if (blMethod->get_active_row_number() == 2) { + radius->hide(); + strength->hide(); + itera->hide(); + medMethod->hide(); + guidbl->show(); + epsbl->show(); + activlum->hide(); + } + // Update Retinex GUI according to inversret button state (to be compliant with inversretChanged function) if (multiImage && inversret->get_inconsistent()) { sensih->show(); diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 082ab2588..a56ce37a2 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -183,6 +183,9 @@ private: // Blur & Noise Adjuster* const radius; Adjuster* const strength; + Adjuster* const itera; + Adjuster* const guidbl; + Adjuster* const epsbl; Adjuster* const sensibn; Adjuster* const blendmaskbl; Adjuster* const radmaskbl; @@ -346,6 +349,10 @@ private: MyComboBoxText* const showmasksoftMethod; sigc::connection showmasksoftMethodConn; //Blur and noise + MyComboBoxText* const blMethod; + sigc::connection blMethodConn; + MyComboBoxText* const medMethod; + sigc::connection medMethodConn; MyComboBoxText* const showmaskblMethod; sigc::connection showmaskblMethodConn; //TM @@ -442,12 +449,14 @@ private: //Shadows Highlight void showmaskSHMethodChanged(); // Blur & Noise - void blurMethodChanged(); + void blMethodChanged(); + void medMethodChanged(); // Soft light void softMethodChanged(); void showmasksoftMethodChanged(); //Blur void showmaskblMethodChanged(); + void blurMethodChanged(); //TM void showmasktmMethodChanged(); // Retinex diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index fe5fdeb61..e502dace5 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1054,7 +1054,12 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).radius = locallab.spots.at(j).radius && pSpot.radius == otherSpot.radius; locallab.spots.at(j).strength = locallab.spots.at(j).strength && pSpot.strength == otherSpot.strength; locallab.spots.at(j).sensibn = locallab.spots.at(j).sensibn && pSpot.sensibn == otherSpot.sensibn; + locallab.spots.at(j).itera = locallab.spots.at(j).itera && pSpot.itera == otherSpot.itera; + locallab.spots.at(j).guidbl = locallab.spots.at(j).guidbl && pSpot.guidbl == otherSpot.guidbl; + locallab.spots.at(j).epsbl = locallab.spots.at(j).epsbl && pSpot.epsbl == otherSpot.epsbl; + locallab.spots.at(j).blMethod = locallab.spots.at(j).blMethod && pSpot.blMethod == otherSpot.blMethod; locallab.spots.at(j).blurMethod = locallab.spots.at(j).blurMethod && pSpot.blurMethod == otherSpot.blurMethod; + locallab.spots.at(j).medMethod = locallab.spots.at(j).medMethod && pSpot.medMethod == otherSpot.medMethod; locallab.spots.at(j).activlum = locallab.spots.at(j).activlum && pSpot.activlum == otherSpot.activlum; locallab.spots.at(j).CCmaskblcurve = locallab.spots.at(j).CCmaskblcurve && pSpot.CCmaskblcurve == otherSpot.CCmaskblcurve; locallab.spots.at(j).LLmaskblcurve = locallab.spots.at(j).LLmaskblcurve && pSpot.LLmaskblcurve == otherSpot.LLmaskblcurve; @@ -3073,10 +3078,30 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).sensibn = mods.locallab.spots.at(i).sensibn; } + if (locallab.spots.at(i).itera) { + toEdit.locallab.spots.at(i).itera = mods.locallab.spots.at(i).itera; + } + + if (locallab.spots.at(i).guidbl) { + toEdit.locallab.spots.at(i).guidbl = mods.locallab.spots.at(i).guidbl; + } + + if (locallab.spots.at(i).epsbl) { + toEdit.locallab.spots.at(i).epsbl = mods.locallab.spots.at(i).epsbl; + } + + if (locallab.spots.at(i).blMethod) { + toEdit.locallab.spots.at(i).blMethod = mods.locallab.spots.at(i).blMethod; + } + if (locallab.spots.at(i).blurMethod) { toEdit.locallab.spots.at(i).blurMethod = mods.locallab.spots.at(i).blurMethod; } + if (locallab.spots.at(i).medMethod) { + toEdit.locallab.spots.at(i).medMethod = mods.locallab.spots.at(i).medMethod; + } + if (locallab.spots.at(i).activlum) { toEdit.locallab.spots.at(i).activlum = mods.locallab.spots.at(i).activlum; } @@ -4604,7 +4629,12 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : radius(v), strength(v), sensibn(v), + itera(v), + guidbl(v), + epsbl(v), + blMethod(v), blurMethod(v), + medMethod(v), activlum(v), CCmaskblcurve(v), LLmaskblcurve(v), @@ -4846,7 +4876,12 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) radius = v; strength = v; sensibn = v; + itera = v; + guidbl = v; + epsbl = v; + blMethod = v; blurMethod = v; + medMethod = v; activlum = v; CCmaskblcurve = v; LLmaskblcurve = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 77a13520b..70f7ffc8b 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -477,7 +477,12 @@ public: bool radius; bool strength; bool sensibn; + bool itera; + bool guidbl; + bool epsbl; + bool blMethod; bool blurMethod; + bool medMethod; bool activlum; bool CCmaskblcurve; bool LLmaskblcurve;