From b8d5a3d9fbee253883437d94b494f174fb30fdad Mon Sep 17 00:00:00 2001 From: Desmis Date: Fri, 1 Jan 2021 12:05:33 +0100 Subject: [PATCH] Local adjustments - Log encoding - Recovery based on mask luminance (#6038) * GUI for recovery mask - Log encoding * Enable recovery Log encoding with luminance mask --- rtdata/languages/default | 8 +++ rtengine/hilite_recon.cc | 5 +- rtengine/iplocallab.cc | 88 +++++++++++++++++++++++++++++ rtengine/procevents.h | 4 ++ rtengine/procparams.cc | 16 ++++++ rtengine/procparams.h | 4 ++ rtengine/refreshmap.cc | 6 +- rtgui/locallabtools.h | 8 +++ rtgui/locallabtools2.cc | 119 +++++++++++++++++++++++++++++++++++++++ rtgui/paramsedited.cc | 28 +++++++++ rtgui/paramsedited.h | 4 ++ 11 files changed, 288 insertions(+), 2 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 78db75169..cbcdebac3 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1245,6 +1245,10 @@ HISTORY_MSG_997;Local - Color threshold mask low HISTORY_MSG_998;Local - Color threshold mask high HISTORY_MSG_999;Local - Color decay HISTORY_MSG_1000;Local - Denoise gray +HISTORY_MSG_1001;Local - Log recovery threshold +HISTORY_MSG_1002;Local - Log threshold mask low +HISTORY_MSG_1003;Local - Log threshold mask high +HISTORY_MSG_1004;Local - Log decay HISTORY_MSG_BLSHAPE;Blur by level HISTORY_MSG_BLURCWAV;Blur chroma HISTORY_MSG_BLURWAV;Blur luminance @@ -2783,8 +2787,10 @@ TP_LOCALLAB_MASKLC_TOOLTIP;This allows you to target the denoise based on the im TP_LOCALLAB_MASKDE_TOOLTIP;Used to direct the Denoise 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 If the mask is below the ‘dark’ threshold, then the Denoise will be applied progressively.\n if the mask is above the ‘light’ threshold, then the Denoise will be applied progressively.\n Between the two, the image settings without the Denoise will be maintained, unless you act on the slider "Gray area denoise". TP_LOCALLAB_MASKGF_TOOLTIP;Used to direct the Guided Filter 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 If the mask is below the ‘dark’ threshold, then the GF will be applied progressively.\n if the mask is above the ‘light’ threshold, then the GF will be applied progressively.\n Between the two, the image settings without the GF will be maintained. TP_LOCALLAB_MASKRECOL_TOOLTIP;Used to modulate the effect of the Color and Light 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 Color and Light settings \n In between these two areas, the full value of the Color and Light settings will be applied +TP_LOCALLAB_MASKRELOG_TOOLTIP;Used to modulate the effect of the Log encoding 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 Log encoding settings - can be used to restore highlights reconstructed by Color propagation \n In between these two areas, the full value of the Log encoding settings will be applied TP_LOCALLAB_MASKDEINV_TOOLTIP;Reverses the way the algorithm interprets the mask.\nIf checked black and very light areas will be decreased. 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’, ‘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_MASKHIGTHRESL_TOOLTIP;Light-tone limit above which Log encoding will be restored progressively to their original values prior to being modified by the Log encoding settings .\n You can use certain tools in ‘Mask and modifications’ to change the gray levels:‘Smooth radius’, ‘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_MASKHIGTHRESD_TOOLTIP;Light-tone limit above which denoise will be progressively applied.\n You can use certain tools in ‘Mask and modifications’ to change the gray levels: ‘structure 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_MASKHIGTHRES_TOOLTIP;Light-tone limit above which 'Guided Filter' will be progressively applied.\n You can use certain tools in ‘Mask and modifications’ to change the gray levels: ‘structure 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_MASKLCTHR;Light area luminance threshold @@ -2793,6 +2799,8 @@ TP_LOCALLAB_MASKLNOISELOW;Reinforce denoise in dark and light areas TP_LOCALLAB_MASKLOWTHRES_TOOLTIP;Dark-tone limit below which 'Guided Filter' will be progressively applied.\n You can use certain tools in ‘Mask and modifications’ to change the gray levels: ‘structure 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_MASKLOWTHRESD_TOOLTIP;Dark-tone limit below which denoise will be progressively applied.\n You can use certain tools in ‘Mask and modifications’ to change the gray levels: ‘structure 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_MASKLOWTHRESC_TOOLTIP;Dark-tone limit below 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’, ‘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_MASKLOWTHRESL_TOOLTIP;Dark-tone limit below which Log encoding will be restored progressively to their original values prior to being modified by the Log encoding settings.\n You can use certain tools in ‘Mask and modifications’ to change the gray levels:‘Smooth radius’, ‘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_MASKLCTHRMID;Gray area denoise TP_LOCALLAB_MASKUSABLE;Mask enabled (Mask & modifications) TP_LOCALLAB_MASKUNUSABLE;Mask disabled (Mask & modifications) diff --git a/rtengine/hilite_recon.cc b/rtengine/hilite_recon.cc index 1a4c4c7f4..6c41ad5ae 100644 --- a/rtengine/hilite_recon.cc +++ b/rtengine/hilite_recon.cc @@ -32,6 +32,8 @@ #include "opthelper.h" #include "rawimagesource.h" #include "rt_math.h" +#define BENCHMARK +#include "StopWatch.h" namespace { @@ -289,7 +291,8 @@ namespace rtengine { void RawImageSource::HLRecovery_inpaint(float** red, float** green, float** blue) -{ +{ + BENCHFUN double progress = 0.0; if (plistener) { diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 38b17b2ab..9fe6421a3 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -591,6 +591,10 @@ struct local_params { float lowthrc; float higthrc; float decayc; + float recothrl; + float lowthrl; + float higthrl; + float decayl; int noiselequal; float noisechrodetail; float bilat; @@ -1051,6 +1055,10 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall float local_lowthrc = (float)locallab.spots.at(sp).lowthresc; float local_higthrc = (float)locallab.spots.at(sp).higthresc; float local_decayc = (float)locallab.spots.at(sp).decayc; + float local_recothrl = (float)locallab.spots.at(sp).recothresl; + float local_lowthrl = (float)locallab.spots.at(sp).lowthresl; + float local_higthrl = (float)locallab.spots.at(sp).higthresl; + float local_decayl = (float)locallab.spots.at(sp).decayl; float local_noisecf = ((float)locallab.spots.at(sp).noisechrof) / 10.f; float local_noisecc = ((float)locallab.spots.at(sp).noisechroc) / 10.f; @@ -1410,6 +1418,10 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.lowthrc = local_lowthrc; lp.higthrc = local_higthrc; lp.decayc = local_decayc; + lp.recothrl = local_recothrl; + lp.lowthrl = local_lowthrl; + lp.higthrl = local_higthrl; + lp.decayl = local_decayl; lp.noiselequal = local_noiselequal; lp.noisechrodetail = local_noisechrodetail; lp.noiselc = local_noiselc; @@ -10818,6 +10830,82 @@ void ImProcFunctions::Lab_Local( } } + + if(lp.enaLMask && lp.recothrl != 1.f) { + LabImage tmp3(bfw, bfh); + + for (int y = 0; y < bfh; y++){ + for (int x = 0; x < bfw; x++) { + tmp3.L[y][x] = original->L[y + ystart][x + xstart]; + tmp3.a[y][x] = original->a[y + ystart][x + xstart]; + tmp3.b[y][x] = original->b[y + ystart][x + xstart]; + } + } + array2D masklum; + masklum(bfw, bfh); + for (int ir = 0; ir < bfh; ir++) + for (int jr = 0; jr < bfw; jr++) { + masklum[ir][jr] = 1.f; + } + + float hig = lp.higthrl; + float higc; + calcdif(hig, higc); + float low = lp.lowthrl; + float lowc; + calcdif(low, lowc); + + if(higc < lowc) { + higc = lowc + 0.01f; + } + float th = (lp.recothrl - 1.f); + float ahigh = th / (higc - 100.f); + float bhigh = 1.f - higc * ahigh; + + float alow = th / lowc; + float blow = 1.f - th; + bool invmaskl = false; +#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 = bufmaskoriglog->L[ir][jr]; + const float lmr = lM / 327.68f; + if (lM < 327.68f * lowc) { + masklum[ir][jr] = alow * lmr + blow; + } else if (lM < 327.68f * higc) { + + } else { + masklum[ir][jr] = ahigh * lmr + bhigh; + } + float k = masklum[ir][jr]; + if(invmaskl == false) { + masklum[ir][jr] = 1 - pow(k, lp.decayl); + } else { + masklum[ir][jr] = pow(k, lp.decayl); + } + + } + + for (int i = 0; i < 3; ++i) { + boxblur(masklum, masklum, 10 / sk, bfw, bfh, false); + } + +#ifdef _OPENMP + #pragma omp parallel for if (multiThread) +#endif + for (int i = 0; i < bfh; ++i) { + for (int j = 0; j < bfw; ++j) { + bufexpfin->L[i][j] = (tmp3.L[i][j] - bufexpfin->L[i][j]) * LIM01(masklum[i][j]) + bufexpfin->L[i][j]; + bufexpfin->a[i][j] = (tmp3.a[i][j] - bufexpfin->a[i][j]) * LIM01(masklum[i][j]) + bufexpfin->a[i][j]; + bufexpfin->b[i][j] = (tmp3.b[i][j] - bufexpfin->b[i][j]) * LIM01(masklum[i][j]) + bufexpfin->b[i][j]; + } + } + masklum.free(); + + } + //end graduated transit_shapedetect2(call, 11, bufexporig.get(), bufexpfin.get(), originalmasklog.get(), hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk); } diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 06c3c50da..8bad0a588 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -1023,6 +1023,10 @@ enum ProcEventCode { Evlocallabhigthresc = 997, Evlocallabdecayc = 998, Evlocallabmidthresd = 999, + Evlocallabrecothresl = 1000, + Evlocallablowthresl = 1001, + Evlocallabhigthresl = 1002, + Evlocallabdecayl = 1003, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 8e30a6e5c..3698518ee 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -4017,6 +4017,10 @@ LocallabParams::LocallabSpot::LocallabSpot() : 1.0, 1.0 }, + recothresl(1.), + lowthresl(12.), + higthresl(85.), + decayl(2.), // mask visimask(false), complexmask(0), @@ -4636,6 +4640,10 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && radmaskL == other.radmaskL && chromaskL == other.chromaskL && LmaskcurveL == other.LmaskcurveL + && recothresl == other.recothresl + && lowthresl == other.lowthresl + && higthresl == other.higthresl + && decayl == other.decayl // mask && visimask == other.visimask @@ -6238,6 +6246,10 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->radmaskL, "Locallab", "radmaskL_" + index_str, spot.radmaskL, keyFile); saveToKeyfile(!pedited || spot_edited->chromaskL, "Locallab", "chromaskL_" + index_str, spot.chromaskL, keyFile); saveToKeyfile(!pedited || spot_edited->LmaskcurveL, "Locallab", "LmaskCurveL_" + index_str, spot.LmaskcurveL, keyFile); + saveToKeyfile(!pedited || spot_edited->recothresl, "Locallab", "Recothresl_" + index_str, spot.recothresl, keyFile); + saveToKeyfile(!pedited || spot_edited->lowthresl, "Locallab", "Lowthresl_" + index_str, spot.lowthresl, keyFile); + saveToKeyfile(!pedited || spot_edited->higthresl, "Locallab", "Higthresl_" + index_str, spot.higthresl, keyFile); + saveToKeyfile(!pedited || spot_edited->decayl, "Locallab", "Decayl_" + index_str, spot.decayl, keyFile); } //mask @@ -8092,6 +8104,10 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "radmaskL_" + index_str, pedited, spot.radmaskL, spotEdited.radmaskL); assignFromKeyfile(keyFile, "Locallab", "chromaskL_" + index_str, pedited, spot.chromaskL, spotEdited.chromaskL); assignFromKeyfile(keyFile, "Locallab", "LmaskCurveL_" + index_str, pedited, spot.LmaskcurveL, spotEdited.LmaskcurveL); + assignFromKeyfile(keyFile, "Locallab", "Recothresl_" + index_str, pedited, spot.recothresl, spotEdited.recothresl); + assignFromKeyfile(keyFile, "Locallab", "Lowthresl_" + index_str, pedited, spot.lowthresl, spotEdited.lowthresl); + assignFromKeyfile(keyFile, "Locallab", "Higthresl_" + index_str, pedited, spot.higthresl, spotEdited.higthresl); + assignFromKeyfile(keyFile, "Locallab", "Decayl_" + index_str, pedited, spot.decayl, spotEdited.decayl); // mask spot.visimask = assignFromKeyfile(keyFile, "Locallab", "Expmask_" + index_str, pedited, spot.expmask, spotEdited.expmask); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 368b7e5e7..fd5726646 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1477,6 +1477,10 @@ struct LocallabParams { double radmaskL; double chromaskL; std::vector LmaskcurveL; + double recothresl; + double lowthresl; + double higthresl; + double decayl; // mask bool visimask; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 127acfb8a..d97dc1ce2 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -1026,7 +1026,11 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // Evlocallablowthresc LUMINANCECURVE, // Evlocallabhigthresc LUMINANCECURVE, // Evlocallabdecayc - LUMINANCECURVE // Evlocallabmidthresd + LUMINANCECURVE, // Evlocallabmidthresd + LUMINANCECURVE, // Evlocallabrecothresl + LUMINANCECURVE, // Evlocallablowthresl + LUMINANCECURVE, // Evlocallabhigthresl + LUMINANCECURVE // Evlocallabdecayl }; diff --git a/rtgui/locallabtools.h b/rtgui/locallabtools.h index 03f6c0b5e..56b4e0b20 100644 --- a/rtgui/locallabtools.h +++ b/rtgui/locallabtools.h @@ -1269,6 +1269,14 @@ private: Gtk::HBox* const surrHBox; Adjuster* const baselog; + MyExpander* const exprecovl; + Gtk::Label* const maskusablel; + Gtk::Label* const maskunusablel; + Adjuster* const recothresl; + Adjuster* const lowthresl; + Adjuster* const higthresl; + Adjuster* const decayl; + Adjuster* const sensilog; Gtk::Frame* const gradlogFrame; Adjuster* const strlog; diff --git a/rtgui/locallabtools2.cc b/rtgui/locallabtools2.cc index aa08fe86d..8e71bb7f2 100644 --- a/rtgui/locallabtools2.cc +++ b/rtgui/locallabtools2.cc @@ -4658,6 +4658,14 @@ LocallabLog::LocallabLog(): surround(Gtk::manage (new MyComboBoxText ())), surrHBox(Gtk::manage(new Gtk::HBox())), baselog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BASELOG"), 1.3, 3., 0.05, 2.))),//, Gtk::manage(new RTImage("circle-black-small.png")), Gtk::manage(new RTImage("circle-white-small.png"))))), + exprecovl(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI2_EXP")))), + maskusablel(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUSABLE")))), + maskunusablel(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUNUSABLE")))), + recothresl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKRECOTHRES"), 1., 2., 0.01, 1.))), + lowthresl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKLCTHRLOW"), 1., 80., 0.5, 12.))), + higthresl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKLCTHR"), 20., 99., 0.5, 85.))), + decayl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKDDECAY"), 0.5, 4., 0.1, 2.))), + sensilog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 60))), gradlogFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_GRADLOGFRA")))), strlog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADSTR"), -2.0, 2.0, 0.05, 0.))), @@ -4731,6 +4739,11 @@ LocallabLog::LocallabLog(): targabs->setAdjusterListener(this); baselog->setAdjusterListener(this); + recothresl->setAdjusterListener(this); + lowthresl->setAdjusterListener(this); + higthresl->setAdjusterListener(this); + decayl->setAdjusterListener(this); + setExpandAlignProperties(exprecovl, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); sensilog->setAdjusterListener(this); @@ -4850,6 +4863,16 @@ LocallabLog::LocallabLog(): logP2Box->pack_start(*targabs); logP2Box->pack_start(*catad); logP2Box->pack_start (*surrHBox); + ToolParamBlock* const logBox3 = Gtk::manage(new ToolParamBlock()); + logBox3->pack_start(*maskusablel, Gtk::PACK_SHRINK, 0); + logBox3->pack_start(*maskunusablel, Gtk::PACK_SHRINK, 0); + logBox3->pack_start(*recothresl); + logBox3->pack_start(*lowthresl); + logBox3->pack_start(*higthresl); + logBox3->pack_start(*decayl); + // colBox3->pack_start(*invmaskc); + exprecovl->add(*logBox3, false); + ToolParamBlock* const logP3Box = Gtk::manage(new ToolParamBlock()); logP3Box->pack_start(*showmaskLMethod, Gtk::PACK_SHRINK, 4); logP3Box->pack_start(*enaLMask, Gtk::PACK_SHRINK, 0); @@ -4863,6 +4886,7 @@ LocallabLog::LocallabLog(): log2Frame->add(*logP2Box); pack_start(*log2Frame); + pack_start(*exprecovl, false, false); // pack_start(*baselog); pack_start(*sensilog); @@ -4887,6 +4911,7 @@ LocallabLog::~LocallabLog() void LocallabLog::setDefaultExpanderVisibility() { + exprecovl->set_expanded(false); expmaskL->set_expanded(false); expL->set_expanded(false); @@ -4905,6 +4930,7 @@ void LocallabLog::updateAdviceTooltips(const bool showTooltips) Autogray->set_tooltip_text(M("TP_LOCALLAB_LOGAUTOGRAY_TOOLTIP")); // blackEv->set_tooltip_text(M("TP_LOCALLAB_LOGBLACKWHEV_TOOLTIP")); // whiteEv->set_tooltip_text(M("TP_LOCALLAB_LOGBLACKWHEV_TOOLTIP")); + exprecovl->set_tooltip_markup(M("TP_LOCALLAB_MASKRELOG_TOOLTIP")); blackEv->set_tooltip_text(""); whiteEv->set_tooltip_text(""); sourceGray->set_tooltip_text(""); @@ -4934,6 +4960,9 @@ void LocallabLog::updateAdviceTooltips(const bool showTooltips) chromaskL->set_tooltip_text(M("TP_LOCALLAB_CHROMASK_TOOLTIP")); // mask2CurveEditorL->set_tooltip_text(M("TP_LOCALLAB_CONTRASTCURVMASK_TOOLTIP")); LmaskshapeL->setTooltip(M("TP_LOCALLAB_LMASK_LL_TOOLTIP")); + decayl->set_tooltip_text(M("TP_LOCALLAB_MASKDECAY_TOOLTIP")); + lowthresl->set_tooltip_text(M("TP_LOCALLAB_MASKLOWTHRESL_TOOLTIP")); + higthresl->set_tooltip_text(M("TP_LOCALLAB_MASKHIGTHRESL_TOOLTIP")); } else { @@ -4943,6 +4972,7 @@ void LocallabLog::updateAdviceTooltips(const bool showTooltips) logFrame->set_tooltip_text(""); log1Frame->set_tooltip_text(""); log2Frame->set_tooltip_text(""); + exprecovl->set_tooltip_markup(""); autocompute->set_tooltip_text(""); blackEv->set_tooltip_text(""); whiteEv->set_tooltip_text(""); @@ -4974,6 +5004,9 @@ void LocallabLog::updateAdviceTooltips(const bool showTooltips) chromaskL->set_tooltip_text(""); mask2CurveEditorL->set_tooltip_text(""); LmaskshapeL->setTooltip(""); + decayl->set_tooltip_text(""); + lowthresl->set_tooltip_text(""); + higthresl->set_tooltip_text(""); } } @@ -5068,6 +5101,10 @@ void LocallabLog::read(const rtengine::procparams::ProcParams* pp, const ParamsE } else if (spot.surround == "ExtremelyDark") { surround->set_active (3); } + recothresl->setValue((double)spot.recothresl); + lowthresl->setValue((double)spot.lowthresl); + higthresl->setValue((double)spot.higthresl); + decayl->setValue((double)spot.decayl); ciecam->set_active(spot.ciecam); fullimage->set_active(spot.fullimage); @@ -5158,6 +5195,11 @@ void LocallabLog::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedi spot.chromaskL = chromaskL->getValue(); spot.LmaskcurveL = LmaskshapeL->getCurve(); + spot.recothresl = recothresl->getValue(); + spot.lowthresl = lowthresl->getValue(); + spot.higthresl = higthresl->getValue(); + spot.decayl = decayl->getValue(); + if (sursour->get_active_row_number() == 0) { spot.sursour = "Average"; } else if (sursour->get_active_row_number() == 1) { @@ -5181,6 +5223,15 @@ void LocallabLog::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedi void LocallabLog::enaLMaskChanged() { + if (enaLMask->get_active()) { + maskusablel->show(); + maskunusablel->hide(); + + } else { + maskusablel->hide(); + maskunusablel->show(); + } + if (isLocActivated && exp->getEnabled()) { if (listener) { if (enaLMask->get_active()) { @@ -5218,6 +5269,10 @@ void LocallabLog::updateGUIToMode(const modeType new_type) surHBox->hide(); expmaskL->hide(); gradlogFrame->hide(); + exprecovl->hide(); + maskusablel->hide(); + maskunusablel->hide(); + decayl->hide(); break; case Normal: @@ -5239,6 +5294,17 @@ void LocallabLog::updateGUIToMode(const modeType new_type) surHBox->hide(); expmaskL->hide(); gradlogFrame->show(); + if (enaLMask->get_active()) { + maskusablel->show(); + maskunusablel->hide(); + + } else { + maskusablel->hide(); + maskunusablel->show(); + } + + exprecovl->show(); + decayl->hide(); break; @@ -5260,6 +5326,16 @@ void LocallabLog::updateGUIToMode(const modeType new_type) expmaskL->show(); gradlogFrame->show(); surHBox->show(); + if (enaLMask->get_active()) { + maskusablel->show(); + maskunusablel->hide(); + + } else { + maskusablel->hide(); + maskunusablel->show(); + } + exprecovl->show(); + decayl->show(); } } @@ -5282,6 +5358,10 @@ void LocallabLog::convertParamToSimple() strlog->setValue(defSpot.strlog); anglog->setValue(defSpot.anglog); enaLMask->set_active(false); + recothresl->setValue(defSpot.recothresl); + lowthresl->setValue(defSpot.lowthresl); + higthresl->setValue(defSpot.higthresl); + decayl->setValue(defSpot.decayl); // Enable all listeners enableListener(); } @@ -5300,6 +5380,7 @@ void LocallabLog::convertParamToNormal() lightq->setValue(defSpot.lightq); sursour->set_active(0); enaLMask->set_active(false); + decayl->setValue(defSpot.decayl); // Enable all listeners enableListener(); @@ -5392,6 +5473,10 @@ void LocallabLog::setDefaults(const rtengine::procparams::ProcParams* defParams, blendmaskL->setDefault(defSpot.blendmaskL); radmaskL->setDefault(defSpot.radmaskL); chromaskL->setDefault(defSpot.chromaskL); + recothresl->setDefault((double)defSpot.recothresl); + lowthresl->setDefault((double)defSpot.lowthresl); + higthresl->setDefault((double)defSpot.higthresl); + decayl->setDefault((double)defSpot.decayl); } @@ -5515,6 +5600,36 @@ void LocallabLog::adjusterChanged(Adjuster* a, double newval) } } + if (a == recothresl) { + + if (listener) { + listener->panelChanged(Evlocallabrecothresl, + recothresl->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (a == lowthresl) { + if (listener) { + listener->panelChanged(Evlocallablowthresl, + lowthresl->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (a == higthresl) { + if (listener) { + listener->panelChanged(Evlocallabhigthresl, + higthresl->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (a == decayl) { + if (listener) { + listener->panelChanged(Evlocallabdecayl, + decayl->getTextValue() + " (" + escapeHtmlChars(spotName) + ")"); + } + } + + if (a == sensilog) { if (listener) { listener->panelChanged(Evlocallabsensilog, @@ -5777,6 +5892,10 @@ void LocallabLog::updateLogGUI() sourceabs->hide(); } } + if (mode == Expert || mode == Normal) { // Keep widget hidden in Simple mode + exprecovl->show(); + } + } diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 3a47da11a..d32e75488 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1552,6 +1552,10 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).radmaskL = locallab.spots.at(j).radmaskL && pSpot.radmaskL == otherSpot.radmaskL; locallab.spots.at(j).chromaskL = locallab.spots.at(j).chromaskL && pSpot.chromaskL == otherSpot.chromaskL; locallab.spots.at(j).LmaskcurveL = locallab.spots.at(j).LmaskcurveL && pSpot.LmaskcurveL == otherSpot.LmaskcurveL; + locallab.spots.at(j).recothresl = locallab.spots.at(j).recothresl && pSpot.recothresl == otherSpot.recothresl; + locallab.spots.at(j).lowthresl = locallab.spots.at(j).lowthresl && pSpot.lowthresl == otherSpot.lowthresl; + locallab.spots.at(j).higthresl = locallab.spots.at(j).higthresl && pSpot.higthresl == otherSpot.higthresl; + locallab.spots.at(j).decayl = locallab.spots.at(j).decayl && pSpot.decayl == otherSpot.decayl; //mask @@ -5112,6 +5116,22 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).LmaskcurveL = mods.locallab.spots.at(i).LmaskcurveL; } + if (locallab.spots.at(i).recothresl) { + toEdit.locallab.spots.at(i).recothresl = mods.locallab.spots.at(i).recothresl; + } + + if (locallab.spots.at(i).lowthresl) { + toEdit.locallab.spots.at(i).lowthresl = mods.locallab.spots.at(i).lowthresl; + } + + if (locallab.spots.at(i).higthresl) { + toEdit.locallab.spots.at(i).higthresl = mods.locallab.spots.at(i).higthresl; + } + + if (locallab.spots.at(i).decayl) { + toEdit.locallab.spots.at(i).decayl = mods.locallab.spots.at(i).decayl; + } + // mask if (locallab.spots.at(i).visimask) { toEdit.locallab.spots.at(i).visimask = mods.locallab.spots.at(i).visimask; @@ -6922,6 +6942,10 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : radmaskL(v), chromaskL(v), LmaskcurveL(v), + recothresl(v), + lowthresl(v), + higthresl(v), + decayl(v), // mask visimask(v), complexmask(v), @@ -7458,6 +7482,10 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) radmaskL = v; chromaskL = v; LmaskcurveL = v; + recothresl = v; + lowthresl = v; + higthresl = v; + decayl = v; // mask visimask = v; complexmask = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 5d4047d3e..70eb19f75 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -885,6 +885,10 @@ public: bool radmaskL; bool chromaskL; bool LmaskcurveL; + bool recothresl; + bool lowthresl; + bool higthresl; + bool decayl; //mask bool visimask; bool complexmask;