Solving issue 1102: "My system don't have any output ICC profile, it leads to crappy resulting images" on behalf of Jacques Desmis
iccprofiles now contains an "input" and "output" subdirectory. Jacques also created new output profiles that are necessary for good color rendering in the output file. simpleprocess.cc has also been cleaned up.
This commit is contained in:
parent
b22a8a8e0e
commit
a7de9f8c91
@ -2,7 +2,8 @@
|
|||||||
file (GLOB PROFILEFILES "profiles/*.pp3")
|
file (GLOB PROFILEFILES "profiles/*.pp3")
|
||||||
file (GLOB LANGUAGEFILES "languages/*")
|
file (GLOB LANGUAGEFILES "languages/*")
|
||||||
file (GLOB SOUNDFILES "sounds/*")
|
file (GLOB SOUNDFILES "sounds/*")
|
||||||
file (GLOB ICCFILES "iccprofiles/*")
|
file (GLOB INPUTICCFILES "iccprofiles/input/*")
|
||||||
|
file (GLOB OUTPUTICCFILES "iccprofiles/output/*")
|
||||||
# THEMEDIR includes subfolders for image resources for some themes; doing the normal glob won't work.
|
# THEMEDIR includes subfolders for image resources for some themes; doing the normal glob won't work.
|
||||||
set (THEMEDIR "themes")
|
set (THEMEDIR "themes")
|
||||||
set (IMAGESDIR "images")
|
set (IMAGESDIR "images")
|
||||||
@ -30,7 +31,8 @@ install (FILES ${IMAGEFILES} DESTINATION ${DATADIR}/images)
|
|||||||
install (FILES ${LANGUAGEFILES} DESTINATION ${DATADIR}/languages)
|
install (FILES ${LANGUAGEFILES} DESTINATION ${DATADIR}/languages)
|
||||||
install (FILES ${PROFILEFILES} DESTINATION ${DATADIR}/profiles)
|
install (FILES ${PROFILEFILES} DESTINATION ${DATADIR}/profiles)
|
||||||
install (FILES ${SOUNDFILES} DESTINATION ${DATADIR}/sounds)
|
install (FILES ${SOUNDFILES} DESTINATION ${DATADIR}/sounds)
|
||||||
install (FILES ${ICCFILES} DESTINATION ${DATADIR}/iccprofiles)
|
install (FILES ${INPUTICCFILES} DESTINATION ${DATADIR}/iccprofiles/input)
|
||||||
|
install (FILES ${OUTPUTICCFILES} DESTINATION ${DATADIR}/iccprofiles/output)
|
||||||
install (DIRECTORY ${THEMEDIR} DESTINATION ${DATADIR})
|
install (DIRECTORY ${THEMEDIR} DESTINATION ${DATADIR})
|
||||||
install (DIRECTORY ${IMAGESDIR} DESTINATION ${DATADIR} FILES_MATCHING PATTERN "index.theme")
|
install (DIRECTORY ${IMAGESDIR} DESTINATION ${DATADIR} FILES_MATCHING PATTERN "index.theme")
|
||||||
install (DIRECTORY ${IMAGESDIR} DESTINATION ${DATADIR} FILES_MATCHING PATTERN "*.png")
|
install (DIRECTORY ${IMAGESDIR} DESTINATION ${DATADIR} FILES_MATCHING PATTERN "*.png")
|
||||||
|
BIN
rtdata/iccprofiles/output/RT_Large_g10.icc
Normal file
BIN
rtdata/iccprofiles/output/RT_Large_g10.icc
Normal file
Binary file not shown.
BIN
rtdata/iccprofiles/output/RT_Large_gBT709.icc
Normal file
BIN
rtdata/iccprofiles/output/RT_Large_gBT709.icc
Normal file
Binary file not shown.
BIN
rtdata/iccprofiles/output/RT_Large_gsRGB.icc
Normal file
BIN
rtdata/iccprofiles/output/RT_Large_gsRGB.icc
Normal file
Binary file not shown.
BIN
rtdata/iccprofiles/output/RT_Middle_gsRGB.icc
Normal file
BIN
rtdata/iccprofiles/output/RT_Middle_gsRGB.icc
Normal file
Binary file not shown.
BIN
rtdata/iccprofiles/output/RT_sRGB.icm
Normal file
BIN
rtdata/iccprofiles/output/RT_sRGB.icm
Normal file
Binary file not shown.
BIN
rtdata/iccprofiles/output/RT_sRGB_g10.icm
Normal file
BIN
rtdata/iccprofiles/output/RT_sRGB_g10.icm
Normal file
Binary file not shown.
BIN
rtdata/iccprofiles/output/RT_sRGB_gBT709.icm
Normal file
BIN
rtdata/iccprofiles/output/RT_sRGB_gBT709.icm
Normal file
Binary file not shown.
Binary file not shown.
@ -193,19 +193,25 @@ ProfileContent ICCStore::getContent (Glib::ustring name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reads all profiles from the given profiles dir
|
// Reads all profiles from the given profiles dir
|
||||||
void ICCStore::init (Glib::ustring usrICCDir, Glib::ustring stdICCDir) {
|
void ICCStore::init (Glib::ustring usrICCDir, Glib::ustring rtICCDir) {
|
||||||
|
|
||||||
Glib::Mutex::Lock lock(mutex_);
|
Glib::Mutex::Lock lock(mutex_);
|
||||||
|
|
||||||
// Load these to different areas, since the short name (e.g. "NIKON D700" may overlap between system/user and RT dir)
|
//
|
||||||
|
fileProfiles.clear();
|
||||||
|
fileProfileContents.clear();
|
||||||
|
// RawTherapee's profiles take precedence if a user's profile of the same name exists
|
||||||
|
loadICCs(Glib::build_filename(rtICCDir, "output"), false, fileProfiles, fileProfileContents);
|
||||||
loadICCs(usrICCDir, false, fileProfiles, fileProfileContents);
|
loadICCs(usrICCDir, false, fileProfiles, fileProfileContents);
|
||||||
loadICCs(stdICCDir, true, fileStdProfiles, fileStdProfileContents);
|
|
||||||
|
// Input profiles
|
||||||
|
// Load these to different areas, since the short name (e.g. "NIKON D700" may overlap between system/user and RT dir)
|
||||||
|
fileStdProfiles.clear();
|
||||||
|
fileStdProfileContents.clear();
|
||||||
|
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<std::string, cmsHPROFILE>& resultProfiles, std::map<std::string, ProfileContent> &resultProfileContents) {
|
||||||
resultProfiles.clear ();
|
|
||||||
resultProfileContents.clear ();
|
|
||||||
|
|
||||||
if (rootDirName!="") {
|
if (rootDirName!="") {
|
||||||
// process directory
|
// process directory
|
||||||
Glib::ustring dirname = rootDirName;
|
Glib::ustring dirname = rootDirName;
|
||||||
@ -293,6 +299,23 @@ ProfileContent::ProfileContent (const ProfileContent& other) {
|
|||||||
data = NULL;
|
data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProfileContent::ProfileContent (cmsHPROFILE hProfile) {
|
||||||
|
|
||||||
|
data = NULL;
|
||||||
|
length = 0;
|
||||||
|
if (hProfile != NULL) {
|
||||||
|
cmsUInt32Number bytesNeeded = 0;
|
||||||
|
cmsSaveProfileToMem(hProfile, 0, &bytesNeeded);
|
||||||
|
if (bytesNeeded > 0)
|
||||||
|
{
|
||||||
|
data = new char[bytesNeeded+1];
|
||||||
|
cmsSaveProfileToMem(hProfile, data, &bytesNeeded);
|
||||||
|
length = (int)bytesNeeded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ProfileContent& ProfileContent::operator= (const ProfileContent other) {
|
ProfileContent& ProfileContent::operator= (const ProfileContent other) {
|
||||||
|
|
||||||
length = other.length;
|
length = other.length;
|
||||||
|
@ -37,6 +37,7 @@ class ProfileContent {
|
|||||||
ProfileContent (): data(NULL), length(0) {}
|
ProfileContent (): data(NULL), length(0) {}
|
||||||
ProfileContent (Glib::ustring fileName);
|
ProfileContent (Glib::ustring fileName);
|
||||||
ProfileContent (const ProfileContent& other);
|
ProfileContent (const ProfileContent& other);
|
||||||
|
ProfileContent (cmsHPROFILE hProfile);
|
||||||
~ProfileContent ();
|
~ProfileContent ();
|
||||||
ProfileContent& operator= (const ProfileContent other);
|
ProfileContent& operator= (const ProfileContent other);
|
||||||
cmsHPROFILE toProfile ();
|
cmsHPROFILE toProfile ();
|
||||||
|
@ -150,7 +150,7 @@ class ImProcFunctions {
|
|||||||
void PF_correct_RT (LabImage * src, LabImage * dst, double radius, int thresh);
|
void PF_correct_RT (LabImage * src, LabImage * dst, double radius, int thresh);
|
||||||
|
|
||||||
Image8* lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile);
|
Image8* lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile);
|
||||||
Image16* lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile, Glib::ustring profi, Glib::ustring gam, bool freegamma, double gampos, double slpos);// for gamma output
|
Image16* lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile, Glib::ustring profi, Glib::ustring gam, bool freegamma, double gampos, double slpos, double &ga0, double &ga1, double &ga2, double &ga3, double &ga4, double &ga5, double &ga6);// for gamma output
|
||||||
Image16* lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile);//without gamma ==>default
|
Image16* lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile);//without gamma ==>default
|
||||||
|
|
||||||
bool transCoord (int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1);
|
bool transCoord (int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1);
|
||||||
|
@ -307,7 +307,7 @@ Image16* ImProcFunctions::lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int
|
|||||||
|
|
||||||
|
|
||||||
// for gamma options (BT709...sRGB linear...)
|
// for gamma options (BT709...sRGB linear...)
|
||||||
Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile, Glib::ustring profi, Glib::ustring gam, bool freegamma, double gampos, double slpos) {
|
Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile, Glib::ustring profi, Glib::ustring gam, bool freegamma, double gampos, double slpos, double &ga0, double &ga1, double &ga2, double &ga3, double &ga4, double &ga5, double &ga6) {
|
||||||
|
|
||||||
//gamutmap(lab);
|
//gamutmap(lab);
|
||||||
|
|
||||||
@ -319,10 +319,11 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int
|
|||||||
Image16* image = new Image16 (cw, ch);
|
Image16* image = new Image16 (cw, ch);
|
||||||
cmsBool rc = TRUE;
|
cmsBool rc = TRUE;
|
||||||
float p1,p2,p3,p4,p5,p6;//primaries
|
float p1,p2,p3,p4,p5,p6;//primaries
|
||||||
double ga0,ga1,ga2,ga3,ga4,ga5=0.0,ga6=0.0;//gamma parameters
|
//double ga0,ga1,ga2,ga3,ga4,ga5=0.0,ga6=0.0;//gamma parameters
|
||||||
double g_a0,g_a1,g_a2,g_a3,g_a4,g_a5;//gamma parameters
|
double g_a0,g_a1,g_a2,g_a3,g_a4,g_a5;//gamma parameters
|
||||||
double pwr;
|
double pwr;
|
||||||
double ts;
|
double ts;
|
||||||
|
ga6=0.0;
|
||||||
pwr=1.0/gampos;
|
pwr=1.0/gampos;
|
||||||
ts=slpos;
|
ts=slpos;
|
||||||
int mode=0, imax=0;
|
int mode=0, imax=0;
|
||||||
@ -331,6 +332,7 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int
|
|||||||
int select_temp =1;//5003K
|
int select_temp =1;//5003K
|
||||||
double eps=0.000000001;// not divide by zero
|
double eps=0.000000001;// not divide by zero
|
||||||
//primaries for 7 working profiles ==> output profiles
|
//primaries for 7 working profiles ==> output profiles
|
||||||
|
// eventually to adapt primaries if RT used special profiles !
|
||||||
if(profi=="ProPhoto") {p1=0.7347; p2=0.2653; p3=0.1596; p4=0.8404; p5=0.0366; p6=0.0001;select_temp=1;}//Prophoto primaries
|
if(profi=="ProPhoto") {p1=0.7347; p2=0.2653; p3=0.1596; p4=0.8404; p5=0.0366; p6=0.0001;select_temp=1;}//Prophoto primaries
|
||||||
else if (profi=="WideGamut") {p1=0.7350; p2=0.2650; p3=0.1150; p4=0.8260; p5=0.1570; p6=0.0180;select_temp=1;}//Widegamut primaries
|
else if (profi=="WideGamut") {p1=0.7350; p2=0.2650; p3=0.1150; p4=0.8260; p5=0.1570; p6=0.0180;select_temp=1;}//Widegamut primaries
|
||||||
else if (profi=="Adobe RGB") {p1=0.6400; p2=0.3300; p3=0.2100; p4=0.7100; p5=0.1500; p6=0.0600;select_temp=2;}//Adobe primaries
|
else if (profi=="Adobe RGB") {p1=0.6400; p2=0.3300; p3=0.2100; p4=0.7100; p5=0.1500; p6=0.0600;select_temp=2;}//Adobe primaries
|
||||||
|
@ -35,11 +35,15 @@ namespace rtengine {
|
|||||||
bool LCMSSafeMode; // If true, not OMP
|
bool LCMSSafeMode; // If true, not OMP
|
||||||
Glib::ustring adobe; // default name of AdobeRGB1998
|
Glib::ustring adobe; // default name of AdobeRGB1998
|
||||||
Glib::ustring prophoto; // default name of Prophoto
|
Glib::ustring prophoto; // default name of Prophoto
|
||||||
|
Glib::ustring prophoto10; // default name of Prophoto
|
||||||
|
|
||||||
Glib::ustring widegamut; //default name of WidegamutRGB
|
Glib::ustring widegamut; //default name of WidegamutRGB
|
||||||
Glib::ustring beta; // default name of BetaRGB
|
Glib::ustring beta; // default name of BetaRGB
|
||||||
Glib::ustring best; // default name of BestRGB
|
Glib::ustring best; // default name of BestRGB
|
||||||
Glib::ustring bruce; // default name of Bruce
|
Glib::ustring bruce; // default name of Bruce
|
||||||
Glib::ustring srgb; // default name of SRGB space profile
|
Glib::ustring srgb; // default name of SRGB space profile
|
||||||
|
Glib::ustring srgb10; // default name of SRGB space profile
|
||||||
|
|
||||||
bool gamutICC; //
|
bool gamutICC; //
|
||||||
|
|
||||||
/** Creates a new instance of Settings.
|
/** Creates a new instance of Settings.
|
||||||
|
@ -125,8 +125,6 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update blurmap
|
// update blurmap
|
||||||
|
|
||||||
|
|
||||||
SHMap* shmap = NULL;
|
SHMap* shmap = NULL;
|
||||||
if (params.sh.enabled) {
|
if (params.sh.enabled) {
|
||||||
shmap = new SHMap (fw, fh, true);
|
shmap = new SHMap (fw, fh, true);
|
||||||
@ -152,10 +150,10 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
|||||||
}
|
}
|
||||||
|
|
||||||
// at this stage, we can flush the raw data to free up quite an important amount of memory
|
// at this stage, we can flush the raw data to free up quite an important amount of memory
|
||||||
imgsrc->flushRawData();
|
// commented out because it make the application crash when batch processing...
|
||||||
|
// TODO: find a better place to flush rawData and rawRGB
|
||||||
// at this stage, we can flush the raw data to free up quite an important amount of memory
|
//imgsrc->flushRawData();
|
||||||
imgsrc->flushRGB();
|
//imgsrc->flushRGB();
|
||||||
|
|
||||||
LUTf curve1 (65536,0);
|
LUTf curve1 (65536,0);
|
||||||
LUTf curve2 (65536,0);
|
LUTf curve2 (65536,0);
|
||||||
@ -170,8 +168,13 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
|||||||
|
|
||||||
ipf.rgbProc (baseImg, labView, curve1, curve2, curve, shmap, params.toneCurve.saturation);
|
ipf.rgbProc (baseImg, labView, curve1, curve2, curve, shmap, params.toneCurve.saturation);
|
||||||
|
|
||||||
|
// Freeing baseImg because not used anymore
|
||||||
|
delete baseImg;
|
||||||
|
baseImg = NULL;
|
||||||
|
|
||||||
if (shmap)
|
if (shmap)
|
||||||
delete shmap;
|
delete shmap;
|
||||||
|
shmap = NULL;
|
||||||
|
|
||||||
if (pl)
|
if (pl)
|
||||||
pl->setProgress (0.5);
|
pl->setProgress (0.5);
|
||||||
@ -228,23 +231,27 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
|||||||
cw = params.crop.w;
|
cw = params.crop.w;
|
||||||
ch = params.crop.h;
|
ch = params.crop.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Image16* readyImg = NULL;
|
||||||
|
cmsHPROFILE jprof = NULL;
|
||||||
|
bool customGamma = false;
|
||||||
|
bool useLCMS;
|
||||||
|
|
||||||
if(params.icm.gamma != "default" || params.icm.freegamma) { // if select gamma output between BT709, sRGB, linear, low, high, 2.2 , 1.8
|
if(params.icm.gamma != "default" || params.icm.freegamma) { // if select gamma output between BT709, sRGB, linear, low, high, 2.2 , 1.8
|
||||||
|
double ga0,ga1,ga2,ga3,ga4,ga5,ga6;
|
||||||
|
readyImg = ipf.lab2rgb16b (labView, cx, cy, cw, ch, params.icm.output, params.icm.working, params.icm.gamma, params.icm.freegamma, params.icm.gampos, params.icm.slpos, ga0,ga1,ga2,ga3,ga4,ga5,ga6 );
|
||||||
|
customGamma = true;
|
||||||
|
|
||||||
//or selected Free gamma
|
//or selected Free gamma
|
||||||
Image16* readyImgP;
|
useLCMS=false;
|
||||||
Image16* readyImg = ipf.lab2rgb16b (labView, cx, cy, cw, ch, params.icm.output, params.icm.working, params.icm.gamma, params.icm.freegamma, params.icm.gampos, params.icm.slpos);
|
bool pro=false;
|
||||||
readyImgP=readyImg;
|
|
||||||
delete labView;
|
|
||||||
if (pl) pl->setProgress (0.70);
|
|
||||||
int drapeau=0;
|
|
||||||
// get the resize parameters
|
|
||||||
int refw, refh;
|
|
||||||
double tmpScale;
|
|
||||||
Glib::ustring chpro, outProfile;
|
Glib::ustring chpro, outProfile;
|
||||||
int present_space[7]={0,0,0,0,0,0,0};
|
bool present_space[9]={false,false,false,false,false,false,false,false,false};
|
||||||
std::vector<std::string> opnames = iccStore->getOutputProfiles ();
|
std::vector<std::string> opnames = iccStore->getOutputProfiles ();
|
||||||
//test if files are in system
|
//test if files are in system
|
||||||
for (int j=0; j<7;j++) {
|
for (int j=0; j<9; j++) {
|
||||||
// one can modify "option" [Color Management] to adapt name of profile if there are different for windows, MacOS, Linux ??
|
// 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) chpro=options.rtSettings.prophoto;
|
if (j==0) chpro=options.rtSettings.prophoto;
|
||||||
else if(j==1) chpro=options.rtSettings.adobe;
|
else if(j==1) chpro=options.rtSettings.adobe;
|
||||||
else if(j==2) chpro=options.rtSettings.widegamut;
|
else if(j==2) chpro=options.rtSettings.widegamut;
|
||||||
@ -252,122 +259,79 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
|||||||
else if(j==4) chpro=options.rtSettings.best;
|
else if(j==4) chpro=options.rtSettings.best;
|
||||||
else if(j==5) chpro=options.rtSettings.bruce;
|
else if(j==5) chpro=options.rtSettings.bruce;
|
||||||
else if(j==6) chpro=options.rtSettings.srgb;
|
else if(j==6) chpro=options.rtSettings.srgb;
|
||||||
for (int i=0; i<opnames.size(); i++) {
|
else if(j==7) chpro=options.rtSettings.srgb10;//gamma 1.0
|
||||||
if(chpro.compare(opnames[i]) ==0) present_space[j]=1;
|
else if(j==8) chpro=options.rtSettings.prophoto10;//gamma 1.0
|
||||||
|
|
||||||
|
for (unsigned int i=0; i<opnames.size(); i++) {
|
||||||
|
if(chpro.compare(opnames[i]) ==0) present_space[j]=true;
|
||||||
}
|
}
|
||||||
if (present_space[j]==0) {
|
if (!present_space[j] && settings->verbose) printf("Missing file: %s\n", chpro.c_str());
|
||||||
if (pl) pl->setProgressStr ("Missing file..");
|
|
||||||
pl->setProgress (0.0);// display file not present: not very good display information...!!
|
|
||||||
if (settings->verbose) printf("Missing file: %s \n", chpro.c_str());
|
|
||||||
} //c_str()
|
|
||||||
}
|
}
|
||||||
|
if (params.icm.freegamma && params.icm.gampos < 1.35) pro=true; //select profil with gammaTRC modified :
|
||||||
|
else if (params.icm.gamma=="linear_g1.0" || (params.icm.gamma=="High_g1.3_s3.35")) pro=true;//pro=0 RT_sRGB || Prophoto
|
||||||
|
|
||||||
// Check that output profiles exist, otherwise use LCMS2
|
// Check that output profiles exist, otherwise use LCMS2
|
||||||
if (params.icm.working=="ProPhoto" && present_space[0]==1) outProfile=options.rtSettings.prophoto;//in option we can change the name of file - if different...
|
// Use the icc/icm profiles associated to possible working profiles, set in "options"
|
||||||
else if (params.icm.working=="Adobe RGB" && present_space[1]==1) outProfile=options.rtSettings.adobe;
|
if (params.icm.working=="ProPhoto" && present_space[0] && !pro) outProfile=options.rtSettings.prophoto;
|
||||||
else if (params.icm.working=="WideGamut" && present_space[2]==1) outProfile=options.rtSettings.widegamut;
|
else if (params.icm.working=="Adobe RGB" && present_space[1] ) outProfile=options.rtSettings.adobe;
|
||||||
else if (params.icm.working=="Beta RGB" && present_space[3]==1) outProfile=options.rtSettings.beta;
|
else if (params.icm.working=="WideGamut" && present_space[2] ) outProfile=options.rtSettings.widegamut;
|
||||||
else if (params.icm.working=="BestRGB" && present_space[4]==1) outProfile=options.rtSettings.best;
|
else if (params.icm.working=="Beta RGB" && present_space[3] ) outProfile=options.rtSettings.beta;
|
||||||
else if (params.icm.working=="BruceRGB" && present_space[5]==1) outProfile=options.rtSettings.bruce;
|
else if (params.icm.working=="BestRGB" && present_space[4] ) outProfile=options.rtSettings.best;
|
||||||
else if (params.icm.working== "sRGB" && present_space[6]==1) outProfile=options.rtSettings.srgb;
|
else if (params.icm.working=="BruceRGB" && present_space[5] ) outProfile=options.rtSettings.bruce;
|
||||||
//OutProfile become Profile's system
|
else if (params.icm.working=="sRGB" && present_space[6] && !pro) outProfile=options.rtSettings.srgb;
|
||||||
else {if (settings->verbose) printf("No file:%s in system - use LCMS2 substitution\n",params.icm.working.c_str() ); drapeau=1; }
|
else if (params.icm.working=="sRGB" && present_space[7] && pro) outProfile=options.rtSettings.srgb10;
|
||||||
|
else if (params.icm.working=="ProPhoto" && present_space[8] && pro) outProfile=options.rtSettings.prophoto10;
|
||||||
|
else {
|
||||||
|
// Should not occurs
|
||||||
|
if (settings->verbose) printf("\"%s\": unknown working profile! - use LCMS2 substitution\n", params.icm.working.c_str() );
|
||||||
|
useLCMS=true;
|
||||||
|
}
|
||||||
|
|
||||||
if (settings->verbose && drapeau==0) printf("Output profile: %s \n", outProfile.c_str()); //c_str()
|
//begin adaptation rTRC gTRC bTRC
|
||||||
|
//"jprof" profile has the same characteristics than RGB values, but TRC are adapted... for applying profile
|
||||||
|
if (!useLCMS) {
|
||||||
|
if (settings->verbose) printf("Output Gamma - profile: \"%s\"\n", outProfile.c_str() ); //c_str()
|
||||||
|
jprof = iccStore->getProfile(outProfile); //get output profile
|
||||||
|
if (jprof == NULL) {
|
||||||
|
useLCMS = true;
|
||||||
|
if (settings->verbose) printf("\"%s\" ICC output profile not found!\n", outProfile.c_str());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cmsToneCurve* GammaTRC[3];
|
||||||
|
cmsFloat64Number Parameters[7];
|
||||||
|
Parameters[0] = ga0;
|
||||||
|
Parameters[1] = ga1;
|
||||||
|
Parameters[2] = ga2;
|
||||||
|
Parameters[3] = ga3;
|
||||||
|
Parameters[4] = ga4;
|
||||||
|
Parameters[5] = ga5;
|
||||||
|
Parameters[6] = ga6;
|
||||||
|
// 7 parameters for smoother curves
|
||||||
|
// Calculate output profile's rTRC bTRC gTRC
|
||||||
|
GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(NULL, 5, Parameters);
|
||||||
|
cmsWriteTag(jprof, cmsSigGreenTRCTag, (void*)GammaTRC[1] );
|
||||||
|
cmsWriteTag(jprof, cmsSigRedTRCTag, (void*)GammaTRC[0] );
|
||||||
|
cmsWriteTag(jprof, cmsSigBlueTRCTag, (void*)GammaTRC[2] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// if Default gamma mode: we use the profile selected in the "Output profile" combobox;
|
||||||
|
// gamma come from the selected profile, otherwise it comes from "Free gamma" tool
|
||||||
|
readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm.output);
|
||||||
|
if (settings->verbose) printf("Output profile: \"%s\"\n", params.icm.output.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
delete labView;
|
||||||
|
labView = NULL;
|
||||||
|
|
||||||
|
if (pl) pl->setProgress (0.70);
|
||||||
|
|
||||||
if (params.resize.enabled) {
|
if (params.resize.enabled) {
|
||||||
|
|
||||||
if (params.crop.enabled && params.resize.appliesTo == "Cropped area") {
|
|
||||||
// the resize values applies to the crop dimensions
|
|
||||||
refw = cw;
|
|
||||||
refh = ch;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// the resize values applies to the image dimensions
|
|
||||||
// if a crop exists, it will be resized to the calculated scale
|
|
||||||
refw = fw;
|
|
||||||
refh = fh;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(params.resize.dataspec) {
|
|
||||||
case (1):
|
|
||||||
// Width
|
|
||||||
tmpScale = (double)params.resize.width/(double)refw;
|
|
||||||
break;
|
|
||||||
case (2):
|
|
||||||
// Height
|
|
||||||
tmpScale = (double)params.resize.height/(double)refh;
|
|
||||||
break;
|
|
||||||
case (3):
|
|
||||||
// FitBox
|
|
||||||
if ((double)refw/(double)refh > (double)params.resize.width/(double)params.resize.height)
|
|
||||||
tmpScale = (double)params.resize.width/(double)refw;
|
|
||||||
else
|
|
||||||
tmpScale = (double)params.resize.height/(double)refh;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// Scale
|
|
||||||
tmpScale = params.resize.scale;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// resize image
|
|
||||||
if (fabs(tmpScale-1.0)>1e-5) {
|
|
||||||
int imw, imh;
|
|
||||||
if (params.crop.enabled && params.resize.appliesTo == "Full image") {
|
|
||||||
imw = cw;
|
|
||||||
imh = ch;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
imw = refw;
|
|
||||||
imh = refh;
|
|
||||||
}
|
|
||||||
imw = (int)( (double)imw * tmpScale + 0.5 );
|
|
||||||
imh = (int)( (double)imh * tmpScale + 0.5 );
|
|
||||||
Image16* tempImage = new Image16 (imw, imh);
|
|
||||||
ipf.resize (readyImg, tempImage, tmpScale);
|
|
||||||
delete readyImg;
|
|
||||||
readyImg = tempImage;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (tunnelMetaData)
|
|
||||||
readyImg->setMetadata (ii->getMetaData()->getExifData ());
|
|
||||||
else
|
|
||||||
readyImg->setMetadata (ii->getMetaData()->getExifData (), params.exif, params.iptc);
|
|
||||||
|
|
||||||
|
|
||||||
ProfileContent pc;
|
|
||||||
|
|
||||||
if (drapeau==0) pc = iccStore->getContent (outProfile);// use profile in system (Prophoto.icm, sRGB.icm, etc.) if present, otherwise use LCMS2 profile generate by lab2rgb16b
|
|
||||||
|
|
||||||
readyImg->setOutputProfile (pc.data, pc.length);
|
|
||||||
|
|
||||||
delete baseImg;
|
|
||||||
|
|
||||||
if (!job->initialImage)
|
|
||||||
ii->decreaseRef ();
|
|
||||||
|
|
||||||
delete job;
|
|
||||||
if (pl)
|
|
||||||
pl->setProgress (0.75);
|
|
||||||
|
|
||||||
return readyImg;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//if default mode : profil = selection by choice in list (Prophoto.icm, sRGB.icm, etc., etc.) , gamma = gamma of profile or not selected Free gamma
|
|
||||||
Image16* readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm.output);
|
|
||||||
delete labView;
|
|
||||||
if (pl) pl->setProgress (0.70);
|
|
||||||
|
|
||||||
// get the resize parameters
|
// get the resize parameters
|
||||||
int refw, refh;
|
int refw, refh;
|
||||||
double tmpScale;
|
double tmpScale;
|
||||||
|
|
||||||
if (params.resize.enabled) {
|
|
||||||
|
|
||||||
if (params.crop.enabled && params.resize.appliesTo == "Cropped area") {
|
if (params.crop.enabled && params.resize.appliesTo == "Cropped area") {
|
||||||
// the resize values applies to the crop dimensions
|
// the resize values applies to the crop dimensions
|
||||||
refw = cw;
|
refw = cw;
|
||||||
@ -429,13 +393,37 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
|||||||
readyImg->setMetadata (ii->getMetaData()->getExifData (), params.exif, params.iptc);
|
readyImg->setMetadata (ii->getMetaData()->getExifData (), params.exif, params.iptc);
|
||||||
|
|
||||||
|
|
||||||
ProfileContent pc;
|
// Setting the output curve to readyImg
|
||||||
if (params.icm.output!="" && params.icm.output!=ColorManagementParams::NoICMString)
|
if (customGamma) {
|
||||||
pc = iccStore->getContent (params.icm.output);
|
if (!useLCMS) {
|
||||||
|
// use corrected sRGB profile in order to apply a good TRC if present, otherwise use LCMS2 profile generate by lab2rgb16b
|
||||||
|
ProfileContent pc(jprof);
|
||||||
readyImg->setOutputProfile (pc.data, pc.length);
|
readyImg->setOutputProfile (pc.data, pc.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// use RT_sRGB.icm profile if present, otherwise use LCMS2 profile generate by lab2rgb16b
|
||||||
|
Glib::ustring outputProfile;
|
||||||
|
if (params.icm.output!="" && params.icm.output!=ColorManagementParams::NoICMString) {
|
||||||
|
outputProfile = params.icm.output;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// use RT_sRGB.icm profile if present, otherwise use LCMS2 profile generate by lab2rgb16b
|
||||||
|
if (settings->verbose) printf("No output profiles set ; looking for the default sRGB profile (\"%s\")...\n", options.rtSettings.srgb.c_str());
|
||||||
|
outputProfile = options.rtSettings.srgb;
|
||||||
|
}
|
||||||
|
|
||||||
delete baseImg;
|
// if iccStore->getProfile send back an object, then iccStore->getContent will do too
|
||||||
|
cmsHPROFILE jprof = iccStore->getProfile(outputProfile); //get outProfile
|
||||||
|
if (jprof == NULL) {
|
||||||
|
if (settings->verbose) printf("\"%s\" ICC output profile not found!\n - use LCMS2 substitution\n", outputProfile.c_str());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (settings->verbose) printf("Using \"%s\" output profile\n", outputProfile.c_str());
|
||||||
|
ProfileContent pc = iccStore->getContent (outputProfile);
|
||||||
|
readyImg->setOutputProfile (pc.data, pc.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!job->initialImage)
|
if (!job->initialImage)
|
||||||
ii->decreaseRef ();
|
ii->decreaseRef ();
|
||||||
@ -445,8 +433,6 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
|||||||
pl->setProgress (0.75);
|
pl->setProgress (0.75);
|
||||||
|
|
||||||
return readyImg;
|
return readyImg;
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl, bool tunnelMetaData) {
|
void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl, bool tunnelMetaData) {
|
||||||
|
@ -234,10 +234,12 @@ void Options::setDefaults () {
|
|||||||
rtSettings.monitorProfile = "";
|
rtSettings.monitorProfile = "";
|
||||||
rtSettings.autoMonitorProfile = false;
|
rtSettings.autoMonitorProfile = false;
|
||||||
rtSettings.LCMSSafeMode = true;
|
rtSettings.LCMSSafeMode = true;
|
||||||
rtSettings.adobe = "AdobeRGB1998"; // put the name of yours profiles (here windows)
|
rtSettings.adobe = "RT_Middle_gsRGB"; // put the name of yours profiles (here windows)
|
||||||
rtSettings.prophoto = "ProPhoto"; // these names appear in the menu "output profile"
|
rtSettings.prophoto = "RT_Large_gBT709"; // these names appear in the menu "output profile"
|
||||||
|
rtSettings.prophoto10 = "RT_Large_g10"; // these names appear in the menu "output profile"
|
||||||
|
rtSettings.srgb10 = "RT_sRGB_g10";
|
||||||
rtSettings.widegamut = "WideGamutRGB";
|
rtSettings.widegamut = "WideGamutRGB";
|
||||||
rtSettings.srgb = "sRGB Color Space Profile";
|
rtSettings.srgb = "RT_sRGB_gBT709";
|
||||||
rtSettings.bruce = "Bruce";
|
rtSettings.bruce = "Bruce";
|
||||||
rtSettings.beta = "BetaRGB";
|
rtSettings.beta = "BetaRGB";
|
||||||
rtSettings.best = "BestRGB";
|
rtSettings.best = "BestRGB";
|
||||||
@ -432,10 +434,14 @@ if (keyFile.has_group ("Color Management")) {
|
|||||||
|
|
||||||
if (keyFile.has_key ("Color Management", "WhiteBalanceSpotSize")) whiteBalanceSpotSize = keyFile.get_integer("Color Management", "WhiteBalanceSpotSize");
|
if (keyFile.has_key ("Color Management", "WhiteBalanceSpotSize")) whiteBalanceSpotSize = keyFile.get_integer("Color Management", "WhiteBalanceSpotSize");
|
||||||
if( keyFile.has_key ("Color Management", "GamutICC")) rtSettings.gamutICC = keyFile.get_boolean("Color Management", "GamutICC");
|
if( keyFile.has_key ("Color Management", "GamutICC")) rtSettings.gamutICC = keyFile.get_boolean("Color Management", "GamutICC");
|
||||||
if( keyFile.has_key ("Color Management", "Adobe_RGB")) rtSettings.adobe = keyFile.get_string("Color Management", "Adobe_RGB");
|
if( keyFile.has_key ("Color Management", "RT_Adobe_RGB")) rtSettings.adobe = keyFile.get_string("Color Management", "RT_Adobe_RGB");
|
||||||
if( keyFile.has_key ("Color Management", "Pro_Photo")) rtSettings.prophoto = keyFile.get_string("Color Management","Pro_Photo");
|
if( keyFile.has_key ("Color Management", "RT_Pro_Photo")) rtSettings.prophoto = keyFile.get_string("Color Management","RT_Pro_Photo");
|
||||||
|
if( keyFile.has_key ("Color Management", "RT_Pro_Photo10")) rtSettings.prophoto10 = keyFile.get_string("Color Management","RT_Pro_Photo10");
|
||||||
|
|
||||||
if( keyFile.has_key ("Color Management", "Wide_Gamut")) rtSettings.widegamut = keyFile.get_string("Color Management","Wide_Gamut");
|
if( keyFile.has_key ("Color Management", "Wide_Gamut")) rtSettings.widegamut = keyFile.get_string("Color Management","Wide_Gamut");
|
||||||
if( keyFile.has_key ("Color Management", "S_rgb")) rtSettings.srgb = keyFile.get_string("Color Management","S_rgb");
|
if( keyFile.has_key ("Color Management", "RT_S_rgb")) rtSettings.srgb = keyFile.get_string("Color Management","RT_S_rgb");
|
||||||
|
if( keyFile.has_key ("Color Management", "RT_S_rgb10")) rtSettings.srgb10 = keyFile.get_string("Color Management","RT_S_rgb10");
|
||||||
|
|
||||||
if( keyFile.has_key ("Color Management", "B_eta")) rtSettings.beta = keyFile.get_string("Color Management","B_eta");
|
if( keyFile.has_key ("Color Management", "B_eta")) rtSettings.beta = keyFile.get_string("Color Management","B_eta");
|
||||||
if( keyFile.has_key ("Color Management", "B_est")) rtSettings.best = keyFile.get_string("Color Management","B_est");
|
if( keyFile.has_key ("Color Management", "B_est")) rtSettings.best = keyFile.get_string("Color Management","B_est");
|
||||||
if( keyFile.has_key ("Color Management", "B_ruce")) rtSettings.bruce = keyFile.get_string("Color Management","B_ruce");
|
if( keyFile.has_key ("Color Management", "B_ruce")) rtSettings.bruce = keyFile.get_string("Color Management","B_ruce");
|
||||||
@ -609,10 +615,14 @@ int Options::saveToFile (Glib::ustring fname) {
|
|||||||
keyFile.set_boolean ("Color Management", "AutoMonitorProfile", rtSettings.autoMonitorProfile);
|
keyFile.set_boolean ("Color Management", "AutoMonitorProfile", rtSettings.autoMonitorProfile);
|
||||||
keyFile.set_integer ("Color Management", "Intent", rtSettings.colorimetricIntent);
|
keyFile.set_integer ("Color Management", "Intent", rtSettings.colorimetricIntent);
|
||||||
keyFile.set_boolean ("Color Management", "LCMSSafeMode", rtSettings.LCMSSafeMode);
|
keyFile.set_boolean ("Color Management", "LCMSSafeMode", rtSettings.LCMSSafeMode);
|
||||||
keyFile.set_string ("Color Management", "Adobe_RGB", rtSettings.adobe);
|
keyFile.set_string ("Color Management", "RT_Adobe_RGB", rtSettings.adobe);
|
||||||
keyFile.set_string ("Color Management", "Pro_Photo", rtSettings.prophoto);
|
keyFile.set_string ("Color Management", "RT_Pro_Photo", rtSettings.prophoto);
|
||||||
|
keyFile.set_string ("Color Management", "RT_Pro_Photo10", rtSettings.prophoto10);
|
||||||
|
|
||||||
keyFile.set_string ("Color Management", "Wide_Gamut", rtSettings.widegamut);
|
keyFile.set_string ("Color Management", "Wide_Gamut", rtSettings.widegamut);
|
||||||
keyFile.set_string ("Color Management", "S_rgb", rtSettings.srgb);
|
keyFile.set_string ("Color Management", "RT_S_rgb", rtSettings.srgb);
|
||||||
|
keyFile.set_string ("Color Management", "RT_S_rgb10", rtSettings.srgb10);
|
||||||
|
|
||||||
keyFile.set_string ("Color Management", "B_eta", rtSettings.beta);
|
keyFile.set_string ("Color Management", "B_eta", rtSettings.beta);
|
||||||
keyFile.set_string ("Color Management", "B_est", rtSettings.best);
|
keyFile.set_string ("Color Management", "B_est", rtSettings.best);
|
||||||
keyFile.set_string ("Color Management", "B_ruce", rtSettings.bruce);
|
keyFile.set_string ("Color Management", "B_ruce", rtSettings.bruce);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user