diff --git a/rtdata/languages/default b/rtdata/languages/default index d4e268a38..5b7a358db 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1274,6 +1274,10 @@ HISTORY_MSG_1026;Local - cbdl recovery threshold HISTORY_MSG_1027;Local - cbdl threshold mask low HISTORY_MSG_1028;Local - cbdl threshold mask high HISTORY_MSG_1029;Local - cbdl decay +HISTORY_MSG_1030;Local - reti recovery threshold +HISTORY_MSG_1031;Local - reti threshold mask low +HISTORY_MSG_1032;Local - reti threshold mask high +HISTORY_MSG_1033;Local - reti decay HISTORY_MSG_BLSHAPE;Blur by level HISTORY_MSG_BLURCWAV;Blur chroma HISTORY_MSG_BLURWAV;Blur luminance @@ -2815,6 +2819,7 @@ TP_LOCALLAB_MASKRECOL_TOOLTIP;Used to modulate the effect of the Color and Light TP_LOCALLAB_MASKREEXP_TOOLTIP;Used to modulate the effect of the 'Dynamic range and Exposure' settings based on the image luminance information contained in the L(L) or LC(H) masks (Mask and modifications).\n The L(L) mask or the LC(H) mask must be enabled to use this function.\n The ‘dark’ and ‘light’ areas below the dark threshold and above the light threshold will be restored progressively to their original values prior to being modified by the 'Dynamic range and Exposure' settings \n In between these two areas, the full value of the 'Dynamic range and Exposure' settings will be applied TP_LOCALLAB_MASKRESH_TOOLTIP;Used to modulate the effect of the Shadows Highlights settings based on the image luminance information contained in the L(L) or LC(H) masks (Mask and modifications).\n The L(L) mask or the LC(H) mask must be enabled to use this function.\n The ‘dark’ and ‘light’ areas below the dark threshold and above the light threshold will be restored progressively to their original values prior to being modified by the Shadows Highlights settings \n In between these two areas, the full value of the Shadows Highlights settings will be applied TP_LOCALLAB_MASKRESCB_TOOLTIP;Used to modulate the effect of the CBDL (Luminance only) settings based on the image luminance information contained in the L(L) or LC(H) masks (Mask and modifications).\n The L(L) mask or the LC(H) mask must be enabled to use this function.\n The ‘dark’ and ‘light’ areas below the dark threshold and above the light threshold will be restored progressively to their original values prior to being modified by the CBDL settings \n In between these two areas, the full value of the CBDL settings will be applied +TP_LOCALLAB_MASKRESRETI_TOOLTIP;Used to modulate the effect of the Retinex (Luminance only) settings based on the image luminance information contained in the L(L) or LC(H) masks (Mask and modifications).\n The L(L) mask or the LC(H) mask must be enabled to use this function.\n The ‘dark’ and ‘light’ areas below the dark threshold and above the light threshold will be restored progressively to their original values prior to being modified by the Retinex settings \n In between these two areas, the full value of the Retinex settings will be applied TP_LOCALLAB_MASKRESTM_TOOLTIP;Used to modulate the effect of the Tone Mapping settings based on the image luminance information contained in the L(L) or LC(H) masks (Mask and modifications).\n The L(L) mask or the LC(H) mask must be enabled to use this function.\n The ‘dark’ and ‘light’ areas below the dark threshold and above the light threshold will be restored progressively to their original values prior to being modified by the Tone Mapping settings \n In between these two areas, the full value of the Tone Mapping settings will be applied TP_LOCALLAB_MASKRESVIB_TOOLTIP;Used to modulate the effect of the Vibrance and Warm Cool settings based on the image luminance information contained in the L(L) or LC(H) masks (Mask and modifications).\n The L(L) mask or the LC(H) mask must be enabled to use this function.\n The ‘dark’ and ‘light’ areas below the dark threshold and above the light threshold will be restored progressively to their original values prior to being modified by the Vibrance and Warm Cool settings \n In between these two areas, the full value of the Vibrance and Warm Cool settings will be applied TP_LOCALLAB_MASKRESWAV_TOOLTIP;Used to modulate the effect of the Local contrast and Wavelet settings based on the image luminance information contained in the L(L) or LC(H) masks (Mask and modifications).\n The L(L) mask or the LC(H) mask must be enabled to use this function.\n The ‘dark’ and ‘light’ areas below the dark threshold and above the light threshold will be restored progressively to their original values prior to being modified by the Local contrast and Wavelet settings \n In between these two areas, the full value of the Local contrast and Wavelet settings will be applied @@ -2823,6 +2828,7 @@ TP_LOCALLAB_MASKDEINV_TOOLTIP;Reverses the way the algorithm interprets the mask TP_LOCALLAB_MASKHIGTHRESC_TOOLTIP;Light-tone limit above which Color and Light will be restored progressively to their original values prior to being modified by the Color and Light settings .\n You can use certain tools in ‘Mask and modifications’ to change the gray levels: ‘structure mask’, 'Blur mask', ‘Smooth radius’, ‘Gamma and slope’, ‘Contrast curve’, ‘Local contrast wavelet’.\n Use a ‘lockable color picker’ on the mask to see which areas will be affected. Be carefull in 'settings' to Background color mask = 0 TP_LOCALLAB_MASKHIGTHRESS_TOOLTIP;Light-tone limit above which Shadows Highlights will be restored progressively to their original values prior to being modified by the Shadows Highlights settings .\n You can use certain tools in ‘Mask and modifications’ to change the gray levels:‘Smooth radius’, ‘Gamma and slope’, ‘Contrast curve’.\n Use a ‘lockable color picker’ on the mask to see which areas will be affected. Be carefull in 'settings' to Background color mask = 0 TP_LOCALLAB_MASKHIGTHRESCB_TOOLTIP;Light-tone limit above which CBDL (Luminance only) will be restored progressively to their original values prior to being modified by the CBDL settings .\n You can use certain tools in ‘Mask and modifications’ to change the gray levels:‘Smooth radius’, ‘Gamma and slope’, ‘Contrast curve’.\n Use a ‘lockable color picker’ on the mask to see which areas will be affected. Be carefull in 'settings' to Background color mask = 0 +TP_LOCALLAB_MASKHIGTHRESRETI_TOOLTIP;Light-tone limit above which Retinex (Luminance only) will be restored progressively to their original values prior to being modified by the Retinex settings .\n You can use certain tools in ‘Mask and modifications’ to change the gray levels:‘Smooth radius’, ‘Gamma and slope’, ‘Contrast curve’.\n Use a ‘lockable color picker’ on the mask to see which areas will be affected. Be carefull in 'settings' to Background color mask = 0 TP_LOCALLAB_MASKHIGTHRESTM_TOOLTIP;Light-tone limit above which Tone Mapping will be restored progressively to their original values prior to being modified by the Tone Mapping settings .\n You can use certain tools in ‘Mask and modifications’ to change the gray levels:‘Smooth radius’, ‘Gamma and slope’, ‘Contrast curve’.\n Use a ‘lockable color picker’ on the mask to see which areas will be affected. Be carefull in 'settings' to Background color mask = 0 TP_LOCALLAB_MASKHIGTHRESVIB_TOOLTIP;Light-tone limit above which Vibrance and Warm Cool will be restored progressively to their original values prior to being modified by the Vibrance and Warm Cool settings .\n You can use certain tools in ‘Mask and modifications’ to change the gray levels:‘Smooth radius’, ‘Gamma and slope’, ‘Contrast curve’.\n Use a ‘lockable color picker’ on the mask to see which areas will be affected. Be carefull in 'settings' to Background color mask = 0 TP_LOCALLAB_MASKHIGTHRESWAV_TOOLTIP;Light-tone limit above which Local contrast and Wavelet will be restored progressively to their original values prior to being modified by the Local contrast and Wavelet settings .\n You can use certain tools in ‘Mask and modifications’ to change the gray levels:‘Smooth radius’, ‘Gamma and slope’, ‘Contrast curve’.\n Use a ‘lockable color picker’ on the mask to see which areas will be affected. Be carefull in 'settings' to Background color mask = 0 @@ -2840,6 +2846,7 @@ TP_LOCALLAB_MASKLOWTHRESL_TOOLTIP;Dark-tone limit below which Log encoding will TP_LOCALLAB_MASKLOWTHRESE_TOOLTIP;Dark-tone limit below which 'Dynamic range and Exposure' will be restored progressively to their original values prior to being modified by the 'Dynamic range and Exposure' settings.\n You can use certain tools in ‘Mask and modifications’ to change the gray levels: ‘Smooth radius’, ‘Gamma and slope’, ‘Contrast curve’.\n Use a ‘lockable color picker’ on the mask to see which areas will be affected. Be carefull in 'settings' to Background color mask = 0 TP_LOCALLAB_MASKLOWTHRESS_TOOLTIP;Dark-tone limit below which Shadows Highligts will be restored progressively to their original values prior to being modified by the Shadows Highlights settings.\n You can use certain tools in ‘Mask and modifications’ to change the gray levels: ‘Smooth radius’, ‘Gamma and slope’, ‘Contrast curve’.\n Use a ‘lockable color picker’ on the mask to see which areas will be affected. Be carefull in 'settings' to Background color mask = 0 TP_LOCALLAB_MASKLOWTHRESCB_TOOLTIP;Dark-tone limit below which CBDL (Luminance only) will be restored progressively to their original values prior to being modified by the CBDL settings.\n You can use certain tools in ‘Mask and modifications’ to change the gray levels: ‘Smooth radius’, ‘Gamma and slope’, ‘Contrast curve’.\n Use a ‘lockable color picker’ on the mask to see which areas will be affected. Be carefull in 'settings' to Background color mask = 0 +TP_LOCALLAB_MASKLOWTHRESRETI_TOOLTIP;Dark-tone limit below which Retinex (Luminance only) will be restored progressively to their original values prior to being modified by the Retinex settings.\n You can use certain tools in ‘Mask and modifications’ to change the gray levels: ‘Smooth radius’, ‘Gamma and slope’, ‘Contrast curve’.\n Use a ‘lockable color picker’ on the mask to see which areas will be affected. Be carefull in 'settings' to Background color mask = 0 TP_LOCALLAB_MASKLOWTHRESTM_TOOLTIP;Dark-tone limit below which Tone Mapping will be restored progressively to their original values prior to being modified by the Tone Mapping settings.\n You can use certain tools in ‘Mask and modifications’ to change the gray levels: ‘Smooth radius’, ‘Gamma and slope’, ‘Contrast curve’.\n Use a ‘lockable color picker’ on the mask to see which areas will be affected. Be carefull in 'settings' to Background color mask = 0 TP_LOCALLAB_MASKLOWTHRESVIB_TOOLTIP;Dark-tone limit below which Vibrance and Warm Cool will be restored progressively to their original values prior to being modified by the Vibrance and Warm Cool settings.\n You can use certain tools in ‘Mask and modifications’ to change the gray levels: ‘Smooth radius’, ‘Gamma and slope’, ‘Contrast curve’.\n Use a ‘lockable color picker’ on the mask to see which areas will be affected. Be carefull in 'settings' to Background color mask = 0 TP_LOCALLAB_MASKLOWTHRESWAV_TOOLTIP;Dark-tone limit below which Local contrast and Wavelet will be restored progressively to their original values prior to being modified by the Local contrast and Wavelet settings.\n You can use certain tools in ‘Mask and modifications’ to change the gray levels: ‘Smooth radius’, ‘Gamma and slope’, ‘Contrast curve’.\n Use a ‘lockable color picker’ on the mask to see which areas will be affected. Be carefull in 'settings' to Background color mask = 0 diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 375d506ce..4915e04e6 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -266,7 +266,7 @@ public: const LocCCmaskCurve & locccmasretiCurve, bool lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool lhmasretiutili, int llretiMask, bool retiMasktmap, bool retiMask, float rad, float lap, bool pde, float gamm, float slop, float chro, float blend, const LUTf & lmaskretilocalcurve, bool localmaskretiutili, - LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, bool multiThread, + LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, LabImage * bufmaskorigreti, bool multiThread, bool delt, const float hueref, const float chromaref, const float lumaref, float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope, float balance, float balanceh, float lumask); @@ -275,7 +275,7 @@ public: void log_encode(Imagefloat *rgb, struct local_params & lp, bool multiThread, int bfw, int bfh); void getAutoLogloc(int sp, ImageSource *imgsrc, float *sourceg, float *blackev, float *whiteev, bool *Autogr, float *sourceab, int fw, int fh, float xsta, float xend, float ysta, float yend, int SCALE); - void MSRLocal(int call, int sp, bool fftw, int lum, float** reducDE, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, float** luminance, const float* const *originalLuminance, + void MSRLocal(int call, int sp, bool fftw, int lum, float** reducDE, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, LabImage * bufmaskorigreti, float** luminance, const float* const *originalLuminance, const int width, const int height, int bfwr, int bfhr, const procparams::LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const LocretitransCurve &locRETtransCcurve, const int chrome, const int scall, const float krad, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, const LocCCmaskCurve & locccmasretiCurve, bool lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool lhmasretiutili, int llretiMask, diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 79c84f648..820e8c352 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -612,6 +612,10 @@ struct local_params { float lowthrw; float higthrw; float decayw; + float recothrr; + float lowthrr; + float higthrr; + float decayr; float recothrs; float lowthrs; float higthrs; @@ -1106,9 +1110,14 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall float local_recothrcb = (float)locallab.spots.at(sp).recothrescb; float local_lowthrcb = (float)locallab.spots.at(sp).lowthrescb; - float local_higthrcb = (float)locallab.spots.at(sp).higthresv; + float local_higthrcb = (float)locallab.spots.at(sp).higthrescb; float local_decaycb = (float)locallab.spots.at(sp).decaycb; + float local_recothrr = (float)locallab.spots.at(sp).recothresr; + float local_lowthrr = (float)locallab.spots.at(sp).lowthresr; + float local_higthrr = (float)locallab.spots.at(sp).higthresr; + float local_decayr = (float)locallab.spots.at(sp).decayr; + float local_recothrt = (float)locallab.spots.at(sp).recothrest; float local_lowthrt = (float)locallab.spots.at(sp).lowthrest; float local_higthrt = (float)locallab.spots.at(sp).higthrest; @@ -1512,6 +1521,10 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.lowthrcb = local_lowthrcb; lp.higthrcb = local_higthrcb; lp.decaycb = local_decaycb; + lp.recothrr = local_recothrr; + lp.lowthrr = local_lowthrr; + lp.higthrr = local_higthrr; + lp.decayr = local_decayr; lp.recothrl = local_recothrl; lp.lowthrl = local_lowthrl; @@ -13513,6 +13526,7 @@ void ImProcFunctions::Lab_Local( LabImage *bufmask = nullptr; LabImage *buforig = nullptr; LabImage *buforigmas = nullptr; + LabImage *bufmaskorigreti = nullptr; if (GW >= mSP && GH >= mSP) @@ -13527,10 +13541,12 @@ void ImProcFunctions::Lab_Local( bufreti = new LabImage(GW, GH); bufmask = new LabImage(GW, GH); + bufmaskorigreti = new LabImage(GW, GH); if (!lp.enaretiMasktmap && lp.enaretiMask) { buforig = new LabImage(GW, GH); buforigmas = new LabImage(GW, GH); + // bufmaskorigreti = new LabImage(GW, GH); } #ifdef _OPENMP @@ -13557,14 +13573,21 @@ void ImProcFunctions::Lab_Local( bufmask->a[y][x] = original->a[y][x]; bufmask->b[y][x] = original->b[y][x]; + + if (!lp.enaretiMasktmap && lp.enaretiMask) { buforig->L[y][x] = original->L[y][x]; buforig->a[y][x] = original->a[y][x]; buforig->b[y][x] = original->b[y][x]; + + // bufmaskorigreti->L[y][x] = original->L[y][x]; + // bufmaskorigreti->a[y][x] = original->a[y][x]; + // bufmaskorigreti->b[y][x] = original->b[y][x]; + + } } - float raddE = params->locallab.spots.at(sp).softradiusret; //calc dE and reduction to use in MSR to reduce artifacts @@ -13620,7 +13643,7 @@ void ImProcFunctions::Lab_Local( const float maxdE2 = 5.f + MAXSCOPE * sco * (1 + 0.1f * lp.thr); const float mindElim2 = 2.f + MINSCOPE * limscope * lp.thr; const float maxdElim2 = 5.f + MAXSCOPE * limscope * (1 + 0.1f * lp.thr); - ImProcFunctions::MSRLocal(call, sp, fftw, 1, reducDE, bufreti, bufmask, buforig, buforigmas, orig, orig1, + ImProcFunctions::MSRLocal(call, sp, fftw, 1, reducDE, bufreti, bufmask, buforig, buforigmas, bufmaskorigreti, orig, orig1, Wd, Hd, Wd, Hd, params->locallab, sk, locRETgainCcurve, locRETtransCcurve, 0, 4, 1.f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, llretiMask, lmaskretilocalcurve, localmaskretiutili, @@ -13661,6 +13684,14 @@ void ImProcFunctions::Lab_Local( delete [] data; } + if(lp.enaretiMask && lp.recothrr != 1.f) { + float hig = lp.higthrr; + float low = lp.lowthrr; + float recoth = lp.recothrr; + float decay = lp.decayr; + bool invmask = false; + maskrecov(tmpl, original, bufmaskorigreti, Hd, Wd, 0, 0, hig, low, recoth, decay, invmask, sk, multiThread); + } float minL = tmpl->L[0][0] - bufreti->L[0][0]; float maxL = minL; @@ -13796,6 +13827,7 @@ void ImProcFunctions::Lab_Local( delete tmpl; delete bufmask; + delete bufmaskorigreti; if (!lp.enaretiMasktmap && lp.enaretiMask) { if (buforig) { @@ -13824,6 +13856,7 @@ void ImProcFunctions::Lab_Local( LabImage *bufmask = nullptr; LabImage *buforig = nullptr; LabImage *buforigmas = nullptr; + LabImage *bufmaskorigreti = nullptr; int bfhr = bfh; int bfwr = bfw; @@ -13845,6 +13878,7 @@ void ImProcFunctions::Lab_Local( Wd = bfw; bufreti = new LabImage(bfw, bfh); bufmask = new LabImage(bfw, bfh); + bufmaskorigreti = new LabImage(bfw, bfh); if (!lp.enaretiMasktmap && lp.enaretiMask) { buforig = new LabImage(bfw, bfh); @@ -13945,7 +13979,7 @@ void ImProcFunctions::Lab_Local( const float mindElim2 = 2.f + MINSCOPE * limscope * lp.thr; const float maxdElim2 = 5.f + MAXSCOPE * limscope * (1 + 0.1f * lp.thr); - ImProcFunctions::MSRLocal(call, sp, fftw, 1, reducDE, bufreti, bufmask, buforig, buforigmas, orig, orig1, + ImProcFunctions::MSRLocal(call, sp, fftw, 1, reducDE, bufreti, bufmask, buforig, buforigmas, bufmaskorigreti, orig, orig1, Wd, Hd, bfwr, bfhr, params->locallab, sk, locRETgainCcurve, locRETtransCcurve, 0, 4, 1.f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, llretiMask, lmaskretilocalcurve, localmaskretiutili, @@ -13985,6 +14019,14 @@ void ImProcFunctions::Lab_Local( } } } + if(lp.enaretiMask && lp.recothrr != 1.f) { + float hig = lp.higthrr; + float low = lp.lowthrr; + float recoth = lp.recothrr; + float decay = lp.decayr; + bool invmask = false; + maskrecov(tmpl, original, bufmaskorigreti, Hd, Wd, ystart, xstart, hig, low, recoth, decay, invmask, sk, multiThread); + } if (!lp.invret) { float minL = tmpl->L[0][0] - bufreti->L[0][0]; @@ -14123,7 +14165,8 @@ void ImProcFunctions::Lab_Local( delete tmpl; delete bufmask; - + delete bufmaskorigreti; + if (!lp.enaretiMasktmap && lp.enaretiMask) { if (buforig) { delete buforig; diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index d65bf1cad..b3b28d3ad 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -782,7 +782,7 @@ void ImProcFunctions::maskforretinex(int sp, int before, float ** luminance, flo const LocCCmaskCurve & locccmasretiCurve, bool lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool lhmasretiutili, int llretiMask, bool retiMasktmap, bool retiMask, float rad, float lap, bool pde, float gamm, float slop, float chro, float blend, const LUTf & lmaskretilocalcurve, bool localmaskretiutili, - LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, bool multiThread, + LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, LabImage * bufmaskorigreti, bool multiThread, bool delt, const float hueref, const float chromaref, const float lumaref, float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope, float balance, float balanceh, float lumask) { @@ -793,11 +793,10 @@ void ImProcFunctions::maskforretinex(int sp, int before, float ** luminance, flo array2D guid(W_L, H_L); std::unique_ptr bufmaskblurreti; bufmaskblurreti.reset(new LabImage(W_L, H_L)); - std::unique_ptr bufmaskorigreti; - bufmaskorigreti.reset(new LabImage(W_L, H_L)); +// std::unique_ptr bufmaskorigreti; +// bufmaskorigreti.reset(new LabImage(W_L, H_L)); std::unique_ptr bufprov; bufprov.reset(new LabImage(W_L, H_L)); - #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif @@ -1124,7 +1123,7 @@ void ImProcFunctions::maskforretinex(int sp, int before, float ** luminance, flo -void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** reducDE, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, float** luminance, const float* const *originalLuminance, +void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** reducDE, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, LabImage * bufmaskorigreti, float** luminance, const float* const *originalLuminance, const int width, const int height, int bfwr, int bfhr, const procparams::LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const LocretitransCurve &locRETtransCcurve, const int chrome, const int scall, const float krad, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, const LocCCmaskCurve & locccmasretiCurve, bool lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool lhmasretiutili, int llretiMask, @@ -1614,7 +1613,7 @@ void ImProcFunctions::MSRLocal(int call, int sp, bool fftw, int lum, float** red locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, llretiMask, retiMasktmap, retiMask, rad, lap, pde, gamm, slop, chro, blend, lmaskretilocalcurve, localmaskretiutili, - bufreti, bufmask, buforig, buforigmas, multiThread, + bufreti, bufmask, buforig, buforigmas, bufmaskorigreti, multiThread, delt, hueref, chromaref, lumaref, maxdE, mindE, maxdElim, mindElim, iterat, limscope, scope, balance, balanceh, lumask ); diff --git a/rtengine/procevents.h b/rtengine/procevents.h index a324d7fe0..00f2d1916 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -1052,6 +1052,10 @@ enum ProcEventCode { Evlocallablowthrescb = 1026, Evlocallabhigthrescb = 1027, Evlocallabdecaycb = 1028, + Evlocallabrecothresr = 1029, + Evlocallablowthresr = 1030, + Evlocallabhigthresr = 1031, + Evlocallabdecayr = 1032, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 50a2f5c6c..e77a4c57a 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3664,6 +3664,10 @@ LocallabParams::LocallabSpot::LocallabSpot() : 1.0, 1.0 }, + recothresr(1.), + lowthresr(12.), + higthresr(85.), + decayr(2.), // Sharpening visisharp(false), expsharp(false), @@ -4529,6 +4533,10 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && cliptm == other.cliptm && fftwreti == other.fftwreti && Lmaskreticurve == other.Lmaskreticurve + && recothresr == other.recothresr + && lowthresr == other.lowthresr + && higthresr == other.higthresr + && decayr == other.decayr // Sharpening && visisharp == other.visisharp && expsharp == other.expsharp @@ -6160,6 +6168,10 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->cliptm, "Locallab", "Cliptm_" + index_str, spot.cliptm, keyFile); saveToKeyfile(!pedited || spot_edited->fftwreti, "Locallab", "Fftwreti_" + index_str, spot.fftwreti, keyFile); saveToKeyfile(!pedited || spot_edited->Lmaskreticurve, "Locallab", "LmaskretiCurve_" + index_str, spot.Lmaskreticurve, keyFile); + saveToKeyfile(!pedited || spot_edited->recothresr, "Locallab", "Recothresr_" + index_str, spot.recothresr, keyFile); + saveToKeyfile(!pedited || spot_edited->lowthresr, "Locallab", "Lowthresr_" + index_str, spot.lowthresr, keyFile); + saveToKeyfile(!pedited || spot_edited->higthresr, "Locallab", "Higthresr_" + index_str, spot.higthresr, keyFile); + saveToKeyfile(!pedited || spot_edited->decayr, "Locallab", "Decayr_" + index_str, spot.decayr, keyFile); } // Sharpening if ((!pedited || spot_edited->visisharp) && spot.visisharp) { @@ -8020,6 +8032,10 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Cliptm_" + index_str, pedited, spot.cliptm, spotEdited.cliptm); assignFromKeyfile(keyFile, "Locallab", "Fftwreti_" + index_str, pedited, spot.fftwreti, spotEdited.fftwreti); assignFromKeyfile(keyFile, "Locallab", "LmaskretiCurve_" + index_str, pedited, spot.Lmaskreticurve, spotEdited.Lmaskreticurve); + assignFromKeyfile(keyFile, "Locallab", "Recothresr_" + index_str, pedited, spot.recothresr, spotEdited.recothresr); + assignFromKeyfile(keyFile, "Locallab", "Lowthresr_" + index_str, pedited, spot.lowthresr, spotEdited.lowthresr); + assignFromKeyfile(keyFile, "Locallab", "Higthresr_" + index_str, pedited, spot.higthresr, spotEdited.higthresr); + assignFromKeyfile(keyFile, "Locallab", "Decayr_" + index_str, pedited, spot.decayr, spotEdited.decayr); // Sharpening spot.visisharp = assignFromKeyfile(keyFile, "Locallab", "Expsharp_" + index_str, pedited, spot.expsharp, spotEdited.expsharp); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index c0ddfc0f0..4efe4c2fc 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1349,6 +1349,10 @@ struct LocallabParams { double cliptm; bool fftwreti; std::vector Lmaskreticurve; + double recothresr; + double lowthresr; + double higthresr; + double decayr; // Sharpening bool visisharp; bool expsharp; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 0d08b253a..742aa3707 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -1055,7 +1055,11 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // Evlocallabrecothrecb LUMINANCECURVE, // Evlocallablowthrescb LUMINANCECURVE, // Evlocallabhigthrescb - LUMINANCECURVE // Evlocallabdecaycb + LUMINANCECURVE, // Evlocallabdecaycb + LUMINANCECURVE, // Evlocallabrecothrer + LUMINANCECURVE, // Evlocallablowthresr + LUMINANCECURVE, // Evlocallabhigthresr + LUMINANCECURVE // Evlocallabdecayr }; diff --git a/rtgui/locallabtools.h b/rtgui/locallabtools.h index 68fb80071..d8fb1ab29 100644 --- a/rtgui/locallabtools.h +++ b/rtgui/locallabtools.h @@ -930,6 +930,13 @@ private: Gtk::Label* const transLabels2; CurveEditorGroup* const LocalcurveEditorgainT; FlatCurveEditor* const cTgainshape; + MyExpander* const exprecovr; + Gtk::Label* const maskusabler; + Gtk::Label* const maskunusabler; + Adjuster* const recothresr; + Adjuster* const lowthresr; + Adjuster* const higthresr; + Adjuster* const decayr; MyExpander* const expmaskreti; MyComboBoxText* const showmaskretiMethod; Gtk::CheckButton* const enaretiMask; diff --git a/rtgui/locallabtools2.cc b/rtgui/locallabtools2.cc index e4c0e6bad..bc45879d9 100644 --- a/rtgui/locallabtools2.cc +++ b/rtgui/locallabtools2.cc @@ -802,6 +802,13 @@ LocallabRetinex::LocallabRetinex(): transLabels2(Gtk::manage(new Gtk::Label("---"))), LocalcurveEditorgainT(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_TRANSMISSIONGAIN"))), cTgainshape(static_cast(LocalcurveEditorgainT->addCurve(CT_Flat, "", nullptr, false, false))), + exprecovr(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI2_EXP")))), + maskusabler(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUSABLE")))), + maskunusabler(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUNUSABLE")))), + recothresr(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKRECOTHRES"), 1., 2., 0.01, 1.))), + lowthresr(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKLCTHRLOW"), 1., 80., 0.5, 12.))), + higthresr(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKLCTHR"), 20., 99., 0.5, 85.))), + decayr(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKDDECAY"), 0.5, 4., 0.1, 2.))), expmaskreti(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_SHOWR")))), showmaskretiMethod(Gtk::manage(new MyComboBoxText())), enaretiMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), @@ -892,6 +899,12 @@ LocallabRetinex::LocallabRetinex(): LocalcurveEditorgainT->curveListComplete(); + recothresr->setAdjusterListener(this); + lowthresr->setAdjusterListener(this); + higthresr->setAdjusterListener(this); + decayr->setAdjusterListener(this); + setExpandAlignProperties(exprecovr, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + setExpandAlignProperties(expmaskreti, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); showmaskretiMethod->append(M("TP_LOCALLAB_SHOWMNONE")); @@ -987,6 +1000,16 @@ LocallabRetinex::LocallabRetinex(): toolretiBox->pack_start(*LocalcurveEditorgainT, Gtk::PACK_SHRINK, 4); expretitools->add(*toolretiBox, false); retiBox->pack_start(*expretitools, false, false); + ToolParamBlock* const reBox3 = Gtk::manage(new ToolParamBlock()); + reBox3->pack_start(*maskusabler, Gtk::PACK_SHRINK, 0); + reBox3->pack_start(*maskunusabler, Gtk::PACK_SHRINK, 0); + reBox3->pack_start(*recothresr); + reBox3->pack_start(*lowthresr); + reBox3->pack_start(*higthresr); + reBox3->pack_start(*decayr); + // colBox3->pack_start(*invmaskc); + exprecovr->add(*reBox3, false); + ToolParamBlock* const maskretiBox = Gtk::manage(new ToolParamBlock()); maskretiBox->pack_start(*showmaskretiMethod, Gtk::PACK_SHRINK, 4); maskretiBox->pack_start(*enaretiMask, Gtk::PACK_SHRINK, 0); @@ -1000,6 +1023,7 @@ LocallabRetinex::LocallabRetinex(): maskretiBox->pack_start(*slomaskreti, Gtk::PACK_SHRINK, 0); maskretiBox->pack_start(*mask2retiCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor expmaskreti->add(*maskretiBox, false); + retiBox->pack_start(*exprecovr, false, false); retiBox->pack_start(*expmaskreti, false, false); // retiBox->pack_start(*inversret); retitoolFrame->add(*retiBox); @@ -1066,6 +1090,7 @@ void LocallabRetinex::updateAdviceTooltips(const bool showTooltips) dehaFrame->set_tooltip_text(M("TP_LOCALLAB_DEHAZFRAME_TOOLTIP")); dehaz->set_tooltip_text(M("TP_LOCALLAB_DEHAZ_TOOLTIP")); retiFrame->set_tooltip_text(M("TP_LOCALLAB_RETIFRAME_TOOLTIP")); + exprecovr->set_tooltip_markup(M("TP_LOCALLAB_MASKRESRETI_TOOLTIP")); loglin->set_tooltip_text(M("TP_LOCALLAB_RETI_LOGLIN_TOOLTIP")); sensih->set_tooltip_text(M("TP_LOCALLAB_SENSI_TOOLTIP")); fftwreti->set_tooltip_text(M("TP_LOCALLAB_LC_FFTW_TOOLTIP")); @@ -1098,6 +1123,9 @@ void LocallabRetinex::updateAdviceTooltips(const bool showTooltips) chromaskreti->set_tooltip_text(M("TP_LOCALLAB_CHROMASK_TOOLTIP")); slomaskreti->set_tooltip_text(M("TP_LOCALLAB_SLOMASK_TOOLTIP")); lapmaskreti->set_tooltip_text(M("TP_LOCALLAB_LAPRAD1_TOOLTIP")); + decayr->set_tooltip_text(M("TP_LOCALLAB_MASKDECAY_TOOLTIP")); + lowthresr->set_tooltip_text(M("TP_LOCALLAB_MASKLOWTHRESRETI_TOOLTIP")); + higthresr->set_tooltip_text(M("TP_LOCALLAB_MASKHIGTHRESRETI_TOOLTIP")); } else { dehaFrame->set_tooltip_text(""); @@ -1135,11 +1163,16 @@ void LocallabRetinex::updateAdviceTooltips(const bool showTooltips) chromaskreti->set_tooltip_text(""); slomaskreti->set_tooltip_text(""); lapmaskreti->set_tooltip_text(""); + exprecovr->set_tooltip_markup(""); + decayr->set_tooltip_text(""); + lowthresr->set_tooltip_text(""); + higthresr->set_tooltip_text(""); } } void LocallabRetinex::setDefaultExpanderVisibility() { + exprecovr->set_expanded(false); expretitools->set_expanded(false); expmaskreti->set_expanded(false); } @@ -1231,6 +1264,10 @@ void LocallabRetinex::read(const rtengine::procparams::ProcParams* pp, const Par slomaskreti->setValue(spot.slomaskreti); Lmaskretishape->setCurve(spot.Lmaskreticurve); inversret->set_active(spot.inversret); + recothresr->setValue((double)spot.recothresr); + lowthresr->setValue((double)spot.lowthresr); + higthresr->setValue((double)spot.higthresr); + decayr->setValue((double)spot.decayr); } // Enable all listeners @@ -1304,6 +1341,10 @@ void LocallabRetinex::write(rtengine::procparams::ProcParams* pp, ParamsEdited* spot.slomaskreti = slomaskreti->getValue(); spot.Lmaskreticurve = Lmaskretishape->getCurve(); spot.inversret = inversret->get_active(); + spot.recothresr = recothresr->getValue(); + spot.lowthresr = lowthresr->getValue(); + spot.higthresr = higthresr->getValue(); + spot.decayr = decayr->getValue(); } // Note: No need to manage pedited as batch mode is deactivated for Locallab @@ -1338,6 +1379,10 @@ void LocallabRetinex::setDefaults(const rtengine::procparams::ProcParams* defPar chromaskreti->setDefault(defSpot.chromaskreti); gammaskreti->setDefault(defSpot.gammaskreti); slomaskreti->setDefault(defSpot.slomaskreti); + recothresr->setDefault((double)defSpot.recothresr); + lowthresr->setDefault((double)defSpot.lowthresr); + higthresr->setDefault((double)defSpot.higthresr); + decayr->setDefault((double)defSpot.decayr); } // Note: No need to manage pedited as batch mode is deactivated for Locallab @@ -1461,6 +1506,35 @@ void LocallabRetinex::adjusterChanged(Adjuster* a, double newval) } } + if (a == recothresr) { + + if (listener) { + listener->panelChanged(Evlocallabrecothresr, + recothresr->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (a == lowthresr) { + if (listener) { + listener->panelChanged(Evlocallablowthresr, + lowthresr->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (a == higthresr) { + if (listener) { + listener->panelChanged(Evlocallabhigthresr, + higthresr->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (a == decayr) { + if (listener) { + listener->panelChanged(Evlocallabdecayr, + decayr->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + if (a == blendmaskreti) { if (listener) { listener->panelChanged(Evlocallabblendmaskreti, @@ -1614,6 +1688,10 @@ void LocallabRetinex::convertParamToNormal() slomaskreti->setValue(defSpot.slomaskreti); Lmaskretishape->setCurve(defSpot.Lmaskreticurve); inversret->set_active(defSpot.inversret); + recothresr->setValue(defSpot.recothresr); + lowthresr->setValue(defSpot.lowthresr); + higthresr->setValue(defSpot.higthresr); + decayr->setValue(defSpot.decayr); // Enable all listeners enableListener(); @@ -1629,6 +1707,17 @@ void LocallabRetinex::convertParamToNormal() void LocallabRetinex::convertParamToSimple() { + const LocallabParams::LocallabSpot defSpot; + + // Disable all listeners + disableListener(); + + recothresr->setValue(defSpot.recothresr); + lowthresr->setValue(defSpot.lowthresr); + higthresr->setValue(defSpot.higthresr); + decayr->setValue(defSpot.decayr); + enableListener(); + } void LocallabRetinex::updateGUIToMode(const modeType new_type) @@ -1638,6 +1727,11 @@ void LocallabRetinex::updateGUIToMode(const modeType new_type) // Expert and Normal mode widgets are hidden in Simple mode retiFrame->hide(); retitoolFrame->hide(); + exprecovr->hide(); + decayr->hide(); + maskusabler->hide(); + maskunusabler->hide(); + break; case Normal: @@ -1645,12 +1739,27 @@ void LocallabRetinex::updateGUIToMode(const modeType new_type) retiFrame->hide(); retitoolFrame->hide(); // Specific Simple mode widgets are shown in Normal mode + exprecovr->hide(); + decayr->hide(); + maskusabler->hide(); + maskunusabler->hide(); + break; case Expert: // Show widgets hidden in Normal and Simple mode retiFrame->show(); retitoolFrame->show(); + exprecovr->show(); + decayr->show(); + if (enaretiMask->get_active()) { + maskusabler->show(); + maskunusabler->hide(); + + } else { + maskusabler->hide(); + maskunusabler->show(); + } } } @@ -1740,6 +1849,15 @@ void LocallabRetinex::showmaskretiMethodChanged() void LocallabRetinex::enaretiMaskChanged() { + if (enaretiMask->get_active()) { + maskusabler->show(); + maskunusabler->hide(); + + } else { + maskusabler->hide(); + maskunusabler->show(); + } + if (isLocActivated && exp->getEnabled()) { if (listener) { if (enaretiMask->get_active()) { diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 18a66453e..42767391b 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1420,6 +1420,10 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).cliptm = locallab.spots.at(j).cliptm && pSpot.cliptm == otherSpot.cliptm; locallab.spots.at(j).fftwreti = locallab.spots.at(j).fftwreti && pSpot.fftwreti == otherSpot.fftwreti; locallab.spots.at(j).Lmaskreticurve = locallab.spots.at(j).Lmaskreticurve && pSpot.Lmaskreticurve == otherSpot.Lmaskreticurve; + locallab.spots.at(j).recothresr = locallab.spots.at(j).recothresr && pSpot.recothresr == otherSpot.recothresr; + locallab.spots.at(j).lowthresr = locallab.spots.at(j).lowthresr && pSpot.lowthresr == otherSpot.lowthresr; + locallab.spots.at(j).higthresr = locallab.spots.at(j).higthresr && pSpot.higthresr == otherSpot.higthresr; + locallab.spots.at(j).decayr = locallab.spots.at(j).decayr && pSpot.decayr == otherSpot.decayr; // Sharpening locallab.spots.at(j).visisharp = locallab.spots.at(j).visisharp && pSpot.visisharp == otherSpot.visisharp; locallab.spots.at(j).expsharp = locallab.spots.at(j).expsharp && pSpot.expsharp == otherSpot.expsharp; @@ -4638,6 +4642,22 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).Lmaskreticurve = mods.locallab.spots.at(i).Lmaskreticurve; } + if (locallab.spots.at(i).recothresr) { + toEdit.locallab.spots.at(i).recothresr = mods.locallab.spots.at(i).recothresr; + } + + if (locallab.spots.at(i).lowthresr) { + toEdit.locallab.spots.at(i).lowthresr = mods.locallab.spots.at(i).lowthresr; + } + + if (locallab.spots.at(i).higthresr) { + toEdit.locallab.spots.at(i).higthresr = mods.locallab.spots.at(i).higthresr; + } + + if (locallab.spots.at(i).decayr) { + toEdit.locallab.spots.at(i).decayr = mods.locallab.spots.at(i).decayr; + } + // Sharpening if (locallab.spots.at(i).visisharp) { toEdit.locallab.spots.at(i).visisharp = mods.locallab.spots.at(i).visisharp; @@ -6939,6 +6959,10 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : cliptm(v), fftwreti(v), Lmaskreticurve(v), + recothresr(v), + lowthresr(v), + higthresr(v), + decayr(v), // Sharpening visisharp(v), expsharp(v), @@ -7500,6 +7524,10 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) cliptm = v; fftwreti = v; Lmaskreticurve = v; + recothresr = v; + lowthresr = v; + higthresr = v; + decayr = v; // Sharpening visisharp = v; expsharp = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index d684db7be..75893792a 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -757,6 +757,10 @@ public: bool cliptm; bool fftwreti; bool Lmaskreticurve; + bool recothresr; + bool lowthresr; + bool higthresr; + bool decayr; // Sharpening bool visisharp; bool expsharp;