AVIF vs HEIC Directional Intra-Prediction Angles
Intra-prediction is essential for modern image compression, removing spatial redundancy by predicting pixel blocks from adjacent, already decoded pixels. When comparing image formats, AVIF (derived from the AV1 video codec) and HEIC (derived from HEVC/H.265) take distinctly different architectural approaches to directional intra-prediction. While HEIC utilizes a fixed set of 33 angular modes uniformly mapped across standard orientations, AVIF implements a dynamic system combining 8 nominal directional modes with fine angular deltas, allowing up to 56 directional angles that deliver greater geometric precision and sharper edge reconstruction.
HEIC Angular Intra-Prediction Architecture
HEIC relies on the intra-frame prediction framework established by HEVC (H.265). HEVC defines 35 total intra-prediction modes for coding units:
- Mode 0: Planar mode (for smooth gradients)
- Mode 1: DC mode (flat, average value)
- Modes 2 through 34: 33 directional/angular modes
The 33 directional prediction modes in HEIC span angles from roughly 45 degrees to 225 degrees. Each mode index corresponds directly to a fixed slope value that dictates the sample projection direction from the top and left reference boundaries. These modes are spaced at fixed intervals, providing uniform coverage across horizontal, vertical, and diagonal orientations. HEIC signals these modes using a Most Probable Mode (MPM) list containing three candidate modes derived from neighboring blocks to minimize signaling overhead.
AVIF Directional Intra-Prediction Architecture
AVIF utilizes the spatial prediction framework of the AV1 codec, which structures directional prediction using a base-plus-offset mechanism rather than a flat list of fixed angles.
AV1 defines 8 base directional (nominal) modes:
- V_PRED: Vertical prediction
- H_PRED: Horizontal prediction
- D45_PRED, D135_PRED, D203_PRED, D157_PRED, D67_PRED, D113_PRED: Diagonal modes representing standard angles (45°, 67.5°, 113°, 135°, 157.5°, and 203°).
To increase directional resolution without bloating mode signaling tables, AV1 introduces directional angle deltas. For any nominal directional mode, the encoder can signal an angular offset ranging from -3 to +3 in increments of approximately 3 degrees.
With 8 nominal directional modes and 7 possible offset settings (0, ±1, ±2, ±3), AVIF can express up to 56 directional angles.
Key Differences and Comparison
1. Angular Granularity and Mode Count
- HEIC: Offers 33 fixed directional angles. The angular steps between modes are static.
- AVIF: Offers up to 56 directional angles. The step size between offsets is approximately 3 degrees, allowing for nearly 70% more directional choices than HEIC.
2. Signaling and Bitstream Efficiency
- HEIC: Signals angular direction as a single mode index chosen from the 33 options, relying on neighbor correlation (via 3 MPMs) to reduce bit consumption.
- AVIF: Employs a two-stage signaling model. The encoder signals the primary nominal mode first. If a nominal directional mode is chosen, a secondary syntax element signals the angle delta if an offset is present. If the edge strictly aligns with a nominal angle, no delta overhead is sent.
3. Edge Alignment and Prediction Accuracy
- HEIC: If an image edge falls between two of the 33 fixed angles, the predictor must approximate using the nearest available mode. This can leave higher residual energy that requires extra transform coefficients to correct.
- AVIF: The finer 3-degree angular increments provide tighter alignment with natural image contours, thin lines, and sharp textural transitions. By matching subtle angles more closely, AVIF produces lower residual energy after prediction.
4. Supporting Non-Directional Alternatives
Both codecs supplement directional prediction with non-directional tools. HEIC relies heavily on its Planar mode to model gradual tone changes. AVIF supplements its 56 directional angles with an expanded set of non-directional modes, including Paeth predictor and three variations of Smooth prediction (Smooth, Smooth Horizontal, and Smooth Vertical). This ensures that directional modes in AVIF are reserved strictly for true edges, while non-directional modes efficiently model soft contours.
AVIF provides significantly finer angular resolution than HEIC (56 angles versus 33 angles), using a flexible base-plus-delta signaling scheme that reduces prediction residuals along complex, arbitrary edges.