Enable DCP options regardless of DCP source. Neutral profile disables DCP curve and look table. Fixes #2922

This commit is contained in:
Ingo
2015-09-30 17:45:36 +02:00
committed by Beep6581
parent e525fbb353
commit ee4e56ce00
5 changed files with 94 additions and 84 deletions

View File

@@ -814,7 +814,7 @@ const DCPProfile::HSBModify* DCPProfile::MakeHueSatMap(ColorTemp &wb, int prefer
return aDeltas;
}
DCPProfile::DCPProfile(Glib::ustring fname, bool isRTProfile)
DCPProfile::DCPProfile(Glib::ustring fname)
{
const int TIFFFloatSize = 4;
const int TagColorMatrix1 = 50721, TagColorMatrix2 = 50722, TagProfileHueSatMapDims = 50937;
@@ -989,7 +989,7 @@ DCPProfile::DCPProfile(Glib::ustring fname, bool isRTProfile)
// Read tone curve points, if any, but disable to RTs own profiles
tag = tagDir->getTag(TagProfileToneCurve);
if (tag != NULL && !isRTProfile) {
if (tag != NULL) {
std::vector<double> cPoints;
cPoints.push_back(double(DCT_Spline)); // The first value is the curve type
@@ -1760,7 +1760,7 @@ void DCPStore::init (Glib::ustring rtProfileDir)
}
}
DCPProfile* DCPStore::getProfile (Glib::ustring filename, bool isRTProfile)
DCPProfile* DCPStore::getProfile (Glib::ustring filename)
{
MyMutex::MyLock lock(mtx);
@@ -1771,7 +1771,7 @@ DCPProfile* DCPStore::getProfile (Glib::ustring filename, bool isRTProfile)
}
// Add profile
profileCache[filename] = new DCPProfile(filename, isRTProfile);
profileCache[filename] = new DCPProfile(filename);
return profileCache[filename];
}
@@ -1783,7 +1783,7 @@ DCPProfile* DCPStore::getStdProfile(Glib::ustring camShortName)
// Warning: do NOT use map.find(), since it does not seem to work reliably here
for (std::map<Glib::ustring, Glib::ustring>::iterator i = fileStdProfiles.begin(); i != fileStdProfiles.end(); i++)
if (name2 == (*i).first) {
return getProfile((*i).second, true);
return getProfile((*i).second);
}
return NULL;

View File

@@ -76,7 +76,7 @@ class DCPProfile
void HSDApply(const HSDTableInfo &ti, const HSBModify *tableBase, float &h, float &s, float &v) const;
public:
DCPProfile(Glib::ustring fname, bool isRTProfile);
DCPProfile(Glib::ustring fname);
~DCPProfile();
bool getHasToneCurve()
@@ -122,7 +122,7 @@ public:
bool isValidDCPFileName(Glib::ustring filename) const;
DCPProfile* getProfile(Glib::ustring filename, bool isRTProfile = false);
DCPProfile* getProfile(Glib::ustring filename);
DCPProfile* getStdProfile(Glib::ustring camShortName);
static DCPStore* getInstance();

View File

