Skip to main content

otf_pixels_codec_webp/
lib.rs

1//! WebP codec for `otf-pixels`, lossy and lossless, owned outright
2//! (ADR-0014).
3//!
4//! # Layers
5//!
6//! The RIFF container (`riff`); VP8L lossless decode ([`vp8l`]) and encode
7//! (`vp8l_encode`); VP8 lossy decode and encode (`vp8`); `ALPH` alpha
8//! (`alpha`); and libwebp's YUV/RGB conversions (`yuv`). Decoding matches
9//! libwebp exactly, and libwebp checks every file we write.
10//!
11//! # Memory
12//!
13//! Internally buffered in both directions, as SPEC §Formats says. The decoder
14//! holds the whole file, whose chunks may come in any order the container
15//! allows; both encoders make decisions over the whole picture before the
16//! first byte is final.
17
18mod alpha;
19mod decoder;
20mod encoder;
21mod riff;
22mod vp8;
23pub mod vp8l;
24mod vp8l_encode;
25mod yuv;
26
27pub use decoder::{WebPCodec, WebPDecoder, probe};
28pub use encoder::WebPEncoder;
29
30/// The bytes a WebP file begins with: `RIFF`, four length bytes, then `WEBP`.
31pub const SIGNATURE_RIFF: [u8; 4] = *b"RIFF";
32/// The form type at offset 8.
33pub const SIGNATURE_WEBP: [u8; 4] = *b"WEBP";