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>> {
301 // of `skip_mode_frame`, plain average blend), so the old blanket301 // of `skip_mode_frame`, plain average blend), so the old blanket
302 // `skip_mode_present` refusal is gone.302 // `skip_mode_present` refusal is gone.
303 // `context_update_tile_id` (spec `decode_tile`/`exit_symbol`) names303 // `context_update_tile_id` (spec `decode_tile`/`exit_symbol`) names
304- // which tile's end-of-tile adapted CDFs become the frame's own; this304+ // which tile's end-of-tile adapted CDFs become the frame's own.
305- // decoder still only ever *keeps* tile 0's adapted table (see the305+ // lane-tiles r8: this comment used to claim a `!= 0` refusal existed
306- // `context_update_tile_id != 0` refusal further down), so any frame306+ // "further down" -- it did not (`decode.rs` reads
307- // naming a different tile there is refused rather than silently307+ // `tile_info.context_update_tile_id` generically at both the
308- // forwarding the wrong tile's table.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.
309 //314 //
310 // lane-tiles r4/r6/r7/r8: the multi-tile refusal itself is scoped,315 // lane-tiles r4/r6/r7/r8: the multi-tile refusal itself is scoped,
311 // not blanket. `decode_key_frame_tile_with_cdfs` and (r6)316 // not blanket. `decode_key_frame_tile_with_cdfs` and (r6)
@@ -6743,7 +6748,16 @@ mod tests {
6743 /// mirroring why the column gate needed 4 columns rather than 3). 64x2566748 /// mirroring why the column gate needed 4 columns rather than 3). 64x256
6744 /// is four 64x64 superblocks tall with `--sb-size=64`, one per tile row.6749 /// is four 64x64 superblocks tall with `--sb-size=64`, one per tile row.
6745 /// Loop filter ON, run through `decode_stream` itself since the6750 /// 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.
6747 #[test]6761 #[test]
6748 fn a_real_aomenc_stream_with_four_tile_rows_decodes_pixel_exact() {6762 fn a_real_aomenc_stream_with_four_tile_rows_decodes_pixel_exact() {
6749 const NAME: &str = "a_real_aomenc_stream_with_four_tile_rows_decodes_pixel_exact";6763 const NAME: &str = "a_real_aomenc_stream_with_four_tile_rows_decodes_pixel_exact";
@@ -6758,6 +6772,7 @@ mod tests {
6758 let (width, height) = (64usize, 256usize);6772 let (width, height) = (64usize, 256usize);
6759 let mut matched = 0u32;6773 let mut matched = 0u32;
6760 let mut named_refusals = 0u32;6774 let mut named_refusals = 0u32;
6775+ let mut saw_nonzero_context_update_tile_id = false;
6761 for attempt in 0..20u32 {6776 for attempt in 0..20u32 {
6762 let seed = 42 + attempt;6777 let seed = 42 + attempt;
6763 let source = gradients_source(seed, width, height, "duration=0.04:rate=25");6778 let source = gradients_source(seed, width, height, "duration=0.04:rate=25");
@@ -6838,6 +6853,9 @@ mod tests {
6838 pos += obu.total_size;6853 pos += obu.total_size;
6839 if let ObuKind::Frame(header, _) = &obu.kind {6854 if let ObuKind::Frame(header, _) = &obu.kind {
6840 rows_seen = header.tile_info.rows;6855 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+ }
6841 }6859 }
6842 }6860 }
6843 assert!(6861 assert!(
@@ -6878,6 +6896,13 @@ mod tests {
6878 "{NAME}: every attempt refused ({named_refusals} refusals); the gate never decoded \6896 "{NAME}: every attempt refused ({named_refusals} refusals); the gate never decoded \
6879 a four-tile-row stream"6897 a four-tile-row stream"
6880 );6898 );
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+ );
6881 eprintln!(6906 eprintln!(
6882 "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals out of 20"6907 "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals out of 20"
6883 );6908 );