New highlight recovery tool, including highlight recovery threshold.

This commit is contained in:
Emil Martinec
2011-01-05 20:11:32 -06:00
parent 13dc744e9b
commit ac9f1c7b09
19 changed files with 110 additions and 416 deletions

View File

@@ -24,8 +24,12 @@
#define ADDSET_VIGN_AMOUNT 20
#define ADDSET_LC_SATURATION 21
#define ADDSET_TC_SATURATION 22
#define ADDSET_TC_HLCOMPAMOUNT 23
#define ADDSET_TC_HLCOMPTHRESH 24
#define ADDSET_TC_SHCOMP 25
// When adding items, make sure to update ADDSET_PARAM_NUM
#define ADDSET_PARAM_NUM 23 // THIS IS USED AS A DELIMITER!!
#define ADDSET_PARAM_NUM 26 // THIS IS USED AS A DELIMITER!!
#endif

View File

@@ -120,7 +120,7 @@ void BatchToolPanelCoordinator::initSession () {
pparams = selected[0]->getProcParams ();
coarse->initBatchBehavior ();
curve->setAdjusterBehavior (options.baBehav[ADDSET_TC_EXPCOMP], options.baBehav[ADDSET_TC_BRIGHTNESS], options.baBehav[ADDSET_TC_BLACKLEVEL], options.baBehav[ADDSET_TC_CONTRAST], options.baBehav[ADDSET_TC_SATURATION]);
curve->setAdjusterBehavior (options.baBehav[ADDSET_TC_EXPCOMP], options.baBehav[ADDSET_TC_HLCOMPAMOUNT],options.baBehav[ADDSET_TC_HLCOMPTHRESH], options.baBehav[ADDSET_TC_BRIGHTNESS], options.baBehav[ADDSET_TC_BLACKLEVEL],options.baBehav[ADDSET_TC_SHCOMP], options.baBehav[ADDSET_TC_CONTRAST], options.baBehav[ADDSET_TC_SATURATION]);
lcurve->setAdjusterBehavior (options.baBehav[ADDSET_LC_BRIGHTNESS], options.baBehav[ADDSET_LC_CONTRAST], options.baBehav[ADDSET_LC_SATURATION]);
whitebalance->setAdjusterBehavior (options.baBehav[ADDSET_WB_TEMPERATURE], options.baBehav[ADDSET_WB_GREEN]);
vignetting->setAdjusterBehavior (options.baBehav[ADDSET_VIGN_AMOUNT]);
@@ -135,8 +135,11 @@ void BatchToolPanelCoordinator::initSession () {
shadowshighlights->setAdjusterBehavior (options.baBehav[ADDSET_SH_HIGHLIGHTS], options.baBehav[ADDSET_SH_SHADOWS], options.baBehav[ADDSET_SH_LOCALCONTRAST]);
if (options.baBehav[ADDSET_TC_EXPCOMP]) pparams.toneCurve.expcomp = 0;
if (options.baBehav[ADDSET_TC_HLCOMPAMOUNT]) pparams.toneCurve.hlcompr = 0;
if (options.baBehav[ADDSET_TC_HLCOMPTHRESH]) pparams.toneCurve.hlcomprthresh = 0;
if (options.baBehav[ADDSET_TC_BRIGHTNESS]) pparams.toneCurve.brightness = 0;
if (options.baBehav[ADDSET_TC_BLACKLEVEL]) pparams.toneCurve.black = 0;
if (options.baBehav[ADDSET_TC_SHCOMP]) pparams.toneCurve.shcompr = 0;
if (options.baBehav[ADDSET_TC_CONTRAST]) pparams.toneCurve.contrast = 0;
if (options.baBehav[ADDSET_SH_HIGHLIGHTS]) pparams.sh.highlights = 0;

View File

@@ -35,6 +35,7 @@ void ParamsEdited::set (bool v) {
toneCurve.saturation = v;
toneCurve.shcompr = v;
toneCurve.hlcompr = v;
toneCurve.hlcomprthresh = v;
toneCurve.autoexp = v;
toneCurve.clip = v;
toneCurve.expcomp = v;
@@ -177,6 +178,7 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
toneCurve.saturation = toneCurve.saturation && p.toneCurve.saturation == other.toneCurve.saturation;
toneCurve.shcompr = toneCurve.shcompr && p.toneCurve.shcompr == other.toneCurve.shcompr;
toneCurve.hlcompr = toneCurve.hlcompr && p.toneCurve.hlcompr == other.toneCurve.hlcompr;
toneCurve.hlcomprthresh = toneCurve.hlcomprthresh && p.toneCurve.hlcomprthresh == other.toneCurve.hlcomprthresh;
toneCurve.autoexp = toneCurve.autoexp && p.toneCurve.autoexp == other.toneCurve.autoexp;
toneCurve.clip = toneCurve.clip && p.toneCurve.clip == other.toneCurve.clip;
toneCurve.expcomp = toneCurve.expcomp && p.toneCurve.expcomp == other.toneCurve.expcomp;
@@ -322,12 +324,13 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
if (toneCurve.brightness) toEdit.toneCurve.brightness = options.baBehav[ADDSET_TC_BRIGHTNESS] ? toEdit.toneCurve.brightness + mods.toneCurve.brightness : mods.toneCurve.brightness;
if (toneCurve.black) toEdit.toneCurve.black = options.baBehav[ADDSET_TC_BLACKLEVEL] ? toEdit.toneCurve.black + mods.toneCurve.black : mods.toneCurve.black;
if (toneCurve.contrast) toEdit.toneCurve.contrast = options.baBehav[ADDSET_TC_CONTRAST] ? toEdit.toneCurve.contrast + mods.toneCurve.contrast : mods.toneCurve.contrast;
if (toneCurve.saturation) toEdit.toneCurve.saturation = options.baBehav[ADDSET_TC_SATURATION] ? toEdit.toneCurve.saturation + mods.toneCurve.saturation : mods.toneCurve.saturation;
if (toneCurve.shcompr) toEdit.toneCurve.shcompr = mods.toneCurve.shcompr;
if (toneCurve.hlcompr) toEdit.toneCurve.hlcompr = mods.toneCurve.hlcompr;
if (toneCurve.saturation) toEdit.toneCurve.saturation = options.baBehav[ADDSET_TC_SATURATION] ? toEdit.toneCurve.saturation + mods.toneCurve.saturation : mods.toneCurve.saturation;
if (toneCurve.shcompr) toEdit.toneCurve.shcompr = options.baBehav[ADDSET_TC_SHCOMP] ? toEdit.toneCurve.shcompr + mods.toneCurve.shcompr : mods.toneCurve.shcompr;
if (toneCurve.autoexp) toEdit.toneCurve.autoexp = mods.toneCurve.autoexp;
if (toneCurve.clip) toEdit.toneCurve.clip = mods.toneCurve.clip;
if (toneCurve.expcomp) toEdit.toneCurve.expcomp = options.baBehav[ADDSET_TC_EXPCOMP] ? toEdit.toneCurve.expcomp + mods.toneCurve.expcomp : mods.toneCurve.expcomp;
if (toneCurve.hlcompr) toEdit.toneCurve.hlcompr = options.baBehav[ADDSET_TC_HLCOMPAMOUNT] ? toEdit.toneCurve.hlcompr + mods.toneCurve.hlcompr : mods.toneCurve.hlcompr;
if (toneCurve.hlcomprthresh) toEdit.toneCurve.hlcomprthresh = options.baBehav[ADDSET_TC_HLCOMPTHRESH] ? toEdit.toneCurve.hlcomprthresh + mods.toneCurve.hlcomprthresh : mods.toneCurve.hlcomprthresh;
if (labCurve.lcurve) toEdit.labCurve.lcurve = mods.labCurve.lcurve;
if (labCurve.acurve) toEdit.labCurve.acurve = mods.labCurve.acurve;
if (labCurve.bcurve) toEdit.labCurve.bcurve = mods.labCurve.bcurve;

View File

@@ -34,6 +34,7 @@ class ToneCurveParamsEdited {
bool saturation;
bool shcompr;
bool hlcompr;
bool hlcomprthresh;
bool autoexp;
bool clip;
bool expcomp;

View File

@@ -133,8 +133,11 @@ Gtk::Widget* Preferences::getBatchProcPanel () {
mi = behModel->append ();
mi->set_value (behavColumns.label, M("TP_EXPOSURE_LABEL"));
appendBehavList (mi, M("TP_EXPOSURE_EXPCOMP"), ADDSET_TC_EXPCOMP, false);
appendBehavList (mi, M("TP_EXPOSURE_BRIGHTNESS"), ADDSET_TC_BRIGHTNESS, false);
appendBehavList (mi, M("TP_EXPOSURE_COMPRHIGHLIGHTS"), ADDSET_TC_HLCOMPAMOUNT, false);
appendBehavList (mi, M("TP_EXPOSURE_COMPRHIGHLIGHTSTHRESHOLD"), ADDSET_TC_HLCOMPTHRESH, false);
appendBehavList (mi, M("TP_EXPOSURE_BLACKLEVEL"), ADDSET_TC_BLACKLEVEL, false);
appendBehavList (mi, M("TP_EXPOSURE_COMPRSHADOWS"), ADDSET_TC_SHCOMP, false);
appendBehavList (mi, M("TP_EXPOSURE_BRIGHTNESS"), ADDSET_TC_BRIGHTNESS, false);
appendBehavList (mi, M("TP_EXPOSURE_CONTRAST"), ADDSET_TC_CONTRAST, false);
appendBehavList (mi, M("TP_EXPOSURE_SATURATION"), ADDSET_TC_SATURATION, false);

View File

@@ -25,7 +25,7 @@
using namespace rtengine;
using namespace rtengine::procparams;
ToneCurve::ToneCurve () : ToolPanel(), expAdd(false), blackAdd(false), brAdd(false), contrAdd(false) {
ToneCurve::ToneCurve () : ToolPanel(), expAdd(false),hlcompAdd(false),hlcompthreshAdd(false), blackAdd(false), shcompAdd(false), brAdd(false), contrAdd(false) {
//----------- Auto Levels ----------------------------------
abox = Gtk::manage (new Gtk::HBox ());
@@ -53,6 +53,8 @@ ToneCurve::ToneCurve () : ToolPanel(), expAdd(false), blackAdd(false), brAdd(fal
pack_start (*expcomp);
hlcompr = Gtk::manage (new Adjuster (M("TP_EXPOSURE_COMPRHIGHLIGHTS"), 0, 100, 1, 70));
pack_start (*hlcompr);
hlcomprthresh = Gtk::manage (new Adjuster (M("TP_EXPOSURE_COMPRHIGHLIGHTSTHRESHOLD"), 0, 100, 1, 0));
pack_start (*hlcomprthresh);
//----------- Black Level ----------------------------------
black = Gtk::manage (new Adjuster (M("TP_EXPOSURE_BLACKLEVEL"), -16384, 32768, 1, 0));
@@ -90,6 +92,7 @@ ToneCurve::ToneCurve () : ToolPanel(), expAdd(false), blackAdd(false), brAdd(fal
brightness->setAdjusterListener (this);
black->setAdjusterListener (this);
hlcompr->setAdjusterListener (this);
hlcomprthresh->setAdjusterListener (this);
shcompr->setAdjusterListener (this);
contrast->setAdjusterListener (this);
saturation->setAdjusterListener (this);
@@ -103,6 +106,7 @@ void ToneCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
expcomp->setEditedState (pedited->toneCurve.expcomp ? Edited : UnEdited);
black->setEditedState (pedited->toneCurve.black ? Edited : UnEdited);
hlcompr->setEditedState (pedited->toneCurve.hlcompr ? Edited : UnEdited);
hlcomprthresh->setEditedState (pedited->toneCurve.hlcomprthresh ? Edited : UnEdited);
shcompr->setEditedState (pedited->toneCurve.shcompr ? Edited : UnEdited);
brightness->setEditedState (pedited->toneCurve.brightness ? Edited : UnEdited);
contrast->setEditedState (pedited->toneCurve.contrast ? Edited : UnEdited);
@@ -121,6 +125,7 @@ void ToneCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
expcomp->setValue (pp->toneCurve.expcomp);
black->setValue (pp->toneCurve.black);
hlcompr->setValue (pp->toneCurve.hlcompr);
hlcomprthresh->setValue (pp->toneCurve.hlcomprthresh);
shcompr->setValue (pp->toneCurve.shcompr);
brightness->setValue (pp->toneCurve.brightness);
contrast->setValue (pp->toneCurve.contrast);
@@ -137,6 +142,7 @@ void ToneCurve::write (ProcParams* pp, ParamsEdited* pedited) {
pp->toneCurve.expcomp = expcomp->getValue ();
pp->toneCurve.black = (int)black->getValue ();
pp->toneCurve.hlcompr = (int)hlcompr->getValue ();
pp->toneCurve.hlcomprthresh = (int)hlcomprthresh->getValue ();
pp->toneCurve.shcompr = (int)shcompr->getValue ();
pp->toneCurve.brightness = (int)brightness->getValue ();
pp->toneCurve.contrast = (int)contrast->getValue ();
@@ -147,6 +153,7 @@ void ToneCurve::write (ProcParams* pp, ParamsEdited* pedited) {
pedited->toneCurve.expcomp = expcomp->getEditedState ();
pedited->toneCurve.black = black->getEditedState ();
pedited->toneCurve.hlcompr = hlcompr->getEditedState ();
pedited->toneCurve.hlcomprthresh = hlcomprthresh->getEditedState ();
pedited->toneCurve.shcompr = shcompr->getEditedState ();
pedited->toneCurve.brightness = brightness->getEditedState ();
pedited->toneCurve.contrast = contrast->getEditedState ();
@@ -163,6 +170,7 @@ void ToneCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pe
brightness->setDefault (defParams->toneCurve.brightness);
black->setDefault (defParams->toneCurve.black);
hlcompr->setDefault (defParams->toneCurve.hlcompr);
hlcomprthresh->setDefault (defParams->toneCurve.hlcomprthresh);
shcompr->setDefault (defParams->toneCurve.shcompr);
contrast->setDefault (defParams->toneCurve.contrast);
saturation->setDefault (defParams->toneCurve.saturation);
@@ -171,6 +179,7 @@ void ToneCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pe
expcomp->setDefaultEditedState (pedited->toneCurve.expcomp ? Edited : UnEdited);
black->setDefaultEditedState (pedited->toneCurve.black ? Edited : UnEdited);
hlcompr->setDefaultEditedState (pedited->toneCurve.hlcompr ? Edited : UnEdited);
hlcomprthresh->setDefaultEditedState (pedited->toneCurve.hlcomprthresh ? Edited : UnEdited);
shcompr->setDefaultEditedState (pedited->toneCurve.shcompr ? Edited : UnEdited);
brightness->setDefaultEditedState (pedited->toneCurve.brightness ? Edited : UnEdited);
contrast->setDefaultEditedState (pedited->toneCurve.contrast ? Edited : UnEdited);
@@ -180,6 +189,7 @@ void ToneCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pe
expcomp->setDefaultEditedState (Irrelevant);
black->setDefaultEditedState (Irrelevant);
hlcompr->setDefaultEditedState (Irrelevant);
hlcomprthresh->setDefaultEditedState (Irrelevant);
shcompr->setDefaultEditedState (Irrelevant);
brightness->setDefaultEditedState (Irrelevant);
contrast->setDefaultEditedState (Irrelevant);
@@ -196,7 +206,7 @@ void ToneCurve::curveChanged () {
void ToneCurve::adjusterChanged (Adjuster* a, double newval) {
if (autolevels->get_active() && (a==expcomp || a==black || a==hlcompr || a==shcompr)) {
if (autolevels->get_active() && (a==expcomp || a==black || a==hlcompr || a==hlcomprthresh || a==shcompr)) {
autolevels->set_active (false);
autolevels->set_inconsistent (false);
}
@@ -220,8 +230,8 @@ void ToneCurve::adjusterChanged (Adjuster* a, double newval) {
listener->panelChanged (EvContrast, costr);
else if (a==saturation)
listener->panelChanged (EvSaturation, costr);
else if (a==hlcompr)
listener->panelChanged (EvHLCompr, costr);
else if (a==hlcompr || a==hlcomprthresh)
listener->panelChanged (EvHLCompr, Glib::ustring::compose ("%1=%2\n%3=%4",M("TP_EXPOSURE_COMPRHIGHLIGHTS"),(int)hlcompr->getValue(),M("TP_EXPOSURE_COMPRHIGHLIGHTSTHRESHOLD"),(int)hlcomprthresh->getValue()));
else if (a==shcompr)
listener->panelChanged (EvSHCompr, costr);
}
@@ -281,6 +291,7 @@ void ToneCurve::waitForAutoExp () {
brightness->setEnabled (false);
black->setEnabled (false);
hlcompr->setEnabled (false);
hlcomprthresh->setEnabled (false);
shcompr->setEnabled (false);
contrast->setEnabled (false);
saturation->setEnabled (false);
@@ -311,6 +322,7 @@ void ToneCurve::enableAll () {
brightness->setEnabled (true);
black->setEnabled (true);
hlcompr->setEnabled (true);
hlcomprthresh->setEnabled (true);
shcompr->setEnabled (true);
contrast->setEnabled (true);
saturation->setEnabled (true);
@@ -339,6 +351,7 @@ void ToneCurve::setBatchMode (bool batchMode) {
expcomp->showEditedCB ();
black->showEditedCB ();
hlcompr->showEditedCB ();
hlcomprthresh->showEditedCB ();
shcompr->showEditedCB ();
brightness->showEditedCB ();
contrast->showEditedCB ();
@@ -347,14 +360,20 @@ void ToneCurve::setBatchMode (bool batchMode) {
curveEditorG->setBatchMode (batchMode);
}
void ToneCurve::setAdjusterBehavior (bool expadd, bool bradd, bool blackadd, bool contradd, bool satadd) {
void ToneCurve::setAdjusterBehavior (bool expadd, bool hlcompadd, bool hlcompthreshadd, bool bradd, bool blackadd, bool shcompadd, bool contradd, bool satadd) {
if ((!expAdd && expadd) || (expAdd && !expadd))
expcomp->setLimits (-5, 5, 0.01, 0);
if ((!hlcompAdd && hlcompadd) || (hlcompAdd && !hlcompadd))
hlcompr->setLimits (0, 100, 1, 0);
if ((!hlcompthreshAdd && hlcompthreshadd) || (hlcompthreshAdd && !hlcompthreshadd))
hlcomprthresh->setLimits (0, 100, 1, 0);
if (!blackAdd && blackadd)
black->setLimits (0, 16384, 1, 0);
else if (blackAdd && !blackadd)
black->setLimits (0, 32768, 1, 0);
if ((!shcompAdd && shcompadd) || (shcompAdd && !shcompadd))
shcompr->setLimits (0, 100, 1, 0);
if ((!brAdd && bradd) || (brAdd && !bradd))
brightness->setLimits (-100, 100, 1, 0);
if ((!contrAdd && contradd) || (contrAdd && !contradd))
@@ -363,7 +382,10 @@ void ToneCurve::setAdjusterBehavior (bool expadd, bool bradd, bool blackadd, boo
saturation->setLimits (-100, 100, 1, 0);
expAdd = expadd;
hlcompAdd = hlcompadd;
hlcompthreshAdd = hlcompthreshadd;
blackAdd = blackadd;
shcompAdd = shcompadd;
brAdd = bradd;
contrAdd = contradd;
satAdd = satadd;

View File

@@ -36,11 +36,12 @@ class ToneCurve : public Gtk::VBox, public AdjusterListener, public ToolPanel, p
Adjuster* brightness;
Adjuster* black;
Adjuster* hlcompr;
Adjuster* hlcomprthresh;
Adjuster* shcompr;
Adjuster* contrast;
Adjuster* saturation;
bool expAdd, blackAdd, brAdd, contrAdd, satAdd, clipDirty, lastAuto;
bool expAdd,hlcompAdd,hlcompthreshAdd, blackAdd, shcompAdd, brAdd, contrAdd, satAdd, clipDirty, lastAuto;
sigc::connection autoconn;
CurveEditorGroup* curveEditorG;
CurveEditor* shape;
@@ -55,7 +56,7 @@ class ToneCurve : public Gtk::VBox, public AdjusterListener, public ToolPanel, p
void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited=NULL);
void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL);
void setBatchMode (bool batchMode);
void setAdjusterBehavior (bool expadd, bool bradd, bool blackadd, bool contradd, bool satadd);
void setAdjusterBehavior (bool expadd, bool hlcompadd, bool hlcompthreshadd, bool bradd, bool blackadd, bool shcompadd, bool contradd, bool satadd);
void adjusterChanged (Adjuster* a, double newval);
void autolevels_toggled ();