Hello, I have some question of webp.

216 views
Skip to first unread message

peiwei zhang

unread,
Dec 4, 2023, 6:51:26 AM12/4/23
to WebP Discussion
Hello,  I have some question of webp. I am learning and using libwebp and trying to compress images with it. I read webp's lossless bitstream specification and learned that its compression process goes through transform and entropy coding. I want to know how libwebp chooses to transform, and how it chooses to encode entropy? Which programs should I read?
Can someone help me? Thank you!

James Zern

unread,
Dec 4, 2023, 2:58:14 PM12/4/23
to webp-d...@webmproject.org
Hi,

On Mon, Dec 4, 2023 at 3:51 AM peiwei zhang <zhangp...@gmail.com> wrote:
Hello,  I have some question of webp. I am learning and using libwebp and trying to compress images with it. I read webp's lossless bitstream specification and learned that its compression process goes through transform and entropy coding. I want to know how libwebp chooses to transform, and how it chooses to encode entropy? Which programs should I read?
Can someone help me? Thank you!

VP8LEncodeImage() [1] is the main entry point for lossless encoding in libwebp. You can follow the process through VP8LEncodeStream() [2].

Vincent Rabaud

unread,
Dec 5, 2023, 11:18:06 AM12/5/23
to webp-d...@webmproject.org
Hi,

There are several stages in the lossless compression.
EncoderAnalyze (https://chromium.googlesource.com/webm/libwebp/+/refs/tags/v1.3.2/src/enc/vp8l_enc.c#570) analyzes the entropy (at https://chromium.googlesource.com/webm/libwebp/+/refs/tags/v1.3.2/src/enc/vp8l_enc.c#385) and then infers the combination of transforms that should later be tried.
The symbols are Huffman encoded and there are different groups of statistics for symbols with similar statistics. It is then all encoded with the BitWriter (https://chromium.googlesource.com/webm/libwebp/+/refs/tags/v1.3.2/src/utils/bit_writer_utils.h#27)

--
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/CABWgkXKAPFv2papNVwSkEUOb390wrrKjyohnkAmQzy-VibzJHA%40mail.gmail.com.

peiwei zhang

unread,
Dec 9, 2023, 4:45:11 AM12/9/23
to WebP Discussion, Vincent Rabaud
Hi, I have another question. Because my current knowledge level is not enough, I would like to ask some conclusions about webp lossless compression. First, the lossless compression of webp is to transform before entropy encoding, right? If so, on what basis does it choose the mode of transform? Second, is the lossless compression selection entropy encoding for webp selected according to the crunch_configs_size obtained by EncoderAnalysz? The last question is, for lossless compression of webp, is there a correlation between choosing transform and choosing entropy encoding? Or should we first determine the transform mode and then choose the entropy encoding method according to the converted data? My code uses method = 6, quality = 100. Thank you so much. Thank you for your help!

Vincent Rabaud

unread,
Dec 11, 2023, 10:05:54 AM12/11/23
to peiwei zhang, WebP Discussion
1: indeed, the image is transformed to lower its entropy, before entropy coding
2: crunch_configs_size is the number of heuristics that are tried for
all the transforms
3: the entropy coding is just generic. The probabilities are affected
by the transforms though


On Sat, Dec 9, 2023 at 9:34 AM peiwei zhang <zhangp...@gmail.com> wrote:
>
> Hi, I have another question. Because my current knowledge level is not enough, I would like to ask some conclusions about webp lossless compression. First, the lossless compression of webp is to transform before entropy encoding, right? If so, on what basis does it choose the mode of transform? Second, is the lossless compression selection entropy encoding for webp selected according to the crunch_configs_size obtained by EncoderAnalysz? The last question is, for lossless compression of webp, is there a correlation between choosing transform and choosing entropy encoding? Or should we first determine the transform mode and then choose the entropy encoding method according to the converted data? My code uses method = 6, quality = 100. Thank you so much. Thank you for your help!
>
> 在2023年12月6日星期三 UTC+8 00:18:06<Vincent Rabaud> 写道:
>>
Reply all
Reply to author
Forward
0 new messages