Used new CheckBox in rawcacorrection; don't zero red and blue when autoca is enabled
This commit is contained in:
parent
a25a585673
commit
bb518eeef8
@ -112,7 +112,7 @@ bool LinEqSolve(int nDim, double* pfMatr, double* pfVect, double* pfSolution)
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace rtengine;
|
using namespace rtengine;
|
||||||
|
|
||||||
void RawImageSource::CA_correct_RT(const double cared, const double cablue, const double caautostrength, array2D<float> &rawData)
|
void RawImageSource::CA_correct_RT(const bool autoCA, const double cared, const double cablue, const double caautostrength, array2D<float> &rawData)
|
||||||
{
|
{
|
||||||
// multithreaded and partly vectorized by Ingo Weyrich
|
// multithreaded and partly vectorized by Ingo Weyrich
|
||||||
constexpr int ts = 128;
|
constexpr int ts = 128;
|
||||||
@ -134,7 +134,6 @@ void RawImageSource::CA_correct_RT(const double cared, const double cablue, cons
|
|||||||
plistener->setProgress (progress);
|
plistener->setProgress (progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool autoCA = (cared == 0 && cablue == 0);
|
|
||||||
// local variables
|
// local variables
|
||||||
const int width = W, height = H;
|
const int width = W, height = H;
|
||||||
//temporary array to store simple interpolation of G
|
//temporary array to store simple interpolation of G
|
||||||
@ -695,7 +694,7 @@ void RawImageSource::CA_correct_RT(const double cared, const double cablue, cons
|
|||||||
//fitparams[polyord*i+j] gives the coefficients of (vblock^i hblock^j) in a polynomial fit for i,j<=4
|
//fitparams[polyord*i+j] gives the coefficients of (vblock^i hblock^j) in a polynomial fit for i,j<=4
|
||||||
}
|
}
|
||||||
//end of initialization for CA correction pass
|
//end of initialization for CA correction pass
|
||||||
//only executed if cared and cablue are zero
|
//only executed if autoCA is true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main algorithm: Tile loop
|
// Main algorithm: Tile loop
|
||||||
|
@ -1980,10 +1980,10 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le
|
|||||||
}
|
}
|
||||||
if(numFrames == 4 && raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::pixelshift]) {
|
if(numFrames == 4 && raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::pixelshift]) {
|
||||||
for(int i=0; i<4; ++i) {
|
for(int i=0; i<4; ++i) {
|
||||||
CA_correct_RT(raw.cared, raw.cablue, 10.0 - raw.caautostrength, *rawDataFrames[i]);
|
CA_correct_RT(raw.ca_autocorrect, raw.cared, raw.cablue, 10.0 - raw.caautostrength, *rawDataFrames[i]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CA_correct_RT(raw.cared, raw.cablue, 10.0 - raw.caautostrength, rawData);
|
CA_correct_RT(raw.ca_autocorrect, raw.cared, raw.cablue, 10.0 - raw.caautostrength, rawData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ protected:
|
|||||||
inline void interpolate_row_rb (float* ar, float* ab, float* pg, float* cg, float* ng, int i);
|
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);
|
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);
|
||||||
|
|
||||||
void CA_correct_RT (const double cared, const double cablue, const double caautostrength, array2D<float> &rawData);
|
void CA_correct_RT (const bool autoCA, const double cared, const double cablue, const double caautostrength, array2D<float> &rawData);
|
||||||
void ddct8x8s(int isgn, float a[8][8]);
|
void ddct8x8s(int isgn, float a[8][8]);
|
||||||
void processRawWhitepoint (float expos, float preser, array2D<float> &rawData); // exposure before interpolation
|
void processRawWhitepoint (float expos, float preser, array2D<float> &rawData); // exposure before interpolation
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
#include "rawcacorrection.h"
|
#include "rawcacorrection.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include <sstream>
|
|
||||||
#include "rtimage.h"
|
#include "rtimage.h"
|
||||||
|
|
||||||
using namespace rtengine;
|
using namespace rtengine;
|
||||||
@ -31,7 +30,8 @@ RAWCACorr::RAWCACorr () : FoldableToolPanel(this, "rawcacorrection", M("TP_CHROM
|
|||||||
Gtk::Image* icablueL = Gtk::manage (new RTImage ("ajd-ca-blue1.png"));
|
Gtk::Image* icablueL = Gtk::manage (new RTImage ("ajd-ca-blue1.png"));
|
||||||
Gtk::Image* icablueR = Gtk::manage (new RTImage ("ajd-ca-blue2.png"));
|
Gtk::Image* icablueR = Gtk::manage (new RTImage ("ajd-ca-blue2.png"));
|
||||||
|
|
||||||
caAutocorrect = Gtk::manage(new Gtk::CheckButton((M("TP_RAWCACORR_AUTO"))));
|
caAutocorrect = Gtk::manage (new CheckBox(M("TP_RAWCACORR_AUTO"), multiImage));
|
||||||
|
caAutocorrect->setCheckBoxListener (this);
|
||||||
|
|
||||||
caStrength = Gtk::manage(new Adjuster (M("TP_RAWCACORR_CASTR"), 2.0, 8.0, 0.5, 6.0));
|
caStrength = Gtk::manage(new Adjuster (M("TP_RAWCACORR_CASTR"), 2.0, 8.0, 0.5, 6.0));
|
||||||
caStrength->setAdjusterListener (this);
|
caStrength->setAdjusterListener (this);
|
||||||
@ -62,40 +62,35 @@ RAWCACorr::RAWCACorr () : FoldableToolPanel(this, "rawcacorrection", M("TP_CHROM
|
|||||||
pack_start( *caRed, Gtk::PACK_SHRINK, 4);
|
pack_start( *caRed, Gtk::PACK_SHRINK, 4);
|
||||||
pack_start( *caBlue, Gtk::PACK_SHRINK, 4);
|
pack_start( *caBlue, Gtk::PACK_SHRINK, 4);
|
||||||
|
|
||||||
caacsconn = caAutocorrect->signal_toggled().connect ( sigc::mem_fun(*this, &RAWCACorr::caCorrectionChanged), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RAWCACorr::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited)
|
void RAWCACorr::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited)
|
||||||
{
|
{
|
||||||
disableListener ();
|
disableListener ();
|
||||||
caacsconn.block (true);
|
|
||||||
|
|
||||||
if(pedited ) {
|
if(pedited ) {
|
||||||
caAutocorrect->set_inconsistent(!pedited->raw.caCorrection);
|
caAutocorrect->setEdited(pedited->raw.caCorrection);
|
||||||
caStrength->setEditedState( pedited->raw.caAutoStrength ? Edited : UnEdited );
|
caStrength->setEditedState( pedited->raw.caAutoStrength ? Edited : UnEdited );
|
||||||
caRed->setEditedState( pedited->raw.caRed ? Edited : UnEdited );
|
caRed->setEditedState( pedited->raw.caRed ? Edited : UnEdited );
|
||||||
caBlue->setEditedState( pedited->raw.caBlue ? Edited : UnEdited );
|
caBlue->setEditedState( pedited->raw.caBlue ? Edited : UnEdited );
|
||||||
}
|
}
|
||||||
|
|
||||||
lastCA = pp->raw.ca_autocorrect;
|
|
||||||
|
|
||||||
caStrength->set_sensitive(pp->raw.ca_autocorrect);
|
caStrength->set_sensitive(pp->raw.ca_autocorrect);
|
||||||
// disable Red and Blue sliders when caAutocorrect is enabled
|
// disable Red and Blue sliders when caAutocorrect is enabled
|
||||||
caRed->set_sensitive(!pp->raw.ca_autocorrect);
|
caRed->set_sensitive(!pp->raw.ca_autocorrect);
|
||||||
caBlue->set_sensitive(!pp->raw.ca_autocorrect);
|
caBlue->set_sensitive(!pp->raw.ca_autocorrect);
|
||||||
|
|
||||||
caAutocorrect->set_active(pp->raw.ca_autocorrect);
|
caAutocorrect->setValue(pp->raw.ca_autocorrect);
|
||||||
caStrength->setValue (pp->raw.caautostrength);
|
caStrength->setValue (pp->raw.caautostrength);
|
||||||
caRed->setValue (pp->raw.cared);
|
caRed->setValue (pp->raw.cared);
|
||||||
caBlue->setValue (pp->raw.cablue);
|
caBlue->setValue (pp->raw.cablue);
|
||||||
|
|
||||||
caacsconn.block (false);
|
|
||||||
enableListener ();
|
enableListener ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RAWCACorr::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited)
|
void RAWCACorr::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited)
|
||||||
{
|
{
|
||||||
pp->raw.ca_autocorrect = caAutocorrect->get_active();
|
pp->raw.ca_autocorrect = caAutocorrect->getLastActive();
|
||||||
pp->raw.caautostrength = caStrength->getValue();
|
pp->raw.caautostrength = caStrength->getValue();
|
||||||
pp->raw.cared = caRed->getValue();
|
pp->raw.cared = caRed->getValue();
|
||||||
pp->raw.cablue = caBlue->getValue();
|
pp->raw.cablue = caBlue->getValue();
|
||||||
@ -125,6 +120,21 @@ void RAWCACorr::adjusterChanged (Adjuster* a, double newval)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RAWCACorr::checkBoxToggled (CheckBox* c, CheckValue newval)
|
||||||
|
{
|
||||||
|
if (c == caAutocorrect) {
|
||||||
|
if (!batchMode) {
|
||||||
|
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 ());
|
||||||
|
}
|
||||||
|
if (listener) {
|
||||||
|
listener->panelChanged (EvPreProcessAutoCA, caAutocorrect->get_active() ? M("GENERAL_ENABLED") : M("GENERAL_DISABLED"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RAWCACorr::setBatchMode(bool batchMode)
|
void RAWCACorr::setBatchMode(bool batchMode)
|
||||||
{
|
{
|
||||||
ToolPanel::setBatchMode (batchMode);
|
ToolPanel::setBatchMode (batchMode);
|
||||||
@ -150,52 +160,6 @@ void RAWCACorr::setDefaults(const rtengine::procparams::ProcParams* defParams, c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RAWCACorr::caCorrectionChanged()
|
|
||||||
{
|
|
||||||
if (batchMode) {
|
|
||||||
if (caAutocorrect->get_inconsistent()) {
|
|
||||||
caAutocorrect->set_inconsistent (false);
|
|
||||||
caacsconn.block (true);
|
|
||||||
caAutocorrect->set_active (false);
|
|
||||||
caacsconn.block (false);
|
|
||||||
} else if (lastCA) {
|
|
||||||
caAutocorrect->set_inconsistent (true);
|
|
||||||
}
|
|
||||||
|
|
||||||
lastCA = caAutocorrect->get_active ();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*else {
|
|
||||||
// For non batch mode, we disable the red and blue slider if caAutocorrect is true
|
|
||||||
if (caAutocorrect->get_active ()) {
|
|
||||||
caRed->set_sensitive(false);
|
|
||||||
caBlue->set_sensitive(false);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
caRed->set_sensitive(true);
|
|
||||||
caBlue->set_sensitive(true);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
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 ());
|
|
||||||
|
|
||||||
if (caAutocorrect->get_active ()) {
|
|
||||||
// set caRed and caBlue to 0 as RawImageSource::CA_correct_RT uses this as
|
|
||||||
// a condition for auto-CA correction. Alternative would be to change
|
|
||||||
// RawImageSource::CA_correct_RT and pass it ca_autocorrect value
|
|
||||||
caRed->setValue(0);
|
|
||||||
caBlue->setValue(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (listener) {
|
|
||||||
listener->panelChanged (EvPreProcessAutoCA, caAutocorrect->get_active() ? M("GENERAL_ENABLED") : M("GENERAL_DISABLED"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RAWCACorr::setAdjusterBehavior (bool caadd)
|
void RAWCACorr::setAdjusterBehavior (bool caadd)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -21,19 +21,17 @@
|
|||||||
|
|
||||||
#include <gtkmm.h>
|
#include <gtkmm.h>
|
||||||
#include "adjuster.h"
|
#include "adjuster.h"
|
||||||
|
#include "checkbox.h"
|
||||||
#include "toolpanel.h"
|
#include "toolpanel.h"
|
||||||
#include "../rtengine/rawimage.h"
|
|
||||||
|
|
||||||
class RAWCACorr : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel
|
class RAWCACorr : public ToolParamBlock, public AdjusterListener, public CheckBoxListener, public FoldableToolPanel
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Gtk::CheckButton* caAutocorrect;
|
CheckBox* caAutocorrect;
|
||||||
Adjuster* caStrength;
|
Adjuster* caStrength;
|
||||||
Adjuster* caRed;
|
Adjuster* caRed;
|
||||||
Adjuster* caBlue;
|
Adjuster* caBlue;
|
||||||
bool lastCA;
|
|
||||||
sigc::connection caacsconn;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -47,7 +45,7 @@ public:
|
|||||||
void trimValues (rtengine::procparams::ProcParams* pp);
|
void trimValues (rtengine::procparams::ProcParams* pp);
|
||||||
|
|
||||||
void adjusterChanged (Adjuster* a, double newval);
|
void adjusterChanged (Adjuster* a, double newval);
|
||||||
void caCorrectionChanged ();
|
void checkBoxToggled (CheckBox* c, CheckValue newval);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user