Bug 148561

Summary: Missing options in RAW conversion; terrible conversion of dark photos
Product: [Applications] digikam Reporter: jgoerzen
Component: Plugin-DImg-RAWAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: caulier.gilles
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In: 6.2.0
Sentry Crash Report:

Description jgoerzen 2007-08-06 04:12:13 UTC
Version:           0.9.1 (using KDE KDE 3.5.7)
Installed from:    Debian testing/unstable Packages
OS:                Linux

There are some important options to have.

#1 is to use camera exposure settings instead of applying autoexposure.  Applying autoexposure makes some really wacky decisions, such as turning nice dark nighttime photos into noisy things with daytime brightness.

In general, there are a lot of dcraw options that digikam is not supporting but ought to.  See the dcraw manpage for more.
Comment 1 Gerhard Kulzer 2007-08-07 23:24:38 UTC
Am Monday 06 August 2007 schrieb jgoerzen@complete.org:
[bugs.kde.org quoted mail]
 You can configure all dcraw parameters, go to Setting->digikam 
configure...->Raw decoding.

Please kill this bug report.

Thanks
Gerhard
Comment 2 jgoerzen 2007-08-07 23:55:59 UTC
No.

You can set *SOME* dcraw parameters.  Nowhere even CLOSE to all in that box.
Comment 3 Guillaume Castagnino 2007-08-08 23:09:24 UTC
I think it could be a good thing to manage more dcraw options in libkdcraw
For example : I would like to enable chromatic aberration reduction (with "-C 0.9994 1.0001" in my case), and I cannot because this option is not managed in the libkdcraw widget...

I think a good solution, that should not need hard work to maintain is to provide a free text field, to let advanced users enter custom dcraw options manually.
Such a field has the big advantage to let the "advanced user that read the dcraw manpage" manage advanced or new options of dcraw that are not managed with the standard libkdcraw widget.
Comment 4 caulier.gilles 2007-08-15 08:02:11 UTC
Guillaume,

libkdcraw is a wrapper around dcraw command line program. All options provided by settings widget are fully tested. Add a field to control more/new dcraw wich have been yet tested with wrapper is a wrong way. Also, this way to control more options sound like the old Linux GUI philosophy. It's weird : it's will be infernal to debug something as well.

Controlling and maintain a compatibility between dcraw version is already complex. In the pass, digiKam used the version of dcraw installed by user on computer. Because dcraw author break command lines options compatibility between dcraw version, it's the hell...

But, i'm agree with you. more dcraw options must be added to GUI in the future. It's planed but it will be done progressivly...

Gilles Caulier

Comment 5 Guillaume Castagnino 2007-08-15 09:42:04 UTC
Yes, I agree that adding a custom free-text field could be like "old Linux GUI philosophy". It has always be and always will be a challenge to make a good GUI to a command line tool. But I think it could have some advantages :

Currently, each time you add a new option in libkdcraw, this breaks binary compatibility and all programs that use libkdcraw (digikam/kipi-plugins) need an update to manage the new dcraw option. If not, the new option will simply be ignored. Such field would let user add custom options, without breaking any compatibility each time you want to manage a new option...
Of course, it's better to manage properly options in the dialog, but as you said, it's sometime a challange to add and maintain a lot of options in dcraw since they often change... So such free-text field could be a good meanwhile solution to manage exotic options that you would probably never support in the GUI

I agree, it's easy to break dcraw output by setting weired options here. So for bug-report purpose, first thing should be (of course) :  "remove all the custom options you set up"... Since only advanced users that know how such options are handled internally should use such field.

my 2 cents,
Regards
Guillaume
Comment 6 caulier.gilles 2007-08-20 11:48:03 UTC
Just to report change on svn, libkdcraw support now PPG RAW decoding interpolation option introduced with dcraw version 8.73.

Gilles Caulier
Comment 7 caulier.gilles 2007-08-20 11:54:31 UTC
Guillaume,

If you want to make patch to include new options in config widget, raw decoding setting and dcraw C++ interface, let's me hear. Note than i'm not agree to add a  "custom free-text field" option in advanced page. I prefert to have new settings designed as the already existing one...

...especially if you want to add a new "enable chromatic aberration reduction" as well. Let's me hear. 

Regards

Gilles Caulier
Comment 8 caulier.gilles 2007-08-22 15:23:41 UTC
SVN commit 703414 by cgilles:

libkdcraw from KDE3 branch : patch from Guillaume Castagnino about to support new chromatic aberration reduction options provided by dcraw 8.77
CCBUGS: 148561
CCMAIL: casta@xwing.info



 M  +91 -0     dcrawsettingswidget.cpp  
 M  +7 -0      dcrawsettingswidget.h  
 M  +7 -0      kdcraw.cpp  
 M  +21 -0     rawdecodingsettings.h  


--- branches/extragear/kde3/libs/libkdcraw/libkdcraw/dcrawsettingswidget.cpp #703413:703414
@@ -69,6 +69,11 @@
         enableNoiseReduction      = 0;
         NRThresholdSpinBox        = 0;
         NRThresholdLabel          = 0;
+        enableCACorrection        = 0;
+        caRedMultSpinBox          = 0;
+        caBlueMultSpinBox         = 0;
+        caRedMultLabel            = 0;
+        caBlueMultLabel           = 0;
         unclipColorComboBox       = 0;
         reconstructLabel          = 0;
         reconstructSpinBox        = 0;
