add free primaries to ICC V4

This commit is contained in:
Desmis 2018-04-22 18:18:18 +02:00
parent d183d47c09
commit bfb063f599
8 changed files with 237 additions and 3 deletions

View File

@ -1611,6 +1611,13 @@ TP_GAMMA_PRIM_WIDEG;Widegamut
TP_GAMMA_PRIM_BEST;BestRGB
TP_GAMMA_PRIM_BETA;BetaRGB
TP_GAMMA_PRIM_BRUCE;BruceRGB
TP_GAMMA_PRIM_FREE;Free primaries
TP_GAMMA_PRIM_REDX;Red x primari
TP_GAMMA_PRIM_REDY;Red y primari
TP_GAMMA_PRIM_GREX;Green x primari
TP_GAMMA_PRIM_GREY;Green y primari
TP_GAMMA_PRIM_BLUX;Blue x primari
TP_GAMMA_PRIM_BLUY;Blue y primari
TP_GAMMA_TEMP;Illuminant (icc V4)temp
TP_GAMMA_TEMP_DEF;Default
TP_GAMMA_TEMP_41;D41

View File

@ -1398,6 +1398,13 @@ cmsHPROFILE rtengine::ICCStore::createGammaProfile(const procparams::ColorManage
p[3] = 0.8404;
p[4] = 0.0366;
p[5] = 0.0001;
} else if (icm.wprimari == "pfree") {
p[0] = icm.predx;
p[1] = icm.predy;
p[2] = icm.pgrex;
p[3] = icm.pgrey;
p[4] = icm.pblux;
p[5] = icm.pbluy;
} else {
p[0] = 0.7347; //default primaries
p[1] = 0.2653;
@ -1524,6 +1531,11 @@ cmsHPROFILE rtengine::ICCStore::createCustomGammaOutputProfile(const procparams:
} else if (icm.wprimari == "acesp1" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.ACESp1)) {
outProfile = options.rtSettings.ACESp1;
outPr = "RT_acesp1";
} else if (icm.wprimari == "pfree") {
outProfile = options.rtSettings.srgb;
printf("PFRRE\n");
outPr = "RT_pfree";
} else {
// Should not occurs
if (settings->verbose) {
@ -1751,6 +1763,14 @@ cmsHPROFILE rtengine::ICCStore::createCustomGammaOutputProfile(const procparams:
p[3] = 0.8404;
p[4] = 0.0366;
p[5] = 0.0001;
} else if (icm.wprimari == "pfree") {
p[0] = icm.predx;
p[1] = icm.predy;
p[2] = icm.pgrex;
p[3] = icm.pgrey;
p[4] = icm.pblux;
p[5] = icm.pbluy;
} else {
p[0] = 0.7347; //default primaries
p[1] = 0.2653;

View File

@ -1959,6 +1959,13 @@ ColorManagementParams::ColorManagementParams() :
gamma("Free"),
gampos(2.4),
slpos(12.92310),
predx(0.6400),
predy(0.3300),
pgrex(0.3000),
pgrey(0.6000),
pblux(0.1500),
pbluy(0.0600),
wprimari("sRGB"),
wprofile("none"),
wtemp("DEF"),
@ -1982,6 +1989,12 @@ bool ColorManagementParams::operator ==(const ColorManagementParams& other) cons
&& gamma == other.gamma
&& gampos == other.gampos
&& slpos == other.slpos
&& predx == other.predx
&& predy == other.predy
&& pgrex == other.pgrex
&& pgrey == other.pgrey
&& pblux == other.pblux
&& pbluy == other.pbluy
&& wprimari == other.wprimari
&& wprofile == other.wprofile
&& wtemp == other.wtemp
@ -3150,6 +3163,13 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
saveToKeyfile(!pedited || pedited->icm.freegamma, "Color Management", "Freegamma", icm.freegamma, keyFile);
saveToKeyfile(!pedited || pedited->icm.gampos, "Color Management", "GammaValue", icm.gampos, keyFile);
saveToKeyfile(!pedited || pedited->icm.slpos, "Color Management", "GammaSlope", icm.slpos, keyFile);
saveToKeyfile(!pedited || pedited->icm.predx, "Color Management", "GammaPredx", icm.predx, keyFile);
saveToKeyfile(!pedited || pedited->icm.predy, "Color Management", "GammaPredy", icm.predy, keyFile);
saveToKeyfile(!pedited || pedited->icm.pgrex, "Color Management", "GammaPgrex", icm.pgrex, keyFile);
saveToKeyfile(!pedited || pedited->icm.pgrey, "Color Management", "GammaPgrey", icm.pgrey, keyFile);
saveToKeyfile(!pedited || pedited->icm.pblux, "Color Management", "GammaPblux", icm.pblux, keyFile);
saveToKeyfile(!pedited || pedited->icm.pbluy, "Color Management", "GammaPbluy", icm.pbluy, keyFile);
saveToKeyfile(!pedited || pedited->icm.wprimari, "Color Management", "GammaPrimari", icm.wprimari, keyFile);
saveToKeyfile(!pedited || pedited->icm.wtemp, "Color Management", "GammaTemp", icm.wtemp, keyFile);
saveToKeyfile(!pedited || pedited->icm.wprofile, "Color Management", "GammaProfile", icm.wprofile, keyFile);
@ -4175,6 +4195,13 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "Color Management", "Freegamma", pedited, icm.freegamma, pedited->icm.freegamma);
assignFromKeyfile(keyFile, "Color Management", "GammaValue", pedited, icm.gampos, pedited->icm.gampos);
assignFromKeyfile(keyFile, "Color Management", "GammaSlope", pedited, icm.slpos, pedited->icm.slpos);
assignFromKeyfile(keyFile, "Color Management", "GammaPredx", pedited, icm.predx, pedited->icm.predx);
assignFromKeyfile(keyFile, "Color Management", "GammaPredy", pedited, icm.predy, pedited->icm.predy);
assignFromKeyfile(keyFile, "Color Management", "GammaPgrex", pedited, icm.pgrex, pedited->icm.pgrex);
assignFromKeyfile(keyFile, "Color Management", "GammaPgrey", pedited, icm.pgrey, pedited->icm.pgrey);
assignFromKeyfile(keyFile, "Color Management", "GammaPblux", pedited, icm.pblux, pedited->icm.pblux);
assignFromKeyfile(keyFile, "Color Management", "GammaPbluy", pedited, icm.pbluy, pedited->icm.pbluy);
assignFromKeyfile(keyFile, "Color Management", "GammaPrimari", pedited, icm.wprimari, pedited->icm.wprimari);
assignFromKeyfile(keyFile, "Color Management", "GammaProfile", pedited, icm.wprofile, pedited->icm.wprofile);
assignFromKeyfile(keyFile, "Color Management", "GammaTemp", pedited, icm.wtemp, pedited->icm.wtemp);

View File

@ -1021,6 +1021,13 @@ struct ColorManagementParams {
Glib::ustring gamma;
double gampos;
double slpos;
double predx;
double predy;
double pgrex;
double pgrey;
double pblux;
double pbluy;
Glib::ustring wprimari;
Glib::ustring wprofile;
Glib::ustring wtemp;

View File

@ -37,6 +37,12 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha
EvICMprimariMethod = m->newEvent(GAMMA, "HISTORY_MSG_ICMPRIMARI");
EvICMprofileMethod = m->newEvent(GAMMA, "HISTORY_MSG_ICMPROFILE");
EvICMtempMethod = m->newEvent(GAMMA, "HISTORY_MSG_ICMTEMP");
EvICMpredx = m->newEvent(GAMMA, "HISTORY_MSG_ICMPREDX");
EvICMpredy = m->newEvent(GAMMA, "HISTORY_MSG_ICMPREDY");
EvICMpgrex = m->newEvent(GAMMA, "HISTORY_MSG_ICMPGREX");
EvICMpgrey = m->newEvent(GAMMA, "HISTORY_MSG_ICMPGREY");
EvICMpblux = m->newEvent(GAMMA, "HISTORY_MSG_ICMPBLUX");
EvICMpbluy = m->newEvent(GAMMA, "HISTORY_MSG_ICMPBLUY");
isBatchMode = lastToneCurve = lastApplyLookTable = lastApplyBaselineExposureOffset = lastApplyHueSatMap = lastgamfree = false;
@ -269,8 +275,45 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha
wprimari->append(M("TP_GAMMA_PRIM_BEST"));
wprimari->append(M("TP_GAMMA_PRIM_BETA"));
wprimari->append(M("TP_GAMMA_PRIM_BRUCE"));
wprimari->append(M("TP_GAMMA_PRIM_FREE"));
wprimari->set_active(5);
prifreeVBox = Gtk::manage(new Gtk::VBox());
Gtk::Image* gamuts0 = Gtk::manage (new RTImage ("rt-logo-tiny.png"));
Gtk::Image* gamutl0 = Gtk::manage (new RTImage ("rt-logo-small.png"));
Gtk::Image* gamuts1 = Gtk::manage (new RTImage ("rt-logo-tiny.png"));
Gtk::Image* gamutl1 = Gtk::manage (new RTImage ("rt-logo-small.png"));
Gtk::Image* gamuts2 = Gtk::manage (new RTImage ("rt-logo-tiny.png"));
Gtk::Image* gamutl2 = Gtk::manage (new RTImage ("rt-logo-small.png"));
Gtk::Image* gamuts3 = Gtk::manage (new RTImage ("rt-logo-tiny.png"));
Gtk::Image* gamutl3 = Gtk::manage (new RTImage ("rt-logo-small.png"));
Gtk::Image* gamuts4 = Gtk::manage (new RTImage ("rt-logo-tiny.png"));
Gtk::Image* gamutl4 = Gtk::manage (new RTImage ("rt-logo-small.png"));
Gtk::Image* gamuts5 = Gtk::manage (new RTImage ("rt-logo-tiny.png"));
Gtk::Image* gamutl5 = Gtk::manage (new RTImage ("rt-logo-small.png"));
predx = Gtk::manage(new Adjuster(M("TP_GAMMA_PRIM_REDX"), 0.6300, 0.7350, 0.0001, 0.6400, gamuts0, gamutl0));
predy = Gtk::manage(new Adjuster(M("TP_GAMMA_PRIM_REDY"), 0.2650, 0.3350, 0.0001, 0.3300, gamutl1, gamuts1));
pgrex = Gtk::manage(new Adjuster(M("TP_GAMMA_PRIM_GREX"), 0.0000, 0.3100, 0.0001, 0.3000, gamutl2, gamuts2));
pgrey = Gtk::manage(new Adjuster(M("TP_GAMMA_PRIM_GREY"), 0.5900, 1.0000, 0.0001, 0.6000, gamuts3, gamutl3));
pblux = Gtk::manage(new Adjuster(M("TP_GAMMA_PRIM_BLUX"), 0.0001, 0.1600, 0.0001, 0.1500, gamutl4, gamuts4));
pbluy = Gtk::manage(new Adjuster(M("TP_GAMMA_PRIM_BLUY"), -0.0700, 0.0700, 0.0001, 0.060, gamutl5, gamuts5));
prifreeVBox->pack_start(*predx, Gtk::PACK_SHRINK);
prifreeVBox->pack_start(*predy, Gtk::PACK_SHRINK);
prifreeVBox->pack_start(*pgrex, Gtk::PACK_SHRINK);
prifreeVBox->pack_start(*pgrey, Gtk::PACK_SHRINK);
prifreeVBox->pack_start(*pblux, Gtk::PACK_SHRINK);
prifreeVBox->pack_start(*pbluy, Gtk::PACK_SHRINK);
fgVBox->pack_start(*prifreeVBox, Gtk::PACK_SHRINK);
predx->setAdjusterListener(this);
predy->setAdjusterListener(this);
pgrex->setAdjusterListener(this);
pgrey->setAdjusterListener(this);
pblux->setAdjusterListener(this);
pbluy->setAdjusterListener(this);
//sliders gampos and slpos
fgVBox->pack_start(*gaHBox, Gtk::PACK_EXPAND_WIDGET);
@ -629,8 +672,13 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
wprimari->set_active(8);
} else if (pp->icm.wprimari == "BruceRGB") {
wprimari->set_active(9);
}
} else if (pp->icm.wprimari == "pfree") {
wprimari->set_active(10);
}
if(wprimari->get_active_row_number() == 10) prifreeVBox->set_sensitive(true);
else prifreeVBox->set_sensitive(false);
if (pp->icm.wtemp == "DEF") {
wtemp->set_active(0);
} else if (pp->icm.wtemp == "D41") {
@ -661,7 +709,8 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
gpChanged();
wprofileChanged();
wtempChanged();
wprimariChanged();
if (pp->icm.output == ColorManagementParams::NoICMString) {
onames->set_active_text(M("TP_ICM_NOICM"));
} else {
@ -705,6 +754,12 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
gampos->setValue(pp->icm.gampos);
slpos->setValue(pp->icm.slpos);
predx->setValue(pp->icm.predx);
predy->setValue(pp->icm.predy);
pgrex->setValue(pp->icm.pgrex);
pgrey->setValue(pp->icm.pgrey);
pblux->setValue(pp->icm.pblux);
pbluy->setValue(pp->icm.pbluy);
if (pedited) {
iunchanged->set_active(!pedited->icm.input);
@ -749,6 +804,12 @@ void ICMPanel::read(const ProcParams* pp, const ParamsEdited* pedited)
gampos->setEditedState(pedited->icm.gampos ? Edited : UnEdited);
slpos->setEditedState(pedited->icm.slpos ? Edited : UnEdited);
predx->setEditedState(pedited->icm.predx ? Edited : UnEdited);
predy->setEditedState(pedited->icm.predy ? Edited : UnEdited);
pgrex->setEditedState(pedited->icm.pgrex ? Edited : UnEdited);
pgrey->setEditedState(pedited->icm.pgrey ? Edited : UnEdited);
pblux->setEditedState(pedited->icm.pblux ? Edited : UnEdited);
pbluy->setEditedState(pedited->icm.pbluy ? Edited : UnEdited);
}
@ -824,6 +885,8 @@ void ICMPanel::write(ProcParams* pp, ParamsEdited* pedited)
pp->icm.wprimari = "BetaRGB";
} else if (wprimari->get_active_row_number() == 9) {
pp->icm.wprimari = "BruceRGB";
} else if (wprimari->get_active_row_number() == 10) {
pp->icm.wprimari = "pfree";
}
if (wtemp->get_active_row_number() == 0) {
@ -834,7 +897,7 @@ void ICMPanel::write(ProcParams* pp, ParamsEdited* pedited)
pp->icm.wtemp = "D50";
} else if (wtemp->get_active_row_number() == 3) {
pp->icm.wtemp = "D55";
} else if (wprimari->get_active_row_number() == 4) {
} else if (wtemp->get_active_row_number() == 4) {
pp->icm.wtemp = "D60";
} else if (wtemp->get_active_row_number() == 5) {
pp->icm.wtemp = "D65";
@ -852,6 +915,12 @@ void ICMPanel::write(ProcParams* pp, ParamsEdited* pedited)
pp->icm.gampos = (double) gampos->getValue();
pp->icm.slpos = (double) slpos->getValue();
pp->icm.outputBPC = obpc->get_active();
pp->icm.predx = (double) predx->getValue();
pp->icm.predy = (double) predy->getValue();
pp->icm.pgrex = (double) pgrex->getValue();
pp->icm.pgrey = (double) pgrey->getValue();
pp->icm.pblux = (double) pblux->getValue();
pp->icm.pbluy = (double) pbluy->getValue();
if (pedited) {
pedited->icm.input = !iunchanged->get_active();
@ -868,6 +937,13 @@ void ICMPanel::write(ProcParams* pp, ParamsEdited* pedited)
pedited->icm.freegamma = !freegamma->get_inconsistent();
pedited->icm.gampos = gampos->getEditedState();
pedited->icm.slpos = slpos->getEditedState();
pedited->icm.predx = predx->getEditedState();
pedited->icm.predy = predy->getEditedState();
pedited->icm.pgrex = pgrex->getEditedState();
pedited->icm.pgrey = pgrey->getEditedState();
pedited->icm.pblux = pblux->getEditedState();
pedited->icm.pbluy = pbluy->getEditedState();
pedited->icm.wprimari = wprimari->get_active_text() != M("GENERAL_UNCHANGED");
pedited->icm.wprofile = wprofile->get_active_text() != M("GENERAL_UNCHANGED");
pedited->icm.wtemp = wtemp->get_active_text() != M("GENERAL_UNCHANGED");
@ -878,13 +954,33 @@ void ICMPanel::setDefaults(const ProcParams* defParams, const ParamsEdited* pedi
{
gampos->setDefault(defParams->icm.gampos);
slpos->setDefault(defParams->icm.slpos);
predx->setDefault(defParams->icm.predx);
predy->setDefault(defParams->icm.predy);
pgrex->setDefault(defParams->icm.pgrex);
pgrey->setDefault(defParams->icm.pgrey);
pblux->setDefault(defParams->icm.pblux);
pbluy->setDefault(defParams->icm.pbluy);
if (pedited) {
gampos->setDefaultEditedState(pedited->icm.gampos ? Edited : UnEdited);
slpos->setDefaultEditedState(pedited->icm.slpos ? Edited : UnEdited);
predx->setDefaultEditedState(pedited->icm.predx ? Edited : UnEdited);
predy->setDefaultEditedState(pedited->icm.predy ? Edited : UnEdited);
pgrex->setDefaultEditedState(pedited->icm.pgrex ? Edited : UnEdited);
pgrey->setDefaultEditedState(pedited->icm.pgrey ? Edited : UnEdited);
pblux->setDefaultEditedState(pedited->icm.pblux ? Edited : UnEdited);
pbluy->setDefaultEditedState(pedited->icm.pbluy ? Edited : UnEdited);
} else {
gampos->setDefaultEditedState(Irrelevant);
slpos->setDefaultEditedState(Irrelevant);
predx->setDefaultEditedState(Irrelevant);
predy->setDefaultEditedState(Irrelevant);
pgrex->setDefaultEditedState(Irrelevant);
pgrey->setDefaultEditedState(Irrelevant);
pblux->setDefaultEditedState(Irrelevant);
pbluy->setDefaultEditedState(Irrelevant);
}
}
@ -905,6 +1001,18 @@ void ICMPanel::adjusterChanged(Adjuster* a, double newval)
listener->panelChanged(EvGAMPOS, costr);
} else if (a == slpos) {
listener->panelChanged(EvSLPOS, costr);
} else if (a == predx) {
listener->panelChanged(EvICMpredx, costr);
} else if (a == predy) {
listener->panelChanged(EvICMpredy, costr);
} else if (a == pgrex) {
listener->panelChanged(EvICMpgrex, costr);
} else if (a == pgrey) {
listener->panelChanged(EvICMpgrey, costr);
} else if (a == pblux) {
listener->panelChanged(EvICMpblux, costr);
} else if (a == pbluy) {
listener->panelChanged(EvICMpbluy, costr);
}
}
}
@ -920,6 +1028,8 @@ void ICMPanel::wpChanged()
void ICMPanel::wprimariChanged()
{
if(wprimari->get_active_row_number() == 10) prifreeVBox->set_sensitive(true);
else prifreeVBox->set_sensitive(false);
if (listener) {
listener->panelChanged(EvICMprimariMethod, wprimari->get_active_text());
@ -1148,6 +1258,9 @@ void ICMPanel::GamChanged()
//wtemp->set_sensitive(true);
if(wprofile->get_active_row_number() == 2) wtemp->set_sensitive(true);
priHBox->set_sensitive(true);
if(wprimari->get_active_row_number() == 10) prifreeVBox->set_sensitive(true);
else prifreeVBox->set_sensitive(false);
gaHBox->set_sensitive(true);
profHBox->set_sensitive(true);
tempHBox->set_sensitive(true);
@ -1165,6 +1278,8 @@ void ICMPanel::GamChanged()
if(wprofile->get_active_row_number() != 2) wtemp->set_sensitive(false);
//wtemp->set_sensitive(false);
priHBox->set_sensitive(false);
prifreeVBox->set_sensitive(false);
gaHBox->set_sensitive(false);
profHBox->set_sensitive(false);
tempHBox->set_sensitive(false);

View File

@ -43,6 +43,14 @@ protected:
Gtk::Frame* dcpFrame;
Adjuster* gampos;
Adjuster* slpos;
Adjuster* predx;
Adjuster* predy;
Adjuster* pgrex;
Adjuster* pgrey;
Adjuster* pblux;
Adjuster* pbluy;
bool lastgamfree;
sigc::connection gamcsconn;
//bool freegamma;
@ -62,12 +70,19 @@ private:
rtengine::ProcEvent EvICMprimariMethod;
rtengine::ProcEvent EvICMprofileMethod;
rtengine::ProcEvent EvICMtempMethod;
rtengine::ProcEvent EvICMpredx;
rtengine::ProcEvent EvICMpredy;
rtengine::ProcEvent EvICMpgrex;
rtengine::ProcEvent EvICMpgrey;
rtengine::ProcEvent EvICMpblux;
rtengine::ProcEvent EvICMpbluy;
Gtk::VBox * iVBox;
Gtk::HBox* priHBox;
Gtk::HBox* gaHBox;
Gtk::HBox* profHBox;
Gtk::HBox* tempHBox;
Gtk::VBox* prifreeVBox;
Gtk::CheckButton* obpc;
Gtk::CheckButton* freegamma;

View File

@ -389,6 +389,12 @@ void ParamsEdited::set(bool v)
icm.freegamma = v;
icm.gampos = v;
icm.slpos = v;
icm.predx = v;
icm.predy = v;
icm.pgrex = v;
icm.pgrey = v;
icm.pblux = v;
icm.pbluy = v;
icm.wprimari = v;
icm.wprofile = v;
icm.wtemp = v;
@ -939,6 +945,13 @@ void ParamsEdited::initFrom(const std::vector<rtengine::procparams::ProcParams>&
icm.freegamma = icm.freegamma && p.icm.freegamma == other.icm.freegamma;
icm.gampos = icm.gampos && p.icm.gampos == other.icm.gampos;
icm.slpos = icm.slpos && p.icm.slpos == other.icm.slpos;
icm.predx = icm.predx && p.icm.predx == other.icm.predx;
icm.predy = icm.predy && p.icm.predy == other.icm.predy;
icm.pgrex = icm.pgrex && p.icm.pgrex == other.icm.pgrex;
icm.pgrey = icm.pgrey && p.icm.pgrey == other.icm.pgrey;
icm.pblux = icm.pblux && p.icm.pblux == other.icm.pblux;
icm.pbluy = icm.pbluy && p.icm.pbluy == other.icm.pbluy;
icm.wprimari = icm.wprimari && p.icm.wprimari == other.icm.wprimari;
icm.wprofile = icm.wprofile && p.icm.wprofile == other.icm.wprofile;
icm.wtemp = icm.wtemp && p.icm.wtemp == other.icm.wtemp;
@ -2444,6 +2457,30 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
toEdit.icm.slpos = dontforceSet && options.baBehav[ADDSET_FREE_OUTPUT_SLOPE] ? toEdit.icm.slpos + mods.icm.slpos : mods.icm.slpos;
}
if (icm.predx) {
toEdit.icm.predx = mods.icm.predx;
}
if (icm.predy) {
toEdit.icm.predy = mods.icm.predy;
}
if (icm.pgrex) {
toEdit.icm.pgrex = mods.icm.pgrex;
}
if (icm.pgrey) {
toEdit.icm.pgrey = mods.icm.pgrey;
}
if (icm.pblux) {
toEdit.icm.pblux = mods.icm.pblux;
}
if (icm.pbluy) {
toEdit.icm.pbluy = mods.icm.pbluy;
}
if (icm.gamma) {
toEdit.icm.gamma = mods.icm.gamma;
}

View File

@ -588,6 +588,12 @@ public:
bool gamma;
bool gampos;
bool slpos;
bool predx;
bool predy;
bool pgrex;
bool pgrey;
bool pblux;
bool pbluy;
bool freegamma;
bool wprimari;
bool wprofile;