Additional Speedup for CA-Correction, also included a prototype to allow strength of Auto-CA-correction

This commit is contained in:
heckflosse
2016-02-28 22:08:07 +01:00
parent 6b5db692e1
commit cbc88a5804
12 changed files with 405 additions and 566 deletions

View File

@@ -375,6 +375,7 @@ void ParamsEdited::set (bool v)
raw.xtranssensor.exBlackGreen = v;
raw.xtranssensor.exBlackBlue = v;
raw.caCorrection = v;
raw.caAutoStrength = v;
raw.caBlue = v;
raw.caRed = v;
raw.hotPixelFilter = v;
@@ -865,6 +866,7 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
raw.xtranssensor.exBlackGreen = raw.xtranssensor.exBlackGreen && p.raw.xtranssensor.blackgreen == other.raw.xtranssensor.blackgreen;
raw.xtranssensor.exBlackBlue = raw.xtranssensor.exBlackBlue && p.raw.xtranssensor.blackblue == other.raw.xtranssensor.blackblue;
raw.caCorrection = raw.caCorrection && p.raw.ca_autocorrect == other.raw.ca_autocorrect;
raw.caAutoStrength = raw.caAutoStrength && p.raw.caautostrength == other.raw.caautostrength;
raw.caRed = raw.caRed && p.raw.cared == other.raw.cared;
raw.caBlue = raw.caBlue && p.raw.cablue == other.raw.cablue;
raw.hotPixelFilter = raw.hotPixelFilter && p.raw.hotPixelFilter == other.raw.hotPixelFilter;
@@ -2290,6 +2292,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
toEdit.raw.ca_autocorrect = mods.raw.ca_autocorrect;
}
if (raw.caAutoStrength) {
toEdit.raw.caautostrength = dontforceSet && options.baBehav[ADDSET_RAWCACORR] ? toEdit.raw.caautostrength + mods.raw.caautostrength : mods.raw.caautostrength;
}
if (raw.caRed) {
toEdit.raw.cared = dontforceSet && options.baBehav[ADDSET_RAWCACORR] ? toEdit.raw.cared + mods.raw.cared : mods.raw.cared;
}
@@ -2770,7 +2776,7 @@ bool RAWParamsEdited::XTransSensor::isUnchanged() const
bool RAWParamsEdited::isUnchanged() const
{
return bayersensor.isUnchanged() && xtranssensor.isUnchanged() && caCorrection && caRed && caBlue && hotPixelFilter && deadPixelFilter && hotDeadPixelThresh && darkFrame
return bayersensor.isUnchanged() && xtranssensor.isUnchanged() && caCorrection && caAutoStrength && caRed && caBlue && hotPixelFilter && deadPixelFilter && hotDeadPixelThresh && darkFrame
&& dfAuto && ff_file && ff_AutoSelect && ff_BlurRadius && ff_BlurType && exPos && exPreser && ff_AutoClipControl && ff_clipControl;
}

View File

@@ -713,6 +713,7 @@ public:
XTransSensor xtranssensor;
bool caCorrection;
bool caAutoStrength;
bool caRed;
bool caBlue;
bool hotPixelFilter;

View File

