1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//! AVIF codec for `otf-pixels`, implemented from scratch.
//!
//! AVIF is two specifications stacked: an ISOBMFF/HEIF container (ISO/IEC
//! 23008-12) holding one or more items, and an AV1 bitstream (AOM AV1) coding
//! the pixels. This crate owns both — see ADR-0013, which reverses ADR-0004's
//! decision to wrap the dav1d/rav1e family.
//!
//! # Scope
//!
//! Still images only: an AVIF still is an AV1 **key frame**, which removes
//! inter prediction, reference frame management, motion vectors and compound
//! modes — well over half of AV1's decoder surface. AVIF image *sequences*
//! (the `avis` brand, carrying `moov`/`trak`) are animation and therefore v2
//! per ROADMAP §v2; a sequence decodes its primary item and nothing else,
//! matching what GIF and WebP already do.
//!
//! # Encoding
//!
//! [`AvifEncoder`] writes an 8-bit 4:2:0 (or monochrome) key frame, with an
//! auxiliary alpha item for transparency. It is the tile decoder driven by
//! decisions: every symbol site asks a coder, which either reads the stream
//! or decides and writes it, so prediction, reconstruction and probability
//! adaptation are the decoder's own and cannot drift from it.
//!
//! # Memory
//!
//! Internally buffered, as SPEC §Formats says. The container addresses its
//! payload by absolute file offset through `iloc`, so the bytes must be
//! resident before any of them can be interpreted — there is no prefix of an
//! AVIF that yields a finished row. The external contract stays streaming
//! (ADR-0005): the codec buffers, the caller does not.
//!
//! # Safety
//!
//! Every parser here reads attacker-controlled bytes. Malformed input is a
//! value, never a panic: `unsafe_code = "forbid"` and the workspace ban on
//! `unwrap`/`expect`/`panic!` mean the classic container failures — a box
//! declaring more bytes than its parent holds, an item extent pointing outside
//! the file, a `grid` whose tiles do not tile — are rejected rather than
//! trusted.
pub use cdf;
pub use ;
pub use ;
pub use ;
pub use AvifEncoder;
pub use ;
pub use ;
/// The box type that identifies a file's brands, at offset 4 of every ISOBMFF
/// file.
pub const SIGNATURE_FTYP: = *b"ftyp";
/// Brands that mean "this file holds an AVIF still image".
///
/// A file is claimed if any of these appears as the major brand or among the
/// compatible brands. `avif` is the still-image brand proper; `mif1` is the
/// HEIF image-file brand that many encoders write as the major brand with
/// `avif` only in the compatible list; `miaf` is the MIAF profile brand; and
/// `MA1A`/`MA1B` are the MIAF AVIF baseline and advanced profiles.
pub const BRANDS_STILL: = ;
/// The brand for an AVIF image sequence.
///
/// Recognised so that sniffing claims the file and the decoder can report what
/// it found, rather than leaving an animation to be mis-sniffed as something
/// else entirely.
pub const BRAND_SEQUENCE: = *b"avis";