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

@ -1790,6 +1790,7 @@ TP_RAW_MONO;Mono
TP_RAW_NONE;None (Shows sensor pattern)
TP_RAW_PIXELSHIFT;Pixel Shift
TP_RAW_PIXELSHIFTBLUR;Blur motion mask
TP_RAW_PIXELSHIFTDMETHOD;Demosaic method for motion
TP_RAW_PIXELSHIFTEPERISO;Sensitivity
TP_RAW_PIXELSHIFTEPERISO_TOOLTIP;The default value of 0 should work fine for base ISO.\nHigher values increase sensitivity of motion detection.\nChange in small steps and watch the motion mask while changing.\nIncrease sensitivity for underexposed or high ISO images.
TP_RAW_PIXELSHIFTEQUALBRIGHT;Equalize brightness of frames

View File

@ -38,7 +38,7 @@
namespace rtengine
{
void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue)
void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh, const array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue)
{
BENCHFUN

View File

@ -35,22 +35,24 @@ using namespace std;
namespace rtengine
{
void RawImageSource::amaze_vng4_demosaic_RT(int winw, int winh, array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue, double contrast)
void RawImageSource::amaze_vng4_demosaic_RT(int winw, int winh, const array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue, double contrast)
{
BENCHFUN
if (contrast == 0.0) {
// contrast == 0.0 means only AMaZE will be used
amaze_demosaic_RT (0, 0, winw, winh, rawData, red, green, blue);
amaze_demosaic_RT(0, 0, winw, winh, rawData, red, green, blue);
return;
}
vng4_demosaic ();
vng4_demosaic(rawData, red, green, blue);
array2D<float> redTmp(winw, winh);
array2D<float> greenTmp(winw, winh);
array2D<float> blueTmp(winw, winh);
array2D<float> L(winw, winh);
amaze_demosaic_RT (0, 0, winw, winh, rawData, redTmp, greenTmp, blueTmp);
amaze_demosaic_RT(0, 0, winw, winh, rawData, redTmp, greenTmp, blueTmp);
const float xyz_rgb[3][3] = { // XYZ from RGB
{ 0.412453, 0.357580, 0.180423 },
{ 0.212671, 0.715160, 0.072169 },
@ -63,7 +65,7 @@ void RawImageSource::amaze_vng4_demosaic_RT(int winw, int winh, array2D<float> &
Color::RGB2L(redTmp[i], greenTmp[i], blueTmp[i], L[i], xyz_rgb, winw);
}
}
// calculate contrast based blend factors to reduce sharpening in regions with low contrast
// calculate contrast based blend factors to use vng4 in regions with low contrast
JaggedArray<float> blend(winw, winh);
buildBlendMask(L, blend, winw, winh, contrast / 100.f);

View File

@ -562,7 +562,7 @@ void RawImageSource::hphd_demosaic ()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#define fc(row,col) (prefilters >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3)
typedef unsigned short ushort;
void RawImageSource::vng4_demosaic ()
void RawImageSource::vng4_demosaic (const array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue)
{
const signed short int *cp, terms[] = {
-2, -2, +0, -1, 0, 0x01, -2, -2, +0, +0, 1, 0x01, -2, -1, -1, +0, 0, 0x01,

File diff suppressed because it is too large Load Diff

View File

@ -323,19 +323,22 @@ BENCHFUN
if(motionDetection) {
if(!showOnlyMask) {
if(bayerParams.pixelShiftMedian) { // We need the demosaiced frames for motion correction
if(bayerParams.pixelShiftLmmse) {
if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(bayerParams.PSDemosaicMethod::LMMSE)) {
lmmse_interpolate_omp(winw, winh, *(rawDataFrames[0]), red, green, blue, bayerParams.lmmse_iterations);
} else if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(bayerParams.PSDemosaicMethod::AMAZEVNG4)) {
amaze_vng4_demosaic_RT (winw, winh, *(rawDataFrames[0]), red, green, blue, bayerParams.dualDemosaicContrast);
} else {
amaze_demosaic_RT(winx, winy, winw, winh, *(rawDataFrames[0]), red, green, blue);
}
multi_array2D<float, 3> redTmp(winw, winh);
multi_array2D<float, 3> greenTmp(winw, winh);
multi_array2D<float, 3> blueTmp(winw, winh);
for(int i = 0; i < 3; i++) {
if(bayerParams.pixelShiftLmmse) {
if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(bayerParams.PSDemosaicMethod::LMMSE)) {
lmmse_interpolate_omp(winw, winh, *(rawDataFrames[i + 1]), redTmp[i], greenTmp[i], blueTmp[i], bayerParams.lmmse_iterations);
} else if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(bayerParams.PSDemosaicMethod::AMAZEVNG4)) {
amaze_vng4_demosaic_RT (winw, winh, *(rawDataFrames[i + 1]), redTmp[i], greenTmp[i], blueTmp[i], bayerParams.dualDemosaicContrast);
} else {
amaze_demosaic_RT(winx, winy, winw, winh, *(rawDataFrames[i + 1]), redTmp[i], greenTmp[i], blueTmp[i]);
}
@ -359,8 +362,10 @@ BENCHFUN
}
}
} else {
if(bayerParams.pixelShiftLmmse) {
if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(bayerParams.PSDemosaicMethod::LMMSE)) {
lmmse_interpolate_omp(winw, winh, rawData, red, green, blue, bayerParams.lmmse_iterations);
} else if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(bayerParams.PSDemosaicMethod::AMAZEVNG4)) {
amaze_vng4_demosaic_RT (winw, winh, rawData, red, green, blue, bayerParams.dualDemosaicContrast);
} else {
amaze_demosaic_RT(winx, winy, winw, winh, rawData, red, green, blue);
}

View File

@ -2367,10 +2367,10 @@ RAWParams::BayerSensor::BayerSensor() :
pixelShiftGreen(true),
pixelShiftBlur(true),
pixelShiftSmoothFactor(0.7),
pixelShiftLmmse(false),
pixelShiftEqualBright(false),
pixelShiftEqualBrightChannel(false),
pixelShiftNonGreenCross(true),
pixelShiftDemosaicMethod(getPSDemosaicMethodString(PSDemosaicMethod::AMAZE)),
dcb_enhance(true),
pdafLinesFilter(false)
{
@ -2403,10 +2403,10 @@ bool RAWParams::BayerSensor::operator ==(const BayerSensor& other) const
&& pixelShiftGreen == other.pixelShiftGreen
&& pixelShiftBlur == other.pixelShiftBlur
&& pixelShiftSmoothFactor == other.pixelShiftSmoothFactor
&& pixelShiftLmmse == other.pixelShiftLmmse
&& pixelShiftEqualBright == other.pixelShiftEqualBright
&& pixelShiftEqualBrightChannel == other.pixelShiftEqualBrightChannel
&& pixelShiftNonGreenCross == other.pixelShiftNonGreenCross
&& pixelShiftDemosaicMethod == other.pixelShiftDemosaicMethod
&& dcb_enhance == other.dcb_enhance
&& pdafLinesFilter == other.pdafLinesFilter;
}
@ -2426,10 +2426,10 @@ void RAWParams::BayerSensor::setPixelShiftDefaults()
pixelShiftGreen = true;
pixelShiftBlur = true;
pixelShiftSmoothFactor = 0.7;
pixelShiftLmmse = false;
pixelShiftEqualBright = false;
pixelShiftEqualBrightChannel = false;
pixelShiftNonGreenCross = true;
pixelShiftDemosaicMethod = getPSDemosaicMethodString(PSDemosaicMethod::AMAZE);
}
const std::vector<const char*>& RAWParams::BayerSensor::getMethodStrings()
@ -2458,6 +2458,23 @@ Glib::ustring RAWParams::BayerSensor::getMethodString(Method method)
return getMethodStrings()[toUnderlying(method)];
}
const std::vector<const char*>& RAWParams::BayerSensor::getPSDemosaicMethodStrings()
{
static const std::vector<const char*> method_strings {
"amaze",
"amazevng4",
"lmmse"
};
return method_strings;
}
Glib::ustring RAWParams::BayerSensor::getPSDemosaicMethodString(PSDemosaicMethod method)
{
return getPSDemosaicMethodStrings()[toUnderlying(method)];
}
RAWParams::XTransSensor::XTransSensor() :
method(getMethodString(Method::THREE_PASS)),
ccSteps(0),
@ -3345,10 +3362,10 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftGreen, "RAW Bayer", "pixelShiftGreen", raw.bayersensor.pixelShiftGreen, keyFile);
saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftBlur, "RAW Bayer", "pixelShiftBlur", raw.bayersensor.pixelShiftBlur, keyFile);
saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftSmooth, "RAW Bayer", "pixelShiftSmoothFactor", raw.bayersensor.pixelShiftSmoothFactor, keyFile);
saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftLmmse, "RAW Bayer", "pixelShiftLmmse", raw.bayersensor.pixelShiftLmmse, keyFile);
saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEqualBright, "RAW Bayer", "pixelShiftEqualBright", raw.bayersensor.pixelShiftEqualBright, keyFile);
saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEqualBrightChannel, "RAW Bayer", "pixelShiftEqualBrightChannel", raw.bayersensor.pixelShiftEqualBrightChannel, keyFile);
saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenCross, "RAW Bayer", "pixelShiftNonGreenCross", raw.bayersensor.pixelShiftNonGreenCross, keyFile);
saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftDemosaicMethod, "RAW Bayer", "pixelShiftDemosaicMethod", raw.bayersensor.pixelShiftDemosaicMethod, keyFile);
saveToKeyfile(!pedited || pedited->raw.bayersensor.pdafLinesFilter, "RAW Bayer", "PDAFLinesFilter", raw.bayersensor.pdafLinesFilter, keyFile);
saveToKeyfile(!pedited || pedited->raw.xtranssensor.method, "RAW X-Trans", "Method", raw.xtranssensor.method, keyFile);
saveToKeyfile(!pedited || pedited->raw.xtranssensor.ccSteps, "RAW X-Trans", "CcSteps", raw.xtranssensor.ccSteps, keyFile);
@ -4682,10 +4699,26 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftGreen", pedited, raw.bayersensor.pixelShiftGreen, pedited->raw.bayersensor.pixelShiftGreen);
assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftBlur", pedited, raw.bayersensor.pixelShiftBlur, pedited->raw.bayersensor.pixelShiftBlur);
assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftSmoothFactor", pedited, raw.bayersensor.pixelShiftSmoothFactor, pedited->raw.bayersensor.pixelShiftSmooth);
assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftLmmse", pedited, raw.bayersensor.pixelShiftLmmse, pedited->raw.bayersensor.pixelShiftLmmse);
assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftEqualBright", pedited, raw.bayersensor.pixelShiftEqualBright, pedited->raw.bayersensor.pixelShiftEqualBright);
assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftEqualBrightChannel", pedited, raw.bayersensor.pixelShiftEqualBrightChannel, pedited->raw.bayersensor.pixelShiftEqualBrightChannel);
assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftNonGreenCross", pedited, raw.bayersensor.pixelShiftNonGreenCross, pedited->raw.bayersensor.pixelShiftNonGreenCross);
if (ppVersion < 336) {
if (keyFile.has_key("RAW Bayer", "pixelShiftLmmse")) {
bool useLmmse = keyFile.get_boolean ("RAW Bayer", "pixelShiftLmmse");
if (useLmmse) {
raw.bayersensor.pixelShiftDemosaicMethod = raw.bayersensor.getPSDemosaicMethodString(raw.bayersensor.PSDemosaicMethod::LMMSE);
} else {
raw.bayersensor.pixelShiftDemosaicMethod = raw.bayersensor.getPSDemosaicMethodString(raw.bayersensor.PSDemosaicMethod::AMAZE);
}
if (pedited) {
pedited->raw.bayersensor.pixelShiftDemosaicMethod = true;
}
}
} else {
assignFromKeyfile(keyFile, "RAW Bayer", "pixelShiftDemosaicMethod", pedited, raw.bayersensor.pixelShiftDemosaicMethod, pedited->raw.bayersensor.pixelShiftDemosaicMethod);
}
assignFromKeyfile(keyFile, "RAW Bayer", "PDAFLinesFilter", pedited, raw.bayersensor.pdafLinesFilter, pedited->raw.bayersensor.pdafLinesFilter);
}