@@ -32,6 +32,14 @@ RAWCACorr::RAWCACorr () : FoldableToolPanel(this, "rawcacorrection", M("TP_CHROM
Gtk::Image* icablueR = Gtk::manage (new RTImage ("ajd-ca-blue2.png"));
caAutocorrect = Gtk::manage(new Gtk::CheckButton((M("TP_RAWCACORR_AUTO"))));
caStrength = Gtk::manage(new Adjuster (M("TP_RAWCACORR_CASTR"), 2.0, 8.0, 0.5, 6.0));
caStrength->setAdjusterListener (this);
if (caStrength->delay < options.adjusterMaxDelay) {
caStrength->delay = options.adjusterMaxDelay;
}
caStrength->show();
caRed = Gtk::manage(new Adjuster (M("TP_RAWCACORR_CARED"), -4.0, 4.0, 0.1, 0, icaredL, icaredR));
caRed->setAdjusterListener (this);
@@ -50,6 +58,7 @@ RAWCACorr::RAWCACorr () : FoldableToolPanel(this, "rawcacorrection", M("TP_CHROM
caBlue->show();
pack_start( *caAutocorrect, Gtk::PACK_SHRINK, 4);
pack_start( *caStrength, Gtk::PACK_SHRINK, 4);
pack_start( *caRed, Gtk::PACK_SHRINK, 4);
pack_start( *caBlue, Gtk::PACK_SHRINK, 4);
@@ -63,17 +72,20 @@ void RAWCACorr::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi
if(pedited ) {
caAutocorrect->set_inconsistent(!pedited->raw.caCorrection);
caStrength->setEditedState( pedited->raw.caAutoStrength ? Edited : UnEdited );
caRed->setEditedState( pedited->raw.caRed ? Edited : UnEdited );
caBlue->setEditedState( pedited->raw.caBlue ? Edited : UnEdited );
}
lastCA = pp->raw.ca_autocorrect;
caStrength->set_sensitive(pp->raw.ca_autocorrect);
// disable Red and Blue sliders when caAutocorrect is enabled
caRed->set_sensitive(!pp->raw.ca_autocorrect);
caBlue->set_sensitive(!pp->raw.ca_autocorrect);
caAutocorrect->set_active(pp->raw.ca_autocorrect);
caStrength->setValue (pp->raw.caautostrength);
caRed->setValue (pp->raw.cared);
caBlue->setValue (pp->raw.cablue);
@@ -84,11 +96,13 @@ void RAWCACorr::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi
void RAWCACorr::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited)
{
pp->raw.ca_autocorrect = caAutocorrect->get_active();
pp->raw.caautostrength = caStrength->getValue();
pp->raw.cared = caRed->getValue();
pp->raw.cablue = caBlue->getValue();
if (pedited) {
pedited->raw.caCorrection = !caAutocorrect->get_inconsistent();
pedited->raw.caAutoStrength = caStrength->getEditedState ();
pedited->raw.caRed = caRed->getEditedState ();
pedited->raw.caBlue = caBlue->getEditedState ();
}
@@ -105,6 +119,8 @@ void RAWCACorr::adjusterChanged (Adjuster* a, double newval)
listener->panelChanged (EvPreProcessCARed, value );
} else if (a == caBlue) {
listener->panelChanged (EvPreProcessCABlue, value );
} else if (a == caStrength) {
listener->panelChanged (EvPreProcessCAStrength, value );
}
}
}
@@ -112,19 +128,23 @@ void RAWCACorr::adjusterChanged (Adjuster* a, double newval)
void RAWCACorr::setBatchMode(bool batchMode)
{
ToolPanel::setBatchMode (batchMode);
caStrength->showEditedCB ();
caRed->showEditedCB ();
caBlue->showEditedCB ();
}
void RAWCACorr::setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited)
{
caStrength->setDefault( defParams->raw.caautostrength);
caRed->setDefault( defParams->raw.cared);
caBlue->setDefault( defParams->raw.cablue);
if (pedited) {
caStrength->setDefaultEditedState( pedited->raw.caAutoStrength ? Edited : UnEdited);
caRed->setDefaultEditedState( pedited->raw.caRed ? Edited : UnEdited);
caBlue->setDefaultEditedState( pedited->raw.caBlue ? Edited : UnEdited);
} else {
caStrength->setDefaultEditedState( Irrelevant );
caRed->setDefaultEditedState( Irrelevant );
caBlue->setDefaultEditedState( Irrelevant );
}
@@ -158,6 +178,7 @@ void RAWCACorr::caCorrectionChanged()
}
}*/
caStrength->set_sensitive(caAutocorrect->get_active ());
// disable Red and Blue sliders when caAutocorrect is enabled
caRed->set_sensitive(!caAutocorrect->get_active ());
caBlue->set_sensitive(!caAutocorrect->get_active ());
@@ -178,6 +199,7 @@ void RAWCACorr::caCorrectionChanged()
void RAWCACorr::setAdjusterBehavior (bool caadd)
{
caStrength->setAddMode(caadd);
caRed->setAddMode(caadd);
caBlue->setAddMode(caadd);
}
@@ -185,6 +207,7 @@ void RAWCACorr::setAdjusterBehavior (bool caadd)
void RAWCACorr::trimValues (rtengine::procparams::ProcParams* pp)
{
caStrength->trimValue(pp->raw.caautostrength);
caRed->trimValue(pp->raw.cared);
caBlue->trimValue(pp->raw.cablue);
}

View File

@@ -29,6 +29,7 @@ class RAWCACorr : public ToolParamBlock, public AdjusterListener, public Foldabl
protected:
Gtk::CheckButton* caAutocorrect;
Adjuster* caStrength;
Adjuster* caRed;
Adjuster* caBlue;
bool lastCA;