Solving issue 1947: "RT frequently "forgets" ICM's working profile and crashes shortly after"
Also seems to fix frequent crash on Win32 ( http://rawtherapee.com/forum/viewtopic.php?f=3&t=4628 )
This commit is contained in:
parent
7d04b6638d
commit
c342288cf7
@ -33,7 +33,7 @@ namespace rtengine {
|
||||
|
||||
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 char* wpnames[] = {"sRGB", "Adobe RGB", "ProPhoto", "WideGamut", "BruceRGB", "Beta RGB", "BestRGB"};
|
||||
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
|
||||
@ -41,36 +41,36 @@ const char* wpgamma[] = {"default","BT709_g2.2_s4.5", "sRGB_g2.4_s12.92", "linea
|
||||
//std22 g=2.2 std18 g=1.8
|
||||
// high g=1.3 s=3.35 for high dynamic images
|
||||
//low g=2.6 s=6.9 for low contrast images
|
||||
|
||||
|
||||
std::vector<std::string> getGamma () {//return gamma
|
||||
|
||||
std::vector<std::string> res;
|
||||
std::vector<Glib::ustring> getGamma () {//return gamma
|
||||
|
||||
std::vector<Glib::ustring> res;
|
||||
for (unsigned int i=0; i<sizeof(wpgamma)/sizeof(wpgamma[0]); i++)
|
||||
res.push_back (wpgamma[i]);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> getWorkingProfiles () {
|
||||
std::vector<Glib::ustring> getWorkingProfiles () {
|
||||
|
||||
std::vector<std::string> res;
|
||||
std::vector<Glib::ustring> res;
|
||||
for (unsigned int i=0; i<sizeof(wpnames)/sizeof(wpnames[0]); i++)
|
||||
res.push_back (wpnames[i]);
|
||||
return res;
|
||||
}
|
||||
|
||||
std::vector<std::string> ICCStore::getOutputProfiles () {
|
||||
std::vector<Glib::ustring> ICCStore::getOutputProfiles () {
|
||||
|
||||
MyMutex::MyLock lock(mutex_);
|
||||
|
||||
std::vector<std::string> res;
|
||||
for (std::map<std::string, cmsHPROFILE>::iterator i=fileProfiles.begin(); i!=fileProfiles.end(); i++){
|
||||
std::string name(i->first);
|
||||
std::string::size_type i2 = name.find_last_of('/');
|
||||
if( i2 == std::string::npos )
|
||||
i2 = name.find_last_of('\\');
|
||||
if( i2 == std::string::npos )
|
||||
std::vector<Glib::ustring> res;
|
||||
for (std::map<Glib::ustring, cmsHPROFILE>::iterator i=fileProfiles.begin(); i!=fileProfiles.end(); i++){
|
||||
Glib::ustring name(i->first);
|
||||
std::string::size_type i2 = name.find_last_of('/');
|
||||
if( i2 == std::string::npos )
|
||||
i2 = name.find_last_of('\\');
|
||||
if( i2 == std::string::npos )
|
||||
res.push_back ( name ); // list only profiles inside selected profiles directory
|
||||
}
|
||||
return res;
|
||||
@ -117,7 +117,7 @@ int ICCStore::numOfWProfiles () {
|
||||
|
||||
TMatrix ICCStore::workingSpaceMatrix (Glib::ustring name) {
|
||||
|
||||
std::map<std::string, TMatrix>::iterator r = wMatrices.find (name);
|
||||
std::map<Glib::ustring, TMatrix>::iterator r = wMatrices.find (name);
|
||||
if (r!=wMatrices.end())
|
||||
return r->second;
|
||||
else
|
||||
@ -126,7 +126,7 @@ TMatrix ICCStore::workingSpaceMatrix (Glib::ustring name) {
|
||||
|
||||
TMatrix ICCStore::workingSpaceInverseMatrix (Glib::ustring name) {
|
||||
|
||||
std::map<std::string, TMatrix>::iterator r = iwMatrices.find (name);
|
||||
std::map<Glib::ustring, TMatrix>::iterator r = iwMatrices.find (name);
|
||||
if (r!=iwMatrices.end())
|
||||
return r->second;
|
||||
else
|
||||
@ -135,7 +135,7 @@ TMatrix ICCStore::workingSpaceInverseMatrix (Glib::ustring name) {
|
||||
|
||||
cmsHPROFILE ICCStore::workingSpace (Glib::ustring name) {
|
||||
|
||||
std::map<std::string, cmsHPROFILE>::iterator r = wProfiles.find (name);
|
||||
std::map<Glib::ustring, cmsHPROFILE>::iterator r = wProfiles.find (name);
|
||||
if (r!=wProfiles.end())
|
||||
return r->second;
|
||||
else
|
||||
@ -144,7 +144,7 @@ cmsHPROFILE ICCStore::workingSpace (Glib::ustring name) {
|
||||
|
||||
cmsHPROFILE ICCStore::workingSpaceGamma (Glib::ustring name) {
|
||||
|
||||
std::map<std::string, cmsHPROFILE>::iterator r = wProfilesGamma.find (name);
|
||||
std::map<Glib::ustring, cmsHPROFILE>::iterator r = wProfilesGamma.find (name);
|
||||
if (r!=wProfilesGamma.end())
|
||||
return r->second;
|
||||
else
|
||||
@ -155,7 +155,7 @@ cmsHPROFILE ICCStore::getProfile (Glib::ustring name) {
|
||||
|
||||
MyMutex::MyLock lock(mutex_);
|
||||
|
||||
std::map<std::string, cmsHPROFILE>::iterator r = fileProfiles.find (name);
|
||||
std::map<Glib::ustring, cmsHPROFILE>::iterator r = fileProfiles.find (name);
|
||||
if (r!=fileProfiles.end())
|
||||
return r->second;
|
||||
else {
|
||||
@ -179,7 +179,7 @@ cmsHPROFILE ICCStore::getStdProfile (Glib::ustring name) {
|
||||
MyMutex::MyLock lock(mutex_);
|
||||
|
||||
|
||||
std::map<std::string, cmsHPROFILE>::iterator r = fileStdProfiles.find (name.uppercase());
|
||||
std::map<Glib::ustring, cmsHPROFILE>::iterator r = fileStdProfiles.find (name.uppercase());
|
||||
if (r==fileStdProfiles.end()) return NULL;
|
||||
|
||||
return r->second;
|
||||
@ -211,7 +211,7 @@ void ICCStore::init (Glib::ustring usrICCDir, Glib::ustring rtICCDir) {
|
||||
loadICCs(Glib::build_filename(rtICCDir, "input"), true, fileStdProfiles, fileStdProfileContents);
|
||||
}
|
||||
|
||||
void ICCStore::loadICCs(Glib::ustring rootDirName, bool nameUpper, std::map<std::string, cmsHPROFILE>& resultProfiles, std::map<std::string, ProfileContent> &resultProfileContents) {
|
||||
void ICCStore::loadICCs(Glib::ustring rootDirName, bool nameUpper, std::map<Glib::ustring, cmsHPROFILE>& resultProfiles, std::map<Glib::ustring, ProfileContent> &resultProfileContents) {
|
||||
if (rootDirName!="") {
|
||||
std::deque<Glib::ustring> qDirs;
|
||||
|
||||
|
@ -46,18 +46,18 @@ class ProfileContent {
|
||||
|
||||
class ICCStore {
|
||||
|
||||
std::map<std::string, cmsHPROFILE> wProfiles;
|
||||
std::map<std::string, cmsHPROFILE> wProfilesGamma;
|
||||
std::map<std::string, TMatrix> wMatrices;
|
||||
std::map<std::string, TMatrix> iwMatrices;
|
||||
std::map<Glib::ustring, cmsHPROFILE> wProfiles;
|
||||
std::map<Glib::ustring, cmsHPROFILE> wProfilesGamma;
|
||||
std::map<Glib::ustring, TMatrix> wMatrices;
|
||||
std::map<Glib::ustring, TMatrix> iwMatrices;
|
||||
|
||||
// these contain profiles from user/system directory (supplied on init)
|
||||
std::map<std::string, cmsHPROFILE> fileProfiles;
|
||||
std::map<std::string, ProfileContent> fileProfileContents;
|
||||
std::map<Glib::ustring, cmsHPROFILE> fileProfiles;
|
||||
std::map<Glib::ustring, ProfileContent> fileProfileContents;
|
||||
|
||||
// these contain standard profiles from RT. keys are all in uppercase
|
||||
std::map<std::string, cmsHPROFILE> fileStdProfiles;
|
||||
std::map<std::string, ProfileContent> fileStdProfileContents;
|
||||
std::map<Glib::ustring, cmsHPROFILE> fileStdProfiles;
|
||||
std::map<Glib::ustring, ProfileContent> fileStdProfileContents;
|
||||
|
||||
cmsHPROFILE xyz;
|
||||
cmsHPROFILE srgb;
|
||||
@ -65,7 +65,7 @@ class ICCStore {
|
||||
MyMutex mutex_;
|
||||
|
||||
ICCStore ();
|
||||
void loadICCs(Glib::ustring rootDirName, bool nameUpper, std::map<std::string, cmsHPROFILE>& resultProfiles, std::map<std::string, ProfileContent> &resultProfileContents);
|
||||
void loadICCs(Glib::ustring rootDirName, bool nameUpper, std::map<Glib::ustring, cmsHPROFILE>& resultProfiles, std::map<Glib::ustring, ProfileContent> &resultProfileContents);
|
||||
|
||||
public:
|
||||
|
||||
@ -89,7 +89,7 @@ class ICCStore {
|
||||
|
||||
cmsHPROFILE getXYZProfile () { return xyz; }
|
||||
cmsHPROFILE getsRGBProfile () { return srgb; }
|
||||
std::vector<std::string> getOutputProfiles ();
|
||||
std::vector<Glib::ustring> getOutputProfiles ();
|
||||
};
|
||||
|
||||
#define iccStore ICCStore::getInstance()
|
||||
|
@ -357,9 +357,10 @@ namespace rtengine {
|
||||
|
||||
/** Returns the available working profile names
|
||||
* @return a vector of the available working profile names */
|
||||
std::vector<std::string> getWorkingProfiles ();
|
||||
/** return gamma */
|
||||
std::vector<std::string> getGamma ();
|
||||
std::vector<Glib::ustring> getWorkingProfiles ();
|
||||
/** Returns the available output gammas
|
||||
* @return a vector of the available gamma names */
|
||||
std::vector<Glib::ustring> getGamma ();
|
||||
|
||||
/** This class holds all the necessary informations to accomplish the full processing of the image */
|
||||
class ProcessingJob {
|
||||
|
@ -395,7 +395,7 @@ else ipf.ciecam_02 (cieView, adap, begh, endh,1, 2, labView, ¶ms,customColCu
|
||||
bool pro=false;
|
||||
Glib::ustring chpro, outProfile;
|
||||
bool present_space[9]={false,false,false,false,false,false,false,false,false};
|
||||
std::vector<std::string> opnames = iccStore->getOutputProfiles ();
|
||||
std::vector<Glib::ustring> opnames = iccStore->getOutputProfiles ();
|
||||
//test if files are in system
|
||||
for (int j=0; j<9; j++) {
|
||||
// one can modify "option" [Color Management] to adapt the profile's name if they are different for windows, MacOS, Linux ??
|
||||
|
@ -125,7 +125,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL),
|
||||
wnames = Gtk::manage (new MyComboBoxText ());
|
||||
wVBox->pack_start (*wnames, Gtk::PACK_SHRINK);
|
||||
|
||||
std::vector<std::string> wpnames = rtengine::getWorkingProfiles ();
|
||||
std::vector<Glib::ustring> wpnames = rtengine::getWorkingProfiles ();
|
||||
for (size_t i=0; i<wpnames.size(); i++)
|
||||
wnames->append_text (wpnames[i]);
|
||||
|
||||
@ -152,7 +152,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL),
|
||||
onames->append_text (M("TP_ICM_NOICM"));
|
||||
onames->set_active (0);
|
||||
|
||||
std::vector<std::string> opnames = iccStore->getOutputProfiles ();
|
||||
std::vector<Glib::ustring> opnames = iccStore->getOutputProfiles ();
|
||||
for (size_t i=0; i<opnames.size(); i++)
|
||||
onames->append_text (opnames[i]);
|
||||
|
||||
@ -170,7 +170,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL),
|
||||
|
||||
oVBox->pack_start(*gaHBox, Gtk::PACK_EXPAND_WIDGET,2);
|
||||
|
||||
std::vector<std::string> wpgamma = rtengine::getGamma ();
|
||||
std::vector<Glib::ustring> wpgamma = rtengine::getGamma ();
|
||||
for (size_t i=0; i<wpgamma.size(); i++)
|
||||
wgamma->append_text (wpgamma[i]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user