diff --git a/rtdata/languages/default b/rtdata/languages/default index 0b6795661..bd48d7e71 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1099,6 +1099,7 @@ HISTORY_MSG_859;Local - Contrast Maximum Blur levels HISTORY_MSG_860;Local - Contrast Curve Blur levels HISTORY_MSG_861;Local - Contrast Curve Contrast levels HISTORY_MSG_862;Local - Contrast Sigma luminance +HISTORY_MSG_862;Local - Contrast Merge Original HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -2430,6 +2431,7 @@ TP_LOCALLAB_NOISEMETH;Denoise TP_LOCALLAB_NONENOISE;None TP_LOCALLAB_OFFS;Offset TP_LOCALLAB_OPACOL;Opacity +TP_LOCALLAB_ORIGCOL;Merge only with original image TP_LOCALLAB_PASTELS2;Vibrance TP_LOCALLAB_PDE;Dynamic Range compression + Standard TP_LOCALLAB_PDE2;Laplacian PDE - Dynamic Range compression + Standard diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 836a0c03d..c06e29e9b 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -10775,6 +10775,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o const bool blurlc = params->locallab.spots.at(sp).blurlc; const float radlevblur = (params->locallab.spots.at(sp).levelblur) / sk; const float sigma = params->locallab.spots.at(sp).sigma; + bool origlc = params->locallab.spots.at(sp).origlc; wavcontrast4(tmp1->L, contrast, radblur, radlevblur, tmp1->W, tmp1->H, level_bl, level_hl, level_br, level_hr, sk, numThreads, locwavCurve, locwavutili, loclevwavCurve, loclevwavutili, wavcurvelev, locconwavCurve, locconwavutili, wavcurvecon, sigma, maxlvl); @@ -11054,19 +11055,22 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o } if (exec) { + origlc = false; + LabImage *mergfile = origlc ? tmpres.get() : tmp1.get(); + #ifdef _OPENMP #pragma omp parallel for #endif for (int x = 0; x < bfh; x++) for (int y = 0; y < bfw; y++) { - tmp1->L[x][y] = CLIPLOC((1.f + mL0) * tmp1->L[x][y] - mL * tmpresid->L[x][y]); - tmp1->a[x][y] = CLIPC((1.f + mC0) * tmp1->a[x][y] - mC * tmpresid->a[x][y]); - tmp1->b[x][y] = CLIPC((1.f + mC0) * tmp1->b[x][y] - mC * tmpresid->b[x][y]); + tmp1->L[x][y] = CLIPLOC((1.f + mL0) * mergfile->L[x][y] - mL * tmpresid->L[x][y]); + tmp1->a[x][y] = CLIPC((1.f + mC0) * mergfile->a[x][y] - mC * tmpresid->a[x][y]); + tmp1->b[x][y] = CLIPC((1.f + mC0) * mergfile->b[x][y] - mC * tmpresid->b[x][y]); } if (softr > 0.f && fabs(mL) > 0.001f) { - softproc(tmpres.get(), tmp1.get(), softr, bfh, bfw, 0.0001, 0.00001, thr, sk, multiThread, flag); + softproc(mergfile, tmp1.get(), softr, bfh, bfw, 0.0001, 0.00001, thr, sk, multiThread, flag); } } } diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 9f8ffb470..ce4a001a0 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -888,6 +888,7 @@ enum ProcEventCode { EvlocallabwavCurvelev = 859, EvlocallabwavCurvecon = 860, Evlocallabsigma = 861, + Evlocallaboriglc = 862, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 20f2e8d04..59010f101 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2732,6 +2732,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : sensilc(19), fftwlc(false), blurlc(true), + origlc(false), localcontMethod("loc"), locwavcurve{(double)FCT_MinMaxCPoints, 0.0, 0.5, 0.35, 0.35, 1., 0.5, 0.35, 0.35}, csthreshold(0, 0, 5, 5, false), @@ -3121,6 +3122,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && sensilc == other.sensilc && fftwlc == other.fftwlc && blurlc == other.blurlc + && origlc == other.origlc && localcontMethod == other.localcontMethod && locwavcurve == other.locwavcurve && csthreshold == other.csthreshold @@ -4490,6 +4492,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensilc, "Locallab", "Sensilc_" + std::to_string(i), spot.sensilc, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).fftwlc, "Locallab", "Fftwlc_" + std::to_string(i), spot.fftwlc, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).blurlc, "Locallab", "Blurlc_" + std::to_string(i), spot.blurlc, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).origlc, "Locallab", "Origlc_" + std::to_string(i), spot.origlc, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).localcontMethod, "Locallab", "localcontMethod_" + std::to_string(i), spot.localcontMethod, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).locwavcurve, "Locallab", "LocwavCurve_" + std::to_string(i), spot.locwavcurve, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).loclevwavcurve, "Locallab", "LoclevwavCurve_" + std::to_string(i), spot.loclevwavcurve, keyFile); @@ -6008,6 +6011,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Sensilc_" + std::to_string(i), pedited, spot.sensilc, spotEdited.sensilc); assignFromKeyfile(keyFile, "Locallab", "Fftwlc_" + std::to_string(i), pedited, spot.fftwlc, spotEdited.fftwlc); assignFromKeyfile(keyFile, "Locallab", "Blurlc_" + std::to_string(i), pedited, spot.blurlc, spotEdited.blurlc); + assignFromKeyfile(keyFile, "Locallab", "Origlc_" + std::to_string(i), pedited, spot.origlc, spotEdited.origlc); assignFromKeyfile(keyFile, "Locallab", "localcontMethod_" + std::to_string(i), pedited, spot.localcontMethod, spotEdited.localcontMethod); assignFromKeyfile(keyFile, "Locallab", "LocwavCurve_" + std::to_string(i), pedited, spot.locwavcurve, spotEdited.locwavcurve); assignFromKeyfile(keyFile, "Locallab", "LoclevwavCurve_" + std::to_string(i), pedited, spot.loclevwavcurve, spotEdited.loclevwavcurve); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 872c48233..9aa48f42c 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1275,6 +1275,7 @@ struct LocallabParams { int sensilc; bool fftwlc; bool blurlc; + bool origlc; Glib::ustring localcontMethod; std::vector locwavcurve; Threshold csthreshold; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 4647d45bd..c40e67aa4 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -891,7 +891,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //Evlocallablevelblur LUMINANCECURVE, //EvlocallabwavCurvelev LUMINANCECURVE, //EvlocallabwavCurvecon - LUMINANCECURVE //Evlocallabsigma + LUMINANCECURVE, //Evlocallabsigma + LUMINANCECURVE // Evlocallaboriglc }; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 94856493b..7e29e8c6d 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -659,6 +659,7 @@ inverssha(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))), // Local contrast fftwlc(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_FFTW")))), blurlc(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_BLURLC")))), +origlc(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ORIGLC")))), //CBDL enacbMask(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ENABLE_MASK")))), //encoding log @@ -2780,6 +2781,7 @@ pe(nullptr) fftwlc->set_tooltip_text(M("TP_LOCALLAB_LC_FFTW_TOOLTIP")); } blurlcConn = blurlc->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::blurlcChanged)); + origlcConn = origlc->signal_toggled().connect(sigc::mem_fun(*this, &Locallab::origlcChanged)); csThreshold->setAdjusterListener(this); LocalcurveEditorwav->setCurveListener(this); @@ -2865,13 +2867,10 @@ pe(nullptr) ToolParamBlock* const clariBox = Gtk::manage(new ToolParamBlock()); clariBox->pack_start(*clarilres); -// if (complexsoft < 2) { clariBox->pack_start(*claricres); -// } -// if (complexsoft < 2) { clariBox->pack_start(*clarisoft); -// } +// clariBox->pack_start(*origlc); clariFrame->add(*clariBox); @@ -5071,6 +5070,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited pp->locallab.spots.at(pp->locallab.selspot).sensilc = sensilc->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).fftwlc = fftwlc->get_active(); pp->locallab.spots.at(pp->locallab.selspot).blurlc = blurlc->get_active(); + pp->locallab.spots.at(pp->locallab.selspot).origlc = origlc->get_active(); pp->locallab.spots.at(pp->locallab.selspot).locwavcurve = wavshape->getCurve(); pp->locallab.spots.at(pp->locallab.selspot).csthreshold = csThreshold->getValue(); pp->locallab.spots.at(pp->locallab.selspot).loclevwavcurve = wavshapelev->getCurve(); @@ -5463,6 +5463,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited pe->locallab.spots.at(pp->locallab.selspot).sensilc = pe->locallab.spots.at(pp->locallab.selspot).sensilc || sensilc->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).fftwlc = pe->locallab.spots.at(pp->locallab.selspot).fftwlc || !fftwlc->get_inconsistent(); pe->locallab.spots.at(pp->locallab.selspot).blurlc = pe->locallab.spots.at(pp->locallab.selspot).blurlc || !blurlc->get_inconsistent(); + pe->locallab.spots.at(pp->locallab.selspot).origlc = pe->locallab.spots.at(pp->locallab.selspot).origlc || !origlc->get_inconsistent(); pe->locallab.spots.at(pp->locallab.selspot).localcontMethod = pe->locallab.spots.at(pp->locallab.selspot).localcontMethod || localcontMethod->get_active_text() != M("GENERAL_UNCHANGED"); pe->locallab.spots.at(pp->locallab.selspot).locwavcurve = pe->locallab.spots.at(pp->locallab.selspot).locwavcurve || !wavshape->isUnChanged(); pe->locallab.spots.at(pp->locallab.selspot).loclevwavcurve = pe->locallab.spots.at(pp->locallab.selspot).loclevwavcurve || !wavshapelev->isUnChanged(); @@ -5852,6 +5853,7 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited pedited->locallab.spots.at(pp->locallab.selspot).sensilc = pedited->locallab.spots.at(pp->locallab.selspot).sensilc || sensilc->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).fftwlc = pedited->locallab.spots.at(pp->locallab.selspot).fftwlc || !fftwlc->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).blurlc = pedited->locallab.spots.at(pp->locallab.selspot).blurlc || !blurlc->get_inconsistent(); + pedited->locallab.spots.at(pp->locallab.selspot).origlc = pedited->locallab.spots.at(pp->locallab.selspot).origlc || !origlc->get_inconsistent(); pedited->locallab.spots.at(pp->locallab.selspot).locwavcurve = pedited->locallab.spots.at(pp->locallab.selspot).locwavcurve || !wavshape->isUnChanged(); pedited->locallab.spots.at(pp->locallab.selspot).loclevwavcurve = pedited->locallab.spots.at(pp->locallab.selspot).loclevwavcurve || !wavshapelev->isUnChanged(); pedited->locallab.spots.at(pp->locallab.selspot).csthreshold = pedited->locallab.spots.at(pp->locallab.selspot).csthreshold || csThreshold->getEditedState(); @@ -6374,6 +6376,7 @@ void Locallab::localcontMethodChanged() LocalcurveEditorwavcon->hide(); fftwlc->show(); blurlc->show(); + origlc->hide(); } else if (localcontMethod->get_active_row_number() == 1) { levelwav->show(); residcont->show(); @@ -6395,6 +6398,7 @@ void Locallab::localcontMethodChanged() LocalcurveEditorwavcon->hide(); fftwlc->hide(); blurlc->show(); + origlc->show(); } // printf("localcontMethodChanged\n"); @@ -7880,6 +7884,29 @@ void Locallab::blurlcChanged() } } +void Locallab::origlcChanged() +{ + + if (multiImage) { + if (origlc->get_inconsistent()) { + origlc->set_inconsistent(false); + origlcConn.block(true); + origlc->set_active(false); + origlcConn.block(false); + } + } + + if (getEnabled() && expcontrast->getEnabled()) { + if (listener) { + if (origlc->get_active()) { + listener->panelChanged(Evlocallaboriglc, M("GENERAL_ENABLED")); + } else { + listener->panelChanged(Evlocallaboriglc, M("GENERAL_DISABLED")); + } + } + } +} + void Locallab::fftwlcChanged() { @@ -10773,6 +10800,7 @@ void Locallab::enableListener() localcontMethodConn.block(false); fftwlcConn.block(false); blurlcConn.block(false); + origlcConn.block(false); // Contrast by detail levels enablecbdlConn.block(false); enacbMaskConn.block(false); @@ -10868,6 +10896,7 @@ void Locallab::disableListener() localcontMethodConn.block(true); fftwlcConn.block(true); blurlcConn.block(true); + origlcConn.block(true); // Contrast by detail levels enablecbdlConn.block(true); enacbMaskConn.block(true); @@ -11531,6 +11560,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con sensilc->setValue(pp->locallab.spots.at(index).sensilc); fftwlc->set_active(pp->locallab.spots.at(index).fftwlc); blurlc->set_active(pp->locallab.spots.at(index).blurlc); + origlc->set_active(pp->locallab.spots.at(index).origlc); csThreshold->setValue(pp->locallab.spots.at(index).csthreshold); if (pp->locallab.spots.at(index).localcontMethod == "loc") { @@ -12027,6 +12057,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con sensilc->setEditedState(spotState->sensilc ? Edited : UnEdited); fftwlc->set_inconsistent(multiImage && !spotState->fftwlc); blurlc->set_inconsistent(multiImage && !spotState->blurlc); + origlc->set_inconsistent(multiImage && !spotState->origlc); wavshape->setUnChanged(!spotState->locwavcurve); wavshapelev->setUnChanged(!spotState->loclevwavcurve); csThreshold->setEditedState(spotState->csthreshold ? Edited : UnEdited); @@ -12543,6 +12574,7 @@ void Locallab::updateSpecificGUIState() LocalcurveEditorwavcon->hide(); fftwlc->show(); blurlc->show(); + origlc->hide(); } else if (localcontMethod->get_active_row_number() == 1) { levelwav->show(); residcont->show(); @@ -12564,6 +12596,7 @@ void Locallab::updateSpecificGUIState() LocalcurveEditorwavcon->show(); fftwlc->hide(); blurlc->show(); + origlc->show(); } // Update Sharpening GUI according to inverssha button state (to be compliant with inversshaChanged function) diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 4f22c12bd..d35072b00 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -465,6 +465,8 @@ private: sigc::connection fftwlcConn; Gtk::CheckButton* const blurlc; sigc::connection blurlcConn; + Gtk::CheckButton* const origlc; + sigc::connection origlcConn; //CBDL Gtk::CheckButton* const enacbMask; @@ -665,6 +667,7 @@ private: // local contrast void fftwlcChanged(); void blurlcChanged(); + void origlcChanged(); //CBDL void enacbMaskChanged(); // ComboBox event functions diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 16c2aa169..bd791565b 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1268,6 +1268,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).sensilc = locallab.spots.at(j).sensilc && pSpot.sensilc == otherSpot.sensilc; locallab.spots.at(j).fftwlc = locallab.spots.at(j).fftwlc && pSpot.fftwlc == otherSpot.fftwlc; locallab.spots.at(j).blurlc = locallab.spots.at(j).blurlc && pSpot.blurlc == otherSpot.blurlc; + locallab.spots.at(j).origlc = locallab.spots.at(j).origlc && pSpot.origlc == otherSpot.origlc; locallab.spots.at(j).localcontMethod = locallab.spots.at(j).localcontMethod && pSpot.localcontMethod == otherSpot.localcontMethod; locallab.spots.at(j).locwavcurve = locallab.spots.at(j).locwavcurve && pSpot.locwavcurve == otherSpot.locwavcurve; locallab.spots.at(j).loclevwavcurve = locallab.spots.at(j).loclevwavcurve && pSpot.loclevwavcurve == otherSpot.loclevwavcurve; @@ -4029,6 +4030,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).blurlc = mods.locallab.spots.at(i).blurlc; } + if (locallab.spots.at(i).origlc) { + toEdit.locallab.spots.at(i).origlc = mods.locallab.spots.at(i).origlc; + } + if (locallab.spots.at(i).localcontMethod) { toEdit.locallab.spots.at(i).localcontMethod = mods.locallab.spots.at(i).localcontMethod; } @@ -5524,6 +5529,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : sensilc(v), fftwlc(v), blurlc(v), + origlc(v), localcontMethod(v), locwavcurve(v), loclevwavcurve(v), @@ -5903,6 +5909,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) sensilc = v; fftwlc = v; blurlc = v; + origlc = v; localcontMethod = v; locwavcurve = v; loclevwavcurve = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 0c89d6c5a..c09c9e1ca 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -701,6 +701,7 @@ public: bool sensilc; bool fftwlc; bool blurlc; + bool origlc; bool localcontMethod; bool locwavcurve; bool loclevwavcurve;