[webkit-dev] image downscaling during decoding

Anton Obzhirov a.obzhirov at samsung.com
Mon Aug 13 08:03:55 PDT 2012


Yes, I noticed IMAGE_DECODER_DOWN_SAMPLING option.
I planned to reuse existing ImageDecoder API as much as possible. May be
will need to add
generic image downscaler with platform API. I need to think it through 
and I will send my proposal. Should I create a bug for it?

-----Original Message-----
From: Ilyes Gouta [mailto:ilyes.gouta at gmail.com] 
Sent: 13 August 2012 15:37
To: Anton Obzhirov
Cc: webkit-dev at lists.webkit.org
Subject: Re: [webkit-dev] image downscaling during decoding

Hi,

> At the moment such images are full decoded to a full size buffer and get
downscaled during rendering.

WebKit has already a hard coded
ImageSource::s_maxPixelsPerDecodedImage value, in
WebCode/platform/graphics/ImageSource.cpp which defaults to 1024 *
1024 when WebKit's option ENABLE(IMAGE_DECODER_DOWN_SAMPLING) gets
turned on. s_maxPixelsPerDecodedImage is used to compute a scaling
factor for both the horizontal and vertical directions and serves as a
cap to the maximum picture size that a decoder would produce (so
already a way to control the total memory allocated for pictures). Now
if those new width and height are smaller than the original picture's
dimensions, then the decoder if clever enough would then produce a
downscaled picture (preferably while decoding and not in a second
pass) that fit s_maxPixelsPerDecodedImage.

For example, it's is already possible for libjpeg to downscale JPEGs
(via a modified IDCT, so we get the resize for free), by specifying a
resize ratio via cinfo's scale_num and scale_denom fields.

Finally, it would make sense to allocate all those graphics buffers
from video memory instead of system memory (malloc()) (and yes that's
rather platform specific) and let the h/w to perform the final resize
and layout/rendering.

-Ilyes

On Mon, Aug 13, 2012 at 2:39 PM, Anton Obzhirov <a.obzhirov at samsung.com>
wrote:
> Hi,
>
>
>
> We are looking for ways to improve page loading speed and reduce memory
> usage for WebKit in general and for GTK port of WebKit in particular.
>
> One of the ideas is to implement downscaling of the images during decoding
> for image elements with rectangle less then original image size.
>
> At the moment such images are full decoded to a full size buffer and get
> downscaled during rendering.
>
> It can be quite beneficial in term of memory usage and should speed up
> rendering of the pages like image galleries for example.
>
> So what are your thoughts about it?
>
>
>
> Regards,
>
> Anton
>
>
>
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo/webkit-dev
>



More information about the webkit-dev mailing list