diff --git a/rtdata/languages/default b/rtdata/languages/default index 235645c46..225e53c07 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -987,6 +987,7 @@ HISTORY_MSG_746;Local - Exp Fattal levels HISTORY_MSG_747;Local Spot created HISTORY_MSG_748;Local - Exp Denoise HISTORY_MSG_749;Local - Reti Depth +HISTORY_MSG_750;Local - Reti Mode log - lin HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -2209,8 +2210,10 @@ TP_LOCALLAB_SHOWMASKSOFT_TOOLTIP;Show process Fourier:\nShows the different stag TP_LOCALLAB_SHOWNORMAL;Normalize luminance (no) TP_LOCALLAB_TM;Tone Mapping TP_LOCALLAB_STR;Strength Retinex +TP_LOCALLAB_LOGLIN;Logarithm mode +TP_LOCALLAB_STRRETI_TOOLTIP;if Strength Retinex < 0.2 only Dehaze is enabled.\nif Strength Retinex >= 0.1 Dehaze is in luminance mode. TP_LOCALLAB_NEIGH;Radius -TP_LOCALLAB_VART;Contrast (variance) +TP_LOCALLAB_VART;Variance (contrast) TP_LOCALLAB_SENSI;Scope TP_LOCALLAB_SENSI_TOOLTIP;Adjust scope of action:\nSmall values limit action to colors very similar to those under the center spot.\nHigh values let the tool act upon a wider range of colors.\nValues smaller than 20 lead to a better algorithm. TP_LOCALLAB_SENSIH;Scope diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index a70c34def..bf0bb8f3d 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -868,14 +868,14 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L const float lig = loc.spots.at(sp).lightnessreti; float value = pow(strength, 0.4f); float value_1 = pow(strength, 0.3f); - + float logli = loc.spots.at(sp).loglin; float limD = loc.spots.at(sp).limd;//10.f limD = pow(limD, 1.7f); //about 2500 enough float ilimD = 1.f / limD; float threslum = loc.spots.at(sp).limd; const float elogt = 2.71828f; - if (scal < 3) { + if(!logli) { useHslLin = true; } @@ -1247,7 +1247,7 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L #ifdef __SSE2__ - if (useHslLin) { //keep in case of ?? + if (useHslLin) { for (; j < W_L - 3; j += 4) { _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * (vclampf(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv))); } @@ -1376,7 +1376,7 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L avg /= ng; avg /= 32768.f; avg = LIM01(avg); - float contreal = 20.f * vart; + float contreal = 2.f * vart; DiagonalCurve reti_contrast({ DCT_NURBS, 0, 0, @@ -1401,7 +1401,7 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L if (scal == 1) { float mintran = luminance[0][0]; float maxtran = mintran; - +/* #ifdef _OPENMP #pragma omp parallel for reduction(min:mintran) reduction(max:maxtran) schedule(dynamic,16) #endif @@ -1412,7 +1412,9 @@ void ImProcFunctions::MSRLocal(int sp, bool fftw, int lum, LabImage * bufreti, L maxtran = rtengine::max(luminance[ir][jr], maxtran); } } - +*/ + mintran = 0.f; + maxtran = 1.f; float deltatran = maxtran - mintran; array2D ble(W_L, H_L); array2D guid(W_L, H_L); diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 180c491b3..3e1fee08f 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -776,6 +776,7 @@ enum ProcEventCode { EvLocallabSpotCreated = 746, EvlocallabexnoiseMethod = 747, Evlocallabdepth = 748, + Evlocallabloglin = 749, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index f1068cd93..eb11372c5 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2586,6 +2586,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : 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}, inversret(false), equilret(true), + loglin(true), softradiusret(0.0), CCmaskreticurve{(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 }, LLmaskreticurve{(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}, @@ -2848,6 +2849,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && localTgaincurve == other.localTgaincurve && inversret == other.inversret && equilret == other.equilret + && loglin == other.loglin && softradiusret == other.softradiusret && CCmaskreticurve == other.CCmaskreticurve && LLmaskreticurve == other.LLmaskreticurve @@ -4093,6 +4095,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).localTgaincurve, "Locallab", "TgainCurve_" + std::to_string(i), spot.localTgaincurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).inversret, "Locallab", "Inversret_" + std::to_string(i), spot.inversret, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).equilret, "Locallab", "Equilret_" + std::to_string(i), spot.equilret, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).loglin, "Locallab", "Loglin_" + std::to_string(i), spot.loglin, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).softradiusret, "Locallab", "Softradiusret_" + std::to_string(i), spot.softradiusret, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).CCmaskreticurve, "Locallab", "CCmaskretiCurve_" + std::to_string(i), spot.CCmaskreticurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).LLmaskreticurve, "Locallab", "LLmaskretiCurve_" + std::to_string(i), spot.LLmaskreticurve, keyFile); @@ -5467,6 +5470,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "TgainCurve_" + std::to_string(i), pedited, spot.localTgaincurve, spotEdited.localTgaincurve); assignFromKeyfile(keyFile, "Locallab", "Inversret_" + std::to_string(i), pedited, spot.inversret, spotEdited.inversret); assignFromKeyfile(keyFile, "Locallab", "Equilret_" + std::to_string(i), pedited, spot.equilret, spotEdited.equilret); + assignFromKeyfile(keyFile, "Locallab", "Loglin_" + std::to_string(i), pedited, spot.loglin, spotEdited.loglin); assignFromKeyfile(keyFile, "Locallab", "Softradiusret_" + std::to_string(i), pedited, spot.softradiusret, spotEdited.softradiusret); assignFromKeyfile(keyFile, "Locallab", "CCmaskretiCurve_" + std::to_string(i), pedited, spot.CCmaskreticurve, spotEdited.CCmaskreticurve); assignFromKeyfile(keyFile, "Locallab", "LLmaskretiCurve_" + std::to_string(i), pedited, spot.LLmaskreticurve, spotEdited.LLmaskreticurve); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 79e432150..98bda95ae 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1136,6 +1136,7 @@ struct LocallabParams { std::vector localTgaincurve; bool inversret; bool equilret; + bool loglin; double softradiusret; std::vector CCmaskreticurve; std::vector LLmaskreticurve; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 927ecbd17..131d69fab 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -775,7 +775,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //Evlocallabfatlevel LUMINANCECURVE, //EvlocallabSpotCreated LUMINANCECURVE, // EvlocallabexnoiseMethod - LUMINANCECURVE // Evlocallabdepth + LUMINANCECURVE, // Evlocallabdepth + LUMINANCECURVE // Evlocallabloglin }; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 3245f6c3c..0ea00b036 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -352,6 +352,7 @@ Locallab::Locallab(): enatmMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), // Retinex equilret(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_EQUIL")))), + loglin(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_LOGLIN")))), inversret(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))), enaretiMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), enaretiMasktmap(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_TM_MASK")))), @@ -1319,6 +1320,10 @@ Locallab::Locallab(): str->setAdjusterListener(this); + if (showtooltip) { + str->set_tooltip_text(M("TP_LOCALLAB_STRRETI_TOOLTIP")); + } + neigh->setAdjusterListener(this); if (showtooltip) { @@ -1361,6 +1366,7 @@ Locallab::Locallab(): inversretConn = inversret->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::inversretChanged)); equilretConn = equilret->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::equilretChanged)); + loglinConn = loglin->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::loglinChanged)); maskretiCurveEditorG->setCurveListener(this); @@ -1452,6 +1458,7 @@ Locallab::Locallab(): retiBox->pack_start(*retinexMethod); retiBox->pack_start(*fftwreti); retiBox->pack_start(*equilret); + retiBox->pack_start(*loglin); // retiBox->pack_start(*str); // retiBox->pack_start(*dehaz); retiBox->pack_start(*chrrt); @@ -1461,7 +1468,7 @@ Locallab::Locallab(): retiBox->pack_start(*limd); retiBox->pack_start(*darkness); retiBox->pack_start(*lightnessreti); - retiBox->pack_start(*softradiusret); +// retiBox->pack_start(*softradiusret); // retiBox->pack_start(*sensih); retiBox->pack_start(*LocalcurveEditorgainT, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor retiBox->pack_start(*expmaskreti); @@ -3040,6 +3047,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).inversret = inversret->get_active(); pp->locallab.spots.at(pp->locallab.selspot).softradiusret = softradiusret->getValue(); pp->locallab.spots.at(pp->locallab.selspot).equilret = equilret->get_active(); + pp->locallab.spots.at(pp->locallab.selspot).loglin = loglin->get_active(); pp->locallab.spots.at(pp->locallab.selspot).LLmaskreticurve = LLmaskretishape->getCurve(); pp->locallab.spots.at(pp->locallab.selspot).CCmaskreticurve = CCmaskretishape->getCurve(); pp->locallab.spots.at(pp->locallab.selspot).HHmaskreticurve = HHmaskretishape->getCurve(); @@ -3309,6 +3317,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).localTgaincurve = pe->locallab.spots.at(pp->locallab.selspot).localTgaincurve || !cTgainshape->isUnChanged(); pe->locallab.spots.at(pp->locallab.selspot).inversret = pe->locallab.spots.at(pp->locallab.selspot).inversret || !inversret->get_inconsistent(); pe->locallab.spots.at(pp->locallab.selspot).equilret = pe->locallab.spots.at(pp->locallab.selspot).equilret || !equilret->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).loglin = pe->locallab.spots.at(pp->locallab.selspot).loglin || !loglin->get_inconsistent(); pe->locallab.spots.at(pp->locallab.selspot).softradiusret = pe->locallab.spots.at(pp->locallab.selspot).softradiusret || softradiusret->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).CCmaskreticurve = pe->locallab.spots.at(pp->locallab.selspot).CCmaskreticurve || !CCmaskretishape->isUnChanged(); pe->locallab.spots.at(pp->locallab.selspot).LLmaskreticurve = pe->locallab.spots.at(pp->locallab.selspot).LLmaskreticurve || !LLmaskretishape->isUnChanged(); @@ -3577,6 +3586,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).localTgaincurve = pedited->locallab.spots.at(pp->locallab.selspot).localTgaincurve || !cTgainshape->isUnChanged(); pedited->locallab.spots.at(pp->locallab.selspot).inversret = pedited->locallab.spots.at(pp->locallab.selspot).inversret || !inversret->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).equilret = pedited->locallab.spots.at(pp->locallab.selspot).equilret || !equilret->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).loglin = pedited->locallab.spots.at(pp->locallab.selspot).loglin || !loglin->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).softradiusret = pedited->locallab.spots.at(pp->locallab.selspot).softradiusret || softradiusret->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).CCmaskreticurve = pedited->locallab.spots.at(pp->locallab.selspot).CCmaskreticurve || !CCmaskretishape->isUnChanged(); pedited->locallab.spots.at(pp->locallab.selspot).LLmaskreticurve = pedited->locallab.spots.at(pp->locallab.selspot).LLmaskreticurve || !LLmaskretishape->isUnChanged(); @@ -5060,7 +5070,7 @@ void Locallab::equilretChanged() if (getEnabled() && expreti->getEnabled()) { if (listener) { - if (inversret->get_active()) { + if (equilret->get_active()) { listener->panelChanged(Evlocallabequilret, M("GENERAL_ENABLED")); } else { listener->panelChanged(Evlocallabequilret, M("GENERAL_DISABLED")); @@ -5069,6 +5079,30 @@ void Locallab::equilretChanged() } } +void Locallab::loglinChanged() +{ + // printf("inversretChanged\n"); + + if (multiImage) { + if (loglin->get_inconsistent()) { + loglin->set_inconsistent(false); + loglinConn.block(true); + loglin->set_active(false); + loglinConn.block(false); + } + } + + + if (getEnabled() && expreti->getEnabled()) { + if (listener) { + if (loglin->get_active()) { + listener->panelChanged(Evlocallabloglin, M("GENERAL_ENABLED")); + } else { + listener->panelChanged(Evlocallabloglin, M("GENERAL_DISABLED")); + } + } + } +} void Locallab::inversretChanged() @@ -7061,6 +7095,7 @@ void Locallab::enableListener() retinexMethodConn.block(false); inversretConn.block(false); equilretConn.block(false); + loglinConn.block(false); enaretiMaskConn.block(false); enaretiMasktmapConn.block(false); showmaskretiMethodConn.block(false); @@ -7135,6 +7170,7 @@ void Locallab::disableListener() retinexMethodConn.block(true); inversretConn.block(true); equilretConn.block(true); + loglinConn.block(true); enaretiMaskConn.block(true); enaretiMasktmapConn.block(true); showmaskretiMethodConn.block(true); @@ -7400,6 +7436,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con cTgainshape->setCurve(pp->locallab.spots.at(index).localTgaincurve); inversret->set_active(pp->locallab.spots.at(index).inversret); equilret->set_active(pp->locallab.spots.at(index).equilret); + loglin->set_active(pp->locallab.spots.at(index).loglin); softradiusret->setValue(pp->locallab.spots.at(index).softradiusret); CCmaskretishape->setCurve(pp->locallab.spots.at(index).CCmaskreticurve); LLmaskretishape->setCurve(pp->locallab.spots.at(index).LLmaskreticurve); @@ -7720,6 +7757,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con cTgainshape->setUnChanged(!spotState->localTgaincurve); inversret->set_inconsistent(multiImage && !spotState->inversret); equilret->set_inconsistent(multiImage && !spotState->equilret); + loglin->set_inconsistent(multiImage && !spotState->loglin); softradiusret->setEditedState(spotState->softradiusret ? Edited : UnEdited); CCmaskretishape->setUnChanged(!spotState->CCmaskreticurve); LLmaskretishape->setUnChanged(!spotState->LLmaskreticurve); diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 9ea657417..e3f7eca2c 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -317,6 +317,8 @@ private: sigc::connection equilretConn; Gtk::CheckButton* const inversret; sigc::connection inversretConn; + Gtk::CheckButton* const loglin; + sigc::connection loglinConn; Gtk::CheckButton* const enaretiMask; sigc::connection enaretiMaskConn; Gtk::CheckButton* const enaretiMasktmap; @@ -451,6 +453,7 @@ private: void enatmMaskChanged(); // Retinex void equilretChanged(); + void loglinChanged(); void inversretChanged(); void enaretiMaskChanged(); void enaretiMasktmapChanged(); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index b7bf2e009..a5ca56344 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1126,6 +1126,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).localTgaincurve = locallab.spots.at(j).localTgaincurve && pSpot.localTgaincurve == otherSpot.localTgaincurve; locallab.spots.at(j).inversret = locallab.spots.at(j).inversret && pSpot.inversret == otherSpot.inversret; locallab.spots.at(j).equilret = locallab.spots.at(j).equilret && pSpot.equilret == otherSpot.equilret; + locallab.spots.at(j).loglin = locallab.spots.at(j).loglin && pSpot.loglin == otherSpot.loglin; locallab.spots.at(j).softradiusret = locallab.spots.at(j).softradiusret && pSpot.softradiusret == otherSpot.softradiusret; locallab.spots.at(j).CCmaskreticurve = locallab.spots.at(j).CCmaskreticurve && pSpot.CCmaskreticurve == otherSpot.CCmaskreticurve; locallab.spots.at(j).LLmaskreticurve = locallab.spots.at(j).LLmaskreticurve && pSpot.LLmaskreticurve == otherSpot.LLmaskreticurve; @@ -3356,6 +3357,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).equilret = mods.locallab.spots.at(i).equilret; } + if (locallab.spots.at(i).loglin) { + toEdit.locallab.spots.at(i).loglin = mods.locallab.spots.at(i).loglin; + } + if (locallab.spots.at(i).CCmaskreticurve) { toEdit.locallab.spots.at(i).CCmaskreticurve = mods.locallab.spots.at(i).CCmaskreticurve; } @@ -4785,6 +4790,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : localTgaincurve(v), inversret(v), equilret(v), + loglin(v), softradiusret(v), CCmaskreticurve(v), LLmaskreticurve(v), @@ -5044,6 +5050,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) localTgaincurve = v; inversret = v; equilret = v; + loglin = v; softradiusret = v; CCmaskreticurve = v; LLmaskreticurve = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index adb2e5cb9..cee7497ac 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -546,6 +546,7 @@ public: bool localTgaincurve; bool inversret; bool equilret; + bool loglin; bool softradiusret; bool CCmaskreticurve; bool LLmaskreticurve;