From f7aa9a4d3207247f55330db5edbf5211e3db9634 Mon Sep 17 00:00:00 2001 From: Desmis Date: Tue, 4 Feb 2020 08:22:26 +0100 Subject: [PATCH] Improvment to smooth blur --- rtdata/languages/default | 4 ++- rtengine/guidedfilter.cc | 69 +++++++++++++++++++++++++++++----------- rtengine/guidedfilter.h | 2 ++ rtengine/iplocallab.cc | 41 ++++++++++++++++++++---- rtengine/procevents.h | 1 + rtengine/procparams.cc | 4 +++ rtengine/procparams.h | 1 + rtengine/refreshmap.cc | 3 +- rtgui/locallab.cc | 25 +++++++++++++++ rtgui/locallab.h | 1 + rtgui/paramsedited.cc | 7 ++++ rtgui/paramsedited.h | 1 + 12 files changed, 133 insertions(+), 26 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 6617df3a8..88e57fed6 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1145,7 +1145,8 @@ HISTORY_MSG_907;Local - Contrast Wavelet ES amplification HISTORY_MSG_908;Local - Contrast Wavelet ES neighboring HISTORY_MSG_909;Local - Contrast Wavelet ES show HISTORY_MSG_910;Local - Wavelet Edge performance -HISTORY_MSG_911;Local - Blur Chroma Luma +HISTORY_MSG_911;Local - Blur Chroma Luma +HISTORY_MSG_912;Local - Blur Guide filter strength HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -2616,6 +2617,7 @@ TP_LOCALLAB_SPECIAL;Special use of RGB curves TP_LOCALLAB_SPOTNAME;Control Spot # TP_LOCALLAB_STD;Standard TP_LOCALLAB_STR;Strength +TP_LOCALLAB_STRBL;Strength TP_LOCALLAB_STREN;Compression Strength TP_LOCALLAB_STRENG;Strength TP_LOCALLAB_STRENGR;Strength diff --git a/rtengine/guidedfilter.cc b/rtengine/guidedfilter.cc index 26740cdc3..3d113424b 100644 --- a/rtengine/guidedfilter.cc +++ b/rtengine/guidedfilter.cc @@ -28,20 +28,32 @@ * available at https://arxiv.org/abs/1505.00996 */ -#include "boxblur.h" #include "guidedfilter.h" -#include "imagefloat.h" -#include "rescale.h" +#include "boxblur.h" #include "sleef.h" +#include "rescale.h" +#include "imagefloat.h" -#define BENCHMARK -#include "StopWatch.h" +namespace rtengine { -namespace rtengine -{ +#if 0 +# define DEBUG_DUMP(arr) \ + do { \ + Imagefloat im(arr.width(), arr.height()); \ + const char *out = "/tmp/" #arr ".tif"; \ + for (int y = 0; y < im.getHeight(); ++y) { \ + for (int x = 0; x < im.getWidth(); ++x) { \ + im.r(y, x) = im.g(y, x) = im.b(y, x) = arr[y][x] * 65535.f; \ + } \ + } \ + im.saveTIFF(out, 16); \ + } while (false) +#else +# define DEBUG_DUMP(arr) +#endif -namespace -{ + +namespace { int calculate_subsampling(int w, int h, int r) { @@ -64,6 +76,7 @@ int calculate_subsampling(int w, int h, int r) } // namespace + void guidedFilter(const array2D &guide, const array2D &src, array2D &dst, int r, float epsilon, bool multithread, int subsampling) { @@ -77,12 +90,7 @@ void guidedFilter(const array2D &guide, const array2D &src, array2 enum Op { MUL, DIVEPSILON, ADD, SUB, ADDMUL, SUBMUL }; const auto apply = -#ifdef _OPENMP - [multithread, epsilon](Op op, array2D &res, const array2D &a, const array2D &b, const array2D &c=array2D()) -> void -#else - // removed multithread to fix clang warning on msys2 clang builds, which don't support OpenMp - [epsilon](Op op, array2D &res, const array2D &a, const array2D &b, const array2D &c=array2D()) -> void -#endif + [=](Op op, array2D &res, const array2D &a, const array2D &b, const array2D &c=array2D()) -> void { const int w = res.width(); const int h = res.height(); @@ -134,7 +142,7 @@ void guidedFilter(const array2D &guide, const array2D &src, array2 { if (d.width() == s.width() && d.height() == s.height()) { #ifdef _OPENMP - #pragma omp parallel for if (multithread) +# pragma omp parallel for if (multithread) #endif for (int y = 0; y < s.height(); ++y) { for (int x = 0; x < s.width(); ++x) { @@ -155,6 +163,7 @@ void guidedFilter(const array2D &guide, const array2D &src, array2 [multithread](array2D &d, array2D &s, int rad) -> void { rad = LIM(rad, 0, (min(s.width(), s.height()) - 1) / 2 - 1); + // boxblur(s, d, rad, s.width(), s.height(), multithread); boxblur(static_cast(s), static_cast(d), rad, s.width(), s.height(), multithread); }; @@ -164,39 +173,54 @@ void guidedFilter(const array2D &guide, const array2D &src, array2 f_subsample(I1, I); f_subsample(p1, p); + DEBUG_DUMP(I); + DEBUG_DUMP(p); + DEBUG_DUMP(I1); + DEBUG_DUMP(p1); + float r1 = float(r) / subsampling; array2D meanI(w, h); f_mean(meanI, I1, r1); + DEBUG_DUMP(meanI); array2D meanp(w, h); f_mean(meanp, p1, r1); + DEBUG_DUMP(meanp); array2D &corrIp = p1; apply(MUL, corrIp, I1, p1); f_mean(corrIp, corrIp, r1); + DEBUG_DUMP(corrIp); array2D &corrI = I1; apply(MUL, corrI, I1, I1); f_mean(corrI, corrI, r1); + DEBUG_DUMP(corrI); array2D &varI = corrI; apply(SUBMUL, varI, meanI, meanI, corrI); + DEBUG_DUMP(varI); array2D &covIp = corrIp; apply(SUBMUL, covIp, meanI, meanp, corrIp); + DEBUG_DUMP(covIp); array2D &a = varI; apply(DIVEPSILON, a, covIp, varI); + DEBUG_DUMP(a); array2D &b = covIp; apply(SUBMUL, b, a, meanI, meanp); + DEBUG_DUMP(b); array2D &meana = a; f_mean(meana, a, r1); + DEBUG_DUMP(meana); array2D &meanb = b; f_mean(meanb, b, r1); + DEBUG_DUMP(meanb); // speedup by heckflosse67 const int Ws = meana.width(); @@ -218,7 +242,7 @@ void guidedFilter(const array2D &guide, const array2D &src, array2 } -void guidedFilterLog(float base, array2D &chan, int r, float eps, bool multithread, int subsampling) +void guidedFilterLog(const array2D &guide, float base, array2D &chan, int r, float eps, bool multithread, int subsampling) { #ifdef _OPENMP # pragma omp parallel for if (multithread) @@ -229,7 +253,7 @@ void guidedFilterLog(float base, array2D &chan, int r, float eps, bool mu } } - guidedFilter(chan, chan, chan, r, eps, multithread, subsampling); + guidedFilter(guide, chan, chan, r, eps, multithread, subsampling); #ifdef _OPENMP # pragma omp parallel for if (multithread) @@ -242,4 +266,13 @@ void guidedFilterLog(float base, array2D &chan, int r, float eps, bool mu } +void guidedFilterLog(float base, array2D &chan, int r, float eps, bool multithread, int subsampling) +{ + guidedFilterLog(chan, base, chan, r, eps, multithread, subsampling); +} + } // namespace rtengine + + + + diff --git a/rtengine/guidedfilter.h b/rtengine/guidedfilter.h index bfaca5bce..94147b411 100644 --- a/rtengine/guidedfilter.h +++ b/rtengine/guidedfilter.h @@ -30,4 +30,6 @@ void guidedFilter(const array2D &guide, const array2D &src, array2 void guidedFilterLog(float base, array2D &chan, int r, float eps, bool multithread, int subsampling=0); +void guidedFilterLog(const array2D &guide, float base, array2D &chan, int r, float eps, bool multithread, int subsampling=0); + } // namespace rtengine diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 2c47dfcbf..a8f0b7188 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -303,6 +303,7 @@ struct local_params { double stren; int it; int guidb; + float strbl; float epsb; float trans; float feath; @@ -1094,6 +1095,8 @@ static void calcLocalParams(int sp, int oW, int oH, const LocallabParams& locall lp.fftbl = fftbl; lp.it = itera; lp.guidb = guidbl; + lp.strbl = 0.01f * (float) locallab.spots.at(sp).strbl; + lp.epsb = epsbl; lp.struexp = structexpo; lp.blurexp = blurexpo; @@ -10893,6 +10896,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o array2D rr(bfw, bfh); array2D gg(bfw, bfh); array2D bb(bfw, bfh); + array2D guide(bfw, bfh); + + #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif @@ -10900,22 +10906,28 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { LL[y][x] = tmp1->L[y][x]; + float ll = LL[y][x]; + guide[y][x] = xlin2log(max(ll, 0.f), 10.f); rr[y][x] = tmpImage->r(y, x); gg[y][x] = tmpImage->g(y, x); bb[y][x] = tmpImage->b(y, x); } } + array2D iR(bfw, bfh, rr, 0); + array2D iG(bfw, bfh, gg, 0); + array2D iB(bfw, bfh, bb, 0); + array2D iL(bfw, bfh, LL, 0); int r = max(int(lp.guidb / sk), 1); const float epsil = 0.001f * std::pow(2, - lp.epsb); if (lp.chromet == 0) { - rtengine::guidedFilterLog(10.f, LL, r, epsil, multiThread); + rtengine::guidedFilterLog(guide, 10.f, LL, r, epsil, multiThread); } else if (lp.chromet == 1) { - rtengine::guidedFilterLog(10.f, rr, r, epsil, multiThread); - rtengine::guidedFilterLog(10.f, bb, r, epsil, multiThread); + rtengine::guidedFilterLog(guide, 10.f, rr, r, epsil, multiThread); + rtengine::guidedFilterLog(guide, 10.f, bb, r, epsil, multiThread); } else if (lp.chromet == 2) { rtengine::guidedFilterLog(10.f, gg, r, epsil, multiThread); rtengine::guidedFilterLog(10.f, rr, r, epsil, multiThread); @@ -10928,6 +10940,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { + rr[y][x] = intp(lp.strbl, rr[y][x] , iR[y][x]); + gg[y][x] = intp(lp.strbl, gg[y][x] , iG[y][x]); + bb[y][x] = intp(lp.strbl, bb[y][x] , iB[y][x]); tmpImage->r(y, x) = rr[y][x]; tmpImage->g(y, x) = gg[y][x]; tmpImage->b(y, x) = bb[y][x]; @@ -10944,6 +10959,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o for (int y = 0; y < bfh ; y++) { for (int x = 0; x < bfw; x++) { + LL[y][x] = intp(lp.strbl, LL[y][x] , iL[y][x]); tmp1->L[y][x] = LL[y][x]; } } @@ -10975,6 +10991,8 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o array2D rr(GW, GH); array2D gg(GW, GH); array2D bb(GW, GH); + array2D guide(GW, GH); + #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif @@ -10982,6 +11000,8 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o for (int y = 0; y < GH ; y++) { for (int x = 0; x < GW; x++) { LL[y][x] = tmp1->L[y][x]; + float ll = LL[y][x]; + guide[y][x] = xlin2log(max(ll, 0.f), 10.f); rr[y][x] = tmpImage->r(y, x); gg[y][x] = tmpImage->g(y, x); bb[y][x] = tmpImage->b(y, x); @@ -10989,15 +11009,20 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } } + array2D iR(GW, GH, rr, 0); + array2D iG(GW, GH, gg, 0); + array2D iB(GW, GH, bb, 0); + array2D iL(GW, GH, LL, 0); + int r = max(int(lp.guidb / sk), 1); const float epsil = 0.001f * std::pow(2, - lp.epsb); if (lp.chromet == 0) { - rtengine::guidedFilterLog(10.f, LL, r, epsil, multiThread); + rtengine::guidedFilterLog(guide, 10.f, LL, r, epsil, multiThread); } else if (lp.chromet == 1) { - rtengine::guidedFilterLog(10.f, rr, r, epsil, multiThread); - rtengine::guidedFilterLog(10.f, bb, r, epsil, multiThread); + rtengine::guidedFilterLog(guide, 10.f, rr, r, epsil, multiThread); + rtengine::guidedFilterLog(guide, 10.f, bb, r, epsil, multiThread); } else if (lp.chromet == 2) { rtengine::guidedFilterLog(10.f, gg, r, epsil, multiThread); rtengine::guidedFilterLog(10.f, rr, r, epsil, multiThread); @@ -11010,6 +11035,9 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o for (int y = 0; y < GH ; y++) { for (int x = 0; x < GW; x++) { + rr[y][x] = intp(lp.strbl, rr[y][x] , iR[y][x]); + gg[y][x] = intp(lp.strbl, gg[y][x] , iG[y][x]); + bb[y][x] = intp(lp.strbl, bb[y][x] , iB[y][x]); tmpImage->r(y, x) = rr[y][x]; tmpImage->g(y, x) = gg[y][x]; tmpImage->b(y, x) = bb[y][x]; @@ -11026,6 +11054,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o for (int y = 0; y < GH ; y++) { for (int x = 0; x < GW; x++) { + LL[y][x] = intp(lp.strbl, LL[y][x] , iL[y][x]); tmp1->L[y][x] = LL[y][x]; } } diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 615c03826..3fcbe233a 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -937,6 +937,7 @@ enum ProcEventCode { Evlocallabwaveshow = 908, EvLocallabSpotwavMethod = 909, EvlocallabchroMethod = 910, + Evlocallabstrbl = 911, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 18aef1eee..3d9b03896 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2623,6 +2623,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : sensibn(40), itera(1), guidbl(0), + strbl(50), isogr(400), strengr(0), scalegr(100), @@ -3072,6 +3073,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && sensibn == other.sensibn && itera == other.itera && guidbl == other.guidbl + && strbl == other.strbl && isogr == other.isogr && strengr == other.strengr && scalegr == other.scalegr @@ -4488,6 +4490,7 @@ 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).itera, "Locallab", "Iteramed_" + std::to_string(i), spot.itera, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).guidbl, "Locallab", "Guidbl_" + std::to_string(i), spot.guidbl, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).strbl, "Locallab", "Strbl_" + std::to_string(i), spot.strbl, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).isogr, "Locallab", "Isogr_" + std::to_string(i), spot.isogr, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).strengr, "Locallab", "Strengr_" + std::to_string(i), spot.strengr, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).scalegr, "Locallab", "Scalegr_" + std::to_string(i), spot.scalegr, keyFile); @@ -6048,6 +6051,7 @@ 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", "Iteramed_" + std::to_string(i), pedited, spot.itera, spotEdited.itera); assignFromKeyfile(keyFile, "Locallab", "Guidbl_" + std::to_string(i), pedited, spot.guidbl, spotEdited.guidbl); + assignFromKeyfile(keyFile, "Locallab", "Strbl_" + std::to_string(i), pedited, spot.strbl, spotEdited.strbl); assignFromKeyfile(keyFile, "Locallab", "Isogr_" + std::to_string(i), pedited, spot.isogr, spotEdited.isogr); assignFromKeyfile(keyFile, "Locallab", "Strengr_" + std::to_string(i), pedited, spot.strengr, spotEdited.strengr); assignFromKeyfile(keyFile, "Locallab", "Scalegr_" + std::to_string(i), pedited, spot.scalegr, spotEdited.scalegr); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index a59919384..63dab717d 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1166,6 +1166,7 @@ struct LocallabParams { int sensibn; int itera; int guidbl; + int strbl; int isogr; int strengr; int scalegr; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index ad568f70e..95e12275e 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -940,7 +940,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //EvlocallablocalneiMethod LUMINANCECURVE, //Evlocallabwaveshow LUMINANCECURVE, // EvLocallabSpotwavMethod - LUMINANCECURVE // EvlocallabchroMethod + LUMINANCECURVE, // EvlocallabchroMethod + LUMINANCECURVE // Evlocallabstrbl }; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 51a3aecd2..e28fef5a6 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -511,6 +511,7 @@ radius(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RADIUS"), MINRAD, MAXRAD, 0.1, 1. strength(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRENGTH"), 0, 100, 1, 0))), itera(Gtk::manage(new Adjuster(M("TP_DIRPYRDENOISE_MEDIAN_PASSES"), 1, 4, 1, 1))), guidbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GUIDBL"), 0, 1000, 1, 0))), +strbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRBL"), 0, 100, 1, 50))), epsbl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_EPSBL"), -10, 10, 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))), @@ -3617,8 +3618,10 @@ pe(nullptr) scalegr->setAdjusterListener(this); itera->setAdjusterListener(this); + guidbl->setLogScale(100, 0); guidbl->setAdjusterListener(this); epsbl->setAdjusterListener(this); + strbl->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)); @@ -3833,6 +3836,7 @@ pe(nullptr) blurrBox->pack_start(*medMethod); blurrBox->pack_start(*itera); blurrBox->pack_start(*guidbl); + blurrBox->pack_start(*strbl); blurrBox->pack_start(*epsbl); blurrBox->pack_start(*sensibn); blurrBox->pack_start(*blurMethod); @@ -5469,6 +5473,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited pp->locallab.spots.at(pp->locallab.selspot).itera = itera->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).guidbl = guidbl->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).epsbl = epsbl->getIntValue(); + pp->locallab.spots.at(pp->locallab.selspot).strbl = strbl->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).isogr = isogr->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).strengr = strengr->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).scalegr = scalegr->getIntValue(); @@ -5965,6 +5970,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited pe->locallab.spots.at(pp->locallab.selspot).strengr = pe->locallab.spots.at(pp->locallab.selspot).strengr || strengr->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).scalegr = pe->locallab.spots.at(pp->locallab.selspot).scalegr || scalegr->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).guidbl = pe->locallab.spots.at(pp->locallab.selspot).guidbl || guidbl->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).strbl = pe->locallab.spots.at(pp->locallab.selspot).strbl || strbl->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).epsbl = pe->locallab.spots.at(pp->locallab.selspot).epsbl || epsbl->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).blMethod = pe->locallab.spots.at(pp->locallab.selspot).blMethod || blMethod->get_active_text() != M("GENERAL_UNCHANGED"); pe->locallab.spots.at(pp->locallab.selspot).chroMethod = pe->locallab.spots.at(pp->locallab.selspot).chroMethod || chroMethod->get_active_text() != M("GENERAL_UNCHANGED"); @@ -6401,6 +6407,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited pedited->locallab.spots.at(pp->locallab.selspot).strengr = pedited->locallab.spots.at(pp->locallab.selspot).strengr || strengr->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).scalegr = pedited->locallab.spots.at(pp->locallab.selspot).scalegr || scalegr->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).guidbl = pedited->locallab.spots.at(pp->locallab.selspot).guidbl || guidbl->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).strbl = pedited->locallab.spots.at(pp->locallab.selspot).strbl || strbl->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).epsbl = pedited->locallab.spots.at(pp->locallab.selspot).epsbl || epsbl->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).blMethod = pedited->locallab.spots.at(pp->locallab.selspot).blMethod || blMethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->locallab.spots.at(pp->locallab.selspot).chroMethod = pedited->locallab.spots.at(pp->locallab.selspot).chroMethod || chroMethod->get_active_text() != M("GENERAL_UNCHANGED"); @@ -7277,6 +7284,7 @@ void Locallab::blMethodChanged() scalegr->show(); medMethod->hide(); guidbl->hide(); + strbl->hide(); epsbl->hide(); activlum->show(); } else if (blMethod->get_active_row_number() == 1) { @@ -7290,6 +7298,7 @@ void Locallab::blMethodChanged() itera->show(); medMethod->show(); guidbl->hide(); + strbl->hide(); epsbl->hide(); activlum->show(); } else if (blMethod->get_active_row_number() == 2) { @@ -7303,6 +7312,7 @@ void Locallab::blMethodChanged() itera->hide(); medMethod->hide(); guidbl->show(); + strbl->show(); epsbl->show(); activlum->hide(); } @@ -9485,6 +9495,7 @@ void Locallab::setDefaults(const rtengine::procparams::ProcParams * defParams, c strengr->setDefault((double)defSpot->strengr); scalegr->setDefault((double)defSpot->scalegr); guidbl->setDefault((double)defSpot->guidbl); + strbl->setDefault((double)defSpot->strbl); epsbl->setDefault((double)defSpot->epsbl); blendmaskbl->setDefault((double)defSpot->blendmaskbl); radmaskbl->setDefault(defSpot->radmaskbl); @@ -9741,6 +9752,7 @@ void Locallab::setDefaults(const rtengine::procparams::ProcParams * defParams, c strengr->setDefaultEditedState(Irrelevant); scalegr->setDefaultEditedState(Irrelevant); guidbl->setDefaultEditedState(Irrelevant); + strbl->setDefaultEditedState(Irrelevant); epsbl->setDefaultEditedState(Irrelevant); blendmaskbl->setDefaultEditedState(Irrelevant); radmaskbl->setDefaultEditedState(Irrelevant); @@ -10002,6 +10014,7 @@ void Locallab::setDefaults(const rtengine::procparams::ProcParams * defParams, c strengr->setDefaultEditedState(defSpotState->strengr ? Edited : UnEdited); scalegr->setDefaultEditedState(defSpotState->scalegr ? Edited : UnEdited); guidbl->setDefaultEditedState(defSpotState->guidbl ? Edited : UnEdited); + strbl->setDefaultEditedState(defSpotState->strbl ? Edited : UnEdited); epsbl->setDefaultEditedState(defSpotState->epsbl ? Edited : UnEdited); blendmaskbl->setDefaultEditedState(defSpotState->blendmaskbl ? Edited : UnEdited); radmaskbl->setDefaultEditedState(defSpotState->radmaskbl ? Edited : UnEdited); @@ -10857,6 +10870,12 @@ void Locallab::adjusterChanged(Adjuster * a, double newval) } } + if (a == strbl) { + if (listener) { + listener->panelChanged(Evlocallabstrbl, strbl->getTextValue()); + } + } + if (a == epsbl) { if (listener) { listener->panelChanged(Evlocallabepsbl, epsbl->getTextValue()); @@ -11810,6 +11829,7 @@ void Locallab::setBatchMode(bool batchMode) strengr->showEditedCB(); scalegr->showEditedCB(); guidbl->showEditedCB(); + strbl->showEditedCB(); epsbl->showEditedCB(); blendmaskbl->showEditedCB(); radmaskbl->showEditedCB(); @@ -12776,6 +12796,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con strengr->setValue(pp->locallab.spots.at(index).strengr); scalegr->setValue(pp->locallab.spots.at(index).scalegr); guidbl->setValue(pp->locallab.spots.at(index).guidbl); + strbl->setValue(pp->locallab.spots.at(index).strbl); epsbl->setValue(pp->locallab.spots.at(index).epsbl); if (pp->locallab.spots.at(index).blMethod == "blur") { @@ -13439,6 +13460,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con strengr->setEditedState(spotState->strengr ? Edited : UnEdited); scalegr->setEditedState(spotState->scalegr ? Edited : UnEdited); guidbl->setEditedState(spotState->guidbl ? Edited : UnEdited); + strbl->setEditedState(spotState->strbl ? Edited : UnEdited); epsbl->setEditedState(spotState->epsbl ? Edited : UnEdited); if (!spotState->blMethod) { @@ -14065,6 +14087,7 @@ void Locallab::updateSpecificGUIState() scalegr->show(); medMethod->hide(); guidbl->hide(); + strbl->hide(); epsbl->hide(); activlum->show(); } else if (blMethod->get_active_row_number() == 1) { @@ -14078,6 +14101,7 @@ void Locallab::updateSpecificGUIState() itera->show(); medMethod->show(); guidbl->hide(); + strbl->hide(); epsbl->hide(); activlum->show(); } else if (blMethod->get_active_row_number() == 2) { @@ -14091,6 +14115,7 @@ void Locallab::updateSpecificGUIState() itera->hide(); medMethod->hide(); guidbl->show(); + strbl->show(); epsbl->show(); activlum->hide(); } diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 98764f932..92fd1af9a 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -301,6 +301,7 @@ private: Adjuster* const strength; Adjuster* const itera; Adjuster* const guidbl; + Adjuster* const strbl; Adjuster* const epsbl; Adjuster* const sensibn; Adjuster* const blendmaskbl; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 11491dafa..924ccb6a8 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1161,6 +1161,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).sensibn = locallab.spots.at(j).sensibn && pSpot.sensibn == otherSpot.sensibn; locallab.spots.at(j).itera = locallab.spots.at(j).itera && pSpot.itera == otherSpot.itera; locallab.spots.at(j).guidbl = locallab.spots.at(j).guidbl && pSpot.guidbl == otherSpot.guidbl; + locallab.spots.at(j).strbl = locallab.spots.at(j).strbl && pSpot.strbl == otherSpot.strbl; locallab.spots.at(j).isogr = locallab.spots.at(j).isogr && pSpot.isogr == otherSpot.isogr; locallab.spots.at(j).strengr = locallab.spots.at(j).strengr && pSpot.strengr == otherSpot.strengr; locallab.spots.at(j).epsbl = locallab.spots.at(j).epsbl && pSpot.epsbl == otherSpot.epsbl; @@ -3656,6 +3657,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).guidbl = mods.locallab.spots.at(i).guidbl; } + if (locallab.spots.at(i).strbl) { + toEdit.locallab.spots.at(i).strbl = mods.locallab.spots.at(i).strbl; + } + if (locallab.spots.at(i).isogr) { toEdit.locallab.spots.at(i).isogr = mods.locallab.spots.at(i).isogr; } @@ -5657,6 +5662,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : strengr(v), scalegr(v), guidbl(v), + strbl(v), epsbl(v), blMethod(v), chroMethod(v), @@ -6083,6 +6089,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) strengr = v; scalegr = v; guidbl = v; + strbl = v; epsbl = v; blMethod = v; chroMethod = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 4d9dd9912..00b845aac 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -595,6 +595,7 @@ public: bool strengr; bool scalegr; bool guidbl; + bool strbl; bool epsbl; bool blMethod; bool chroMethod;