Added 4-pass xtrans demosaic

This commit is contained in:
heckflosse
2018-06-03 16:22:34 +02:00
parent 80d25fdcc6
commit c3f163a323
13 changed files with 203 additions and 79 deletions

View File

@@ -16,6 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include "eventmapper.h"
#include "xtransprocess.h"
#include "options.h"
#include "guiutils.h"
@@ -25,6 +26,9 @@ using namespace rtengine::procparams;
XTransProcess::XTransProcess () : FoldableToolPanel(this, "xtransprocess", M("TP_RAW_LABEL"), true)
{
auto m = ProcEventMapper::getInstance();
EvDemosaicContrast = m->newEvent(DEMOSAIC, "HISTORY_MSG_DUALDEMOSAIC_CONTRAST");
Gtk::HBox* hb1 = Gtk::manage (new Gtk::HBox ());
hb1->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_DMETHOD") + ": ")), Gtk::PACK_SHRINK, 4);
method = Gtk::manage (new MyComboBoxText ());
@@ -63,6 +67,20 @@ XTransProcess::XTransProcess () : FoldableToolPanel(this, "xtransprocess", M("TP
hb1->pack_end (*method, Gtk::PACK_EXPAND_WIDGET, 4);
pack_start( *hb1, Gtk::PACK_SHRINK, 4);
dualDemosaicOptions = Gtk::manage (new Gtk::VBox ());
dualDemosaicContrast = Gtk::manage(new Adjuster (M("TP_RAW_DUALDEMOSAICCONTRAST"), 0, 200, 1, 20));
dualDemosaicContrast->setAdjusterListener (this);
// dualDemosaicContrast->set_tooltip_markup (M("TP_RAW_LMMSE_TOOLTIP"));
if (dualDemosaicContrast->delay < options.adjusterMaxDelay) {
dualDemosaicContrast->delay = options.adjusterMaxDelay;
}
dualDemosaicContrast->show();
dualDemosaicOptions->pack_start(*dualDemosaicContrast);
pack_start( *dualDemosaicOptions, Gtk::PACK_SHRINK, 4);
pack_start( *Gtk::manage( new Gtk::HSeparator()), Gtk::PACK_SHRINK, 0 );
ccSteps = Gtk::manage (new Adjuster (M("TP_RAW_FALSECOLOR"), 0, 5, 1, 0 ));
ccSteps->setAdjusterListener (this);
@@ -91,14 +109,18 @@ void XTransProcess::read(const rtengine::procparams::ProcParams* pp, const Param
}
if(pedited ) {
dualDemosaicContrast->setEditedState ( pedited->raw.xtranssensor.dualDemosaicContrast ? Edited : UnEdited);
ccSteps->setEditedState (pedited->raw.xtranssensor.ccSteps ? Edited : UnEdited);
if( !pedited->raw.xtranssensor.method ) {
method->set_active_text(M("GENERAL_UNCHANGED"));
}
}
dualDemosaicContrast->setValue (pp->raw.xtranssensor.dualDemosaicContrast);
ccSteps->setValue (pp->raw.xtranssensor.ccSteps);
if (!batchMode) {
dualDemosaicOptions->set_visible(pp->raw.xtranssensor.method == procparams::RAWParams::XTransSensor::getMethodString(procparams::RAWParams::XTransSensor::Method::FOUR_PASS));
}
methodconn.block (false);
@@ -107,6 +129,7 @@ void XTransProcess::read(const rtengine::procparams::ProcParams* pp, const Param
void XTransProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited)
{
pp->raw.xtranssensor.dualDemosaicContrast = dualDemosaicContrast->getValue();
pp->raw.xtranssensor.ccSteps = ccSteps->getIntValue();
int currentRow = method->get_active_row_number();
@@ -117,12 +140,14 @@ void XTransProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* p
if (pedited) {
pedited->raw.xtranssensor.method = method->get_active_text() != M("GENERAL_UNCHANGED");
pedited->raw.xtranssensor.dualDemosaicContrast = dualDemosaicContrast->getEditedState ();
pedited->raw.xtranssensor.ccSteps = ccSteps->getEditedState ();
}
}
void XTransProcess::setAdjusterBehavior (bool falsecoloradd)
void XTransProcess::setAdjusterBehavior (bool falsecoloradd, bool dualDemosaicContrastAdd)
{
dualDemosaicContrast->setAddMode(dualDemosaicContrastAdd);
ccSteps->setAddMode(falsecoloradd);
}
@@ -131,16 +156,20 @@ void XTransProcess::setBatchMode(bool batchMode)
method->append (M("GENERAL_UNCHANGED"));
method->set_active_text(M("GENERAL_UNCHANGED"));
ToolPanel::setBatchMode (batchMode);
dualDemosaicContrast->showEditedCB ();
ccSteps->showEditedCB ();
}
void XTransProcess::setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited)
{
dualDemosaicContrast->setDefault( defParams->raw.xtranssensor.dualDemosaicContrast);
ccSteps->setDefault (defParams->raw.xtranssensor.ccSteps);
if (pedited) {
dualDemosaicContrast->setDefaultEditedState( pedited->raw.xtranssensor.dualDemosaicContrast ? Edited : UnEdited);
ccSteps->setDefaultEditedState(pedited->raw.xtranssensor.ccSteps ? Edited : UnEdited);
} else {
dualDemosaicContrast->setDefaultEditedState(Irrelevant );
ccSteps->setDefaultEditedState(Irrelevant );
}
}
@@ -150,6 +179,8 @@ void XTransProcess::adjusterChanged (Adjuster* a, double newval)
if (listener) {
if (a == ccSteps) {
listener->panelChanged (EvDemosaicFalseColorIter, a->getTextValue() );
} else if (a == dualDemosaicContrast) {
listener->panelChanged (EvDemosaicContrast, a->getTextValue() );
}
}
}
@@ -161,6 +192,14 @@ void XTransProcess::methodChanged ()
oldSelection = curSelection;
if (!batchMode) {
if (currentMethod == procparams::RAWParams::XTransSensor::Method::FOUR_PASS) {
dualDemosaicOptions->show();
} else {
dualDemosaicOptions->hide();
}
}
if (listener && method->get_active_row_number() >= 0) {
listener->panelChanged (
currentMethod == RAWParams::XTransSensor::Method::MONO || RAWParams::XTransSensor::Method(oldSelection) == RAWParams::XTransSensor::Method::MONO