Supported libavif Transfer Characteristics for HDR
This article outlines the specific color transfer characteristics supported by the libavif library for encoding and decoding High Dynamic Range (HDR) images. It details how libavif utilizes Coding Independent Code Points (CICP) defined in the ISO/IEC 23091-2 and ITU-T H.273 standards to handle HDR formats like HDR10 and HLG, ensuring accurate brightness and color rendering across compatible displays.
CICP and HDR in libavif
The AVIF image format relies on the AV1 video codec bitstream, which uses Coding Independent Code Points (CICP) to specify color properties. These properties include color primaries, matrix coefficients, and transfer characteristics.
For HDR content, the transfer characteristics (often referred to as the transfer function or gamma curve) define how digital pixel values are mapped to physical light intensity.
Primary Supported HDR Transfer Characteristics
The libavif library supports the following key HDR
transfer characteristics:
1. SMPTE ST 2084 (PQ / Perceptual Quantizer)
- CICP Value: 16 (AVIF_TRANSFER_CHARACTERISTICS_SMPTE2084)
- Description: Developed by the Society of Motion Picture and Television Engineers, the Perceptual Quantizer is the foundation for HDR10, HDR10+, and Dolby Vision. It is designed to match the human visual system, supporting a luminance range of up to 10,000 cd/m² (nits). This is the most common transfer characteristic used for high-end HDR consumer content.
2. ARIB STD-B67 (HLG / Hybrid Log-Gamma)
- CICP Value: 18 (AVIF_TRANSFER_CHARACTERISTICS_HLG)
- Description: Developed by the BBC and NHK, HLG is a royalty-free HDR standard designed primarily for live broadcasting. It combines a standard gamma curve in its lower luminance range with a logarithmic curve in its upper range. This allows the same signal to be decoded by both Standard Dynamic Range (SDR) and HDR displays, offering excellent backward compatibility.
3. Linear
- CICP Value: 8 (AVIF_TRANSFER_CHARACTERISTICS_LINEAR)
- Description: This characteristic represents a 1.0 gamma curve, where light output is directly proportional to the digital signal. While not a consumer HDR format like PQ or HLG, linear transfer characteristics are frequently used in professional CGI, VFX, and HDR image-editing pipelines to preserve raw sensor or render data before final tone mapping.
Auxiliary Transfer Characteristics
While the following are technically supported by libavif, they are less common for dedicated HDR presentation:
- BT.2020-10 (10-bit) / BT.2020-12 (12-bit): (CICP Values 14 and 15) These curves are mathematically identical to the BT.709 transfer function but are scaled for 10-bit and 12-bit precision workflows, often acting as a bridge in high-bit-depth color spaces.
Implementation in libavif
When encoding an AVIF image, you specify these characteristics in the
avifImage structure using the
transferCharacteristics field. For example, setting this
field to 16 flags the image as PQ HDR. Compatible web
browsers and image viewers read this metadata to trigger the display’s
HDR pipeline, ensuring the image is rendered with the intended contrast
and highlight retention.