Expand description
Translation of src/utils/quant_levels_utils.c and src/utils/quant_levels_utils.h from libwebp v1.6.0.
Work package: WP4 (pixel ops).
§Deviations from upstream
Changes of representation that the ADRs allow, or behavior that the Rust side cannot reproduce exactly. Each records the reason.
QuantizeLevelsandWebPDequantizeLevels. A NULL plane isNone, and a NULLsseisNone. The early returns leavesseand the plane unchanged, as in C. The conversions of the rounded centroids touint8_tand of the error touint64_tare in range for every valid input.
§Checks not applicable
These checks do not apply, or cannot be made, with the reason:
- Floating point.
QuantizeLevelsand the SSIM functions (src/dsp/ssim.rs) are compared bit for bit on the development host (arm64, Apple clang,-ffp-contract=off). Equality on other hosts is recorded, not assumed (docs/PORTING.md).
Functions§
- quantize_
levels - Quantizes the levels of an 8-bit plane to
num_levelsvalues with k-means steps, and stores the sum of squared error inssewhen it is given.