From 243faf603cd1db26321289cf44e575c960ce6490 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sun, 4 Aug 2019 13:19:54 +0200 Subject: [PATCH] Save GUI mask for Blur --- rtengine/curves.cc | 136 +++++++++++++++++ rtengine/curves.h | 87 +++++++++++ rtengine/dcrop.cc | 21 ++- rtengine/improccoordinator.cc | 16 +- rtengine/improccoordinator.h | 12 +- rtengine/improcfun.h | 4 +- rtengine/iplocallab.cc | 96 +++++++----- rtengine/procevents.h | 10 ++ rtengine/procparams.cc | 36 +++++ rtengine/procparams.h | 9 ++ rtengine/refreshmap.cc | 13 +- rtengine/rtengine.h | 2 +- rtengine/simpleprocess.cc | 12 +- rtgui/locallab.cc | 276 +++++++++++++++++++++++++++++++++- rtgui/locallab.h | 20 +++ rtgui/paramsedited.cc | 63 ++++++++ rtgui/paramsedited.h | 9 ++ rtgui/toolpanelcoord.cc | 7 +- 18 files changed, 778 insertions(+), 51 deletions(-) diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 9d10c4c0e..0b6d112bc 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -1640,6 +1640,142 @@ void LocretigainCurverab::Set(const std::vector &curvePoints) Reset(); } } +LocHHmaskblCurve::LocHHmaskblCurve() : sum(0.f) {}; + +void LocHHmaskblCurve::Reset() +{ + lutLocHHmaskblCurve.reset(); + sum = 0.f; +} + + +void LocHHmaskblCurve::Set(const Curve &pCurve) +{ + if (pCurve.isIdentity()) { + Reset(); // raise this value if the quality suffers from this number of samples + return; + } + + lutLocHHmaskblCurve(501); // raise this value if the quality suffers from this number of samples + sum = 0.f; + + for (int i = 0; i < 501; i++) { + lutLocHHmaskblCurve[i] = pCurve.getVal(double (i) / 500.); + + if (lutLocHHmaskblCurve[i] < 0.02f) { + lutLocHHmaskblCurve[i] = 0.02f; + } + + sum += lutLocHHmaskblCurve[i]; + } + + //lutLocHHCurve.dump("wav"); +} + +void LocHHmaskblCurve::Set(const std::vector &curvePoints, bool & lhmasblutili) +{ + // if (HHutili && !curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) { + if (!curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) { + FlatCurve ttcurve(curvePoints, false, CURVES_MIN_POLY_POINTS / 2); + ttcurve.setIdentityValue(0.); + lhmasblutili = true; + Set(ttcurve); + } else { + Reset(); + } +} + +LocLLmaskblCurve::LocLLmaskblCurve() : sum(0.f) {}; + +void LocLLmaskblCurve::Reset() +{ + lutLocLLmaskblCurve.reset(); + sum = 0.f; +} + +void LocLLmaskblCurve::Set(const Curve &pCurve) +{ + if (pCurve.isIdentity()) { + Reset(); // raise this value if the quality suffers from this number of samples + return; + } + + lutLocLLmaskblCurve(501); // raise this value if the quality suffers from this number of samples + sum = 0.f; + + for (int i = 0; i < 501; i++) { + lutLocLLmaskblCurve[i] = pCurve.getVal(double (i) / 500.); + + if (lutLocLLmaskblCurve[i] < 0.02f) { + lutLocLLmaskblCurve[i] = 0.02f; //avoid 0.f for wavelet : under 0.01f quasi no action for each value + } + + sum += lutLocLLmaskblCurve[i]; + } + + //lutLocHHCurve.dump("wav"); +} + + + +void LocLLmaskblCurve::Set(const std::vector &curvePoints, bool & llmasblutili) +{ + // if (HHutili && !curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) { + if (!curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) { + FlatCurve ttcurve(curvePoints, false, CURVES_MIN_POLY_POINTS / 2); + ttcurve.setIdentityValue(0.); + llmasblutili = true; + Set(ttcurve); + } else { + Reset(); + } +} + +LocCCmaskblCurve::LocCCmaskblCurve() : sum(0.f) {}; + +void LocCCmaskblCurve::Reset() +{ + lutLocCCmaskblCurve.reset(); + sum = 0.f; +} + +void LocCCmaskblCurve::Set(const Curve &pCurve) +{ + if (pCurve.isIdentity()) { + Reset(); // raise this value if the quality suffers from this number of samples + return; + } + + lutLocCCmaskblCurve(501); // raise this value if the quality suffers from this number of samples + sum = 0.f; + + for (int i = 0; i < 501; i++) { + lutLocCCmaskblCurve[i] = pCurve.getVal(double (i) / 500.); + + if (lutLocCCmaskblCurve[i] < 0.02f) { + lutLocCCmaskblCurve[i] = 0.02f; //avoid 0.f for wavelet : under 0.01f quasi no action for each value + } + + sum += lutLocCCmaskblCurve[i]; + } + + //lutLocHHCurve.dump("wav"); +} + + + +void LocCCmaskblCurve::Set(const std::vector &curvePoints, bool & lcmasblutili) +{ + // if (HHutili && !curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) { + if (!curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) { + FlatCurve ttcurve(curvePoints, false, CURVES_MIN_POLY_POINTS / 2); + ttcurve.setIdentityValue(0.); + lcmasblutili = true; + Set(ttcurve); + } else { + Reset(); + } +} diff --git a/rtengine/curves.h b/rtengine/curves.h index fa8cd079e..6863fd4b4 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -649,6 +649,93 @@ public: } }; +class LocHHmaskblCurve +{ +private: + LUTf lutLocHHmaskblCurve; // 0xffff range + void Set(const Curve &pCurve); + +public: + float sum; + + virtual ~LocHHmaskblCurve() {}; + LocHHmaskblCurve(); + void Reset(); + void Set(const std::vector &curvePoints, bool & lhmasblutili); + float getSum() const + { + return sum; + } + + float operator[](float index) const + { + return lutLocHHmaskblCurve[index]; + } + operator bool (void) const + { + return lutLocHHmaskblCurve; + } +}; + + +class LocCCmaskblCurve +{ +private: + LUTf lutLocCCmaskblCurve; // 0xffff range + void Set(const Curve &pCurve); + +public: + float sum; + + virtual ~LocCCmaskblCurve() {}; + LocCCmaskblCurve(); + void Reset(); + void Set(const std::vector &curvePoints, bool & lcmasblutili); + float getSum() const + { + return sum; + } + + float operator[](float index) const + { + return lutLocCCmaskblCurve[index]; + } + operator bool (void) const + { + return lutLocCCmaskblCurve; + } +}; + +class LocLLmaskblCurve +{ +private: + LUTf lutLocLLmaskblCurve; // 0xffff range + void Set(const Curve &pCurve); + +public: + float sum; + + virtual ~LocLLmaskblCurve() {}; + LocLLmaskblCurve(); + void Reset(); + void Set(const std::vector &curvePoints, bool & llmasblutili); + float getSum() const + { + return sum; + } + + float operator[](float index) const + { + return lutLocLLmaskblCurve[index]; + } + operator bool (void) const + { + return lutLocLLmaskblCurve; + } +}; + + + class LocHHmasktmCurve { private: diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 5a181618a..4f0c66596 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -913,7 +913,10 @@ void Crop::update(int todo) bool lhmastmutili = parent->lhmastmutili; bool lcmastmutili = parent->lcmastmutili; bool llmastmutili = parent->llmastmutili; - + bool lhmasblutili = parent->lhmasblutili; + bool lcmasblutili = parent->lcmasblutili; + bool llmasblutili = parent->llmasblutili; + // float avg = parent->avg; LUTu dummy; bool needslocal = params.locallab.enabled; @@ -938,6 +941,9 @@ void Crop::update(int todo) LocCCmasktmCurve locccmastmCurve; LocLLmasktmCurve locllmastmCurve; LocHHmasktmCurve lochhmastmCurve; + LocCCmaskblCurve locccmasblCurve; + LocLLmaskblCurve locllmasblCurve; + LocHHmaskblCurve lochhmasblCurve; LocwavCurve locwavCurve; LocretigainCurverab locRETgainCurverab; @@ -970,6 +976,9 @@ void Crop::update(int todo) locccmastmCurve.Set(params.locallab.spots.at(sp).CCmasktmcurve, lcmastmutili); locllmastmCurve.Set(params.locallab.spots.at(sp).LLmasktmcurve, llmastmutili); lochhmastmCurve.Set(params.locallab.spots.at(sp).HHmasktmcurve, lhmastmutili); + 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); locwavCurve.Set(params.locallab.spots.at(sp).locwavcurve); locallutili = false; CurveFactory::curveLocal(locallutili, params.locallab.spots.at(sp).llcurve, lllocalcurve2, sca); @@ -1007,8 +1016,10 @@ void Crop::update(int todo) locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili, locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili, + locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, locwavCurve, - LHutili, HHutili, cclocalcurve2, localcutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, parent->locallColorMask, parent->locallExpMask, parent->locallSHMask, parent->locallcbMask, parent->locallretiMask, parent->locallsoftMask, parent->localltmMask); + LHutili, HHutili, cclocalcurve2, localcutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, + parent->locallColorMask, parent->locallExpMask, parent->locallSHMask, parent->locallcbMask, parent->locallretiMask, parent->locallsoftMask, parent->localltmMask, parent->locallblMask); } else { parent->ipf.Lab_Local(1, sp, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, lllocalcurve2,locallutili, loclhCurve, lochhCurve, locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili, @@ -1016,8 +1027,9 @@ void Crop::update(int todo) locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili, locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili, + locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, locwavCurve, - LHutili, HHutili, cclocalcurve2, localcutili, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, lightCurveloc2, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, 0, 0, 0, 0, 0, 0, 0); + 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); } lllocalcurve2.clear(); lightCurveloc2.clear(); @@ -1047,6 +1059,9 @@ void Crop::update(int todo) locllmastmCurve.Reset(); locccmastmCurve.Reset(); lochhmastmCurve.Reset(); + locllmasblCurve.Reset(); + locccmasblCurve.Reset(); + lochhmasblCurve.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 1bda60307..91a0e516d 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -904,6 +904,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) lcmastmutili = false; lhmastmutili = false; llmastmutili = false; + lcmasblutili = false; + lhmasblutili = false; + llmasblutili = false; lhmasutili = false; lcmasutili = false; locRETgainCurve.Set(params->locallab.spots.at(sp).localTgaincurve); @@ -927,6 +930,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) locllmastmCurve.Set(params->locallab.spots.at(sp).LLmasktmcurve, llmastmutili); locccmastmCurve.Set(params->locallab.spots.at(sp).CCmasktmcurve, lcmastmutili); lochhmastmCurve.Set(params->locallab.spots.at(sp).HHmasktmcurve, lhmastmutili); + 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); locwavCurve.Set(params->locallab.spots.at(sp).locwavcurve); CurveFactory::curveLocal(locallutili, params->locallab.spots.at(sp).llcurve, lllocalcurve, sca); CurveFactory::curveCCLocal(localcutili, params->locallab.spots.at(sp).cccurve, cclocalcurve, sca); @@ -977,16 +983,19 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili, locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili, + locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, locwavCurve, - LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, locallColorMask, locallExpMask, locallSHMask, locallcbMask, locallretiMask, locallsoftMask, localltmMask); + LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, + locallColorMask, locallExpMask, locallSHMask, locallcbMask, locallretiMask, locallsoftMask, localltmMask, locallblMask); } else { ipf.Lab_Local(3, sp, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, lllocalcurve, locallutili, loclhCurve, lochhCurve, locccmasCurve, lcmasutili, locllmasCurve, llmasutili, lochhmasCurve, lhmasutili, locccmasexpCurve, lcmasexputili, locllmasexpCurve, llmasexputili, lochhmasexpCurve, lhmasexputili, locccmasSHCurve, lcmasSHutili, locllmasSHCurve, llmasSHutili, lochhmasSHCurve, lhmasSHutili, locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili, locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili, + locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, locwavCurve, - LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerblu, chromarblu, lumarblu, huer, chromar, lumar, sobeler, 0, 0, 0, 0, 0, 0, 0); + 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); } //recalculate references after if (params->locallab.spots.at(sp).spotMethod == "exc") { @@ -1023,6 +1032,9 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) locllmastmCurve.Reset(); locccmastmCurve.Reset(); lochhmastmCurve.Reset(); + locllmasblCurve.Reset(); + locccmasblCurve.Reset(); + lochhmasblCurve.Reset(); } } diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 120aad1af..4b58cab04 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -254,6 +254,9 @@ protected: LocCCmasktmCurve locccmastmCurve; LocLLmasktmCurve locllmastmCurve; LocHHmasktmCurve lochhmastmCurve; + LocCCmaskblCurve locccmasblCurve; + LocLLmaskblCurve locllmasblCurve; + LocHHmaskblCurve lochhmasblCurve; LocwavCurve locwavCurve; bool locallutili; @@ -277,6 +280,9 @@ protected: bool lcmastmutili; bool lhmastmutili; bool llmastmutili; + bool lcmasblutili; + bool lhmasblutili; + bool llmasblutili; bool LHutili; bool HHutili; LUTf huerefs; @@ -297,7 +303,8 @@ protected: int locallretiMask; int locallsoftMask; int localltmMask; - + int locallblMask; + public: ImProcCoordinator (); @@ -366,7 +373,7 @@ public: updaterThreadStart.unlock(); } - void setLocallabMaskVisibility (int locallColorMask, int locallExpMask, int locallSHMask, int locallcbMask, int locallretiMask, int locallsoftMask, int localltmMask) override + void setLocallabMaskVisibility (int locallColorMask, int locallExpMask, int locallSHMask, int locallcbMask, int locallretiMask, int locallsoftMask, int localltmMask, int locallblMask) override { this->locallColorMask = locallColorMask; this->locallExpMask = locallExpMask; @@ -375,6 +382,7 @@ public: this->locallretiMask = locallretiMask; this->locallsoftMask = locallsoftMask; this->localltmMask = localltmMask; + this->locallblMask = locallblMask; } void setProgressListener (ProgressListener* pl) override diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 17eb2642a..7bfa42b9f 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -315,8 +315,10 @@ public: const LocCCmaskcbCurve & locccmascbCurve, bool &lcmascbutili, const LocLLmaskcbCurve & locllmascbCurve, bool &llmascbutili, const LocHHmaskcbCurve & lochhmascbCurve, bool & lhmascbutili, const LocCCmaskretiCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskretiCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskretiCurve & lochhmasretiCurve, bool & lhmasretiutili, const LocCCmasktmCurve & locccmastmCurve, bool &lcmastmutili, const LocLLmasktmCurve & locllmastmCurve, bool &llmastmutili, const LocHHmasktmCurve & lochhmastmCurve, bool & lhmastmutili, + const LocCCmaskblCurve & locccmasblCurve, bool &lcmasblutili, const LocLLmaskblCurve & locllmasblCurve, bool &llmasblutili, const LocHHmaskblCurve & lochhmasblCurve, bool & lhmasblutili, const LocwavCurve & locwavCurve, - 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, int llColorMask, int llExpMask, int llSHMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask); + 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, int llColorMask, + int llExpMask, int llSHMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask); void addGaNoise(LabImage *lab, LabImage *dst, const float mean, const float variance, const int sk); void BlurNoise_Localold(int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy); void InverseBlurNoise_Local(const struct local_params& lp, const float hueref, const float chromaref, const float lumaref, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy, int sk); diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 643ebbfe3..d53c4919f 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -266,6 +266,7 @@ struct local_params { int showmaskretimet; int showmasksoftmet; int showmasktmmet; + int showmaskblmet; float laplacexp; float balanexp; float linear; @@ -325,6 +326,7 @@ struct local_params { bool enaretiMask; bool enaretiMasktmap; bool enatmMask; + bool enablMask; int highlihs; int shadowhs; int radiushs; @@ -418,7 +420,7 @@ static void SobelCannyLuma(float **sobelL, float **luma, int bfw, int bfh, float -static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locallab, struct local_params& lp, int llColorMask, int llExpMask, int llSHMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask) +static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locallab, struct local_params& lp, int llColorMask, int llExpMask, int llSHMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask) { int w = oW; int h = oH; @@ -502,13 +504,14 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.showmaskretimet = llretiMask; lp.showmasksoftmet = llsoftMask; lp.showmasktmmet = lltmMask; + lp.showmaskblmet = llblMask; // printf("lpshmasktm=%i\n",lp.showmasktmmet); - lp.enaExpMask = locallab.spots.at(sp).enaExpMask && llExpMask == 0 && llColorMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0;// Exposure mask is deactivated if Color & Light mask is visible - lp.enaSHMask = locallab.spots.at(sp).enaSHMask && llSHMask == 0 && llColorMask == 0 && llExpMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0; - lp.enacbMask = locallab.spots.at(sp).enacbMask && llcbMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llretiMask == 0 && lltmMask == 0; - lp.enaretiMask = locallab.spots.at(sp).enaretiMask && llretiMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && lltmMask == 0; - lp.enatmMask = locallab.spots.at(sp).enatmMask && lltmMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0; - // if(lp.enaretiMask) printf("lp.enaretiMasktrue\n"); else printf("lp.enaretiMaskfalse\n"); + lp.enaExpMask = locallab.spots.at(sp).enaExpMask && llExpMask == 0 && llColorMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0;// Exposure mask is deactivated if Color & Light mask is visible + lp.enaSHMask = locallab.spots.at(sp).enaSHMask && llSHMask == 0 && llColorMask == 0 && llExpMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0 ; + lp.enacbMask = locallab.spots.at(sp).enacbMask && llcbMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llretiMask == 0 && lltmMask == 0 && llblMask == 0; + lp.enaretiMask = locallab.spots.at(sp).enaretiMask && llretiMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && lltmMask == 0 && llblMask == 0; + lp.enatmMask = locallab.spots.at(sp).enatmMask && lltmMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && llblMask == 0; + lp.enablMask = locallab.spots.at(sp).enablMask && llblMask == 0 && llColorMask == 0 && llExpMask == 0 && llSHMask == 0 && llcbMask == 0 && llretiMask == 0 && lltmMask == 0; if (locallab.spots.at(sp).softMethod == "soft") { lp.softmet = 0; @@ -3580,7 +3583,7 @@ void ImProcFunctions::calc_ref(int sp, LabImage * original, LabImage * transform if (params->locallab.enabled) { //always calculate hueref, chromaref, lumaref before others operations use in normal mode for all modules exceprt denoise struct local_params lp; - calcLocalParams(sp, oW, oH, params->locallab, lp, 0, 0, 0, 0, 0, 0, 0); + calcLocalParams(sp, oW, oH, params->locallab, lp, 0, 0, 0, 0, 0, 0, 0, 0); int begy = lp.yc - lp.lyT; int begx = lp.xc - lp.lxL; int yEn = lp.yc + lp.ly; @@ -4905,8 +4908,10 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o const LocCCmaskcbCurve & locccmascbCurve, bool &lcmascbutili, const LocLLmaskcbCurve & locllmascbCurve, bool &llmascbutili, const LocHHmaskcbCurve & lochhmascbCurve, bool & lhmascbutili, const LocCCmaskretiCurve & locccmasretiCurve, bool &lcmasretiutili, const LocLLmaskretiCurve & locllmasretiCurve, bool &llmasretiutili, const LocHHmaskretiCurve & lochhmasretiCurve, bool & lhmasretiutili, const LocCCmasktmCurve & locccmastmCurve, bool &lcmastmutili, const LocLLmasktmCurve & locllmastmCurve, bool &llmastmutili, const LocHHmasktmCurve & lochhmastmCurve, bool & lhmastmutili, + const LocCCmaskblCurve & locccmasblCurve, bool &lcmasblutili, const LocLLmaskblCurve & locllmasblCurve, bool &llmasblutili, const LocHHmaskblCurve & lochhmasblCurve, bool & lhmasblutili, const LocwavCurve & locwavCurve, - 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, int llColorMask, int llExpMask, int llSHMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask) + 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, int llColorMask, + int llExpMask, int llSHMask, int llcbMask, int llretiMask, int llsoftMask, int lltmMask, int llblMask) { /* comment on processus deltaE * the algo uses 3 different ways to manage deltaE according to the type of intervention @@ -4936,7 +4941,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o int del = 3; // to avoid crash with [loy - begy] and [lox - begx] and bfh bfw // with gtk2 [loy - begy-1] [lox - begx -1 ] and del = 1 struct local_params lp; - calcLocalParams(sp, oW, oH, params->locallab, lp, llColorMask, llExpMask, llSHMask, llcbMask, llretiMask, llsoftMask, lltmMask); + calcLocalParams(sp, oW, oH, params->locallab, lp, llColorMask, llExpMask, llSHMask, llcbMask, llretiMask, llsoftMask, lltmMask, llblMask); const float radius = lp.rad / (sk * 1.4f); //0 to 70 ==> see skip int strred = 1;//(lp.strucc - 1); @@ -6296,15 +6301,18 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o if (((radius >= 1.5 * GAUSS_SKIP && lp.rad > 1.) || lp.stren > 0.1) && lp.blurena) { // radius < GAUSS_SKIP means no gauss, just copy of original image std::unique_ptr tmp1; + const int ystart = std::max(static_cast(lp.yc - lp.lyT) - cy, 0); + const int yend = std::min(static_cast(lp.yc + lp.ly) - cy, original->H); + const int xstart = std::max(static_cast(lp.xc - lp.lxL) - cx, 0); + const int xend = std::min(static_cast(lp.xc + lp.lx) - cx, original->W); + const int bfh = yend - ystart; + const int bfw = xend - xstart; + const int GW = transformed->W; + const int GH = transformed->H; + int bfwmask = 0; + int bfhmask = 0; if (call <= 3 && lp.blurmet == 0) { - const int ystart = std::max(static_cast(lp.yc - lp.lyT) - cy, 0); - const int yend = std::min(static_cast(lp.yc + lp.ly) - cy, original->H); - const int xstart = std::max(static_cast(lp.xc - lp.lxL) - cx, 0); - const int xend = std::min(static_cast(lp.xc + lp.lx) - cx, original->W); - const int bfh = yend - ystart; - const int bfw = xend - xstart; - if (bfw > 0 && bfh > 0) { tmp1.reset(new LabImage(bfw, bfh)); #ifdef _OPENMP @@ -6319,20 +6327,32 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } } -#ifdef _OPENMP - #pragma omp parallel -#endif - - { - gaussianBlur(tmp1->L, tmp1->L, bfw, bfh, radius); - gaussianBlur(tmp1->a, tmp1->a, bfw, bfh, radius); - gaussianBlur(tmp1->b, tmp1->b, bfw, bfh, radius); - } + bfwmask = bfw; + bfhmask = bfh; } } else { - const int GW = transformed->W; - const int GH = transformed->H; tmp1.reset(new LabImage(transformed->W, transformed->H)); + bfwmask = GW; + bfhmask = GH; + } + +//here mask for normal and inverse + + +//end mask + + if (lp.blurmet == 0) { +#ifdef _OPENMP + #pragma omp parallel +#endif + + { + gaussianBlur(tmp1->L, tmp1->L, bfw, bfh, radius); + gaussianBlur(tmp1->a, tmp1->a, bfw, bfh, radius); + gaussianBlur(tmp1->b, tmp1->b, bfw, bfh, radius); + } + + } else { #ifdef _OPENMP #pragma omp parallel @@ -7007,6 +7027,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o //local contrast bool wavcurve = false; + if (lp.locmet == 1) { for (int i = 0; i < 500; i++) { if (locwavCurve[i] != 0.5) { @@ -7014,6 +7035,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } } } + if ((lp.lcamount > 0.f || wavcurve || params->locallab.spots.at(sp).residcont != 0.f) && call < 3 && lp.lcena) { int ystart = std::max(static_cast(lp.yc - lp.lyT) - cy, 0); int yend = std::min(static_cast(lp.yc + lp.ly) - cy, original->H); @@ -7156,11 +7178,12 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } } else if (lp.locmet == 1) { //wavelet - + int wavelet_level = params->locallab.spots.at(sp).levelwav; int minwin = min(bfwr, bfhr); int maxlevelspot = 9; + // adap maximum level wavelet to size of RT-spot if (minwin * sk < 1024) { maxlevelspot = 9; //sampling wavelet 512 @@ -7205,6 +7228,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o wavelet_level = min(wavelet_level, maxlevelspot); wavelet_decomposition wdspot(tmp1->data, bfw, bfh, wavelet_level, 1, sk); + if (wdspot.memoryAllocationFailed) { return; } @@ -7234,21 +7258,22 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o double contreal = 0.6 * contrast; DiagonalCurve resid_contrast({ DCT_NURBS, - 0, 0, - avg - avg * (0.6 - contreal / 250.0), avg - avg * (0.6 + contreal / 250.0), - avg + (1. - avg) * (0.6 - contreal / 250.0), avg + (1. - avg) * (0.6 + contreal / 250.0), - 1, 1 + 0, 0, + avg - avg * (0.6 - contreal / 250.0), avg - avg * (0.6 + contreal / 250.0), + avg + (1. - avg) * (0.6 - contreal / 250.0), avg + (1. - avg) * (0.6 + contreal / 250.0), + 1, 1 }); #ifdef _OPENMP #pragma omp parallel for if (multiThread) #endif + for (int i = 0; i < W_L * H_L; i++) { float buf = LIM01(wav_L0[i] / 32768.f); buf = resid_contrast.getVal(buf); buf *= 32768.f; wav_L0[i] = buf; } - + } @@ -7259,7 +7284,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o float MaxP[10]; float MaxN[10]; Evaluate2(wdspot, mean, meanN, sigma, sigmaN, MaxP, MaxN); - // printf("mean=%f sig=%f\n", mean[3], sigma[3]); + // printf("mean=%f sig=%f\n", mean[3], sigma[3]); for (int dir = 1; dir < 4; dir++) { for (int level = 0; level < maxlvl; ++level) { @@ -7285,6 +7310,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o for (int i = 0; i < W_L * H_L; i++) { float absciss; float &val = wav_L[dir][i]; + if (fabsf(val) >= (mean[level] + sigma[level])) { //for max float valcour = xlogf(fabsf(val)); float valc = valcour - logmax; diff --git a/rtengine/procevents.h b/rtengine/procevents.h index c294d27f4..77e075fb3 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -746,6 +746,16 @@ enum ProcEventCode { EvlocallabwavCurve = 716, Evlocallablevelwav = 717, Evlocallabresidcont = 718, + EvlocallabCCmaskblshape = 719, + EvlocallabLLmaskblshape = 720, + EvlocallabHHmaskblshape = 721, + EvLocallabEnablMask = 722, + EvlocallabshowmaskblMethod = 723, + Evlocallabblendmaskbl = 724, + Evlocallabradmaskbl = 725, + Evlocallabchromaskbl = 726, + Evlocallabgammaskbl = 727, + Evlocallabslomaskbl = 728, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index f3e0111ea..f438d7036 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2462,6 +2462,15 @@ LocallabParams::LocallabSpot::LocallabSpot() : sensibn(40), blurMethod("norm"), activlum(false), + CCmaskblcurve{(double)FCT_MinMaxCPoints, 0.0, 1.0, 0.35, 0.35, 0.50, 1.0, 0.35, 0.35, 1.0, 1.0, 0.35, 0.35 }, + LLmaskblcurve{(double)FCT_MinMaxCPoints, 0.0, 1.0, 0.35, 0.35, 0.50, 1.0, 0.35, 0.35, 1.0, 1.0, 0.35, 0.35}, + HHmaskblcurve{(double)FCT_MinMaxCPoints, 0.0, 1.0, 0.35, 0.35, 0.50, 1.0, 0.35, 0.35, 1.0, 1.0, 0.35, 0.35}, + enablMask(false), + blendmaskbl(0), + radmaskbl(10.0), + chromaskbl(0.0), + gammaskbl(1.0), + slomaskbl(0.0), // Tone Mapping exptonemap(false), stren(0.5), @@ -2699,6 +2708,15 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && sensibn == other.sensibn && blurMethod == other.blurMethod && activlum == other.activlum + && CCmaskblcurve == other.CCmaskblcurve + && LLmaskblcurve == other.LLmaskblcurve + && HHmaskblcurve == other.HHmaskblcurve + && enablMask == other.enablMask + && blendmaskbl == other.blendmaskbl + && radmaskbl == other.radmaskbl + && chromaskbl == other.chromaskbl + && gammaskbl == other.gammaskbl + && slomaskbl == other.slomaskbl // Tone Mapping && exptonemap == other.exptonemap && stren == other.stren @@ -3917,6 +3935,15 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensibn, "Locallab", "Sensibn_" + std::to_string(i), spot.sensibn, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blurMethod, "Locallab", "BlurMethod_" + std::to_string(i), spot.blurMethod, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).activlum, "Locallab", "activlum_" + std::to_string(i), spot.activlum, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).CCmaskblcurve, "Locallab", "CCmaskblCurve_" + std::to_string(i), spot.CCmaskblcurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).LLmaskblcurve, "Locallab", "LLmaskblCurve_" + std::to_string(i), spot.LLmaskblcurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).HHmaskblcurve, "Locallab", "HHmaskblCurve_" + std::to_string(i), spot.HHmaskblcurve, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).enablMask, "Locallab", "EnablMask_" + std::to_string(i), spot.enablMask, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blendmaskbl, "Locallab", "Blendmaskbl_" + std::to_string(i), spot.blendmaskbl, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).radmaskbl, "Locallab", "Radmaskbl_" + std::to_string(i), spot.radmaskbl, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).chromaskbl, "Locallab", "Chromaskbl_" + std::to_string(i), spot.chromaskbl, keyFile); + 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); // 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); @@ -5257,6 +5284,15 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Sensibn_" + std::to_string(i), pedited, spot.sensibn, spotEdited.sensibn); assignFromKeyfile(keyFile, "Locallab", "BlurMethod_" + std::to_string(i), pedited, spot.blurMethod, spotEdited.blurMethod); assignFromKeyfile(keyFile, "Locallab", "activlum_" + std::to_string(i), pedited, spot.activlum, spotEdited.activlum); + assignFromKeyfile(keyFile, "Locallab", "CCmaskblCurve_" + std::to_string(i), pedited, spot.CCmaskblcurve, spotEdited.CCmaskblcurve); + assignFromKeyfile(keyFile, "Locallab", "LLmaskblCurve_" + std::to_string(i), pedited, spot.LLmaskblcurve, spotEdited.LLmaskblcurve); + assignFromKeyfile(keyFile, "Locallab", "HHmaskblCurve_" + std::to_string(i), pedited, spot.HHmaskblcurve, spotEdited.HHmaskblcurve); + assignFromKeyfile(keyFile, "Locallab", "EnablMask_" + std::to_string(i), pedited, spot.enablMask, spotEdited.enablMask); + assignFromKeyfile(keyFile, "Locallab", "Blendmaskbl_" + std::to_string(i), pedited, spot.blendmaskbl, spotEdited.blendmaskbl); + assignFromKeyfile(keyFile, "Locallab", "Radmaskbl_" + std::to_string(i), pedited, spot.radmaskbl, spotEdited.radmaskbl); + assignFromKeyfile(keyFile, "Locallab", "Chromaskbl_" + std::to_string(i), pedited, spot.chromaskbl, spotEdited.chromaskbl); + 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); // 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 9bb7d4ece..13db8399e 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1063,6 +1063,15 @@ struct LocallabParams { int sensibn; Glib::ustring blurMethod; bool activlum; + std::vector CCmaskblcurve; + std::vector LLmaskblcurve; + std::vector HHmaskblcurve; + bool enablMask; + int blendmaskbl; + double radmaskbl; + double chromaskbl; + double gammaskbl; + double slomaskbl; // Tone Mapping bool exptonemap; double stren; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 632f27075..7f4ffa75e 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -745,8 +745,17 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //EvlocallablocalcontMethod LUMINANCECURVE, //Evlocallabwavcurve LUMINANCECURVE, //Evlocallablevelwav - LUMINANCECURVE //Evlocallabresidcont - + LUMINANCECURVE, //Evlocallabresidcont + LUMINANCECURVE, // EvlocallabCCmaskblshape + LUMINANCECURVE, //EvlocallabLLmaskblshape + LUMINANCECURVE, //EvlocallabHHmaskblshape + LUMINANCECURVE, //EvLocallabEnablMask + LUMINANCECURVE, //EvlocallabshowmaskblMethod + LUMINANCECURVE, //Evlocallabblendmaskbl + LUMINANCECURVE, //Evlocallabradmaskbl + LUMINANCECURVE, //Evlocallabchromaskbl + LUMINANCECURVE, //Evlocallabgammaskbl + LUMINANCECURVE //Evlocallabslomaskbl }; diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index 1dea2663b..9a8ad9cc7 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -507,7 +507,7 @@ public: virtual void updateUnLock() = 0; - virtual void setLocallabMaskVisibility(int locallColorMask, int locallExpMask, int locallSHMask, int locallcbMask, int locallretiMask, int locallsoftMask, int localltmMask) = 0; + virtual void setLocallabMaskVisibility(int locallColorMask, int locallExpMask, int locallSHMask, int locallcbMask, int locallretiMask, int locallsoftMask, int localltmMask, int locallblMask) = 0; /** Creates and returns a Crop instance that acts as a window on the image * @param editDataProvider pointer to the EditDataProvider that communicates with the EditSubscriber diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index e14cc47b3..95e930ad5 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1109,6 +1109,9 @@ private: LocCCmasktmCurve locccmastmCurve; LocLLmasktmCurve locllmastmCurve; LocHHmasktmCurve lochhmastmCurve; + LocCCmaskblCurve locccmasblCurve; + LocLLmaskblCurve locllmasblCurve; + LocHHmaskblCurve lochhmasblCurve; LocwavCurve locwavCurve; LUTf lllocalcurve(65536, 0); LUTf cclocalcurve(65536, 0); @@ -1152,6 +1155,9 @@ private: bool lcmastmutili = false; bool lhmastmutili = false; bool llmastmutili = false; + bool lcmasblutili = false; + bool lhmasblutili = false; + bool llmasblutili = false; bool lcmasutili = false; bool lhmasutili = false; locRETgainCurve.Set(params.locallab.spots.at(sp).localTgaincurve); @@ -1175,6 +1181,9 @@ private: locccmastmCurve.Set(params.locallab.spots.at(sp).CCmasktmcurve, lcmastmutili); locllmastmCurve.Set(params.locallab.spots.at(sp).LLmasktmcurve, llmastmutili); lochhmastmCurve.Set(params.locallab.spots.at(sp).HHmasktmcurve, lhmastmutili); + 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); locwavCurve.Set(params.locallab.spots.at(sp).locwavcurve); CurveFactory::curveLocal(locallutili, params.locallab.spots.at(sp).llcurve, lllocalcurve, 1); CurveFactory::curveCCLocal(localcutili, params.locallab.spots.at(sp).cccurve, cclocalcurve, 1); @@ -1206,8 +1215,9 @@ private: locccmascbCurve, lcmascbutili, locllmascbCurve, llmascbutili, lochhmascbCurve, lhmascbutili, locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, locccmastmCurve, lcmastmutili, locllmastmCurve, llmastmutili, lochhmastmCurve, lhmastmutili, + locccmasblCurve, lcmasblutili, locllmasblCurve, llmasblutili, lochhmasblCurve, lhmasblutili, locwavCurve, - LHutili, HHutili, cclocalcurve, localcutili, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, lightCurveloc, huerefblu, chromarefblu, lumarefblu, huere, chromare, lumare, sobelre, 0, 0, 0, 0, 0, 0, 0); + 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); // Clear local curves diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 2577c970d..f1c93f539 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -147,6 +147,7 @@ Locallab::Locallab(): expmaskcb(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_SHOW")))), expmaskreti(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_SHOW")))), expmasktm(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_SHOW")))), + expmaskbl(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_SHOW")))), // CurveEditorGroup widgets // Color & Light @@ -160,6 +161,9 @@ Locallab::Locallab(): maskSHCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), // Vibrance curveEditorGG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL"))), + //Blur + maskblCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), + //TM masktmCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK"))), // Retinex @@ -232,6 +236,11 @@ Locallab::Locallab(): radius(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADIUS"), 1.0, 100.0, 0.1, 1.0))), strength(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRENGTH"), 0, 100, 1, 0))), sensibn(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIBN"), 0, 100, 1, 40))), + blendmaskbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLENDMASKCOL"), -100, 100, 1, 0))), + radmaskbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADMASKCOL"), 0.0, 100.0, 0.1, 10.))), + chromaskbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMASKCOL"), -100.0, 100.0, 0.1, 0.))), + 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.))), // Tone Mapping stren(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STREN"), -0.5, 2.0, 0.01, 0.5))), gamma(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAM"), 0.4, 4.0, 0.11, 1.0))), @@ -326,6 +335,7 @@ Locallab::Locallab(): pastSatTog(Gtk::manage(new Gtk::CheckButton(M("TP_VIBRANCE_PASTSATTOG")))), // Blur & Noise activlum(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ACTIV")))), + enablMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), //TM equiltm(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_EQUIL")))), enatmMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), @@ -357,6 +367,8 @@ Locallab::Locallab(): //soft Method softMethod(Gtk::manage(new MyComboBoxText())), showmasksoftMethod(Gtk::manage(new MyComboBoxText())), + //Blur + showmaskblMethod(Gtk::manage(new MyComboBoxText())), //TM showmasktmMethod(Gtk::manage(new MyComboBoxText())), // Retinex @@ -1034,6 +1046,62 @@ Locallab::Locallab(): } sensibn->setAdjusterListener(this); + setExpandAlignProperties(expmaskbl, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + expmaskbl->signal_button_release_event().connect_notify(sigc::bind(sigc::mem_fun(this, &Locallab::foldAllButMe), expmaskbl)); + expmaskbl->setLevel(2); + + maskblCurveEditorG->setCurveListener(this); + + CCmaskblshape = static_cast(maskblCurveEditorG->addCurve(CT_Flat, "C(C)", nullptr, false, false)); + CCmaskblshape->setIdentityValue(0.); + CCmaskblshape->setResetCurve(FlatCurveType(defSpot.CCmaskblcurve.at(0)), defSpot.CCmaskblcurve); + + if (showtooltip) { + CCmaskblshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + } + + CCmaskblshape->setBottomBarColorProvider(this, 7); + + LLmaskblshape = static_cast(maskblCurveEditorG->addCurve(CT_Flat, "L(L)", nullptr, false, false)); + LLmaskblshape->setIdentityValue(0.); + LLmaskblshape->setResetCurve(FlatCurveType(defSpot.LLmaskblcurve.at(0)), defSpot.LLmaskblcurve); + + if (showtooltip) { + LLmaskblshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + } + + LLmaskblshape->setBottomBarBgGradient(mllshape); + + HHmaskblshape = static_cast(maskblCurveEditorG->addCurve(CT_Flat, "LC(H)", nullptr, false, true)); + HHmaskblshape->setIdentityValue(0.); + HHmaskblshape->setResetCurve(FlatCurveType(defSpot.HHmaskblcurve.at(0)), defSpot.HHmaskblcurve); + + if (showtooltip) { + HHmaskblshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_CC_TOOLTIP")); + } + + HHmaskblshape->setCurveColorProvider(this, 6); + HHmaskblshape->setBottomBarColorProvider(this, 6); + + maskblCurveEditorG->curveListComplete(); + enablMaskConn = enablMask->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::enablMaskChanged)); + + showmaskblMethod->append(M("TP_LOCALLAB_SHOWMNONE")); + showmaskblMethod->append(M("TP_LOCALLAB_SHOWMODIF")); + showmaskblMethod->append(M("TP_LOCALLAB_SHOWMODIFMASK")); + showmaskblMethod->append(M("TP_LOCALLAB_SHOWMASK")); + showmaskblMethod->append(M("TP_LOCALLAB_PREVIEWSEL")); + + + showmaskblMethod->set_active(0); + + if (showtooltip) { + showmaskblMethod->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKCOL_TOOLTIP")); + } + + showmaskblMethodConn = showmaskblMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::showmaskblMethodChanged)); + + blurMethod->append(M("TP_LOCALLAB_BLNORM")); blurMethod->append(M("TP_LOCALLAB_BLINV")); @@ -1046,6 +1114,22 @@ Locallab::Locallab(): blurMethodConn = blurMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallab::blurMethodChanged)); activlumConn = activlum->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::activlumChanged)); + blendmaskbl->setAdjusterListener(this); + radmaskbl->setAdjusterListener(this); + chromaskbl->setAdjusterListener(this); + gammaskbl->setAdjusterListener(this); + slomaskbl->setAdjusterListener(this); + + ToolParamBlock* const maskblBox = Gtk::manage(new ToolParamBlock()); + maskblBox->pack_start(*showmaskblMethod, Gtk::PACK_SHRINK, 4); + maskblBox->pack_start(*enablMask, Gtk::PACK_SHRINK, 0); + maskblBox->pack_start(*maskblCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor + maskblBox->pack_start(*blendmaskbl, Gtk::PACK_SHRINK, 0); + maskblBox->pack_start(*radmaskbl, Gtk::PACK_SHRINK, 0); + maskblBox->pack_start(*chromaskbl, Gtk::PACK_SHRINK, 0); + maskblBox->pack_start(*gammaskbl, Gtk::PACK_SHRINK, 0); + maskblBox->pack_start(*slomaskbl, Gtk::PACK_SHRINK, 0); + expmaskbl->add(*maskblBox, false); ToolParamBlock* const blurrBox = Gtk::manage(new ToolParamBlock()); blurrBox->pack_start(*radius); @@ -1053,6 +1137,7 @@ Locallab::Locallab(): blurrBox->pack_start(*sensibn); blurrBox->pack_start(*blurMethod); blurrBox->pack_start(*activlum); +// blurrBox->pack_start(*expmaskbl); expblur->add(*blurrBox, false); expblur->setLevel(2); @@ -1745,6 +1830,7 @@ Locallab::~Locallab() delete LocalcurveEditorgainT; delete LocalcurveEditorwav; delete masktmCurveEditorG; + delete maskblCurveEditorG; delete maskretiCurveEditorG; delete maskcbCurveEditorG; } @@ -1770,6 +1856,7 @@ void Locallab::foldAllButMe(GdkEventButton* event, MyExpander *expander) expmaskcb->set_expanded(expmaskcb == expander); expmaskreti->set_expanded(expmaskreti == expander); expmasktm->set_expanded(expmasktm == expander); + expmaskbl->set_expanded(expmaskbl == expander); } } @@ -1862,6 +1949,7 @@ void Locallab::writeOptions(std::vector &tpOpen) tpOpen.push_back(expmaskcb->get_expanded()); tpOpen.push_back(expmaskreti->get_expanded()); tpOpen.push_back(expmasktm->get_expanded()); + tpOpen.push_back(expmaskbl->get_expanded()); } @@ -1911,6 +1999,12 @@ void Locallab::refChanged(double huer, double lumar, double chromar) LLmaskcbshape->updateLocallabBackground(normLumar); HHmaskcbshape->updateLocallabBackground(normHuer); + //updtae blur mask background + CCmaskblshape->updateLocallabBackground(normChromar); + LLmaskblshape->updateLocallabBackground(normLumar); + HHmaskblshape->updateLocallabBackground(normHuer); + + // Update TM mask background CCmasktmshape->updateLocallabBackground(normChromar); LLmasktmshape->updateLocallabBackground(normLumar); @@ -1929,7 +2023,7 @@ void Locallab::refChanged(double huer, double lumar, double chromar) void Locallab::updateToolState(std::vector &tpOpen) { - if (tpOpen.size() >= 20) { + if (tpOpen.size() >= 21) { expsettings->setExpanded(tpOpen.at(0)); expcolor->set_expanded(tpOpen.at(1)); expexpose->set_expanded(tpOpen.at(2)); @@ -1949,6 +2043,7 @@ void Locallab::updateToolState(std::vector &tpOpen) expmaskcb->set_expanded(tpOpen.at(16)); expmaskreti->set_expanded(tpOpen.at(17)); expmasktm->set_expanded(tpOpen.at(18)); + expmaskbl->set_expanded(tpOpen.at(19)); } } @@ -2656,6 +2751,16 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) } pp->locallab.spots.at(pp->locallab.selspot).activlum = activlum->get_active(); + pp->locallab.spots.at(pp->locallab.selspot).LLmaskblcurve = LLmaskblshape->getCurve(); + pp->locallab.spots.at(pp->locallab.selspot).CCmaskblcurve = CCmaskblshape->getCurve(); + pp->locallab.spots.at(pp->locallab.selspot).HHmaskblcurve = HHmaskblshape->getCurve(); + pp->locallab.spots.at(pp->locallab.selspot).enablMask = enablMask->get_active(); + pp->locallab.spots.at(pp->locallab.selspot).blendmaskbl = blendmaskbl->getIntValue(); + pp->locallab.spots.at(pp->locallab.selspot).radmaskbl = radmaskbl->getValue(); + pp->locallab.spots.at(pp->locallab.selspot).chromaskbl = chromaskbl->getValue(); + pp->locallab.spots.at(pp->locallab.selspot).gammaskbl = gammaskbl->getValue(); + pp->locallab.spots.at(pp->locallab.selspot).slomaskbl = slomaskbl->getValue(); + // Tone Mapping pp->locallab.spots.at(pp->locallab.selspot).exptonemap = exptonemap->getEnabled(); pp->locallab.spots.at(pp->locallab.selspot).stren = stren->getValue(); @@ -2910,6 +3015,15 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).sensibn = pe->locallab.spots.at(pp->locallab.selspot).sensibn || sensibn->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).blurMethod = pe->locallab.spots.at(pp->locallab.selspot).blurMethod || blurMethod->get_active_text() != M("GENERAL_UNCHANGED"); pe->locallab.spots.at(pp->locallab.selspot).activlum = pe->locallab.spots.at(pp->locallab.selspot).activlum || !activlum->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).CCmaskblcurve = pe->locallab.spots.at(pp->locallab.selspot).CCmaskblcurve || !CCmaskblshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).LLmaskblcurve = pe->locallab.spots.at(pp->locallab.selspot).LLmaskblcurve || !LLmaskblshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).HHmaskblcurve = pe->locallab.spots.at(pp->locallab.selspot).HHmaskblcurve || !HHmaskblshape->isUnChanged(); + pe->locallab.spots.at(pp->locallab.selspot).enablMask = pe->locallab.spots.at(pp->locallab.selspot).enablMask || !enablMask->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).blendmaskbl = pe->locallab.spots.at(pp->locallab.selspot).blendmaskbl || blendmaskbl->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).radmaskbl = pe->locallab.spots.at(pp->locallab.selspot).radmaskbl || radmaskbl->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).chromaskbl = pe->locallab.spots.at(pp->locallab.selspot).chromaskbl || chromaskbl->getEditedState(); + 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(); // 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(); @@ -3151,6 +3265,15 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).sensibn = pedited->locallab.spots.at(pp->locallab.selspot).sensibn || sensibn->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).blurMethod = pedited->locallab.spots.at(pp->locallab.selspot).blurMethod || blurMethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->locallab.spots.at(pp->locallab.selspot).activlum = pedited->locallab.spots.at(pp->locallab.selspot).activlum || !activlum->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).CCmaskblcurve = pedited->locallab.spots.at(pp->locallab.selspot).CCmaskblcurve || !CCmaskblshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).LLmaskblcurve = pedited->locallab.spots.at(pp->locallab.selspot).LLmaskblcurve || !LLmaskblshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).HHmaskblcurve = pedited->locallab.spots.at(pp->locallab.selspot).HHmaskblcurve || !HHmaskblshape->isUnChanged(); + pedited->locallab.spots.at(pp->locallab.selspot).enablMask = pedited->locallab.spots.at(pp->locallab.selspot).enablMask || !enablMask->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).blendmaskbl = pedited->locallab.spots.at(pp->locallab.selspot).blendmaskbl || blendmaskbl->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).radmaskbl = pedited->locallab.spots.at(pp->locallab.selspot).radmaskbl || radmaskbl->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).chromaskbl = pedited->locallab.spots.at(pp->locallab.selspot).chromaskbl || chromaskbl->getEditedState(); + 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(); // 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(); @@ -3490,6 +3613,29 @@ void Locallab::curveChanged(CurveEditor* ce) } } + //Blur + if (getEnabled() && expblur->getEnabled()) { + + if (ce == CCmaskblshape) { + if (listener) { + listener->panelChanged(EvlocallabCCmaskblshape, M("HISTORY_CUSTOMCURVE")); + } + } + + if (ce == LLmaskblshape) { + if (listener) { + listener->panelChanged(EvlocallabLLmaskblshape, M("HISTORY_CUSTOMCURVE")); + } + } + + if (ce == HHmaskblshape) { + if (listener) { + listener->panelChanged(EvlocallabHHmaskblshape, M("HISTORY_CUSTOMCURVE")); + } + } + + } + // TM if (getEnabled() && exptonemap->getEnabled()) { @@ -3659,6 +3805,7 @@ void Locallab::showmaskcolMethodChanged() showmaskretiMethod->set_active(0); showmasksoftMethod->set_active(0); showmasktmMethod->set_active(0); + showmaskblMethod->set_active(0); enableListener(); if (listener) { @@ -3678,6 +3825,7 @@ void Locallab::showmaskexpMethodChanged() showmaskretiMethod->set_active(0); showmasksoftMethod->set_active(0); showmasktmMethod->set_active(0); + showmaskblMethod->set_active(0); enableListener(); if (listener) { @@ -3724,6 +3872,7 @@ void Locallab::showmaskSHMethodChanged() showmaskretiMethod->set_active(0); showmasksoftMethod->set_active(0); showmasktmMethod->set_active(0); + showmaskblMethod->set_active(0); enableListener(); if (listener) { @@ -3743,6 +3892,7 @@ void Locallab::showmaskcbMethodChanged() showmaskretiMethod->set_active(0); showmasksoftMethod->set_active(0); showmasktmMethod->set_active(0); + showmaskblMethod->set_active(0); enableListener(); if (listener) { @@ -3750,6 +3900,28 @@ void Locallab::showmaskcbMethodChanged() } } +void Locallab::showmaskblMethodChanged() +{ + // printf("showmaskblMethodChanged\n"); + + // When one mask state is changed, other masks are deactivated + disableListener(); + showmaskcolMethod->set_active(0); + showmaskSHMethod->set_active(0); + showmaskexpMethod->set_active(0); + showmaskcbMethod->set_active(0); + showmaskretiMethod->set_active(0); + showmasksoftMethod->set_active(0); + showmasktmMethod->set_active(0); + enableListener(); + + if (listener) { + listener->panelChanged(EvlocallabshowmaskblMethod, ""); + } +} + + + void Locallab::showmasktmMethodChanged() { // printf("showmaskSHMethodChanged\n"); @@ -3833,6 +4005,7 @@ Locallab::llMaskVisibility* Locallab::getMaskVisibility() maskStruct->retiMask = showmaskretiMethod->get_active_row_number(); maskStruct->softMask = showmasksoftMethod->get_active_row_number(); maskStruct->tmMask = showmasktmMethod->get_active_row_number(); + maskStruct->blMask = showmaskblMethod->get_active_row_number(); // printf("SHmask=%i \n", maskStruct->SHMask); // printf("retimask=%i \n", maskStruct->retiMask); @@ -3911,6 +4084,32 @@ void Locallab::enaSHMaskChanged() } } +void Locallab::enablMaskChanged() +{ + printf("enablmaskChanged\n"); + + if (multiImage) { + if (enablMask->get_inconsistent()) { + enablMask->set_inconsistent(false); + enablMaskConn.block(true); + enablMask->set_active(false); + enablMaskConn.block(false); + } + } + + if (getEnabled() && expblur->getEnabled()) { + if (listener) { + if (enablMask->get_active()) { + listener->panelChanged(EvLocallabEnablMask, M("GENERAL_ENABLED")); + } else { + listener->panelChanged(EvLocallabEnablMask, M("GENERAL_DISABLED")); + } + } + } +} + + + void Locallab::enatmMaskChanged() { printf("enatmmaskChanged\n"); @@ -4330,6 +4529,7 @@ void Locallab::inversshaChanged() } } + void Locallab::equiltmChanged() { // printf("inversretChanged\n"); @@ -4556,6 +4756,11 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe radius->setDefault(defSpot->radius); strength->setDefault((double)defSpot->strength); sensibn->setDefault((double)defSpot->sensibn); + blendmaskbl->setDefault((double)defSpot->blendmaskbl); + radmaskbl->setDefault(defSpot->radmaskbl); + chromaskbl->setDefault(defSpot->chromaskbl); + gammaskbl->setDefault(defSpot->gammaskbl); + slomaskbl->setDefault(defSpot->slomaskbl); // Tone Mapping stren->setDefault(defSpot->stren); gamma->setDefault(defSpot->gamma); @@ -4701,6 +4906,11 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe radius->setDefaultEditedState(Irrelevant); strength->setDefaultEditedState(Irrelevant); sensibn->setDefaultEditedState(Irrelevant); + blendmaskbl->setDefaultEditedState(Irrelevant); + radmaskbl->setDefaultEditedState(Irrelevant); + chromaskbl->setDefaultEditedState(Irrelevant); + gammaskbl->setDefaultEditedState(Irrelevant); + slomaskbl->setDefaultEditedState(Irrelevant); // Tone Mapping stren->setDefaultEditedState(Irrelevant); gamma->setDefaultEditedState(Irrelevant); @@ -4850,6 +5060,11 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe radius->setDefaultEditedState(defSpotState->radius ? Edited : UnEdited); strength->setDefaultEditedState(defSpotState->strength ? Edited : UnEdited); sensibn->setDefaultEditedState(defSpotState->sensibn ? Edited : UnEdited); + blendmaskbl->setDefaultEditedState(defSpotState->blendmaskbl ? Edited : UnEdited); + radmaskbl->setDefaultEditedState(defSpotState->radmaskbl ? Edited : UnEdited); + chromaskbl->setDefaultEditedState(defSpotState->chromaskbl ? Edited : UnEdited); + gammaskbl->setDefaultEditedState(defSpotState->gammaskbl ? Edited : UnEdited); + slomaskbl->setDefaultEditedState(defSpotState->slomaskbl ? Edited : UnEdited); // Tone Mapping stren->setDefaultEditedState(defSpotState->stren ? Edited : UnEdited); gamma->setDefaultEditedState(defSpotState->gamma ? Edited : UnEdited); @@ -5340,6 +5555,37 @@ void Locallab::adjusterChanged(Adjuster * a, double newval) listener->panelChanged(Evlocallabsensibn, sensibn->getTextValue()); } } + + if (a == blendmaskbl) { + if (listener) { + listener->panelChanged(Evlocallabblendmaskbl, blendmaskbl->getTextValue()); + } + } + + if (a == radmaskbl) { + if (listener) { + listener->panelChanged(Evlocallabradmaskbl, radmaskbl->getTextValue()); + } + } + + if (a == chromaskbl) { + if (listener) { + listener->panelChanged(Evlocallabchromaskbl, chromaskbl->getTextValue()); + } + } + + if (a == gammaskbl) { + if (listener) { + listener->panelChanged(Evlocallabgammaskbl, gammaskbl->getTextValue()); + } + } + + if (a == slomaskbl) { + if (listener) { + listener->panelChanged(Evlocallabslomaskbl, slomaskbl->getTextValue()); + } + } + } // Tone Mapping @@ -5890,6 +6136,11 @@ void Locallab::setBatchMode(bool batchMode) streng->showEditedCB(); strength->showEditedCB(); sensibn->showEditedCB(); + blendmaskbl->showEditedCB(); + radmaskbl->showEditedCB(); + chromaskbl->showEditedCB(); + gammaskbl->showEditedCB(); + slomaskbl->showEditedCB(); // Tone Mapping stren->showEditedCB(); gamma->showEditedCB(); @@ -5991,6 +6242,7 @@ void Locallab::setBatchMode(bool batchMode) showmaskcbMethod->hide(); showmaskretiMethod->hide(); showmasktmMethod->hide(); + showmaskblMethod->hide(); } std::vector Locallab::getCurvePoints(ThresholdSelector* tAdjuster) const @@ -6158,6 +6410,8 @@ void Locallab::enableListener() enableblurConn.block(false); blurMethodConn.block(false); activlumConn.block(false); + enablMaskConn.block(false); + showmaskblMethodConn.block(false); // Tone Mapping enabletonemapConn.block(false); equiltmConn.block(false); @@ -6224,6 +6478,8 @@ void Locallab::disableListener() enableblurConn.block(true); blurMethodConn.block(true); activlumConn.block(true); + enablMaskConn.block(true); + showmaskblMethodConn.block(true); // Tone Mapping enabletonemapConn.block(true); equiltmConn.block(true); @@ -6400,6 +6656,15 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con } activlum->set_active(pp->locallab.spots.at(index).activlum); + CCmaskblshape->setCurve(pp->locallab.spots.at(index).CCmaskblcurve); + LLmaskblshape->setCurve(pp->locallab.spots.at(index).LLmaskblcurve); + HHmaskblshape->setCurve(pp->locallab.spots.at(index).HHmaskblcurve); + enablMask->set_active(pp->locallab.spots.at(index).enablMask); + blendmaskbl->setValue(pp->locallab.spots.at(index).blendmaskbl); + radmaskbl->setValue(pp->locallab.spots.at(index).radmaskbl); + chromaskbl->setValue(pp->locallab.spots.at(index).chromaskbl); + gammaskbl->setValue(pp->locallab.spots.at(index).gammaskbl); + slomaskbl->setValue(pp->locallab.spots.at(index).slomaskbl); // Tone Mapping exptonemap->setEnabled(pp->locallab.spots.at(index).exptonemap); @@ -6688,6 +6953,15 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con } activlum->set_inconsistent(multiImage && !spotState->activlum); + CCmaskblshape->setUnChanged(!spotState->CCmaskblcurve); + LLmaskblshape->setUnChanged(!spotState->LLmaskblcurve); + HHmaskblshape->setUnChanged(!spotState->HHmaskblcurve); + enablMask->set_inconsistent(multiImage && !spotState->enablMask); + blendmaskbl->setEditedState(spotState->blendmaskbl ? Edited : UnEdited); + radmaskbl->setEditedState(spotState->radmaskbl ? Edited : UnEdited); + chromaskbl->setEditedState(spotState->chromaskbl ? Edited : UnEdited); + gammaskbl->setEditedState(spotState->gammaskbl ? Edited : UnEdited); + slomaskbl->setEditedState(spotState->slomaskbl ? Edited : UnEdited); // Tone Mapping exptonemap->set_inconsistent(!spotState->exptonemap); diff --git a/rtgui/locallab.h b/rtgui/locallab.h index bd5cdf8f9..29226f99d 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -66,6 +66,7 @@ private: MyExpander* const expmaskcb; MyExpander* const expmaskreti; MyExpander* const expmasktm; + MyExpander* const expmaskbl; sigc::connection enablecolorConn, enableexposeConn, enableshadhighConn, enablevibranceConn, enablesoftConn, enableblurConn, enabletonemapConn, enableretiConn, enablesharpConn, enablecontrastConn, enablecbdlConn, enabledenoiConn; // Curve widgets @@ -95,6 +96,11 @@ private: // Vibrance CurveEditorGroup* const curveEditorGG; DiagonalCurveEditor* skinTonesCurve; + //Blur and noise + CurveEditorGroup* const maskblCurveEditorG; + FlatCurveEditor* CCmaskblshape; + FlatCurveEditor* LLmaskblshape; + FlatCurveEditor* HHmaskblshape; // TM CurveEditorGroup* const masktmCurveEditorG; FlatCurveEditor* CCmasktmshape; @@ -178,6 +184,11 @@ private: Adjuster* const radius; Adjuster* const strength; Adjuster* const sensibn; + Adjuster* const blendmaskbl; + Adjuster* const radmaskbl; + Adjuster* const chromaskbl; + Adjuster* const gammaskbl; + Adjuster* const slomaskbl; // Tone Mapping Adjuster* const stren; Adjuster* const gamma; @@ -281,6 +292,8 @@ private: // Blur & Noise Gtk::CheckButton* const activlum; sigc::connection activlumConn; + Gtk::CheckButton* const enablMask; + sigc::connection enablMaskConn; //Tone mapping Gtk::CheckButton* const equiltm; sigc::connection equiltmConn; @@ -332,6 +345,9 @@ private: sigc::connection softMethodConn; MyComboBoxText* const showmasksoftMethod; sigc::connection showmasksoftMethodConn; + //Blur and noise + MyComboBoxText* const showmaskblMethod; + sigc::connection showmaskblMethodConn; //TM MyComboBoxText* const showmasktmMethod; sigc::connection showmasktmMethodConn; @@ -399,6 +415,7 @@ private: void pastsattog_toggled(); // Blur & Noise void activlumChanged(); + void enablMaskChanged(); //TM void equiltmChanged(); void enatmMaskChanged(); @@ -429,6 +446,8 @@ private: // Soft light void softMethodChanged(); void showmasksoftMethodChanged(); + //Blur + void showmaskblMethodChanged(); //TM void showmasktmMethodChanged(); // Retinex @@ -476,6 +495,7 @@ public: int retiMask; int softMask; int tmMask; + int blMask; }; void resetMaskVisibility(); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index ada34b8ad..fe5fdeb61 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1056,6 +1056,15 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).sensibn = locallab.spots.at(j).sensibn && pSpot.sensibn == otherSpot.sensibn; locallab.spots.at(j).blurMethod = locallab.spots.at(j).blurMethod && pSpot.blurMethod == otherSpot.blurMethod; locallab.spots.at(j).activlum = locallab.spots.at(j).activlum && pSpot.activlum == otherSpot.activlum; + locallab.spots.at(j).CCmaskblcurve = locallab.spots.at(j).CCmaskblcurve && pSpot.CCmaskblcurve == otherSpot.CCmaskblcurve; + locallab.spots.at(j).LLmaskblcurve = locallab.spots.at(j).LLmaskblcurve && pSpot.LLmaskblcurve == otherSpot.LLmaskblcurve; + locallab.spots.at(j).HHmaskblcurve = locallab.spots.at(j).HHmaskblcurve && pSpot.HHmaskblcurve == otherSpot.HHmaskblcurve; + locallab.spots.at(j).enablMask = locallab.spots.at(j).enablMask && pSpot.enablMask == otherSpot.enablMask; + locallab.spots.at(j).blendmaskbl = locallab.spots.at(j).blendmaskbl && pSpot.blendmaskbl == otherSpot.blendmaskbl; + locallab.spots.at(j).radmaskbl = locallab.spots.at(j).radmaskbl && pSpot.radmaskbl == otherSpot.radmaskbl; + locallab.spots.at(j).chromaskbl = locallab.spots.at(j).chromaskbl && pSpot.chromaskbl == otherSpot.chromaskbl; + 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; // 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; @@ -3072,6 +3081,42 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).activlum = mods.locallab.spots.at(i).activlum; } + if (locallab.spots.at(i).CCmaskblcurve) { + toEdit.locallab.spots.at(i).CCmaskblcurve = mods.locallab.spots.at(i).CCmaskblcurve; + } + + if (locallab.spots.at(i).LLmaskblcurve) { + toEdit.locallab.spots.at(i).LLmaskblcurve = mods.locallab.spots.at(i).LLmaskblcurve; + } + + if (locallab.spots.at(i).HHmaskblcurve) { + toEdit.locallab.spots.at(i).HHmaskblcurve = mods.locallab.spots.at(i).HHmaskblcurve; + } + + if (locallab.spots.at(i).enablMask) { + toEdit.locallab.spots.at(i).enablMask = mods.locallab.spots.at(i).enablMask; + } + + if (locallab.spots.at(i).blendmaskbl) { + toEdit.locallab.spots.at(i).blendmaskbl = mods.locallab.spots.at(i).blendmaskbl; + } + + if (locallab.spots.at(i).radmaskbl) { + toEdit.locallab.spots.at(i).radmaskbl = mods.locallab.spots.at(i).radmaskbl; + } + + if (locallab.spots.at(i).chromaskbl) { + toEdit.locallab.spots.at(i).chromaskbl = mods.locallab.spots.at(i).chromaskbl; + } + + if (locallab.spots.at(i).gammaskbl) { + toEdit.locallab.spots.at(i).gammaskbl = mods.locallab.spots.at(i).gammaskbl; + } + + if (locallab.spots.at(i).slomaskbl) { + toEdit.locallab.spots.at(i).slomaskbl = mods.locallab.spots.at(i).slomaskbl; + } + // Tone Mapping if (locallab.spots.at(i).exptonemap) { toEdit.locallab.spots.at(i).exptonemap = mods.locallab.spots.at(i).exptonemap; @@ -4561,6 +4606,15 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : sensibn(v), blurMethod(v), activlum(v), + CCmaskblcurve(v), + LLmaskblcurve(v), + HHmaskblcurve(v), + enablMask(v), + blendmaskbl(v), + radmaskbl(v), + chromaskbl(v), + gammaskbl(v), + slomaskbl(v), // Tone Mapping exptonemap(v), stren(v), @@ -4794,6 +4848,15 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) sensibn = v; blurMethod = v; activlum = v; + CCmaskblcurve = v; + LLmaskblcurve = v; + HHmaskblcurve = v; + enablMask = v; + blendmaskbl = v; + radmaskbl = v; + chromaskbl = v; + gammaskbl = v; + slomaskbl = v; // Tone Mapping exptonemap = v; stren = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 4f9595006..77a13520b 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -479,6 +479,15 @@ public: bool sensibn; bool blurMethod; bool activlum; + bool CCmaskblcurve; + bool LLmaskblcurve; + bool HHmaskblcurve; + bool enablMask; + bool blendmaskbl; + bool radmaskbl; + bool chromaskbl; + bool gammaskbl; + bool slomaskbl; // Tone Mapping bool exptonemap; bool stren; diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index d92a069d9..c83b0d13d 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -474,9 +474,10 @@ void ToolPanelCoordinator::panelChanged(const rtengine::ProcEvent& event, const } // Manage Locallab mask visibility - if (event == rtengine::EvlocallabshowmaskcolMethod || event == rtengine::EvlocallabshowmaskexpMethod || event == rtengine::EvlocallabshowmaskSHMethod || event == rtengine::EvlocallabshowmasksoftMethod || event == rtengine::EvlocallabshowmaskcbMethod || event == rtengine::EvlocallabshowmaskretiMethod || event == rtengine::EvlocallabshowmasktmMethod) { + if (event == rtengine::EvlocallabshowmaskcolMethod || event == rtengine::EvlocallabshowmaskexpMethod || event == rtengine::EvlocallabshowmaskSHMethod || event == rtengine::EvlocallabshowmasksoftMethod + || event == rtengine::EvlocallabshowmaskcbMethod || event == rtengine::EvlocallabshowmaskretiMethod || event == rtengine::EvlocallabshowmasktmMethod || event == rtengine::EvlocallabshowmaskblMethod) { Locallab::llMaskVisibility* maskStruc = locallab->getMaskVisibility(); - ipc->setLocallabMaskVisibility(maskStruc->colorMask, maskStruc->expMask, maskStruc->SHMask, maskStruc->cbMask, maskStruc->retiMask, maskStruc->softMask, maskStruc->tmMask); + ipc->setLocallabMaskVisibility(maskStruc->colorMask, maskStruc->expMask, maskStruc->SHMask, maskStruc->cbMask, maskStruc->retiMask, maskStruc->softMask, maskStruc->tmMask, maskStruc->blMask); } ipc->endUpdateParams(changeFlags); // starts the IPC processing @@ -584,7 +585,7 @@ void ToolPanelCoordinator::profileChange( // Reset Locallab mask visibility when a picture is loaded if (event == rtengine::EvPhotoLoaded) { locallab->resetMaskVisibility(); - ipc->setLocallabMaskVisibility(0, 0, 0, 0, 0, 0, 0); + ipc->setLocallabMaskVisibility(0, 0, 0, 0, 0, 0, 0, 0); } // start the IPC processing