Abstract profile - Gamut improvment (#6665)

* Gamut control when the chosen primaries are different from working profile

* Gamut control abstract

* Gamut label and history

* Change to Wx Wz

* Fixed crash if y primaries are set to zero

* Fomated with Astylert ImProcFunctions::workingtrc and Color::primaries_to_xyz

* Fixed black becomes green wit gamt abstract profile

* Harmonize types in color.cc

* Try to fix Multiplication result converted to larger type
This commit is contained in:
Desmis
2023-01-24 14:29:50 +01:00
committed by GitHub
parent 21afbaf90b
commit 7afdfc1e2b
10 changed files with 415 additions and 51 deletions

View File

@@ -62,6 +62,7 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha
EvICMpreser = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_ICM_PRESER");
EvICMLabGridciexy = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_ICL_LABGRIDCIEXY");
EvICMfbw = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_ICM_FBW");
EvICMgamut = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_ICM_GAMUT");
isBatchMode = lastToneCurve = lastApplyLookTable = lastApplyBaselineExposureOffset = lastApplyHueSatMap = false;
ipDialog = Gtk::manage(new MyFileChooserButton(M("TP_ICM_INPUTDLGLABEL"), Gtk::FILE_CHOOSER_ACTION_OPEN));
@@ -263,8 +264,12 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha
wprimBox->pack_start(*wprim, Gtk::PACK_EXPAND_WIDGET);
fbw = Gtk::manage(new Gtk::CheckButton((M("TP_ICM_FBW"))));
fbw->set_active(true);
gamut = Gtk::manage(new Gtk::CheckButton((M("TP_ICM_GAMUT"))));
gamut->set_active(false);
trcProfVBox->pack_start(*wprimBox, Gtk::PACK_EXPAND_WIDGET);
trcProfVBox->pack_start(*fbw, Gtk::PACK_EXPAND_WIDGET);
trcProfVBox->pack_start(*gamut, Gtk::PACK_EXPAND_WIDGET);
neutral = Gtk::manage (new Gtk::Button (M ("TP_ICM_NEUTRAL")));
setExpandAlignProperties (neutral, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START);
@@ -468,6 +473,7 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha
wprimconn = wprim->signal_changed().connect(sigc::mem_fun(*this, &ICMPanel::wprimChanged));
fbwconn = fbw->signal_toggled().connect(sigc::mem_fun(*this, &ICMPanel::fbwChanged));
gamutconn = gamut->signal_toggled().connect(sigc::mem_fun(*this, &ICMPanel::gamutChanged));
obpcconn = obpc->signal_toggled().connect(sigc::mem_fun(*this, &ICMPanel::oBPCChanged));
tcurveconn = ckbToneCurve->signal_toggled().connect(sigc::mem_fun(*this, &ICMPanel::toneCurveChanged));
ltableconn = ckbApplyLookTable->signal_toggled().connect(sigc::mem_fun(*this, &ICMPanel::applyLookTableChanged));
@@ -513,6 +519,7 @@ void ICMPanel::neutral_pressed ()
wSlope->setValue(defPar.workingTRCSlope);//12.92
preser->setValue(defPar.preser);
fbw->set_active(defPar.fbw);
gamut->set_active(defPar.gamut);
wTRC->set_active(toUnderlying(ColorManagementParams::WorkingTrc::NONE));//reset to none
will->set_active(toUnderlying(ColorManagementParams::Illuminant::DEFAULT));//reset to default - after wprim
}
@@ -765,6 +772,7 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
ConnectionBlocker obpcconn_(obpcconn);
ConnectionBlocker fbwconn_(fbwconn);
ConnectionBlocker gamutconn_(gamutconn);
ConnectionBlocker ipc_(ipc);
ConnectionBlocker tcurveconn_(tcurveconn);
ConnectionBlocker ltableconn_(ltableconn);
@@ -838,6 +846,7 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
obpc->set_active(pp->icm.outputBPC);
fbw->set_active(pp->icm.fbw);
gamut->set_active(pp->icm.gamut);
ckbToneCurve->set_active(pp->icm.toneCurve);
lastToneCurve = pp->icm.toneCurve;
ckbApplyLookTable->set_active(pp->icm.applyLookTable);
@@ -862,6 +871,7 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
iunchanged->set_active(!pedited->icm.inputProfile);
obpc->set_inconsistent(!pedited->icm.outputBPC);
fbw->set_inconsistent(!pedited->icm.fbw);
gamut->set_inconsistent(!pedited->icm.gamut);
ckbToneCurve->set_inconsistent(!pedited->icm.toneCurve);
ckbApplyLookTable->set_inconsistent(!pedited->icm.applyLookTable);
ckbApplyBaselineExposureOffset->set_inconsistent(!pedited->icm.applyBaselineExposureOffset);
@@ -920,6 +930,7 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
willulab->set_sensitive(false);
wprim->set_sensitive(false);
fbw->set_sensitive(false);
gamut->set_sensitive(false);
wprimlab->set_sensitive(false);
riaHBox->set_sensitive(false);
redFrame->hide();
@@ -931,6 +942,7 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
willulab->set_sensitive(true);
wprim->set_sensitive(true);
fbw->set_sensitive(true);
gamut->set_sensitive(true);
wprimlab->set_sensitive(true);
if (ColorManagementParams::Primaries(wprim->get_active_row_number()) == ColorManagementParams::Primaries::DEFAULT) {
redFrame->hide();
@@ -973,6 +985,7 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
willulab->set_sensitive(true);
wprim->set_sensitive(true);
fbw->set_sensitive(true);
gamut->set_sensitive(true);
wprimlab->set_sensitive(true);
wGamma->set_sensitive(false);
wSlope->set_sensitive(false);
@@ -990,6 +1003,7 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
willulab->set_sensitive(true);
wprim->set_sensitive(true);
fbw->set_sensitive(true);
gamut->set_sensitive(true);
wprimlab->set_sensitive(true);
wGamma->set_sensitive(false);
wSlope->set_sensitive(false);
@@ -1007,6 +1021,7 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
willulab->set_sensitive(true);
wprim->set_sensitive(true);
fbw->set_sensitive(true);
gamut->set_sensitive(true);
wprimlab->set_sensitive(true);
redFrame->show();
wGamma->set_sensitive(false);
@@ -1025,6 +1040,7 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
willulab->set_sensitive(true);
wprim->set_sensitive(true);
fbw->set_sensitive(true);
gamut->set_sensitive(true);
wprimlab->set_sensitive(true);
riaHBox->set_sensitive(true);
if (ColorManagementParams::Primaries(wprim->get_active_row_number()) == ColorManagementParams::Primaries::DEFAULT) {
@@ -1042,6 +1058,7 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
willulab->set_sensitive(true);
wprim->set_sensitive(true);
fbw->set_sensitive(true);
gamut->set_sensitive(true);
wprimlab->set_sensitive(true);
wGamma->set_sensitive(false);
wSlope->set_sensitive(false);
@@ -1143,6 +1160,7 @@ void ICMPanel::write(ProcParams* pp, ParamsEdited* pedited)
pp->icm.applyHueSatMap = ckbApplyHueSatMap->get_active();
pp->icm.outputBPC = obpc->get_active();
pp->icm.fbw = fbw->get_active();
pp->icm.gamut = gamut->get_active();
pp->icm.workingTRCGamma = wGamma->getValue();
pp->icm.workingTRCSlope = wSlope->getValue();
pp->icm.redx = redx->getValue();
@@ -1162,6 +1180,7 @@ void ICMPanel::write(ProcParams* pp, ParamsEdited* pedited)
pedited->icm.aRendIntent = aRendIntent->getSelected() < 4;
pedited->icm.outputBPC = !obpc->get_inconsistent();
pedited->icm.fbw = !fbw->get_inconsistent();
pedited->icm.gamut = !gamut->get_inconsistent();
pedited->icm.dcpIlluminant = dcpIll->get_active_text() != M("GENERAL_UNCHANGED");
pedited->icm.toneCurve = !ckbToneCurve->get_inconsistent();
pedited->icm.applyLookTable = !ckbApplyLookTable->get_inconsistent();
@@ -1268,6 +1287,7 @@ void ICMPanel::wtrcinChanged()
willulab->set_sensitive(false);
wprim->set_sensitive(false);
fbw->set_sensitive(false);
gamut->set_sensitive(false);
wprimlab->set_sensitive(false);
redFrame->hide();
riaHBox->set_sensitive(false);
@@ -1278,6 +1298,7 @@ void ICMPanel::wtrcinChanged()
will->set_sensitive(false);
wprim->set_sensitive(true);
fbw->set_sensitive(true);
gamut->set_sensitive(true);
wprimlab->set_sensitive(true);
willulab->set_sensitive(true);
if (ColorManagementParams::Primaries(wprim->get_active_row_number()) == ColorManagementParams::Primaries::DEFAULT) {
@@ -1311,6 +1332,7 @@ void ICMPanel::wtrcinChanged()
willulab->set_sensitive(true);
wprim->set_sensitive(true);
fbw->set_sensitive(true);
gamut->set_sensitive(true);
wprimlab->set_sensitive(true);
wGamma->set_sensitive(false);
wSlope->set_sensitive(false);
@@ -1336,6 +1358,7 @@ void ICMPanel::wtrcinChanged()
willulab->set_sensitive(true);
wprim->set_sensitive(true);
fbw->set_sensitive(true);
gamut->set_sensitive(true);
wGamma->set_sensitive(false);
wSlope->set_sensitive(false);
riaHBox->set_sensitive(true);
@@ -1362,6 +1385,7 @@ void ICMPanel::wtrcinChanged()
willulab->set_sensitive(true);
wprim->set_sensitive(true);
fbw->set_sensitive(true);
gamut->set_sensitive(true);
wprimlab->set_sensitive(true);
wGamma->set_sensitive(false);
wSlope->set_sensitive(false);
@@ -1389,6 +1413,7 @@ void ICMPanel::wtrcinChanged()
willulab->set_sensitive(true);
wprim->set_sensitive(true);
fbw->set_sensitive(true);
gamut->set_sensitive(true);
wprimlab->set_sensitive(true);
wGamma->set_sensitive(false);
wSlope->set_sensitive(false);
@@ -1416,6 +1441,7 @@ void ICMPanel::wtrcinChanged()
willulab->set_sensitive(true);
wprim->set_sensitive(true);
fbw->set_sensitive(true);
gamut->set_sensitive(true);
wprimlab->set_sensitive(true);
wGamma->set_sensitive(false);
wSlope->set_sensitive(false);
@@ -2023,6 +2049,33 @@ void ICMPanel::fbwChanged()
}
}
void ICMPanel::gamutChanged()
{
if (multiImage) {
if (gamut->get_inconsistent()) {
gamut->set_inconsistent(false);
gamutconn.block(true);
gamut->set_active(false);
gamutconn.block(false);
} else if (lastgamut) {
gamut->set_inconsistent(true);
}
lastgamut = gamut->get_active();
}
if (listener) {
if (gamut->get_inconsistent()) {
listener->panelChanged(EvICMgamut, M("GENERAL_UNCHANGED"));
} else if (fbw->get_active()) {
listener->panelChanged(EvICMgamut, M("GENERAL_ENABLED"));
} else {
listener->panelChanged(EvICMgamut, M("GENERAL_DISABLED"));
}
}
}
void ICMPanel::setRawMeta(bool raw, const rtengine::FramesData* pMeta)
{