How AVIF Uses AV1 Intra-Frame Coding Tools
The AV1 Image File Format (AVIF) leverages the still-image capabilities of the open-source AV1 video codec by encapsulating its intra-frame coding toolset within the standardized HEIF (High Efficiency Image File Format) container. Rather than inventing a standalone compression scheme, AVIF treats a still image as an AV1 intra-frame (also known as a keyframe or I-frame), allowing it to inherit modern spatial compression algorithms that significantly outperform traditional formats like JPEG and WebP.
Intra-Frame Prediction
Intra-frame coding relies solely on spatial redundancy within a single image, without referencing past or future frames. AVIF inherits AV1's advanced spatial intra-prediction tools, which predict the content of a target block using previously decoded boundary pixels from adjacent blocks:
- Directional Intra Prediction: AV1 features 56 directional prediction angles alongside recursive filtering. This fine angular granularity allows AVIF to align prediction vectors precisely with diagonal edges and complex gradients, minimizing the residual error that needs to be encoded.
- Non-Directional Predictors: For regions lacking clear directional patterns, AV1 provides DC, Smooth, and Paeth predictors. These modes model flat regions, gradual light falloffs, and bilateral edge contexts.
- Chroma from Luma (CfL): Because human vision is less sensitive to color detail than to luminance, AV1 introduces CfL to predict the chroma (color) channels directly from the reconstructed luma (brightness) channel. By utilizing the structural correlation between light and color, AVIF significantly reduces color plane residuals.
Flexible Block Partitioning
AVIF organizes image data using AV1's recursive block-partitioning tree. Images are divided into large base units called Superblocks—up to 128×128 pixels in size.
Each Superblock can be recursively subdivided down to blocks as small as 4×4 pixels. Unlike older codecs that rely primarily on square quad-tree divisions, AV1 supports horizontal and vertical splits (1:2, 2:1, 1:4, and 4:1 ratios). This structural flexibility allows AVIF to assign large blocks to uniform regions like clear skies, while isolating fine textures and sharp borders into tiny, localized partitions to prevent wasteful bit allocation.
Adaptive Transform Coding
Once prediction is complete, the remaining prediction error (residual) is converted from the spatial domain into the frequency domain:
- Multiple Transform Kernels: AV1 supports variations beyond standard Discrete Cosine Transforms (DCT). It incorporates the Asymmetric Discrete Sine Transform (ADST), flipped ADST, and the Identity Transform (which bypasses frequency conversion entirely).
- Hybrid 2D Transforms: AV1 allows horizontal and vertical transforms to be paired independently (e.g., DCT horizontally and ADST vertically). This enables AVIF to adapt specifically to directional residuals left behind along edges, concentrating residual energy into fewer coefficients.
Advanced In-Loop Filtering
To eliminate visual artifacts without blurring essential details, AVIF applies AV1's sequential three-stage in-loop restoration pipeline directly to the reconstructed image:
- Deblocking Filter: Smoothes unnatural step-edges that appear along block boundaries at lower bitrates.
- Constrained Directional Enhancement Filter (CDEF): Analyzes the dominant direction of edges within each block to suppress ringing artifacts and mosquito noise while sharpening primary boundaries.
- Loop Restoration: Employs separable Wiener filters and dual-subspace self-guided filters to reverse blur and restore high-frequency details across large image segments.
Film Grain Synthesis
High-frequency visual elements such as analog film grain or digital sensor noise typically require massive amounts of data to preserve. AVIF overcomes this using AV1's film grain synthesis tool. The encoder analyzes the grain, discards the raw noise, and transmits mathematical parameters describing its frequency and distribution. The decoder then reconstructs and overlays the synthetic grain onto the image during rendering, dramatically reducing file size while preserving photographic texture.