diff --git a/rtdata/languages/default b/rtdata/languages/default index 2b63be060..5a85773f0 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1152,7 +1152,8 @@ HISTORY_MSG_953;Local - Mask Common blend chroma HISTORY_MSG_954;Local - Show-hide tools HISTORY_MSG_955;Local - Enable Spot HISTORY_MSG_956;Local - CH Curve -HISTORY_MSG_957;Local - Tool complexity mode +HISTORY_MSG_957;Local - Denoise mode +HISTORY_MSG_958;Local - Show/hide settings HISTORY_MSG_BLSHAPE;Blur by level HISTORY_MSG_BLURCWAV;Blur chroma HISTORY_MSG_BLURWAV;Blur luminance @@ -2780,8 +2781,8 @@ TP_LOCALLAB_SHOWPOISSON;Poisson (pde ƒ) TP_LOCALLAB_SHOWR;Mask and modifications TP_LOCALLAB_SHOWREF;Preview ΔE TP_LOCALLAB_SHOWS;Mask and modifications -TP_LOCALLAB_SHOWSTRUC;Show structure Spot(advanced) -TP_LOCALLAB_SHOWSTRUCEX;Show structure Spot(advanced) +TP_LOCALLAB_SHOWSTRUC;Show spot structure(advanced) +TP_LOCALLAB_SHOWSTRUCEX;Show spot structure(advanced) TP_LOCALLAB_SHOWT;Mask and modifications TP_LOCALLAB_SHOWVI;Mask and modifications TP_LOCALLAB_SHRESFRA;Shadows/Highlights @@ -2815,8 +2816,8 @@ TP_LOCALLAB_STRGRID;Strength TP_LOCALLAB_STRRETI_TOOLTIP;if Strength Retinex < 0.2 only Dehaze is enabled.\nif Strength Retinex >= 0.1 Dehaze is in luminance mode. TP_LOCALLAB_STRUC;Structure TP_LOCALLAB_STRUCCOL;Structure -TP_LOCALLAB_STRUCCOL1;Structure Spot -TP_LOCALLAB_STRUCT_TOOLTIP;Use Sobel algorithm to take into account structure in shape detection.\nyou can have a preview by activating "mask and modifications - Show structure spot".\n\nCan be used in conjunction with masks (advanced) structure, blur, wavelet to improve edge detection.\n\nNeeds maskless adjustments to be activated (lightness, exposure...) +TP_LOCALLAB_STRUCCOL1;Spot Structure +TP_LOCALLAB_STRUCT_TOOLTIP;Use Sobel algorithm to take into account structure in shape detection.\nyou can have a preview by activating "mask and modifications - Show spot structure".\n\nCan be used in conjunction with masks (advanced) structure, blur, wavelet to improve edge detection.\n\nNeeds maskless adjustments to be activated (lightness, exposure...) TP_LOCALLAB_STRUMASKCOL;Structure mask strength TP_LOCALLAB_STRUMASK_TOOLTIP;Generate a structure mask with difference between surface areas and reliefs.\nIf structure mask as tool is enabled, this mask is used in addition to the other tools (gamma, slope, contrast curve ...) TP_LOCALLAB_STYPE;Shape method diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 67d754dbb..3fc2c667f 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -539,6 +539,7 @@ struct local_params { int blmet; int smasktyp; int chromet; + int quamet; int shmeth; int medmet; int locmet; @@ -786,6 +787,12 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.chromet = 2; } + if (locallab.spots.at(sp).quamethod == "cons") { + lp.quamet = 0; + } else if (locallab.spots.at(sp).quamethod == "agre") { + lp.quamet = 1; + } + if (locallab.spots.at(sp).shMethod == "std") { lp.shmeth = 0; } else if (locallab.spots.at(sp).shMethod == "tone") { @@ -8394,7 +8401,7 @@ void ImProcFunctions::DeNoise(int call, int del, float * slidL, float * slida, f } } - if ((lp.noiselc < 0.02f && aut == 0) || (mxsl < 1.f && (aut == 1 || aut == 2))) { + if ((lp.quamet == 0 && aut == 0) || (mxsl < 1.f && (aut == 1 || aut == 2))) { WaveletDenoiseAllL(Ldecomp, noisevarlum, madL, vari, edge, numThreads); } else { @@ -8684,7 +8691,7 @@ void ImProcFunctions::DeNoise(int call, int del, float * slidL, float * slida, f float noisevarab_r = 100.f; //SQR(lp.noisecc / 10.0); - if ((lp.noisecc < 2.f && aut == 0) || (maxccoarse < 0.1f && (aut == 1 || aut == 2))) { + if ((lp.quamet == 0 && aut == 0) || (maxccoarse < 0.1f && (aut == 1 || aut == 2))) { WaveletDenoiseAllAB(Ldecomp, adecomp, noisevarchrom, madL, variC, edge, noisevarab_r, true, false, false, numThreads); WaveletDenoiseAllAB(Ldecomp, bdecomp, noisevarchrom, madL, variCb, edge, noisevarab_r, true, false, false, numThreads); } else { @@ -8945,7 +8952,7 @@ void ImProcFunctions::DeNoise(int call, int del, float * slidL, float * slida, f } - if ((lp.noiselc < 0.02f && aut == 0) || (mxsl < 1.f && (aut == 1 || aut == 2))) { + if ((lp.quamet == 0 && aut == 0) || (mxsl < 1.f && (aut == 1 || aut == 2))) { WaveletDenoiseAllL(Ldecomp, noisevarlum, madL, vari, edge, numThreads); } else { WaveletDenoiseAll_BiShrinkL(Ldecomp, noisevarlum, madL, vari, edge, numThreads); @@ -9231,7 +9238,7 @@ void ImProcFunctions::DeNoise(int call, int del, float * slidL, float * slida, f float noisevarab_r = 100.f; //SQR(lp.noisecc / 10.0); - if ((lp.noisecc < 0.02f && aut == 0) || (maxccoarse < 0.1f && (aut == 1 || aut == 2))) { + if ((lp.quamet == 0 && aut == 0) || (maxccoarse < 0.1f && (aut == 1 || aut == 2))) { WaveletDenoiseAllAB(Ldecomp, adecomp, noisevarchrom, madL, variC, edge, noisevarab_r, true, false, false, numThreads); WaveletDenoiseAllAB(Ldecomp, bdecomp, noisevarchrom, madL, variCb, edge, noisevarab_r, true, false, false, numThreads); } else { diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 730689192..0cc199b89 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -979,7 +979,8 @@ enum ProcEventCode { EvLocallabSpotprevMethod = 953, Evlocallabactiv = 954, EvlocallabCHshape = 955, - Evlocallabhishow = 956, + EvlocallabquaMethod = 956, + Evlocallabhishow = 957, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 5ebd2ec48..0a3cb6c6b 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3246,6 +3246,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : epsbl(0), blMethod("blur"), chroMethod("lum"), + quamethod("cons"), blurMethod("norm"), medMethod("33"), activlum(true), @@ -4181,6 +4182,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && epsbl == other.epsbl && blMethod == other.blMethod && chroMethod == other.chroMethod + && quamethod == other.quamethod && blurMethod == other.blurMethod && medMethod == other.medMethod && activlum == other.activlum @@ -5708,6 +5710,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->epsbl, "Locallab", "Epsbl_" + index_str, spot.epsbl, keyFile); saveToKeyfile(!pedited || spot_edited->blMethod, "Locallab", "BlMethod_" + index_str, spot.blMethod, keyFile); saveToKeyfile(!pedited || spot_edited->chroMethod, "Locallab", "ChroMethod_" + index_str, spot.chroMethod, keyFile); + saveToKeyfile(!pedited || spot_edited->quamethod, "Locallab", "QuaMethod_" + index_str, spot.quamethod, keyFile); saveToKeyfile(!pedited || spot_edited->blurMethod, "Locallab", "BlurMethod_" + index_str, spot.blurMethod, keyFile); saveToKeyfile(!pedited || spot_edited->medMethod, "Locallab", "MedMethod_" + index_str, spot.medMethod, keyFile); saveToKeyfile(!pedited || spot_edited->activlum, "Locallab", "activlum_" + index_str, spot.activlum, keyFile); @@ -7436,6 +7439,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Epsbl_" + index_str, pedited, spot.epsbl, spotEdited.epsbl); assignFromKeyfile(keyFile, "Locallab", "BlMethod_" + index_str, pedited, spot.blMethod, spotEdited.blMethod); assignFromKeyfile(keyFile, "Locallab", "ChroMethod_" + index_str, pedited, spot.chroMethod, spotEdited.chroMethod); + assignFromKeyfile(keyFile, "Locallab", "QuaMethod_" + index_str, pedited, spot.quamethod, spotEdited.quamethod); assignFromKeyfile(keyFile, "Locallab", "BlurMethod_" + index_str, pedited, spot.blurMethod, spotEdited.blurMethod); assignFromKeyfile(keyFile, "Locallab", "MedMethod_" + index_str, pedited, spot.medMethod, spotEdited.medMethod); assignFromKeyfile(keyFile, "Locallab", "activlum_" + index_str, pedited, spot.activlum, spotEdited.activlum); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 44747bbab..af79aec95 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1204,6 +1204,7 @@ struct LocallabParams { int epsbl; Glib::ustring blMethod; // blur, med, guid Glib::ustring chroMethod; // lum, chr, all + Glib::ustring quamethod; // cons agre Glib::ustring blurMethod; // norm, inv Glib::ustring medMethod; // none, 33, 55, 77, 99 bool activlum; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 0b0f6fb3c..446e6e4fe 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -983,6 +983,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // EvLocallabSpotprevMethod LUMINANCECURVE, // Evlocallabactiv LUMINANCECURVE, // EvlocallabCHshape + LUMINANCECURVE, //EvlocallabquaMethod LUMINANCECURVE //Evlocallabhishow }; diff --git a/rtgui/locallabtools.cc b/rtgui/locallabtools.cc index 1a64d2722..fc9242bcd 100644 --- a/rtgui/locallabtools.cc +++ b/rtgui/locallabtools.cc @@ -5635,6 +5635,7 @@ LocallabBlur::LocallabBlur(): chroMethod(Gtk::manage(new MyComboBoxText())), activlum(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ACTIV")))), expdenoise(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI_EXP")))), + quamethod(Gtk::manage(new MyComboBoxText())), LocalcurveEditorwavden(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_WAVDEN"))), wavshapeden(static_cast(LocalcurveEditorwavden->addCurve(CT_Flat, "", nullptr, false, false))), noiselumf0(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMFINEZERO"), MINCHRO, MAXCHRO, 0.01, 0.))), @@ -5672,6 +5673,7 @@ LocallabBlur::LocallabBlur(): Lmaskblshape(static_cast(mask2blCurveEditorG->addCurve(CT_Diagonal, "L(L)"))), mask2blCurveEditorGwav(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_WAVMASK"))), LLmaskblshapewav(static_cast(mask2blCurveEditorGwav->addCurve(CT_Flat, "L(L)", nullptr, false, false))), + quaHBox(Gtk::manage(new Gtk::HBox())), csThresholdblur(Gtk::manage(new ThresholdAdjuster(M("TP_LOCALLAB_CSTHRESHOLDBLUR"), 0, 9, 0, 0, 6, 5, 0, false))) { const LocallabParams::LocallabSpot defSpot; @@ -5733,6 +5735,14 @@ LocallabBlur::LocallabBlur(): setExpandAlignProperties(expdenoise, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + + quamethod->append(M("TP_WAVELET_QUACONSER")); + quamethod->append(M("TP_WAVELET_QUAAGRES")); + quamethodconn = quamethod->signal_changed().connect(sigc::mem_fun(*this, &LocallabBlur::quamethodChanged)); + Gtk::Label* const quaLabel = Gtk::manage(new Gtk::Label(M("TP_WAVELET_DENQUA") + ":")); + quaHBox->pack_start(*quaLabel, Gtk::PACK_SHRINK, 4); + quaHBox->pack_start(*quamethod); + LocalcurveEditorwavden->setCurveListener(this); wavshapeden->setIdentityValue(0.); @@ -5865,6 +5875,7 @@ LocallabBlur::LocallabBlur(): ToolParamBlock* const denoisebox = Gtk::manage(new ToolParamBlock()); Gtk::Frame* const wavFrame = Gtk::manage(new Gtk::Frame()); ToolParamBlock* const wavBox = Gtk::manage(new ToolParamBlock()); + wavBox->pack_start(*quaHBox); wavBox->pack_start(*LocalcurveEditorwavden, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor // wavBox->pack_start(*noiselumf0); // wavBox->pack_start(*noiselumf); @@ -5994,6 +6005,7 @@ void LocallabBlur::disableListener() medMethodConn.block(true); blurMethodConn.block(true); chroMethodConn.block(true); + quamethodconn.block(true); activlumConn.block(true); showmaskblMethodConn.block(true); showmaskblMethodtypConn.block(true); @@ -6010,6 +6022,7 @@ void LocallabBlur::enableListener() medMethodConn.block(false); blurMethodConn.block(false); chroMethodConn.block(false); + quamethodconn.block(false); activlumConn.block(false); showmaskblMethodConn.block(false); showmaskblMethodtypConn.block(false); @@ -6081,6 +6094,12 @@ void LocallabBlur::read(const rtengine::procparams::ProcParams* pp, const Params chroMethod->set_active(2); } + if (spot.quamethod == "cons") { + quamethod->set_active(0); + } else if (spot.quamethod == "agre") { + quamethod->set_active(1); + } + activlum->set_active(spot.activlum); wavshapeden->setCurve(spot.locwavcurveden); noiselumf0->setValue(spot.noiselumf0); @@ -6194,6 +6213,12 @@ void LocallabBlur::write(rtengine::procparams::ProcParams* pp, ParamsEdited* ped spot.chroMethod = "all"; } + if (quamethod->get_active_row_number() == 0) { + spot.quamethod = "cons"; + } else if (quamethod->get_active_row_number() == 1) { + spot.quamethod = "agre"; + } + spot.activlum = activlum->get_active(); spot.locwavcurveden = wavshapeden->getCurve(); spot.noiselumf0 = noiselumf0->getValue(); @@ -6760,6 +6785,17 @@ void LocallabBlur::chroMethodChanged() } } +void LocallabBlur::quamethodChanged() +{ + if (isLocActivated && exp->getEnabled()) { + if (listener) { + listener->panelChanged(EvlocallabquaMethod, + quamethod->get_active_text() + " (" + escapeHtmlChars(spotName) + ")"); + } + } +} + + void LocallabBlur::activlumChanged() { if (isLocActivated && exp->getEnabled()) { diff --git a/rtgui/locallabtools.h b/rtgui/locallabtools.h index 9d0e21779..4d26e2915 100644 --- a/rtgui/locallabtools.h +++ b/rtgui/locallabtools.h @@ -652,6 +652,7 @@ private: MyComboBoxText* const chroMethod; Gtk::CheckButton* const activlum; MyExpander* const expdenoise; + MyComboBoxText* const quamethod; CurveEditorGroup* const LocalcurveEditorwavden; FlatCurveEditor* const wavshapeden; Adjuster* const noiselumf0; @@ -689,10 +690,11 @@ private: DiagonalCurveEditor* const Lmaskblshape; CurveEditorGroup* const mask2blCurveEditorGwav; FlatCurveEditor* const LLmaskblshapewav; + Gtk::HBox* const quaHBox; ThresholdAdjuster* const csThresholdblur; sigc::connection blMethodConn, fftwblConn, medMethodConn, blurMethodConn, chroMethodConn, activlumConn, showmaskblMethodConn, showmaskblMethodtypConn, enablMaskConn, toolblConn; - + sigc::connection quamethodconn; public: LocallabBlur(); ~LocallabBlur(); @@ -735,6 +737,7 @@ private: void showmaskblMethodtypChanged(); void enablMaskChanged(); void toolblChanged(); + void quamethodChanged(); void updateBlurGUI(); }; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 162146681..95036b063 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1274,6 +1274,7 @@ void ParamsEdited::initFrom(const std::vector& 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).chroMethod = locallab.spots.at(j).chroMethod && pSpot.chroMethod == otherSpot.chroMethod; + locallab.spots.at(j).quamethod = locallab.spots.at(j).quamethod && pSpot.quamethod == otherSpot.quamethod; 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; @@ -3995,6 +3996,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).chroMethod = mods.locallab.spots.at(i).chroMethod; } + if (locallab.spots.at(i).quamethod) { + toEdit.locallab.spots.at(i).quamethod = mods.locallab.spots.at(i).quamethod; + } + if (locallab.spots.at(i).blurMethod) { toEdit.locallab.spots.at(i).blurMethod = mods.locallab.spots.at(i).blurMethod; } @@ -6403,6 +6408,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : epsbl(v), blMethod(v), chroMethod(v), + quamethod(v), blurMethod(v), medMethod(v), activlum(v), @@ -6892,6 +6898,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) epsbl = v; blMethod = v; chroMethod = v; + quamethod = v; blurMethod = v; medMethod = v; activlum = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index bd32e7f81..c589aa96f 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -617,6 +617,7 @@ public: bool epsbl; bool blMethod; bool chroMethod; + bool quamethod; bool blurMethod; bool medMethod; bool activlum;