Inter-Frame Prediction in Animated AVIF Files
Animated AVIF files achieve high compression efficiency by relying on the underlying AV1 video coding standard to eliminate temporal redundancy between frames. Because AVIF is an image-specific profile of the ISO Base Media File Format (ISOBMFF) that encapsulates raw AV1 bitstreams, its inter-frame prediction mechanism does not exist as a separate image-level protocol. Instead, it utilizes the full suite of AV1 motion estimation, multi-frame referencing, and advanced motion compensation tools to predict succeeding frames from previous or future reference pictures.
The Codec-Level Architecture
An animated AVIF file stores an image sequence as a video track within an ISOBMFF container. The temporal processing relies on two fundamental AV1 frame categories:
- Intra-frames (Key Frames): Self-contained images coded using only spatial prediction within the current frame.
- Inter-frames (Delta Frames): Frames that depend on one or more previously decoded reference frames, storing only the residual differences and motion vectors rather than complete pixel data.
Multi-Reference Frame Buffers
Unlike older animation formats such as GIF (which uses simple frame disposal and differential bounding boxes) or basic video codecs that reference only the immediate previous frame, AV1 maintains a pool of up to eight distinct reference frames in its frame buffer.
During inter-prediction, an encoder can select from seven temporal reference directions for any given block:
- LAST, LAST2, LAST3: Frames immediately preceding the current frame.
- GOLDEN: A designated high-quality past frame retained across longer intervals.
- BWDREF and ALTREF2: Backward reference frames used in bidirectional prediction.
- ALTREF (Alternative Reference): An invisible, temporally filtered synthetic frame used exclusively as a prediction source.
This structure allows animated AVIF files to retain recurring elements—such as a looping background or an oscillating graphic—in memory, referencing them later without re-encoding the visual data.
Block-Based Motion Compensation and Sub-Pixel Accuracy
AV1 partitions frames using a recursive block structure ranging from 128×128 down to 4×4 pixels. For inter-predicted blocks, the codec calculates motion vectors (MVs) that track pixel displacement across frames. AV1 supports sub-pixel precision down to 1/8-pel accuracy, using high-order interpolation filters (such as 8-tap regular, smooth, or sharp filters) to accurately capture fine or slow movements.
Compound and Masked Prediction
When predicting a block, AV1 is not limited to a single motion vector. It supports compound prediction, combining two distinct reference signals via several methods:
- Distance-Weighted Compound: Weights the two prediction signals based on temporal distance from the reference frames to the target frame.
- Wedge-Based Prediction: Splits a block diagonally or along predefined shapes using a codebook of wedge masks to blend two different motion sources seamlessly.
- Difference-Weighted Prediction: Dynamically calculates a pixel-by-pixel mask based on the absolute differences between the two reference sources.
Global and Warped Motion Compensation
Animated graphics and screen recordings often feature camera pans, zooming, or rotational motion. AV1 includes affine and homography transformation models:
- Global Motion: Allows an entire frame to share global transformation parameters (translation, rotation, scaling) derived from a reference frame, eliminating the need to store individual motion vectors for every block.
- Warped Motion: Locally estimates 2D affine transformations using neighboring motion vectors, providing smooth continuous prediction for non-rigid or shearing movements.
Overlapped Block Motion Compensation (OBMC)
To eliminate boundary discontinuities between adjacent blocks with different motion vectors, AV1 applies Overlapped Block Motion Compensation. OBMC blends the prediction of the current block with predictions formed by extending the motion vectors of adjacent top and left neighboring blocks, significantly reducing blockiness and lowering the bit-cost of the residual transform stage.