Automatic ICC profile detection

see issue 938
This commit is contained in:
Oliver Duis 2011-08-30 07:12:07 +02:00
parent 76181828df
commit ec918d2f56
14 changed files with 113 additions and 110 deletions

View File

@ -863,7 +863,8 @@ TP_HSVEQUALIZER_VAL;V
TP_ICM_FILEDLGFILTERANY;Any files TP_ICM_FILEDLGFILTERANY;Any files
TP_ICM_FILEDLGFILTERICM;ICC Profile Files TP_ICM_FILEDLGFILTERICM;ICC Profile Files
TP_ICM_GAMMABEFOREINPUT;Profile applies Gamma TP_ICM_GAMMABEFOREINPUT;Profile applies Gamma
TP_ICM_INPUTCAMERA;Camera default TP_ICM_INPUTCAMERA;Camera standard
TP_ICM_INPUTCAMERAICC;Camera standard or ICC
TP_ICM_INPUTCUSTOM;Custom TP_ICM_INPUTCUSTOM;Custom
TP_ICM_INPUTDLGLABEL;Select Input ICC Profile... TP_ICM_INPUTDLGLABEL;Select Input ICC Profile...
TP_ICM_INPUTEMBEDDED;Use Embedded, if possible TP_ICM_INPUTEMBEDDED;Use Embedded, if possible

View File

