Verifying 10-Bit and 12-Bit AVIF Sample Scaling into Standard 8-Bit PNGs
Reading pixi and av1C High-Bitdepth Flags Without Truncation Bias
Modern camera pipelines and gradient-heavy UI artwork frequently encode AVIF stills at 10-bit (0..1023) or 12-bit (0..4095) precision to suppress sky and shadow banding in AV1 Main or Professional profiles. When down-converting high-bit-depth buffers to standard 8-bit RGBA PNG, naive bit-shift truncation (sample >> 2) systematically biases bright highlights downward—mapping full-white 1023 to 255 only at the peak while shifting midtones by up to one full 8-bit step.
Our Bit Depth Inspector parses both the ISOBMFF pixi channel-depth array and the av1C decoder configuration record, then executes a dual-pass libavif WASM decode: one 16-bit pass to recover exact source code words and one 8-bit pass to verify unbiased round(sample * 255 / ((1 << depth) - 1)) scaling across horizontal test columns.
- Cross-checks ISOBMFF pixi channel declarations against av1C high_bitdepth and twelve_bit flags.
- Displays column-by-column native code words alongside quantized 8-bit output levels and absolute residuals.
- Confirms endpoint preservation (0 -> 0 and 1023 -> 255) on full-range identity ramps.