Merge rec2020 into master
This commit is contained in:
BIN
rtdata/iccprofiles/output/Rec2020.icm
Normal file
BIN
rtdata/iccprofiles/output/Rec2020.icm
Normal file
Binary file not shown.
@@ -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},
|
||||
|
@@ -41,8 +41,9 @@ void loadProfiles (const Glib::ustring& dirName,
|
||||
std::map<Glib::ustring, Glib::ustring>* profileNames,
|
||||
bool nameUpper, bool onlyRgb)
|
||||
{
|
||||
if (dirName.empty ())
|
||||
if (dirName.empty ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -52,23 +53,27 @@ void loadProfiles (const Glib::ustring& dirName,
|
||||
|
||||
const Glib::ustring fileName = *entry;
|
||||
|
||||
if (fileName.size () < 4)
|
||||
if (fileName.size () < 4) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const Glib::ustring extension = fileName.substr (fileName.size () - 4).casefold ();
|
||||
|
||||
if (extension.compare (".icc") != 0 && extension.compare (".icm") != 0)
|
||||
if (extension.compare (".icc") != 0 && extension.compare (".icm") != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const Glib::ustring filePath = Glib::build_filename (dirName, fileName);
|
||||
|
||||
if (!Glib::file_test (filePath, Glib::FILE_TEST_IS_REGULAR))
|
||||
if (!Glib::file_test (filePath, Glib::FILE_TEST_IS_REGULAR)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Glib::ustring name = fileName.substr (0, fileName.size() - 4);
|
||||
|
||||
if (nameUpper)
|
||||
if (nameUpper) {
|
||||
name = name.uppercase ();
|
||||
}
|
||||
|
||||
if (profiles) {
|
||||
const rtengine::ProfileContent content (filePath);
|
||||
@@ -77,28 +82,31 @@ void loadProfiles (const Glib::ustring& dirName,
|
||||
if (profile && (!onlyRgb || cmsGetColorSpace (profile) == cmsSigRgbData)) {
|
||||
profiles->insert (std::make_pair (name, profile));
|
||||
|
||||
if (profileContents)
|
||||
if (profileContents) {
|
||||
profileContents->insert (std::make_pair (name, content));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (profileNames)
|
||||
if (profileNames) {
|
||||
profileNames->insert (std::make_pair (name, filePath));
|
||||
}
|
||||
}
|
||||
catch (Glib::Exception&) {}
|
||||
} catch (Glib::Exception&) {}
|
||||
}
|
||||
|
||||
inline void getSupportedIntent (cmsHPROFILE profile, cmsUInt32Number intent, cmsUInt32Number direction, std::uint8_t& result)
|
||||
{
|
||||
if (cmsIsIntentSupported (profile, intent, direction))
|
||||
if (cmsIsIntentSupported (profile, intent, direction)) {
|
||||
result |= 1 << intent;
|
||||
}
|
||||
}
|
||||
|
||||
inline std::uint8_t getSupportedIntents (cmsHPROFILE profile, cmsUInt32Number direction)
|
||||
{
|
||||
if (!profile)
|
||||
if (!profile) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::uint8_t result = 0;
|
||||
|
||||
@@ -116,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
|
||||
@@ -163,8 +171,9 @@ std::vector<Glib::ustring> ICCStore::getProfiles () const
|
||||
|
||||
std::vector<Glib::ustring> res;
|
||||
|
||||
for (ProfileMap::const_iterator profile = fileProfiles.begin (); profile != fileProfiles.end (); ++profile)
|
||||
for (ProfileMap::const_iterator profile = fileProfiles.begin (); profile != fileProfiles.end (); ++profile) {
|
||||
res.push_back (profile->first);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -181,8 +190,9 @@ std::vector<Glib::ustring> ICCStore::getProfilesFromDir (const Glib::ustring& di
|
||||
loadProfiles (profilesDir, &profiles, NULL, NULL, false, true);
|
||||
loadProfiles (dirName, &profiles, NULL, NULL, false, true);
|
||||
|
||||
for (ProfileMap::const_iterator profile = profiles.begin (); profile != profiles.end (); ++profile)
|
||||
for (ProfileMap::const_iterator profile = profiles.begin (); profile != profiles.end (); ++profile) {
|
||||
res.push_back (profile->first);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -388,22 +398,25 @@ cmsHPROFILE ICCStore::getStdProfile (const Glib::ustring& name) const
|
||||
const ProfileMap::const_iterator r = fileStdProfiles.find (nameUpper);
|
||||
|
||||
// return profile from store
|
||||
if (r != fileStdProfiles.end ())
|
||||
if (r != fileStdProfiles.end ()) {
|
||||
return r->second;
|
||||
}
|
||||
|
||||
// profile is not yet in store
|
||||
const NameMap::const_iterator f = fileStdProfilesFileNames.find (nameUpper);
|
||||
|
||||
// profile does not exist
|
||||
if (f == fileStdProfilesFileNames.end ())
|
||||
if (f == fileStdProfilesFileNames.end ()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// but there exists one => load it
|
||||
const ProfileContent content (f->second);
|
||||
const cmsHPROFILE profile = content.toProfile ();
|
||||
|
||||
if (profile)
|
||||
if (profile) {
|
||||
const_cast<ProfileMap&>(fileStdProfiles).insert (std::make_pair (f->first, profile));
|
||||
}
|
||||
|
||||
// profile is not valid or it is now stored => remove entry from fileStdProfilesFileNames
|
||||
const_cast<NameMap&>(fileStdProfilesFileNames).erase (f);
|
||||
@@ -481,6 +494,7 @@ void ICCStore::findDefaultMonitorProfile ()
|
||||
defaultMonitorProfile = Glib::ustring(profileName);
|
||||
defaultMonitorProfile = Glib::path_get_basename(defaultMonitorProfile);
|
||||
size_t pos = defaultMonitorProfile.rfind(".");
|
||||
|
||||
if (pos != Glib::ustring::npos) {
|
||||
defaultMonitorProfile = defaultMonitorProfile.substr(0, pos);
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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<Glib::ustring> 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) {
|
||||
|
@@ -644,6 +644,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;
|
||||
@@ -1542,6 +1543,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");
|
||||
}
|
||||
@@ -1776,11 +1781,13 @@ int Options::readFromFile (Glib::ustring fname)
|
||||
if (options.rtSettings.verbose) {
|
||||
printf("Options::readFromFile / Error code %d while reading values from \"%s\":\n%s\n", err.code(), fname.c_str(), err.what().c_str());
|
||||
}
|
||||
|
||||
setDefaults ();
|
||||
} catch (...) {
|
||||
if (options.rtSettings.verbose) {
|
||||
printf("Options::readFromFile / Unknown exception while trying to load \"%s\"!\n", fname.c_str());
|
||||
}
|
||||
|
||||
setDefaults ();
|
||||
}
|
||||
|
||||
@@ -2033,6 +2040,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);
|
||||
|
Reference in New Issue
Block a user