diff --git a/rtdata/languages/default b/rtdata/languages/default index 636f88abe..84edae2ae 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1019,7 +1019,7 @@ HISTORY_MSG_774;Local - Reti Mask contrast curve HISTORY_MSG_775;Local - CBDL Mask contrast curve HISTORY_MSG_776;Local - Blur Denoise Mask contrast curve HISTORY_MSG_777;Local - Blur Mask local contrast curve -HISTORY_MSG_778;Local - Blur Mask highlights +HISTORY_MSG_778;Local - Mask highlights HISTORY_MSG_779;Local - Color Mask local contrast curve HISTORY_MSG_780;Local - Color Mask shadows HISTORY_MSG_781;Local - Contrast Mask Wavelet level @@ -1163,6 +1163,8 @@ HISTORY_MSG_922;Local - changes In Black and White HISTORY_MSG_923;Local - Tool complexity mode HISTORY_MSG_924;Local - Tool complexity mode HISTORY_MSG_925;Local - Scope color tools +HISTORY_MSG_926;Local - Show mask type +HISTORY_MSG_927;Local - Shadow mask HISTORY_MSG_CAT02PRESET;Cat02 automatic preset HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction @@ -2712,6 +2714,10 @@ TP_LOCALLAB_SHOWLC;Mask and modifications TP_LOCALLAB_SHOWMASK;Show mask TP_LOCALLAB_SHOWMASKCOL_TOOLTIP;Display mask modifications.\nBeware, you can only view one tool mask at the same time.\n\nNote: Use Mask is before algorihtm shape detection. TP_LOCALLAB_SHOWMASKSOFT_TOOLTIP;Show process Fourier:\nShows the different stages of the process.\nLaplace - builds the second derivative according to the threshold (first step).\nFourier -shows the transformed Laplacian with DCT.\nPoisson - show solution of Poisson DCE.\nNormalize - show result without normalization luminance. +TP_LOCALLAB_SHOWMASKTYP1;Blur & Noise +TP_LOCALLAB_SHOWMASKTYP2;Denoise +TP_LOCALLAB_SHOWMASKTYP3;Blur & Noise + Denoise +TP_LOCALLAB_SHOWMASKTYP_TOOLTIP;Mask and modifications can be chosen.\nBlur and noise : in this case it is not used for 'denoise'.\nDenoise : in this case it is not used for 'blur and noise'.\n\nBlur and noise + denoise : mask is shared, be carefull to 'show modifications' and 'scope' TP_LOCALLAB_SHOWMNONE;None TP_LOCALLAB_SHOWMODIF;Show modifications without mask TP_LOCALLAB_SHOWMODIFMASK;Show modifications with mask @@ -2727,7 +2733,7 @@ TP_LOCALLAB_SHOWT;Mask and modifications TP_LOCALLAB_SHOWVI;Mask and modifications TP_LOCALLAB_SHRESFRA;Shadows/Highlights TP_LOCALLAB_SHTRC_TOOLTIP;Modifies the tones of the image by acting on a TRC (Tone Response Curve).\nGamma acts mainly on light tones.\nSlope acts mainly on dark tones -TP_LOCALLAB_SIGMAWAV;Damper +TP_LOCALLAB_SIGMAWAV;Attenuation Response TP_LOCALLAB_SIM;Simple TP_LOCALLAB_SLOMASKCOL;Slope mask TP_LOCALLAB_SLOSH;Slope diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 58e1958b5..99bc2581d 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1067,7 +1067,8 @@ void Crop::update(int todo) CurveFactory::curvemaskLocal(localmaskcbutili, params.locallab.spots.at(sp).Lmaskcbcurve, lmaskcblocalcurve2, sca); localmasklcutili = false; CurveFactory::curvemaskLocal(localmasklcutili, params.locallab.spots.at(sp).Lmasklccurve, lmasklclocalcurve2, sca); - + localmaskblutili = false; + CurveFactory::curvemaskLocal(localmaskblutili, params.locallab.spots.at(sp).Lmaskblcurve, lmaskbllocalcurve2, sca); double ecomp = params.locallab.spots.at(sp).expcomp; double black = params.locallab.spots.at(sp).black; diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 2c378eef3..c6a02d0b4 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -530,6 +530,7 @@ struct local_params { int softmet; int blurmet; int blmet; + int smasktyp; int chromet; int shmeth; int medmet; @@ -790,6 +791,15 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.blurmet = 1; } + if (locallab.spots.at(sp).showmaskblMethodtyp == "blur") { + lp.smasktyp = 0; + } else if (locallab.spots.at(sp).showmaskblMethodtyp == "nois") { + lp.smasktyp = 1; + } else if (locallab.spots.at(sp).showmaskblMethodtyp == "all") { + lp.smasktyp = 2; + } + + if (locallab.spots.at(sp).spotMethod == "norm") { lp.excmet = 0; } else if (locallab.spots.at(sp).spotMethod == "exc") { @@ -8387,9 +8397,11 @@ void ImProcFunctions::DeNoise(int call, int del, float * slidL, float * slida, f bool execcolor = (lp.chro != 0.f || lp.ligh != 0.f || lp.cont != 0); // only if one slider ore more is engaged bool execbdl = (lp.mulloc[0] != 1.f || lp.mulloc[1] != 1.f || lp.mulloc[2] != 1.f || lp.mulloc[3] != 1.f || lp.mulloc[4] != 1.f || lp.mulloc[5] != 1.f) ;//only if user want cbdl bool execdenoi = noiscfactiv && ((lp.colorena && execcolor) || (lp.tonemapena && lp.strengt != 0.f) || (lp.cbdlena && execbdl) || (lp.sfena && lp.strng > 0.f) || (lp.lcena && lp.lcamount > 0.f) || (lp.sharpena && lp.shrad > 0.42) || (lp.retiena && lp.str > 0.f) || (lp.exposena && lp.expcomp != 0.f) || (lp.expvib && lp.past != 0.f)); + bool execmaskden = (lp.showmaskblmet == 2 || lp.enablMask || lp.showmaskblmet == 3 || lp.showmaskblmet == 4) && lp.smasktyp != 0; if (((lp.noiself > 0.f || lp.noiself0 > 0.f || lp.noiself2 > 0.f || lp.noiselc > 0.f || lp.noisecf > 0.f || lp.noisecc > 0.f - || lp.showmaskblmet == 2 || lp.enablMask || lp.showmaskblmet == 3 || lp.showmaskblmet == 4 || aut == 1 || aut == 2) && lp.denoiena) || execdenoi) { // sk == 1 ?? +// || lp.showmaskblmet == 2 || lp.enablMask || lp.showmaskblmet == 3 || lp.showmaskblmet == 4 || aut == 1 || aut == 2) && lp.denoiena) || execdenoi) { // sk == 1 ?? + || execmaskden || aut == 1 || aut == 2) && lp.denoiena) || execdenoi) { // sk == 1 ?? StopWatch Stop1("locallab Denoise called"); @@ -8940,7 +8952,12 @@ void ImProcFunctions::DeNoise(int call, int del, float * slidL, float * slida, f } - DeNoise_Local(call, lp, originalmaskbl, levred, huerefblur, lumarefblur, chromarefblur, original, transformed, tmp1, cx, cy, sk); + // DeNoise_Local(call, lp, originalmaskbl, levred, huerefblur, lumarefblur, chromarefblur, original, transformed, tmp1, cx, cy, sk); + if(lp.smasktyp != 0) { + DeNoise_Local(call, lp, originalmaskbl, levred, huerefblur, lumarefblur, chromarefblur, original, transformed, tmp1, cx, cy, sk); + } else { + DeNoise_Local(call, lp, original, levred, huerefblur, lumarefblur, chromarefblur, original, transformed, tmp1, cx, cy, sk); + } } else if (call == 2) { //simpleprocess @@ -9482,8 +9499,13 @@ void ImProcFunctions::DeNoise(int call, int del, float * slidL, float * slida, f } } - + if(lp.smasktyp != 0) { DeNoise_Local(call, lp, originalmaskbl, levred, huerefblur, lumarefblur, chromarefblur, original, transformed, bufwv, cx, cy, sk); + } else { + DeNoise_Local(call, lp, original, levred, huerefblur, lumarefblur, chromarefblur, original, transformed, bufwv, cx, cy, sk); + } + + // DeNoise_Local(call, lp, originalmaskbl, levred, huerefblur, lumarefblur, chromarefblur, original, transformed, bufwv, cx, cy, sk); } } } @@ -10024,7 +10046,20 @@ void ImProcFunctions::Lab_Local( } } + const int highli = params->locallab.spots.at(sp).shadmaskbl; + + if (highli > 0 && (lp.enablMask || lp.showmaskblmet == 3)) { + ImProcFunctions::shadowsHighlights(bufmaskblurbl.get(), true, 1, highli, 0, 40, sk, 50, 0); + } + + const int shado = params->locallab.spots.at(sp).shadmaskblsha; + + if (shado > 0 && (lp.enablMask || lp.showmaskblmet == 3)) { + ImProcFunctions::shadowsHighlights(bufmaskblurbl.get(), true, 1, 0, shado, 40, sk, 0, 60); + } + int wavelet_level = params->locallab.spots.at(sp).shadmaskbl; + int maxlvl = wavelet_level; int minwin = rtengine::min(GW, GH); int maxlevelspot = 9; @@ -10045,39 +10080,118 @@ void ImProcFunctions::Lab_Local( } if (wavcurvemask && (lp.enablMask || lp.showmaskblmet == 3)) { + const int level_bl = params->locallab.spots.at(sp).csthresholdblur.getBottomLeft(); + const int level_hl = params->locallab.spots.at(sp).csthresholdblur.getTopLeft(); + const int level_br = params->locallab.spots.at(sp).csthresholdblur.getBottomRight(); + const int level_hr = params->locallab.spots.at(sp).csthresholdblur.getTopRight(); + #ifdef _OPENMP const int numThreads = omp_get_max_threads(); #else const int numThreads = 1; #endif - const int level_bl = params->locallab.spots.at(sp).csthresholdblur.getBottomLeft(); - const int level_hl = params->locallab.spots.at(sp).csthresholdblur.getTopLeft(); - const int level_br = params->locallab.spots.at(sp).csthresholdblur.getBottomRight(); - const int level_hr = params->locallab.spots.at(sp).csthresholdblur.getTopRight(); - LocwavCurve dummy; - constexpr bool loclevwavutili = false; - constexpr bool wavcurvelev = false; - constexpr bool locconwavutili = false; - constexpr bool wavcurvecon = false; - constexpr bool loccompwavutili = false; - constexpr bool wavcurvecomp = false; - constexpr bool loccomprewavutili = false; - constexpr bool locedgwavutili = false; - constexpr bool wavcurvecompre = false; - constexpr bool wavcurve = false; - constexpr float contrast = 0.f; - int maxlvl; + wavelet_decomposition *wdspotbl = new wavelet_decomposition(bufmaskblurbl->L[0], GW, GH, maxlvl, 1, sk, numThreads, lp.daubLen); + if (wdspotbl->memory_allocation_failed()) { + return; + } + + + float mean[10]; + float meanN[10]; + float sigma[10]; + float sigmaN[10]; + float MaxP[10]; + float MaxN[10]; + + Evaluate2(*wdspotbl, mean, meanN, sigma, sigmaN, MaxP, MaxN, numThreads); + float alow = 1.f; + float blow = 0.f; + if (level_hl != level_bl) { + alow = 1.f / (level_hl - level_bl); + blow = -alow * level_bl; + } + + float ahigh = 1.f; + float bhigh = 0.f; + + if (level_hr != level_br) { + ahigh = 1.f / (level_hr - level_br); + bhigh = -ahigh * level_br; + } + + for (int dir = 1; dir < 4; dir++) { + for (int level = level_bl; level < maxlvl; ++level) { + int W_L = wdspotbl->level_W(level); + int H_L = wdspotbl->level_H(level); + float* const *wav_L = wdspotbl->level_coeffs(level); + + if (MaxP[level] > 0.f && mean[level] != 0.f && sigma[level] != 0.f) { + float insigma = 0.666f; //SD + float logmax = log(MaxP[level]); //log Max + float rapX = (mean[level] + sigma[level]) / MaxP[level]; //rapport between sD / max + float inx = log(insigma); + float iny = log(rapX); + float rap = inx / iny; //koef + float asig = 0.166f / (sigma[level]); + float bsig = 0.5f - asig * mean[level]; + float amean = 0.5f / mean[level]; + +#ifdef _OPENMP + #pragma omp parallel for if (multiThread) +#endif + for (int i = 0; i < W_L * H_L; i++) { + if(loclmasCurveblwav && lmasutiliblwav) { + float absciss; + float &val = wav_L[dir][i]; + + if (fabsf(val) >= (mean[level] + sigma[level])) { //for max + float valcour = xlogf(fabsf(val)); + float valc = valcour - logmax; + float vald = valc * rap; + absciss = xexpf(vald); + } else if (fabsf(val) >= mean[level]) { + absciss = asig * fabsf(val) + bsig; + } else { + absciss = amean * fabsf(val); + } + + float klev = 1.f; + if (level >= level_hl && level <= level_hr) { + klev = 1.f; + } + + if (level_hl != level_bl) { + if (level >= level_bl && level < level_hl) { + klev = alow * level + blow; + } + } + + if (level_hr != level_br) { + if (level > level_hr && level <= level_br) { + klev = ahigh * level + bhigh; + } + } + float kc = klev * (loclmasCurveblwav[absciss * 500.f] - 0.5f); + float amplieffect = kc <= 0.f ? 1.f : 4.f; + + float kinterm = 1.f + amplieffect * kc; + kinterm = kinterm <= 0.f ? 0.01f : kinterm; + + val *= kinterm; + + } + } + } + + } + } + wdspotbl->reconstruct(bufmaskblurbl->L[0], 1.f); + delete wdspotbl; - wavcontrast4(lp, bufmaskblurbl->L, nullptr, nullptr, contrast, 0.f, 0.f, GW, GH, level_bl, level_hl, level_br, level_hr, sk, numThreads, loclmasCurveblwav, lmasutiliblwav, wavcurve, dummy, loclevwavutili, wavcurvelev, dummy, locconwavutili, wavcurvecon, dummy, loccompwavutili, wavcurvecomp, dummy, loccomprewavutili, wavcurvecompre, dummy, locedgwavutili, 1.f, 1.f, maxlvl, 0.f, 0.f, 1.f, 1.f, false, false, false, false, false, 0.f, 0.f); } - const int shado = params->locallab.spots.at(sp).shadmaskbl; - - if (shado > 0 && (lp.enablMask || lp.showmaskblmet == 3)) { - ImProcFunctions::shadowsHighlights(bufmaskblurbl.get(), true, 1, shado, 0, 40, sk, 50, 0);//50 middle value for highlight tonal width - } // deltae Mask with scope int sco = params->locallab.spots.at(sp).scopemask; @@ -10150,7 +10264,9 @@ void ImProcFunctions::Lab_Local( //end mask } - if (((radius > 1.5 * GAUSS_SKIP && lp.rad > 1.6) || lp.stren > 0.1 || lp.blmet == 1 || lp.guidb > 0 || lp.showmaskblmet == 2 || lp.enablMask || lp.showmaskblmet == 3 || lp.showmaskblmet == 4) && lp.blurena) { // radius < GAUSS_SKIP means no gauss, just copy of original image + bool execmaskblur = (lp.showmaskblmet == 2 || lp.enablMask || lp.showmaskblmet == 3 || lp.showmaskblmet == 4) && lp.smasktyp != 1; + if (((radius > 1.5 * GAUSS_SKIP && lp.rad > 1.6) || lp.stren > 0.1 || lp.blmet == 1 || lp.guidb > 0 || execmaskblur) && lp.blurena) { // radius < GAUSS_SKIP means no gauss, just copy of original image + // if (((radius > 1.5 * GAUSS_SKIP && lp.rad > 1.6) || lp.stren > 0.1 || lp.blmet == 1 || lp.guidb > 0 || 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; int ystart = rtengine::max(static_cast(lp.yc - lp.lyT) - cy, 0); @@ -10615,7 +10731,13 @@ void ImProcFunctions::Lab_Local( } if (lp.blurmet == 0) { //blur and noise (center) - BlurNoise_Local(tmp1.get(), originalmaskbl, bufchro, hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk); +// BlurNoise_Local(tmp1.get(), originalmaskbl, bufchro, hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk); + + if(lp.smasktyp != 1) { + BlurNoise_Local(tmp1.get(), originalmaskbl, bufchro, hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk); + } else { + BlurNoise_Local(tmp1.get(), original, bufchro, hueref, chromaref, lumaref, lp, original, transformed, cx, cy, sk); + } if (params->locallab.spots.at(sp).recurs) { original->CopyFrom(transformed, multiThread); @@ -10623,7 +10745,12 @@ void ImProcFunctions::Lab_Local( calc_ref(sp, original, transformed, 0, 0, original->W, original->H, sk, huerefblur, chromarefblur, lumarefblur, hueref, chromaref, lumaref, sobelref, avge, locwavCurveden, locwavdenutili); } } else if (lp.blurmet == 1) { - InverseBlurNoise_Local(originalmaskbl, bufchro, lp, hueref, chromaref, lumaref, original, transformed, tmp1.get(), cx, cy, sk); + // InverseBlurNoise_Local(originalmaskbl, bufchro, lp, hueref, chromaref, lumaref, original, transformed, tmp1.get(), cx, cy, sk); + if(lp.smasktyp != 1) { + InverseBlurNoise_Local(originalmaskbl, bufchro, lp, hueref, chromaref, lumaref, original, transformed, tmp1.get(), cx, cy, sk); + } else { + InverseBlurNoise_Local(original, bufchro, lp, hueref, chromaref, lumaref, original, transformed, tmp1.get(), cx, cy, sk); + } if (params->locallab.spots.at(sp).recurs) { original->CopyFrom(transformed, multiThread); diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 572487810..e3243938f 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -948,6 +948,8 @@ enum ProcEventCode { EvlocallabcomplexityWithRefresh = 922, EvlocallabcomplexityWithoutRefresh = 923, EvLocallabSpotcolorscope = 924, + EvlocallabshowmasktypMethod = 925, + Evlocallabshadmaskblsha = 926, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 7783ecca8..361fc97c3 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3147,6 +3147,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : 0.35, 0.35 }, + showmaskblMethodtyp("blur"), CCmaskblcurve{ static_cast(FCT_MinMaxCPoints), 0.0, @@ -3202,6 +3203,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : slomaskbl(0.0), lapmaskbl(0.0), shadmaskbl(0), + shadmaskblsha(0), strumaskbl(0.), Lmaskblcurve{ static_cast(DCT_NURBS), @@ -3961,6 +3963,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && sensiden == other.sensiden && detailthr == other.detailthr && locwavcurveden == other.locwavcurveden + && showmaskblMethodtyp == other.showmaskblMethodtyp && CCmaskblcurve == other.CCmaskblcurve && LLmaskblcurve == other.LLmaskblcurve && HHmaskblcurve == other.HHmaskblcurve @@ -3974,6 +3977,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && slomaskbl == other.slomaskbl && lapmaskbl == other.lapmaskbl && shadmaskbl == other.shadmaskbl + && shadmaskblsha == other.shadmaskblsha && strumaskbl == other.strumaskbl && Lmaskblcurve == other.Lmaskblcurve && LLmaskblcurvewav == other.LLmaskblcurvewav @@ -5435,6 +5439,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->sensiden, "Locallab", "Sensiden_" + index_str, spot.sensiden, keyFile); saveToKeyfile(!pedited || spot_edited->detailthr, "Locallab", "Detailthr_" + index_str, spot.detailthr, keyFile); saveToKeyfile(!pedited || spot_edited->locwavcurveden, "Locallab", "LocwavCurveden_" + index_str, spot.locwavcurveden, keyFile); + saveToKeyfile(!pedited || spot_edited->showmaskblMethodtyp, "Locallab", "Showmasktyp_" + index_str, spot.showmaskblMethodtyp, keyFile); saveToKeyfile(!pedited || spot_edited->CCmaskblcurve, "Locallab", "CCmaskblCurve_" + index_str, spot.CCmaskblcurve, keyFile); saveToKeyfile(!pedited || spot_edited->LLmaskblcurve, "Locallab", "LLmaskblCurve_" + index_str, spot.LLmaskblcurve, keyFile); saveToKeyfile(!pedited || spot_edited->HHmaskblcurve, "Locallab", "HHmaskblCurve_" + index_str, spot.HHmaskblcurve, keyFile); @@ -5448,6 +5453,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->slomaskbl, "Locallab", "Slomaskbl_" + index_str, spot.slomaskbl, keyFile); saveToKeyfile(!pedited || spot_edited->lapmaskbl, "Locallab", "Lapmaskbl_" + index_str, spot.lapmaskbl, keyFile); saveToKeyfile(!pedited || spot_edited->shadmaskbl, "Locallab", "shadmaskbl_" + index_str, spot.shadmaskbl, keyFile); + saveToKeyfile(!pedited || spot_edited->shadmaskblsha, "Locallab", "shadmaskblsha_" + index_str, spot.shadmaskblsha, keyFile); saveToKeyfile(!pedited || spot_edited->strumaskbl, "Locallab", "strumaskbl_" + index_str, spot.strumaskbl, keyFile); saveToKeyfile(!pedited || spot_edited->Lmaskblcurve, "Locallab", "LmaskblCurve_" + index_str, spot.Lmaskblcurve, keyFile); saveToKeyfile(!pedited || spot_edited->LLmaskblcurvewav, "Locallab", "LLmaskblCurvewav_" + index_str, spot.LLmaskblcurvewav, keyFile); @@ -7096,6 +7102,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Sensiden_" + index_str, pedited, spot.sensiden, spotEdited.sensiden); assignFromKeyfile(keyFile, "Locallab", "Detailthr_" + index_str, pedited, spot.detailthr, spotEdited.detailthr); assignFromKeyfile(keyFile, "Locallab", "LocwavCurveden_" + index_str, pedited, spot.locwavcurveden, spotEdited.locwavcurveden); + assignFromKeyfile(keyFile, "Locallab", "Showmasktyp_" + index_str, pedited, spot.showmaskblMethodtyp, spotEdited.showmaskblMethodtyp); assignFromKeyfile(keyFile, "Locallab", "CCmaskblCurve_" + index_str, pedited, spot.CCmaskblcurve, spotEdited.CCmaskblcurve); assignFromKeyfile(keyFile, "Locallab", "LLmaskblCurve_" + index_str, pedited, spot.LLmaskblcurve, spotEdited.LLmaskblcurve); assignFromKeyfile(keyFile, "Locallab", "HHmaskblCurve_" + index_str, pedited, spot.HHmaskblcurve, spotEdited.HHmaskblcurve); @@ -7109,6 +7116,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Slomaskbl_" + index_str, pedited, spot.slomaskbl, spotEdited.slomaskbl); assignFromKeyfile(keyFile, "Locallab", "Lapmaskbl_" + index_str, pedited, spot.lapmaskbl, spotEdited.lapmaskbl); assignFromKeyfile(keyFile, "Locallab", "shadmaskbl_" + index_str, pedited, spot.shadmaskbl, spotEdited.shadmaskbl); + assignFromKeyfile(keyFile, "Locallab", "shadmaskblsha_" + index_str, pedited, spot.shadmaskblsha, spotEdited.shadmaskblsha); assignFromKeyfile(keyFile, "Locallab", "strumaskbl_" + index_str, pedited, spot.strumaskbl, spotEdited.strumaskbl); assignFromKeyfile(keyFile, "Locallab", "LmaskblCurve_" + index_str, pedited, spot.Lmaskblcurve, spotEdited.Lmaskblcurve); assignFromKeyfile(keyFile, "Locallab", "LLmaskblCurvewav_" + index_str, pedited, spot.LLmaskblcurvewav, spotEdited.LLmaskblcurvewav); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 8eda6e160..a9d68d550 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1202,6 +1202,7 @@ struct LocallabParams { int sensiden; int detailthr; std::vector locwavcurveden; + Glib::ustring showmaskblMethodtyp; std::vector CCmaskblcurve; std::vector LLmaskblcurve; std::vector HHmaskblcurve; @@ -1215,6 +1216,7 @@ struct LocallabParams { double slomaskbl; double lapmaskbl; int shadmaskbl; + int shadmaskblsha; double strumaskbl; std::vector Lmaskblcurve; std::vector LLmaskblcurvewav; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index dc630387f..773ec8b68 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -951,7 +951,10 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // Evlocallabblwh LUMINANCECURVE, // EvlocallabcomplexityWithRefresh M_VOID, // EvlocallabcomplexityWithoutRefresh - LUMINANCECURVE // EvLocallabSpotcolorscope + LUMINANCECURVE, // EvLocallabSpotcolorscope + LUMINANCECURVE, //EvlocallabshowmasktypMethod + LUMINANCECURVE // Evlocallabshadmaskblsha + }; diff --git a/rtgui/locallabtools.cc b/rtgui/locallabtools.cc index f1d0be4a7..a3dd71052 100644 --- a/rtgui/locallabtools.cc +++ b/rtgui/locallabtools.cc @@ -5218,6 +5218,7 @@ LocallabBlur::LocallabBlur(): sensiden(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIDEN"), 0, 100, 1, 60))), expmaskbl(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_SHOWPLUS")))), showmaskblMethod(Gtk::manage(new MyComboBoxText())), + showmaskblMethodtyp(Gtk::manage(new MyComboBoxText())), enablMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), maskblCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), CCmaskblshape(static_cast(maskblCurveEditorG->addCurve(CT_Flat, "C(C)", nullptr, false, false))), @@ -5232,6 +5233,7 @@ LocallabBlur::LocallabBlur(): gammaskbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAMMASKCOL"), 0.05, 5.0, 0.01, 1.))), slomaskbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOMASKCOL"), 0.0, 15.0, 0.1, 0.))), shadmaskbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_HIGHMASKCOL"), 0, 100, 1, 0))), + shadmaskblsha(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SHAMASKCOL"), 0, 100, 1, 0))), mask2blCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), Lmaskblshape(static_cast(mask2blCurveEditorG->addCurve(CT_Diagonal, "L(L)"))), mask2blCurveEditorGwav(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_WAVMASK"))), @@ -5342,6 +5344,12 @@ LocallabBlur::LocallabBlur(): showmaskblMethod->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKCOL_TOOLTIP")); showmaskblMethodConn = showmaskblMethod->signal_changed().connect(sigc::mem_fun(*this, &LocallabBlur::showmaskblMethodChanged)); + showmaskblMethodtyp->append(M("TP_LOCALLAB_SHOWMASKTYP1")); + showmaskblMethodtyp->append(M("TP_LOCALLAB_SHOWMASKTYP2")); + showmaskblMethodtyp->append(M("TP_LOCALLAB_SHOWMASKTYP3")); + showmaskblMethodtyp->set_active(0); + showmaskblMethodtypConn = showmaskblMethodtyp->signal_changed().connect(sigc::mem_fun(*this, &LocallabBlur::showmaskblMethodtypChanged)); + enablMaskConn = enablMask->signal_toggled().connect(sigc::mem_fun(*this, &LocallabBlur::enablMaskChanged)); maskblCurveEditorG->setCurveListener(this); @@ -5379,6 +5387,8 @@ LocallabBlur::LocallabBlur(): shadmaskbl->setAdjusterListener(this); + shadmaskblsha->setAdjusterListener(this); + mask2blCurveEditorG->setCurveListener(this); Lmaskblshape->setResetCurve(DiagonalCurveType(defSpot.Lmaskblcurve.at(0)), defSpot.Lmaskblcurve); @@ -5442,6 +5452,7 @@ LocallabBlur::LocallabBlur(): pack_start(*expdenoise); ToolParamBlock* const maskblBox = Gtk::manage(new ToolParamBlock()); maskblBox->pack_start(*showmaskblMethod, Gtk::PACK_SHRINK, 4); + maskblBox->pack_start(*showmaskblMethodtyp, Gtk::PACK_SHRINK, 4); maskblBox->pack_start(*enablMask, Gtk::PACK_SHRINK, 0); maskblBox->pack_start(*maskblCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor maskblBox->pack_start(*strumaskbl, Gtk::PACK_SHRINK, 0); @@ -5457,6 +5468,7 @@ LocallabBlur::LocallabBlur(): toolblBox->pack_start(*chromaskbl, Gtk::PACK_SHRINK, 0); toolblBox->pack_start(*gammaskbl, Gtk::PACK_SHRINK, 0); toolblBox->pack_start(*slomaskbl, Gtk::PACK_SHRINK, 0); + toolblBox->pack_start(*shadmaskblsha, Gtk::PACK_SHRINK, 0); toolblBox->pack_start(*shadmaskbl, Gtk::PACK_SHRINK, 0); toolblBox->pack_start(*mask2blCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor toolblBox->pack_start(*mask2blCurveEditorGwav, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor @@ -5464,7 +5476,7 @@ LocallabBlur::LocallabBlur(): toolblFrame->add(*toolblBox); maskblBox->pack_start(*toolblFrame); expmaskbl->add(*maskblBox, false); -// pack_start(*expmaskbl); + pack_start(*expmaskbl); } LocallabBlur::~LocallabBlur() @@ -5511,6 +5523,7 @@ void LocallabBlur::updateAdviceTooltips(const bool showTooltips) Lmaskblshape->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); LLmaskblshapewav->setTooltip(M("TP_LOCALLAB_LMASK_LEVEL_TOOLTIP")); blendmaskbl->set_tooltip_text(M("TP_LOCALLAB_BLENDMASK_TOOLTIP")); + showmaskblMethodtyp->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKTYP_TOOLTIP")); } else { expblnoise->set_tooltip_text(""); radius->set_tooltip_text(""); @@ -5528,6 +5541,7 @@ void LocallabBlur::updateAdviceTooltips(const bool showTooltips) Lmaskblshape->setTooltip(""); LLmaskblshapewav->setTooltip(""); blendmaskbl->set_tooltip_text(M("")); + showmaskblMethodtyp->set_tooltip_markup(M("")); } } @@ -5549,6 +5563,7 @@ void LocallabBlur::disableListener() chroMethodConn.block(true); activlumConn.block(true); showmaskblMethodConn.block(true); + showmaskblMethodtypConn.block(true); enablMaskConn.block(true); toolblConn.block(true); } @@ -5564,6 +5579,7 @@ void LocallabBlur::enableListener() chroMethodConn.block(false); activlumConn.block(false); showmaskblMethodConn.block(false); + showmaskblMethodtypConn.block(false); enablMaskConn.block(false); toolblConn.block(false); } @@ -5632,6 +5648,15 @@ void LocallabBlur::read(const rtengine::procparams::ProcParams* pp, const Params chroMethod->set_active(2); } + + if (spot.showmaskblMethodtyp == "blur") { + showmaskblMethodtyp ->set_active(0); + } else if (spot.showmaskblMethodtyp == "nois") { + showmaskblMethodtyp->set_active(1); + } else if (spot.showmaskblMethodtyp == "all") { + showmaskblMethodtyp->set_active(2); + } + activlum->set_active(spot.activlum); wavshapeden->setCurve(spot.locwavcurveden); noiselumf0->setValue(spot.noiselumf0); @@ -5660,6 +5685,7 @@ void LocallabBlur::read(const rtengine::procparams::ProcParams* pp, const Params gammaskbl->setValue(spot.gammaskbl); slomaskbl->setValue(spot.slomaskbl); shadmaskbl->setValue((double)spot.shadmaskbl); + shadmaskblsha->setValue((double)spot.shadmaskblsha); Lmaskblshape->setCurve(spot.Lmaskblcurve); LLmaskblshapewav->setCurve(spot.LLmaskblcurvewav); csThresholdblur->setValue(spot.csthresholdblur); @@ -5735,6 +5761,15 @@ void LocallabBlur::write(rtengine::procparams::ProcParams* pp, ParamsEdited* ped spot.chroMethod = "all"; } + + if (showmaskblMethodtyp->get_active_row_number() == 0) { + spot.showmaskblMethodtyp = "blur"; + } else if (showmaskblMethodtyp->get_active_row_number() == 1) { + spot.showmaskblMethodtyp = "nois"; + } else if (showmaskblMethodtyp->get_active_row_number() == 2) { + spot.showmaskblMethodtyp = "all"; + } + spot.activlum = activlum->get_active(); spot.locwavcurveden = wavshapeden->getCurve(); spot.noiselumf0 = noiselumf0->getValue(); @@ -5763,6 +5798,7 @@ void LocallabBlur::write(rtengine::procparams::ProcParams* pp, ParamsEdited* ped spot.gammaskbl = gammaskbl->getValue(); spot.slomaskbl = slomaskbl->getValue(); spot.shadmaskbl = shadmaskbl->getIntValue(); + spot.shadmaskblsha = shadmaskblsha->getIntValue(); spot.Lmaskblcurve = Lmaskblshape->getCurve(); spot.LLmaskblcurvewav = LLmaskblshapewav->getCurve(); spot.csthresholdblur = csThresholdblur->getValue(); @@ -5810,6 +5846,7 @@ void LocallabBlur::setDefaults(const rtengine::procparams::ProcParams* defParams gammaskbl->setDefault(defSpot.gammaskbl); slomaskbl->setDefault(defSpot.slomaskbl); shadmaskbl->setDefault(defSpot.shadmaskbl); + shadmaskblsha->setDefault(defSpot.shadmaskblsha); csThresholdblur->setDefault(defSpot.csthresholdblur); } @@ -6035,6 +6072,14 @@ void LocallabBlur::adjusterChanged(Adjuster* a, double newval) shadmaskbl->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); } } + + if (a == shadmaskblsha) { + if (listener) { + listener->panelChanged(Evlocallabshadmaskblsha, + shadmaskblsha->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + } } @@ -6122,9 +6167,10 @@ void LocallabBlur::convertParamToNormal() strumaskbl->setValue(defSpot.strumaskbl); toolbl->set_active(defSpot.toolbl); lapmaskbl->setValue(defSpot.lapmaskbl); - gammaskbl->setValue(defSpot.gammaskbl); - slomaskbl->setValue(defSpot.slomaskbl); +// gammaskbl->setValue(defSpot.gammaskbl); +// slomaskbl->setValue(defSpot.slomaskbl); shadmaskbl->setValue((double)defSpot.shadmaskbl); + shadmaskblsha->setValue((double)defSpot.shadmaskblsha); LLmaskblshapewav->setCurve(defSpot.LLmaskblcurvewav); csThresholdblur->setValue(defSpot.csthresholdblur); @@ -6140,9 +6186,10 @@ void LocallabBlur::updateGUIToMode(const modeType new_type) strumaskbl->hide(); toolbl->hide(); lapmaskbl->hide(); - gammaskbl->hide(); - slomaskbl->hide(); + gammaskbl->show(); + slomaskbl->show(); shadmaskbl->hide(); + shadmaskblsha->hide(); mask2blCurveEditorGwav->hide(); csThresholdblur->hide(); } else { @@ -6157,6 +6204,7 @@ void LocallabBlur::updateGUIToMode(const modeType new_type) gammaskbl->show(); slomaskbl->show(); shadmaskbl->show(); + shadmaskblsha->show(); mask2blCurveEditorGwav->show(); csThresholdblur->show(); } @@ -6263,6 +6311,19 @@ void LocallabBlur::showmaskblMethodChanged() } } +void LocallabBlur::showmaskblMethodtypChanged() +{ + // If mask preview is activated, deactivate all other tool mask preview + if (locToolListener) { + locToolListener->resetOtherMaskView(this); + } + + if (listener) { + listener->panelChanged(EvlocallabshowmasktypMethod, + showmaskblMethodtyp->get_active_text() + " (" + escapeHtmlChars(spotName) + ")"); + } +} + void LocallabBlur::enablMaskChanged() { if (isLocActivated && exp->getEnabled()) { diff --git a/rtgui/locallabtools.h b/rtgui/locallabtools.h index e18f9f6f3..4e6b30f00 100644 --- a/rtgui/locallabtools.h +++ b/rtgui/locallabtools.h @@ -654,6 +654,7 @@ private: Adjuster* const sensiden; MyExpander* const expmaskbl; MyComboBoxText* const showmaskblMethod; + MyComboBoxText* const showmaskblMethodtyp; Gtk::CheckButton* const enablMask; CurveEditorGroup* const maskblCurveEditorG; FlatCurveEditor* const CCmaskblshape; @@ -668,13 +669,14 @@ private: Adjuster* const gammaskbl; Adjuster* const slomaskbl; Adjuster* const shadmaskbl; + Adjuster* const shadmaskblsha; CurveEditorGroup* const mask2blCurveEditorG; DiagonalCurveEditor* const Lmaskblshape; CurveEditorGroup* const mask2blCurveEditorGwav; FlatCurveEditor* const LLmaskblshapewav; ThresholdAdjuster* const csThresholdblur; - sigc::connection blMethodConn, fftwblConn, medMethodConn, blurMethodConn, chroMethodConn, activlumConn, showmaskblMethodConn, enablMaskConn, toolblConn; + sigc::connection blMethodConn, fftwblConn, medMethodConn, blurMethodConn, chroMethodConn, activlumConn, showmaskblMethodConn, showmaskblMethodtypConn, enablMaskConn, toolblConn; public: LocallabBlur(); @@ -714,6 +716,7 @@ private: void chroMethodChanged(); void activlumChanged(); void showmaskblMethodChanged(); + void showmaskblMethodtypChanged(); void enablMaskChanged(); void toolblChanged(); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 9b3eb2d7d..f870c74b1 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1240,6 +1240,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).sensiden = locallab.spots.at(j).sensiden && pSpot.sensiden == otherSpot.sensiden; locallab.spots.at(j).detailthr = locallab.spots.at(j).detailthr && pSpot.detailthr == otherSpot.detailthr; locallab.spots.at(j).locwavcurveden = locallab.spots.at(j).locwavcurveden && pSpot.locwavcurveden == otherSpot.locwavcurveden; + locallab.spots.at(j).showmaskblMethodtyp = locallab.spots.at(j).showmaskblMethodtyp && pSpot.showmaskblMethodtyp == otherSpot.showmaskblMethodtyp; 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; locallab.spots.at(j).HHmaskblcurve = locallab.spots.at(j).HHmaskblcurve && pSpot.HHmaskblcurve == otherSpot.HHmaskblcurve; @@ -1253,6 +1254,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).slomaskbl = locallab.spots.at(j).slomaskbl && pSpot.slomaskbl == otherSpot.slomaskbl; locallab.spots.at(j).lapmaskbl = locallab.spots.at(j).lapmaskbl && pSpot.lapmaskbl == otherSpot.lapmaskbl; locallab.spots.at(j).shadmaskbl = locallab.spots.at(j).shadmaskbl && pSpot.shadmaskbl == otherSpot.shadmaskbl; + locallab.spots.at(j).shadmaskblsha = locallab.spots.at(j).shadmaskblsha && pSpot.shadmaskblsha == otherSpot.shadmaskblsha; locallab.spots.at(j).strumaskbl = locallab.spots.at(j).strumaskbl && pSpot.strumaskbl == otherSpot.strumaskbl; locallab.spots.at(j).Lmaskblcurve = locallab.spots.at(j).Lmaskblcurve && pSpot.Lmaskblcurve == otherSpot.Lmaskblcurve; locallab.spots.at(j).LLmaskblcurvewav = locallab.spots.at(j).LLmaskblcurvewav && pSpot.LLmaskblcurvewav == otherSpot.LLmaskblcurvewav; @@ -3892,6 +3894,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).locwavcurveden = mods.locallab.spots.at(i).locwavcurveden; } + if (locallab.spots.at(i).showmaskblMethodtyp) { + toEdit.locallab.spots.at(i).showmaskblMethodtyp = mods.locallab.spots.at(i).showmaskblMethodtyp; + } + if (locallab.spots.at(i).CCmaskblcurve) { toEdit.locallab.spots.at(i).CCmaskblcurve = mods.locallab.spots.at(i).CCmaskblcurve; } @@ -3944,6 +3950,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).shadmaskbl = mods.locallab.spots.at(i).shadmaskbl; } + if (locallab.spots.at(i).shadmaskblsha) { + toEdit.locallab.spots.at(i).shadmaskblsha = mods.locallab.spots.at(i).shadmaskblsha; + } + if (locallab.spots.at(i).strumaskbl) { toEdit.locallab.spots.at(i).strumaskbl = mods.locallab.spots.at(i).strumaskbl; } @@ -6055,6 +6065,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : sensiden(v), detailthr(v), locwavcurveden(v), + showmaskblMethodtyp(v), CCmaskblcurve(v), LLmaskblcurve(v), HHmaskblcurve(v), @@ -6068,6 +6079,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : slomaskbl(v), lapmaskbl(v), shadmaskbl(v), + shadmaskblsha(v), strumaskbl(v), Lmaskblcurve(v), LLmaskblcurvewav(v), @@ -6509,6 +6521,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) sensiden = v; detailthr = v; locwavcurveden = v; + showmaskblMethodtyp = v; CCmaskblcurve = v; LLmaskblcurve = v; HHmaskblcurve = v; @@ -6522,6 +6535,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) slomaskbl = v; lapmaskbl = v; shadmaskbl = v; + shadmaskblsha = v; strumaskbl = v; Lmaskblcurve = v; LLmaskblcurvewav = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 60a495bfc..36872ed4d 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -629,6 +629,7 @@ public: bool sensiden; bool detailthr; bool locwavcurveden; + bool showmaskblMethodtyp; bool CCmaskblcurve; bool LLmaskblcurve; bool HHmaskblcurve; @@ -642,6 +643,7 @@ public: bool slomaskbl; bool lapmaskbl; bool shadmaskbl; + bool shadmaskblsha; bool strumaskbl; bool Lmaskblcurve; bool LLmaskblcurvewav;