Bug 289222

Summary: Rotate jpeg images isn't multithreaded.
Product: [Applications] digikam Reporter: Lukas Sommer <sommerluk>
Component: Plugin-DImg-JPEGAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: caulier.gilles, mike, sommerluk
Priority: NOR Keywords: junior-jobs
Version: 2.3.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 2.6.0

Description Lukas Sommer 2011-12-17 17:44:07 UTC
Version:           2.3.0 (using KDE 4.7.3) 
OS:                Linux

Rotate jpeg images isn't multithreaded.



Reproducible: Always

Steps to Reproduce:
Rotate many jpeg images.



Actual Results:  
It takes a long time because it uses only 1 processor core (I was observing this in ksysgurad).



Expected Results:  
It uses multiple processor cores. So it will finish eralier on multi-core systems. Would be great ;-)





Additional Information:
I am using digikam 2.3.0 Menu->Image-Rotate with various images.
Comment 1 caulier.gilles 2011-12-17 18:44:42 UTC
It use multithreading :

https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/jpeglossless/plugin/actionthread.cpp#L92

...through QThread class...

Gilles Caulier
Comment 2 Michael G. Hansen 2011-12-17 19:17:20 UTC
Yes, but only one thread, processing only one image at once. This wish is about using all available cores, to process several images in parallel. This could be easily done by using QtConcurrent - ideal for a junior-job ;-)

Michael
Comment 3 caulier.gilles 2011-12-17 19:29:06 UTC
QtConcurrent? What is that ?

Gilles Caulier
Comment 4 Michael G. Hansen 2011-12-17 19:49:47 UTC
QtConcurrent is a multithreading component of Qt, to which you can give a list and a function, and it will call the function in parallel adjusted to the number of cores with all elements in the list. I use it a lot in gpssync.

Michael
Comment 5 caulier.gilles 2011-12-17 19:54:23 UTC
Excelent. Give some link in source code please. This must be used in lots of parts in digiKam

Gilles Caulier
Comment 6 Lukas Sommer 2011-12-18 18:38:13 UTC
Maybe it is usefull to limite how many cores are used?

I have 6 cores, but it is nice that programs don't use all of them - this keeps other programs responsive.

So, maybe the maximal number of parallel processes can be limited, either automatically based on the number of available cores or manually by the user?

What do you think?
Comment 7 Michael G. Hansen 2011-12-18 20:32:34 UTC
QtConcurrent is for example used to load GPX files in parallel in GPSSync:

http://lxr.kde.org/source/extragear/graphics/kipi-plugins/gpssync/gpsdataparser.cpp#97

QtConcurrent documentation:

http://developer.qt.nokia.com/doc/qt-4.8/threads-qtconcurrent.html

@Lukas: Last time I looked, QtConcurrent only offered to automatically use the number of available cores, and also did not allow you to change the priority of the thread. Maybe KDE's threadweaver [1] allows you to do that.

Michael

[1] http://api.kde.org/4.0-api/kdelibs-apidocs/threadweaver/html/index.html
Comment 8 caulier.gilles 2012-01-25 08:29:01 UTC
This have been implemented in digiKam core from git/master by Marcel.

digiKam do not use JPEGLossLess plugin to rotate image. A dedicated code from digiKam core do it, and it's multithreaded and parallelized if you have more than one CPU available...

This will be available for next 2.6.0 release...

Gilles Caulier
Comment 9 Lukas Sommer 2012-02-01 07:12:06 UTC
Thanks a lot!