Pixelshift: replaced checkbox to use lmmse by a combobox to allow further demosaicers for parts with motion, #4579

This commit is contained in:
heckflosse
2018-06-01 19:13:59 +02:00
parent a0b8626b7d
commit 41c1f21c76
17 changed files with 3997 additions and 50 deletions

View File

@@ -29,6 +29,7 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA
auto m = ProcEventMapper::getInstance();
EvDemosaicContrast = m->newEvent(DEMOSAIC, "HISTORY_MSG_DUALDEMOSAIC_CONTRAST");
EvDemosaicPixelshiftDemosaicMethod = m->newEvent(DEMOSAIC, "HISTORY_MSG_PIXELSHIFT_DEMOSAIC");
Gtk::HBox* hb1 = Gtk::manage (new Gtk::HBox ());
hb1->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_DMETHOD") + ": ")), Gtk::PACK_SHRINK, 4);
@@ -149,6 +150,17 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA
pixelShiftShowMotionMaskOnly->set_tooltip_text (M("TP_RAW_PIXELSHIFTSHOWMOTIONMASKONLY_TOOLTIP"));
pixelShiftFrame->pack_start(*pixelShiftShowMotionMaskOnly);
Gtk::HBox* hb4 = Gtk::manage (new Gtk::HBox ());
hb4->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_PIXELSHIFTDMETHOD") + ": ")), Gtk::PACK_SHRINK, 4);
pixelShiftDemosaicMethod = Gtk::manage (new MyComboBoxText ());
for(const auto method_string : procparams::RAWParams::BayerSensor::getPSDemosaicMethodStrings()) {
pixelShiftDemosaicMethod->append(M("TP_RAW_" + Glib::ustring(method_string).uppercase()));
}
pixelShiftDemosaicMethod->set_active(0);
hb4->pack_start(*pixelShiftDemosaicMethod);
pixelShiftOptions->pack_start(*hb4);
pixelShiftGreen = Gtk::manage (new CheckBox(M("TP_RAW_PIXELSHIFTGREEN"), multiImage));
pixelShiftGreen->setCheckBoxListener (this);
pixelShiftOptions->pack_start(*pixelShiftGreen);
@@ -207,13 +219,6 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA
pixelShiftMedian->set_tooltip_text (M("TP_RAW_PIXELSHIFTMEDIAN_TOOLTIP"));
pixelShiftOptions->pack_start(*pixelShiftMedian);
pixelShiftLmmse = Gtk::manage (new CheckBox(M("TP_RAW_PIXELSHIFTLMMSE"), multiImage));
pixelShiftLmmse->setCheckBoxListener (this);
pixelShiftLmmse->set_tooltip_text (M("TP_RAW_PIXELSHIFTLMMSE_TOOLTIP"));
pixelShiftOptions->pack_start(*pixelShiftLmmse);
pixelShiftFrame->pack_start(*pixelShiftOptions);
pixelShiftOptions->hide();
@@ -222,6 +227,7 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA
method->connect(method->signal_changed().connect( sigc::mem_fun(*this, &BayerProcess::methodChanged) ));
imageNumber->connect(imageNumber->signal_changed().connect( sigc::mem_fun(*this, &BayerProcess::imageNumberChanged) ));
pixelShiftMotionMethod->connect(pixelShiftMotionMethod->signal_changed().connect( sigc::mem_fun(*this, &BayerProcess::pixelShiftMotionMethodChanged) ));
pixelShiftDemosaicMethod->connect(pixelShiftDemosaicMethod->signal_changed().connect( sigc::mem_fun(*this, &BayerProcess::pixelShiftDemosaicMethodChanged) ));
}
@@ -230,6 +236,7 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params
disableListener ();
method->block (true);
imageNumber->block (true);
pixelShiftDemosaicMethod->block(true);
//allEnhconn.block (true);
method->set_active(std::numeric_limits<int>::max());
@@ -242,8 +249,14 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params
break;
}
}
pixelShiftDemosaicMethod->set_active(std::numeric_limits<int>::max());
for (size_t i = 0; i < procparams::RAWParams::BayerSensor::getPSDemosaicMethodStrings().size(); ++i) {
if (pp->raw.bayersensor.pixelShiftDemosaicMethod == procparams::RAWParams::BayerSensor::getPSDemosaicMethodStrings()[i]) {
pixelShiftDemosaicMethod->set_active(i);
break;
}
}
//allEnhance->set_active(pp->raw.bayersensor.all_enhance);
dcbIterations->setValue (pp->raw.bayersensor.dcb_iterations);
dcbEnhance->setValue (pp->raw.bayersensor.dcb_enhance);
@@ -260,7 +273,6 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params
pixelShiftSmooth->set_sensitive (pp->raw.bayersensor.pixelShiftBlur);
}
pixelShiftSmooth->setValue (pp->raw.bayersensor.pixelShiftSmoothFactor);
pixelShiftLmmse->setValue (pp->raw.bayersensor.pixelShiftLmmse);
pixelShiftEqualBright->setValue (pp->raw.bayersensor.pixelShiftEqualBright);
pixelShiftEqualBrightChannel->set_sensitive (pp->raw.bayersensor.pixelShiftEqualBright);
pixelShiftEqualBrightChannel->setValue (pp->raw.bayersensor.pixelShiftEqualBrightChannel);
@@ -286,7 +298,6 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params
pixelShiftGreen->setEdited (pedited->raw.bayersensor.pixelShiftGreen);
pixelShiftBlur->setEdited (pedited->raw.bayersensor.pixelShiftBlur);
pixelShiftSmooth->setEditedState ( pedited->raw.bayersensor.pixelShiftSmooth ? Edited : UnEdited);
pixelShiftLmmse->setEdited (pedited->raw.bayersensor.pixelShiftLmmse);
pixelShiftEqualBright->setEdited (pedited->raw.bayersensor.pixelShiftEqualBright);
pixelShiftEqualBrightChannel->setEdited (pedited->raw.bayersensor.pixelShiftEqualBrightChannel);
pixelShiftNonGreenCross->setEdited (pedited->raw.bayersensor.pixelShiftNonGreenCross);
@@ -298,12 +309,19 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params
if(!pedited->raw.bayersensor.method) {
method->set_active(std::numeric_limits<int>::max()); // No name
}
if(!pedited->raw.bayersensor.imageNum) {
imageNumber->set_active_text(M("GENERAL_UNCHANGED"));
}
if(!pedited->raw.bayersensor.pixelShiftMotionCorrectionMethod) {
pixelShiftMotionMethod->set_active_text(M("GENERAL_UNCHANGED"));
}
if(!pedited->raw.bayersensor.pixelShiftDemosaicMethod) {
pixelShiftDemosaicMethod->set_active(std::numeric_limits<int>::max()); // No name
}
}
if (!batchMode) {
@@ -330,6 +348,7 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params
method->block (false);
imageNumber->block (false);
pixelShiftDemosaicMethod->block(false);
//allEnhconn.block (false);
enableListener ();
@@ -353,7 +372,6 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe
pp->raw.bayersensor.pixelShiftGreen = pixelShiftGreen->getLastActive ();
pp->raw.bayersensor.pixelShiftBlur = pixelShiftBlur->getLastActive ();
pp->raw.bayersensor.pixelShiftSmoothFactor = pixelShiftSmooth->getValue();
pp->raw.bayersensor.pixelShiftLmmse = pixelShiftLmmse->getLastActive ();
pp->raw.bayersensor.pixelShiftEqualBright = pixelShiftEqualBright->getLastActive ();
pp->raw.bayersensor.pixelShiftEqualBrightChannel = pixelShiftEqualBrightChannel->getLastActive ();
pp->raw.bayersensor.pixelShiftNonGreenCross = pixelShiftNonGreenCross->getLastActive ();
@@ -368,6 +386,11 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe
pp->raw.bayersensor.imageNum = currentRow;
}
currentRow = pixelShiftDemosaicMethod->get_active_row_number();
if( currentRow >= 0 && currentRow < std::numeric_limits<int>::max()) {
pp->raw.bayersensor.pixelShiftDemosaicMethod = procparams::RAWParams::BayerSensor::getPSDemosaicMethodString(RAWParams::BayerSensor::PSDemosaicMethod(currentRow));
}
if (pedited) {
pedited->raw.bayersensor.ccSteps = ccSteps->getEditedState ();
@@ -379,6 +402,7 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe
pedited->raw.bayersensor.lmmseIterations = lmmseIterations->getEditedState ();
pedited->raw.bayersensor.dualDemosaicContrast = dualDemosaicContrast->getEditedState ();
pedited->raw.bayersensor.pixelShiftMotionCorrectionMethod = pixelShiftMotionMethod->get_active_text() != M("GENERAL_UNCHANGED");
pedited->raw.bayersensor.pixelShiftDemosaicMethod = pixelShiftDemosaicMethod->get_active_row_number() != std::numeric_limits<int>::max();
pedited->raw.bayersensor.pixelShiftEperIso = pixelShiftEperIso->getEditedState ();
pedited->raw.bayersensor.pixelShiftSigma = pixelShiftSigma->getEditedState ();
pedited->raw.bayersensor.pixelShiftShowMotion = !pixelShiftShowMotion->get_inconsistent();
@@ -388,7 +412,6 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe
pedited->raw.bayersensor.pixelShiftGreen = !pixelShiftGreen->get_inconsistent();
pedited->raw.bayersensor.pixelShiftBlur = !pixelShiftBlur->get_inconsistent();
pedited->raw.bayersensor.pixelShiftSmooth = pixelShiftSmooth->getEditedState();
pedited->raw.bayersensor.pixelShiftLmmse = !pixelShiftLmmse->get_inconsistent();
pedited->raw.bayersensor.pixelShiftEqualBright = !pixelShiftEqualBright->get_inconsistent();
pedited->raw.bayersensor.pixelShiftEqualBrightChannel = !pixelShiftEqualBrightChannel->get_inconsistent();
pedited->raw.bayersensor.pixelShiftNonGreenCross = !pixelShiftNonGreenCross->get_inconsistent();
@@ -423,6 +446,8 @@ void BayerProcess::setBatchMode(bool batchMode)
method->set_active(std::numeric_limits<int>::max()); // No name
pixelShiftMotionMethod->append (M("GENERAL_UNCHANGED"));
pixelShiftMotionMethod->set_active_text (M("GENERAL_UNCHANGED"));
pixelShiftDemosaicMethod->append (M("GENERAL_UNCHANGED"));
pixelShiftDemosaicMethod->set_active(std::numeric_limits<int>::max()); // No name
imageNumber->append (M("GENERAL_UNCHANGED"));
imageNumber->set_active_text (M("GENERAL_UNCHANGED"));
ToolPanel::setBatchMode (batchMode);
@@ -535,6 +560,19 @@ void BayerProcess::methodChanged ()
}
}
void BayerProcess::pixelShiftDemosaicMethodChanged ()
{
if (listener) {
const int curSelection = pixelShiftDemosaicMethod->get_active_row_number();
if (curSelection >= 0 && curSelection < std::numeric_limits<int>::max()) {
const RAWParams::BayerSensor::PSDemosaicMethod method = RAWParams::BayerSensor::PSDemosaicMethod(curSelection);
Glib::ustring methodName = procparams::RAWParams::BayerSensor::getPSDemosaicMethodString(method);;
listener->panelChanged (EvDemosaicPixelshiftDemosaicMethod, methodName);
}
}
}
void BayerProcess::imageNumberChanged ()
{
if (listener) {
@@ -579,10 +617,6 @@ void BayerProcess::checkBoxToggled (CheckBox* c, CheckValue newval)
if (listener) {
listener->panelChanged (EvPixelShiftBlur, pixelShiftBlur->getValueAsStr ());
}
} else if (c == pixelShiftLmmse) {
if (listener) {
listener->panelChanged (EvPixelShiftLmmse, pixelShiftLmmse->getValueAsStr ());
}
} else if (c == pixelShiftEqualBright) {
if (!batchMode) {
pixelShiftEqualBrightChannel->set_sensitive(newval != CheckValue::off);

View File

@@ -42,6 +42,7 @@ protected:
Gtk::VBox *pixelShiftFrame;
Gtk::VBox *pixelShiftOptions;
MyComboBoxText* pixelShiftMotionMethod;
MyComboBoxText* pixelShiftDemosaicMethod;
CheckBox* pixelShiftShowMotion;
CheckBox* pixelShiftShowMotionMaskOnly;
CheckBox* pixelShiftNonGreenCross;
@@ -49,7 +50,6 @@ protected:
CheckBox* pixelShiftBlur;
CheckBox* pixelShiftHoleFill;
CheckBox* pixelShiftMedian;
CheckBox* pixelShiftLmmse;
CheckBox* pixelShiftEqualBright;
CheckBox* pixelShiftEqualBrightChannel;
Adjuster* pixelShiftSmooth;
@@ -61,6 +61,7 @@ protected:
IdleRegister idle_register;
rtengine::ProcEvent EvDemosaicContrast;
rtengine::ProcEvent EvDemosaicPixelshiftDemosaicMethod;
public:
BayerProcess ();
@@ -77,6 +78,7 @@ public:
void adjusterChanged(Adjuster* a, double newval);
void checkBoxToggled(CheckBox* c, CheckValue newval);
void pixelShiftMotionMethodChanged();
void pixelShiftDemosaicMethodChanged();
void FrameCountChanged(int n, int frameNum);
};

View File

@@ -414,10 +414,10 @@ void ParamsEdited::set (bool v)
raw.bayersensor.pixelShiftGreen = v;
raw.bayersensor.pixelShiftBlur = v;
raw.bayersensor.pixelShiftSmooth = v;
raw.bayersensor.pixelShiftLmmse = v;
raw.bayersensor.pixelShiftEqualBright = v;
raw.bayersensor.pixelShiftEqualBrightChannel = v;
raw.bayersensor.pixelShiftNonGreenCross = v;
raw.bayersensor.pixelShiftDemosaicMethod = v;
raw.bayersensor.greenEq = v;
raw.bayersensor.linenoise = v;
raw.bayersensor.linenoiseDirection = v;
@@ -964,10 +964,10 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
raw.bayersensor.pixelShiftGreen = raw.bayersensor.pixelShiftGreen && p.raw.bayersensor.pixelShiftGreen == other.raw.bayersensor.pixelShiftGreen;
raw.bayersensor.pixelShiftBlur = raw.bayersensor.pixelShiftBlur && p.raw.bayersensor.pixelShiftBlur == other.raw.bayersensor.pixelShiftBlur;
raw.bayersensor.pixelShiftSmooth = raw.bayersensor.pixelShiftSmooth && p.raw.bayersensor.pixelShiftSmoothFactor == other.raw.bayersensor.pixelShiftSmoothFactor;
raw.bayersensor.pixelShiftLmmse = raw.bayersensor.pixelShiftLmmse && p.raw.bayersensor.pixelShiftLmmse == other.raw.bayersensor.pixelShiftLmmse;
raw.bayersensor.pixelShiftEqualBright = raw.bayersensor.pixelShiftEqualBright && p.raw.bayersensor.pixelShiftEqualBright == other.raw.bayersensor.pixelShiftEqualBright;
raw.bayersensor.pixelShiftEqualBrightChannel = raw.bayersensor.pixelShiftEqualBrightChannel && p.raw.bayersensor.pixelShiftEqualBrightChannel == other.raw.bayersensor.pixelShiftEqualBrightChannel;
raw.bayersensor.pixelShiftNonGreenCross = raw.bayersensor.pixelShiftNonGreenCross && p.raw.bayersensor.pixelShiftNonGreenCross == other.raw.bayersensor.pixelShiftNonGreenCross;
raw.bayersensor.pixelShiftDemosaicMethod = raw.bayersensor.pixelShiftDemosaicMethod && p.raw.bayersensor.pixelShiftDemosaicMethod == other.raw.bayersensor.pixelShiftDemosaicMethod;
raw.bayersensor.greenEq = raw.bayersensor.greenEq && p.raw.bayersensor.greenthresh == other.raw.bayersensor.greenthresh;
raw.bayersensor.linenoise = raw.bayersensor.linenoise && p.raw.bayersensor.linenoise == other.raw.bayersensor.linenoise;
raw.bayersensor.linenoiseDirection = raw.bayersensor.linenoiseDirection && p.raw.bayersensor.linenoiseDirection == other.raw.bayersensor.linenoiseDirection;
@@ -2542,10 +2542,6 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
toEdit.raw.bayersensor.pixelShiftSmoothFactor = mods.raw.bayersensor.pixelShiftSmoothFactor;
}
if (raw.bayersensor.pixelShiftLmmse) {
toEdit.raw.bayersensor.pixelShiftLmmse = mods.raw.bayersensor.pixelShiftLmmse;
}
if (raw.bayersensor.pixelShiftEqualBright) {
toEdit.raw.bayersensor.pixelShiftEqualBright = mods.raw.bayersensor.pixelShiftEqualBright;
}
@@ -2558,6 +2554,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
toEdit.raw.bayersensor.pixelShiftNonGreenCross = mods.raw.bayersensor.pixelShiftNonGreenCross;
}
if (raw.bayersensor.pixelShiftDemosaicMethod) {
toEdit.raw.bayersensor.pixelShiftDemosaicMethod = mods.raw.bayersensor.pixelShiftDemosaicMethod;
}
if (raw.bayersensor.greenEq) {
toEdit.raw.bayersensor.greenthresh = dontforceSet && options.baBehav[ADDSET_PREPROCESS_GREENEQUIL] ? toEdit.raw.bayersensor.greenthresh + mods.raw.bayersensor.greenthresh : mods.raw.bayersensor.greenthresh;
}
@@ -3080,7 +3080,7 @@ bool RAWParamsEdited::BayerSensor::isUnchanged() const
{
return method && imageNum && dcbIterations && dcbEnhance && lmmseIterations && dualDemosaicContrast /*&& allEnhance*/ && greenEq
&& pixelShiftMotionCorrectionMethod && pixelShiftEperIso && pixelShiftSigma && pixelShiftShowMotion && pixelShiftShowMotionMaskOnly
&& pixelShiftHoleFill && pixelShiftMedian && pixelShiftNonGreenCross && pixelShiftGreen && pixelShiftBlur && pixelShiftSmooth && pixelShiftLmmse && pixelShiftEqualBright && pixelShiftEqualBrightChannel
&& pixelShiftHoleFill && pixelShiftMedian && pixelShiftNonGreenCross && pixelShiftDemosaicMethod && pixelShiftGreen && pixelShiftBlur && pixelShiftSmooth && pixelShiftEqualBright && pixelShiftEqualBrightChannel
&& linenoise && linenoiseDirection && pdafLinesFilter && exBlack0 && exBlack1 && exBlack2 && exBlack3 && exTwoGreen;
}

