Why Browsers Decode AVIF With Pixel Variations

When rendering AVIF (AV1 Image File Format) images, different web browsers frequently output minute pixel variations. This article explores the technical reasons behind these discrepancies, which stem primarily from the use of diverse AV1 decoding libraries, variations in color management systems, chroma upsampling algorithms, hardware acceleration differences, and floating-point rounding during YUV-to-RGB conversions.

Diverse Underlying Decoder Implementations

Browsers rely on different underlying software libraries and hardware decoders to process AV1 bitstreams:

Chroma Upsampling Differences

Most AVIF images are compressed using 4:2:0 chroma subsampling to minimize file size, meaning color information is stored at half the horizontal and vertical resolution of the brightness (luma) data.

To render the image, browsers must reconstruct the missing color data through chroma upsampling. The exact placement and interpolation of these chroma samples depend on the browser engine's graphics pipeline:

YUV to RGB Matrix Conversions

AVIF files store data in the YCbCr (YUV) color model, but computer displays require RGB values. Converting YUV to RGB requires matrix multiplication:

\[\begin{bmatrix} R \\ G \\ B \end{bmatrix} = M \times \begin{bmatrix} Y \\ Cb \\ Cr \end{bmatrix}\]

Differences in pixel values arise from how each engine executes this formula:

Color Management Systems and Profiles

Color reproduction is heavily dictated by the operating system and the browser's integrated Color Management System (CMS):

Bit-Depth Truncation and Dithering

AVIF supports 8-bit, 10-bit, and 12-bit color depths. When a 10-bit AVIF is rendered on a standard 8-bit display:

These divergent approaches directly alter individual pixel values in the final rendered output, resulting in the minute variations observed during cross-browser comparisons.