From a0edd97ca36c7c16cf144270eb3ab8c071b9c49c Mon Sep 17 00:00:00 2001 From: Desmis Date: Sat, 12 Dec 2020 14:46:11 +0100 Subject: [PATCH] LA denoise local contrast mask --- rtdata/languages/default | 6 ++++ rtengine/improcfun.h | 2 +- rtengine/iplocallab.cc | 60 +++++++++++++++++++++++++++++++++-- rtengine/procevents.h | 3 ++ rtengine/procparams.cc | 12 +++++++ rtengine/procparams.h | 3 ++ rtengine/refreshmap.cc | 6 +++- rtgui/locallabtools.cc | 67 +++++++++++++++++++++++++++++++++++++++- rtgui/locallabtools.h | 15 ++++++++- rtgui/paramsedited.cc | 21 +++++++++++++ rtgui/paramsedited.h | 3 ++ 11 files changed, 191 insertions(+), 7 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index f04ef1f78..5c29e97d9 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1227,6 +1227,9 @@ HISTORY_MSG_979;Local - Log encoding Brightness Q HISTORY_MSG_980;Local - Log encoding Colorfulness M HISTORY_MSG_981;Local - Log encoding Strength HISTORY_MSG_982;Local - Equalizer hue +HISTORY_MSG_983;Local - denoise threshold mask high +HISTORY_MSG_984;Local - denoise threshold mask low +HISTORY_MSG_985;Local - denoise use mask HISTORY_MSG_BLSHAPE;Blur by level HISTORY_MSG_BLURCWAV;Blur chroma HISTORY_MSG_BLURWAV;Blur luminance @@ -2546,6 +2549,7 @@ TP_LOCALLAB_DENOICHRODET_TOOLTIP;Allows you to recover chrominance detail by pro TP_LOCALLAB_DENOICHROF_TOOLTIP;Allows you to adjust fine-detail chrominance noise TP_LOCALLAB_DENOIEQUALCHRO_TOOLTIP;Allows you to direct the chroma noise reduction towards either the blue-yellow or red-green colors. TP_LOCALLAB_DENOIEQUAL_TOOLTIP;Allows you to carry out more or less noise reduction in either the shadows or the highlights. +TP_LOCALLAB_DENOI1_EXP;Denoise using local contrast mask TP_LOCALLAB_DENOILUMDETAIL_TOOLTIP;Allows you to recover luminance detail by progressively applying a Fourier transform (DCT). TP_LOCALLAB_DENOIQUA_TOOLTIP;Conservative mode preserves low frequency detail. “Aggressive” mode removes low frequency detail. TP_LOCALLAB_DENOIS;Ψ Denoise @@ -2755,6 +2759,8 @@ TP_LOCALLAB_MASKCOM_TOOLNAME;Common Color Mask - 13 TP_LOCALLAB_MASKCOM_TOOLTIP;A tool in its own right.\nCan be used to adjust the image appearance (chrominance, luminance, contrast) and texture as a function of Scope. TP_LOCALLAB_MASKCURVE_TOOLTIP;The 3 curves are set to 1 (maximum) by default:\nC=f(C) the chroma varies according to the chrominance. You can decrease the chroma to improve the selection. By setting this curve close to zero (with a low value of C to activate the curve) you can desaturate the background in Inverse mode.\nL=f(L) the luminance varies according to the luminance, so you can decrease the brightness to improve the selection.\nL and C = f(H) luminance and chroma vary with hue, so you can decrease luminance and chroma to improve selection TP_LOCALLAB_MASKH;Hue curve +TP_LOCALLAB_MASKLCTHR;Threshold luminance mask highlights +TP_LOCALLAB_MASKLCTHRLOW;Threshold luminance mask shadows TP_LOCALLAB_MASK_TOOLTIP;You can enable multiple masks for a tool by activating another tool and using only the mask (set the tool sliders to 0 ).\n\nYou can also duplicate the RT-spot and place it close to the first spot. The small variations in the spot references allows you to make fine adjustments. TP_LOCALLAB_MED;Medium TP_LOCALLAB_MEDIAN;Median Low diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index a8d168383..f9ec00469 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -369,7 +369,7 @@ public: void DeNoise_Local(int call, const struct local_params& lp, LabImage* originalmask, int levred, float hueref, float lumaref, float chromaref, LabImage* original, LabImage* transformed, const LabImage &tmp1, int cx, int cy, int sk); void DeNoise_Local2(const struct local_params& lp, LabImage* originalmask, int levred, float hueref, float lumaref, float chromaref, LabImage* original, LabImage* transformed, const LabImage &tmp1, int cx, int cy, int sk); - void DeNoise(int call, float * slidL, float * slida, float * slidb, int aut, bool noiscfactiv, const struct local_params& lp, LabImage* originalmaskbl, int levred, float huerefblur, float lumarefblur, float chromarefblur, LabImage* original, LabImage* transformed, int cx, int cy, int sk, const LocwavCurve& locwavCurvehue, bool locwavhueutili); + void DeNoise(int call, float * slidL, float * slida, float * slidb, int aut, bool noiscfactiv, const struct local_params& lp, LabImage* originalmaskbl, LabImage * bufmaskblurbl, int levred, float huerefblur, float lumarefblur, float chromarefblur, LabImage* original, LabImage* transformed, int cx, int cy, int sk, const LocwavCurve& locwavCurvehue, bool locwavhueutili); void fftw_denoise(int GW, int GH, int max_numblox_W, int min_numblox_W, float **tmp1, array2D *Lin, int numThreads, const struct local_params & lp, int chrom); diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index d4cf7041b..c8129b801 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -657,6 +657,9 @@ struct local_params { float blurma; float contma; bool activspot; + float thrlow; + float thrhigh; + bool usemask; }; @@ -773,6 +776,11 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.ena_Mask = locallab.spots.at(sp).enamask && lllcMask == 0 && llcbMask == 0 && llsoftMask == 0 && llsharMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0 && lllogMask == 0 && llvibMask == 0; lp.enaLMask = locallab.spots.at(sp).enaLMask && lllogMask == 0 && llColorMask == 0 && lllcMask == 0 && llsharMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0 && llvibMask == 0 && ll_Mask == 0;// Exposure mask is deactivated if Color & Light mask is visible + + lp.thrlow = locallab.spots.at(sp).levelthrlow; + lp.thrhigh = locallab.spots.at(sp).levelthr; + lp.usemask = locallab.spots.at(sp).usemask; + // printf("llColorMask=%i lllcMask=%i llExpMask=%i llSHMask=%i llcbMask=%i llretiMask=%i lltmMask=%i llblMask=%i llvibMask=%i\n", llColorMask, lllcMask, llExpMask, llSHMask, llcbMask, llretiMask, lltmMask, llblMask, llvibMask); if (locallab.spots.at(sp).softMethod == "soft") { lp.softmet = 0; @@ -8650,7 +8658,7 @@ void ImProcFunctions::fftw_denoise(int GW, int GH, int max_numblox_W, int min_nu } -void ImProcFunctions::DeNoise(int call, float * slidL, float * slida, float * slidb, int aut, bool noiscfactiv, const struct local_params & lp, LabImage * originalmaskbl, int levred, float huerefblur, float lumarefblur, float chromarefblur, LabImage * original, LabImage * transformed, int cx, int cy, int sk, const LocwavCurve& locwavCurvehue, bool locwavhueutili) +void ImProcFunctions::DeNoise(int call, float * slidL, float * slida, float * slidb, int aut, bool noiscfactiv, const struct local_params & lp, LabImage * originalmaskbl, LabImage * bufmaskblurbl, int levred, float huerefblur, float lumarefblur, float chromarefblur, LabImage * original, LabImage * transformed, int cx, int cy, int sk, const LocwavCurve& locwavCurvehue, bool locwavhueutili) { //local denoise @@ -8855,6 +8863,29 @@ void ImProcFunctions::DeNoise(int call, float * slidL, float * slida, float * sl } } + if(lp.enablMask && lp.usemask) { + float hig = lp.thrhigh; + if(lp.thrhigh < lp.thrlow) { + hig = lp.thrlow + 0.01f; + } + +#ifdef _OPENMP + #pragma omp parallel for if (multiThread) +#endif + for (int ir = 0; ir < GH; ir++) + for (int jr = 0; jr < GW; jr++) { + const float lM = bufmaskblurbl->L[ir][jr]; + if (lM < 327.68f * lp.thrlow) { + noisevarlum[(ir >> 1) * GW2 + (jr >> 1)] *= 3.f; + } else if (lM < 327.68f * hig) { + // do nothing + } else { + noisevarlum[(ir >> 1) * GW2 + (jr >> 1)] *= 0.01f; + } + } + } + + if(HHhuecurve) { #ifdef _OPENMP #pragma omp parallel for @@ -9424,6 +9455,29 @@ void ImProcFunctions::DeNoise(int call, float * slidL, float * slida, float * sl noisevarlum[(ir >> 1)*bfw2 + (jr >> 1)] = nvll[i]; } } + + if(lp.enablMask && lp.usemask) { + float hig = lp.thrhigh; + if(lp.thrhigh < lp.thrlow) { + hig = lp.thrlow + 0.01f; + } + +#ifdef _OPENMP + #pragma omp parallel for if (multiThread) +#endif + for (int ir = 0; ir < bfh; ir++) + for (int jr = 0; jr < bfw; jr++) { + const float lM = bufmaskblurbl->L[ir + ystart][jr + xstart]; + if (lM < 327.68f * lp.thrlow) { + noisevarlum[(ir >> 1) * bfw2 + (jr >> 1)] *= 3.f; + } else if (lM < 327.68f * hig) { + // do nothing + } else { + noisevarlum[(ir >> 1) * bfw2 + (jr >> 1)] *= 0.01f; + } + } + } + if(HHhuecurve) { #ifdef _OPENMP @@ -11112,11 +11166,11 @@ void ImProcFunctions::Lab_Local( //local denoise if (lp.denoiena) { - float slidL[8] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}; + float slidL[8] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}; float slida[8] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}; float slidb[8] = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}; constexpr int aut = 0; - DeNoise(call, slidL, slida, slidb, aut, noiscfactiv, lp, originalmaskbl.get(), levred, huerefblur, lumarefblur, chromarefblur, original, transformed, cx, cy, sk, locwavCurvehue, locwavhueutili); + DeNoise(call, slidL, slida, slidb, aut, noiscfactiv, lp, originalmaskbl.get(), bufmaskblurbl.get(), levred, huerefblur, lumarefblur, chromarefblur, original, transformed, cx, cy, sk, locwavCurvehue, locwavhueutili); if (params->locallab.spots.at(sp).recurs) { original->CopyFrom(transformed, multiThread); diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 7464152a3..159ab9835 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -1005,6 +1005,9 @@ enum ProcEventCode { Evlocallabcolorfl = 979, Evlocallabrepar = 980, EvlocallabwavCurvehue = 981, + Evlocallablevelthr = 982, + Evlocallablevelthrlow = 983, + Evlocallabusemask1 = 984, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 8f9567b41..cc80f582e 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3307,6 +3307,9 @@ LocallabParams::LocallabSpot::LocallabSpot() : quamethod("cons"), blurMethod("norm"), medMethod("33"), + usemask(false), + levelthr(40), + levelthrlow(20), activlum(true), noiselumf(0.), noiselumf0(0.), @@ -4346,6 +4349,9 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && chroMethod == other.chroMethod && quamethod == other.quamethod && blurMethod == other.blurMethod + && usemask == other.usemask + && levelthr == other.levelthr + && levelthrlow == other.levelthrlow && medMethod == other.medMethod && activlum == other.activlum && noiselumf == other.noiselumf @@ -5928,6 +5934,9 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo 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->usemask, "Locallab", "Usemaskb_" + index_str, spot.usemask, keyFile); + saveToKeyfile(!pedited || spot_edited->levelthr, "Locallab", "Levelthr_" + index_str, spot.levelthr, keyFile); + saveToKeyfile(!pedited || spot_edited->levelthrlow, "Locallab", "Levelthrlow_" + index_str, spot.levelthrlow, 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); saveToKeyfile(!pedited || spot_edited->noiselumf, "Locallab", "noiselumf_" + index_str, spot.noiselumf, keyFile); @@ -7726,6 +7735,9 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) 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", "Usemaskb_" + index_str, pedited, spot.usemask, spotEdited.usemask); + assignFromKeyfile(keyFile, "Locallab", "Levelthr_" + index_str, pedited, spot.levelthr, spotEdited.levelthr); + assignFromKeyfile(keyFile, "Locallab", "Levelthrlow_" + index_str, pedited, spot.levelthrlow, spotEdited.levelthrlow); assignFromKeyfile(keyFile, "Locallab", "MedMethod_" + index_str, pedited, spot.medMethod, spotEdited.medMethod); assignFromKeyfile(keyFile, "Locallab", "activlum_" + index_str, pedited, spot.activlum, spotEdited.activlum); assignFromKeyfile(keyFile, "Locallab", "noiselumf_" + index_str, pedited, spot.noiselumf, spotEdited.noiselumf); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 520b12763..79d7ad0f5 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1214,6 +1214,9 @@ struct LocallabParams { Glib::ustring quamethod; // cons agre Glib::ustring blurMethod; // norm, inv Glib::ustring medMethod; // none, 33, 55, 77, 99 + bool usemask; + double levelthr; + double levelthrlow; bool activlum; double noiselumf; double noiselumf0; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 331945848..7cd1c2547 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -1008,7 +1008,11 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // Evlocallablightq LUMINANCECURVE, // Evlocallabcolorfl LUMINANCECURVE, // Evlocallabrepar - LUMINANCECURVE //EvlocallabwavCurvehue + LUMINANCECURVE, //EvlocallabwavCurvehue + LUMINANCECURVE, // Evlocallablevelthr + LUMINANCECURVE, // Evlocallablevelthrlow + LUMINANCECURVE //Evlocallabusemask1 + }; diff --git a/rtgui/locallabtools.cc b/rtgui/locallabtools.cc index d06fa1837..e2bd7728d 100644 --- a/rtgui/locallabtools.cc +++ b/rtgui/locallabtools.cc @@ -5760,6 +5760,10 @@ LocallabBlur::LocallabBlur(): quamethod(Gtk::manage(new MyComboBoxText())), LocalcurveEditorwavden(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_WAVDEN"))), wavshapeden(static_cast(LocalcurveEditorwavden->addCurve(CT_Flat, "", nullptr, false, false))), + expdenoise1(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI1_EXP")))), + usemask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_USEMASK")))), + levelthr(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKLCTHR"), 0., 100., 1., 40.))), + levelthrlow(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKLCTHRLOW"), 0., 100., 1., 20.))), noiselumf0(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMFINEZERO"), MINCHRO, MAXCHRO, 0.01, 0.))), noiselumf(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMFINE"), MINCHRO, MAXCHRO, 0.01, 0.))), noiselumf2(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMFINETWO"), MINCHRO, MAXCHRO, 0.01, 0.))), @@ -5821,6 +5825,7 @@ LocallabBlur::LocallabBlur(): blMethodConn = blMethod->signal_changed().connect(sigc::mem_fun(*this, &LocallabBlur::blMethodChanged)); fftwblConn = fftwbl->signal_toggled().connect(sigc::mem_fun(*this, &LocallabBlur::fftwblChanged)); + usemaskConn = usemask->signal_toggled().connect(sigc::mem_fun(*this, &LocallabBlur::usemaskChanged)); invblConn = invbl->signal_toggled().connect(sigc::mem_fun(*this, &LocallabBlur::invblChanged)); radius->setAdjusterListener(this); @@ -5883,6 +5888,11 @@ LocallabBlur::LocallabBlur(): wavshapeden->setResetCurve(FlatCurveType(defSpot.locwavcurveden.at(0)), defSpot.locwavcurveden); LocalcurveEditorwavden->curveListComplete(); + setExpandAlignProperties(expdenoise1, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + + levelthr->setAdjusterListener(this); + + levelthrlow->setAdjusterListener(this); noiselumf0->setAdjusterListener(this); @@ -6032,6 +6042,12 @@ LocallabBlur::LocallabBlur(): wavBox->pack_start(*noiselumdetail); wavBox->pack_start(*noiselequal); wavBox->pack_start(*LocalcurveEditorwavhue, Gtk::PACK_SHRINK, 4); + ToolParamBlock* const wavBox1 = Gtk::manage(new ToolParamBlock()); + wavBox1->pack_start(*usemask, Gtk::PACK_SHRINK, 0); + wavBox1->pack_start(*levelthrlow, Gtk::PACK_SHRINK, 0); + wavBox1->pack_start(*levelthr, Gtk::PACK_SHRINK, 0); + expdenoise1->add(*wavBox1, false); + wavBox->pack_start(*expdenoise1); wavBox->pack_start(*noisechrof); wavBox->pack_start(*noisechroc); wavBox->pack_start(*noisechrodetail); @@ -6209,6 +6225,7 @@ void LocallabBlur::setDefaultExpanderVisibility() { expblnoise->set_expanded(false); expdenoise->set_expanded(false); + expdenoise1->set_expanded(false); expmaskbl->set_expanded(false); } @@ -6218,6 +6235,7 @@ void LocallabBlur::disableListener() blMethodConn.block(true); fftwblConn.block(true); + usemaskConn.block(true); invblConn.block(true); medMethodConn.block(true); blurMethodConn.block(true); @@ -6236,6 +6254,7 @@ void LocallabBlur::enableListener() blMethodConn.block(false); fftwblConn.block(false); + usemaskConn.block(false); invblConn.block(false); medMethodConn.block(false); blurMethodConn.block(false); @@ -6274,6 +6293,7 @@ void LocallabBlur::read(const rtengine::procparams::ProcParams* pp, const Params } fftwbl->set_active(spot.fftwbl); + usemask->set_active(spot.usemask); invbl->set_active(spot.invbl); radius->setValue(spot.radius); strength->setValue(spot.strength); @@ -6327,6 +6347,8 @@ void LocallabBlur::read(const rtengine::procparams::ProcParams* pp, const Params noiselumf2->setValue(spot.noiselumf2); noiselumc->setValue(spot.noiselumc); noiselumdetail->setValue(spot.noiselumdetail); + levelthr->setValue(spot.levelthr); + levelthrlow->setValue(spot.levelthrlow); noiselequal->setValue((double)spot.noiselequal); noisechrof->setValue(spot.noisechrof); noisechroc->setValue(spot.noisechroc); @@ -6335,7 +6357,7 @@ void LocallabBlur::read(const rtengine::procparams::ProcParams* pp, const Params adjblur->setValue((double)spot.adjblur); bilateral->setValue((double)spot.bilateral); sensiden->setValue((double)spot.sensiden); - + if (spot.showmaskblMethodtyp == "blur") { showmaskblMethodtyp ->set_active(0); } else if (spot.showmaskblMethodtyp == "nois") { @@ -6395,6 +6417,7 @@ void LocallabBlur::write(rtengine::procparams::ProcParams* pp, ParamsEdited* ped } spot.fftwbl = fftwbl->get_active(); + spot.usemask = usemask->get_active(); spot.invbl = invbl->get_active(); spot.radius = radius->getValue(); spot.strength = strength->getIntValue(); @@ -6448,6 +6471,8 @@ void LocallabBlur::write(rtengine::procparams::ProcParams* pp, ParamsEdited* ped spot.noiselumf2 = noiselumf2->getValue(); spot.noiselumc = noiselumc->getValue(); spot.noiselumdetail = noiselumdetail->getValue(); + spot.levelthr = levelthr->getValue(); + spot.levelthrlow = levelthrlow->getValue(); spot.noiselequal = noiselequal->getIntValue(); spot.noisechrof = noisechrof->getValue(); spot.noisechroc = noisechroc->getValue(); @@ -6482,6 +6507,7 @@ void LocallabBlur::write(rtengine::procparams::ProcParams* pp, ParamsEdited* ped spot.Lmaskblcurve = Lmaskblshape->getCurve(); spot.LLmaskblcurvewav = LLmaskblshapewav->getCurve(); spot.csthresholdblur = csThresholdblur->getValue(); + } // Note: No need to manage pedited as batch mode is deactivated for Locallab @@ -6510,6 +6536,8 @@ void LocallabBlur::setDefaults(const rtengine::procparams::ProcParams* defParams noiselumf2->setDefault(defSpot.noiselumf2); noiselumc->setDefault(defSpot.noiselumc); noiselumdetail->setDefault(defSpot.noiselumdetail); + levelthr->setDefault(defSpot.levelthr); + levelthrlow->setDefault(defSpot.levelthrlow); noiselequal->setDefault((double)defSpot.noiselequal); noisechrof->setDefault(defSpot.noisechrof); noisechroc->setDefault(defSpot.noisechroc); @@ -6648,6 +6676,20 @@ void LocallabBlur::adjusterChanged(Adjuster* a, double newval) } } + if (a == levelthr) { + if (listener) { + listener->panelChanged(Evlocallablevelthr, + levelthr->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (a == levelthrlow) { + if (listener) { + listener->panelChanged(Evlocallablevelthrlow, + levelthrlow->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + if (a == noisechrof) { if (listener) { listener->panelChanged(Evlocallabnoisechrof, @@ -6763,6 +6805,8 @@ void LocallabBlur::adjusterChanged(Adjuster* a, double newval) } } + + void LocallabBlur::adjusterChanged2(ThresholdAdjuster* a, int newBottomL, int newTopL, int newBottomR, int newTopR) { if (isLocActivated && exp->getEnabled()) { @@ -6891,6 +6935,9 @@ void LocallabBlur::convertParamToSimple() gammaskbl->setValue(defSpot.gammaskbl); slomaskbl->setValue(defSpot.slomaskbl); Lmaskblshape->setCurve(defSpot.Lmasklccurve); + levelthr->setValue(defSpot.levelthr); + levelthrlow->setValue(defSpot.levelthrlow); + usemask->set_active(defSpot.usemask); // Enable all listeners enableListener(); @@ -6903,6 +6950,7 @@ void LocallabBlur::updateGUIToMode(const modeType new_type) // Expert and Normal mode widgets are hidden in Simple mode fftwbl->hide(); expmaskbl->hide(); + expdenoise1->hide(); break; @@ -6918,6 +6966,7 @@ void LocallabBlur::updateGUIToMode(const modeType new_type) csThresholdblur->hide(); // Specific Simple mode widgets are shown in Normal mode expmaskbl->show(); + expdenoise1->show(); break; @@ -6927,6 +6976,7 @@ void LocallabBlur::updateGUIToMode(const modeType new_type) if (blMethod->get_active_row_number() == 0) { // Keep widget hidden when blMethod is > 0 fftwbl->show(); } + expdenoise1->show(); expmaskbl->show(); strumaskbl->show(); @@ -6997,6 +7047,21 @@ void LocallabBlur::fftwblChanged() } } +void LocallabBlur::usemaskChanged() +{ + if (isLocActivated && exp->getEnabled()) { + if (listener) { + if (usemask->get_active()) { + listener->panelChanged(Evlocallabusemask1, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(spotName) + ")"); + } else { + listener->panelChanged(Evlocallabusemask1, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(spotName) + ")"); + } + } + } +} + void LocallabBlur::invblChanged() { const LocallabParams::LocallabSpot defSpot; diff --git a/rtgui/locallabtools.h b/rtgui/locallabtools.h index e15cd716c..ad100baae 100644 --- a/rtgui/locallabtools.h +++ b/rtgui/locallabtools.h @@ -278,6 +278,7 @@ public: void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; void adjusterChanged(Adjuster* a, double newval) override; void adjusterChanged(ThresholdAdjuster* a, double newBottom, double newTop) override {}; // Not used +// void adjusterChanged3(ThresholdAdjuster* a, double newBottom, double newTop) override {}; void adjusterChanged(ThresholdAdjuster* a, double newBottomLeft, double newTopLeft, double newBottomRight, double newTopRight) override {}; // Not used void adjusterChanged(ThresholdAdjuster* a, int newBottom, int newTop) override {}; // Not used void adjusterChanged(ThresholdAdjuster* a, int newBottomLeft, int newTopLeft, int newBottomRight, int newTopRight) override {}; // Not used @@ -558,6 +559,7 @@ public: void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; void adjusterChanged(Adjuster* a, double newval) override; void adjusterChanged(ThresholdAdjuster* a, double newBottom, double newTop) override {}; // Not used +// void adjusterChanged3(ThresholdAdjuster* a, double newBottom, double newTop) override {}; void adjusterChanged(ThresholdAdjuster* a, double newBottomLeft, double newTopLeft, double newBottomRight, double newTopRight) override {}; // Not used void adjusterChanged(ThresholdAdjuster* a, int newBottom, int newTop) override; void adjusterChanged(ThresholdAdjuster* a, int newBottomLeft, int newTopLeft, int newBottomRight, int newTopRight) override {}; // Not used @@ -633,6 +635,8 @@ class LocallabBlur: public Gtk::VBox, public LocallabTool, public ThresholdAdjusterListener +// public ThresholdCurveProvider + { private: // Blur & Noise specific widgets @@ -659,6 +663,10 @@ private: MyComboBoxText* const quamethod; CurveEditorGroup* const LocalcurveEditorwavden; FlatCurveEditor* const wavshapeden; + MyExpander* const expdenoise1; + Gtk::CheckButton* const usemask; + Adjuster* const levelthr; + Adjuster* const levelthrlow; Adjuster* const noiselumf0; Adjuster* const noiselumf; Adjuster* const noiselumf2; @@ -701,7 +709,7 @@ private: ThresholdAdjuster* const csThresholdblur; sigc::connection blMethodConn, fftwblConn, invblConn, medMethodConn, blurMethodConn, chroMethodConn, activlumConn, showmaskblMethodConn, showmaskblMethodtypConn, enablMaskConn, toolblConn; - sigc::connection quamethodconn; + sigc::connection quamethodconn, usemaskConn; public: LocallabBlur(); ~LocallabBlur(); @@ -720,6 +728,7 @@ public: void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; void adjusterChanged(Adjuster* a, double newval) override; void adjusterChanged(ThresholdAdjuster* a, double newBottom, double newTop) override {}; // Not used +// void adjusterChanged3(ThresholdAdjuster* a, double newBotto, double newTo) override; void adjusterChanged(ThresholdAdjuster* a, double newBottomLeft, double newTopLeft, double newBottomRight, double newTopRight) override {}; // Not used void adjusterChanged(ThresholdAdjuster* a, int newBottom, int newTop) override {}; // Not used void adjusterChanged(ThresholdAdjuster* a, int newBottomLeft, int newTopLeft, int newBottomRight, int newTopRight) override {}; // Not used @@ -736,6 +745,7 @@ private: void blMethodChanged(); void fftwblChanged(); + void usemaskChanged(); void invblChanged(); void medMethodChanged(); void blurMethodChanged(); @@ -969,6 +979,7 @@ class LocallabContrast: public Gtk::VBox, public LocallabTool, public ThresholdAdjusterListener + { private: MyComboBoxText* const localcontMethod; @@ -1077,6 +1088,7 @@ public: void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; void adjusterChanged(Adjuster* a, double newval) override; void adjusterChanged(ThresholdAdjuster* a, double newBottom, double newTop) override {}; // Not used +// void adjusterChanged3(ThresholdAdjuster* a, double newBottom, double newTop) override {}; void adjusterChanged(ThresholdAdjuster* a, double newBottomLeft, double newTopLeft, double newBottomRight, double newTopRight) override {}; // Not used void adjusterChanged(ThresholdAdjuster* a, int newBottom, int newTop) override {}; // Not used void adjusterChanged(ThresholdAdjuster* a, int newBottomLeft, int newTopLeft, int newBottomRight, int newTopRight) override {}; // Not used @@ -1347,6 +1359,7 @@ public: void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; void adjusterChanged(Adjuster* a, double newval) override; void adjusterChanged(ThresholdAdjuster* a, double newBottom, double newTop) override {}; // Not used +// void adjusterChanged3(ThresholdAdjuster* a, double newBottom, double newTop) override {}; void adjusterChanged(ThresholdAdjuster* a, double newBottomLeft, double newTopLeft, double newBottomRight, double newTopRight) override {}; // Not used void adjusterChanged(ThresholdAdjuster* a, int newBottom, int newTop) override {}; // Not used void adjusterChanged(ThresholdAdjuster* a, int newBottomLeft, int newTopLeft, int newBottomRight, int newTopRight) override {}; // Not used diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 628d07214..59a97234b 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1284,6 +1284,9 @@ void ParamsEdited::initFrom(const std::vector& 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).usemask = locallab.spots.at(j).usemask && pSpot.usemask == otherSpot.usemask; + locallab.spots.at(j).levelthr = locallab.spots.at(j).levelthr && pSpot.levelthr == otherSpot.levelthr; + locallab.spots.at(j).levelthrlow = locallab.spots.at(j).levelthrlow && pSpot.levelthrlow == otherSpot.levelthrlow; 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).noiselumf = locallab.spots.at(j).noiselumf && pSpot.noiselumf == otherSpot.noiselumf; @@ -4052,6 +4055,18 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).blurMethod = mods.locallab.spots.at(i).blurMethod; } + if (locallab.spots.at(i).usemask) { + toEdit.locallab.spots.at(i).usemask = mods.locallab.spots.at(i).usemask; + } + + if (locallab.spots.at(i).levelthr) { + toEdit.locallab.spots.at(i).levelthr = mods.locallab.spots.at(i).levelthr; + } + + if (locallab.spots.at(i).levelthrlow) { + toEdit.locallab.spots.at(i).levelthrlow = mods.locallab.spots.at(i).levelthrlow; + } + if (locallab.spots.at(i).medMethod) { toEdit.locallab.spots.at(i).medMethod = mods.locallab.spots.at(i).medMethod; } @@ -6567,6 +6582,9 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : blMethod(v), chroMethod(v), quamethod(v), + usemask(v), + levelthr(v), + levelthrlow(v), blurMethod(v), medMethod(v), activlum(v), @@ -7082,6 +7100,9 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) blMethod = v; chroMethod = v; quamethod = v; + usemask = v; + levelthr = v; + levelthrlow = v; blurMethod = v; medMethod = v; activlum = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index ea4ebfdce..e035b2b13 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -620,6 +620,9 @@ public: bool blMethod; bool chroMethod; bool quamethod; + bool usemask; + bool levelthr; + bool levelthrlow; bool blurMethod; bool medMethod; bool activlum;