From 6b1e5d6181d809ea9689a2060b626bd6b066afa2 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sat, 30 Jan 2021 07:35:07 +0100 Subject: [PATCH] Ciecam - Take into account issue #6022 choice between classic - symmetric - mixed - for cat02/16 (#6079) * Change mode cat02-16 auto * Change tooltip --- rtdata/languages/default | 12 ++- rtengine/procparams.cc | 4 + rtengine/procparams.h | 1 + rtgui/colorappearance.cc | 162 ++++++++++++++++++++++++++++++++++++++- rtgui/colorappearance.h | 5 +- rtgui/paramsedited.cc | 6 ++ rtgui/paramsedited.h | 1 + 7 files changed, 185 insertions(+), 6 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 3b50d32c8..dd57d7106 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1282,6 +1282,7 @@ HISTORY_MSG_BLSHAPE;Blur by level HISTORY_MSG_BLURCWAV;Blur chroma HISTORY_MSG_BLURWAV;Blur luminance HISTORY_MSG_BLUWAV;Attenuation response +HISTORY_MSG_CATCAT;Cat02/16 mode HISTORY_MSG_CAT02PRESET;Cat02/16 automatic preset HISTORY_MSG_CATCOMPLEX;Ciecam complexity HISTORY_MSG_CATMODEL;CAM Model @@ -2033,6 +2034,11 @@ TP_COLORAPP_BADPIXSL_TOOLTIP;Suppression of hot/bad (brightly colored) pixels.\n TP_COLORAPP_BRIGHT;Brightness (Q) TP_COLORAPP_BRIGHT_TOOLTIP;Brightness in CIECAM02/16 is the amount of perceived light emanating from a stimulus and differs from L*a*b* and RGB brightness. TP_COLORAPP_CAT02ADAPTATION_TOOLTIP;When setting manually, values above 65 are recommended. +TP_COLORAPP_CATMET_TOOLTIP;Classic - traditional CIECAM operation. The chromatic adaptation transforms are applied separately on ‘Scene conditions’ and basic illuminant on the one hand, and on basic illuminant and ‘Viewing conditions’ on the other.\n\nSymmetric – The chromatic adaptation is based on the white balance. The ‘Scene conditions’, ‘Image adjustments’ and ‘Viewing conditions’ settings are neutralized.\n\nMixed – Same as the ‘Classic’ option but in this case, the chromatic adaptation is based on the white balance. +TP_COLORAPP_CATMOD;Cat02/16 mode +TP_COLORAPP_CATCLASSIC;Classic +TP_COLORAPP_CATSYMGEN;Automatic Symmetric +TP_COLORAPP_CATSYMSPE;Mixed TP_COLORAPP_CHROMA;Chroma (C) TP_COLORAPP_CHROMA_M;Colorfulness (M) TP_COLORAPP_CHROMA_M_TOOLTIP;Colorfulness in CIECAM02/16 is the perceived amount of hue in relation to gray, an indicator that a stimulus appears to be more or less colored. @@ -2054,7 +2060,7 @@ TP_COLORAPP_DATACIE;CIECAM02/16 output histograms in curves TP_COLORAPP_DATACIE_TOOLTIP;When enabled, histograms in CIECAM02/16 curves show approximate values/ranges for J or Q, and C, s or M after the CIECAM02/16 adjustments.\nThis selection does not impact the main histogram panel.\n\nWhen disabled, histograms in CIECAM02/16 curves show L*a*b* values before CIECAM02/16 adjustments. TP_COLORAPP_DEGREE_TOOLTIP;CAT02/16 is a chromatic adaptation, it converts the values of an image whose white point is that of a given illuminant (for example D65), into new values whose white point is that of the new illuminant - see WP Model (for example D50 or D55). TP_COLORAPP_DEGREOUT_TOOLTIP;CAT02/16 is a chromatic adaptation, it converts the values of an image whose white point is that of a given illuminant (for example D50), into new values whose white point is that of the new illuminant - see WP model (for example D75). -TP_COLORAPP_FREE;Free temp+green + CAT02/16 + [output] +TP_COLORAPP_FREE;Free temp + tint + CAT02/16 +[output] TP_COLORAPP_GAMUT;Gamut control (L*a*b*) TP_COLORAPP_GAMUT_TOOLTIP;Allow gamut control in L*a*b* mode. TP_COLORAPP_GEN;Settings - Preset @@ -2070,7 +2076,7 @@ TP_COLORAPP_IL75;D75 TP_COLORAPP_ILA;Incandescent StdA 2856K TP_COLORAPP_ILFREE;Free TP_COLORAPP_ILLUM;Illuminant -TP_COLORAPP_ILLUM_TOOLTIP;Select the illuminant closest to the shooting conditions.\nIn general D50, but it can change depending on the time and lattitude. +TP_COLORAPP_ILLUM_TOOLTIP;Select the illuminant closest to the shooting conditions.\nIn general D50, but it can change depending on the time and latitude. TP_COLORAPP_LABEL;Color Appearance & Lighting (CIECAM02/16) TP_COLORAPP_LABEL_CAM02;Image Adjustments TP_COLORAPP_LABEL_SCENE;Scene Conditions @@ -2079,7 +2085,7 @@ TP_COLORAPP_LIGHT;Lightness (J) TP_COLORAPP_LIGHT_TOOLTIP;Lightness in CIECAM02/16 is the clarity of a stimulus relative to the clarity of a stimulus that appears white under similar viewing conditions, differs from L*a*b* and RGB lightness. TP_COLORAPP_MEANLUMINANCE;Mean luminance (Yb%) TP_COLORAPP_MODEL;WP Model -TP_COLORAPP_MODEL_TOOLTIP;White-Point Model.\n\nWB [RT] + [output]: RT's white balance is used for the scene, CIECAM02/16 is set to D50, and the output device's white balance is set in Viewing Conditions.\n\nWB [RT+CAT02/16] + [output]: RT's white balance settings are used by CAT02 and the output device's white balance is set in Viewing Conditions.\n\nFree temp+green + CAT02/16 + [output]: temp and green are selected by the user, the output device's white balance is set in Viewing Conditions. +TP_COLORAPP_MODEL_TOOLTIP;White-Point Model.\n\nWB [RT] + [output]: RT's white balance is used for the scene, CIECAM02/16 is set to D50, and the output device's white balance is set in Viewing Conditions.\n\nWB [RT+CAT02/16] + [output]: RT's white balance settings are used by CAT02 and the output device's white balance is set in Viewing Conditions.\n\nFree temp + tint + CAT02/16 + [output]: temp and tint are selected by the user, the output device's white balance is set in Viewing Conditions. TP_COLORAPP_MODELCAT;CAM Model TP_COLORAPP_MODELCAT_TOOLTIP;Allows you to choose between CIECAM02 or CIECAM16.\n CIECAM02 will sometimes be more accurate.\n CIECAM16 should generate fewer artifacts TP_COLORAPP_MOD02;CIECAM02 diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index e77a4c57a..09c174462 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -1424,6 +1424,7 @@ ColorAppearanceParams::ColorAppearanceParams() : curveMode3(CtcMode::CHROMA), complexmethod("normal"), modelmethod("02"), + catmethod("clas"), surround("Average"), surrsrc("Average"), adapscen(2000.0), @@ -1474,6 +1475,7 @@ bool ColorAppearanceParams::operator ==(const ColorAppearanceParams& other) cons && curveMode3 == other.curveMode3 && complexmethod == other.complexmethod && modelmethod == other.modelmethod + && catmethod == other.catmethod && surround == other.surround && surrsrc == other.surrsrc && adapscen == other.adapscen @@ -5589,6 +5591,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->colorappearance.surround, "Color appearance", "Surround", colorappearance.surround, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.complexmethod, "Color appearance", "complex", colorappearance.complexmethod, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.modelmethod, "Color appearance", "ModelCat", colorappearance.modelmethod, keyFile); + saveToKeyfile(!pedited || pedited->colorappearance.catmethod, "Color appearance", "CatCat", colorappearance.catmethod, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.surrsrc, "Color appearance", "Surrsrc", colorappearance.surrsrc, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.adaplum, "Color appearance", "AdaptLum", colorappearance.adaplum, keyFile); saveToKeyfile(!pedited || pedited->colorappearance.badpixsl, "Color appearance", "Badpixsl", colorappearance.badpixsl, keyFile); @@ -7281,6 +7284,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) pedited->colorappearance.modelmethod = true; } } + assignFromKeyfile(keyFile, "Color appearance", "CatCat", pedited, colorappearance.catmethod, pedited->colorappearance.catmethod); assignFromKeyfile(keyFile, "Color appearance", "Surround", pedited, colorappearance.surround, pedited->colorappearance.surround); assignFromKeyfile(keyFile, "Color appearance", "Surrsrc", pedited, colorappearance.surrsrc, pedited->colorappearance.surrsrc); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 4efe4c2fc..15fb79702 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -674,6 +674,7 @@ struct ColorAppearanceParams { CtcMode curveMode3; Glib::ustring complexmethod; Glib::ustring modelmethod; + Glib::ustring catmethod; Glib::ustring surround; Glib::ustring surrsrc; diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index e2d49a6b4..968d3cc58 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -225,6 +225,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" EvCATillum = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_ILLUM"); EvCATcomplex = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_CATCOMPLEX"); EvCATmodel = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_CATMODEL"); + EvCATcat = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_CATCAT"); //preset button cat02/16 Gtk::Frame *genFrame; Gtk::VBox *genVBox; @@ -255,11 +256,23 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" modelHBox->pack_start(*modelLabel, Gtk::PACK_SHRINK, 4); modelHBox->pack_start(*modelmethod); genVBox->pack_start (*modelHBox, Gtk::PACK_SHRINK); + + catmethod = Gtk::manage (new MyComboBoxText ()); + catmethod->append(M("TP_COLORAPP_CATCLASSIC")); + catmethod->append(M("TP_COLORAPP_CATSYMGEN")); + catmethod->append(M("TP_COLORAPP_CATSYMSPE")); + catmethodconn = catmethod->signal_changed().connect(sigc::mem_fun(*this, &ColorAppearance::catmethodChanged)); + catmethod->set_tooltip_text(M("TP_COLORAPP_CATMET_TOOLTIP")); + Gtk::HBox* const catHBox = Gtk::manage(new Gtk::HBox()); + Gtk::Label* const catLabel = Gtk::manage(new Gtk::Label(M("TP_COLORAPP_CATMOD") + ":")); + catHBox->pack_start(*catLabel, Gtk::PACK_SHRINK, 4); + catHBox->pack_start(*catmethod); + genVBox->pack_start (*catHBox, Gtk::PACK_SHRINK); presetcat02 = Gtk::manage (new Gtk::CheckButton (M ("TP_COLORAPP_PRESETCAT02"))); presetcat02->set_tooltip_markup (M("TP_COLORAPP_PRESETCAT02_TIP")); presetcat02conn = presetcat02->signal_toggled().connect( sigc::mem_fun(*this, &ColorAppearance::presetcat02pressed)); - genVBox->pack_start (*presetcat02, Gtk::PACK_SHRINK); +// genVBox->pack_start (*presetcat02, Gtk::PACK_SHRINK); genFrame->add (*genVBox); pack_start (*genFrame, Gtk::PACK_EXPAND_WIDGET, 4); @@ -859,6 +872,7 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) disableListener (); complexmethodconn.block(true); modelmethodconn.block(true); + catmethodconn.block(true); tcmodeconn.block (true); tcmode2conn.block (true); tcmode3conn.block (true); @@ -923,6 +937,9 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) if (!pedited->colorappearance.modelmethod) { modelmethod->set_active_text(M("GENERAL_UNCHANGED")); } + if (!pedited->colorappearance.catmethod) { + catmethod->set_active_text(M("GENERAL_UNCHANGED")); + } if (!pedited->colorappearance.curveMode2) { toneCurveMode2->set_active (2); @@ -952,6 +969,16 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) modelmethod->set_active(1); } + catmethod->set_active(0); + + if (pp->colorappearance.catmethod == "clas") { + catmethod->set_active(0); + } else if (pp->colorappearance.catmethod == "symg") { + catmethod->set_active(1); + } else if (pp->colorappearance.catmethod == "symc") { + catmethod->set_active(2); + } + surrsrcconn.block (true); if (pedited && !pedited->colorappearance.surrsrc) { @@ -1125,6 +1152,7 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) tcmode3conn.block (false); tcmode2conn.block (false); tcmodeconn.block (false); + catmethodconn.block(false); modelmethodconn.block(false); complexmethodconn.block(false); enableListener (); @@ -1207,6 +1235,7 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) if (pedited) { pedited->colorappearance.complexmethod = complexmethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->colorappearance.modelmethod = modelmethod->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->colorappearance.catmethod = catmethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->colorappearance.degree = degree->getEditedState (); pedited->colorappearance.degreeout = degreeout->getEditedState (); pedited->colorappearance.adapscen = adapscen->getEditedState (); @@ -1266,6 +1295,13 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) pp->colorappearance.modelmethod = "16"; } + if (catmethod->get_active_row_number() == 0) { + pp->colorappearance.catmethod = "clas"; + } else if (catmethod->get_active_row_number() == 1) { + pp->colorappearance.catmethod = "symg"; + } else if (catmethod->get_active_row_number() == 2) { + pp->colorappearance.catmethod = "symc"; + } if (surrsrc->get_active_row_number() == 0) { pp->colorappearance.surrsrc = "Average"; @@ -1366,6 +1402,10 @@ void ColorAppearance::convertParamToNormal() if (presetcat02->get_active ()) { wbmodel->set_active (2); } + if (catmethod->get_active_row_number() == 1 || catmethod->get_active_row_number() == 2) { + wbmodel->set_active (2); + } + greenout->setValue(def_params.greenout); badpixsl->setValue(def_params.badpixsl); @@ -1397,6 +1437,123 @@ void ColorAppearance::modelmethodChanged() } } +void ColorAppearance::catmethodChanged() +{ + + if (catmethod->get_active_row_number() == 1) { + disableListener(); + jlight->resetValue (false); + qbright->resetValue (false); + chroma->resetValue (false); + schroma->resetValue (false); + mchroma->resetValue (false); + rstprotection->resetValue (false); + contrast->resetValue (false); + qcontrast->resetValue (false); + colorh->resetValue (false); + tempout->resetValue (false); + greenout->resetValue (false); + ybout->resetValue (false); + tempsc->resetValue (false); + greensc->resetValue (false); + badpixsl->resetValue (false); + illum->set_active (2); + toneCurveMode->set_active (0); + toneCurveMode2->set_active (0); + toneCurveMode3->set_active (0); + shape->reset(); + shape2->reset(); + shape3->reset(); + gamutconn.block (true); + gamut->set_active (true); + gamutconn.block (false); + degree->setAutoValue (true); + degree->resetValue (false); + degree->setValue(90); + adapscen->resetValue (false); + adapscen->setAutoValue (true); + degreeout->resetValue (false); + degreeout->setAutoValue (true); + ybscen->resetValue (false); + ybscen->setAutoValue (true); + surrsrc->set_active (0); + wbmodel->set_active (2); + tempsc->resetValue (false); + greensc->resetValue (false); + adapscen->setValue(400.); + ybscen->setValue(18); + surround->set_active (0); + adaplum->setValue(400.); + degreeout->setValue(90); + ybout->setValue(18); + tempout->setValue (nexttemp); + +/* if(tempout->getAutoValue()) { + tempout->resetValue (false); + } else { + tempout->setValue (nexttemp); + tempout->setAutoValue (true); + } +*/ + greenout->setValue (nextgreen); + enableListener(); + + } else if (catmethod->get_active_row_number() == 0) { + disableListener(); + degree->setAutoValue (true); + degree->resetValue (false); + adapscen->resetValue (false); + adapscen->setAutoValue (true); + degreeout->resetValue (false); + degreeout->setAutoValue (true); + ybscen->resetValue (false); + ybscen->setAutoValue (true); + surrsrc->set_active (0); + wbmodel->set_active (0); + illum->set_active (2); + tempsc->resetValue (false); + greensc->resetValue (false); + adapscen->resetValue (false); + ybscen->resetValue (false); + surround->set_active (0); + adaplum->resetValue (false); + degreeout->resetValue (false); + ybout->resetValue (false); + tempout->resetValue (false); + greenout->resetValue (false); + enableListener(); + } else if (catmethod->get_active_row_number() == 2) { + disableListener(); + degree->setAutoValue (true); + degree->resetValue (false); + adapscen->resetValue (false); + adapscen->setAutoValue (true); + degreeout->resetValue (false); + degreeout->setAutoValue (true); + ybscen->resetValue (false); + ybscen->setAutoValue (true); + surrsrc->set_active (0); + wbmodel->set_active (2); + illum->set_active (2); + tempsc->resetValue (false); + greensc->resetValue (false); + adapscen->resetValue (false); + ybscen->resetValue (false); + surround->set_active (0); + adaplum->resetValue (false); + degreeout->resetValue (false); + ybout->resetValue (false); + // tempout->resetValue (false); + tempout->setValue (nexttemp); + greenout->resetValue (false); + enableListener(); + } + + if (listener && (multiImage || getEnabled())) { + listener->panelChanged(EvCATcat, catmethod->get_active_text()); + } +} + void ColorAppearance::curveChanged (CurveEditor* ce) { @@ -1548,7 +1705,7 @@ void ColorAppearance::badpix_toggled () { } */ -void ColorAppearance::presetcat02pressed () +void ColorAppearance::presetcat02pressed () //keep in case of... { if (presetcat02->get_active ()) { disableListener(); @@ -2275,6 +2432,7 @@ void ColorAppearance::setBatchMode (bool batchMode) complexmethod->append(M("GENERAL_UNCHANGED")); modelmethod->append(M("GENERAL_UNCHANGED")); + catmethod->append(M("GENERAL_UNCHANGED")); surround->append (M ("GENERAL_UNCHANGED")); surrsrc->append (M ("GENERAL_UNCHANGED")); wbmodel->append (M ("GENERAL_UNCHANGED")); diff --git a/rtgui/colorappearance.h b/rtgui/colorappearance.h index 194916cb0..07ca33b8e 100644 --- a/rtgui/colorappearance.h +++ b/rtgui/colorappearance.h @@ -79,6 +79,7 @@ public: void neutral_pressed (); void complexmethodChanged(); void modelmethodChanged(); + void catmethodChanged(); void convertParamToNormal(); void updateGUIToMode(int mode); @@ -110,6 +111,7 @@ private: rtengine::ProcEvent EvCATillum; rtengine::ProcEvent EvCATcomplex; rtengine::ProcEvent EvCATmodel; + rtengine::ProcEvent EvCATcat; bool bgTTipQuery (int x, int y, bool keyboard_tooltip, const Glib::RefPtr& tooltip); bool srTTipQuery (int x, int y, bool keyboard_tooltip, const Glib::RefPtr& tooltip); void foldAllButMe (GdkEventButton* event, MyExpander *expander); @@ -147,6 +149,7 @@ private: MyComboBoxText* toneCurveMode3; MyComboBoxText* complexmethod; MyComboBoxText* modelmethod; + MyComboBoxText* catmethod; //Adjuster* edge; Gtk::CheckButton* surrsource; @@ -173,7 +176,7 @@ private: sigc::connection surrconn; sigc::connection gamutconn, datacieconn, tonecieconn /*,badpixconn , sharpcieconn*/; sigc::connection tcmodeconn, tcmode2conn, tcmode3conn, neutralconn; - sigc::connection complexmethodconn, modelmethodconn; + sigc::connection complexmethodconn, modelmethodconn, catmethodconn; Gtk::HBox* alHBox; Gtk::HBox* wbmHBox; Gtk::HBox* illumHBox; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 42767391b..f1da3fca6 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -246,6 +246,7 @@ void ParamsEdited::set(bool v) colorappearance.curveMode3 = v; colorappearance.complexmethod = v; colorappearance.modelmethod = v; + colorappearance.catmethod = v; colorappearance.tempout = v; colorappearance.autotempout = v; colorappearance.greenout = v; @@ -918,6 +919,7 @@ void ParamsEdited::initFrom(const std::vector& colorappearance.curveMode3 = colorappearance.curveMode3 && p.colorappearance.curveMode3 == other.colorappearance.curveMode3; colorappearance.complexmethod = colorappearance.complexmethod && p.colorappearance.complexmethod == other.colorappearance.complexmethod; colorappearance.modelmethod = colorappearance.modelmethod && p.colorappearance.modelmethod == other.colorappearance.modelmethod; + colorappearance.catmethod = colorappearance.catmethod && p.colorappearance.catmethod == other.colorappearance.catmethod; colorappearance.tempout = colorappearance.tempout && p.colorappearance.tempout == other.colorappearance.tempout; colorappearance.autotempout = colorappearance.autotempout && p.colorappearance.autotempout == other.colorappearance.autotempout; colorappearance.greenout = colorappearance.greenout && p.colorappearance.greenout == other.colorappearance.greenout; @@ -2696,6 +2698,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.colorappearance.modelmethod = mods.colorappearance.modelmethod; } + if (colorappearance.catmethod) { + toEdit.colorappearance.catmethod = mods.colorappearance.catmethod; + } + if (colorappearance.enabled) { toEdit.colorappearance.enabled = mods.colorappearance.enabled; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 75893792a..f5e547fa5 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -268,6 +268,7 @@ struct ColorAppearanceParamsEdited { bool curveMode3; bool complexmethod; bool modelmethod; + bool catmethod; bool enabled; bool degree; bool autodegree;