@@ -89,6 +94,8 @@
     QLabel          *brightnessLabel;
     QLabel          *RAWQualityLabel;
     QLabel          *NRThresholdLabel;
+    QLabel          *caRedMultLabel;
+    QLabel          *caBlueMultLabel;
     QLabel          *unclipColorLabel;
     QLabel          *reconstructLabel;
     QLabel          *outputColorSpaceLabel;
@@ -109,11 +116,14 @@
     QCheckBox       *autoColorBalanceCheckBox;
     QCheckBox       *dontStretchPixelsCheckBox;
     QCheckBox       *enableNoiseReduction;
+    QCheckBox       *enableCACorrection;
 
     KIntNumInput    *reconstructSpinBox;
     KIntNumInput    *blackPointSpinBox;
     KIntNumInput    *NRThresholdSpinBox;
 
+    KDoubleNumInput *caRedMultSpinBox;
+    KDoubleNumInput *caBlueMultSpinBox;
     KDoubleNumInput *colorMult1SpinBox;
     KDoubleNumInput *colorMult2SpinBox;
     KDoubleNumInput *colorMult3SpinBox;
@@ -294,6 +304,36 @@
 
     // ---------------------------------------------------------------
 
+    d->enableCACorrection = new QCheckBox(i18n("Enable Chromatic Aberration correction"), d->stdSettings);
+    QWhatsThis::add( d->enableCACorrection, i18n("<p><b>Enable Chromatic Aberration correction</b><p>"
+                     "Enlarge the raw red and blue layers by the given factors, "
+                     "typically 0.999 to 1.001, to correct chromatic aberration.<p>"));
+    settingsBoxLayout->addMultiCellWidget(d->enableCACorrection, line, line, 0, 2);
+    line++;
+
+    d->caRedMultLabel   = new QLabel(i18n("Red multiplier:"), d->stdSettings);
+    d->caRedMultSpinBox = new KDoubleNumInput(d->stdSettings);
+    d->caRedMultSpinBox->setPrecision(5);
+    d->caRedMultSpinBox->setRange(0.00001, 2.0, 0.001, true);
+    QWhatsThis::add( d->caRedMultSpinBox, i18n("<p><b>Red multiplier</b><p>"
+                     "Set here the magnification factor of the red layer"));
+
+    d->caBlueMultLabel   = new QLabel(i18n("Blue multiplier:"), d->stdSettings);
+    d->caBlueMultSpinBox = new KDoubleNumInput(d->stdSettings);
+    d->caBlueMultSpinBox->setPrecision(5);
+    d->caBlueMultSpinBox->setRange(0.00001, 2.0, 0.001, true);
+    QWhatsThis::add( d->caBlueMultSpinBox, i18n("<p><b>Blue multiplier</b><p>"
+                     "Set here the magnification factor of the blue layer"));
+    
+    settingsBoxLayout->addMultiCellWidget(d->caRedMultLabel, line, line, 0, 0);
+    settingsBoxLayout->addMultiCellWidget(d->caRedMultSpinBox, line, line, 1, 2);
+    line++;
+    settingsBoxLayout->addMultiCellWidget(d->caBlueMultLabel, line, line, 0, 0);
+    settingsBoxLayout->addMultiCellWidget(d->caBlueMultSpinBox, line, line, 1, 2);
+    line++;
+
+    // ---------------------------------------------------------------
+
     d->outputColorSpaceLabel    = new QLabel(i18n("Color space:"), d->stdSettings);
     d->outputColorSpaceComboBox = new QComboBox( false, d->stdSettings );
     d->outputColorSpaceComboBox->insertItem( i18n("Raw (linear)"), 0 );
@@ -412,6 +452,9 @@
     connect(d->enableNoiseReduction, SIGNAL(toggled(bool)),
             this, SLOT(slotNoiseReductionToggled(bool)));
 
+    connect(d->enableCACorrection, SIGNAL(toggled(bool)),
+            this, SLOT(slotCACorrectionToggled(bool)));
+
     connect(d->blackPointCheckBox, SIGNAL(toggled(bool)),
             d->blackPointSpinBox, SLOT(setEnabled(bool)));
 
@@ -443,6 +486,9 @@
     setUnclipColor(0);
     setDontStretchPixels(false);
     setNoiseReduction(false);
+    setUseCACorrection(false);
+    setcaRedMultiplier(1.0);
+    setcaBlueMultiplier(1.0);
     setBrightness(1.0);
     setUseBlackPoint(false);
     setBlackPoint(0);
@@ -483,6 +529,14 @@
     d->NRThresholdLabel->setEnabled(b);
 }
 
