Expand description
HDR → SDR tonemap.
Pipeline: 10-bit BT.2020 PQ/HLG Y’CbCr → linear scene-referred RGB → BT.709 gamut → Hable filmic curve → BT.709 gamma → 8-bit BT.709 limited-range Y’CbCr.
Single-output policy: every HDR upload gets tonemapped to SDR at transcode time and the encoded ABR ladder is 8-bit BT.709. Every viewer sees a correctly-mapped image regardless of display capability. HDR-fidelity-for-HDR-viewers is a future dual-rendition path that will reuse the same primitives for the SDR rungs.
Reference standards:
- ITU-R BT.2020 (matrix + primaries)
- SMPTE ST.2084 (PQ EOTF)
- ARIB STD-B67 (HLG EOTF)
- ITU-R BT.709 (output matrix + transfer)
- “Filmic Tonemapping for Real-time Rendering” — John Hable, 2010
Implementation is pure-Rust scalar f32. AVX2 vectorisation is a follow-up — the kernel is hot (per-pixel two matrix multiplies + one transcendental on each channel + the filmic curve), but it’s single-threaded with a per-frame fan-out, so the per-thread budget lands well inside a 1080p60 real-time window even scalar.
Functions§
- tonemap_
yuv420p10le_ bt2020_ to_ yuv420p_ bt709 - HDR → SDR tonemap.