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

Peter Albrecht px79 at crazymonkeys.de
Thu Jan 9 21:17:09 GMT 2014


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

--- Comment #37 from Peter Albrecht <px79 at crazymonkeys.de> ---
I guess, I finally found the problem:

*** Short version (if you know the whole comment history) ***
The IccTransform object is created on the stack in 
 #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
See stacktrace "PREVIEW WIDGET:" in comment #33
So it gets created and deleted for every tile of the preview beeing processed.


*** Long version (if you don't want to read the whole comment history) ***
cmsReverseToneCurveEx() is a quite time consuming function.

Problematic stacktrace:
#0 cmsReverseToneCurveEx() at
/srv/local/debug/media-libs/lcms-2.5-r1/work/lcms2-2.5/src/cmsgamma.c:867
#1 BuildRGBOutputMatrixShaper() at
/srv/local/debug/media-libs/lcms-2.5-r1/work/lcms2-2.5/src/cmsio1.c:476
#2 _cmsReadOutputLUT() at
/srv/local/debug/media-libs/lcms-2.5-r1/work/lcms2-2.5/src/cmsio1.c:644
#3 DefaultICCintents() at
/srv/local/debug/media-libs/lcms-2.5-r1/work/lcms2-2.5/src/cmscnvrt.c:561
#4 cmsCreateExtendedTransform() at
/srv/local/debug/media-libs/lcms-2.5-r1/work/lcms2-2.5/src/cmsxform.c:692
#5 cmsCreateMultiprofileTransformTHR() at
/srv/local/debug/media-libs/lcms-2.5-r1/work/lcms2-2.5/src/cmsxform.c:807
#6 cmsCreateTransformTHR() at
/srv/local/debug/media-libs/lcms-2.5-r1/work/lcms2-2.5/src/cmsxform.c:848
#7 cmsCreateTransform() at
/srv/local/debug/media-libs/lcms-2.5-r1/work/lcms2-2.5/src/cmsxform.c:858
#8 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:541
#9 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
#10 Digikam::DImg::convertToPixmap() at
/srv/local/debug/media-gfx/digikam-3.5.0/work/digikam-3.5.0/core/libs/dimg/dimg.cpp:2038
#11 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
#12 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
#13 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
#14 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

Opening an editor tool in digikam's image editor calls
PreviewWidget::viewportPaintEvent().
This function uses tiling, so the subsequent called functions are all called 70
times in my case. (see comment #23)
In EditorCore::convertToPixmap() an IccTransform object is created and placed
on the stack.
In IccTransform::open() this IccTransform object realizes, that no color
profile has been loaded yet.
So the color profile gets loaded which leads to calls to
cmsReverseToneCurveEx().
This color profile then is applied to the current tile.
When done with this tile, the execution pointer climbs up the stacktrace again
to PreviewWidget::viewportPaintEvent(), where the next tile will be processed
this way.

The problem is: When climbing up the stacktrace and returning from
EditorCore::convertToPixmap(), the IccTransform object gets
deleted from the stack. And together with this object, the loaded color profile
gets deleted. So for the next tile to be processed, 
an new IccTransform object gets created, which again loads the color profile.
Again leading to time consuming calls to
cmsReverseToneCurveEx().


*** Solution ***
The IccTransform object someway needs to be kept alive for the whole
tile-processing of PreviewWidget::viewportPaintEvent().
Since I am not very familiar with KDE programming itself nor do I know the
digikam architecture very well, I need 
your help Gilles, Marcel or whoever wants to help.

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



More information about the Digikam-devel mailing list