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

@ -1611,6 +1611,7 @@ TP_PREPROCESS_NO_FOUND;None found
TP_PRSHARPENING_LABEL;Post-Resize Sharpening
TP_PRSHARPENING_TOOLTIP;Sharpens the image after resizing. Only works when the "Lanczos" resizing method is used. It is impossible to preview the effects of this tool. See RawPedia for usage instructions.
TP_RAWCACORR_AUTO;Auto-correction
TP_RAWCACORR_CASTR;Strength
TP_RAWCACORR_CABLUE;Blue
TP_RAWCACORR_CARED;Red
TP_RAWEXPOS_BLACKS;Black Levels

File diff suppressed because it is too large Load Diff

View File

@ -466,6 +466,7 @@ enum ProcEvent {
EvmapMethod = 436,
EvRetinexmapcurve = 437,
EvviewMethod = 438,
EvPreProcessCAStrength = 439,
NUMOFEVENTS
};
}

View File

@ -888,6 +888,7 @@ void RAWParams::setDefaults()
ff_clipControl = 0;
cared = 0;
cablue = 0;
caautostrength = 4;
ca_autocorrect = false;
hotPixelFilter = false;
deadPixelFilter = false;
@ -3250,6 +3251,10 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol
keyFile.set_boolean ("RAW", "CA", raw.ca_autocorrect );
}
if (!pedited || pedited->raw.caAutoStrength) {
keyFile.set_double ("RAW", "CAAutoStrength", raw.caautostrength );
}
if (!pedited || pedited->raw.caRed) {
keyFile.set_double ("RAW", "CARed", raw.cared );
}
@ -7064,6 +7069,14 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited)
}
}
if (keyFile.has_key ("RAW", "CAAutoStrength")) {
raw.caautostrength = keyFile.get_double ("RAW", "CAAutoStrength" );
if (pedited) {
pedited->raw.caAutoStrength = true;
}
}
if (keyFile.has_key ("RAW", "CARed")) {
raw.cared = keyFile.get_double ("RAW", "CARed" );
@ -7785,6 +7798,7 @@ bool ProcParams::operator== (const ProcParams& other)
&& raw.expos == other.raw.expos
&& raw.preser == other.raw.preser
&& raw.ca_autocorrect == other.raw.ca_autocorrect
&& raw.caautostrength == other.raw.caautostrength
&& raw.cared == other.raw.cared
&& raw.cablue == other.raw.cablue
&& raw.hotPixelFilter == other.raw.hotPixelFilter

View File

@ -1218,6 +1218,7 @@ public:
int ff_clipControl;
bool ca_autocorrect;
double caautostrength;
double cared;
double cablue;

View File

@ -1865,7 +1865,7 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le
plistener->setProgress (0.0);
}
CA_correct_RT(raw.cared, raw.cablue);
CA_correct_RT(raw.cared, raw.cablue, 10.0 - raw.caautostrength);
}
if ( raw.expos != 1 ) {

View File

@ -215,8 +215,7 @@ protected:
inline void interpolate_row_rb (float* ar, float* ab, float* pg, float* cg, float* ng, int i);
inline void interpolate_row_rb_mul_pp (float* ar, float* ab, float* pg, float* cg, float* ng, int i, float r_mul, float g_mul, float b_mul, int x1, int width, int skip);
int LinEqSolve( int nDim, double* pfMatr, double* pfVect, double* pfSolution);//Emil's CA auto correction
void CA_correct_RT (double cared, double cablue);
void CA_correct_RT (const double cared, const double cablue, const double caautostrength);
void ddct8x8s(int isgn, float a[8][8]);
void processRawWhitepoint (float expos, float preser); // exposure before interpolation

View File

@ -465,6 +465,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
RETINEX, // EvLradius
RETINEX, // EvmapMethod
DEMOSAIC, // EvRetinexmapcurve
DEMOSAIC // EvviewMethod
DEMOSAIC, // EvviewMethod
DARKFRAME // EvPreProcessCAStrength
};

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;