[Digikam-devel] extragear/graphics/digikam

Gilles Caulier caulier.gilles at free.fr
Sun Jul 9 15:24:01 BST 2006


SVN commit 560198 by cgilles:

digikam from trunk : BUGFIX : use the default color space used by dcraw (sRGB) if digiKam CM is not enable.

CCMAIL: digikam-devel at kde.org, fj.cruz at supercable.es


 M  +32 -11    libs/dimg/loaders/rawloader.cpp  
 M  +7 -6      libs/dimg/rawdecodingsettings.h  
 M  +14 -4     utilities/imageeditor/editor/editorwindow.cpp  


--- trunk/extragear/graphics/digikam/libs/dimg/loaders/rawloader.cpp #560197:560198
@@ -43,6 +43,7 @@
 
 #include <kdebug.h>
 #include <kprocess.h>
+#include <kstandarddirs.h>
 
 // Local includes.
 
@@ -124,10 +125,10 @@
     {
         uchar *image = new uchar[m_width*m_height*8];
 
-        unsigned short *dst  = (unsigned short *)image;
-        uchar          *src  = m_data;
-        float fac            = 65535.0 / m_rgbmax;
-        checkpoint           = 0;
+        unsigned short *dst = (unsigned short *)image;
+        uchar          *src = m_data;
+        float fac           = 65535.0 / m_rgbmax;
+        checkpoint          = 0;
 
         for (int h = 0; h < m_height; h++)
         {
@@ -238,11 +239,14 @@
 
 void RAWLoader::startProcess()
 {
-    if (m_observer && !m_observer->continueQuery(m_image))
+    if (m_observer)
     {
-        m_running    = false;
-        m_normalExit = false;
-        return;
+        if (!m_observer->continueQuery(m_image))
+        {
+            m_running    = false;
+            m_normalExit = false;
+            return;
+        }
     }
 
     // create KProcess and build argument list
@@ -334,23 +338,40 @@
 
     switch (m_rawDecodingSettings.ICCColorCorrectionMode)
     {
-        case RawDecodingSettings::EMBED:
+        case RawDecodingSettings::EMBED_WORKSPACE:
+        {
             *m_process << "-p";
             *m_process << "embed";
             break;
+        }
 
-        case RawDecodingSettings::USERPROFILE:
+        case RawDecodingSettings::SRGB_WORKSPACE:
+        {
+            *m_process << "-o";
+            *m_process << "1";
+
+            KGlobal::dirs()->addResourceType("profiles", KGlobal::dirs()->kde_default("data") + "digikam/profiles");
+            QString directory = KGlobal::dirs()->findResourceDir("profiles", "srgb.icm");
+            m_image->getICCProfilFromFile(directory + "srgb.icm");
+            break;
+        }
+
+        case RawDecodingSettings::USER_PROFILES:
+        {
             *m_process << "-p";
             *m_process << QFile::encodeName( m_rawDecodingSettings.cameraICCProfilePath );
             break;
+        }
 
         default:    // No ICC color Correction : converter to RAW Color Mode.
+        {
             *m_process << "-o";
             *m_process << "0";
             break;
+        }
     }
 
-    if (m_rawDecodingSettings.ICCColorCorrectionMode != RawDecodingSettings::NOICC &&
+    if (m_rawDecodingSettings.ICCColorCorrectionMode != RawDecodingSettings::NO_ICC &&
         !m_rawDecodingSettings.outputICCProfilePath.isEmpty())
     {
         *m_process << "-o";
--- trunk/extragear/graphics/digikam/libs/dimg/rawdecodingsettings.h #560197:560198
@@ -35,16 +35,17 @@
 
 public:
     
-    enum INPUTICCMODE
+    enum ICCCOLORCORRECTIONMODE
     {
-        NOICC = 0,    // No color correction during Raw file decoding.
-        EMBED,        // Using embedded ICC color profile in RAW file.
-        USERPROFILE   // Using user input ICC profile file.
+        NO_ICC = 0,          // No color correction during Raw file decoding.
+        SRGB_WORKSPACE,      // Using default workspace color profile (sRGB) 
+        EMBED_WORKSPACE,     // Using embedded workspace color profile in RAW file.
+        USER_PROFILES        // Using user input and workspace profile files.
     };
 
     RawDecodingSettings()
     {
-        ICCColorCorrectionMode  = NOICC;
+        ICCColorCorrectionMode  = SRGB_WORKSPACE;
         cameraICCProfilePath    = QString::null;
         outputICCProfilePath    = QString::null;
     
@@ -68,7 +69,7 @@
 
     void optimizeTimeLoading(void)
     {
-        ICCColorCorrectionMode  = NOICC;
+        ICCColorCorrectionMode  = NO_ICC;
         enableNoiseReduction    = false;
         enableRAWQuality        = false;
         RGBInterpolate4Colors   = false;
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp #560197:560198
@@ -693,15 +693,15 @@
 {
     KConfig* config = kapp->config();
 
-    // -- Settings for Color Management stuff --------------------------------
+    // -- Settings for Color Management stuff ----------------------------------------------
 
     config->setGroup("Color Management");
 
-    d->ICCSettings->renderingSetting   = config->readNumEntry("RenderingIntent");
     d->ICCSettings->enableCMSetting    = config->readBoolEntry("EnableCM", false);
     d->ICCSettings->askOrApplySetting  = config->readBoolEntry("BehaviourICC", false);
     d->ICCSettings->BPCSetting         = config->readBoolEntry("BPCAlgorithm",false);
     d->ICCSettings->managedViewSetting = config->readBoolEntry("ManagedView", false);
+    d->ICCSettings->renderingSetting   = config->readNumEntry("RenderingIntent");
     d->ICCSettings->inputSetting       = config->readPathEntry("InProfileFile", QString::null);
     d->ICCSettings->workspaceSetting   = config->readPathEntry("WorkProfileFile", QString::null);
     d->ICCSettings->monitorSetting     = config->readPathEntry("MonitorProfileFile", QString::null);
@@ -709,7 +709,7 @@
 
     DImgInterface::instance()->setICCSettings(d->ICCSettings);
 
-    // -- IO files format settings ------------------------------------------------
+    // -- JPEG, PNG, TIFF files format settings ----------------------------------------------
 
     config->setGroup("ImageViewer Settings");
 
@@ -723,6 +723,16 @@
 
     m_IOFileSettings->TIFFCompression  = config->readBoolEntry("TIFFCompression", false);
 
+    // -- RAW pictures decoding settings ------------------------------------------------------
+
+    // If digiKam Color Management is enable, no need to correct color of decoded RAW image,
+    // else, sRGB color workspace will be used.
+
+    if (d->ICCSettings->enableCMSetting) 
+        m_IOFileSettings->rawDecodingSettings.ICCColorCorrectionMode = RawDecodingSettings::NO_ICC;
+    else
+        m_IOFileSettings->rawDecodingSettings.ICCColorCorrectionMode = RawDecodingSettings::SRGB_WORKSPACE;
+
     m_IOFileSettings->rawDecodingSettings.sixteenBitsImage        = config->readBoolEntry("SixteenBitsImage", false);
     m_IOFileSettings->rawDecodingSettings.automaticColorBalance   = config->readBoolEntry("AutomaticColorBalance", true);
     m_IOFileSettings->rawDecodingSettings.cameraColorBalance      = config->readBoolEntry("CameraColorBalance", true);
@@ -735,7 +745,7 @@
     m_IOFileSettings->rawDecodingSettings.NRSigmaDomain           = config->readDoubleNumEntry("NRSigmaDomain", 2.0);
     m_IOFileSettings->rawDecodingSettings.NRSigmaRange            = config->readDoubleNumEntry("NRSigmaRange", 4.0);
     
-    // -- GUI Settings -------------------------------------------------------
+    // -- GUI Settings -----------------------------------------------------------------------
     
     QSizePolicy rightSzPolicy(QSizePolicy::Preferred, QSizePolicy::Expanding, 2, 1);
     if(config->hasKey("Splitter Sizes"))



More information about the Digikam-devel mailing list