[Digikam-devel] [digikam] [Bug 322789] Enabling "color managed view" in editor slows down tool startup

Peter Albrecht px79 at crazymonkeys.de
Tue Jan 7 21:11:59 GMT 2014


https://bugs.kde.org/show_bug.cgi?id=322789

--- Comment #33 from Peter Albrecht <px79 at crazymonkeys.de> ---
(In reply to comment #29)
> Why do we not encounter these problems with other places where images are
> drawn, mainly the preview view?

That's a good point! As I posted in comment #2: The Image Editor itself starts
very fast (~1 second), although its image is also color corrected. So I
compared the "editor loading" process with the "tool loading" process.

EDITOR:
      #0 Digikam::IccTransform::apply() at
/srv/local/debug/media-gfx/digikam-3.5.0/work/digikam-3.5.0/core/libs/dimg/filters/icc/icctransform.cpp:615
      #1 Digikam::DImg::convertToPixmap() at
/srv/local/debug/media-gfx/digikam-3.5.0/work/digikam-3.5.0/core/libs/dimg/dimg.cpp:2038
      #2 Digikam::EditorCore::paintOnDevice() at
/srv/local/debug/media-gfx/digikam-3.5.0/work/digikam-3.5.0/core/utilities/imageeditor/core/editorcore.cpp:666
      #3 Digikam::Canvas::paintViewport() at
/srv/local/debug/media-gfx/digikam-3.5.0/work/digikam-3.5.0/core/utilities/imageeditor/q3support/canvas.cpp:622
      #4 Digikam::Canvas::viewportPaintEvent() at
/srv/local/debug/media-gfx/digikam-3.5.0/work/digikam-3.5.0/core/utilities/imageeditor/q3support/canvas.cpp:514

PREVIEW WIDGET:
      #0 Digikam::IccTransform::apply() at
/srv/local/debug/media-gfx/digikam-3.5.0/work/digikam-3.5.0/core/libs/dimg/filters/icc/icctransform.cpp:615
      #1 Digikam::DImg::convertToPixmap() at
/srv/local/debug/media-gfx/digikam-3.5.0/work/digikam-3.5.0/core/libs/dimg/dimg.cpp:2038
      #2 Digikam::EditorCore::convertToPixmap() at
/srv/local/debug/media-gfx/digikam-3.5.0/work/digikam-3.5.0/core/utilities/imageeditor/core/editorcore.cpp:999
      #3 Digikam::ImageIface::convertToPixmap() at
/srv/local/debug/media-gfx/digikam-3.5.0/work/digikam-3.5.0/core/utilities/imageeditor/plugin/imageiface.cpp:309
      #4 Digikam::ImageRegionWidget::paintPreview() at
/srv/local/debug/media-gfx/digikam-3.5.0/work/digikam-3.5.0/core/utilities/imageeditor/q3support/imageregionwidget.cpp:141
      #5 Digikam::PreviewWidget::viewportPaintEvent() at
/srv/local/debug/media-gfx/digikam-3.5.0/work/digikam-3.5.0/core/utilities/imageeditor/q3support/previewwidget.cpp:591

Both processes call "IccTransform::apply()". And both use tiling. So both call
"IccTransform::apply()" 70 times (for my screen resolution). So why is "editor
loading" faster than "tool loading"?

Further debugging shows: 
Every call to "IccTransform::apply()" in "tool loading" (PreviewWidget) causes
6 calls to "cmsReverseToneCurveEx()". (Two times three color channels.) 
For "editor loading", only the first call to "IccTransform::apply()" causes 6
calls to "cmsReverseToneCurveEx()". The other 69 calls to
"IccTransform::apply()" do not cause calls to "cmsReverseToneCurveEx()"!?!?

apply() calls open():
#0 Digikam::IccTransform::open() at
/srv/local/debug/media-gfx/digikam-3.5.0/work/digikam-3.5.0/core/libs/dimg/filters/icc/icctransform.cpp:550
#1 Digikam::IccTransform::apply() at
/srv/local/debug/media-gfx/digikam-3.5.0/work/digikam-3.5.0/core/libs/dimg/filters/icc/icctransform.cpp:636
and open()'s first lines are:
bool IccTransform::open(TransformDescription& description) {
    if (d->handle)
    {
        if (d->currentDescription == description)
        {
            return true;
        }
     ...

The big difference is: 
In case of "tool loading", d->handle is always "0x0", so the IccTransformation
is created via dkCmsCreateTransform() every time of the 70 calls of
IccTransform::apply(). Leading to 70 x 6 = 420 calls to
cmsReverseToneCurveEx().
In case of "editor loading", digikam realizes that an IccTransformation has
already been created and leaves "IccTransform::open()" with the "return true"
mentioned in the code snipped above. So "editor loading" produces 1 x 6 = 6
calls to cmsReverseToneCurveEx().

So, the next question seems to be: Why does the "tool loading" process lose
"d->handle"?
It is set in IccTransform::open(), in line 543: d->handle =
dkCmsCreateTransform(...);

-- 
You are receiving this mail because:
You are the assignee for the bug.



More information about the Digikam-devel mailing list