From 20a6e04d194237be77a4988c96b26f956d0c7ef6 Mon Sep 17 00:00:00 2001 From: Desmis Date: Thu, 17 Oct 2019 10:54:01 +0200 Subject: [PATCH] Add wavelet mask local contrast to mask 1+* --- rtdata/languages/default | 8 +++- rtengine/dcrop.cc | 7 ++++ rtengine/improccoordinator.cc | 11 ++++- rtengine/improccoordinator.h | 2 + rtengine/improcfun.h | 1 + rtengine/iplocallab.cc | 75 +++++++++++++++-------------------- rtengine/procevents.h | 2 + rtengine/procparams.cc | 8 ++++ rtengine/procparams.h | 2 + rtengine/refreshmap.cc | 4 +- rtengine/simpleprocess.cc | 5 +++ rtgui/locallab.cc | 46 +++++++++++++++++++++ rtgui/locallab.h | 3 ++ rtgui/paramsedited.cc | 14 +++++++ rtgui/paramsedited.h | 2 + 15 files changed, 143 insertions(+), 47 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index f2c31a1c8..51194f273 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1014,6 +1014,8 @@ HISTORY_MSG_773;Local - TM Mask contrast curve 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 Wavelet level HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -2086,7 +2088,7 @@ TP_LOCALLAB_ARTIF_TOOLTIP;Increase deltaE Weakening improve shape detection, but TP_LOCALLAB_AVOID;Avoid color shift TP_LOCALLAB_BALAN;Balance deltaE ab-L TP_LOCALLAB_BILATERAL;Bilateral filter -TP_LOCALLAB_MASK_TOOLTIP;You can enable multiple masks for a single tool, this requires activating another tool (but without using the tool : sliders to 0,...) where is the mask you want to activate.\nMasks with this ability are marked '+'\nThe number indicates the order of use of the masks.\n\nYou can combine the mask associated with the tool with an inverse mask.\nIn this case the new tool associated with the mask must be selected in inverse; you must use the tool with very small values (ex Exposure 0.01) +TP_LOCALLAB_MASK_TOOLTIP;You can enable multiple masks for a single tool, this requires activating another tool (but without using the tool : sliders to 0,...) where is the mask you want to activate.\nMasks with this ability are marked '+'\nMasks with additional features are marked '*'\nThe number indicates the order of use of the masks.\n\nYou can combine the mask associated with the tool with an inverse mask.\nIn this case the new tool associated with the mask must be selected in inverse; you must use the tool with very small values (ex Exposure 0.01) TP_LOCALLAB_CHROMASK_TOOLTIP;You can use this slider to desaturated background (inverse mask - curve near 0).\nAlso to attenuate or enhance the action of a mask on the chroma TP_LOCALLAB_BLENDMASKCOL;Blend TP_LOCALLAB_BLUR;Gaussian Blur - Noise - Grain @@ -2117,6 +2119,7 @@ TP_LOCALLAB_CHROMASKCOL;Chroma mask TP_LOCALLAB_GAMMASKCOL;Gamma mask TP_LOCALLAB_SLOMASKCOL;Slope mask TP_LOCALLAB_LAPMASKCOL;Laplacian threshold mask +TP_LOCALLAB_WAMASKCOL;Mask Wavelet level TP_LOCALLAB_LAPLACC;Mask Laplacian solve PDE TP_LOCALLAB_CHRRT;Chroma TP_LOCALLAB_CIRCRADIUS;Spot size @@ -2301,7 +2304,7 @@ TP_LOCALLAB_SHOWS;4+ - Mask and modifications TP_LOCALLAB_SHOWR;5 - Mask and modifications TP_LOCALLAB_SHOWE;6+ - Mask and modifications TP_LOCALLAB_SHOWC;7+ - Mask and modifications -TP_LOCALLAB_SHOWPLUS;1+ - Mask and modifications - Smooth-Blur & Denoise +TP_LOCALLAB_SHOWPLUS;1+* - Mask and modifications - Smooth-Blur & Denoise TP_LOCALLAB_SHOWMASKCOL_TOOLTIP;Display modifications.\nBeware, you can only view one modification (color and light or Exposure or Shadows-Highlight or TM or CBDL or Retinex MSR or Blur).\n\nUse Mask is before algorihtm shape detection TP_LOCALLAB_SHOWMNONE;None TP_LOCALLAB_SHOWMODIF;Show modifications whithout mask @@ -2325,6 +2328,7 @@ TP_LOCALLAB_SYM;Symmetrical (mouse) TP_LOCALLAB_WAVE;Wavelet TP_LOCALLAB_LOCCONT;Unsharp Mask TP_LOCALLAB_WAV;Levels local contrast +TP_LOCALLAB_WAVMASK;Mask Levels local contrast TP_LOCALLAB_LEVELWAV;Wavelets Levels TP_LOCALLAB_RESIDCONT;Residual image Contrast TP_LOCALLAB_RESIDCHRO;Residual image Chroma diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index bad345669..1d5ed3198 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -928,6 +928,7 @@ void Crop::update(int todo) bool lcmasblutili = parent->lcmasblutili; bool llmasblutili = parent->llmasblutili; bool locwavutili = parent->locwavutili; + bool lmasutiliblwav = parent->lmasutiliblwav; // float avg = parent->avg; LUTu dummy; @@ -958,6 +959,7 @@ void Crop::update(int todo) LocLLmaskCurve locllmasblCurve; LocHHmaskCurve lochhmasblCurve; LocwavCurve locwavCurve; + LocwavCurve loclmasCurveblwav; LocretigainCurverab locRETgainCurverab; locallutili = false; @@ -993,6 +995,8 @@ void Crop::update(int todo) locccmasblCurve.Set(params.locallab.spots.at(sp).CCmaskblcurve, lcmasblutili); locllmasblCurve.Set(params.locallab.spots.at(sp).LLmaskblcurve, llmasblutili); lochhmasblCurve.Set(params.locallab.spots.at(sp).HHmaskblcurve, lhmastmutili); + loclmasCurveblwav.Set(params.locallab.spots.at(sp).LLmaskblcurvewav, lmasutiliblwav); + locwavCurve.Set(params.locallab.spots.at(sp).locwavcurve, locwavutili); locallutili = false; CurveFactory::curveLocal(locallutili, params.locallab.spots.at(sp).llcurve, lllocalcurve2, sca); @@ -1064,6 +1068,7 @@ void Crop::update(int todo) locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili, locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, + loclmasCurveblwav,lmasutiliblwav, locwavCurve, locwavutili, LHutili, HHutili, cclocalcurve2, localcutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, @@ -1088,6 +1093,7 @@ void Crop::update(int todo) locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili, locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, + loclmasCurveblwav,lmasutiliblwav, locwavCurve, locwavutili, LHutili, HHutili, cclocalcurve2, localcutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1133,6 +1139,7 @@ void Crop::update(int todo) locccmasblCurve.Reset(); lochhmasblCurve.Reset(); locwavCurve.Reset(); + loclmasCurveblwav.Reset(); if (skip <= 2) { usleep(settings->cropsleep); //wait to avoid crash when crop 100% and move window diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index ce0eca227..1e33fd7a9 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -199,7 +199,9 @@ ImProcCoordinator::ImProcCoordinator() : llmasSHutili(false), lcmascbutili(false), lhmascbutili(false), - llmascbutili(false), + llmascbutili(false), + locwavutili(false), + lmasutiliblwav(false), LHutili(false), HHutili(false), huerefs(500, -100000.f), @@ -956,6 +958,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) lhmasutili = false; lcmasutili = false; locwavutili = false; + lmasutiliblwav = false; locRETgainCurve.Set(params->locallab.spots.at(sp).localTgaincurve); locRETtransCurve.Set(params->locallab.spots.at(sp).localTtranscurve); loclhCurve.Set(params->locallab.spots.at(sp).LHcurve, LHutili); @@ -981,6 +984,8 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) locllmasblCurve.Set(params->locallab.spots.at(sp).LLmaskblcurve, llmasblutili); locccmasblCurve.Set(params->locallab.spots.at(sp).CCmaskblcurve, lcmasblutili); lochhmasblCurve.Set(params->locallab.spots.at(sp).HHmaskblcurve, lhmasblutili); + loclmasCurveblwav.Set(params->locallab.spots.at(sp).LLmaskblcurvewav, lmasutiliblwav); + locwavCurve.Set(params->locallab.spots.at(sp).locwavcurve, locwavutili); CurveFactory::curveLocal(locallutili, params->locallab.spots.at(sp).llcurve, lllocalcurve, sca); CurveFactory::curveCCLocal(localcutili, params->locallab.spots.at(sp).cccurve, cclocalcurve, sca); @@ -1058,6 +1063,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili, locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, + loclmasCurveblwav,lmasutiliblwav, locwavCurve, locwavutili, LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, @@ -1081,6 +1087,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili, locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, + loclmasCurveblwav,lmasutiliblwav, locwavCurve, locwavutili, LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1133,7 +1140,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) locccmasblCurve.Reset(); lochhmasblCurve.Reset(); locwavCurve.Reset(); - + loclmasCurveblwav.Reset(); } } diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 031742103..a577466de 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -268,6 +268,7 @@ protected: LocLLmaskCurve locllmasblCurve; LocHHmaskCurve lochhmasblCurve; LocwavCurve locwavCurve; + LocwavCurve loclmasCurveblwav; bool locallutili; bool localcutili; @@ -301,6 +302,7 @@ protected: bool lhmasblutili; bool llmasblutili; bool locwavutili; + bool lmasutiliblwav; bool LHutili; bool HHutili; LUTf huerefs; diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 2c6556c7d..23705ed07 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -239,6 +239,7 @@ public: const LocCCmaskCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool & lhmasretiutili, const LocCCmaskCurve & locccmastmCurve, bool &lcmastmutili, const LocLLmaskCurve & locllmastmCurve, bool &llmastmutili, const LocHHmaskCurve & lochhmastmCurve, bool & lhmastmutili, const LocCCmaskCurve & locccmasblCurve, bool &lcmasblutili, const LocLLmaskCurve & locllmasblCurve, bool &llmasblutili, const LocHHmaskCurve & lochhmasblCurve, bool & lhmasblutili, + const LocwavCurve & loclmasCurveblwav, bool & lmasutiliblwav, const LocwavCurve & locwavCurve, bool & locwavutili, bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localcutili, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & lightCurveloc, double & huerefblur, double &chromarefblur, double & lumarefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref, diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 5e7c78f27..864a204f6 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -6840,6 +6840,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o const LocCCmaskCurve & locccmasretiCurve, bool & lcmasretiutili, const LocLLmaskCurve & locllmasretiCurve, bool & llmasretiutili, const LocHHmaskCurve & lochhmasretiCurve, bool & lhmasretiutili, const LocCCmaskCurve & locccmastmCurve, bool & lcmastmutili, const LocLLmaskCurve & locllmastmCurve, bool & llmastmutili, const LocHHmaskCurve & lochhmastmCurve, bool & lhmastmutili, const LocCCmaskCurve & locccmasblCurve, bool & lcmasblutili, const LocLLmaskCurve & locllmasblCurve, bool & llmasblutili, const LocHHmaskCurve & lochhmasblCurve, bool & lhmasblutili, + const LocwavCurve & loclmasCurveblwav, bool & lmasutiliblwav, const LocwavCurve & locwavCurve, bool & locwavutili, bool & LHutili, bool & HHutili, LUTf & cclocalcurve, bool & localcutili, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, LUTf & lightCurveloc, double & huerefblur, double & chromarefblur, double & lumarefblur, double & hueref, double & chromaref, double & lumaref, double & sobelref, @@ -7098,7 +7099,36 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o bufmaskblurbl->L[ir][jr] = 0.5f * lmaskbllocalcurve[2.f * bufmaskblurbl->L[ir][jr]]; } } + int wavelet_level = params->locallab.spots.at(sp).wavmaskbl; + int minwin = min(GW, GH); + int maxlevelspot = 9; + while ((1 << maxlevelspot) >= (minwin * sk) && maxlevelspot > 1) { + --maxlevelspot ; + } + wavelet_level = min(wavelet_level, maxlevelspot); + int maxlvl; + float contrast = 0.f; + bool wavcurvemask = false; + + if (loclmasCurveblwav && lmasutiliblwav) { + for (int i = 0; i < 500; i++) { + if (loclmasCurveblwav[i] != 0.5) { + wavcurvemask = true; + } + } + } + + if(wavcurvemask) { +#ifdef _OPENMP + const int numThreads = omp_get_max_threads(); +#else + const int numThreads = 1; + +#endif + + wavcontrast(bufmaskblurbl->L, contrast, GW, GH, wavelet_level, sk, numThreads, loclmasCurveblwav, lmasutiliblwav, maxlvl); + } float lap = params->locallab.spots.at(sp).lapmaskbl; bool pde = params->locallab.spots.at(sp).laplac; @@ -8606,52 +8636,13 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o const int numThreads = 1; #endif - + // adap maximum level wavelet to size of RT-spot int minwin = min(bfw, bfh); int maxlevelspot = 9; - - // adap maximum level wavelet to size of RT-spot - if (minwin * sk < 1024) { - maxlevelspot = 9; //sampling wavelet 512 + while ((1 << maxlevelspot) >= (minwin * sk) && maxlevelspot > 1) { + --maxlevelspot ; } - if (minwin * sk < 512) { - maxlevelspot = 8; //sampling wavelet 256 - } - - if (minwin * sk < 256) { - maxlevelspot = 7; //sampling 128 - } - - if (minwin * sk < 128) { - maxlevelspot = 6; - } - - if (minwin * sk < 64) { - maxlevelspot = 5; - } - - if (minwin * sk < 32) { - maxlevelspot = 4; - } - - if (minwin * sk < 16) { - maxlevelspot = 3; - } - - if (minwin * sk < 8) { - maxlevelspot = 2; - } - - if (minwin * sk < 4) { - maxlevelspot = 1; - } - - if (minwin * sk < 2) { - maxlevelspot = 0; - } - - wavelet_level = min(wavelet_level, maxlevelspot); bool exec = false; diff --git a/rtengine/procevents.h b/rtengine/procevents.h index d11376131..6194c40bf 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -803,6 +803,8 @@ enum ProcEventCode { EvlocallabLmaskretishape = 773, EvlocallabLmaskcbshape = 774, EvlocallabLmaskblshape = 775, + EvlocallabLLmaskblshapewav = 776, + Evlocallabwavmaskbl = 777, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 5e4457b2f..6298318c0 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2567,7 +2567,9 @@ LocallabParams::LocallabSpot::LocallabSpot() : gammaskbl(1.0), slomaskbl(0.0), lapmaskbl(0.0), + wavmaskbl(5), Lmaskblcurve{(double)DCT_NURBS, 0.0, 0.0, 1.0, 1.0}, + LLmaskblcurvewav{(double)FCT_MinMaxCPoints, 0.0, 0.5, 0.35, 0.35, 1., 0.5, 0.35, 0.35}, // Tone Mapping exptonemap(false), stren(0.5), @@ -2856,7 +2858,9 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && gammaskbl == other.gammaskbl && slomaskbl == other.slomaskbl && lapmaskbl == other.lapmaskbl + && wavmaskbl == other.wavmaskbl && Lmaskblcurve == other.Lmaskblcurve + && LLmaskblcurvewav == other.LLmaskblcurvewav // Tone Mapping && exptonemap == other.exptonemap && stren == other.stren @@ -4131,7 +4135,9 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).gammaskbl, "Locallab", "Gammaskbl_" + std::to_string(i), spot.gammaskbl, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).slomaskbl, "Locallab", "Slomaskbl_" + std::to_string(i), spot.slomaskbl, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).lapmaskbl, "Locallab", "Lapmaskbl_" + std::to_string(i), spot.lapmaskbl, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).wavmaskbl, "Locallab", "Wavmaskbllevel_" + std::to_string(i), spot.wavmaskbl, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).Lmaskblcurve, "Locallab", "LmaskblCurve_" + std::to_string(i), spot.Lmaskblcurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).LLmaskblcurvewav, "Locallab", "LLmaskblCurvewav_" + std::to_string(i), spot.LLmaskblcurvewav, keyFile); // Tone Mapping saveToKeyfile(!pedited || pedited->locallab.spots.at(i).exptonemap, "Locallab", "Exptonemap_" + std::to_string(i), spot.exptonemap, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).stren, "Locallab", "Stren_" + std::to_string(i), spot.stren, keyFile); @@ -5533,7 +5539,9 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Gammaskbl_" + std::to_string(i), pedited, spot.gammaskbl, spotEdited.gammaskbl); assignFromKeyfile(keyFile, "Locallab", "Slomaskbl_" + std::to_string(i), pedited, spot.slomaskbl, spotEdited.slomaskbl); assignFromKeyfile(keyFile, "Locallab", "Lapmaskbl_" + std::to_string(i), pedited, spot.lapmaskbl, spotEdited.lapmaskbl); + assignFromKeyfile(keyFile, "Locallab", "Wavmaskbllevel_" + std::to_string(i), pedited, spot.wavmaskbl, spotEdited.wavmaskbl); assignFromKeyfile(keyFile, "Locallab", "LmaskblCurve_" + std::to_string(i), pedited, spot.Lmaskblcurve, spotEdited.Lmaskblcurve); + assignFromKeyfile(keyFile, "Locallab", "LLmaskblCurvewav_" + std::to_string(i), pedited, spot.LLmaskblcurvewav, spotEdited.LLmaskblcurvewav); // Tone Mapping assignFromKeyfile(keyFile, "Locallab", "Exptonemap_" + std::to_string(i), pedited, spot.exptonemap, spotEdited.exptonemap); assignFromKeyfile(keyFile, "Locallab", "Stren_" + std::to_string(i), pedited, spot.stren, spotEdited.stren); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 973773f66..f3b9c5f11 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1116,7 +1116,9 @@ struct LocallabParams { double gammaskbl; double slomaskbl; double lapmaskbl; + int wavmaskbl; std::vector Lmaskblcurve; + std::vector LLmaskblcurvewav; // Tone Mapping bool exptonemap; double stren; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index dcb9bf4a3..9020c649b 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -802,7 +802,9 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //EvlocallabLmasktmshape LUMINANCECURVE, //EvlocallabLmaskretishape LUMINANCECURVE, //EvlocallabLmaskcbshape - LUMINANCECURVE //EvlocallabLmaskblshape + LUMINANCECURVE, //EvlocallabLmaskblshape + LUMINANCECURVE, //EvlocallabLLmaskblshapewav + LUMINANCECURVE //Evlocallabwavmaskbl }; namespace rtengine diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 6e18cb522..06de1263c 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1116,6 +1116,7 @@ private: LocCCmaskCurve locccmasblCurve; LocLLmaskCurve locllmasblCurve; LocHHmaskCurve lochhmasblCurve; + LocwavCurve loclmasCurveblwav; LocwavCurve locwavCurve; LUTf lllocalcurve(65536, 0); LUTf cclocalcurve(65536, 0); @@ -1179,6 +1180,7 @@ private: bool lhmasblutili = false; bool llmasblutili = false; bool locwavutili = false; + bool lmasutiliblwav = false; locRETgainCurve.Set(params.locallab.spots.at(sp).localTgaincurve); locRETtransCurve.Set(params.locallab.spots.at(sp).localTtranscurve); loclhCurve.Set(params.locallab.spots.at(sp).LHcurve, LHutili); @@ -1204,6 +1206,8 @@ private: locccmasblCurve.Set(params.locallab.spots.at(sp).CCmaskblcurve, lcmasblutili); locllmasblCurve.Set(params.locallab.spots.at(sp).LLmaskblcurve, llmasblutili); lochhmasblCurve.Set(params.locallab.spots.at(sp).HHmaskblcurve, lhmasblutili); + loclmasCurveblwav.Set(params.locallab.spots.at(sp).LLmaskblcurvewav, lmasutiliblwav); + locwavCurve.Set(params.locallab.spots.at(sp).locwavcurve, locwavutili); CurveFactory::curveLocal(locallutili, params.locallab.spots.at(sp).llcurve, lllocalcurve, 1); CurveFactory::curveCCLocal(localcutili, params.locallab.spots.at(sp).cccurve, cclocalcurve, 1); @@ -1262,6 +1266,7 @@ private: locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili, locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, + loclmasCurveblwav,lmasutiliblwav, locwavCurve, locwavutili, LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 487de19f4..be198a53b 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -168,6 +168,7 @@ Locallab::Locallab(): //Blur maskblCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), mask2blCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), + mask2blCurveEditorGwav(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_WAVMASK"))), //TM masktmCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), @@ -262,6 +263,7 @@ Locallab::Locallab(): 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.))), lapmaskbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LAPMASKCOL"), 0.0, 100.0, 0.1, 0.))), + wavmaskbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_WAMASKCOL"), 1, 9, 1, 5))), isogr(Gtk::manage(new Adjuster(M("TP_LOCALLAB_ISOGR"), 20, 6400, 1, 400))), strengr(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRENGR"), 0, 100, 1, 0))), scalegr(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SCALEGR"), 0, 100, 1, 100))), @@ -2139,6 +2141,20 @@ Locallab::Locallab(): Lmaskblshape->setBottomBarBgGradient(mLmaskblshape); Lmaskblshape->setLeftBarBgGradient(mLmaskblshape); mask2blCurveEditorG->curveListComplete(); + + mask2blCurveEditorGwav->setCurveListener(this); + LLmaskblshapewav = static_cast(mask2blCurveEditorGwav->addCurve(CT_Flat, "L(L)", nullptr, false, false)); + LLmaskblshapewav->setIdentityValue(0.); + LLmaskblshapewav->setResetCurve(FlatCurveType(defSpot.LLmaskblcurvewav.at(0)), defSpot.LLmaskblcurvewav); + + if (showtooltip) { + LLmaskblshapewav->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + } + + LLmaskblshapewav->setBottomBarBgGradient(mllshape); + + + mask2blCurveEditorGwav->curveListComplete(); @@ -2196,6 +2212,7 @@ Locallab::Locallab(): gammaskbl->setAdjusterListener(this); slomaskbl->setAdjusterListener(this); lapmaskbl->setAdjusterListener(this); + wavmaskbl->setAdjusterListener(this); ToolParamBlock* const maskblBox = Gtk::manage(new ToolParamBlock()); maskblBox->pack_start(*showmaskblMethod, Gtk::PACK_SHRINK, 4); @@ -2208,6 +2225,8 @@ Locallab::Locallab(): maskblBox->pack_start(*gammaskbl, Gtk::PACK_SHRINK, 0); maskblBox->pack_start(*slomaskbl, Gtk::PACK_SHRINK, 0); maskblBox->pack_start(*mask2blCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + maskblBox->pack_start(*mask2blCurveEditorGwav, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + maskblBox->pack_start(*wavmaskbl, Gtk::PACK_SHRINK, 0); expmaskbl->add(*maskblBox, false); panel->pack_start(*expmaskbl); @@ -2352,6 +2371,7 @@ Locallab::~Locallab() delete masktmCurveEditorG; delete maskblCurveEditorG; delete mask2blCurveEditorG; + delete mask2blCurveEditorGwav; delete maskretiCurveEditorG; delete mask2retiCurveEditorG; delete maskcbCurveEditorG; @@ -3413,8 +3433,10 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).gammaskbl = gammaskbl->getValue(); pp->locallab.spots.at(pp->locallab.selspot).slomaskbl = slomaskbl->getValue(); pp->locallab.spots.at(pp->locallab.selspot).lapmaskbl = lapmaskbl->getValue(); + pp->locallab.spots.at(pp->locallab.selspot).wavmaskbl = wavmaskbl->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).fftwbl = fftwbl->get_active(); pp->locallab.spots.at(pp->locallab.selspot).Lmaskblcurve = Lmaskblshape->getCurve(); + pp->locallab.spots.at(pp->locallab.selspot).LLmaskblcurvewav = LLmaskblshapewav->getCurve(); // Tone Mapping pp->locallab.spots.at(pp->locallab.selspot).exptonemap = exptonemap->getEnabled(); @@ -3719,8 +3741,10 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).gammaskbl = pe->locallab.spots.at(pp->locallab.selspot).gammaskbl || gammaskbl->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).slomaskbl = pe->locallab.spots.at(pp->locallab.selspot).slomaskbl || slomaskbl->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).lapmaskbl = pe->locallab.spots.at(pp->locallab.selspot).lapmaskbl || lapmaskbl->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).wavmaskbl = pe->locallab.spots.at(pp->locallab.selspot).wavmaskbl || wavmaskbl->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).fftwbl = pe->locallab.spots.at(pp->locallab.selspot).fftwbl || !fftwbl->get_inconsistent(); pe->locallab.spots.at(pp->locallab.selspot).Lmaskblcurve = pe->locallab.spots.at(pp->locallab.selspot).Lmaskblcurve || !Lmaskblshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).LLmaskblcurvewav = pe->locallab.spots.at(pp->locallab.selspot).LLmaskblcurvewav || !LLmaskblshapewav->isUnChanged(); // Tone Mapping pe->locallab.spots.at(pp->locallab.selspot).exptonemap = pe->locallab.spots.at(pp->locallab.selspot).activlum || !exptonemap->get_inconsistent(); pe->locallab.spots.at(pp->locallab.selspot).stren = pe->locallab.spots.at(pp->locallab.selspot).stren || stren->getEditedState(); @@ -4012,8 +4036,10 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).gammaskbl = pedited->locallab.spots.at(pp->locallab.selspot).gammaskbl || gammaskbl->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).slomaskbl = pedited->locallab.spots.at(pp->locallab.selspot).slomaskbl || slomaskbl->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).lapmaskbl = pedited->locallab.spots.at(pp->locallab.selspot).lapmaskbl || lapmaskbl->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).wavmaskbl = pedited->locallab.spots.at(pp->locallab.selspot).wavmaskbl || wavmaskbl->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).fftwbl = pedited->locallab.spots.at(pp->locallab.selspot).fftwbl || !fftwbl->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).Lmaskblcurve = pedited->locallab.spots.at(pp->locallab.selspot).Lmaskblcurve || !Lmaskblshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).LLmaskblcurvewav = pedited->locallab.spots.at(pp->locallab.selspot).LLmaskblcurvewav || !LLmaskblshapewav->isUnChanged(); // Tone Mapping pedited->locallab.spots.at(pp->locallab.selspot).exptonemap = pedited->locallab.spots.at(pp->locallab.selspot).exptonemap || !exptonemap->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).stren = pedited->locallab.spots.at(pp->locallab.selspot).stren || stren->getEditedState(); @@ -4425,6 +4451,12 @@ void Locallab::curveChanged(CurveEditor* ce) } } + if (ce == LLmaskblshapewav) { + if (listener) { + listener->panelChanged(EvlocallabLLmaskblshapewav, M("HISTORY_CUSTOMCURVE")); + } + } + } // TM @@ -5934,6 +5966,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe gammaskbl->setDefault(defSpot->gammaskbl); slomaskbl->setDefault(defSpot->slomaskbl); lapmaskbl->setDefault(defSpot->lapmaskbl); + wavmaskbl->setDefault(defSpot->wavmaskbl); // Tone Mapping stren->setDefault(defSpot->stren); gamma->setDefault(defSpot->gamma); @@ -6110,6 +6143,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe gammaskbl->setDefaultEditedState(Irrelevant); slomaskbl->setDefaultEditedState(Irrelevant); lapmaskbl->setDefaultEditedState(Irrelevant); + wavmaskbl->setDefaultEditedState(Irrelevant); // Tone Mapping stren->setDefaultEditedState(Irrelevant); gamma->setDefaultEditedState(Irrelevant); @@ -6290,6 +6324,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe gammaskbl->setDefaultEditedState(defSpotState->gammaskbl ? Edited : UnEdited); slomaskbl->setDefaultEditedState(defSpotState->slomaskbl ? Edited : UnEdited); lapmaskbl->setDefaultEditedState(defSpotState->lapmaskbl ? Edited : UnEdited); + wavmaskbl->setDefaultEditedState(defSpotState->wavmaskbl ? Edited : UnEdited); // Tone Mapping stren->setDefaultEditedState(defSpotState->stren ? Edited : UnEdited); gamma->setDefaultEditedState(defSpotState->gamma ? Edited : UnEdited); @@ -6914,6 +6949,12 @@ void Locallab::adjusterChanged(Adjuster * a, double newval) } } + if (a == wavmaskbl) { + if (listener) { + listener->panelChanged(Evlocallabwavmaskbl, wavmaskbl->getTextValue()); + } + } + } // Tone Mapping @@ -7559,6 +7600,7 @@ void Locallab::setBatchMode(bool batchMode) gammaskbl->showEditedCB(); slomaskbl->showEditedCB(); lapmaskbl->showEditedCB(); + wavmaskbl->showEditedCB(); // Tone Mapping stren->showEditedCB(); gamma->showEditedCB(); @@ -8183,8 +8225,10 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con gammaskbl->setValue(pp->locallab.spots.at(index).gammaskbl); slomaskbl->setValue(pp->locallab.spots.at(index).slomaskbl); lapmaskbl->setValue(pp->locallab.spots.at(index).lapmaskbl); + wavmaskbl->setValue(pp->locallab.spots.at(index).wavmaskbl); fftwbl->set_active(pp->locallab.spots.at(index).fftwbl); Lmaskblshape->setCurve(pp->locallab.spots.at(index).Lmaskblcurve); + LLmaskblshapewav->setCurve(pp->locallab.spots.at(index).LLmaskblcurvewav); // Tone Mapping exptonemap->setEnabled(pp->locallab.spots.at(index).exptonemap); @@ -8534,8 +8578,10 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con gammaskbl->setEditedState(spotState->gammaskbl ? Edited : UnEdited); slomaskbl->setEditedState(spotState->slomaskbl ? Edited : UnEdited); lapmaskbl->setEditedState(spotState->lapmaskbl ? Edited : UnEdited); + wavmaskbl->setEditedState(spotState->wavmaskbl ? Edited : UnEdited); fftwbl->set_inconsistent(multiImage && !spotState->fftwbl); Lmaskblshape->setUnChanged(!spotState->Lmaskblcurve); + LLmaskblshapewav->setUnChanged(!spotState->LLmaskblcurvewav); // Tone Mapping exptonemap->set_inconsistent(!spotState->exptonemap); diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 856a8de20..0b417ce06 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -105,10 +105,12 @@ private: //Blur and noise CurveEditorGroup* const maskblCurveEditorG; CurveEditorGroup* const mask2blCurveEditorG; + CurveEditorGroup* const mask2blCurveEditorGwav; DiagonalCurveEditor* Lmaskblshape; FlatCurveEditor* CCmaskblshape; FlatCurveEditor* LLmaskblshape; FlatCurveEditor* HHmaskblshape; + FlatCurveEditor* LLmaskblshapewav; // TM CurveEditorGroup* const masktmCurveEditorG; CurveEditorGroup* const mask2tmCurveEditorG; @@ -217,6 +219,7 @@ private: Adjuster* const gammaskbl; Adjuster* const slomaskbl; Adjuster* const lapmaskbl; + Adjuster* const wavmaskbl; Adjuster* const isogr; Adjuster* const strengr; Adjuster* const scalegr; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index d6f8d737a..06dba48a9 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1106,8 +1106,10 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).gammaskbl = locallab.spots.at(j).gammaskbl && pSpot.gammaskbl == otherSpot.gammaskbl; 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).wavmaskbl = locallab.spots.at(j).wavmaskbl && pSpot.wavmaskbl == otherSpot.wavmaskbl; locallab.spots.at(j).fftwbl = locallab.spots.at(j).fftwbl && pSpot.fftwbl == otherSpot.fftwbl; 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; // Tone Mapping locallab.spots.at(j).exptonemap = locallab.spots.at(j).exptonemap && pSpot.exptonemap == otherSpot.exptonemap; locallab.spots.at(j).stren = locallab.spots.at(j).stren && pSpot.stren == otherSpot.stren; @@ -3308,10 +3310,18 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).lapmaskbl = mods.locallab.spots.at(i).lapmaskbl; } + if (locallab.spots.at(i).wavmaskbl) { + toEdit.locallab.spots.at(i).wavmaskbl = mods.locallab.spots.at(i).wavmaskbl; + } + if (locallab.spots.at(i).Lmaskblcurve) { toEdit.locallab.spots.at(i).Lmaskblcurve = mods.locallab.spots.at(i).Lmaskblcurve; } + if (locallab.spots.at(i).LLmaskblcurvewav) { + toEdit.locallab.spots.at(i).LLmaskblcurvewav = mods.locallab.spots.at(i).LLmaskblcurvewav; + } + // Tone Mapping if (locallab.spots.at(i).exptonemap) { toEdit.locallab.spots.at(i).exptonemap = mods.locallab.spots.at(i).exptonemap; @@ -4910,7 +4920,9 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : gammaskbl(v), slomaskbl(v), lapmaskbl(v), + wavmaskbl(v), Lmaskblcurve(v), + LLmaskblcurvewav(v), // Tone Mapping exptonemap(v), stren(v), @@ -5196,7 +5208,9 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) gammaskbl = v; slomaskbl = v; lapmaskbl = v; + wavmaskbl = v; Lmaskblcurve = v; + LLmaskblcurvewav = v; // Tone Mapping exptonemap = v; stren = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index c849da583..3f7bebfc3 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -526,7 +526,9 @@ public: bool gammaskbl; bool slomaskbl; bool lapmaskbl; + bool wavmaskbl; bool Lmaskblcurve; + bool LLmaskblcurvewav; // Tone Mapping bool exptonemap; bool stren;