AVIF Directional Intra-Prediction for Structural Lines

AVIF utilizes the advanced intra-frame coding toolset of the AV1 video codec to preserve sharp edges and compress structural lines with minimal data overhead. Through directional intra-prediction, the format analyzes surrounding reconstructed pixels and extrapolates their values across a target block along precisely calculated angles. By approximating lines, contours, and gradients using mathematical projections rather than raw pixel data, AVIF eliminates spatial redundancy and maintains crisp geometric detail even at aggressive compression levels.

The Mechanism of Directional Prediction

When an image is compressed using AVIF, it is recursively partitioned into smaller blocks, ranging from 4x4 up to 128x128 pixels. For any given block being encoded in intra mode (spatial prediction within a single frame), the encoder looks at the reconstructed boundary pixels immediately adjacent to the block’s top and left edges.

To reconstruct structural lines—such as architectural edges, object boundaries, or sharp graphical shapes—the encoder selects a directional prediction mode that best aligns with the orientation of the line passing through that block.

Angular Precision and Fine-Tuning

Earlier image and video standards, such as JPEG and older iterations of H.264, provided a very limited set of directional modes (typically 8 basic directions). This often resulted in "staircase" artifacts or blurry transitions when a diagonal line did not match the available prediction vectors exactly.

AVIF dramatically improves angular precision by implementing:

This high degree of angular granularity allows the prediction vector to align almost perfectly with the true angle of structural lines in an image.

Sub-Pixel Interpolation

Because arbitrary diagonal lines rarely pass directly through the discrete grid points of boundary pixels, AVIF employs sub-pixel interpolation. When projecting a directional line across a block:

  1. The prediction path intersects the reference boundary at non-integer coordinates.
  2. AVIF calculates the reference values using 2-tap bilinear interpolation or multi-tap directional filters.
  3. These interpolated values are then cast along the chosen angle across the entire interior of the block, synthesizing a continuous, coherent edge.

Boundary Filtering and Edge Preservation

To prevent hard seams between adjacent blocks, AVIF can apply an intra-boundary smoothing filter to reference pixels before directional projection begins. However, when the encoder detects a strong, sharp structural edge, this filter can be selectively disabled or tuned. This conditional filtering ensures that natural photographic textures blend smoothly without dulling or smearing high-contrast edges.

Residual Coding

Once the directional intra-prediction is generated, the predicted block is subtracted from the original block to produce a residual signal. Because the directional intra-prediction vector accurately models the angle and path of structural lines, the resulting residual contains very little high-frequency energy.

This residual is then transformed using discrete cosine transforms (DCT) or asymmetric discrete sine transforms (ADST) and quantized. Because the directional model has already absorbed most of the structural line information, the quantized residual requires very few bits to store, completing an efficient compression cycle while preserving edge fidelity.