RFC: QImage scaling

Adam Treat treat at kde.org
Tue Mar 27 15:17:31 BST 2007


Hi Lubos,

I recently had a similar test app comparing QImage scaling to Imlib2 scaling. 
TT looked at this and Zack made some magical changes to the image scaling 
algorithm in Qt 4.3 latest.  Before, Imlib2 was an order of magnitude faster 
at rendering a scaled image.  Now, Qt is twice as fast as Imlib2 at least for 
QImage's that are scaled directly.

Have you tested against latest Qt 4.3?

Adam

On Tuesday 27 March 2007, Lubos Lunak wrote:
>  Hello,
>
>  Problem description: Untar attachment, compile (g++ a.cpp asm_scale.S
> scale.cpp ...) run and compare times.
>
>  Solution: That should be the two scale sources, but I'm not sure where to
> put and how much of it. The full sources are actually at
> http://websvn.kde.org/trunk/extragear/graphics/gwenview/imageutils/ and
> scale.cpp contains scaling code from ImageMagick (tad a bit more optimized)
> that can do rather high-quality scaling (Lanczos, Mitchell) and still be
> faster than Qt, fast sampling (i.e. no smoothing) from ImageMagick and
> scaling code from Imlib2 ported by Mosfet (I don't even remember where I
> got that) that's very fast and the quality is about the same like with Qt.
> The question, as already said, are where to put it and how much of it.
>
>  Besides Gwenview there are currently copies of it also in Krita and
> KSplashX. KSplashX is bound to have its own copy due to its design, so it
> doesn't count, but I suppose the rest shouldn't keep its own copies.
> Especially given that additionally e.g. KDesktop^W ... Plasma could use it
> for wallpaper and there would be more cases. Gwenview uses both methods
> (config option to select the higher quality) but in general I think just
> Imlib2/Mosfet could in general do.
>
>  I've been originally thinking about putting the Imlib2/Mosfet code to
> kdefx as some QImage scaling function, but that'd probably end up the same
> way like KPixmapIO, so I'm considering adding it as a qt-copy patch simply
> replacing QImage::scaled(). The licenses in the code look all BSD-style to
> me, so it should be ok.
>
>  So, would that be ok with everybody or would there be apps that could use
> more than just this one scaling function, working automagically(TM)?
>
> PS: Don't bother asking the obvious question with qt-blackhole@ ... er,
> qt-bugs@ in it. The answer is #48590.




More information about the kde-core-devel mailing list