@ -174,6 +174,17 @@ cmsHPROFILE ICCStore::getProfile (Glib::ustring name) {
return NULL; return NULL;
} }
cmsHPROFILE ICCStore::getStdProfile (Glib::ustring name) {
Glib::Mutex::Lock lock(mutex_);
std::map<std::string, cmsHPROFILE>::iterator r = fileStdProfiles.find (name.uppercase());
if (r==fileProfiles.end()) return NULL;
return r->second;
}
ProfileContent ICCStore::getContent (Glib::ustring name) { ProfileContent ICCStore::getContent (Glib::ustring name) {
Glib::Mutex::Lock lock(mutex_); Glib::Mutex::Lock lock(mutex_);
@ -181,24 +192,30 @@ ProfileContent ICCStore::getContent (Glib::ustring name) {
return fileProfileContents[name]; return fileProfileContents[name];
} }
std::vector<std::string> ICCStore::parseDir (Glib::ustring pdir) { // Reads all profiles from the given profiles dir
void ICCStore::init (Glib::ustring usrICCDir, Glib::ustring stdICCDir) {
Glib::Mutex::Lock lock(mutex_); Glib::Mutex::Lock lock(mutex_);
fileProfiles.clear (); // Load these to different areas, since the short name (e.g. "NIKON D700" may overlap between system/user and RT dir)
fileProfileContents.clear (); loadICCs(usrICCDir, false, fileProfiles, fileProfileContents);
std::vector<std::string> result; loadICCs(stdICCDir, true, fileStdProfiles, fileStdProfileContents);
if (pdir!="") { }
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!="") {
// process directory // process directory
Glib::ustring dirname = pdir; Glib::ustring dirname = rootDirName;
Glib::Dir* dir = NULL; Glib::Dir* dir = NULL;
try { try {
if (!safe_file_test (dirname, Glib::FILE_TEST_IS_DIR)) if (!safe_file_test (dirname, Glib::FILE_TEST_IS_DIR)) return;
return result;
dir = new Glib::Dir (dirname); dir = new Glib::Dir (dirname);
} }
catch (Glib::Exception& fe) { catch (Glib::Exception& fe) {
return result; return;
} }
dirname = dirname + "/"; dirname = dirname + "/";
for (Glib::DirIterator i = dir->begin(); i!=dir->end(); ++i) { for (Glib::DirIterator i = dir->begin(); i!=dir->end(); ++i) {
@ -208,15 +225,13 @@ std::vector<std::string> ICCStore::parseDir (Glib::ustring pdir) {
if (!safe_file_test (fname, Glib::FILE_TEST_IS_DIR)) { if (!safe_file_test (fname, Glib::FILE_TEST_IS_DIR)) {
int lastdot = sname.find_last_of ('.'); int lastdot = sname.find_last_of ('.');
if (lastdot!=Glib::ustring::npos && lastdot<=(int)sname.size()-4 && (!sname.casefold().compare (lastdot, 4, ".icm") || !sname.casefold().compare (lastdot, 4, ".icc"))) { if (lastdot!=Glib::ustring::npos && lastdot<=(int)sname.size()-4 && (!sname.casefold().compare (lastdot, 4, ".icm") || !sname.casefold().compare (lastdot, 4, ".icc"))) {
// printf ("processing file %s...\n", fname.c_str()); Glib::ustring name = nameUpper ? sname.substr(0,lastdot).uppercase() : sname.substr(0,lastdot);
Glib::ustring name = sname.substr(0,lastdot);
ProfileContent pc (fname); ProfileContent pc (fname);
if (pc.data) { if (pc.data) {
cmsHPROFILE profile = pc.toProfile (); cmsHPROFILE profile = pc.toProfile ();
if (profile) { if (profile) {
fileProfiles[name] = profile; resultProfiles[name] = profile;
fileProfileContents[name] = pc; resultProfileContents[name] = pc;
result.push_back (name);
} }
} }
} }
@ -224,7 +239,6 @@ std::vector<std::string> ICCStore::parseDir (Glib::ustring pdir) {
} }
delete dir; delete dir;
} }
return result;
} }
// Determine the first monitor default profile of operating system, if selected // Determine the first monitor default profile of operating system, if selected

View File

@ -49,15 +49,21 @@ class ICCStore {
std::map<std::string, TMatrix> wMatrices; std::map<std::string, TMatrix> wMatrices;
std::map<std::string, TMatrix> iwMatrices; std::map<std::string, TMatrix> iwMatrices;
// these contain profiles from user/system directory (supplied on init)
std::map<std::string, cmsHPROFILE> fileProfiles; std::map<std::string, cmsHPROFILE> fileProfiles;
std::map<std::string, ProfileContent> fileProfileContents; std::map<std::string, 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;
cmsHPROFILE xyz; cmsHPROFILE xyz;
cmsHPROFILE srgb; cmsHPROFILE srgb;
Glib::Mutex mutex_; Glib::Mutex mutex_;
ICCStore (); ICCStore ();
void loadICCs(Glib::ustring rootDirName, bool nameUpper, std::map<std::string, cmsHPROFILE>& resultProfiles, std::map<std::string, ProfileContent> &resultProfileContents);
public: public:
@ -74,7 +80,9 @@ class ICCStore {
TMatrix workingSpaceInverseMatrix (Glib::ustring name); TMatrix workingSpaceInverseMatrix (Glib::ustring name);
cmsHPROFILE getProfile (Glib::ustring name); cmsHPROFILE getProfile (Glib::ustring name);
std::vector<std::string> parseDir (Glib::ustring pdir); cmsHPROFILE getStdProfile(Glib::ustring name);
void init (Glib::ustring usrICCDir, Glib::ustring stdICCDir);
ProfileContent getContent (Glib::ustring name); ProfileContent getContent (Glib::ustring name);
cmsHPROFILE getXYZProfile () { return xyz; } cmsHPROFILE getXYZProfile () { return xyz; }

View File

@ -31,10 +31,10 @@ const Settings* settings;
Glib::Mutex* lcmsMutex = NULL; Glib::Mutex* lcmsMutex = NULL;
int init (const Settings* s) { int init (const Settings* s, Glib::ustring baseDir) {
settings = s; settings = s;
iccStore->parseDir (s->iccDirectory); iccStore->init (s->iccDirectory, baseDir + "/iccprofiles");
iccStore->findDefaultMonitorProfile(); iccStore->findDefaultMonitorProfile();
CurveFactory::init (); CurveFactory::init ();

View File

@ -420,7 +420,7 @@ void RawImageSource::getImage (ColorTemp ctemp, int tran, Imagefloat* image, Pre
// Color correction (only when running on full resolution) // Color correction (only when running on full resolution)
if (ri->isBayer() && pp.skip==1) if (ri->isBayer() && pp.skip==1)
processFalseColorCorrection (image, raw.ccSteps); processFalseColorCorrection (image, raw.ccSteps);
colorSpaceConversion (image, cmp, embProfile, camProfile, xyz_cam, defGain); colorSpaceConversion (image, cmp, embProfile, camProfile, xyz_cam, ((const ImageData*)getMetaData())->getCamera(), defGain);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -1563,47 +1563,18 @@ void RawImageSource::processFalseColorCorrection (Imagefloat* im, int steps) {
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// Converts raw image including ICC input profile to working space - floating point version
void RawImageSource::colorSpaceConversion (Imagefloat* im, ColorManagementParams cmp, cmsHPROFILE embedded, cmsHPROFILE camprofile, double camMatrix[3][3], std::string camName, double& defgain) {
void RawImageSource::colorSpaceConversion (Imagefloat* im, ColorManagementParams cmp, cmsHPROFILE embedded, cmsHPROFILE camprofile, double camMatrix[3][3], double& defgain) { //MyTime t1, t2, t3;
//t1.set ();
//camMatrix is cam2xyz = xyz_cam
if (cmp.input == "(none)")
return;
MyTime t1, t2, t3;
t1.set ();
cmsHPROFILE in; cmsHPROFILE in;
cmsHPROFILE out; if (!findInputProfile(cmp.input, embedded, camName, in)) return;
Glib::ustring inProfile = cmp.input; if (in==NULL) {
// use default camprofile, supplied by dcraw
if (inProfile=="(embedded)") {
if (embedded)
in = embedded;
else
in = camprofile;
}
else if (inProfile=="(camera)" || inProfile=="")
in = camprofile;
else {
in = iccStore->getProfile (inProfile);
if (in==NULL)
inProfile = "(camera)";
}
if (inProfile=="(camera)" || inProfile=="" || (inProfile=="(embedded)" && !embedded)) {
// use default profiles supplied by dcraw
// in this case we avoid using the slllllooooooowwww lcms // in this case we avoid using the slllllooooooowwww lcms
// out = iccStore->workingSpace (wProfile);
// hTransform = cmsCreateTransform (in, (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)|PLANAR_SH(1)), out, (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)|PLANAR_SH(1)), settings->colorimetricIntent, cmsFLAGS_MATRIXINPUT | cmsFLAGS_MATRIXOUTPUT);//cmsFLAGS_MATRIXINPUT | cmsFLAGS_MATRIXOUTPUT);
// cmsDoTransform (hTransform, im->data, im->data, im->planestride/2);
// cmsDeleteTransform(hTransform);
TMatrix work = iccStore->workingSpaceInverseMatrix (cmp.working); TMatrix work = iccStore->workingSpaceInverseMatrix (cmp.working);
float mat[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}; float mat[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
for (int i=0; i<3; i++) for (int i=0; i<3; i++)
@ -1633,7 +1604,7 @@ void RawImageSource::colorSpaceConversion (Imagefloat* im, ColorManagementParams
im->g[h][w] /= 65535.0f ; im->g[h][w] /= 65535.0f ;
im->b[h][w] /= 65535.0f ; im->b[h][w] /= 65535.0f ;
} }
out = iccStore->workingSpace (cmp.working); cmsHPROFILE out = iccStore->workingSpace (cmp.working);
// out = iccStore->workingSpaceGamma (wProfile); // out = iccStore->workingSpaceGamma (wProfile);
lcmsMutex->lock (); lcmsMutex->lock ();
@ -1678,53 +1649,21 @@ void RawImageSource::colorSpaceConversion (Imagefloat* im, ColorManagementParams
im->b[h][w] *= 65535.0 ; im->b[h][w] *= 65535.0 ;
} }
} }
t3.set ();
//t3.set ();
// printf ("ICM TIME: %d\n", t3.etime(t1)); // printf ("ICM TIME: %d\n", t3.etime(t1));
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void RawImageSource::colorSpaceConversion16 (Image16* im, ColorManagementParams cmp, cmsHPROFILE embedded, cmsHPROFILE camprofile, double camMatrix[3][3], double& defgain) { // Converts raw image including ICC input profile to working space - 16bit int version
void RawImageSource::colorSpaceConversion16 (Image16* im, ColorManagementParams cmp, cmsHPROFILE embedded, cmsHPROFILE camprofile, double camMatrix[3][3], std::string camName, double& defgain) {
//camMatrix is cam2xyz = xyz_cam
if (cmp.input == "(none)")
return;
//MyTime t1, t2, t3;
//t1.set ();
cmsHPROFILE in; cmsHPROFILE in;
cmsHPROFILE out; if (!findInputProfile(cmp.input, embedded, camName, in)) return;
Glib::ustring inProfile = cmp.input; if (in==NULL) {
// Take camprofile from DCRAW
if (inProfile=="(embedded)") {
if (embedded)
in = embedded;
else
in = camprofile;
}
else if (inProfile=="(camera)" || inProfile=="")
in = camprofile;
else {
in = iccStore->getProfile (inProfile);
if (in==NULL)
inProfile = "(camera)";
}
if (inProfile=="(camera)" || inProfile=="" || (inProfile=="(embedded)" && !embedded)) {
/* out = iccStore->workingSpace (cmp.working);
lcmsMutex->lock ();
cmsHTRANSFORM hTransform = cmsCreateTransform (in, TYPE_RGB_16_PLANAR, out, TYPE_RGB_16_PLANAR, settings->colorimetricIntent, cmsFLAGS_NOCACHE); //cmsFLAGS_MATRIXINPUT | cmsFLAGS_MATRIXOUTPUT);//cmsFLAGS_MATRIXINPUT | cmsFLAGS_MATRIXOUTPUT);
lcmsMutex->unlock ();
im->ExecCMSTransform(hTransform, settings->LCMSSafeMode);
cmsDeleteTransform(hTransform);
*/
// in this case we avoid using the slllllooooooowwww lcms // in this case we avoid using the slllllooooooowwww lcms
TMatrix work = iccStore->workingSpaceInverseMatrix (cmp.working); TMatrix work = iccStore->workingSpaceInverseMatrix (cmp.working);
double mat[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}; double mat[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
@ -1747,7 +1686,7 @@ TMatrix work = iccStore->workingSpaceInverseMatrix (cmp.working);
} }
} }
else { else {
out = iccStore->workingSpace (cmp.working); cmsHPROFILE out = iccStore->workingSpace (cmp.working);
// out = iccStore->workingSpaceGamma (wProfile); // out = iccStore->workingSpaceGamma (wProfile);
lcmsMutex->lock (); lcmsMutex->lock ();
cmsHTRANSFORM hTransform = cmsCreateTransform (in, TYPE_RGB_16_PLANAR, out, TYPE_RGB_16_PLANAR, settings->colorimetricIntent, cmsHTRANSFORM hTransform = cmsCreateTransform (in, TYPE_RGB_16_PLANAR, out, TYPE_RGB_16_PLANAR, settings->colorimetricIntent,
@ -1786,6 +1725,25 @@ TMatrix work = iccStore->workingSpaceInverseMatrix (cmp.working);
// printf ("ICM TIME: %d\n", t3.etime(t1)); // printf ("ICM TIME: %d\n", t3.etime(t1));
} }
// Determine RAW input and output profiles. Returns TRUE on success
bool RawImageSource::findInputProfile(Glib::ustring inProfile, cmsHPROFILE embedded, std::string camName, cmsHPROFILE& in) {
in=NULL; // cam will be taken on NULL
if (inProfile == "(none)") return false;
if (inProfile == "(embedded)" && embedded) {
in = embedded;
} else if (inProfile=="(cameraICC)") {
in = iccStore->getStdProfile(camName);
} else if (inProfile!="(camera)" && inProfile!="") {
in = iccStore->getProfile (inProfile);
}
// "in" might be NULL because of "not found". That's ok, we take the cam profile then
return true;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// derived from Dcraw "blend_highlights()" // derived from Dcraw "blend_highlights()"
// very effective to reduce (or remove) the magenta, but with levels of grey ! // very effective to reduce (or remove) the magenta, but with levels of grey !

View File

@ -23,6 +23,7 @@
#include <lcms2.h> #include <lcms2.h>
#include <array2D.h> #include <array2D.h>
#include <curves.h> #include <curves.h>
#include <cacheimagedata.h>
#define HR_SCALE 2 #define HR_SCALE 2
@ -59,6 +60,7 @@ class RawImageSource : public ImageSource {
private: private:
static LUTf invGrad; // for fast_demosaic static LUTf invGrad; // for fast_demosaic
static LUTf initInvGrad (); static LUTf initInvGrad ();
static bool findInputProfile(Glib::ustring inProfile, cmsHPROFILE embedded, std::string camName, cmsHPROFILE& in);
protected: protected:
Glib::Mutex getImageMutex; // locks getImage Glib::Mutex getImageMutex; // locks getImage
@ -154,8 +156,8 @@ class RawImageSource : public ImageSource {
void getAutoExpHistogram (LUTu & histogram, int& histcompr); void getAutoExpHistogram (LUTu & histogram, int& histcompr);
void getRAWHistogram (LUTu & histRedRaw, LUTu & histGreenRaw, LUTu & histBlueRaw); void getRAWHistogram (LUTu & histRedRaw, LUTu & histGreenRaw, LUTu & histBlueRaw);
static void colorSpaceConversion16 (Image16* im, ColorManagementParams cmp, cmsHPROFILE embedded, cmsHPROFILE camprofile, double cam[3][3], double& defgain); static void colorSpaceConversion16 (Image16* im, ColorManagementParams cmp, cmsHPROFILE embedded, cmsHPROFILE camprofile, double cam[3][3], std::string camName, double& defgain);
static void colorSpaceConversion (Imagefloat* im, ColorManagementParams cmp, cmsHPROFILE embedded, cmsHPROFILE camprofile, double cam[3][3], double& defgain); static void colorSpaceConversion (Imagefloat* im, ColorManagementParams cmp, cmsHPROFILE embedded, cmsHPROFILE camprofile, double cam[3][3], std::string camName, double& defgain);
static void inverse33 (double (*coeff)[3], double (*icoeff)[3]); static void inverse33 (double (*coeff)[3], double (*icoeff)[3]);
void boxblur2(float** src, float** dst, int H, int W, int box ); void boxblur2(float** src, float** dst, int H, int W, int box );

View File

@ -75,6 +75,9 @@ namespace rtengine {
virtual std::string getMake () const =0; virtual std::string getMake () const =0;
/** @return the model of the camera */ /** @return the model of the camera */
virtual std::string getModel () const =0; virtual std::string getModel () const =0;
std::string getCamera () const { return getMake() + " " + getModel(); }
/** @return the lens on the camera */ /** @return the lens on the camera */
virtual std::string getLens () const =0; virtual std::string getLens () const =0;
/** Functions to convert between floating point and string representation of shutter and aperture */ /** Functions to convert between floating point and string representation of shutter and aperture */
@ -309,8 +312,8 @@ namespace rtengine {
/** /**
* Initializes the RT engine * Initializes the RT engine
* @param s is a struct of basic settings */ * @param s is a struct of basic settings, baseDir of RT */
int init (const Settings* s); int init (const Settings* s, Glib::ustring baseDir);
/** Cleanup the RT engine (static variables) */ /** Cleanup the RT engine (static variables) */
void cleanup (); void cleanup ();

View File

@ -47,7 +47,7 @@ int main (int argc, char* argv[]) {
s.monitorProfile = ""; s.monitorProfile = "";
Glib::thread_init (); Glib::thread_init ();
rtengine::init (s); rtengine::init (s,"");
PListener pl; PListener pl;
rtengine::InitialImage* ii; rtengine::InitialImage* ii;

View File

@ -573,7 +573,7 @@ IImage8* Thumbnail::quickProcessImage (const procparams::ProcParams& params, int
} }
// Full thumbnail processing, second stage if complete profile exists // Full thumbnail processing, second stage if complete profile exists
IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rheight, TypeInterpolation interp, double& myscale) { IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rheight, TypeInterpolation interp, std::string camName, double& myscale) {
// compute WB multipliers // compute WB multipliers
ColorTemp currWB = ColorTemp (params.wb.temperature, params.wb.green); ColorTemp currWB = ColorTemp (params.wb.temperature, params.wb.green);
@ -676,7 +676,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
*/ */
// perform color space transformation // perform color space transformation
if (isRaw) if (isRaw)
RawImageSource::colorSpaceConversion16 (resImg, params.icm, embProfile, camProfile, cam2xyz, logDefGain); RawImageSource::colorSpaceConversion16 (resImg, params.icm, embProfile, camProfile, cam2xyz, camName, logDefGain );
else else
StdImageSource::colorSpaceConversion16 (resImg, params.icm, embProfile); StdImageSource::colorSpaceConversion16 (resImg, params.icm, embProfile);

View File

@ -70,7 +70,7 @@ namespace rtengine {
static void cleanupGamma (); static void cleanupGamma ();
void init (); void init ();
IImage8* processImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp, double& scale); IImage8* processImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp, std::string camName, double& scale);
IImage8* quickProcessImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp, double& scale); IImage8* quickProcessImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp, double& scale);
int getImageWidth (const procparams::ProcParams& pparams, int rheight, float &ratio); int getImageWidth (const procparams::ProcParams& pparams, int rheight, float &ratio);
void getDimensions (int& w, int& h, double& scaleFac); void getDimensions (int& w, int& h, double& scaleFac);

View File

@ -49,6 +49,9 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL),
icamera = Gtk::manage (new Gtk::RadioButton (M("TP_ICM_INPUTCAMERA"))); icamera = Gtk::manage (new Gtk::RadioButton (M("TP_ICM_INPUTCAMERA")));
pack_start (*icamera, Gtk::PACK_SHRINK, 4); pack_start (*icamera, Gtk::PACK_SHRINK, 4);
icameraICC = Gtk::manage (new Gtk::RadioButton (M("TP_ICM_INPUTCAMERAICC")));
pack_start (*icameraICC, Gtk::PACK_SHRINK, 4);
ifromfile = Gtk::manage (new Gtk::RadioButton (M("TP_ICM_INPUTCUSTOM")+":")); ifromfile = Gtk::manage (new Gtk::RadioButton (M("TP_ICM_INPUTCUSTOM")+":"));
Gtk::HBox* ffbox = Gtk::manage (new Gtk::HBox ()); Gtk::HBox* ffbox = Gtk::manage (new Gtk::HBox ());
ffbox->pack_start (*ifromfile, Gtk::PACK_SHRINK); ffbox->pack_start (*ifromfile, Gtk::PACK_SHRINK);
@ -57,6 +60,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL),
pack_start (*ffbox, Gtk::PACK_SHRINK, 4); pack_start (*ffbox, Gtk::PACK_SHRINK, 4);
opts = icamera->get_group(); opts = icamera->get_group();
icameraICC->set_group (opts);
iembedded->set_group (opts); iembedded->set_group (opts);
ifromfile->set_group (opts); ifromfile->set_group (opts);
inone->set_group (opts); inone->set_group (opts);
@ -167,6 +171,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL),
wgamma->signal_changed().connect( sigc::mem_fun(*this, &ICMPanel::gpChanged) ); wgamma->signal_changed().connect( sigc::mem_fun(*this, &ICMPanel::gpChanged) );
icamera->signal_toggled().connect( sigc::mem_fun(*this, &ICMPanel::ipChanged) ); icamera->signal_toggled().connect( sigc::mem_fun(*this, &ICMPanel::ipChanged) );
icameraICC->signal_toggled().connect( sigc::mem_fun(*this, &ICMPanel::ipChanged) );
iembedded->signal_toggled().connect( sigc::mem_fun(*this, &ICMPanel::ipChanged) ); iembedded->signal_toggled().connect( sigc::mem_fun(*this, &ICMPanel::ipChanged) );
ifromfile->signal_toggled().connect( sigc::mem_fun(*this, &ICMPanel::ipChanged) ); ifromfile->signal_toggled().connect( sigc::mem_fun(*this, &ICMPanel::ipChanged) );
igamma->signal_toggled().connect( sigc::mem_fun(*this, &ICMPanel::profAppGammaChanged) ); igamma->signal_toggled().connect( sigc::mem_fun(*this, &ICMPanel::profAppGammaChanged) );
@ -189,13 +194,17 @@ void ICMPanel::read (const ProcParams* pp, const ParamsEdited* pedited) {
iembedded->set_active (true); iembedded->set_active (true);
igamma->set_sensitive (false); igamma->set_sensitive (false);
} }
else if ((pp->icm.input == "(cameraICC)") && icameraICC->get_state()!=Gtk::STATE_INSENSITIVE) {
icameraICC->set_active (true);
igamma->set_sensitive (false);
}
else if ((pp->icm.input == "(camera)" || pp->icm.input=="") && icamera->get_state()!=Gtk::STATE_INSENSITIVE) { else if ((pp->icm.input == "(camera)" || pp->icm.input=="") && icamera->get_state()!=Gtk::STATE_INSENSITIVE) {
icamera->set_active (true); icamera->set_active (true);
igamma->set_sensitive (false); igamma->set_sensitive (false);
} }
else { else {
ifromfile->set_active (true); ifromfile->set_active (true);
oldip = pp->icm.input.substr(5); oldip = pp->icm.input.substr(5); // cut of "file:"
ipDialog->set_filename (pp->icm.input.substr(5)); ipDialog->set_filename (pp->icm.input.substr(5));
igamma->set_sensitive (true); igamma->set_sensitive (true);
} }
@ -253,6 +262,8 @@ void ICMPanel::write (ProcParams* pp, ParamsEdited* pedited) {
pp->icm.input = "(embedded)"; pp->icm.input = "(embedded)";
else if (icamera->get_active ()) else if (icamera->get_active ())
pp->icm.input = "(camera)"; pp->icm.input = "(camera)";
else if (icameraICC->get_active ())
pp->icm.input = "(cameraICC)";
else { else {
pp->icm.input = "file:"+ipDialog->get_filename (); pp->icm.input = "file:"+ipDialog->get_filename ();
@ -344,6 +355,10 @@ void ICMPanel::ipChanged () {
profname = "(camera)"; profname = "(camera)";
igamma->set_sensitive (false); igamma->set_sensitive (false);
} }
else if (icameraICC->get_active ()) {
profname = "(cameraICC)";
igamma->set_sensitive (false);
}
else { else {
profname = ipDialog->get_filename (); profname = ipDialog->get_filename ();
igamma->set_sensitive (true); igamma->set_sensitive (true);
@ -400,6 +415,7 @@ void ICMPanel::setRaw (bool raw) {
icamera->set_active (raw); icamera->set_active (raw);
iembedded->set_active (!raw); iembedded->set_active (!raw);
icamera->set_sensitive (raw); icamera->set_sensitive (raw);
icameraICC->set_sensitive (raw);
iembedded->set_sensitive (!raw); iembedded->set_sensitive (!raw);
enableListener (); enableListener ();

View File

@ -44,6 +44,7 @@ class ICMPanel : public Gtk::VBox, public AdjusterListener, public FoldableToolP
Gtk::RadioButton* iembedded; Gtk::RadioButton* iembedded;
Gtk::RadioButton* icamera; Gtk::RadioButton* icamera;
Gtk::RadioButton* icameraICC;
Gtk::RadioButton* ifromfile; Gtk::RadioButton* ifromfile;
Gtk::CheckButton* igamma; Gtk::CheckButton* igamma;
Gtk::ComboBoxText* wnames; Gtk::ComboBoxText* wnames;

View File

@ -712,7 +712,7 @@ void Options::load () {
langMgr.load(localeTranslation, new MultiLangMgr(languageTranslation, new MultiLangMgr(defaultTranslation))); langMgr.load(localeTranslation, new MultiLangMgr(languageTranslation, new MultiLangMgr(defaultTranslation)));
rtengine::init (&options.rtSettings); rtengine::init (&options.rtSettings, argv0);
} }
void Options::save () { void Options::save () {

View File

@ -446,7 +446,7 @@ rtengine::IImage8* Thumbnail::processThumbImage (const rtengine::procparams::Pro
else else
{ {
// Full thumbnail: apply profile // Full thumbnail: apply profile
image = tpp->processImage (pparams, h, rtengine::TI_Bilinear, scale); image = tpp->processImage (pparams, h, rtengine::TI_Bilinear, cfs.camera, scale );
} }
tpp->getDimensions(lastW,lastH,lastScale); tpp->getDimensions(lastW,lastH,lastScale);
@ -471,7 +471,7 @@ rtengine::IImage8* Thumbnail::upgradeThumbImage (const rtengine::procparams::Pro
return 0; return 0;
} }
rtengine::IImage8* image = tpp->processImage (pparams, h, rtengine::TI_Bilinear, scale); rtengine::IImage8* image = tpp->processImage (pparams, h, rtengine::TI_Bilinear, cfs.camera, scale );
tpp->getDimensions(lastW,lastH,lastScale); tpp->getDimensions(lastW,lastH,lastScale);
delete tpp; delete tpp;
@ -555,7 +555,7 @@ void Thumbnail::infoFromImage (const Glib::ustring& fname, rtengine::RawMetaData
cfs.timeValid = true; cfs.timeValid = true;
cfs.exifValid = true; cfs.exifValid = true;
cfs.lens = idata->getLens(); cfs.lens = idata->getLens();
cfs.camera = idata->getMake() + " " + idata->getModel(); cfs.camera = idata->getCamera();
} }
else { else {
cfs.lens = "Unknown"; cfs.lens = "Unknown";