diff --git a/rtdata/dcpprofiles/Sony ILCE-6000.dcp b/rtdata/dcpprofiles/Sony ILCE-6000.dcp index 6d7e7c1e6..5ef8c4d31 100644 Binary files a/rtdata/dcpprofiles/Sony ILCE-6000.dcp and b/rtdata/dcpprofiles/Sony ILCE-6000.dcp differ diff --git a/rtdata/iccprofiles/output/Rec2020.icm b/rtdata/iccprofiles/output/Rec2020.icm new file mode 100644 index 000000000..0decaf6dc Binary files /dev/null and b/rtdata/iccprofiles/output/Rec2020.icm differ diff --git a/rtengine/iccmatrices.h b/rtengine/iccmatrices.h index 9e9682a73..292f45612 100644 --- a/rtengine/iccmatrices.h +++ b/rtengine/iccmatrices.h @@ -54,7 +54,7 @@ const double sRGB_xyz[3][3] = {{3.13593293538656, -1.61878246026431, // Color space conversion to/from XYZ; color spaces adapted to D50 using Bradford transform -const double xyz_sRGB[3][3] = {{0.4360747, 0.3850649, 0.1430804}, +const double xyz_sRGB[3][3] = {{0.4360747, 0.3850649, 0.1430804}, {0.2225045, 0.7168786, 0.0606169}, {0.0139322, 0.0971045, 0.7141733} }; @@ -83,6 +83,26 @@ const double prophoto_xyz[3][3] = {{1.3459433, -0.2556075, -0.0511118}, { -0.5445989, 1.5081673, 0.0205351}, {0.0000000, 0.0000000, 1.2118128} }; +/* +const double xyz_rec2020[3][3] = {{0.636958, 0.144617, 0.168881}, + {0.262700, 0.677998, 0.059302}, + {0.0000000, 0.028073, 1.060985} +}; + +const double rec2020_xyz[3][3] = {{1.716651, -0.355671, -0.253366}, + { -0.666684, 1.616481, 0.015769}, + {0.017640, -0.042771, 0.942103} +}; +*/ +const double xyz_rec2020[3][3] = {{0.6734241, 0.1656411, 0.1251286}, + {0.2790177, 0.6753402, 0.0456377}, + { -0.0019300, 0.0299784, 0.7973330} +}; + +const double rec2020_xyz[3][3] = {{1.6473376, -0.3935675, -0.2359961}, + { -0.6826036, 1.6475887, 0.0128190}, + {0.0296524, -0.0628993, 1.2531279} +}; const double xyz_widegamut[3][3] = {{0.7161046, 0.1009296, 0.1471858}, {0.2581874, 0.7249378, 0.0168748}, diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index c4382a5a6..530207876 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -124,9 +124,9 @@ inline 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}; -const double (*iwprofiles[])[3] = {sRGB_xyz, adobe_xyz, prophoto_xyz, widegamut_xyz, bruce_xyz, beta_xyz, best_xyz}; -const char* wpnames[] = {"sRGB", "Adobe RGB", "ProPhoto", "WideGamut", "BruceRGB", "Beta RGB", "BestRGB"}; +const double (*wprofiles[])[3] = {xyz_sRGB, xyz_adobe, xyz_prophoto, xyz_widegamut, xyz_bruce, xyz_beta, xyz_best, xyz_rec2020}; +const double (*iwprofiles[])[3] = {sRGB_xyz, adobe_xyz, prophoto_xyz, widegamut_xyz, bruce_xyz, beta_xyz, best_xyz, rec2020_xyz}; +const char* wpnames[] = {"sRGB", "Adobe RGB", "ProPhoto", "WideGamut", "BruceRGB", "Beta RGB", "BestRGB", "Rec2020"}; 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 diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index 5f1c2d10e..4f17c6fbe 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -429,6 +429,14 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int p5 = 0.1300; p6 = 0.0350; select_temp = 1; + } else if (profi == "Rec2020") { + p1 = 0.7080; // Rec2020 primaries + p2 = 0.2920; + p3 = 0.1700; + p4 = 0.7970; + p5 = 0.1310; + p6 = 0.0460; + select_temp = 2; } else { p1 = 0.7347; //ProPhoto and default primaries p2 = 0.2653; @@ -511,7 +519,7 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int if (select_temp == 1) { t50 = 5003; // for Widegamut, Prophoto Best, Beta D50 } else if (select_temp == 2) { - t50 = 6504; // for sRGB, AdobeRGB, Bruce D65 + t50 = 6504; // for sRGB, AdobeRGB, Bruce Rec2020 D65 } cmsCIExyY xyD; diff --git a/rtengine/settings.h b/rtengine/settings.h index 3e9c9d38a..4053a547f 100644 --- a/rtengine/settings.h +++ b/rtengine/settings.h @@ -56,6 +56,7 @@ public: Glib::ustring bruce; // default name of Bruce 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 bool gamutICC; // no longer used bool gamutLch; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index ab9c85ffe..5af070a24 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -293,6 +293,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p adjustr = 1.f / 1.3f; } else if (params.icm.working == "WideGamut") { adjustr = 1.f / 1.1f; + } else if (params.icm.working == "Rec2020") { + adjustr = 1.f / 1.1f; } else if (params.icm.working == "Beta RGB") { adjustr = 1.f / 1.2f; } else if (params.icm.working == "BestRGB") { @@ -532,6 +534,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p adjustr = 1.f / 1.3f; } else if (params.icm.working == "WideGamut") { adjustr = 1.f / 1.1f; + } else if (params.icm.working == "Rec2020") { + adjustr = 1.f / 1.1f; } else if (params.icm.working == "Beta RGB") { adjustr = 1.f / 1.2f; } else if (params.icm.working == "BestRGB") { @@ -1177,11 +1181,11 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p useLCMS = false; bool pro = false; Glib::ustring chpro, outProfile; - bool present_space[9] = {false, false, false, false, false, false, false, false, false}; + bool present_space[10] = {false, false, false, false, false, false, false, false, false, false}; std::vector opnames = iccStore->getProfiles (); //test if files are in system - for (int j = 0; j < 9; j++) { + for (int j = 0; j < 10; j++) { // one can modify "option" [Color Management] to adapt the profile's name if they are different for windows, MacOS, Linux ?? // some of them are actually provided by RT, thanks to Jacques Desmis if (j == 0) { @@ -1202,6 +1206,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p chpro = options.rtSettings.srgb10; //gamma 1.0 } else if (j == 8) { chpro = options.rtSettings.prophoto10; //gamma 1.0 + } else if (j == 9) { + chpro = options.rtSettings.rec2020; } for (unsigned int i = 0; i < opnames.size(); i++) { @@ -1241,6 +1247,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p outProfile = options.rtSettings.srgb10; } else if (params.icm.working == "ProPhoto" && present_space[8] && pro) { outProfile = options.rtSettings.prophoto10; + } else if (params.icm.working == "Rec2020" && present_space[9]) { + outProfile = options.rtSettings.rec2020; } else { // Should not occurs if (settings->verbose) { diff --git a/rtgui/options.cc b/rtgui/options.cc index 869ef8cb8..2348ab097 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -643,6 +643,7 @@ void Options::setDefaults () rtSettings.bruce = "Bruce"; rtSettings.beta = "BetaRGB"; rtSettings.best = "BestRGB"; + rtSettings.rec2020 = "Rec2020"; rtSettings.verbose = false; rtSettings.gamutICC = true; rtSettings.gamutLch = true; @@ -1537,6 +1538,10 @@ int Options::readFromFile (Glib::ustring fname) rtSettings.best = keyFile.get_string ("Color Management", "Best"); } + if ( keyFile.has_key ("Color Management", "Rec2020")) { + rtSettings.rec2020 = keyFile.get_string ("Color Management", "Rec2020"); + } + if ( keyFile.has_key ("Color Management", "Bruce")) { rtSettings.bruce = keyFile.get_string ("Color Management", "Bruce"); } @@ -2029,6 +2034,7 @@ int Options::saveToFile (Glib::ustring fname) keyFile.set_string ("Color Management", "sRGB10", rtSettings.srgb10); keyFile.set_string ("Color Management", "Beta", rtSettings.beta); keyFile.set_string ("Color Management", "Best", rtSettings.best); + keyFile.set_string ("Color Management", "Rec2020", rtSettings.rec2020); keyFile.set_string ("Color Management", "Bruce", rtSettings.bruce); keyFile.set_integer ("Color Management", "WhiteBalanceSpotSize", whiteBalanceSpotSize); keyFile.set_boolean ("Color Management", "GamutICC", rtSettings.gamutICC);