+void DcrawSettingsWidget::slotCACorrectionToggled(bool b)
+{
+    d->caRedMultSpinBox->setEnabled(b);
+    d->caBlueMultSpinBox->setEnabled(b);
+    d->caRedMultLabel->setEnabled(b);
+    d->caBlueMultLabel->setEnabled(b);
+}
+
 void DcrawSettingsWidget::slotColorMultToggled(bool b)
 {
     d->colorMult1SpinBox->setEnabled(b);
@@ -714,6 +768,43 @@
 
 // ---------------------------------------------------------------
 
+bool DcrawSettingsWidget::useCACorrection()
+{
+    return d->enableCACorrection->isChecked();
+}
+
+void DcrawSettingsWidget::setUseCACorrection(bool b)
+{
+    d->enableCACorrection->setChecked(b);
+    slotCACorrectionToggled(b);
+}
+
+// ---------------------------------------------------------------
+
+double DcrawSettingsWidget::caRedMultiplier()
+{
+    return d->caRedMultSpinBox->value();
+}
+
+void DcrawSettingsWidget::setcaRedMultiplier(double b)
+{
+    d->caRedMultSpinBox->setValue(b);
+}
+
+// ---------------------------------------------------------------
+
+double DcrawSettingsWidget::caBlueMultiplier()
+{
+    return d->caBlueMultSpinBox->value();
+}
+
+void DcrawSettingsWidget::setcaBlueMultiplier(double b)
+{
+    d->caBlueMultSpinBox->setValue(b);
+}
+
+// ---------------------------------------------------------------
+
 bool DcrawSettingsWidget::useColorMultipliers()
 {
     return d->colorMultCheckBox->isChecked();
--- branches/extragear/kde3/libs/libkdcraw/libkdcraw/dcrawsettingswidget.h #703413:703414
@@ -55,11 +55,14 @@
     bool   useFourColor();
     bool   useDontStretchPixels();
     bool   useNoiseReduction();
+    bool   useCACorrection();
     bool   useBlackPoint();
     int    unclipColor();
     double brightness();
     int    blackPoint();
     int    NRThreshold();
+    double caRedMultiplier();
+    double caBlueMultiplier();
     bool   useColorMultipliers();
     double colorMultiplier1();
     double colorMultiplier2();
@@ -75,11 +78,14 @@
     void   setFourColor(bool b);
     void   setDontStretchPixels(bool b);
     void   setNoiseReduction(bool b);
+    void   setUseCACorrection(bool b);
     void   setUseBlackPoint(bool b);
     void   setUnclipColor(int v);
     void   setBrightness(double b);
     void   setBlackPoint(int b);
     void   setNRThreshold(int b);
+    void   setcaRedMultiplier(double b);
+    void   setcaBlueMultiplier(double b);
     void   setQuality(RawDecodingSettings::DecodingQuality q);
     void   setOutputColorSpace(RawDecodingSettings::OutputColorSpace c);
     void   setUseColorMultipliers(bool b);
@@ -100,6 +106,7 @@
     void slotColorMultToggled(bool);
     void slotUnclipColorActivated(int);
     void slotNoiseReductionToggled(bool);
+    void slotCACorrectionToggled(bool);
     void processDcrawURL(const QString&);
 
 private:
--- branches/extragear/kde3/libs/libkdcraw/libkdcraw/kdcraw.cpp #703413:703414
@@ -766,6 +766,13 @@
         *d->process << QString::number(m_rawDecodingSettings.NRThreshold);
     }
 
+    if (m_rawDecodingSettings.enableCACorrection)
+    {
+        *d->process << "-C";
+        *d->process << QString::number(m_rawDecodingSettings.caMultiplier[0], 'f', 5);
+        *d->process << QString::number(m_rawDecodingSettings.caMultiplier[1], 'f', 5);
+    }
+
     *d->process << "-o";
     *d->process << QString::number(m_rawDecodingSettings.outputColorSpace);
 
--- branches/extragear/kde3/libs/libkdcraw/libkdcraw/rawdecodingsettings.h #703413:703414
@@ -91,6 +91,10 @@
         enableNoiseReduction       = false;
         NRThreshold                = 100;
 
+        enableCACorrection         = false;
+        caMultiplier[0]            = 1.0;
+        caMultiplier[1]            = 1.0;
+
         enableColorMultipliers     = false;
         colorBalanceMultipliers[0] = 0.0;
         colorBalanceMultipliers[1] = 0.0;
@@ -115,6 +119,9 @@
             && blackPoint == o.blackPoint  
             && enableNoiseReduction == o.enableNoiseReduction  
             && NRThreshold == o.NRThreshold  
+            && enableCACorrection == o.enableCACorrection
+            && caMultiplier[0] == o.caMultiplier[0]
+            && caMultiplier[1] == o.caMultiplier[1]
             && enableColorMultipliers == o.enableColorMultipliers  
             && colorBalanceMultipliers[0] == o.colorBalanceMultipliers[0]  
             && colorBalanceMultipliers[1] == o.colorBalanceMultipliers[1]  
@@ -146,6 +153,10 @@
         enableNoiseReduction       = false;
         NRThreshold                = 100;
 
+        enableCACorrection         = false;
+        caMultiplier[0]            = 1.0;
+        caMultiplier[1]            = 1.0;
+
         enableColorMultipliers     = false;
         colorBalanceMultipliers[0] = 0.0;
         colorBalanceMultipliers[1] = 0.0;
@@ -209,6 +220,16 @@
     */
     int NRThreshold;
 
+    /** Use red and blue layer magnification to reduce chromatic aberrations
+    */
+    bool enableCACorrection;
+
+    /** Magnification factor for Red and Blue layers
+        - caMultiplier[0] = red multiplier
+        - caMultiplier[1] = blue multiplier
+    */
+    double caMultiplier[2];
+
     /** Brightness of output image.
     */
     float brightness;
Comment 9 caulier.gilles 2007-08-22 15:26:00 UTC
SVN commit 703417 by cgilles:

kipi-plugins from KDE3 branch : RAW Converter : patch from Guillaume Castagnino to support new chromatic aberration reduction options from libkdcraw 

CCBUGS: 148561
CCMAIL: casta@xwing.info



 M  +9 -0      batchdialog.cpp  
 M  +12 -0     singledialog.cpp  


--- branches/extragear/kde3/libs/kipi-plugins/rawconverter/batchdialog.cpp #703416:703417
@@ -240,6 +240,9 @@
     m_decodingSettingsBox->setUseBlackPoint(config.readBoolEntry("Use Black Point", false));
     m_decodingSettingsBox->setBlackPoint(config.readNumEntry("Black Point", 0));
     m_decodingSettingsBox->setNRThreshold(config.readNumEntry("NR Threshold", 100));
+    m_decodingSettingsBox->setUseCACorrection(config.readBoolEntry("EnableCACorrection", false));
+    m_decodingSettingsBox->setcaRedMultiplier(config.readDoubleNumEntry("caRedMultiplier", 1.0));
+    m_decodingSettingsBox->setcaBlueMultiplier(config.readDoubleNumEntry("caBlueMultiplier", 1.0));
     m_decodingSettingsBox->setUseColorMultipliers(config.readBoolEntry("Use Color Multipliers", false));
     m_decodingSettingsBox->setcolorMultiplier1(config.readDoubleNumEntry("Color Multiplier1", 1.0));
     m_decodingSettingsBox->setcolorMultiplier2(config.readDoubleNumEntry("Color Multiplier2", 1.0));
@@ -280,6 +283,9 @@
     config.writeEntry("Use Black Point", m_decodingSettingsBox->useBlackPoint());
     config.writeEntry("Black Point", m_decodingSettingsBox->blackPoint());
     config.writeEntry("NR Threshold", m_decodingSettingsBox->NRThreshold());
+    config.writeEntry("EnableCACorrection", m_decodingSettingsBox->useCACorrection());
+    config.writeEntry("caRedMultiplier", m_decodingSettingsBox->caRedMultiplier());
+    config.writeEntry("caBlueMultiplier", m_decodingSettingsBox->caBlueMultiplier());
     config.writeEntry("Decoding Quality", (int)m_decodingSettingsBox->quality());
     config.writeEntry("Output Color Space", (int)m_decodingSettingsBox->outputColorSpace());
     config.writeEntry("Use Color Multipliers", m_decodingSettingsBox->useColorMultipliers());
@@ -339,6 +345,9 @@
     rawDecodingSettings.enableBlackPoint           = m_decodingSettingsBox->useBlackPoint();
     rawDecodingSettings.blackPoint                 = m_decodingSettingsBox->blackPoint();
     rawDecodingSettings.NRThreshold                = m_decodingSettingsBox->NRThreshold();
+    rawDecodingSettings.enableCACorrection         = m_decodingSettingsBox->useCACorrection();
+    rawDecodingSettings.caMultiplier[0]            = m_decodingSettingsBox->caRedMultiplier();
+    rawDecodingSettings.caMultiplier[1]            = m_decodingSettingsBox->caBlueMultiplier();
     rawDecodingSettings.RAWQuality                 = m_decodingSettingsBox->quality();
     rawDecodingSettings.outputColorSpace           = m_decodingSettingsBox->outputColorSpace();
     rawDecodingSettings.enableColorMultipliers     = m_decodingSettingsBox->useColorMultipliers();
--- branches/extragear/kde3/libs/kipi-plugins/rawconverter/singledialog.cpp #703416:703417
@@ -231,6 +231,9 @@
     m_decodingSettingsBox->setUseBlackPoint(config.readBoolEntry("Use Black Point", false));
     m_decodingSettingsBox->setBlackPoint(config.readNumEntry("Black Point", 0));
     m_decodingSettingsBox->setNRThreshold(config.readNumEntry("NR Threshold", 100));
+    m_decodingSettingsBox->setUseCACorrection(config.readBoolEntry("EnableCACorrection", false));
+    m_decodingSettingsBox->setcaRedMultiplier(config.readDoubleNumEntry("caRedMultiplier", 1.0));
+    m_decodingSettingsBox->setcaBlueMultiplier(config.readDoubleNumEntry("caBlueMultiplier", 1.0));
     m_decodingSettingsBox->setUseColorMultipliers(config.readBoolEntry("Use Color Multipliers", false));
     m_decodingSettingsBox->setcolorMultiplier1(config.readDoubleNumEntry("Color Multiplier1", 1.0));
     m_decodingSettingsBox->setcolorMultiplier2(config.readDoubleNumEntry("Color Multiplier2", 1.0));
@@ -271,6 +274,9 @@
     config.writeEntry("Use Black Point", m_decodingSettingsBox->useBlackPoint());
     config.writeEntry("Black Point", m_decodingSettingsBox->blackPoint());
     config.writeEntry("NR Threshold", m_decodingSettingsBox->NRThreshold());
+    config.writeEntry("EnableCACorrection", m_decodingSettingsBox->useCACorrection());
+    config.writeEntry("caRedMultiplier", m_decodingSettingsBox->caRedMultiplier());
+    config.writeEntry("caBlueMultiplier", m_decodingSettingsBox->caBlueMultiplier());
     config.writeEntry("Decoding Quality", (int)m_decodingSettingsBox->quality());
     config.writeEntry("Output Color Space", (int)m_decodingSettingsBox->outputColorSpace());
     config.writeEntry("Use Color Multipliers", m_decodingSettingsBox->useColorMultipliers());
@@ -305,6 +311,9 @@
     rawDecodingSettings.enableBlackPoint           = m_decodingSettingsBox->useBlackPoint();
     rawDecodingSettings.blackPoint                 = m_decodingSettingsBox->blackPoint();
     rawDecodingSettings.NRThreshold                = m_decodingSettingsBox->NRThreshold();
+    rawDecodingSettings.enableCACorrection         = m_decodingSettingsBox->useCACorrection();
+    rawDecodingSettings.caMultiplier[0]            = m_decodingSettingsBox->caRedMultiplier();
+    rawDecodingSettings.caMultiplier[1]            = m_decodingSettingsBox->caBlueMultiplier();
     rawDecodingSettings.RAWQuality                 = m_decodingSettingsBox->quality();
     rawDecodingSettings.outputColorSpace           = m_decodingSettingsBox->outputColorSpace();
     rawDecodingSettings.enableColorMultipliers     = m_decodingSettingsBox->useColorMultipliers();
@@ -333,6 +342,9 @@
     rawDecodingSettings.enableBlackPoint           = m_decodingSettingsBox->useBlackPoint();
     rawDecodingSettings.blackPoint                 = m_decodingSettingsBox->blackPoint();
     rawDecodingSettings.NRThreshold                = m_decodingSettingsBox->NRThreshold();
+    rawDecodingSettings.enableCACorrection         = m_decodingSettingsBox->useCACorrection();
+    rawDecodingSettings.caMultiplier[0]            = m_decodingSettingsBox->caRedMultiplier();
+    rawDecodingSettings.caMultiplier[1]            = m_decodingSettingsBox->caBlueMultiplier();
     rawDecodingSettings.RAWQuality                 = m_decodingSettingsBox->quality();
     rawDecodingSettings.outputColorSpace           = m_decodingSettingsBox->outputColorSpace();
     rawDecodingSettings.enableColorMultipliers     = m_decodingSettingsBox->useColorMultipliers();
Comment 10 caulier.gilles 2007-08-22 15:27:11 UTC
SVN commit 703418 by cgilles:

digiKam from KDE3 branch : patch from Guillaume Castagnino about to support new chromatic aberration reduction options provided by dcraw 8.77
CCBUGS: 148561
CCMAIL: casta@xwing.info


 M  +3 -0      imageeditor/editor/editorwindow.cpp  
 M  +6 -0      setup/setupdcraw.cpp  


--- branches/extragear/kde3/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp #703417:703418
@@ -892,6 +892,9 @@
     m_IOFileSettings->rawDecodingSettings.RAWQuality              = (KDcrawIface::RawDecodingSettings::DecodingQuality)config->readNumEntry("RAWQuality",
                                                                     KDcrawIface::RawDecodingSettings::BILINEAR);
     m_IOFileSettings->rawDecodingSettings.NRThreshold             = config->readNumEntry("NRThreshold", 100);
+    m_IOFileSettings->rawDecodingSettings.enableCACorrection      = config->readBoolEntry("EnableCACorrection", false);
+    m_IOFileSettings->rawDecodingSettings.caMultiplier[0]         = config->readDoubleNumEntry("caRedMultiplier", 1.0);
+    m_IOFileSettings->rawDecodingSettings.caMultiplier[1]         = config->readDoubleNumEntry("caBlueMultiplier", 1.0);
     m_IOFileSettings->rawDecodingSettings.brightness              = config->readDoubleNumEntry("RAWBrightness", 1.0);
 
     // -- GUI Settings -------------------------------------------------------
--- branches/extragear/kde3/graphics/digikam/utilities/setup/setupdcraw.cpp #703417:703418
@@ -95,6 +95,9 @@
     config->writeEntry("DontStretchPixels", d->dcrawSettings->useDontStretchPixels());
     config->writeEntry("EnableNoiseReduction", d->dcrawSettings->useNoiseReduction());
     config->writeEntry("NRThreshold", d->dcrawSettings->NRThreshold());
+    config->writeEntry("EnableCACorrection", d->dcrawSettings->useCACorrection());
+    config->writeEntry("caRedMultiplier", d->dcrawSettings->caRedMultiplier());
+    config->writeEntry("caBlueMultiplier", d->dcrawSettings->caBlueMultiplier());
     config->writeEntry("UnclipColors", d->dcrawSettings->unclipColor());
     config->writeEntry("RAWBrightness", d->dcrawSettings->brightness());
     config->writeEntry("RAWQuality", d->dcrawSettings->quality());
@@ -108,6 +111,9 @@
     d->dcrawSettings->setSixteenBits(config->readBoolEntry("SixteenBitsImage", false));
     d->dcrawSettings->setNoiseReduction(config->readBoolEntry("EnableNoiseReduction", false));
     d->dcrawSettings->setNRThreshold(config->readNumEntry("NRThreshold", 100));
+    d->dcrawSettings->setUseCACorrection(config->readBoolEntry("EnableCACorrection", false));
+    d->dcrawSettings->setcaRedMultiplier(config->readDoubleNumEntry("caRedMultiplier", 1.0));
+    d->dcrawSettings->setcaBlueMultiplier(config->readDoubleNumEntry("caBlueMultiplier", 1.0));
     d->dcrawSettings->setDontStretchPixels(config->readBoolEntry("DontStretchPixels", false));
     d->dcrawSettings->setUnclipColor(config->readNumEntry("UnclipColors", 0));
     d->dcrawSettings->setCameraWB(config->readBoolEntry("CameraColorBalance", true));
Comment 11 caulier.gilles 2007-08-22 16:02:32 UTC
SVN commit 703434 by cgilles:

libkdcraw from trunk (KDE4) : backport patch from Guillaume Castagnino about to support new chromatic aberration reduction options provided by dcraw 8.77
CCBUGS: 148561
CCMAIL: casta@xwing.info


 M  +91 -0     dcrawsettingswidget.cpp  
 M  +7 -0      dcrawsettingswidget.h  
 M  +8 -0      kdcraw.cpp  
 M  +21 -0     rawdecodingsettings.h  


--- trunk/extragear/libs/libkdcraw/libkdcraw/dcrawsettingswidget.cpp #703433:703434
@@ -70,6 +70,11 @@
         enableNoiseReduction      = 0;
         NRThresholdSpinBox        = 0;
         NRThresholdLabel          = 0;
+        enableCACorrection        = 0;
+        caRedMultSpinBox          = 0;
+        caBlueMultSpinBox         = 0;
+        caRedMultLabel            = 0;
+        caBlueMultLabel           = 0;
         unclipColorComboBox       = 0;
         reconstructLabel          = 0;
         reconstructSpinBox        = 0;
@@ -90,6 +95,8 @@
     QLabel          *brightnessLabel;
     QLabel          *RAWQualityLabel;
     QLabel          *NRThresholdLabel;
+    QLabel          *caRedMultLabel;
+    QLabel          *caBlueMultLabel;
     QLabel          *unclipColorLabel;
     QLabel          *reconstructLabel;
     QLabel          *outputColorSpaceLabel;
@@ -110,11 +117,14 @@
     QCheckBox       *autoColorBalanceCheckBox;
     QCheckBox       *dontStretchPixelsCheckBox;
     QCheckBox       *enableNoiseReduction;
+    QCheckBox       *enableCACorrection;
 
     KIntNumInput    *reconstructSpinBox;
     KIntNumInput    *blackPointSpinBox;
     KIntNumInput    *NRThresholdSpinBox;
 
+    KDoubleNumInput *caRedMultSpinBox;
+    KDoubleNumInput *caBlueMultSpinBox;
     KDoubleNumInput *colorMult1SpinBox;
     KDoubleNumInput *colorMult2SpinBox;
     KDoubleNumInput *colorMult3SpinBox;
@@ -297,6 +307,36 @@
 
     // ---------------------------------------------------------------
 
+    d->enableCACorrection = new QCheckBox(i18n("Enable Chromatic Aberration correction"), d->stdSettings);
+    d->enableCACorrection->setWhatsThis(i18n("<p><b>Enable Chromatic Aberration correction</b><p>"
+                     "Enlarge the raw red and blue layers by the given factors, "
+                     "typically 0.999 to 1.001, to correct chromatic aberration.<p>"));
+    settingsBoxLayout->addWidget(d->enableCACorrection, line, 0, 1, 3);
+    line++;
+
+    d->caRedMultLabel   = new QLabel(i18n("Red multiplier:"), d->stdSettings);
+    d->caRedMultSpinBox = new KDoubleNumInput(d->stdSettings);
+    d->caRedMultSpinBox->setPrecision(5);
+    d->caRedMultSpinBox->setRange(0.00001, 2.0, 0.001, true);
+    d->caRedMultSpinBox->setWhatsThis(i18n("<p><b>Red multiplier</b><p>"
+                     "Set here the magnification factor of the red layer"));
+
+    d->caBlueMultLabel   = new QLabel(i18n("Blue multiplier:"), d->stdSettings);
+    d->caBlueMultSpinBox = new KDoubleNumInput(d->stdSettings);
+    d->caBlueMultSpinBox->setPrecision(5);
+    d->caBlueMultSpinBox->setRange(0.00001, 2.0, 0.001, true);
+    d->caBlueMultSpinBox->setWhatsThis(i18n("<p><b>Blue multiplier</b><p>"
+                     "Set here the magnification factor of the blue layer"));
+    
+    settingsBoxLayout->addWidget(d->caRedMultLabel, line, 0, 1, 1);
+    settingsBoxLayout->addWidget(d->caRedMultSpinBox, line, 1, 1, 2);
+    line++;
+    settingsBoxLayout->addWidget(d->caBlueMultLabel, line, 0, 1, 1);
+    settingsBoxLayout->addWidget(d->caBlueMultSpinBox, line, 1, 1, 2);
+    line++;
+
+    // ---------------------------------------------------------------
+
     d->outputColorSpaceLabel    = new QLabel(i18n("Color space:"), d->stdSettings);
     d->outputColorSpaceComboBox = new QComboBox( d->stdSettings );
     d->outputColorSpaceComboBox->insertItem(0, i18n("Raw (linear)"));
@@ -419,6 +459,9 @@
     connect(d->enableNoiseReduction, SIGNAL(toggled(bool)),
             this, SLOT(slotNoiseReductionToggled(bool)));
 
+    connect(d->enableCACorrection, SIGNAL(toggled(bool)),
+            this, SLOT(slotCACorrectionToggled(bool)));
+
     connect(d->blackPointCheckBox, SIGNAL(toggled(bool)),
             d->blackPointSpinBox, SLOT(setEnabled(bool)));
 
@@ -450,6 +493,9 @@
     setUnclipColor(0);
     setDontStretchPixels(false);
     setNoiseReduction(false);
+    setUseCACorrection(false);
+    setcaRedMultiplier(1.0);
+    setcaBlueMultiplier(1.0);
     setBrightness(1.0);
     setUseBlackPoint(false);
     setBlackPoint(0);
@@ -490,6 +536,14 @@
     d->NRThresholdLabel->setEnabled(b);
 }
 
