From 690b34f2a59a9671bddca07586da34f22f45d782 Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 9 Apr 2018 13:58:29 +0200 Subject: [PATCH] change aces matrix --- rtengine/iccmatrices.h | 16 ++++++++-------- rtengine/iccstore.cc | 38 +++++++++++++++++++++++--------------- rtengine/settings.h | 2 +- rtgui/icmpanel.cc | 4 ++-- rtgui/options.cc | 2 +- 5 files changed, 35 insertions(+), 27 deletions(-) diff --git a/rtengine/iccmatrices.h b/rtengine/iccmatrices.h index e36dfb9ad..283ac8fa2 100644 --- a/rtengine/iccmatrices.h +++ b/rtengine/iccmatrices.h @@ -66,16 +66,16 @@ constexpr double xyz_sRGB[3][3] = { {0.0139322, 0.0971045, 0.7141733} }; -constexpr double xyz_ACEScg[3][3] = { - {0.68988, 0.14977, 0.12456}, - {0.28452, 0.67169, 0.04379}, - {-0.00604, 0.01001, 0.82094} +constexpr double xyz_ACESc[3][3] = { + {0.99089, 0.01224, -0.03893}, + {0.36189, 0.72252, -0.08441}, + {-0.00272, 0.00826, 0.81937} }; -constexpr double ACEScg_xyz[3][3] = { - {1.59266, -0.351803, -0.22288}, - {-0.67593, 1.639273, 0.015117}, - {0.019959, -0.022576, 1.21629} +constexpr double ACESc_xyz[3][3] = { + {1.015799, -0.017739, -0.046435}, + {-0.507793, 1.391284 , 0.119201}, + {0.008491, -0.014084, 1.219402} }; constexpr double sRGB_xyz[3][3] = { diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index a34816c1f..8996611f1 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -195,9 +195,9 @@ cmsHPROFILE createXYZProfile() return rtengine::ICCStore::createFromMatrix(mat, false, "XYZ"); } -const double(*wprofiles[])[3] = {xyz_sRGB, xyz_adobe, xyz_prophoto, xyz_widegamut, xyz_bruce, xyz_beta, xyz_best, xyz_rec2020, xyz_ACEScg}; -const double(*iwprofiles[])[3] = {sRGB_xyz, adobe_xyz, prophoto_xyz, widegamut_xyz, bruce_xyz, beta_xyz, best_xyz, rec2020_xyz, ACEScg_xyz}; -const char* wpnames[] = {"sRGB", "Adobe RGB", "ProPhoto", "WideGamut", "BruceRGB", "Beta RGB", "BestRGB", "Rec2020", "ACEScg"}; +const double(*wprofiles[])[3] = {xyz_sRGB, xyz_adobe, xyz_prophoto, xyz_widegamut, xyz_bruce, xyz_beta, xyz_best, xyz_rec2020, xyz_ACESc}; +const double(*iwprofiles[])[3] = {sRGB_xyz, adobe_xyz, prophoto_xyz, widegamut_xyz, bruce_xyz, beta_xyz, best_xyz, rec2020_xyz, ACESc_xyz}; +const char* wpnames[] = {"sRGB", "Adobe RGB", "ProPhoto", "WideGamut", "BruceRGB", "Beta RGB", "BestRGB", "Rec2020", "ACESc"}; const char* wpgamma[] = {"default", "BT709_g2.2_s4.5", "sRGB_g2.4_s12.92", "linear_g1.0", "standard_g2.2", "standard_g1.8", "High_g1.3_s3.35", "Low_g2.6_s6.9"}; //gamma free //default = gamma inside profile //BT709 g=2.22 s=4.5 sRGB g=2.4 s=12.92 @@ -1285,7 +1285,7 @@ cmsHPROFILE rtengine::ICCStore::createGammaProfile(const procparams::ColorManage enum class ColorTemp { D50 = 5003, // for Widegamut, Prophoto Best, Beta -> D50 D65 = 6504, // for sRGB, AdobeRGB, Bruce Rec2020 -> D65 - D60 = 6005 //for ACEScg + D60 = 6005 //for ACESc }; ColorTemp temp = ColorTemp::D50; @@ -1345,8 +1345,8 @@ cmsHPROFILE rtengine::ICCStore::createGammaProfile(const procparams::ColorManage p[4] = 0.1310; p[5] = 0.0460; temp = ColorTemp::D65; - } else if (icm.wprimari == "ACEScg") { - p[0] = 0.734704; // ACEScg primaries + } else if (icm.wprimari == "ACESc") { + p[0] = 0.734704; // ACESc primaries p[1] = 0.265298; p[2] = -0.000004; p[3] = 0.999993; @@ -1481,9 +1481,9 @@ cmsHPROFILE rtengine::ICCStore::createCustomGammaOutputProfile(const procparams: outProfile = options.rtSettings.rec2020; outPr = "RT_rec2020"; - } else if (icm.wprimari == "ACEScg" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.ACEScg) ) { - outProfile = options.rtSettings.ACEScg; - outPr = "RT_acescg"; + } else if (icm.wprimari == "ACESc" && rtengine::ICCStore::getInstance()->outputProfileExist(options.rtSettings.ACESc) ) { + outProfile = options.rtSettings.ACESc; + outPr = "RT_acesc"; } else { // Should not occurs @@ -1494,7 +1494,7 @@ cmsHPROFILE rtengine::ICCStore::createCustomGammaOutputProfile(const procparams: return nullptr; } - // outProfile = options.rtSettings.prophoto; + // outProfile = options.rtSettings.prophoto; //begin adaptation rTRC gTRC bTRC //"outputProfile" profile has the same characteristics than RGB values, but TRC are adapted... for applying profile @@ -1603,7 +1603,7 @@ cmsHPROFILE rtengine::ICCStore::createCustomGammaOutputProfile(const procparams: enum class ColorTemp { D50 = 5003, // for Widegamut, Prophoto Best, Beta -> D50 D65 = 6504, // for sRGB, AdobeRGB, Bruce Rec2020 -> D65 - D60 = 6005 //for ACEScg->D60 + D60 = 6005 //for ACESc->D60 }; ColorTemp temp = ColorTemp::D50; float p[6]; //primaries @@ -1661,14 +1661,14 @@ cmsHPROFILE rtengine::ICCStore::createCustomGammaOutputProfile(const procparams: p[4] = 0.1310; p[5] = 0.0460; temp = ColorTemp::D65; - } else if (icm.wprimari == "ACEScg") { - p[0] = 0.734704; // ACEScg primaries + } else if (icm.wprimari == "ACESc") { + p[0] = 0.734704; // ACESc primaries p[1] = 0.265298; p[2] = -0.000004; p[3] = 0.999993; p[4] = 0.00009989; p[5] = -0.077007; - temp = ColorTemp::D50; + temp = ColorTemp::D60; } else { p[0] = 0.7347; //ProPhoto and default primaries p[1] = 0.2653; @@ -1696,12 +1696,20 @@ cmsHPROFILE rtengine::ICCStore::createCustomGammaOutputProfile(const procparams: GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(nullptr, 5, Parameters); if(icm.wprofile == "v4") { outputProfile = cmsCreateRGBProfile(&xyD, &Primaries, GammaTRC); + /* + cmsCIEXYZ *red = (cmsCIEXYZ *)cmsReadTag(outputProfile, cmsSigRedColorantTag); + cmsCIEXYZ red_tag = *red; + cmsWriteTag (outputProfile, cmsSigRedColorantTag, &red_tag); + */ } cmsWriteTag(outputProfile, cmsSigRedTRCTag,GammaTRC[0] ); cmsWriteTag(outputProfile, cmsSigGreenTRCTag,GammaTRC[1] ); cmsWriteTag(outputProfile, cmsSigBlueTRCTag,GammaTRC[2] ); + + if(icm.wprofile == "v2" || icm.wprofile == "v4") { - cmsSaveProfileToFile(outputProfile, outPro.c_str()); + cmsSaveProfileToFile(outputProfile, outPro.c_str()); + } if (GammaTRC) { cmsFreeToneCurve(GammaTRC[0]); diff --git a/rtengine/settings.h b/rtengine/settings.h index b80196cb0..32eed80bb 100644 --- a/rtengine/settings.h +++ b/rtengine/settings.h @@ -61,7 +61,7 @@ public: Glib::ustring srgb; // default name of SRGB space profile Glib::ustring srgb10; // default name of SRGB space profile Glib::ustring rec2020; // default name of rec2020 - Glib::ustring ACEScg; // default name of ACEScg + Glib::ustring ACESc; // default name of ACESc bool gamutICC; // no longer used bool gamutLch; diff --git a/rtgui/icmpanel.cc b/rtgui/icmpanel.cc index 18b1dba48..712d34fb4 100644 --- a/rtgui/icmpanel.cc +++ b/rtgui/icmpanel.cc @@ -260,8 +260,8 @@ ICMPanel::ICMPanel () : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iunch std::vector wprinames = rtengine::ICCStore::getInstance()->getWorkingProfiles(); - for (size_t i = 1; i < wprinames.size(); i++) { - if(i == 1 || i >= 5 ) { + for (size_t i = 0; i < wprinames.size(); i++) { + if(i <= 1 || i >= 5 ) { wprimari->append (wprinames[i]); } } diff --git a/rtgui/options.cc b/rtgui/options.cc index d9aab2a42..adb5fe9d9 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -541,7 +541,7 @@ void Options::setDefaults () rtSettings.beta = "BetaRGB"; rtSettings.best = "BestRGB"; rtSettings.rec2020 = "RT_Rec2020-V2-srgbtrc"; - rtSettings.ACEScg = "RT_ACES-V2-srgbtrc"; + rtSettings.ACESc = "RT_ACES-V2-srgbtrc"; rtSettings.verbose = false; rtSettings.gamutICC = true; rtSettings.gamutLch = true;