Merge Locallab tool "Denoise" into Locallab tool "Blur & Noise"
This commit is contained in:
@@ -25,9 +25,6 @@
|
||||
#include "locallab.h"
|
||||
#include "rtimage.h"
|
||||
|
||||
#define MINCHRO 0.
|
||||
#define MAXCHRO 150.
|
||||
#define MAXCHROCC 100.
|
||||
#define MINNEIGH 0.1
|
||||
#define MAXNEIGH 1500
|
||||
#define CENTERNEIGH 200
|
||||
@@ -4135,319 +4132,6 @@ void LocallabCBDL::lumacontrastPlusPressed()
|
||||
adjusterChanged(multiplier[0], multiplier[0]->getValue()); // Value isn't used
|
||||
}
|
||||
|
||||
/* ==== LocallabDenoise ==== */
|
||||
LocallabDenoise::LocallabDenoise():
|
||||
LocallabTool(this, M("TP_LOCALLAB_DEN_TOOLNAME"), M("TP_LOCALLAB_DENOIS"), true),
|
||||
|
||||
// Denoise specific widgets
|
||||
LocalcurveEditorwavden(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_WAVDEN"))),
|
||||
wavshapeden(static_cast<FlatCurveEditor*>(LocalcurveEditorwavden->addCurve(CT_Flat, "", nullptr, false, false))),
|
||||
noiselumf0(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMFINEZERO"), MINCHRO, MAXCHRO, 0.01, 0.))),
|
||||
noiselumf(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMFINE"), MINCHRO, MAXCHRO, 0.01, 0.))),
|
||||
noiselumf2(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMFINETWO"), MINCHRO, MAXCHRO, 0.01, 0.))),
|
||||
noiselumc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMCOARSE"), MINCHRO, MAXCHROCC, 0.01, 0.))),
|
||||
noiselumdetail(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMDETAIL"), 0., 100., 0.01, 0.))),
|
||||
noiselequal(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELEQUAL"), -2, 10, 1, 7, Gtk::manage(new RTImage("circle-white-small.png")), Gtk::manage(new RTImage("circle-black-small.png"))))),
|
||||
noisechrof(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISECHROFINE"), MINCHRO, MAXCHRO, 0.01, 0.))),
|
||||
noisechroc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISECHROCOARSE"), MINCHRO, MAXCHROCC, 0.01, 0.))),
|
||||
noisechrodetail(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISECHRODETAIL"), 0., 100., 0.01, 0.))),
|
||||
detailthr(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DETAILTHR"), 0, 100, 1, 0))),
|
||||
adjblur(Gtk::manage(new Adjuster(M("TP_LOCALLAB_ADJ"), -100., 100., 1., 0., Gtk::manage(new RTImage("circle-blue-small.png")), Gtk::manage(new RTImage("circle-red-small.png"))))),
|
||||
bilateral(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BILATERAL"), 0, 100, 1, 0))),
|
||||
sensiden(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSIDEN"), 0, 100, 1, 20)))
|
||||
{
|
||||
const bool showtooltip = options.showtooltip;
|
||||
|
||||
const LocallabParams::LocallabSpot defSpot;
|
||||
|
||||
// Parameter Denoise specific widgets
|
||||
if (showtooltip) {
|
||||
exp->set_tooltip_markup(M("TP_LOCALLAB_DENOI_TOOLTIP"));
|
||||
}
|
||||
|
||||
LocalcurveEditorwavden->setCurveListener(this);
|
||||
|
||||
wavshapeden->setIdentityValue(0.);
|
||||
wavshapeden->setResetCurve(FlatCurveType(defSpot.locwavcurveden.at(0)), defSpot.locwavcurveden);
|
||||
|
||||
if (showtooltip) {
|
||||
wavshapeden->setTooltip(M("TP_LOCALLAB_WASDEN_TOOLTIP"));
|
||||
}
|
||||
|
||||
LocalcurveEditorwavden->curveListComplete();
|
||||
|
||||
noiselumf0->setAdjusterListener(this);
|
||||
|
||||
noiselumf->setAdjusterListener(this);
|
||||
|
||||
noiselumf2->setAdjusterListener(this);
|
||||
|
||||
if (showtooltip) {
|
||||
noiselumc->set_tooltip_text(M("TP_LOCALLAB_NOISECHROC_TOOLTIP"));
|
||||
}
|
||||
|
||||
noiselumc->setAdjusterListener(this);
|
||||
|
||||
noiselumdetail->setAdjusterListener(this);
|
||||
|
||||
noiselequal->setAdjusterListener(this);
|
||||
|
||||
noisechrof->setAdjusterListener(this);
|
||||
|
||||
if (showtooltip) {
|
||||
noisechroc->set_tooltip_text(M("TP_LOCALLAB_NOISECHROC_TOOLTIP"));
|
||||
}
|
||||
|
||||
noisechroc->setAdjusterListener(this);
|
||||
|
||||
noisechrodetail->setAdjusterListener(this);
|
||||
|
||||
detailthr->setAdjusterListener(this);
|
||||
|
||||
adjblur->setAdjusterListener(this);
|
||||
|
||||
bilateral->setAdjusterListener(this);
|
||||
|
||||
sensiden->setAdjusterListener(this);
|
||||
|
||||
// Add Denoise specific widgets to GUI
|
||||
Gtk::Frame* const wavFrame = Gtk::manage(new Gtk::Frame());
|
||||
ToolParamBlock* const wavBox = Gtk::manage(new ToolParamBlock());
|
||||
wavBox->pack_start(*LocalcurveEditorwavden, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor
|
||||
// wavBox->pack_start(*noiselumf0);
|
||||
// wavBox->pack_start(*noiselumf);
|
||||
// wavBox->pack_start(*noiselumf2);
|
||||
// wavBox->pack_start(*noiselumc);
|
||||
wavBox->pack_start(*noiselumdetail);
|
||||
wavBox->pack_start(*noiselequal);
|
||||
wavBox->pack_start(*noisechrof);
|
||||
wavBox->pack_start(*noisechroc);
|
||||
wavBox->pack_start(*noisechrodetail);
|
||||
wavBox->pack_start(*detailthr);
|
||||
wavBox->pack_start(*adjblur);
|
||||
wavFrame->add(*wavBox);
|
||||
pack_start(*wavFrame);
|
||||
pack_start(*bilateral);
|
||||
pack_start(*sensiden);
|
||||
}
|
||||
|
||||
LocallabDenoise::~LocallabDenoise()
|
||||
{
|
||||
delete LocalcurveEditorwavden;
|
||||
}
|
||||
|
||||
void LocallabDenoise::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited)
|
||||
{
|
||||
// Disable all listeners
|
||||
disableListener();
|
||||
|
||||
// Update GUI to selected spot value
|
||||
const int index = pp->locallab.selspot;
|
||||
|
||||
if (index < (int)pp->locallab.spots.size()) {
|
||||
spotName = pp->locallab.spots.at(index).name; // Update spot name according to selected spot
|
||||
|
||||
exp->set_visible(pp->locallab.spots.at(index).visidenoi);
|
||||
exp->setEnabled(pp->locallab.spots.at(index).expdenoi);
|
||||
|
||||
wavshapeden->setCurve(pp->locallab.spots.at(index).locwavcurveden);
|
||||
noiselumf0->setValue(pp->locallab.spots.at(index).noiselumf0);
|
||||
noiselumf->setValue(pp->locallab.spots.at(index).noiselumf);
|
||||
noiselumf2->setValue(pp->locallab.spots.at(index).noiselumf2);
|
||||
noiselumc->setValue(pp->locallab.spots.at(index).noiselumc);
|
||||
noiselumdetail->setValue(pp->locallab.spots.at(index).noiselumdetail);
|
||||
noiselequal->setValue((double)pp->locallab.spots.at(index).noiselequal);
|
||||
noisechrof->setValue(pp->locallab.spots.at(index).noisechrof);
|
||||
noisechroc->setValue(pp->locallab.spots.at(index).noisechroc);
|
||||
noisechrodetail->setValue(pp->locallab.spots.at(index).noisechrodetail);
|
||||
detailthr->setValue((double)pp->locallab.spots.at(index).detailthr);
|
||||
adjblur->setValue((double)pp->locallab.spots.at(index).adjblur);
|
||||
bilateral->setValue((double)pp->locallab.spots.at(index).bilateral);
|
||||
sensiden->setValue((double)pp->locallab.spots.at(index).sensiden);
|
||||
}
|
||||
|
||||
// Enable all listeners
|
||||
enableListener();
|
||||
|
||||
// Note: No need to manage pedited as batch mode is deactivated for Locallab
|
||||
}
|
||||
|
||||
void LocallabDenoise::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited)
|
||||
{
|
||||
const int index = pp->locallab.selspot;
|
||||
|
||||
if (index < (int)pp->locallab.spots.size()) {
|
||||
pp->locallab.spots.at(index).expdenoi = exp->getEnabled();
|
||||
pp->locallab.spots.at(index).visidenoi = exp->get_visible();
|
||||
|
||||
pp->locallab.spots.at(index).locwavcurveden = wavshapeden->getCurve();
|
||||
pp->locallab.spots.at(index).noiselumf0 = noiselumf0->getValue();
|
||||
pp->locallab.spots.at(index).noiselumf = noiselumf->getValue();
|
||||
pp->locallab.spots.at(index).noiselumf2 = noiselumf2->getValue();
|
||||
pp->locallab.spots.at(index).noiselumc = noiselumc->getValue();
|
||||
pp->locallab.spots.at(index).noiselumdetail = noiselumdetail->getValue();
|
||||
pp->locallab.spots.at(index).noiselequal = noiselequal->getIntValue();
|
||||
pp->locallab.spots.at(index).noisechrof = noisechrof->getValue();
|
||||
pp->locallab.spots.at(index).noisechroc = noisechroc->getValue();
|
||||
pp->locallab.spots.at(index).noisechrodetail = noisechrodetail->getValue();
|
||||
pp->locallab.spots.at(index).detailthr = detailthr->getIntValue();
|
||||
pp->locallab.spots.at(index).adjblur = adjblur->getIntValue();
|
||||
pp->locallab.spots.at(index).bilateral = bilateral->getIntValue();
|
||||
pp->locallab.spots.at(index).sensiden = sensiden->getIntValue();
|
||||
}
|
||||
|
||||
// Note: No need to manage pedited as batch mode is deactivated for Locallab
|
||||
}
|
||||
|
||||
void LocallabDenoise::setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited)
|
||||
{
|
||||
const int index = defParams->locallab.selspot;
|
||||
|
||||
if (index < (int)defParams->locallab.spots.size()) {
|
||||
const LocallabParams::LocallabSpot defSpot = defParams->locallab.spots.at(index);
|
||||
|
||||
// Set default values for adjuster widgets
|
||||
noiselumf0->setDefault(defSpot.noiselumf0);
|
||||
noiselumf->setDefault(defSpot.noiselumf);
|
||||
noiselumf2->setDefault(defSpot.noiselumf2);
|
||||
noiselumc->setDefault(defSpot.noiselumc);
|
||||
noiselumdetail->setDefault(defSpot.noiselumdetail);
|
||||
noiselequal->setDefault((double)defSpot.noiselequal);
|
||||
noisechrof->setDefault(defSpot.noisechrof);
|
||||
noisechroc->setDefault(defSpot.noisechroc);
|
||||
noisechrodetail->setDefault(defSpot.noisechrodetail);
|
||||
detailthr->setDefault((double)defSpot.detailthr);
|
||||
adjblur->setDefault((double)defSpot.adjblur);
|
||||
bilateral->setDefault((double)defSpot.bilateral);
|
||||
sensiden->setDefault((double)defSpot.sensiden);
|
||||
}
|
||||
|
||||
// Note: No need to manage pedited as batch mode is deactivated for Locallab
|
||||
}
|
||||
|
||||
void LocallabDenoise::adjusterChanged(Adjuster* a, double newval)
|
||||
{
|
||||
if (isLocActivated && exp->getEnabled()) {
|
||||
if (a == noiselumf0) {
|
||||
if (listener) {
|
||||
listener->panelChanged(Evlocallabnoiselumf0,
|
||||
noiselumf0->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
if (a == noiselumf) {
|
||||
if (listener) {
|
||||
listener->panelChanged(Evlocallabnoiselumf,
|
||||
noiselumf->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
if (a == noiselumf2) {
|
||||
if (listener) {
|
||||
listener->panelChanged(Evlocallabnoiselumf2,
|
||||
noiselumf2->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
if (a == noiselumc) {
|
||||
if (listener) {
|
||||
listener->panelChanged(Evlocallabnoiselumc,
|
||||
noiselumc->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
if (a == noiselumdetail) {
|
||||
if (listener) {
|
||||
listener->panelChanged(Evlocallabnoiselumdetail,
|
||||
noiselumdetail->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
if (a == noiselequal) {
|
||||
if (listener) {
|
||||
listener->panelChanged(Evlocallabnoiselequal,
|
||||
noiselequal->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
if (a == noisechrof) {
|
||||
if (listener) {
|
||||
listener->panelChanged(Evlocallabnoisechrof,
|
||||
noisechrof->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
if (a == noisechroc) {
|
||||
if (listener) {
|
||||
listener->panelChanged(Evlocallabnoisechroc,
|
||||
noisechroc->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
if (a == noisechrodetail) {
|
||||
if (listener) {
|
||||
listener->panelChanged(Evlocallabnoisechrodetail,
|
||||
noisechrodetail->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
if (a == detailthr) {
|
||||
if (listener) {
|
||||
listener->panelChanged(Evlocallabdetailthr,
|
||||
detailthr->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
if (a == adjblur) {
|
||||
if (listener) {
|
||||
listener->panelChanged(Evlocallabadjblur,
|
||||
adjblur->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
if (a == bilateral) {
|
||||
if (listener) {
|
||||
listener->panelChanged(Evlocallabbilateral,
|
||||
bilateral->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
if (a == sensiden) {
|
||||
if (listener) {
|
||||
listener->panelChanged(Evlocallabsensiden,
|
||||
sensiden->getTextValue() + " (" + escapeHtmlChars(spotName) + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LocallabDenoise::curveChanged(CurveEditor* ce)
|
||||
{
|
||||
if (isLocActivated && exp->getEnabled()) {
|
||||
if (ce == wavshapeden) {
|
||||
if (listener) {
|
||||
listener->panelChanged(EvlocallabwavCurveden,
|
||||
M("HISTORY_CUSTOMCURVE") + " (" + escapeHtmlChars(spotName) + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LocallabDenoise::enabledChanged()
|
||||
{
|
||||
if (isLocActivated) {
|
||||
if (listener) {
|
||||
if (exp->getEnabled()) {
|
||||
listener->panelChanged(EvLocenadenoi,
|
||||
M("GENERAL_ENABLED") + " (" + escapeHtmlChars(spotName) + ")");
|
||||
} else {
|
||||
listener->panelChanged(EvLocenadenoi,
|
||||
M("GENERAL_DISABLED") + " (" + escapeHtmlChars(spotName) + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ==== LocallabLog ==== */
|
||||
LocallabLog::LocallabLog():
|
||||
LocallabTool(this, M("TP_LOCALLAB_LOG_TOOLNAME"), M("TP_LOCALLAB_LOG"), false),
|
||||
|
||||
Reference in New Issue
Block a user