The rescaling algorithm used in the webp decoding.

25 views
Skip to first unread message

Allen Cheung

unread,
Dec 10, 2021, 10:46:03 PM12/10/21
to WebP Discussion
I am studying image downsampling and found that webp has a better image quality than other algorithms (such as cubic, bilinear) when the rescaling ratio is high (in my case, the rescaling ratio == 8).
I debug the webp source code and locate the implementation of webp's decoding rescaling function in the file 'libwebp\src\dec\io_dec.c'. (Am I right?) But it is complicated to understand it.

And I found skal said the algorithm used is based on summed-area (i.e.: box-filtering). 

Is there any more detailed information about the algorithm?

Thank you very much for your comments and suggestions.

Pascal Massimino

unread,
Dec 13, 2021, 12:33:19 PM12/13/21
to WebP Discussion
Hi Allen,

First, the horizontal and vertical summation passes are separated. Then for each pass, it's using a DDA [1] to generate the source points for each output point
(yes, it's mapping the points in reverse direction: for each output position, find the fractional value of the source point that would be rescaled to this location).
Then you use the fractional part of the position to scale the input sample values. It's indeed an integral (/summed) rescaling because of that. Could use smarter
interpolation (similar to trapezoid method for integrals), but it's not really improving the result much. Midpoint is fine, and computation is easier (just one mult).

Hope the following schema helps understanding:
image.png

skal/



Thank you very much for your comments and suggestions.

--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss...@webmproject.org.
To view this discussion on the web visit https://groups.google.com/a/webmproject.org/d/msgid/webp-discuss/dd82921d-fe50-480e-b9f8-777d66f17acan%40webmproject.org.
Reply all
Reply to author
Forward
0 new messages