@@ -831,8 +831,8 @@ void ColorManagementParams::setDefaults()
{
input = "(cameraICC)";
blendCMSMatrix = false;
toneCurve = true;
applyLookTable = true;
toneCurve = false;
applyLookTable = false;
applyBaselineExposureOffset = true;
applyHueSatMap = true;
dcpIlluminant = 0;

View File

@@ -30,7 +30,7 @@ using namespace rtengine::procparams;
extern Options options;
ICMPanel::ICMPanel () : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iunchanged(NULL), icmplistener(NULL), lastRefFilename("")
ICMPanel::ICMPanel () : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iunchanged(NULL), icmplistener(NULL), lastRefFilename(""), camName("")
{
isBatchMode = lastToneCurve = lastApplyLookTable = lastApplyBaselineExposureOffset = lastApplyHueSatMap = lastBlendCMSMatrix = lastgamfree = false;
@@ -348,8 +348,13 @@ void ICMPanel::updateDCP (int dcpIlluminant, Glib::ustring dcp_name)
dcpIll->set_sensitive (false);
dcpFrame->set_sensitive(false);
if (ifromfile->get_active() && dcpStore->isValidDCPFileName(dcp_name)) {
DCPProfile* dcp = dcpStore->getProfile(dcp_name, false);
DCPProfile* dcp = NULL;
if(dcp_name == "(cameraICC)") {
dcp = dcpStore->getStdProfile(camName);
} else if (ifromfile->get_active() && dcpStore->isValidDCPFileName(dcp_name)) {
dcp = dcpStore->getProfile(dcp_name);
}
if (dcp) {
dcpFrame->set_sensitive(true);
@@ -416,7 +421,6 @@ void ICMPanel::updateDCP (int dcpIlluminant, Glib::ustring dcp_name)
}
}
}
}
if (!dcpIllLabel->get_sensitive() && dcpIll->get_active_row_number() != 0) {
if (dcpTemperatures[0] != 0 || dcpTemperatures[1] != 0) {
@@ -467,7 +471,7 @@ void ICMPanel::read (const ProcParams* pp, const ParamsEdited* pedited)
} else if ((pp->icm.input == "(cameraICC)") && icameraICC->get_state() != Gtk::STATE_INSENSITIVE) {
icameraICC->set_active (true);
ckbBlendCMSMatrix->set_sensitive (true);
updateDCP(pp->icm.dcpIlluminant, "");
updateDCP(pp->icm.dcpIlluminant, "(cameraICC)");
} else if ((pp->icm.input == "(cameraICC)") && icamera->get_state() != Gtk::STATE_INSENSITIVE && icameraICC->get_state() == Gtk::STATE_INSENSITIVE) {
// this is the case when (cameraICC) is instructed by packaged profiles, but ICC file is not found
// therefore falling back UI to explicitly reflect the (camera) option
@@ -478,7 +482,7 @@ void ICMPanel::read (const ProcParams* pp, const ParamsEdited* pedited)
// If neither (camera) nor (cameraICC) are available, as is the case when loading a non-raw, activate (embedded).
iembedded->set_active (true);
ckbBlendCMSMatrix->set_sensitive (false);
updateDCP(pp->icm.dcpIlluminant, "");
updateDCP(pp->icm.dcpIlluminant, "(cameraICC)");
} else if ((pp->icm.input == "(camera)" || pp->icm.input == "") && icamera->get_state() != Gtk::STATE_INSENSITIVE) {
icamera->set_active (true);
ckbBlendCMSMatrix->set_sensitive (false);
@@ -603,8 +607,13 @@ void ICMPanel::write (ProcParams* pp, ParamsEdited* pedited)
pp->icm.freegamma = freegamma->get_active();
DCPProfile* dcp = NULL;
if (ifromfile->get_active() && pp->icm.input.substr(0, 5) == "file:" && dcpStore->isValidDCPFileName(pp->icm.input.substr(5))) {
DCPProfile* dcp = dcpStore->getProfile(pp->icm.input.substr(5), false);
dcp = dcpStore->getProfile(pp->icm.input.substr(5));
} else if(icameraICC->get_active()) {
dcp = dcpStore->getStdProfile(camName);
}
if (dcp) {
if (dcp->getHasToneCurve()) {
@@ -623,7 +632,6 @@ void ICMPanel::write (ProcParams* pp, ParamsEdited* pedited)
pp->icm.applyHueSatMap = ckbApplyHueSatMap->get_active ();
}
}
}
pp->icm.blendCMSMatrix = ckbBlendCMSMatrix->get_active ();
pp->icm.gampos = (double) gampos->getValue();
@@ -880,6 +888,7 @@ void ICMPanel::setRawMeta (bool raw, const rtengine::ImageData* pMeta)
icamera->set_active (raw);
iembedded->set_active (!raw);
icamera->set_sensitive (raw);
camName = pMeta->getCamera();
icameraICC->set_sensitive (raw && (iccStore->getStdProfile(pMeta->getCamera()) != NULL || dcpStore->getStdProfile(pMeta->getCamera()) != NULL));
iembedded->set_sensitive (!raw);

View File

@@ -93,6 +93,7 @@ private:
double dcpTemperatures[2];
bool enableLastICCWorkDirChange;
Glib::ustring lastRefFilename;
Glib::ustring camName;
void updateDCP(int dcpIlluminant, Glib::ustring dcp_name);
public:
ICMPanel ();