Added a "gamma" slider to pyramid NR. Noise reduction is carried out with L channel mapped to that gamma. Default value is 2.0; lower values increase shadow smoothing, higher values smooth highlights more. Unfortunately adjusting this slider interacts with the other two, so all three have to be iteratively adjusted to achieve a desired result.
This commit is contained in:
@@ -24,92 +24,112 @@ using namespace rtengine;
|
||||
using namespace rtengine::procparams;
|
||||
|
||||
DirPyrDenoise::DirPyrDenoise () : ToolPanel () {
|
||||
|
||||
enabled = Gtk::manage (new Gtk::CheckButton (M("GENERAL_ENABLED")));
|
||||
enabled->set_active (false);
|
||||
enabled->show ();
|
||||
pack_start (*enabled);
|
||||
|
||||
Gtk::HSeparator *hsep1 = Gtk::manage (new Gtk::HSeparator());
|
||||
hsep1->show ();
|
||||
pack_start (*hsep1);
|
||||
|
||||
enaConn = enabled->signal_toggled().connect( sigc::mem_fun(*this, &DirPyrDenoise::enabledChanged) );
|
||||
|
||||
luma = Gtk::manage (new Adjuster (M("TP_DIRPYRDENOISE_LUMA"), 0, 100, 1, 10));
|
||||
chroma = Gtk::manage (new Adjuster (M("TP_DIRPYRDENOISE_CHROMA"), 0, 100, 1, 10));
|
||||
gamma = Gtk::manage (new Adjuster (M("TP_DIRPYRDENOISE_GAMMA"), 1.0, 3.0, 0.01, 0.10));
|
||||
|
||||
luma->setAdjusterListener (this);
|
||||
chroma->setAdjusterListener (this);
|
||||
gamma->setAdjusterListener (this);
|
||||
|
||||
luma->show();
|
||||
chroma->show();
|
||||
gamma->show();
|
||||
|
||||
pack_start (*luma);
|
||||
pack_start (*chroma);
|
||||
pack_start (*gamma);
|
||||
|
||||
enabled = Gtk::manage (new Gtk::CheckButton (M("GENERAL_ENABLED")));
|
||||
enabled->set_active (false);
|
||||
enabled->show ();
|
||||
pack_start (*enabled);
|
||||
|
||||
Gtk::HSeparator *hsep1 = Gtk::manage (new Gtk::HSeparator());
|
||||
hsep1->show ();
|
||||
pack_start (*hsep1);
|
||||
|
||||
enaConn = enabled->signal_toggled().connect( sigc::mem_fun(*this, &DirPyrDenoise::enabledChanged) );
|
||||
|
||||
luma = Gtk::manage (new Adjuster (M("TP_DIRPYRDENOISE_LUMA"), 0, 100, 1, 10));
|
||||
chroma = Gtk::manage (new Adjuster (M("TP_DIRPYRDENOISE_CHROMA"), 0, 100, 1, 10));
|
||||
luma->setAdjusterListener (this);
|
||||
chroma->setAdjusterListener (this);
|
||||
luma->show();
|
||||
chroma->show();
|
||||
|
||||
pack_start (*luma);
|
||||
pack_start (*chroma);
|
||||
}
|
||||
|
||||
void DirPyrDenoise::read (const ProcParams* pp, const ParamsEdited* pedited) {
|
||||
|
||||
|
||||
disableListener ();
|
||||
|
||||
|
||||
if (pedited) {
|
||||
luma->setEditedState (pedited->dirpyrDenoise.luma ? Edited : UnEdited);
|
||||
chroma->setEditedState (pedited->dirpyrDenoise.chroma ? Edited : UnEdited);
|
||||
gamma->setEditedState (pedited->dirpyrDenoise.gamma ? Edited : UnEdited);
|
||||
enabled->set_inconsistent (!pedited->dirpyrDenoise.enabled);
|
||||
}
|
||||
|
||||
|
||||
enaConn.block (true);
|
||||
enabled->set_active (pp->dirpyrDenoise.enabled);
|
||||
enaConn.block (false);
|
||||
|
||||
lastEnabled = pp->dirpyrDenoise.enabled;
|
||||
|
||||
|
||||
luma->setValue (pp->dirpyrDenoise.luma);
|
||||
chroma->setValue (pp->dirpyrDenoise.chroma);
|
||||
gamma->setValue (pp->dirpyrDenoise.gamma);
|
||||
|
||||
enableListener ();
|
||||
}
|
||||
|
||||
void DirPyrDenoise::write (ProcParams* pp, ParamsEdited* pedited) {
|
||||
|
||||
pp->dirpyrDenoise.luma = luma->getValue ();
|
||||
pp->dirpyrDenoise.chroma = chroma->getValue ();
|
||||
pp->dirpyrDenoise.enabled = enabled->get_active();
|
||||
|
||||
|
||||
pp->dirpyrDenoise.luma = luma->getValue ();
|
||||
pp->dirpyrDenoise.chroma = chroma->getValue ();
|
||||
pp->dirpyrDenoise.gamma = gamma->getValue ();
|
||||
pp->dirpyrDenoise.enabled = enabled->get_active();
|
||||
|
||||
if (pedited) {
|
||||
pedited->dirpyrDenoise.luma = luma->getEditedState ();
|
||||
pedited->dirpyrDenoise.chroma = chroma->getEditedState ();
|
||||
pedited->dirpyrDenoise.enabled = !enabled->get_inconsistent();
|
||||
pedited->dirpyrDenoise.gamma = gamma->getEditedState ();
|
||||
pedited->dirpyrDenoise.enabled = !enabled->get_inconsistent();
|
||||
}
|
||||
}
|
||||
|
||||
void DirPyrDenoise::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) {
|
||||
|
||||
|
||||
luma->setDefault (defParams->dirpyrDenoise.luma);
|
||||
chroma->setDefault (defParams->dirpyrDenoise.chroma);
|
||||
gamma->setDefault (defParams->dirpyrDenoise.chroma);
|
||||
|
||||
if (pedited) {
|
||||
luma->setDefaultEditedState (pedited->dirpyrDenoise.luma ? Edited : UnEdited);
|
||||
chroma->setDefaultEditedState (pedited->dirpyrDenoise.chroma ? Edited : UnEdited);
|
||||
}
|
||||
gamma->setDefaultEditedState (pedited->dirpyrDenoise.gamma ? Edited : UnEdited);
|
||||
}
|
||||
else {
|
||||
luma->setDefaultEditedState (Irrelevant);
|
||||
chroma->setDefaultEditedState (Irrelevant);
|
||||
gamma->setDefaultEditedState (Irrelevant);
|
||||
}
|
||||
}
|
||||
|
||||
void DirPyrDenoise::adjusterChanged (Adjuster* a, double newval) {
|
||||
|
||||
|
||||
if (listener && enabled->get_active()) {
|
||||
|
||||
if (a==luma)
|
||||
listener->panelChanged (EvDPDNLuma, Glib::ustring::format (std::setw(2), std::fixed, std::setprecision(1), a->getValue()));
|
||||
else if (a==chroma)
|
||||
if (a==luma) {
|
||||
listener->panelChanged (EvDPDNLuma, Glib::ustring::format ((int)a->getValue()));
|
||||
} else {
|
||||
if (a==chroma) {
|
||||
listener->panelChanged (EvDPDNChroma, Glib::ustring::format ((int)a->getValue()));
|
||||
}
|
||||
} else {
|
||||
if (a==gamma)
|
||||
listener->panelChanged (EvDPDNGamma, Glib::ustring::format (std::setw(2), std::fixed, std::setprecision(2), a->getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DirPyrDenoise::enabledChanged () {
|
||||
|
||||
|
||||
if (batchMode) {
|
||||
if (enabled->get_inconsistent()) {
|
||||
enabled->set_inconsistent (false);
|
||||
@@ -119,10 +139,10 @@ void DirPyrDenoise::enabledChanged () {
|
||||
}
|
||||
else if (lastEnabled)
|
||||
enabled->set_inconsistent (true);
|
||||
|
||||
|
||||
lastEnabled = enabled->get_active ();
|
||||
}
|
||||
|
||||
|
||||
if (listener) {
|
||||
if (enabled->get_active ())
|
||||
listener->panelChanged (EvDPDNEnabled, M("GENERAL_ENABLED"));
|
||||
@@ -132,18 +152,18 @@ void DirPyrDenoise::enabledChanged () {
|
||||
}
|
||||
|
||||
void DirPyrDenoise::setBatchMode (bool batchMode) {
|
||||
|
||||
|
||||
ToolPanel::setBatchMode (batchMode);
|
||||
luma->showEditedCB ();
|
||||
chroma->showEditedCB ();
|
||||
}
|
||||
|
||||
/*void DirPyrDenoise::setAdjusterBehavior (bool bedgetoladd) {
|
||||
|
||||
if (!edgetolAdd && bedgetoladd)
|
||||
edge->setLimits (-10000, 10000, 100, 0);
|
||||
else if (edgetolAdd && !bedgetoladd)
|
||||
edge->setLimits (10, 30000, 100, 1500);
|
||||
|
||||
edgetolAdd = bedgetoladd;
|
||||
}*/
|
||||
|
||||
if (!edgetolAdd && bedgetoladd)
|
||||
edge->setLimits (-10000, 10000, 100, 0);
|
||||
else if (edgetolAdd && !bedgetoladd)
|
||||
edge->setLimits (10, 30000, 100, 1500);
|
||||
|
||||
edgetolAdd = bedgetoladd;
|
||||
}*/
|
||||
|
@@ -28,6 +28,8 @@ class DirPyrDenoise : public Gtk::VBox, public AdjusterListener, public ToolPane
|
||||
protected:
|
||||
Adjuster* luma;
|
||||
Adjuster* chroma;
|
||||
Adjuster* gamma;
|
||||
|
||||
Gtk::CheckButton* enabled;
|
||||
bool lastEnabled;
|
||||
sigc::connection enaConn;
|
||||
|
@@ -73,7 +73,8 @@ void ParamsEdited::set (bool v) {
|
||||
dirpyrDenoise.enabled = v;
|
||||
dirpyrDenoise.luma = v;
|
||||
dirpyrDenoise.chroma = v;
|
||||
sh.enabled = v;
|
||||
dirpyrDenoise.gamma = v;
|
||||
sh.enabled = v;
|
||||
sh.hq = v;
|
||||
sh.highlights = v;
|
||||
sh.htonalwidth = v;
|
||||
@@ -192,7 +193,8 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
|
||||
dirpyrDenoise.enabled = dirpyrDenoise.enabled && p.dirpyrDenoise.enabled == other.dirpyrDenoise.enabled;
|
||||
dirpyrDenoise.luma = dirpyrDenoise.luma && p.dirpyrDenoise.luma == other.dirpyrDenoise.luma;
|
||||
dirpyrDenoise.chroma = dirpyrDenoise.chroma && p.dirpyrDenoise.chroma == other.dirpyrDenoise.chroma;
|
||||
|
||||
dirpyrDenoise.gamma = dirpyrDenoise.gamma && p.dirpyrDenoise.gamma == other.dirpyrDenoise.gamma;
|
||||
|
||||
sh.enabled = sh.enabled && p.sh.enabled == other.sh.enabled;
|
||||
sh.hq = sh.hq && p.sh.hq == other.sh.hq;
|
||||
sh.highlights = sh.highlights && p.sh.highlights == other.sh.highlights;
|
||||
@@ -302,7 +304,8 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
|
||||
if (dirpyrDenoise.enabled) toEdit.dirpyrDenoise.enabled = mods.dirpyrDenoise.enabled;
|
||||
if (dirpyrDenoise.luma) toEdit.dirpyrDenoise.luma = mods.dirpyrDenoise.luma;
|
||||
if (dirpyrDenoise.chroma) toEdit.dirpyrDenoise.chroma = mods.dirpyrDenoise.chroma;
|
||||
|
||||
if (dirpyrDenoise.gamma) toEdit.dirpyrDenoise.gamma = mods.dirpyrDenoise.gamma;
|
||||
|
||||
if (sh.enabled) toEdit.sh.enabled = mods.sh.enabled;
|
||||
if (sh.hq) toEdit.sh.hq = mods.sh.hq;
|
||||
if (sh.highlights) toEdit.sh.highlights = options.baBehav[ADDSET_SH_HIGHLIGHTS] ? toEdit.sh.highlights + mods.sh.highlights : mods.sh.highlights;
|
||||
|
@@ -119,6 +119,7 @@ public:
|
||||
bool enabled;
|
||||
bool luma;
|
||||
bool chroma;
|
||||
bool gamma;
|
||||
};
|
||||
|
||||
class SHParamsEdited {
|
||||
|
Reference in New Issue
Block a user