Spatial Frequency Weighting in AVIF Quantization

Spatial frequency weighting in AVIF intra-frame quantization optimizes compression efficiency by tailoring quantization step sizes to the sensitivity of the Human Visual System (HVS). By applying non-uniform scaling across different transform coefficients, this technique discards visually imperceptible high-frequency data while preserving critical low-frequency structures. Consequently, AVIF can achieve significantly smaller file sizes at higher perceived visual fidelities, directly shaping the trade-off between texture retention, artifact suppression, and bitrate.

The Mechanics of Quantization Matrices in AVIF

AVIF relies on the AV1 video codec's intra-frame coding tools, where spatial pixel data is converted into frequency coefficients using various transforms, such as the Discrete Cosine Transform (DCT) and the Asymmetric Discrete Sine Transform (ADST). Under standard uniform quantization, every frequency coefficient in a transform block is divided by the same base quantizer step size.

When spatial frequency weighting is enabled, AVIF applies a Quantization Matrix (QM) to scale this base step size on a per-frequency basis. Low-frequency coefficients (representing overall luminance and broad color gradients) receive lower scale factors, resulting in fine quantization. Conversely, high-frequency coefficients (representing fine edges, subtle textures, and noise) receive higher scale factors, resulting in coarser quantization.

Alignment with the Human Visual System

The primary effect of this weighting is perceptual optimization based on the Contrast Sensitivity Function (CSF) of human vision. The human eye is exceptionally sensitive to errors in low spatial frequencies, such as variations in smooth gradients, where coarse quantization manifests as jarring color banding or blocking artifacts.

The human visual apparatus is far less sensitive to minor structural alterations in high spatial frequencies. By deliberately suppressing or zeroing out high-frequency coefficients through aggressive quantization, AVIF discards data that the viewer is unlikely to notice under standard viewing conditions.

Impact on Compression Efficiency and Entropy Coding

Coarser quantization of high-frequency components causes a substantial portion of these coefficients to round directly to zero. In AV1's transform coefficient coding, long runs of zeros are compressed with extreme efficiency via symbol-to-symbol entropy modeling.

By eliminating low-energy high frequencies:

Visual Quality Trade-offs

While spatial frequency weighting improves subjective quality metrics, it introduces distinct visual characteristics: