HDR AVIF Tone Mapping in Modern Web Browsers

Tone mapping in modern web browsers allows High Dynamic Range (HDR) AVIF images to display accurately across diverse screens by dynamically compressing their wide color gamuts and extreme luminance levels to fit a target display’s physical capabilities. When a browser loads an HDR AVIF, it parses embedded metadata, evaluates the user's display capabilities via the operating system, maps color primaries and luminance curves, and composites the final pixels alongside standard page elements. This article explains how browsers extract AVIF color profiles, perform luminance conversion, and handle hardware rendering to avoid clipping or washed-out images.

1. Metadata Extraction and Color Space Parsing

An HDR AVIF file wraps AV1 compressed bitstreams within an ISO Base Media File Format (ISOBMFF) container. Inside this structure, the browser's image decoder inspects color signaling—specifically Color Independent Code Points (CICP) or an embedded ICC profile.

CICP metadata defines four critical properties:

If present, the browser also checks for Content Light Level Information (clli), which specifies Maximum Content Light Level (MaxCLL) and Maximum Frame-Average Light Level (MaxFALL), providing boundaries for the tone mapper to calculate scaling.

2. Querying Display Capabilities

Before tone mapping can occur, the browser queries the host operating system’s graphics stack (such as DirectX on Windows, Metal/Quartz on macOS, or Wayland/X11 on Linux) to determine the hardware environment.

The browser checks:

3. Luminance Adaptation and Tone Curves

Once both the source metadata and destination capabilities are known, the browser executes tone mapping through its graphics pipeline (such as Chromium’s Skia engine or Gecko's WebRender).

Rendering on an SDR Display

When displayed on an SDR screen, the browser must compress a wide range of luminance (often 0–1,000+ nits) into standard dynamic range (typically 0–100 or 0–200 nits).

Rendering on an HDR Display

When rendered on an HDR monitor, full compression down to SDR levels is unnecessary. However, adaptation is often still required:

4. Compositing with SDR Web Content

Web browsers must render HDR images within an interface that consists primarily of standard dynamic range elements, such as standard CSS colors, text, and SDR graphics.

To achieve this:

5. Hardware Acceleration and Shader Execution

Tone mapping operations do not run on the CPU during continuous rendering. Decoded AV1 pixel buffers are uploaded as textures to the GPU. Tone curves, color matrix multiplications, and gamut clipping/compression are performed via fragment shaders in the browser's GPU rasterization pipeline. This ensures that scaling, panning, and rendering HDR AVIF assets maintain 60 to 120 frames per second without incurring latency or battery drain.