quant_levels_dec_utils.c/.h.
Reasoning: Image Data Buffers: The `data` parameter of `WebPDequantizeLevels` (in both .c and .h) and `InitParams` (src/utils/quant_levels_dec_utils.c:232) is annotated with `WEBP_SIZED_BY((long)stride * height)`, as it points to the start of the image buffer. The `src` and `dst` fields in `SmoothParams` (src/utils/quant_levels_dec_utils.c:54) are annotated as `WEBP_INDEXABLE`. They are initialized from `data` in `InitParams` (L266) and are advanced row by row using pointer arithmetic (e.g., `p->src += p->stride` in `VFilter` L111, `p->dst += p->stride` in `ApplyFilter` L165). `WEBP_INDEXABLE` is used because the pointers iterate within the buffer and are only accessed with positive indices. Scratch Buffers (`SmoothParams`): Scratch buffers are allocated in `InitParams` via `WebPSafeMalloc`. The local variable `mem` holding this allocation (L245) is explicitly annotated as `WEBP_BIDI_INDEXABLE` to ensure safety when compiling with error suppression. - `start`, `cur`, `top`: These pointers are used for iteration and pointer arithmetic within the circular scratch buffer. They are annotated as `WEBP_INDEXABLE`. - `end`: This pointer is annotated as `WEBP_BIDI_INDEXABLE` because it is used in subtraction (`p->end - width`) in `InitParams` (L257) to calculate `p->top`. - `average`: This buffer is accessed sequentially up to `width`. It is annotated as `WEBP_COUNTED_BY(width)`. Initialization in `InitParams` is reordered (L261) to ensure `p->width` is set before `p->average`. - `correction`: This lookup table requires negative indexing. To avoid using `WEBP_BIDI_INDEXABLE` in the struct, it is annotated as `WEBP_COUNTED_BY_OR_NULL(CORRECTION_LUT_SIZE)` (L75), pointing to the start of the buffer. `CORRECTION_LUT_SIZE` is defined (L33). `InitCorrectionLUT` (L188) and `ApplyFilter` (L147) calculate a local middle pointer which is explicitly annotated as `WEBP_BIDI_INDEXABLE` to allow safe negative indexing. Local Pointers: To ensure safety when compiling with error suppression (where locals default to unsafe), explicit annotations are added to local pointers derived from safe struct members: - `VFilter` (L87): `src`, `cur`, `top`, `out` are `WEBP_INDEXABLE`. - `HFilter` (L121): `in`, `out` are `WEBP_INDEXABLE`. - `ApplyFilter` (L145): `average`, `dst` are `WEBP_INDEXABLE`. - `CountLevels` (L214): `data` is `WEBP_INDEXABLE`. Bug: 432511821 Change-Id: I6bdf86f80c94a5b182c5aef7e4092fe4ea24afb8
WebP Codec
__ __ ____ ____ ____
/ \\/ \/ _ \/ _ )/ _ \
\ / __/ _ \ __/
\__\__/\____/\_____/__/ ____ ___
/ _/ / \ \ / _ \/ _/
/ \_/ / / \ \ __/ \__
\____/____/\_____/_____/____/v1.6.0
WebP codec is a library to encode and decode images in WebP format. This package contains the library that can be used in other programs to add WebP support, as well as the command line tools 'cwebp' and 'dwebp' to compress and decompress images respectively.
See https://developers.google.com/speed/webp for details on the image format.
The latest source tree is available at https://chromium.googlesource.com/webm/libwebp
It is released under the same license as the WebM project. See https://www.webmproject.org/license/software/ or the "COPYING" file for details. An additional intellectual property rights grant can be found in the file PATENTS.
Building
See the building documentation.
Encoding and Decoding Tools
The examples/ directory contains tools to encode and decode images and animations, view information about WebP images, and more. See the tools documentation.
APIs
See the APIs documentation, and API usage examples in the
examples/ directory.
Bugs
Please report all bugs to the issue tracker. For security reports, select 'Security report' from the Template dropdown.
Patches welcome! See how to contribute.
Discuss
Email: webp-discuss@webmproject.org
Web: https://groups.google.com/a/webmproject.org/group/webp-discuss