Maximum Reference Frames for Animated AVIF
This article examines the structural limits of reference frames in animated AVIF images. Because animated AVIF files are built on top of the AV1 video coding format wrapped within the ISO Base Media File Format (ISOBMFF), their temporal prediction capabilities strictly mirror the AV1 specification. Readers will learn the precise maximum number of reference frames maintained in memory, the active reference limits per frame, and how these parameters govern frame prediction across animation sequences.
AV1 Architecture and the Reference Buffer Limit
Animated AVIF files do not define their own independent video compression scheme; instead, they encapsulate an AV1 bitstream as an image sequence track. Consequently, the maximum number of reference frames an animated AVIF can utilize across sequence items is governed entirely by the AV1 Decoded Picture Buffer (DPB).
Under the AV1 specification, the Decoded Picture Buffer maintains a
fixed pool size defined by the constant NUM_REF_FRAMES,
which is set to 8. This means an animated AVIF decoder
can store a maximum of 8 distinct reference frames in memory at any
point in the playback sequence.
Maximum References Per Single Frame
While 8 frame slots exist in the decoded buffer pool, AV1 allows an inter-coded frame to reference up to 7 of those frames for prediction:
- LAST_FRAME: The most recent reference frame.
- LAST2_FRAME: The second most recent reference frame.
- LAST3_FRAME: The third most recent reference frame.
- GOLDEN_FRAME: A historically preserved frame often used for scene background recovery.
- BWDREF_FRAME: A backward (future in display order) reference frame.
- ALTREF2_FRAME: An alternative backward reference frame.
- ALTREF_FRAME: An alternative forward/backward reference often used for temporal filtering.
Although a sequence can update, shift, and refresh which images occupy the 8 buffer slots using reference frame update flags, no individual inter-frame can draw from more than 7 directional references simultaneously.
Sequence Mechanics in Animated AVIF
Across the lifetime of an animated AVIF sequence, reference frame management functions as follows:
- Intra Frames (Keyframes): Sequence items flagged as keyframes decode independently of prior frames and reset or selectively update the 8 buffer slots.
- Inter Frames: Subsequent animation frames reference up to 7 previously decoded frames currently resident within the 8 DPB slots.
- Buffer Slot Updates: The encoder chooses which of the 8 slots to overwrite with newly decoded frames using a bitmask. This allows non-consecutive frames (such as static background elements in a looping animation) to persist across hundreds of frames without being discarded.
In summary, an animated AVIF can retain at most 8 reference frames simultaneously within its sequence buffer, drawing from a maximum of 7 active reference frames to predict any given frame.