View File

@@ -742,10 +742,10 @@ public:
bool pixelShiftGreen;
bool pixelShiftBlur;
bool pixelShiftSmooth;
bool pixelShiftLmmse;
bool pixelShiftEqualBright;
bool pixelShiftEqualBrightChannel;
bool pixelShiftNonGreenCross;
bool pixelShiftDemosaicMethod;
//bool allEnhance;
bool greenEq;

View File

@@ -852,7 +852,7 @@ void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dstPP, Param
filterPE.raw.bayersensor.pixelShiftEqualBrightChannel = falsePE.raw.bayersensor.pixelShiftEqualBrightChannel;
filterPE.raw.bayersensor.pixelShiftGreen = falsePE.raw.bayersensor.pixelShiftGreen;
filterPE.raw.bayersensor.pixelShiftHoleFill = falsePE.raw.bayersensor.pixelShiftHoleFill;
filterPE.raw.bayersensor.pixelShiftLmmse = falsePE.raw.bayersensor.pixelShiftLmmse;
filterPE.raw.bayersensor.pixelShiftDemosaicMethod = falsePE.raw.bayersensor.pixelShiftDemosaicMethod;
filterPE.raw.bayersensor.pixelShiftMedian = falsePE.raw.bayersensor.pixelShiftMedian;
filterPE.raw.bayersensor.pixelShiftMotionCorrectionMethod = falsePE.raw.bayersensor.pixelShiftMotionCorrectionMethod;
filterPE.raw.bayersensor.pixelShiftNonGreenCross = falsePE.raw.bayersensor.pixelShiftNonGreenCross;

View File

@@ -1,11 +1,13 @@
#pragma once
// This number has to be incremented whenever the PP3 file format is modified or the behaviour of a tool changes
#define PPVERSION 335
#define PPVERSION 336
#define PPVERSION_AEXP 301 //value of PPVERSION when auto exposure algorithm was modified
/*
Log of version changes
336 2018-06-01
new demosaic method combobox for pixelshift
335 2018-05-30
new contrast adjuster in Bayer process tool
334 2018-05-13