forge
Explore
Log in

Don't you dare go Hollow

docs+test(av1): drop the stale context_update_tile_id refusal claim, hard-assert it live

Browse files at this commit

99f3d6355338318beb88d0db99f8b84b7c5bbcd3Ahmet Kaan GümüşParent: 2451a89
stream.rs's multi-tile comment claimed a context_update_tile_id != 0
refusal existed "further down" -- it did not; decode.rs has read
tile_info.context_update_tile_id generically (never hardcoded to 0) at
both tile-loop sites all along. Confirmed live via a probe on the
four-tile-row gate: aomenc's own RD-driven tile-size heuristic picks
1/2/3 as often as 0 across the 20-seed sweep, all pixel-exact. Fixed
the stale comment and added a hard assert
(saw_nonzero_context_update_tile_id) to
a_real_aomenc_stream_with_four_tile_rows_decodes_pixel_exact so this
proof can't silently stop firing.
crates/ec-av1/src/stream.rsmodified+31 -6
@@ -301,11 +301,16 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
301301 // of `skip_mode_frame`, plain average blend), so the old blanket
302302 // `skip_mode_present` refusal is gone.
303303 // `context_update_tile_id` (spec `decode_tile`/`exit_symbol`) names
304- // which tile's end-of-tile adapted CDFs become the frame's own; this
305- // decoder still only ever *keeps* tile 0's adapted table (see the
306- // `context_update_tile_id != 0` refusal further down), so any frame
307- // naming a different tile there is refused rather than silently
308- // forwarding the wrong tile's table.
304+ // which tile's end-of-tile adapted CDFs become the frame's own.
305+ // lane-tiles r8: this comment used to claim a `!= 0` refusal existed
306+ // "further down" -- it did not (`decode.rs` reads
307+ // `tile_info.context_update_tile_id` generically at both the
308+ // key-frame and inter-frame tile loops' `result_cdfs = cdfs` sites,
309+ // never hardcoded to tile 0); stale documentation, not a real gap.
310+ // `a_real_aomenc_stream_with_four_tile_rows_decodes_pixel_exact`
311+ // hard-asserts a live aomenc stream naming tile 1/2/3 decodes
312+ // pixel-exact, so the capability is now proven as well as described
313+ // correctly.
309314 //
310315 // lane-tiles r4/r6/r7/r8: the multi-tile refusal itself is scoped,
311316 // not blanket. `decode_key_frame_tile_with_cdfs` and (r6)
@@ -6743,7 +6748,16 @@ mod tests {
67436748 /// mirroring why the column gate needed 4 columns rather than 3). 64x256
67446749 /// is four 64x64 superblocks tall with `--sb-size=64`, one per tile row.
67456750 /// Loop filter ON, run through `decode_stream` itself since the
6746- /// `rows > 1` refusal is already lifted by this commit.
6751+ /// `rows > 1` refusal is already lifted by this commit. Also settles a
6752+ /// stale documentation claim found while writing this gate: the old
6753+ /// comment above `decode_stream`'s multi-tile block said
6754+ /// `context_update_tile_id != 0` was refused "further down" -- no such
6755+ /// refusal exists (`decode.rs` reads `tile_info.context_update_tile_id`
6756+ /// generically, never hardcoded to tile 0), and this fixture's own
6757+ /// aomenc runs pick 1/2/3 as often as 0 (RD-driven tile-size heuristic),
6758+ /// all 20/20 pixel-exact -- so the capability was already there,
6759+ /// undocumented and unproven; hard-asserted here so the proof can't go
6760+ /// unnoticed if it stops firing.
67476761 #[test]
67486762 fn a_real_aomenc_stream_with_four_tile_rows_decodes_pixel_exact() {
67496763 const NAME: &str = "a_real_aomenc_stream_with_four_tile_rows_decodes_pixel_exact";
@@ -6758,6 +6772,7 @@ mod tests {
67586772 let (width, height) = (64usize, 256usize);
67596773 let mut matched = 0u32;
67606774 let mut named_refusals = 0u32;
6775+ let mut saw_nonzero_context_update_tile_id = false;
67616776 for attempt in 0..20u32 {
67626777 let seed = 42 + attempt;
67636778 let source = gradients_source(seed, width, height, "duration=0.04:rate=25");
@@ -6838,6 +6853,9 @@ mod tests {
68386853 pos += obu.total_size;
68396854 if let ObuKind::Frame(header, _) = &obu.kind {
68406855 rows_seen = header.tile_info.rows;
6856+ if header.tile_info.context_update_tile_id != 0 {
6857+ saw_nonzero_context_update_tile_id = true;
6858+ }
68416859 }
68426860 }
68436861 assert!(
@@ -6878,6 +6896,13 @@ mod tests {
68786896 "{NAME}: every attempt refused ({named_refusals} refusals); the gate never decoded \
68796897 a four-tile-row stream"
68806898 );
6899+ assert!(
6900+ saw_nonzero_context_update_tile_id,
6901+ "{NAME}: every attempt named context_update_tile_id=0 -- this sweep proves nothing \
6902+ about the != 0 case (see the stale-refusal note above `decode_stream`'s multi-tile \
6903+ comment: aomenc's own tile-size heuristic picks it, seen 1/2/3 live in a prior probe \
6904+ run of this exact fixture, so a 20-attempt window not seeing it is the gate's own bug)"
6905+ );
68816906 eprintln!(
68826907 "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals out of 20"
68836908 );