[Kde-imaging] branches/extragear/kde3/libs/libkdcraw/libkdcraw

Gilles Caulier caulier.gilles at gmail.com
Mon Aug 20 11:39:59 CEST 2007


SVN commit 702258 by cgilles:

libkdcraw from KDE3 branch : patch from Guillaume Castagnino about to handle RAW decoding quality settings properlly since dcraw 8.73 include a new interpolation method named PPG
CCMAIL: kde-imaging at kde.org
CCMAIL: casta at xwing.info



 M  +40 -30    dcrawsettingswidget.cpp  
 M  +44 -26    rawdecodingsettings.h  


--- branches/extragear/kde3/libs/libkdcraw/libkdcraw/dcrawsettingswidget.cpp #702257:702258
@@ -113,7 +113,7 @@
     KIntNumInput    *reconstructSpinBox;
     KIntNumInput    *blackPointSpinBox;
     KIntNumInput    *NRThresholdSpinBox;
- 
+
     KDoubleNumInput *colorMult1SpinBox;
     KDoubleNumInput *colorMult2SpinBox;
     KDoubleNumInput *colorMult3SpinBox;
@@ -134,7 +134,7 @@
     // ---------------------------------------------------------------
 
     int line = 0;
-    
+
     d->sixteenBitsImage = new QCheckBox(i18n("16 bits color depth"), d->stdSettings);
     QWhatsThis::add( d->sixteenBitsImage, i18n("<p>If enabled, all RAW files will be decoded in 16-bit "
                                                "color depth using a linear gamma curve. To prevent dark "
@@ -144,7 +144,7 @@
                                                "color depth with a BT.709 gamma curve and a 99th-percentile "
                                                "white point. This mode is faster than 16-bit decoding."));
     settingsBoxLayout->addMultiCellWidget(d->sixteenBitsImage, 0, 0, 0, 0);
-    
+
     if (sixteenBitsOption)
     {
         d->sixteenBitsImage->show();
@@ -214,8 +214,8 @@
                                              "<b>Blend</b>:Blend clipped and unclipped values together for a gradual fade to white<p>"
                                              "<b>Rebuild</b>: reconstruct highlights using a "
                                              "level value"));
-    settingsBoxLayout->addMultiCellWidget(d->unclipColorLabel, line, line, 0, 0);    
-    settingsBoxLayout->addMultiCellWidget(d->unclipColorComboBox, line, line, 1, 2);    
+    settingsBoxLayout->addMultiCellWidget(d->unclipColorLabel, line, line, 0, 0);
+    settingsBoxLayout->addMultiCellWidget(d->unclipColorComboBox, line, line, 1, 2);
     line++;
 
     d->reconstructLabel   = new QLabel(i18n("Level:"), d->stdSettings);
@@ -224,8 +224,8 @@
     QWhatsThis::add(d->reconstructSpinBox, i18n("<p><b>Level</b><p>"
                                                "Specify the reconstruct highlight level. "
                                                "Low values favor whites and high values favor colors."));
-    settingsBoxLayout->addMultiCellWidget(d->reconstructLabel, line, line, 0, 0);    
-    settingsBoxLayout->addMultiCellWidget(d->reconstructSpinBox, line, line, 1, 2);    
+    settingsBoxLayout->addMultiCellWidget(d->reconstructLabel, line, line, 0, 0);
+    settingsBoxLayout->addMultiCellWidget(d->reconstructSpinBox, line, line, 1, 2);
     line++;
 
     // ---------------------------------------------------------------
@@ -237,8 +237,8 @@
     QWhatsThis::add(d->brightnessSpinBox, i18n("<p><b>Brighness</b><p>"
                                                "Specify the brightness level of output image."
                                                "The default value is 1.0 (works in 8-bit mode only).<p>"));
-    settingsBoxLayout->addMultiCellWidget(d->brightnessLabel, line, line, 0, 0);    
-    settingsBoxLayout->addMultiCellWidget(d->brightnessSpinBox, line, line, 1, 2);    
+    settingsBoxLayout->addMultiCellWidget(d->brightnessLabel, line, line, 0, 0);
+    settingsBoxLayout->addMultiCellWidget(d->brightnessSpinBox, line, line, 1, 2);
     line++;
 
     // ---------------------------------------------------------------
@@ -263,6 +263,10 @@
                 "This method computes gradients near the pixel of interest and uses "
                 "the lower gradients (representing smoother and more similar parts "
                 "of the image) to make an estimate.<p>"
+                "<b>PPG</b>: use Patterned Pixel Grouping interpolation. "
+                "Pixel Grouping uses assumptions about natural scenery in making estimates. "
+                "It has fewer color artifacts on natural images than the Variable Number of "
+                "Gradients method.<p>"
                 "<b>AHD</b>: use Adaptive Homogeneity-Directed interpolation. "
                 "This method selects the direction of interpolation so as to "
                 "maximize a homogeneity metric, thus typically minimizing color artifacts.<p>"));
