AVIF Gain Maps: Adaptive SDR and HDR Display

AVIF supports adaptive display across Standard Dynamic Range (SDR) and High Dynamic Range (HDR) monitors by utilizing gain maps—secondary image channels paired with specific metadata that instruct a display engine how to scale luminance. This technology enables a single AVIF file to serve a baseline SDR image to standard screens while dynamically reconstructing an HDR image tailored to the precise brightness capabilities of an HDR display. By adopting standard gain map specifications, AVIF bridges the gap between hardware generations without requiring duplicate assets or sacrificing backward compatibility.

The Architecture of an AVIF Gain Map

AVIF (AV1 Image File Format) is built upon the ISO Base Media File Format (ISOBMFF). This container structure allows an AVIF file to store multiple image items, auxiliary items, and metadata tracks within a single payload.

When an AVIF file includes a gain map, it typically stores:

How Adaptive Rendering Works

When an image viewer or web browser opens an AVIF file with a gain map, the display engine executes a multi-step calculation:

  1. Hardware Interrogation: The application queries the operating system to determine the peak luminance and dynamic range capabilities of the connected monitor.
  2. Weight Calculation: The engine compares the monitor’s peak brightness with the target brightness specified in the gain map metadata. It computes an interpolation factor (a weight between 0.0 and 1.0).
  3. Map Scaling: The gain map values are decoded, scaled by the calculated weight, and upscaled to match the resolution of the base image if necessary.
  4. Pixel Synthesis: The base image pixels are multiplied by the adjusted gain map values to produce final pixel luminance values that match the display's exact peak capability.

If the monitor is purely SDR, the engine ignores the auxiliary gain map entirely and renders the base image, avoiding any performance penalty or visual degradation. If the display is capable of 1,000 nits, the engine applies the gain map to boost highlights up to 1,000 nits. If the display only supports 600 nits, the gain map scales proportionally, preventing clipped highlights or washed-out midtones.

Benefits Over Traditional HDR Formats

Direct HDR images encoded using transfer functions like PQ (Perceptual Quantizer) or HLG (Hybrid Log-Gamma) look incorrect or dull when shown on an SDR screen without dynamic tone mapping. Conversely, hard-clipping an HDR image down to SDR ruins highlights.

AVIF gain maps solve this by: