diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 771d1e03f..0278912e6 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -198,7 +198,7 @@ public: float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope); void deltaEforMask(float **rdE, int bfw, int bfh, LabImage* bufcolorig, const float hueref, const float chromaref, const float lumaref, - float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope); + float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope, float balance); void discrete_laplacian_threshold(float * data_out, const float * data_in, size_t nx, size_t ny, float t); void rex_poisson_dct(float * data, size_t nx, size_t ny, double m); void mean_dt(const float * data, size_t size, double * mean_p, double * dt_p); @@ -217,7 +217,7 @@ public: LUTf & lmaskretilocalcurve, bool & localmaskretiutili, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, bool multiThread, bool delt, const float hueref, const float chromaref, const float lumaref, - float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope); + float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope, float balance); void filmGrain(Imagefloat *rgb, int isogr, int strengr, int scalegr, int bfw, int bfh); @@ -228,7 +228,7 @@ public: LUTf & lmaskretilocalcurve, bool & localmaskretiutili, LabImage * transformed, bool retiMasktmap, bool retiMask, bool delt, const float hueref, const float chromaref, const float lumaref, - float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope); + float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope, float balance); void calc_ref(int sp, LabImage* original, LabImage* transformed, int cx, int cy, int oW, int oH, int sk, double &huerefblur, double &chromarefblur, double &lumarefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref, float &avg); diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index a8a421f0d..6ad85e3f9 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -2360,11 +2360,14 @@ static void blendmask(const local_params& lp, int xstart, int ystart, int cx, in } void ImProcFunctions::deltaEforMask(float **rdE, int bfw, int bfh, LabImage* bufcolorig, const float hueref, const float chromaref, const float lumaref, - float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope) + float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope, float balance) { const float refa = chromaref * cos(hueref); const float refb = chromaref * sin(hueref); const float refL = lumaref; + float kL = balance; //lp.balance; + float kab = 1.f; + balancedeltaE(kL, kab); float reducdE = 1.f; #ifdef _OPENMP @@ -2373,7 +2376,7 @@ void ImProcFunctions::deltaEforMask(float **rdE, int bfw, int bfh, LabImage* buf for (int y = 0; y < bfh; y++) { for (int x = 0; x < bfw; x++) { - float tempdE = sqrt((SQR(refa - bufcolorig->a[y][x] / 327.68f) + SQR(refb - bufcolorig->b[y][x] / 327.68f)) + SQR(refL - bufcolorig->L[y][x] / 327.68f)); + float tempdE = sqrt(kab * (SQR(refa - bufcolorig->a[y][x] / 327.68f) + SQR(refb - bufcolorig->b[y][x] / 327.68f)) + kL * SQR(refL - bufcolorig->L[y][x] / 327.68f)); if (tempdE > maxdE) { reducdE = 0.f; @@ -3038,7 +3041,7 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int } if (shado > 0) { - ImProcFunctions::shadowsHighlights(bufmaskblurcol, true, 1, 0, shado, 40, sk, 0, lp.shcomp); + ImProcFunctions::shadowsHighlights(bufmaskblurcol, true, 1, 0, shado, 40, sk, 0, 30); } int wavelet_level = level_br; @@ -3082,7 +3085,7 @@ void ImProcFunctions::maskcalccol(bool invmask, bool pde, int bfw, int bfh, int rdE[i] = &rdEBuffer[i * bfw]; } - deltaEforMask(rdE, bfw, bfh, bufcolorig, hueref, chromaref, lumaref, maxdE, mindE, maxdElim, mindElim, iterat, limscope, scope); + deltaEforMask(rdE, bfw, bfh, bufcolorig, hueref, chromaref, lumaref, maxdE, mindE, maxdElim, mindElim, iterat, limscope, scope, lp.balance); // printf("rde1=%f rde2=%f\n", rdE[1][1], rdE[100][100]); std::unique_ptr delta(new LabImage(bfw, bfh)); #ifdef _OPENMP @@ -7323,7 +7326,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o rdE[i] = &rdEBuffer[i * GW]; } - deltaEforMask(rdE, GW, GH, bufgb.get(), hueref, chromaref, lumaref, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, sco); + deltaEforMask(rdE, GW, GH, bufgb.get(), hueref, chromaref, lumaref, maxdE, mindE, maxdElim, mindElim, lp.iterat, limscope, sco, lp.balance); // printf("rde1=%f rde2=%f\n", rdE[1][1], rdE[100][100]); std::unique_ptr delta(new LabImage(GW, GH)); #ifdef _OPENMP @@ -9572,7 +9575,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o lmaskretilocalcurve, localmaskretiutili, transformed, lp.enaretiMasktmap, lp.enaretiMask, delt, hueref, chromaref, lumaref, - maxdE2, mindE2, maxdElim2, mindElim2, lp.iterat, limscope2, sco); + maxdE2, mindE2, maxdElim2, mindElim2, lp.iterat, limscope2, sco, lp.balance); #ifdef _OPENMP #pragma omp parallel for #endif @@ -9705,7 +9708,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o lmaskretilocalcurve, localmaskretiutili, transformed, lp.enaretiMasktmap, lp.enaretiMask, false, 1.f, 1.f, 1.f, - 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 50); + 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 50, 1.f); } @@ -10096,7 +10099,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o lmaskretilocalcurve, localmaskretiutili, transformed, lp.enaretiMasktmap, lp.enaretiMask, delt, hueref, chromaref, lumaref, - maxdE2, mindE2, maxdElim2, mindElim2, lp.iterat, limscope2, sco); + maxdE2, mindE2, maxdElim2, mindElim2, lp.iterat, limscope2, sco, lp.balance); #ifdef _OPENMP #pragma omp parallel for @@ -10243,7 +10246,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o lmaskretilocalcurve, localmaskretiutili, transformed, lp.enaretiMasktmap, lp.enaretiMask, false, 1.f, 1.f, 1.f, - 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 50); + 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 50, 1.f); } diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index 2d521ab10..20360b83f 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -856,7 +856,7 @@ void ImProcFunctions::maskforretinex(int sp, int before, float ** luminance, flo LUTf & lmaskretilocalcurve, bool & localmaskretiutili, LabImage * bufreti, LabImage * bufmask, LabImage * buforig, LabImage * buforigmas, bool multiThread, bool delt, const float hueref, const float chromaref, const float lumaref, - float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope) + float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope, float balance) { array2D loctemp(W_L, H_L); array2D ble(W_L, H_L); @@ -983,7 +983,7 @@ void ImProcFunctions::maskforretinex(int sp, int before, float ** luminance, flo rdE[i] = &rdEBuffer[i * W_L]; } - deltaEforMask(rdE, W_L, H_L, bufreti, hueref, chromaref, lumaref, maxdE, mindE, maxdElim, mindElim, iterat, limscope, scope); + deltaEforMask(rdE, W_L, H_L, bufreti, hueref, chromaref, lumaref, maxdE, mindE, maxdElim, mindElim, iterat, limscope, scope, balance); // printf("rde1=%f rde2=%f\n", rdE[1][1], rdE[100][100]); std::unique_ptr delta(new LabImage(W_L, H_L)); #ifdef _OPENMP @@ -1141,7 +1141,7 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, float** reducDE, LabI LUTf & lmaskretilocalcurve, bool & localmaskretiutili, LabImage * transformed, bool retiMasktmap, bool retiMask, bool delt, const float hueref, const float chromaref, const float lumaref, - float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope) + float maxdE, float mindE, float maxdElim, float mindElim, float iterat, float limscope, int scope, float balance) { BENCHFUN @@ -1679,7 +1679,7 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, float** reducDE, LabI lmaskretilocalcurve, localmaskretiutili, bufreti, bufmask, buforig, buforigmas, multiThread, delt, hueref, chromaref, lumaref, - maxdE, mindE, maxdElim, mindElim, iterat, limscope, scope + maxdE, mindE, maxdElim, mindElim, iterat, limscope, scope, balance ); } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 8342d25e7..ec2bb1853 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2434,7 +2434,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : avoid(false), laplac(false), deltae(true), - scopemask(50), + scopemask(60), // Color & Light expcolor(false), curvactiv(false), diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index 609415010..1a3ab0d3f 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -68,7 +68,7 @@ ControlSpotPanel::ControlSpotPanel(): balan_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BALAN"), 0.2, 2.5, 0.1, 1.0, Gtk::manage(new RTImage("rawtherapee-logo-16.png")), Gtk::manage(new RTImage("circle-white-small.png"))))), transitweak_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_TRANSITWEAK"), 0.5, 10.0, 0.1, 1.0))), transitgrad_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_TRANSITGRAD"), -1.0, 1.0, 0.01, 0.0))), - scopemask_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SCOPEMASK"), 0, 100, 1, 50))), + scopemask_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SCOPEMASK"), 0, 100, 1, 60))), avoid_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_AVOID")))), laplac_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_LAPLACC")))),