diff --git a/rtdata/languages/default b/rtdata/languages/default index 2011c7344..fc64fb922 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -990,7 +990,8 @@ HISTORY_MSG_749;Local - Reti Depth HISTORY_MSG_750;Local - Reti Mode log - lin HISTORY_MSG_751;Local - Reti Dehaze luminance HISTORY_MSG_752;Local - Reti Offset -HISTORY_MSG_753;Local - Transmission map +HISTORY_MSG_753;Local - Reti Transmission map +HISTORY_MSG_754;Local - Reti Clip HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -2107,6 +2108,7 @@ TP_LOCALLAB_DARKRETI;Darkness TP_LOCALLAB_LIGHTRETI;Lightness TP_LOCALLAB_THRESRETI;Threshold TP_LOCALLAB_DENOIS;Denoise +TP_LOCALLAB_CLIPTM;Clip Restored datas (gain) TP_LOCALLAB_DEHAZ;Strength TP_LOCALLAB_DEPTH;Depth TP_LOCALLAB_LUMONLY;Luminance only @@ -2211,6 +2213,12 @@ TP_LOCALLAB_LC_FFTW_TOOLTIP;FFT improve quality and allow big radius, but increa TP_LOCALLAB_RETI_FFTW_TOOLTIP;FFT improve quality and allow big radius, but increases the treatment time.\nThe treatment time depends on the surface to be treated\nThe treatment time depends on the value of scale (be carefull to high values).\nTo be used preferably for large radius.\n\nDimensions can be reduced by a few pixels to optimize FFTW.\nThis optimization can reduce the treatment time by a factor of 1.5 to 10.\nNot used in Preview TP_LOCALLAB_TRANSMISSIONGAIN;Transmission gain TP_LOCALLAB_TRANSMISSIONMAP;Transmission map +TP_LOCALLAB_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction.\nYou can act on this curve to change Transmission and reduce the artifacts +TP_LOCALLAB_MLABEL;Restored datas Min=%1 Max=%2 (Clip - Offset) +TP_LOCALLAB_MLABEL_TOOLTIP;'Should be' near min=0 max=32768 but others values are possible.\nYou can act on Clip Restored datas and Offset to normalize.\n\nRestored image with no mixture. +TP_LOCALLAB_TLABEL;TM Datas Min=%1 Max=%2 Mean=%3 Sigma=%4 (Threshold) +TP_LOCALLAB_TLABEL2;TM Effective Tm=%1 TM=%2 +TP_LOCALLAB_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nTm=Min TM=Max of Transmission Map.\nYou can act on Threshold to normalize TP_LOCALLAB_STREN;Compression Strength TP_LOCALLAB_STRGRID;Strength TP_LOCALLAB_SHADEX;Shadows diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 8fe3cafca..89a7d107f 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -8883,7 +8883,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o // float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; bool fftw = lp.ftwreti; - fftw = false; + //fftw = false; //for Retinex Mask are incorporated in MSR ImProcFunctions::MSRLocal(sp, fftw, 1, bufreti, bufmask, buforig, buforigmas, orig, tmpl->L, orig1, Wd, Hd, Wd, Hd, params->locallab, sk, locRETgainCcurve, locRETtransCcurve, 0, 4, 1.f, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, locccmasretiCurve, lcmasretiutili, locllmasretiCurve, llmasretiutili, lochhmasretiCurve, lhmasretiutili, llretiMask, transformed, lp.enaretiMasktmap, lp.enaretiMask); diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index 3827bc9c1..8c07029e0 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -876,6 +876,7 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L float ilimD = 1.f / limD; float threslum = loc.spots.at(sp).limd; const float elogt = 2.71828f; + float radi = loc.spots.at(sp).softradiusret; if (!logli) { useHslLin = true; @@ -953,6 +954,7 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L for (int i = 0; i < H_L; i++) { out[i] = &outBuffer[i * W_L]; } + float clipt = loc.spots.at(sp).cliptm; const float logBetaGain = xlogf(16384.f); float pond = logBetaGain / (float) scal; @@ -1048,7 +1050,7 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L for (int x = 0; x < W_L; ++x) { float buf = (src[y][x] - out[y][x]) * value; buf *= (buf > 0.f) ? lig : dar; - out[y][x] = LIM(out[y][x] + buf, 0.f, 100000.f); + out[y][x] = LIM(out[y][x] + buf, -100000.f, 100000.f); } } } @@ -1280,7 +1282,8 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L } //printf("ok 5\n"); - if (scal != 1) { + // if (scal != 1) { + if (scal >= 1 && radi > 0.f) { float mintran = luminance[0][0]; float maxtran = mintran; @@ -1301,7 +1304,7 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L //here add GuidFilter for transmission map array2D ble(W_L, H_L); array2D guid(W_L, H_L); - float clipt = loc.spots.at(sp).cliptm; +// float clipt = loc.spots.at(sp).cliptm; #ifdef _OPENMP #pragma omp parallel for @@ -1310,12 +1313,11 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L for (int i = 0; i < H_L; i ++) for (int j = 0; j < W_L; j++) { guid[i][j] = src[i][j] / 32768.f; - ble[i][j] = LIM((luminance[i][j] + mintran) / deltatran, 0.002f * clipt, 1.f - 0.002f * clipt); + ble[i][j] = LIM((luminance[i][j] - mintran) / deltatran, 0.f, 1.f); } double epsilmax = 0.9; double epsilmin = 1e-5; - float radi = loc.spots.at(sp).softradiusret; if (radi > 0.f) { double aepsil = (epsilmax - epsilmin) / 90.f; @@ -1410,7 +1412,7 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L } } - if (scal == 1) { + if (scal == 1 && radi > 0.f) { float mintran = luminance[0][0]; float maxtran = mintran; @@ -1440,9 +1442,8 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L double epsilmax = 0.9; double epsilmin = 1e-4; - float radi = loc.spots.at(sp).softradiusret; - if (loc.spots.at(sp).softradiusret > 0.f) { + if (radi > 0.f) { double aepsil = (epsilmax - epsilmin) / 90.f; double bepsil = epsilmax - 100.f * aepsil; double epsil = aepsil * radi + bepsil; @@ -1545,7 +1546,7 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L delta = 1.0f; } - float cdfactor = 32768.f / delta; + float cdfactor = (clipt * 32768.f) / delta; maxCD = -9999999.f; minCD = 9999999.f; //prepare work for curve gain diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 455d2c0ed..f269750ff 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2587,7 +2587,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : depth(25), sensih(30), localTgaincurve{(double)FCT_MinMaxCPoints, 0.0, 0.12, 0.35, 0.35, 0.70, 0.50, 0.35, 0.35, 1.00, 0.12, 0.35, 0.35}, - localTtranscurve{(double)FCT_MinMaxCPoints, 0.0, 0.50, 0.35, 0.35, 0.60, 0.75, 0.35, 0.35, 1.00, 0.50, 0.35, 0.35}, + localTtranscurve{(double)FCT_MinMaxCPoints, 0.0, 0.50, 0.35, 0.35, 0.5, 0.5, 0.35, 0.35, 1.00, 0.50, 0.35, 0.35}, inversret(false), equilret(true), loglin(false), @@ -2607,7 +2607,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : darkness(2.0), lightnessreti(1.0), limd(8.0), - cliptm(0.0), + cliptm(1.0), fftwreti(false), // Sharpening expsharp(false), diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 5e6477be1..f4c90a308 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -270,7 +270,7 @@ Locallab::Locallab(): chrrt(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHRRT"), 0.0, 100.0, 0.1, 0.0))), neigh(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NEIGH"), MINNEIGH, MAXNEIGH, 0.5, 50., nullptr, nullptr, &retiSlider2neigh, &retiNeigh2Slider))), vart(Gtk::manage(new Adjuster(M("TP_LOCALLAB_VART"), 0.1, 500., 0.1, 150.))), - offs(Gtk::manage(new Adjuster(M("TP_LOCALLAB_OFFS"), -2000., 10000., 1., 0.))), + offs(Gtk::manage(new Adjuster(M("TP_LOCALLAB_OFFS"), -16386., 32768., 1., 0.))), dehaz(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DEHAZ"), 0, 100, 1, 0))), depth(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DEPTH"), 0, 100, 1, 25))), sensih(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIH"), 0, 100, 1, 30))), @@ -283,8 +283,8 @@ Locallab::Locallab(): scalereti(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SCALERETI"), 1.0, 10.0, 1., 2.))), darkness(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DARKRETI"), 0.01, 6.0, 0.01, 2.0))), lightnessreti(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LIGHTRETI"), 0.01, 4.0, 0.01, 1.))), - limd(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRESRETI"), 2., 100.0, 0.1, 8.))), - cliptm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CLIPTM"), 0., 100.0, 0.1, 0.))), + limd(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRESRETI"), 1.2, 100.0, 0.1, 8.))), + cliptm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CLIPTM"), 0.02, 2.0, 0.01, 1.))), // Sharpening sharcontrast(Gtk::manage(new Adjuster(M("TP_SHARPENING_CONTRAST"), 0, 200, 1, 20))), sharradius(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SHARRADIUS"), 0.4, 2.5, 0.01, 0.75))), @@ -360,7 +360,7 @@ Locallab::Locallab(): lumonly(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_LUMONLY")))), enaretiMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), enaretiMasktmap(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_TM_MASK")))), - fftwreti(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_FFTW2")))), + fftwreti(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_FFTW")))), // Sharpening inverssha(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))), // Local contrast @@ -1375,20 +1375,17 @@ Locallab::Locallab(): mMLabels = Gtk::manage(new Gtk::Label("---")); setExpandAlignProperties(mMLabels, true, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_START); - mMLabels->set_tooltip_markup(M("TP_RETINEX_MLABEL_TOOLTIP")); - // settingsGrid->attach (*mMLabels, 0, 0, 1, 1); -// mMLabels->show (); - + if (showtooltip) { + mMLabels->set_tooltip_markup(M("TP_LOCALLAB_MLABEL_TOOLTIP")); + } + transLabels = Gtk::manage(new Gtk::Label("---")); setExpandAlignProperties(transLabels, true, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_START); - transLabels->set_tooltip_markup(M("TP_RETINEX_TLABEL_TOOLTIP")); - // settingsGrid->attach (*transLabels, 0, 1, 1, 1); -// transLabels->show (); - + if (showtooltip) { + transLabels->set_tooltip_markup(M("TP_LOCALLAB_TLABEL_TOOLTIP")); + } transLabels2 = Gtk::manage(new Gtk::Label("---")); setExpandAlignProperties(transLabels2, true, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_START); -// settingsGrid->attach (*transLabels2, 0, 2, 1, 1); -// transLabels2->show (); LocalcurveEditortransT->setCurveListener(this); cTtransshape = static_cast(LocalcurveEditortransT->addCurve(CT_Flat, "", nullptr, false, false)); @@ -1396,7 +1393,7 @@ Locallab::Locallab(): cTtransshape->setResetCurve(FlatCurveType(defSpot.localTtranscurve.at(0)), defSpot.localTtranscurve); if (showtooltip) { - cTtransshape->setTooltip(M("TP_RETINEX_TRANSMISSION_TOOLTIP")); + cTtransshape->setTooltip(M("TP_LOCALLAB_TRANSMISSION_TOOLTIP")); } LocalcurveEditortransT->curveListComplete(); @@ -1524,12 +1521,12 @@ Locallab::Locallab(): retiBox->pack_start(*neigh); retiBox->pack_start(*vart); retiBox->pack_start(*scalereti); - retiBox->pack_start(*limd); -// retiBox->pack_start(*cliptm); - retiBox->pack_start(*offs); retiBox->pack_start(*darkness); retiBox->pack_start(*lightnessreti); // retiBox->pack_start(*softradiusret); + retiBox->pack_start(*limd); + retiBox->pack_start(*cliptm); + retiBox->pack_start(*offs); retiBox->pack_start(*mMLabels); retiBox->pack_start(*transLabels); retiBox->pack_start(*transLabels2); @@ -2252,7 +2249,7 @@ void Locallab::updateLabel() nY = nextmax; { mMLabels->set_text( - Glib::ustring::compose(M("TP_RETINEX_MLABEL"), + Glib::ustring::compose(M("TP_LOCALLAB_MLABEL"), Glib::ustring::format(std::fixed, std::setprecision(0), nX), Glib::ustring::format(std::fixed, std::setprecision(0), nY)) ); @@ -2272,7 +2269,7 @@ void Locallab::updateTrans() nS = nextsigma; { transLabels->set_text( - Glib::ustring::compose(M("TP_RETINEX_TLABEL"), + Glib::ustring::compose(M("TP_LOCALLAB_TLABEL"), Glib::ustring::format(std::fixed, std::setprecision(1), nm), Glib::ustring::format(std::fixed, std::setprecision(1), nM), Glib::ustring::format(std::fixed, std::setprecision(1), nZ),