Issue 2846: Filter preview through output profile when using a monitor profile.
- Removed the "Rendering intent" setting from Preferences, - Hard-code "relative colorimetric" intent everywhere, - Filter through output profile before filtering through monitor profile if using a monitor profile, - If not using a monitor profile, a direct sRGB conversion is done,
This commit is contained in:
parent
1fe1508fa9
commit
91f67f0cb6
@ -98,6 +98,14 @@ ImProcFunctions::~ImProcFunctions ()
|
|||||||
if (monitorTransform != NULL) {
|
if (monitorTransform != NULL) {
|
||||||
cmsDeleteTransform (monitorTransform);
|
cmsDeleteTransform (monitorTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (output2monitorTransform != NULL) {
|
||||||
|
cmsDeleteTransform (output2monitorTransform);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lab2outputTransform != NULL) {
|
||||||
|
cmsDeleteTransform (lab2outputTransform);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImProcFunctions::setScale (double iscale)
|
void ImProcFunctions::setScale (double iscale)
|
||||||
@ -184,11 +192,21 @@ void ImProcFunctions::firstAnalysis (Imagefloat* original, const ProcParams* par
|
|||||||
// set up monitor transform
|
// set up monitor transform
|
||||||
Glib::ustring wprofile = params->icm.working;
|
Glib::ustring wprofile = params->icm.working;
|
||||||
|
|
||||||
if (monitorTransform) {
|
if (monitorTransform != NULL) {
|
||||||
cmsDeleteTransform (monitorTransform);
|
cmsDeleteTransform (monitorTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (output2monitorTransform != NULL) {
|
||||||
|
cmsDeleteTransform (output2monitorTransform);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lab2outputTransform != NULL) {
|
||||||
|
cmsDeleteTransform (lab2outputTransform);
|
||||||
|
}
|
||||||
|
|
||||||
monitorTransform = NULL;
|
monitorTransform = NULL;
|
||||||
|
output2monitorTransform = NULL;
|
||||||
|
lab2outputTransform = NULL;
|
||||||
|
|
||||||
#if !defined(__APPLE__) // No support for monitor profiles on OS X, all data is sRGB
|
#if !defined(__APPLE__) // No support for monitor profiles on OS X, all data is sRGB
|
||||||
Glib::ustring monitorProfile = settings->monitorProfile;
|
Glib::ustring monitorProfile = settings->monitorProfile;
|
||||||
@ -205,10 +223,25 @@ void ImProcFunctions::firstAnalysis (Imagefloat* original, const ProcParams* par
|
|||||||
if (monitor) {
|
if (monitor) {
|
||||||
lcmsMutex->lock ();
|
lcmsMutex->lock ();
|
||||||
cmsHPROFILE iprof = cmsCreateLab4Profile(NULL);
|
cmsHPROFILE iprof = cmsCreateLab4Profile(NULL);
|
||||||
monitorTransform = cmsCreateTransform (iprof, TYPE_Lab_DBL, monitor, TYPE_RGB_8, settings->colorimetricIntent,
|
monitorTransform = cmsCreateTransform (iprof, TYPE_Lab_FLT, monitor, TYPE_RGB_8, INTENT_RELATIVE_COLORIMETRIC,
|
||||||
cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE ); // NOCACHE is for thread safety, NOOPTIMIZE for precision
|
cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE ); // NOCACHE is for thread safety, NOOPTIMIZE for precision
|
||||||
cmsCloseProfile(iprof);
|
|
||||||
|
|
||||||
|
Glib::ustring outputProfile;
|
||||||
|
|
||||||
|
if (params->icm.output != "" && params->icm.output != ColorManagementParams::NoICMString) {
|
||||||
|
outputProfile = params->icm.output;
|
||||||
|
cmsHPROFILE jprof = iccStore->getProfile(outputProfile);
|
||||||
|
|
||||||
|
if (jprof) {
|
||||||
|
lab2outputTransform = cmsCreateTransform (iprof, TYPE_Lab_FLT, jprof, TYPE_RGB_FLT, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE );
|
||||||
|
|
||||||
|
if (monitor) {
|
||||||
|
output2monitorTransform = cmsCreateTransform (jprof, TYPE_RGB_FLT, monitor, TYPE_RGB_8, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cmsCloseProfile(iprof);
|
||||||
lcmsMutex->unlock ();
|
lcmsMutex->unlock ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,8 @@ class ImProcFunctions
|
|||||||
static LUTf gamma2curve;
|
static LUTf gamma2curve;
|
||||||
|
|
||||||
cmsHTRANSFORM monitorTransform;
|
cmsHTRANSFORM monitorTransform;
|
||||||
|
cmsHTRANSFORM lab2outputTransform;
|
||||||
|
cmsHTRANSFORM output2monitorTransform;
|
||||||
|
|
||||||
const ProcParams* params;
|
const ProcParams* params;
|
||||||
double scale;
|
double scale;
|
||||||
@ -222,7 +224,7 @@ public:
|
|||||||
static void cleanupCache ();
|
static void cleanupCache ();
|
||||||
|
|
||||||
ImProcFunctions (const ProcParams* iparams, bool imultiThread = true)
|
ImProcFunctions (const ProcParams* iparams, bool imultiThread = true)
|
||||||
: monitorTransform(NULL), params(iparams), scale(1), multiThread(imultiThread) {}
|
: monitorTransform(NULL), lab2outputTransform(NULL), output2monitorTransform(NULL), params(iparams), scale(1), multiThread(imultiThread) {}
|
||||||
~ImProcFunctions ();
|
~ImProcFunctions ();
|
||||||
|
|
||||||
void setScale (double iscale);
|
void setScale (double iscale);
|
||||||
|
@ -54,8 +54,8 @@ void ImProcFunctions::lab2monitorRgb (LabImage* lab, Image8* image)
|
|||||||
#pragma omp parallel firstprivate(lab, data, W, H)
|
#pragma omp parallel firstprivate(lab, data, W, H)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
AlignedBuffer<double> pBuf(3 * lab->W);
|
AlignedBuffer<float> pBuf(3 * lab->W);
|
||||||
double *buffer = pBuf.data;
|
float *buffer = pBuf.data;
|
||||||
|
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
#pragma omp for schedule(dynamic,16)
|
#pragma omp for schedule(dynamic,16)
|
||||||
@ -78,8 +78,14 @@ void ImProcFunctions::lab2monitorRgb (LabImage* lab, Image8* image)
|
|||||||
buffer[iy++] = rb[j] / 327.68f;
|
buffer[iy++] = rb[j] / 327.68f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!settings->HistogramWorking && output2monitorTransform && lab2outputTransform) {
|
||||||
|
AlignedBuffer<float> buf(3 * W);
|
||||||
|
cmsDoTransform (lab2outputTransform, buffer, buf.data, W);
|
||||||
|
cmsDoTransform (output2monitorTransform, buf.data, data + ix, W);
|
||||||
|
} else {
|
||||||
cmsDoTransform (monitorTransform, buffer, data + ix, W);
|
cmsDoTransform (monitorTransform, buffer, data + ix, W);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // End of parallelization
|
} // End of parallelization
|
||||||
|
|
||||||
@ -161,7 +167,7 @@ Image8* ImProcFunctions::lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch,
|
|||||||
|
|
||||||
lcmsMutex->lock ();
|
lcmsMutex->lock ();
|
||||||
cmsHPROFILE hLab = cmsCreateLab4Profile(NULL);
|
cmsHPROFILE hLab = cmsCreateLab4Profile(NULL);
|
||||||
cmsHTRANSFORM hTransform = cmsCreateTransform (hLab, TYPE_Lab_DBL, oprofG, TYPE_RGB_8, settings->colorimetricIntent,
|
cmsHTRANSFORM hTransform = cmsCreateTransform (hLab, TYPE_Lab_DBL, oprofG, TYPE_RGB_8, INTENT_RELATIVE_COLORIMETRIC,
|
||||||
cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE ); // NOCACHE is important for thread safety
|
cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE ); // NOCACHE is important for thread safety
|
||||||
cmsCloseProfile(hLab);
|
cmsCloseProfile(hLab);
|
||||||
lcmsMutex->unlock ();
|
lcmsMutex->unlock ();
|
||||||
@ -316,7 +322,7 @@ Image16* ImProcFunctions::lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int
|
|||||||
|
|
||||||
cmsHPROFILE iprof = iccStore->getXYZProfile ();
|
cmsHPROFILE iprof = iccStore->getXYZProfile ();
|
||||||
lcmsMutex->lock ();
|
lcmsMutex->lock ();
|
||||||
cmsHTRANSFORM hTransform = cmsCreateTransform (iprof, TYPE_RGB_16, oprof, TYPE_RGB_16, settings->colorimetricIntent, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE);
|
cmsHTRANSFORM hTransform = cmsCreateTransform (iprof, TYPE_RGB_16, oprof, TYPE_RGB_16, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE);
|
||||||
lcmsMutex->unlock ();
|
lcmsMutex->unlock ();
|
||||||
|
|
||||||
image->ExecCMSTransform(hTransform);
|
image->ExecCMSTransform(hTransform);
|
||||||
@ -587,7 +593,7 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int
|
|||||||
|
|
||||||
cmsHPROFILE iprof = iccStore->getXYZProfile ();
|
cmsHPROFILE iprof = iccStore->getXYZProfile ();
|
||||||
lcmsMutex->lock ();
|
lcmsMutex->lock ();
|
||||||
cmsHTRANSFORM hTransform = cmsCreateTransform (iprof, TYPE_RGB_16, oprofdef, TYPE_RGB_16, settings->colorimetricIntent, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE);
|
cmsHTRANSFORM hTransform = cmsCreateTransform (iprof, TYPE_RGB_16, oprofdef, TYPE_RGB_16, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE);
|
||||||
lcmsMutex->unlock ();
|
lcmsMutex->unlock ();
|
||||||
|
|
||||||
image->ExecCMSTransform(hTransform);
|
image->ExecCMSTransform(hTransform);
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
#define EXIF M_VOID
|
#define EXIF M_VOID
|
||||||
#define IPTC M_VOID
|
#define IPTC M_VOID
|
||||||
#define DIRPYREQUALIZER (M_COLOR|M_LUMINANCE)
|
#define DIRPYREQUALIZER (M_COLOR|M_LUMINANCE)
|
||||||
#define OUTPUTPROFILE (M_COLOR|M_LUMINANCE)
|
#define OUTPUTPROFILE (M_INIT|M_COLOR|M_LUMINANCE)
|
||||||
#define INPUTPROFILE WHITEBALANCE
|
#define INPUTPROFILE WHITEBALANCE
|
||||||
#define GAMMA (M_COLOR|M_LUMINANCE)
|
#define GAMMA (M_COLOR|M_LUMINANCE)
|
||||||
#define MINUPDATE M_MINUPDATE
|
#define MINUPDATE M_MINUPDATE
|
||||||
|
@ -279,7 +279,7 @@ void StdImageSource::colorSpaceConversion (Imagefloat* im, ColorManagementParams
|
|||||||
}
|
}
|
||||||
|
|
||||||
lcmsMutex->lock ();
|
lcmsMutex->lock ();
|
||||||
cmsHTRANSFORM hTransform = cmsCreateTransform (in, TYPE_RGB_FLT, out, TYPE_RGB_FLT, settings->colorimetricIntent,
|
cmsHTRANSFORM hTransform = cmsCreateTransform (in, TYPE_RGB_FLT, out, TYPE_RGB_FLT, INTENT_RELATIVE_COLORIMETRIC,
|
||||||
cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE);
|
cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE);
|
||||||
lcmsMutex->unlock ();
|
lcmsMutex->unlock ();
|
||||||
|
|
||||||
|
@ -676,12 +676,14 @@ Gtk::Widget* Preferences::getColorManagementPanel ()
|
|||||||
Gtk::VBox* mvbcm = Gtk::manage (new Gtk::VBox ());
|
Gtk::VBox* mvbcm = Gtk::manage (new Gtk::VBox ());
|
||||||
mvbcm->set_border_width (4);
|
mvbcm->set_border_width (4);
|
||||||
|
|
||||||
Gtk::Label* intlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_CMETRICINTENT") + ":", Gtk::ALIGN_LEFT));
|
/*
|
||||||
|
Gtk::Label* intlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_CMETRICINTENT")+":", Gtk::ALIGN_LEFT));
|
||||||
intent = Gtk::manage (new Gtk::ComboBoxText ());
|
intent = Gtk::manage (new Gtk::ComboBoxText ());
|
||||||
intent->append_text (M("PREFERENCES_INTENT_PERCEPTUAL"));
|
intent->append_text (M("PREFERENCES_INTENT_PERCEPTUAL"));
|
||||||
intent->append_text (M("PREFERENCES_INTENT_RELATIVE"));
|
intent->append_text (M("PREFERENCES_INTENT_RELATIVE"));
|
||||||
intent->append_text (M("PREFERENCES_INTENT_SATURATION"));
|
intent->append_text (M("PREFERENCES_INTENT_SATURATION"));
|
||||||
intent->append_text (M("PREFERENCES_INTENT_ABSOLUTE"));
|
intent->append_text (M("PREFERENCES_INTENT_ABSOLUTE"));
|
||||||
|
*/
|
||||||
|
|
||||||
iccDir = Gtk::manage (new Gtk::FileChooserButton (M("PREFERENCES_ICCDIR"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER));
|
iccDir = Gtk::manage (new Gtk::FileChooserButton (M("PREFERENCES_ICCDIR"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER));
|
||||||
Gtk::Label* pdlabel = Gtk::manage (new Gtk::Label (M("PREFERENCES_ICCDIR") + ":", Gtk::ALIGN_LEFT));
|
Gtk::Label* pdlabel = Gtk::manage (new Gtk::Label (M("PREFERENCES_ICCDIR") + ":", Gtk::ALIGN_LEFT));
|
||||||
@ -707,8 +709,8 @@ Gtk::Widget* Preferences::getColorManagementPanel ()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Gtk::Table* colt = Gtk::manage (new Gtk::Table (3, 2));
|
Gtk::Table* colt = Gtk::manage (new Gtk::Table (3, 2));
|
||||||
colt->attach (*intlab, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK, 2, 2);
|
//colt->attach (*intlab, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK, 2, 2);
|
||||||
colt->attach (*intent, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL | Gtk::SHRINK, Gtk::SHRINK, 2, 2);
|
//colt->attach (*intent, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL | Gtk::SHRINK, Gtk::SHRINK, 2, 2);
|
||||||
colt->attach (*pdlabel, 0, 1, 1, 2, Gtk::FILL, Gtk::SHRINK, 2, 2);
|
colt->attach (*pdlabel, 0, 1, 1, 2, Gtk::FILL, Gtk::SHRINK, 2, 2);
|
||||||
colt->attach (*iccDir, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL | Gtk::SHRINK, Gtk::SHRINK, 2, 2);
|
colt->attach (*iccDir, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL | Gtk::SHRINK, Gtk::SHRINK, 2, 2);
|
||||||
#if !defined(__APPLE__) // monitor profile not supported on apple
|
#if !defined(__APPLE__) // monitor profile not supported on apple
|
||||||
@ -1425,7 +1427,7 @@ void Preferences::storePreferences ()
|
|||||||
moptions.rtSettings.autoMonitorProfile = cbAutoMonProfile->get_active ();
|
moptions.rtSettings.autoMonitorProfile = cbAutoMonProfile->get_active ();
|
||||||
#endif
|
#endif
|
||||||
moptions.rtSettings.iccDirectory = iccDir->get_filename ();
|
moptions.rtSettings.iccDirectory = iccDir->get_filename ();
|
||||||
moptions.rtSettings.colorimetricIntent = intent->get_active_row_number ();
|
//moptions.rtSettings.colorimetricIntent = intent->get_active_row_number ();
|
||||||
moptions.rtSettings.viewingdevice = view->get_active_row_number ();
|
moptions.rtSettings.viewingdevice = view->get_active_row_number ();
|
||||||
moptions.rtSettings.viewingdevicegrey = grey->get_active_row_number ();
|
moptions.rtSettings.viewingdevicegrey = grey->get_active_row_number ();
|
||||||
moptions.rtSettings.viewinggreySc = greySc->get_active_row_number ();
|
moptions.rtSettings.viewinggreySc = greySc->get_active_row_number ();
|
||||||
@ -1554,7 +1556,7 @@ void Preferences::fillPreferences ()
|
|||||||
iccDir->set_current_folder (moptions.rtSettings.iccDirectory);
|
iccDir->set_current_folder (moptions.rtSettings.iccDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
intent->set_active (moptions.rtSettings.colorimetricIntent);
|
//intent->set_active (moptions.rtSettings.colorimetricIntent);
|
||||||
view->set_active (moptions.rtSettings.viewingdevice);
|
view->set_active (moptions.rtSettings.viewingdevice);
|
||||||
grey->set_active (moptions.rtSettings.viewingdevicegrey);
|
grey->set_active (moptions.rtSettings.viewingdevicegrey);
|
||||||
greySc->set_active (moptions.rtSettings.viewinggreySc);
|
greySc->set_active (moptions.rtSettings.viewinggreySc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user