@@ -318,12 +322,12 @@
     if (outputColorSpaceOption)
     {
         d->outputColorSpaceLabel->show();
-        d->outputColorSpaceComboBox->show(); 
+        d->outputColorSpaceComboBox->show();
     }
     else
     {
         d->outputColorSpaceLabel->hide();
-        d->outputColorSpaceComboBox->hide(); 
+        d->outputColorSpaceComboBox->hide();
     }
 
     insertTab(d->stdSettings, i18n("Standard"));
@@ -340,7 +344,7 @@
                                                    "stretch the image to its correct aspect ratio. In any "
                                                    "case, this option guarantees that each output pixel "
                                                    "corresponds to one RAW pixel.<p>"));
-    settingsBoxLayout2->addMultiCellWidget(d->dontStretchPixelsCheckBox, 0, 0, 0, 2);   
+    settingsBoxLayout2->addMultiCellWidget(d->dontStretchPixelsCheckBox, 0, 0, 0, 2);
 
     // ---------------------------------------------------------------
 
@@ -353,8 +357,8 @@
     d->blackPointSpinBox->setRange(0, 1000, 1, true);
     QWhatsThis::add(d->blackPointSpinBox, i18n("<p><b>Black point value</b><p>"
                                                "Specify specific black point value of the output image.<p>"));
-    settingsBoxLayout2->addMultiCellWidget(d->blackPointCheckBox, 1, 1, 0, 0);    
-    settingsBoxLayout2->addMultiCellWidget(d->blackPointSpinBox, 1, 1, 1, 2);    
+    settingsBoxLayout2->addMultiCellWidget(d->blackPointCheckBox, 1, 1, 0, 0);
+    settingsBoxLayout2->addMultiCellWidget(d->blackPointSpinBox, 1, 1, 1, 2);
 
     // ---------------------------------------------------------------
 
@@ -380,19 +384,19 @@
     d->colorMult4SpinBox->setPrecision(5);
     d->colorMult4SpinBox->setRange(0.00001, 1.0, 0.01, true);
 
-    settingsBoxLayout->addMultiCellWidget(d->colorMultCheckBox, 2, 2, 0, 2);    
-    settingsBoxLayout->addMultiCellWidget(d->colorMult1Label, 3, 3, 0, 0);    
-    settingsBoxLayout->addMultiCellWidget(d->colorMult1SpinBox, 3, 3, 1, 2);    
-    settingsBoxLayout->addMultiCellWidget(d->colorMult2Label, 4, 4, 0, 0);    
-    settingsBoxLayout->addMultiCellWidget(d->colorMult2SpinBox, 4, 4, 1, 2);    
-    settingsBoxLayout->addMultiCellWidget(d->colorMult3Label, 5, 5, 0, 0);    
-    settingsBoxLayout->addMultiCellWidget(d->colorMult3SpinBox, 5, 5, 1, 2);    
-    settingsBoxLayout->addMultiCellWidget(d->colorMult4Label, 6, 6, 0, 0);    
-    settingsBoxLayout->addMultiCellWidget(d->colorMult4SpinBox, 6, 6, 1, 2);    
+    settingsBoxLayout->addMultiCellWidget(d->colorMultCheckBox, 2, 2, 0, 2);
+    settingsBoxLayout->addMultiCellWidget(d->colorMult1Label, 3, 3, 0, 0);
+    settingsBoxLayout->addMultiCellWidget(d->colorMult1SpinBox, 3, 3, 1, 2);
+    settingsBoxLayout->addMultiCellWidget(d->colorMult2Label, 4, 4, 0, 0);
+    settingsBoxLayout->addMultiCellWidget(d->colorMult2SpinBox, 4, 4, 1, 2);
+    settingsBoxLayout->addMultiCellWidget(d->colorMult3Label, 5, 5, 0, 0);
+    settingsBoxLayout->addMultiCellWidget(d->colorMult3SpinBox, 5, 5, 1, 2);
+    settingsBoxLayout->addMultiCellWidget(d->colorMult4Label, 6, 6, 0, 0);
+    settingsBoxLayout->addMultiCellWidget(d->colorMult4SpinBox, 6, 6, 1, 2);
 
-    settingsBoxLayout2->setRowStretch(7, 10);   
+    settingsBoxLayout2->setRowStretch(7, 10);
     insertTab(d->advSettings, i18n("Advanced"));
-    
+
     if (!showAdvancedOptions)
     {
         removePage(d->advSettings);
@@ -447,8 +451,8 @@
     setcolorMultiplier3(1.0);
     setcolorMultiplier4(1.0);
     setNRThreshold(100);
-    setQuality(RawDecodingSettings::BILINEAR); 
-    setOutputColorSpace(RawDecodingSettings::SRGB); 
+    setQuality(RawDecodingSettings::BILINEAR);
+    setOutputColorSpace(RawDecodingSettings::SRGB);
 }
 
 void DcrawSettingsWidget::slotsixteenBitsImageToggled(bool b)