View File

@ -1245,6 +1245,12 @@ struct RAWParams {
CUSTOM
};
enum class PSDemosaicMethod {
AMAZE,
AMAZEVNG4,
LMMSE
};
Glib::ustring method;
int imageNum;
int ccSteps;
@ -1275,10 +1281,10 @@ struct RAWParams {
bool pixelShiftGreen;
bool pixelShiftBlur;
double pixelShiftSmoothFactor;
bool pixelShiftLmmse;
bool pixelShiftEqualBright;
bool pixelShiftEqualBrightChannel;
bool pixelShiftNonGreenCross;
Glib::ustring pixelShiftDemosaicMethod;
bool dcb_enhance;
bool pdafLinesFilter;
@ -1291,6 +1297,9 @@ struct RAWParams {
static const std::vector<const char*>& getMethodStrings();
static Glib::ustring getMethodString(Method method);
static const std::vector<const char*>& getPSDemosaicMethodStrings();
static Glib::ustring getPSDemosaicMethodString(PSDemosaicMethod method);
};
/**

View File

@ -2068,7 +2068,7 @@ void RawImageSource::demosaic(const RAWParams &raw)
if ( raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::HPHD) ) {
hphd_demosaic ();
} else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::VNG4) ) {
vng4_demosaic ();
vng4_demosaic (rawData, red, green, blue);
} else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AHD) ) {
ahd_demosaic ();
} else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AMAZE) ) {

View File

@ -262,13 +262,13 @@ protected:
void nodemosaic(bool bw);
void eahd_demosaic();
void hphd_demosaic();
void vng4_demosaic();
void vng4_demosaic(const array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue);
void ppg_demosaic();
void jdl_interpolate_omp();
void igv_interpolate(int winw, int winh);
void lmmse_interpolate_omp(int winw, int winh, array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue, int iterations);
void amaze_demosaic_RT(int winx, int winy, int winw, int winh, array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue);//Emil's code for AMaZE
void amaze_vng4_demosaic_RT(int winw, int winh, array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue, double contrast = 0.0);
void amaze_demosaic_RT(int winx, int winy, int winw, int winh, const array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue);//Emil's code for AMaZE
void amaze_vng4_demosaic_RT(int winw, int winh, const array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue, double contrast = 0.0);
void fast_demosaic();//Emil's code for fast demosaicing
void dcb_demosaic(int iterations, bool dcb_enhance);
void ahd_demosaic();

View File

@ -1465,8 +1465,6 @@ private:
}
if (params.raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::PIXELSHIFT)) {
params.raw.bayersensor.method = procparams::RAWParams::BayerSensor::getMethodString(params.raw.bayersensor.pixelShiftLmmse ? procparams::RAWParams::BayerSensor::Method::LMMSE : procparams::RAWParams::BayerSensor::Method::AMAZE);
} else if (params.raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::AMAZE)) {
params.raw.bayersensor.method = procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::RCD);
}

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