Jpeg rendering
-
I'm writing an application to, among other tings, decode jpeg-files on the fly.
Unfortunately, the Qt jpeg plugin performs less than optimal when compared to other decoders around.
Besides performance, it's important that the decoder can be compiled and embedded directly in the distribution set, as deployment must be as simple as possible for all platforms of the project (win32, Linux).I would like to use libjeg (https://sourceforge.net/projects/libjpeg/) as the default engine, with ambitions of using libjpeg-turbo (https://sourceforge.net/projects/libjpeg-turbo/) when possible.
Is this known territory in the forum?
-
Qt builds against it's own private copy of libjpeg if there is no system libjpeg. You can compile Qt yourself and tell it to use another jpeg lib (see "configure -help" output). But I doubt that you gain very much speed out of that (some fancy compiler optimizations may improve things a bit).
As long as it's source compatible, libjpeg-turbo should work.
On systems where it is already installed, Qt uses the system libjpeg.
-
Thanks for the answer.
I've tried to make a small test program; It loads a jpeg 1000 times using first QImage(file) and libjpeg(file). The difference in decoding speeds is quite noticable, being about 20%. (I've made sure that caching is not an issue!)
This seems to contradict your observations. Are you doing something "additional", such as manipulation LD_LIBRABRY_PATH (think I read something about this somewhere - but this wouldn't work in win32 anyway..)
BR
-
No, there is no additional library magic.
But your are comparing apples and oranges. A QImage is a format agnostic container for pixel images. Qt has to decode the image data (using libjpeg in your case), transfer the data to its own structures, keep some internal data around, setup the implicit sharing and the like. If you just use libjpeg you have to stick to its data structures, no QImage is involved then.
-
I will update my test program, see if I can prove your point!
BR