[Digikam-devel] extragear/graphics/digikam/libs/dimg
Gilles Caulier
caulier.gilles at free.fr
Tue May 23 13:56:36 BST 2006
SVN commit 544028 by cgilles:
digikam from trunk :
-RawDecodingSettings : new method to set optimized parametters about loading, not image quality. We will use this settings to render histogram
-DImg::RawLoader: fix 8/16 bits handling, add option dcraw -h option to decrease time loading (histogram)
TODO : ColorImageProperties side bar : using optimised settings to load image...
CCMAIL: digikam-devel at kde.org
M +22 -17 loaders/rawloader.cpp
M +38 -22 rawdecodingsettings.h
--- trunk/extragear/graphics/digikam/libs/dimg/loaders/rawloader.cpp #544027:544028
@@ -120,13 +120,13 @@
// -------------------------------------------------------------------
// Get image data
- if (m_sixteenBit)
+ if (m_sixteenBit) // 16 bits image
{
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;
+ float fac = 65535.0 / m_rgbmax;
checkpoint = 0;
for (int h = 0; h < m_height; h++)
@@ -161,9 +161,10 @@
}
}
- imageData() = (uchar *)image;
+ imageData() = (uchar *)image;
+ m_sixteenBit = true;
}
- else
+ else // 8 bits image
{
uchar *image = new uchar[m_width*m_height*4];
@@ -206,7 +207,8 @@
}
}
- imageData() = image;
+ imageData() = image;
+ m_sixteenBit = false;
}
delete [] m_data;
@@ -226,7 +228,6 @@
//----------------------------------------------------------
- m_sixteenBit = true;
imageWidth() = m_width;
imageHeight() = m_height;
imageSetAttribute("format", "RAW");
@@ -266,13 +267,13 @@
m_process = new KProcess;
connect(m_process, SIGNAL(processExited(KProcess *)),
- this, SLOT(slotProcessExited(KProcess *)));
+ this, SLOT(slotProcessExited(KProcess *)));
connect(m_process, SIGNAL(receivedStdout(KProcess *, char *, int)),
- this, SLOT(slotReceivedStdout(KProcess *, char *, int)));
+ this, SLOT(slotReceivedStdout(KProcess *, char *, int)));
connect(m_process, SIGNAL(receivedStderr(KProcess *, char *, int)),
- this, SLOT(slotReceivedStderr(KProcess *, char *, int)));
+ this, SLOT(slotReceivedStderr(KProcess *, char *, int)));
// run dcraw with options:
// -c : write to stdout
@@ -291,15 +292,19 @@
// -B : Use bilateral filter to smooth noise while preserving edges.
// -p : Use the input ICC profiles to define the camera's raw colorspace.
// -o : Use ICC profiles to define the output colorspace.
+ // -h : Output a half-size color image. Twice as fast as -q 0.
*m_process << DcrawBinary::instance()->path();
*m_process << "-c";
- if (m_sixteenBit)
+ if (m_rawDecodingSettings.sixteenBitsImage)
*m_process << "-4";
else
*m_process << "-2";
+ if (m_rawDecodingSettings.halfSizeColorImage)
+ *m_process << "-h";
+
if (m_rawDecodingSettings.cameraColorBalance)
*m_process << "-w";
@@ -321,16 +326,16 @@
// -- Quality option ---------------------------------------------
//
- // Since dcraw 0.8, the command line compatibility have been broken about Quality option.
- // To handle Quality settings, we will use :
+ // Since dcraw 0.8, the command line compatibility have been broken about Quality option:
// '-q' alone (dcraw < 8.0)
- // '-q value' (dcraw >= 8.0)
- // In fact, m_rawDecodingSettings.enableRAWQuality is used to preserve compatibility.
-
- *m_process << "-q";
-
+ // '-q numerical value' (dcraw >= 8.0)
+ // For that, the current implementation is only compatible with dcraw >= 8.0.
+
if (m_rawDecodingSettings.enableRAWQuality)
+ {
+ *m_process << "-q";
*m_process << QString::number(m_rawDecodingSettings.RAWQuality);
+ }
// -- Noise Reduction option -------------------------------------
--- trunk/extragear/graphics/digikam/libs/dimg/rawdecodingsettings.h #544027:544028
@@ -66,57 +66,73 @@
~RawDecodingSettings(){};
+ void optimizeTimeLoading(void)
+ {
+ ICCColorCorrectionMode = NOICC;
+ enableNoiseReduction = false;
+ enableRAWQuality = false;
+ RGBInterpolate4Colors = false;
+ SuperCCDsecondarySensor = false;
+ unclipColors = false;
+ cameraColorBalance = true;
+ automaticColorBalance = true;
+ halfSizeColorImage = true;
+ sixteenBitsImage = true;
+ };
+
public:
- // Half-size color image decoding (twice as fast as "enableRAWQuality"). Use this option to
- // reduce time loading to render histogram for example, no to render an image to screen.
+ /** Half-size color image decoding (twice as fast as "enableRAWQuality"). Use this option to
+ reduce time loading to render histogram for example, no to render an image to screen. */
bool halfSizeColorImage;
- // If true, decode RAW file in 16 bits per color per pixel else 8 bits.
+ /** If true, decode RAW file in 16 bits per color per pixel else 8 bits. */
bool sixteenBitsImage;
- // Use the color balance specified by the camera. If this can't be found, reverts to the default.
+ /** Use the color balance specified by the camera. If this can't be found, reverts to the default. */
bool cameraColorBalance;
- // Automatic color balance. The default is to use a fixed color balance
- // based on a white card photographed in sunlight.
+ /** Automatic color balance. The default is to use a fixed color balance based on a white card
+ photographed in sunlight. */
bool automaticColorBalance;
- // RAW file decoding using RGB interpolation as four colors.
+ /** RAW file decoding using RGB interpolation as four colors. */
bool RGBInterpolate4Colors;
- // For Fuji Super CCD SR cameras, use the secondary sensors. In effect underexposing the image
- // by four stops to reveal detail in the highlights.
+ /** For Fuji Super CCD SR cameras, use the secondary sensors. In effect underexposing the image
+ by four stops to reveal detail in the highlights. */
bool SuperCCDsecondarySensor;
- // By default, dcraw clips all colors to prevent pink highlights. Use -n -b 0.25 to leave
- // the image data completely unclipped.
+ /** By default, dcraw clips all colors to prevent pink highlights. Use -n -b 0.25 to leave
+ the image data completely unclipped. */
bool unclipColors;
- // RAW file decoding using quality factor.
+ /** RAW file decoding using quality factor. */
bool enableRAWQuality;
- // RAW quality decoding factor value.
+ /** RAW quality decoding factor value. */
int RAWQuality;
- // RAW file decoding using bilateral filter to reduce noise. This is '-B sigma_domain sigma_range'
- // dcraw option to smooth noise while preserving edges. sigma_domain is in units of pixels, while
- // sigma_range is in units of CIELab colorspace.
+ /** RAW file decoding using bilateral filter to reduce noise. This is '-B sigma_domain sigma_range'
+ dcraw option to smooth noise while preserving edges. sigma_domain is in units of pixels, while
+ sigma_range is in units of CIELab colorspace. */
bool enableNoiseReduction;
- // Noise reduction sigma domain value.
+ /** Noise reduction sigma domain value. */
float NRSigmaDomain;
- // Noise reduction sigma range value.
+ /** Noise reduction sigma range value. */
float NRSigmaRange;
- // Input ICC profile color correction mode to use (dcraw -p option).
- int ICCColorCorrectionMode;
+ /** Input ICC profile color correction mode to use (dcraw -p option). */
+ int ICCColorCorrectionMode;
- // The file path to ICC camera color profile (input profile). Set to 'embed' to use the ICC profile embedded in the raw photo.
+ /** The file path to ICC camera color profile (input profile). Set to 'embed' to use the ICC
+ profile embedded in the raw photo. */
QString cameraICCProfilePath;
- // The file path to ICC output color profile (output profile). Set empty to use default sRGB color space.
+ /** The file path to ICC output color profile (output profile). Set empty to use default
+ sRGB color space. */
QString outputICCProfilePath;
};
More information about the Digikam-devel
mailing list