forge
Explore
Log in

Don't you dare go Hollow

Refuse a stream whose bit depth is not 8

Browse files at this commit

cee9a3d92a15304f14fb3d9089c9ff54c3d79c79Ahmet Kaan GümüşParent: e7ae36e
  • fix
    • refuse a stream whose bit depth is not 8
Show full message
fix(av1): refuse a stream whose bit depth is not 8

Both AV1 files in this box's own library -- a 2160p HDR10 encode and a 1080p
one -- are yuv420p10le. Probed through examples/decode_probe, both got past
every header refusal this decoder has and stopped at delta_q/delta_lf, which
is a header-level refusal: it says the headers parse, nothing about blocks.

What it was hiding: Picture's y/u/v are Vec<u8>, and nothing in decode.rs reads
bit_depth at all. Once delta_q lands -- which is in flight -- those two files
would have been reconstructed into 8-bit planes and compared against a 10-bit
reference. Not a desync; no symbol goes unread. Just quietly truncated pixels,
which is the failure mode this decoder is built not to have.

Refused by name until the planes are widened. Both films now say so.

Suite 243 passed / 0 failed.
crates/ec-av1/src/refusal_inventory.rsmodified+1 -0
@@ -39,6 +39,7 @@ const REFUSALS: &[&str] = &[
39 "a 16x16 inter block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet",39 "a 16x16 inter block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet",
40 "a 32x32 partition type this decoder does not code (value={part32})",40 "a 32x32 partition type this decoder does not code (value={part32})",
41 "a Golomb tail longer than this decoder reads",41 "a Golomb tail longer than this decoder reads",
42+ "a stream whose bit depth is not 8 (this decoder reconstructs into 8-bit planes)",
42 "a tx_type symbol outside its CDF's own set: {t}",43 "a tx_type symbol outside its CDF's own set: {t}",
43 "an INTER 32x32 partition type this decoder does not code (value={part32})",44 "an INTER 32x32 partition type this decoder does not code (value={part32})",
44 "a superblock-level partition type other than NONE or SPLIT (this decoder's intra tile path codes only those two at 64x64)",45 "a superblock-level partition type other than NONE or SPLIT (this decoder's intra tile path codes only those two at 64x64)",
crates/ec-av1/src/stream.rsmodified+19 -0
@@ -165,6 +165,25 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
165 // intrabc call at all -- that symbol is intra-frame-only). A165 // intrabc call at all -- that symbol is intra-frame-only). A
166 // genuine palette/intrabc use still refuses by name deeper in the166 // genuine palette/intrabc use still refuses by name deeper in the
167 // block readers, so no whole-frame refusal is needed here anymore.167 // block readers, so no whole-frame refusal is needed here anymore.
168+ // Both AV1 files in this box's own library (a 2160p HDR10 encode and a
169+ // 1080p one, probed 2026-08-30 through `examples/decode_probe`) are
170+ // `yuv420p10le`, and every buffer this decoder reconstructs into --
171+ // `Picture`'s `y`/`u`/`v` -- is `Vec<u8>`. A 10- or 12-bit stream would
172+ // therefore be reconstructed into 8-bit samples and compared against a
173+ // 10-bit reference, which is silent wrongness rather than a desync: no
174+ // symbol goes unread, the pixels are just quietly truncated. Refuse it
175+ // by name until the planes are widened. `bit_depth` defaults to 8 when
176+ // no sequence header has been seen, which is the existing behaviour for
177+ // every fixture in this crate.
178+ if parser
179+ .sequence_header()
180+ .is_some_and(|seq| seq.color_config.bit_depth != 8)
181+ {
182+ return Err(Error::unsupported(
183+ "AV1 decode_stream",
184+ "a stream whose bit depth is not 8 (this decoder reconstructs into 8-bit planes)",
185+ ));
186+ }
168 if header.delta.q_present || header.delta.lf_present {187 if header.delta.q_present || header.delta.lf_present {
169 return Err(Error::unsupported(188 return Err(Error::unsupported(
170 "AV1 decode_stream",189 "AV1 decode_stream",