@@ -640,9 +644,12 @@
             return RawDecodingSettings::VNG;
             break;
         case 2:
+            return RawDecodingSettings::PPG;
+            break;
+        case 3:
             return RawDecodingSettings::AHD;
             break;
-        default:    
+        default:
             return RawDecodingSettings::BILINEAR;
             break;
     }
@@ -655,10 +662,13 @@
         case RawDecodingSettings::VNG:
             d->RAWQualityComboBox->setCurrentItem(1);
             break;
-        case RawDecodingSettings::AHD:
+        case RawDecodingSettings::PPG:
             d->RAWQualityComboBox->setCurrentItem(2);
             break;
-        default:    
+        case RawDecodingSettings::AHD:
+            d->RAWQualityComboBox->setCurrentItem(3);
+            break;
+        default:
             d->RAWQualityComboBox->setCurrentItem(0);
             break;
     }
--- branches/extragear/kde3/libs/libkdcraw/libkdcraw/rawdecodingsettings.h #702257:702258
@@ -35,15 +35,33 @@
 
 public:
 
-    /** RAW decoding Interpolation methods */
+    /** RAW decoding Interpolation methods
+
+        Bilinear: use high-speed but low-quality bilinear
+                  interpolation (default - for slow computer). In this method,
+                  the red value of a non-red pixel is computed as the average of
+                  the adjacent red pixels, and similar for blue and green.
+        VNG:      use Variable Number of Gradients interpolation.
+                  This method computes gradients near the pixel of interest and uses
+                  the lower gradients (representing smoother and more similar parts
+                  of the image) to make an estimate.
+        PPG:      use Patterned Pixel Grouping interpolation.
+                  Pixel Grouping uses assumptions about natural scenery in making estimates.
+                  It has fewer color artifacts on natural images than the Variable Number of
+                  Gradients method.
+        AHD:      use Adaptive Homogeneity-Directed interpolation.
+                  This method selects the direction of interpolation so as to
+                  maximize a homogeneity metric, thus typically minimizing color artifacts.
+    */
     enum DecodingQuality 
     {
         BILINEAR = 0,
-        VNG      = 2,
+        VNG      = 1,
+        PPG      = 2,
         AHD      = 3
     };
 
-    /** Output RGB color space used to decoded image */ 
+    /** Output RGB color space used to decoded image */
     enum OutputColorSpace 
     {
         RAWCOLOR = 0,
@@ -79,7 +97,7 @@
         colorBalanceMultipliers[2] = 0.0;
         colorBalanceMultipliers[3] = 0.0;
     };
-    
+
     /** Compare for equality */
     bool operator==(const RawDecodingSettings &o) const
     {
@@ -139,35 +157,35 @@
 
     /** If true, decode RAW file in 16 bits per color per pixel else 8 bits.
     */
-    bool sixteenBitsImage;    
+    bool sixteenBitsImage;
 
-    /** 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;
 
-    /**  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. 
+        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 cameras with non-square pixels, do not stretch the image to its 
         correct aspect ratio. In any case, this option guarantees that each 
-        output pixel corresponds to one RAW pixel. 
+        output pixel corresponds to one RAW pixel.
     */
     bool DontStretchPixels;
-    
-    /** Unclip Highlight color level: 
+
+    /** Unclip Highlight color level:
         0   = Clip all highlights to solid white.
         1   = Leave highlights unclipped in various shades of pink.
         2   = Blend clipped and unclipped values together for a gradual
@@ -177,31 +195,31 @@
     */
     int unclipColors;
 
-    /** RAW quality decoding factor value. See DecodingQuality values 
-        for details. 
+    /** RAW quality decoding factor value. See DecodingQuality values
+        for details.
     */
     DecodingQuality RAWQuality;
 
-    /** Use wavelets to erase noise while preserving real detail. 
+    /** Use wavelets to erase noise while preserving real detail.
     */
     bool enableNoiseReduction;
 
-    /** Noise reduction threshold value.  
+    /** Noise reduction threshold value.
         The best threshold should be somewhere between 100 and 1000.
     */
     int NRThreshold;
-    
-    /** Brightness of output image. 
+
+    /** Brightness of output image.
     */
-    float brightness;   
+    float brightness;
 
     /** Set on the black point setting to decode RAW image.
     */
     bool enableBlackPoint;
 
-    /** Black Point value of output image. 
+    /** Black Point value of output image.
     */
-    int blackPoint;   
+    int blackPoint;
 
     /** The output color space used to decoded RAW data. See OutputColorSpace 
         values for details. 


More information about the Kde-imaging mailing list