Bug 163164

Summary: Allow more conservative memory management
Product: [Applications] digikam Reporter: Dik Takken <kde>
Component: Plugin-Editor-CurvesAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: andi.clemens, caulier.gilles
Priority: NOR    
Version: 0.9.4   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 3.0.0

Description Dik Takken 2008-06-03 21:54:27 UTC
Version:           0.9.4-beta4 (using KDE 3.5.8)
OS:                Linux

Working with very large photographs (like 50 megapixel 16-bit 6x6 cm slide scans) can be a problem in Digikam. A 300 MB TIFF easily consumes 800 MB of resident memory and a total of 1200 MB of virtual memory.

Maybe adding features like a configurable number of undo steps can improve the situation. CinePaint has this feature, and this application is a lot easier on the memory than DigiKam is.
Comment 1 caulier.gilles 2008-08-24 14:06:36 UTC
SVN commit 851712 by cgilles:

digiKam from KDE3 branch : AdjustCurves tool : memory consume optimization.
No need to duplicates original image data here: we can use the instance from editor instead.

Andi, this way can be applied in others image plugins if necessary. i'm sure that we will find old code to polish by thi way.

CCBUGS: 163164


 M  +7 -13     adjustcurves.cpp
 M  +1 -1      adjustcurves.h


--- branches/extragear/kde3/graphics/digikam/imageplugins/adjustcurves/adjustcurves.cpp #851711:851712
@@ -87,18 +87,12 @@
 AdjustCurveTool::AdjustCurveTool(QObject* parent)
               : EditorTool(parent)
 {
-    m_destinationPreviewData = 0L;
+    m_destinationPreviewData = 0;

    ImageIface iface(0, 0);
-    uchar *data     = iface.getOriginalImage();
-    int w           = iface.originalWidth();
-    int h           = iface.originalHeight();
-    bool sixteenBit = iface.originalSixteenBit();
-    bool hasAlpha   = iface.originalHasAlpha();
-    m_originalImage = DImg(w, h, sixteenBit, hasAlpha ,data);
-    delete [] data;
+    m_originalImage = iface.getOriginalImg();

-    m_histoSegments = m_originalImage.sixteenBit() ? 65535 : 255;
+    m_histoSegments = m_originalImage->sixteenBit() ? 65535 : 255;

    setName("adjustcurves");
    setToolName(i18n("Adjust Curves"));
@@ -191,8 +185,8 @@
    QLabel *spacev = new QLabel(curveBox);
    spacev->setFixedWidth(1);

-    m_curvesWidget = new CurvesWidget(256, 256, m_originalImage.bits(), m_originalImage.width(),
-                                                m_originalImage.height(), m_originalImage.sixteenBit(),
+    m_curvesWidget = new CurvesWidget(256, 256, m_originalImage->bits(), m_originalImage->width(),
+                                                m_originalImage->height(), m_originalImage->sixteenBit(),
                                                curveBox);
    QWhatsThis::add( m_curvesWidget, i18n("<p>This is the curve drawing of the selected channel from "
                                          "original image"));
@@ -576,7 +570,7 @@
            QPoint disable(-1, -1);
            QPoint p = config->readPointEntry(QString("CurveAjustmentChannel%1Point%2").arg(i).arg(j), &disable);

-            if (m_originalImage.sixteenBit() && p.x() != -1)
+            if (m_originalImage->sixteenBit() && p.x() != -1)
            {
                p.setX(p.x()*255);
                p.setY(p.y()*255);
@@ -607,7 +601,7 @@
        {
            QPoint p = m_curvesWidget->curves()->getCurvePoint(i, j);

-            if (m_originalImage.sixteenBit() && p.x() != -1)
+            if (m_originalImage->sixteenBit() && p.x() != -1)
            {
                p.setX(p.x()/255);
                p.setY(p.y()/255);
--- branches/extragear/kde3/graphics/digikam/imageplugins/adjustcurves/adjustcurves.h #851711:851712
@@ -132,7 +132,7 @@

    Digikam::ImageWidget         *m_previewWidget;

-    Digikam::DImg                 m_originalImage;
+    Digikam::DImg                *m_originalImage;
 };

 }  // NameSpace DigikamAdjustCurvesImagesPlugin
Comment 2 caulier.gilles 2008-08-24 15:30:22 UTC
Andi,

Please look this patch and my comment. We need to apply the same way on all image plugins when we will port code to Editor Tool api

Gilles
Comment 3 Andi Clemens 2008-08-24 15:49:23 UTC
Ok... we can do it when actually converting the imageplugins. Right now I'm in the "converting the widgets" flow :-)

Andi
Comment 4 caulier.gilles 2011-11-24 09:17:00 UTC
Dik,

This entry still valid with 2.x serie ?

Gilles Caulier
Comment 5 Dik Takken 2011-11-26 17:58:05 UTC
Gentoo is still on 1.9. I'll test again when 2.x is stable. On 1.9, the problem is still the same.
Comment 6 caulier.gilles 2011-12-18 17:34:00 UTC
Dik,

This file still valid using digiKam 2.4 ?

Gilles Caulier
Comment 7 caulier.gilles 2012-09-11 19:54:00 UTC
Dik,

No news from this entry please ?

Gilles Caulier
Comment 8 Dik Takken 2012-09-12 16:06:53 UTC
Sorry it took so long, but 2.x is much better in this respect. Resolving as fixed.