Details
-
Task
-
Resolution: Duplicate
-
P3: Somewhat important
-
None
-
None
-
None
Description
Currently QtWebKit's ImageDecoderQt.cpp is asking for the ImageSize, the ImageFormat and later decoding asking to decode the image itself. The QJpegHandler will call read_jpeg_format, read_jpeg_size and read_jpeg_image which will create and destroy the JPEG decompressor three times for every JPEG image.
The boilerplate code for read_jpeg_format and read_jpeg_size is the same and the extra init of the decompressor could be saved. On top of that even the read_jpeg_image could use the same decompressor. One thing to get right though is that one can set "scaling" on the image, so the jpeg_calc_output_dimensions method needs to be called from the read_jpeg_image with updated information. From a quick look at the libjpeg code this seems to be allowed and possible.
A quick hack showed a promising improvement on the "image_cycling" test case.