+void DcrawSettingsWidget::slotCACorrectionToggled(bool b)
+{
+    d->caRedMultSpinBox->setEnabled(b);
+    d->caBlueMultSpinBox->setEnabled(b);
+    d->caRedMultLabel->setEnabled(b);
+    d->caBlueMultLabel->setEnabled(b);
+}
+
 void DcrawSettingsWidget::slotColorMultToggled(bool b)
 {
     d->colorMult1SpinBox->setEnabled(b);
@@ -721,6 +775,43 @@
 
 // ---------------------------------------------------------------
 
+bool DcrawSettingsWidget::useCACorrection()
+{
+    return d->enableCACorrection->isChecked();
+}
+
+void DcrawSettingsWidget::setUseCACorrection(bool b)
+{
+    d->enableCACorrection->setChecked(b);
+    slotCACorrectionToggled(b);
+}
+
+// ---------------------------------------------------------------
+
+double DcrawSettingsWidget::caRedMultiplier()
+{
+    return d->caRedMultSpinBox->value();
+}
+
+void DcrawSettingsWidget::setcaRedMultiplier(double b)
+{
+    d->caRedMultSpinBox->setValue(b);
+}
+
+// ---------------------------------------------------------------
+
+double DcrawSettingsWidget::caBlueMultiplier()
+{
+    return d->caBlueMultSpinBox->value();
+}
+
+void DcrawSettingsWidget::setcaBlueMultiplier(double b)
+{
+    d->caBlueMultSpinBox->setValue(b);
+}
+
+// ---------------------------------------------------------------
+
 bool DcrawSettingsWidget::useColorMultipliers()
 {
     return d->colorMultCheckBox->isChecked();
--- trunk/extragear/libs/libkdcraw/libkdcraw/dcrawsettingswidget.h #703433:703434
@@ -55,11 +55,14 @@
     bool   useFourColor();
     bool   useDontStretchPixels();
     bool   useNoiseReduction();
+    bool   useCACorrection();
     bool   useBlackPoint();
     int    unclipColor();
     double brightness();
     int    blackPoint();
     int    NRThreshold();
+    double caRedMultiplier();
+    double caBlueMultiplier();
     bool   useColorMultipliers();
     double colorMultiplier1();
     double colorMultiplier2();
@@ -75,11 +78,14 @@
     void   setFourColor(bool b);
     void   setDontStretchPixels(bool b);
     void   setNoiseReduction(bool b);
+    void   setUseCACorrection(bool b);
     void   setUseBlackPoint(bool b);
     void   setUnclipColor(int v);
     void   setBrightness(double b);
     void   setBlackPoint(int b);
     void   setNRThreshold(int b);
+    void   setcaRedMultiplier(double b);
+    void   setcaBlueMultiplier(double b);
     void   setQuality(RawDecodingSettings::DecodingQuality q);
     void   setOutputColorSpace(RawDecodingSettings::OutputColorSpace c);
     void   setUseColorMultipliers(bool b);
@@ -100,6 +106,7 @@
     void slotColorMultToggled(bool);
     void slotUnclipColorActivated(int);
     void slotNoiseReductionToggled(bool);
+    void slotCACorrectionToggled(bool);
     void processDcrawUrl(const QString&);
 
 private:
--- trunk/extragear/libs/libkdcraw/libkdcraw/kdcraw.cpp #703433:703434
@@ -651,6 +651,7 @@
     // -b : set Brightness value.
     // -k : set Black Point value.
     // -r : set Raw Color Balance Multipliers.
+    // -C : set Correct chromatic aberration correction.
 
     QStringList args;
     args << "-c";
@@ -704,6 +705,13 @@
         args << QString::number(m_rawDecodingSettings.NRThreshold);
     }
 
+    if (m_rawDecodingSettings.enableCACorrection)
+    {
+        args << "-C";
+        args << QString::number(m_rawDecodingSettings.caMultiplier[0], 'f', 5);
+        args << QString::number(m_rawDecodingSettings.caMultiplier[1], 'f', 5);
+    }
+
     args << "-o";
     args << QString::number(m_rawDecodingSettings.outputColorSpace);
 
--- trunk/extragear/libs/libkdcraw/libkdcraw/rawdecodingsettings.h #703433:703434
@@ -91,6 +91,10 @@
         enableNoiseReduction       = false;
         NRThreshold                = 100;
 
+        enableCACorrection         = false;
+        caMultiplier[0]            = 1.0;
+        caMultiplier[1]            = 1.0;
+
         enableColorMultipliers     = false;
         colorBalanceMultipliers[0] = 0.0;
         colorBalanceMultipliers[1] = 0.0;
@@ -115,6 +119,9 @@
             && blackPoint == o.blackPoint  
             && enableNoiseReduction == o.enableNoiseReduction  
             && NRThreshold == o.NRThreshold  
+            && enableCACorrection == o.enableCACorrection
+            && caMultiplier[0] == o.caMultiplier[0]
+            && caMultiplier[1] == o.caMultiplier[1]
             && enableColorMultipliers == o.enableColorMultipliers  
             && colorBalanceMultipliers[0] == o.colorBalanceMultipliers[0]  
             && colorBalanceMultipliers[1] == o.colorBalanceMultipliers[1]  
@@ -146,6 +153,10 @@
         enableNoiseReduction       = false;
         NRThreshold                = 100;
 
+        enableCACorrection         = false;
+        caMultiplier[0]            = 1.0;
+        caMultiplier[1]            = 1.0;
+
         enableColorMultipliers     = false;
         colorBalanceMultipliers[0] = 0.0;
         colorBalanceMultipliers[1] = 0.0;
@@ -209,6 +220,16 @@
     */
     int NRThreshold;
 
+    /** Use red and blue layer magnification to reduce chromatic aberrations
+    */
+    bool enableCACorrection;
+
+    /** Magnification factor for Red and Blue layers
+        - caMultiplier[0] = red multiplier
+        - caMultiplier[1] = blue multiplier
+    */
+    double caMultiplier[2];
+
     /** Brightness of output image. 
     */
     float brightness;
Comment 12 caulier.gilles 2007-08-22 16:24:36 UTC
SVN commit 703446 by cgilles:

digiKam from trunk (KDE4) : backport patch from Guillaume Castagnino about to support new chromatic aberration reduction options provided by dcraw 8.77
CCBUGS: 148561
CCMAIL: casta@xwing.info


 M  +3 -0      imageeditor/editor/editorwindow.cpp  
 M  +6 -0      setup/setupdcraw.cpp  


--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp #703445:703446
@@ -853,6 +853,9 @@
                                                        group.readEntry("RAWQuality",
                                                        (int)KDcrawIface::RawDecodingSettings::BILINEAR);
     m_IOFileSettings->rawDecodingSettings.NRThreshold             = group.readEntry("NRThreshold", 100);
+    m_IOFileSettings->rawDecodingSettings.enableCACorrection      = group.readEntry("EnableCACorrection", false);
+    m_IOFileSettings->rawDecodingSettings.caMultiplier[0]         = group.readEntry("caRedMultiplier", 1.0);
+    m_IOFileSettings->rawDecodingSettings.caMultiplier[1]         = group.readEntry("caBlueMultiplier", 1.0);
     m_IOFileSettings->rawDecodingSettings.brightness              = group.readEntry("RAWBrightness", 1.0);
 
     // -- GUI Settings -------------------------------------------------------
--- trunk/extragear/graphics/digikam/utilities/setup/setupdcraw.cpp #703445:703446
@@ -91,6 +91,9 @@
     group.writeEntry("DontStretchPixels", d->dcrawSettings->useDontStretchPixels());
     group.writeEntry("EnableNoiseReduction", d->dcrawSettings->useNoiseReduction());
     group.writeEntry("NRThreshold", d->dcrawSettings->NRThreshold());
+    group.writeEntry("EnableCACorrection", d->dcrawSettings->useCACorrection());
+    group.writeEntry("caRedMultiplier", d->dcrawSettings->caRedMultiplier());
+    group.writeEntry("caBlueMultiplier", d->dcrawSettings->caBlueMultiplier());
     group.writeEntry("UnclipColors", d->dcrawSettings->unclipColor());
     group.writeEntry("RAWBrightness", d->dcrawSettings->brightness());
     group.writeEntry("RAWQuality", (int)d->dcrawSettings->quality());
@@ -104,6 +107,9 @@
     d->dcrawSettings->setSixteenBits(group.readEntry("SixteenBitsImage", false));
     d->dcrawSettings->setNoiseReduction(group.readEntry("EnableNoiseReduction", false));
     d->dcrawSettings->setNRThreshold(group.readEntry("NRThreshold", 100));
+    d->dcrawSettings->setUseCACorrection(group.readEntry("EnableCACorrection", false));
+    d->dcrawSettings->setcaRedMultiplier(group.readEntry("caRedMultiplier", 1.0));
+    d->dcrawSettings->setcaBlueMultiplier(group.readEntry("caBlueMultiplier", 1.0));
     d->dcrawSettings->setDontStretchPixels(group.readEntry("DontStretchPixels", false));
     d->dcrawSettings->setUnclipColor(group.readEntry("UnclipColors", 0));
     d->dcrawSettings->setCameraWB(group.readEntry("CameraColorBalance", true));
Comment 13 Arnd Baecker 2007-09-01 02:06:57 UTC
Guillaume, Gilles,

what should be done about this bug? 
Do you want to specify a list of features which should be supported?

Arnd
Comment 14 Guillaume Castagnino 2007-09-01 09:46:41 UTC
Hi,

I have an other patch to add RAW White Balance correction, but the implementation depends on what Gilles wants to do on #142055 ;)
IMHO : For me it sounds better to use the ported ufraw algorithm, that leads to a more coherent workflow for the WB values.

After that, I do not really see more dcraw options to add for the moment.

Regards
Comment 15 caulier.gilles 2007-09-01 10:02:47 UTC
Guillaume,

...and i wait feedback from users on #142055. I have not yet tested your patch and of course, i will do it because i use everyday RAW file (i'm just overloaded currently (:=)))

Gilles
Comment 16 caulier.gilles 2007-09-03 14:20:10 UTC
jgoerzen,

There is a KDE3 patch from Guillaume to test with libkdcraw, digiKam and Raw converter in file #142055. Please give us a feedback.

I mark this file as duplicate of this one

Gilles 

*** This bug has been marked as a duplicate of 142055 ***
Comment 17 caulier.gilles 2019-07-27 13:49:39 UTC
Fixed with bug #142055