LA Log encoding clamp values

This commit is contained in:
Desmis 2020-10-28 16:38:17 +01:00
parent aae90a0ad3
commit ca5d6e44ee
4 changed files with 26 additions and 11 deletions

View File

@ -1553,6 +1553,7 @@ void Color::calcGamma (double pwr, double ts, GammaValues &gamma)
gamma[4] = g[4];
gamma[5] = g[5];
gamma[6] = 0.;
printf("g0=%f g1=%f g2=%f g3=%f g4=%f g5=%f\n", g[0], g[1], g[2], g[3], g[4], g[5] );
}
void Color::gammaf2lut (LUTf &gammacurve, float gamma, float start, float slope, float divisor, float factor)
{

View File

@ -1570,12 +1570,14 @@ void ImProcFunctions::log_encode(Imagefloat *rgb, struct local_params & lp, bool
// BENCHFUN
const float gray = lp.sourcegray / 100.f;
const float shadows_range = lp.blackev;
/*
if(lp.whiteev < 1.5f) {
lp.whiteev = 1.5f;
}
*/
float dynamic_range = lp.whiteev - lp.blackev;
if (dynamic_range < 1.f) {
dynamic_range = 1.f;
if (dynamic_range < 0.5f) {
dynamic_range = 0.5f;
}
const float noise = pow_F(2.f, -16.f);
const float log2 = xlogf(lp.baselog);
@ -1654,9 +1656,14 @@ void ImProcFunctions::log_encode(Imagefloat *rgb, struct local_params & lp, bool
if (m > noise) {
float mm = apply(m);
float f = mm / m;
f = min(f, 1000000.f);
r *= f;
b *= f;
g *= f;
r = CLIP(r);
g = CLIP(g);
b = CLIP(b);
}
assert(r == r);
@ -1710,13 +1717,18 @@ void ImProcFunctions::log_encode(Imagefloat *rgb, struct local_params & lp, bool
// float t2 = norm(r, g, b);
float f2 = apply(t2) / t2;
f = intp(blend, f, f2);
assert(std::isfinite(f));
f = min(f, 1000000.f);
// assert(std::isfinite(f));
r *= f;
g *= f;
b *= f;
assert(std::isfinite(r));
assert(std::isfinite(g));
assert(std::isfinite(b));
r = CLIP(r);
g = CLIP(g);
b = CLIP(b);
// assert(std::isfinite(r));
// assert(std::isfinite(g));
// assert(std::isfinite(b));
}
}
}

View File

@ -3611,6 +3611,7 @@ LocallabShadow::LocallabShadow():
blurSHde->setAdjusterListener(this);
gamSH->setAdjusterListener(this);
sloSH->setLogScale(16, 0);
sloSH->setAdjusterListener(this);

View File

@ -4655,13 +4655,13 @@ LocallabLog::LocallabLog():
autocompute(Gtk::manage(new Gtk::ToggleButton(M("TP_LOCALLAB_LOGAUTO")))),
logPFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LOGPFRA")))),
blackEv(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLACK_EV"), -16.0, 0.0, 0.1, -5.0))),
whiteEv(Gtk::manage(new Adjuster(M("TP_LOCALLAB_WHITE_EV"), 1.5, 32.0, 0.1, 10.0))),
whiteEv(Gtk::manage(new Adjuster(M("TP_LOCALLAB_WHITE_EV"), 0., 32.0, 0.1, 10.0))),
fullimage(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_FULLIMAGE")))),
Autogray(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_AUTOGRAY")))),
sourceGray(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOURCE_GRAY"), 1.0, 100.0, 0.1, 10.0))),
targetGray(Gtk::manage(new Adjuster(M("TP_LOCALLAB_TARGET_GRAY"), 5.0, 80.0, 0.1, 18.0))),
detail(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DETAIL"), 0., 1., 0.01, 0.6))),
baselog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BASELOG"), 1.4, 8., 0.05, 2., Gtk::manage(new RTImage("circle-black-small.png")), Gtk::manage(new RTImage("circle-white-small.png"))))),
baselog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BASELOG"), 1.3, 8., 0.05, 2., Gtk::manage(new RTImage("circle-black-small.png")), Gtk::manage(new RTImage("circle-white-small.png"))))),
sensilog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 60))),
strlog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADSTR"), -2.0, 2.0, 0.05, 0.))),
anglog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADANG"), -180, 180, 0.1, 0.)))
@ -4669,10 +4669,10 @@ LocallabLog::LocallabLog():
// Parameter Log encoding specific widgets
autoconn = autocompute->signal_toggled().connect(sigc::mem_fun(*this, &LocallabLog::autocomputeToggled));
// blackEv->setLogScale(2, -8);
blackEv->setLogScale(2, -8);
blackEv->setAdjusterListener(this);
// whiteEv->setLogScale(16, 0);
whiteEv->setLogScale(16, 0);
whiteEv->setAdjusterListener(this);
fullimageConn = fullimage->signal_toggled().connect(sigc::mem_fun(*this, &LocallabLog::fullimageChanged));
@ -4802,9 +4802,10 @@ void LocallabLog::read(const rtengine::procparams::ProcParams* pp, const ParamsE
blackEv->setValue(spot.blackEv);
whiteEv->setValue(spot.whiteEv);
if(whiteEv->getValue() < 1.5){
/* if(whiteEv->getValue() < 1.5){
whiteEv->setValue(1.5);
}
*/
fullimage->set_active(spot.fullimage);
Autogray->set_active(spot.Autogray);
sourceGray->setValue(spot.sourceGray);