zenpixels 0.5 · primaries, hdr & metadata signaling

Primaries, HDR headroom, CLL & CICP vs ICC

Bytes only become a real color once you know which primaries they mix, how bright 1.0 is, whether values use full or narrow range, and whether CICP or ICC is the active authority. Explore each layer visually and copy exact 0.5 Rust code below.

01

Color primaries & out-of-gamut renderings

Click anywhere inside the CIE spectral horseshoe (or pick a test color) to compare how BT.709 / sRGB, Display P3, Adobe RGB, and BT.2020 encode the exact same physical chromaticity — and what happens when wide-gamut colors clip vs soft-compress.

CIE 1931 xy Chromaticity Diagram

■ BT.709 / sRGB (35.9% CIE) ■ Display P3 (+25% wider) ■ Adobe RGB (wide cyan-green) ■ BT.2020 (75.8% spectral)

Same physical color rendered across gamuts & policies

Wide-gamut swatches use CSS color(display-p3 ...) / color(rec2020 ...) so P3 displays show true saturation. Notice negative linear RGB channels whenever a color falls outside a smaller triangle.

02

All the HDR things: DiffuseWhite, CLL, ST.2086, HLG & BT.2446A

HDR pipelines break when people confuse five different luminance numbers. Drag the sliders to see where each value sits on the log-luminance ruler and how BT.2446A rolls HDR highlights smoothly into SDR.

Absolute Luminance Ruler (0.01 → 10,000 cd/m², log scale)

BT.2446A HDR → SDR roll-off vs naive hard clip

x = HDR nits, y = SDR signal

DiffuseWhite (white anchor)

Assigns a luminance to relative-linear 1.0. At the ITU BT.2408 anchor of 203 nits, neutral linear 2.0 represents 406 nits. Supply an anchor with with_diffuse_white(...) on ConvertPolicy or .with_diffuse_white(...) on ColorSpace.

PixelBuf::new_signal_white writes nominal signal white for RGB and gray. The PQ endpoint represents 10,000 nits. The display-rendered HLG endpoint represents HlgRendering::peak(). White fill and luminance

ContentLightLevel (MaxCLL & MaxFALL)

MaxCLL = brightest single pixel in the image/stream; MaxFALL = brightest frame-average luminance. Often missing or inflated in real files — ImagePlan can measure pixels with PeakSource::Measured, while streaming RowPlan takes an explicit Option<Nits>.

MasteringDisplay (SMPTE ST 2086 / mDCV)

Describes the grading monitor (primaries, white point, min/max nits like 0.0001–4000 nits) — not the content's actual peak. A 1000-nit movie graded on a 4000-nit Sony BVM still has MaxCLL = 1000.

HlgRendering (BT.2100-3 display OOTF)

HLG is display-adaptive and channel-coupled (Ysγ−1·RGBs), so browsers and monitors render it differently by screen peak Lw, black Lb, and gamma γ. Pass explicit HlgRendering (e.g. REFERENCE_1000_NIT, where 75% signal = 203 nits); display peak is not reused as content peak, and HLG ICC synthesis is refused. Explore HLG display presets & coupled OOTF →

03

Signaling: Narrow vs Full range, and CICP vs ICC

Color signaling travels in container chunks before a single pixel is touched. Getting range or CICP vs ICC precedence wrong silently lifts blacks or double-applies profiles.

Signal range: Full vs Narrow (TV / studio swing)

Narrow range reserves headroom and footroom for broadcast SDI/HDMI. Under default ConvertPolicy::lossless(), zenpixels-convert refuses silent Narrow↔Full conversions with ConvertError::RangeConversionForbidden instead of relabeling unscaled bytes (which would turn black 16 into dark gray!).

Full range (U8: 0..=255, U16: 0..=65535)
0 (black) —————————— 255 (white)
Narrow range (U8: 16..=235, U16: 4096..=60160)
0–15
16 (black) ————— 235 (white)
236+

Interactive CICP 4-byte tuple inspector (ITU-T H.273)

CICP vs ICC profiles — when to use each

DimensionCICP (ITU-T H.273)ICC Profile
Payload size4 bytes (CP, TC, MC, full)400 B – 2 MB (matrix/TRC or 3D CLUT)
What it expressesStandardized RGB/YCbCr (sRGB, P3, BT.2020, PQ, HLG)Arbitrary device spaces (CMYK, printers, custom LUTs, monitors)
Converter pathBuilt-in SIMD matrices (no CMS needed)Requires explicit ColorServices::with_cms_binding(MoxCms::binding()) or Lcms::binding() (or qualified matrix+TRC ICC substitution)
Container precedencePNG 3rd ed: cICP > iCCP > sRGB > gAMA+cHRM; AVIF: nclx vs profJPEG/TIFF: ICC primary; active ColorSpace::Icc stays authoritative (unusable ICC refuses rather than falling back)
SynthesisAlways emit CICP where container supports iticc_profiles::synthesize_icc_for_cicp exports qualified RGB ICC (HLG ICC synthesis refused)

ColorSpace vs ColorOrigin: ColorSpace on PixelFormat is the active authority describing the current pixels in memory. ColorOrigin remembers what the original file claimed (even dual CICP + ICC chunks) for transcoding provenance — and never overrides converted pixels.

04

Live Rust code: primaries, HDR & atomic CICP/ICC output