diff --git a/rtdata/languages/default b/rtdata/languages/default index c0f914499..d5f49221e 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -921,7 +921,7 @@ HISTORY_MSG_673;Local - Use cbdl mask HISTORY_MSG_675;Local - TM soft radius HISTORY_MSG_676;Local Spot transition-differentiation HISTORY_MSG_677;Local - TM amount - +HISTORY_MSG_678;Local - TM saturation HISTORY_MSG_CLAMPOOG;Clip out-of-gamut colors HISTORY_MSG_COLORTONING_LABGRID_VALUE;CT - Color correction HISTORY_MSG_COLORTONING_LABREGION_AB;CT - Color correction @@ -2020,6 +2020,7 @@ TP_LOCALLAB_EXCLUF;Excluding TP_LOCALLAB_EXCLUF_TOOLTIP;Can be used to exclude this part of datas - move Scope to extend color.\n You can apply all settings to this RT-spot. TP_LOCALLAB_LABGRID_VALUES;High(a)=%1 High(b)=%2\nLow(a)=%3 Low(b)=%4 TP_LOCALLAB_LABGRID;Color correction grid +TP_LOCALLAB_SATUR;Saturation TP_LOCALLAB_SENSIDEN;Scope TP_LOCALLAB_SENSIEXCLU;Scope TP_LOCALLAB_SENSIEXCLU_TOOLTIP;Adjust color to include in exclusion! diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index d8effc87c..88cde10cd 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -5292,6 +5292,7 @@ void ImProcFunctions::EPDToneMaplocal(int sp, LabImage *lab, LabImage *tmp1, uns float edgest = ((float)params->locallab.spots.at(sp).estop) / 100.f; float sca = ((float)params->locallab.spots.at(sp).scaltm) / 10.f; float gamm = ((float)params->locallab.spots.at(sp).gamma) / 100.f; + float satur = ((float)params->locallab.spots.at(sp).satur) / 100.f; float rew = ((float)params->locallab.spots.at(sp).rewei); //Pointers to whole data and size of it. float *L = lab->L[0]; @@ -5374,6 +5375,10 @@ void ImProcFunctions::EPDToneMaplocal(int sp, LabImage *lab, LabImage *tmp1, uns //Restore past range, also desaturate a bit per Mantiuk's Color correction for tone mapping. float s = (1.0f + 38.7889f) * powf(Compression, 1.5856f) / (1.0f + 38.7889f * powf(Compression, 1.5856f)); + float ss = (1.f / s) - 1.f; + float sat = 1.f + (2.5f * satur) * ss; +// printf("s=%f ss=%f sat=%f \n", s, ss, sat); + if(sat == 1.f) sat = 1.001f; #ifdef _OPENMP #pragma omp parallel for // removed schedule(dynamic,10) #endif @@ -5383,8 +5388,8 @@ void ImProcFunctions::EPDToneMaplocal(int sp, LabImage *lab, LabImage *tmp1, uns int y = i - x * WW; tmp1->L[x][y] = L[i] * maxL * (1.f / gamm) + minL; - tmp1->a[x][y] = s * a[i]; - tmp1->b[x][y] = s * b[i]; + tmp1->a[x][y] = sat * a[i]; + tmp1->b[x][y] = sat * b[i]; } } diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 93fa6f472..dc5c1543f 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -1621,7 +1621,9 @@ void ImProcFunctions::InverseReti_Local(const struct local_params & lp, const fl } } } + } + delete origblur; } @@ -1734,6 +1736,7 @@ void ImProcFunctions::InverseBlurNoise_Local(const struct local_params & lp, co } } } + delete origblur; } static void calclight(float lum, float koef, float &lumnew, const LUTf &lightCurveloc) @@ -5542,6 +5545,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o bufgb->L[y - ystart][x - xstart] = original->L[y][x]; bufgb->a[y - ystart][x - xstart] = original->a[y][x]; bufgb->b[y - ystart][x - xstart] = original->b[y][x]; + tmp1->L[y - ystart][x - xstart] = original->L[y][x]; tmp1->a[y - ystart][x - xstart] = original->a[y][x]; tmp1->b[y - ystart][x - xstart] = original->b[y][x]; } @@ -5553,7 +5557,7 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o localContrastParams.amount = params->locallab.spots.at(sp).lcamount; localContrastParams.darkness = params->locallab.spots.at(sp).lcdarkness; localContrastParams.lightness = params->locallab.spots.at(sp).lightness; - ImProcFunctions::localContrast(bufgb.get(), tmp1->L, localContrastParams, sk); + ImProcFunctions::localContrast(tmp1.get(), tmp1->L, localContrastParams, sk); float minL = tmp1->L[0][0] - bufgb->L[0][0]; float maxL = minL; diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 101fd5fe5..f1fe9eaa5 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -704,6 +704,7 @@ enum ProcEventCode { Evlocallabsoftradiustm = 674, EvLocallabSpotTransitgrad = 675, Evlocallabamount = 676, + Evlocallabsatur = 677, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 370b13dbe..b29f5e500 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2462,6 +2462,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : estop(140), scaltm(10), rewei(0), + satur(20), sensitm(19), softradiustm(0.0), amount(95), @@ -2660,6 +2661,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && estop == other.estop && scaltm == other.scaltm && rewei == other.rewei + && satur == other.satur && sensitm == other.sensitm && softradiustm == other.softradiustm && amount == other.amount @@ -3814,6 +3816,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.spots.at(i).estop, "Locallab", "Estop_" + std::to_string(i), spot.estop, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).scaltm, "Locallab", "Scaltm_" + std::to_string(i), spot.scaltm, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).rewei, "Locallab", "Rewei_" + std::to_string(i), spot.rewei, keyFile); + saveToKeyfile(!pedited || pedited->locallab.spots.at(i).satur, "Locallab", "Satur_" + std::to_string(i), spot.satur, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).sensitm, "Locallab", "Sensitm_" + std::to_string(i), spot.sensitm, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).softradiustm, "Locallab", "Softradiustm_" + std::to_string(i), spot.softradiustm, keyFile); saveToKeyfile(!pedited || pedited->locallab.spots.at(i).amount, "Locallab", "Amount_" + std::to_string(i), spot.amount, keyFile); @@ -5109,6 +5112,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Estop_" + std::to_string(i), pedited, spot.estop, spotEdited.estop); assignFromKeyfile(keyFile, "Locallab", "Scaltm_" + std::to_string(i), pedited, spot.scaltm, spotEdited.scaltm); assignFromKeyfile(keyFile, "Locallab", "Rewei_" + std::to_string(i), pedited, spot.rewei, spotEdited.rewei); + assignFromKeyfile(keyFile, "Locallab", "Satur_" + std::to_string(i), pedited, spot.satur, spotEdited.satur); assignFromKeyfile(keyFile, "Locallab", "Sensitm_" + std::to_string(i), pedited, spot.sensitm, spotEdited.sensitm); assignFromKeyfile(keyFile, "Locallab", "Softradiustm_" + std::to_string(i), pedited, spot.softradiustm, spotEdited.softradiustm); assignFromKeyfile(keyFile, "Locallab", "Amount_" + std::to_string(i), pedited, spot.amount, spotEdited.amount); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index bcd181d63..77ae01ca0 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1063,6 +1063,7 @@ struct LocallabParams { int estop; int scaltm; int rewei; + int satur; int sensitm; double softradiustm; int amount; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index df9e37748..f81527cf0 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -703,7 +703,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, //EvlocallabshowmaskcbMethod LUMINANCECURVE, //Evlocallabsoftradiustm LUMINANCECURVE, // EvLocallabSpotTransitgrad - LUMINANCECURVE // Evlocallabamount + LUMINANCECURVE, // Evlocallabamount + LUMINANCECURVE // Evlocallabsatur }; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 94c5c5f77..5bae2b852 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -145,6 +145,7 @@ Locallab::Locallab(): sensitm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 15))), softradiustm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), 0.0, 100.0, 0.1, 0.))), amount(Gtk::manage(new Adjuster(M("TP_LOCALLAB_AMOUNT"), 50, 100, 1, 95))), + satur(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SATUR"), -100, 100, 1, 20))), // Retinex str(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STR"), 0, 100, 1, 0))), chrrt(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHRRT"), 0, 100, 1, 0))), @@ -769,6 +770,7 @@ Locallab::Locallab(): rewei->setAdjusterListener(this); amount->setAdjusterListener(this); + satur->setAdjusterListener(this); if(showtooltip) sensitm->set_tooltip_text(M("TP_LOCALLAB_SENSI_TOOLTIP")); sensitm->setAdjusterListener(this); @@ -778,6 +780,7 @@ Locallab::Locallab(): tmBox->pack_start(*amount); tmBox->pack_start(*stren); tmBox->pack_start(*gamma); + tmBox->pack_start(*satur); tmBox->pack_start(*estop); tmBox->pack_start(*scaltm); tmBox->pack_start(*rewei); @@ -2001,6 +2004,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.spots.at(pp->locallab.selspot).estop = estop->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).scaltm = scaltm->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).rewei = rewei->getIntValue(); + pp->locallab.spots.at(pp->locallab.selspot).satur = satur->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).sensitm = sensitm->getIntValue(); pp->locallab.spots.at(pp->locallab.selspot).softradiustm = softradiustm->getValue(); pp->locallab.spots.at(pp->locallab.selspot).amount = amount->getIntValue(); @@ -2209,6 +2213,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pe->locallab.spots.at(pp->locallab.selspot).estop = pe->locallab.spots.at(pp->locallab.selspot).estop || estop->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).scaltm = pe->locallab.spots.at(pp->locallab.selspot).scaltm || scaltm->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).rewei = pe->locallab.spots.at(pp->locallab.selspot).rewei || rewei->getEditedState(); + pe->locallab.spots.at(pp->locallab.selspot).satur = pe->locallab.spots.at(pp->locallab.selspot).satur || satur->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).sensitm = pe->locallab.spots.at(pp->locallab.selspot).sensitm || sensitm->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).softradiustm = pe->locallab.spots.at(pp->locallab.selspot).softradiustm || softradiustm->getEditedState(); pe->locallab.spots.at(pp->locallab.selspot).amount = pe->locallab.spots.at(pp->locallab.selspot).amount || amount->getEditedState(); @@ -2411,6 +2416,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.spots.at(pp->locallab.selspot).estop = pedited->locallab.spots.at(pp->locallab.selspot).estop || estop->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).scaltm = pedited->locallab.spots.at(pp->locallab.selspot).scaltm || scaltm->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).rewei = pedited->locallab.spots.at(pp->locallab.selspot).rewei || rewei->getEditedState(); + pedited->locallab.spots.at(pp->locallab.selspot).satur = pedited->locallab.spots.at(pp->locallab.selspot).satur || satur->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).sensitm = pedited->locallab.spots.at(pp->locallab.selspot).sensitm || sensitm->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).softradiustm = pedited->locallab.spots.at(pp->locallab.selspot).softradiustm || softradiustm->getEditedState(); pedited->locallab.spots.at(pp->locallab.selspot).amount = pedited->locallab.spots.at(pp->locallab.selspot).amount || amount->getEditedState(); @@ -3375,6 +3381,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe estop->setDefault((double)defSpot->estop); scaltm->setDefault((double)defSpot->scaltm); rewei->setDefault((double)defSpot->rewei); + satur->setDefault((double)defSpot->satur); sensitm->setDefault((double)defSpot->sensitm); softradiustm->setDefault(defSpot->softradiustm); amount->setDefault((double)defSpot->amount); @@ -3497,6 +3504,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe estop->setDefaultEditedState(Irrelevant); scaltm->setDefaultEditedState(Irrelevant); rewei->setDefaultEditedState(Irrelevant); + satur->setDefaultEditedState(Irrelevant); sensitm->setDefaultEditedState(Irrelevant); softradiustm->setDefaultEditedState(Irrelevant); amount->setDefaultEditedState(Irrelevant); @@ -3623,6 +3631,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe estop->setDefaultEditedState(defSpotState->estop ? Edited : UnEdited); scaltm->setDefaultEditedState(defSpotState->scaltm ? Edited : UnEdited); rewei->setDefaultEditedState(defSpotState->rewei ? Edited : UnEdited); + satur->setDefaultEditedState(defSpotState->satur ? Edited : UnEdited); sensitm->setDefaultEditedState(defSpotState->sensitm ? Edited : UnEdited); softradiustm->setDefaultEditedState(defSpotState->softradiustm ? Edited : UnEdited); amount->setDefaultEditedState(defSpotState->amount ? Edited : UnEdited); @@ -4101,6 +4110,12 @@ void Locallab::adjusterChanged(Adjuster * a, double newval) } } + if (a == satur) { + if (listener) { + listener->panelChanged(Evlocallabsatur, satur->getTextValue()); + } + } + } // Retinex @@ -4486,6 +4501,7 @@ void Locallab::setBatchMode(bool batchMode) estop->showEditedCB(); scaltm->showEditedCB(); rewei->showEditedCB(); + satur->showEditedCB(); sensitm->showEditedCB(); softradiustm->showEditedCB(); amount->showEditedCB(); @@ -4918,6 +4934,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con estop->setValue(pp->locallab.spots.at(index).estop); scaltm->setValue(pp->locallab.spots.at(index).scaltm); rewei->setValue(pp->locallab.spots.at(index).rewei); + satur->setValue(pp->locallab.spots.at(index).satur); sensitm->setValue(pp->locallab.spots.at(index).sensitm); softradiustm->setValue(pp->locallab.spots.at(index).softradiustm); amount->setValue(pp->locallab.spots.at(index).amount); @@ -5156,6 +5173,7 @@ void Locallab::updateLocallabGUI(const rtengine::procparams::ProcParams* pp, con estop->setEditedState(spotState->estop ? Edited : UnEdited); scaltm->setEditedState(spotState->scaltm ? Edited : UnEdited); rewei->setEditedState(spotState->rewei ? Edited : UnEdited); + satur->setEditedState(spotState->satur ? Edited : UnEdited); sensitm->setEditedState(spotState->sensitm ? Edited : UnEdited); softradiustm->setEditedState(spotState->softradiustm ? Edited : UnEdited); amount->setEditedState(spotState->amount ? Edited : UnEdited); diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 56d1266e9..dd80c5f2b 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -167,6 +167,7 @@ private: Adjuster* const sensitm; Adjuster* const softradiustm; Adjuster* const amount; + Adjuster* const satur; // Retinex Adjuster* const str; Adjuster* const chrrt; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 9dc5b8ddc..a3b89179e 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1052,6 +1052,7 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).estop = locallab.spots.at(j).estop && pSpot.estop == otherSpot.estop; locallab.spots.at(j).scaltm = locallab.spots.at(j).scaltm && pSpot.scaltm == otherSpot.scaltm; locallab.spots.at(j).rewei = locallab.spots.at(j).rewei && pSpot.rewei == otherSpot.rewei; + locallab.spots.at(j).satur = locallab.spots.at(j).satur && pSpot.satur == otherSpot.satur; locallab.spots.at(j).sensitm = locallab.spots.at(j).sensitm && pSpot.sensitm == otherSpot.sensitm; locallab.spots.at(j).softradiustm = locallab.spots.at(j).softradiustm && pSpot.softradiustm == otherSpot.softradiustm; locallab.spots.at(j).amount = locallab.spots.at(j).amount && pSpot.amount == otherSpot.amount; @@ -3022,6 +3023,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).rewei = mods.locallab.spots.at(i).rewei; } + if (locallab.spots.at(i).satur) { + toEdit.locallab.spots.at(i).satur = mods.locallab.spots.at(i).satur; + } + if (locallab.spots.at(i).sensitm) { toEdit.locallab.spots.at(i).sensitm = mods.locallab.spots.at(i).sensitm; } @@ -4335,6 +4340,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : estop(v), scaltm(v), rewei(v), + satur(v), sensitm(v), softradiustm(v), amount(v), @@ -4530,6 +4536,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) estop = v; scaltm = v; rewei = v; + satur = v; sensitm = v; softradiustm = v; amount = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 85f38302c..de59da427 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -479,6 +479,7 @@ public: bool estop; bool scaltm; bool rewei; + bool satur; bool sensitm; bool softradiustm; bool amount;