From 206379a40d70e40a0ed30acaa5f2117250e7f679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 28 Aug 2026 17:50:55 +0300 Subject: [PATCH] wip(av1): TELL-checkpoint ladder falsifies the r7 interintra suspect; real divergence is at the VERY FIRST partition symbol of frame 1's own tile, before any mode-info read. Round 8, capped at budget. Method (per symbol-consumption-gap class rule): added TELL checkpoints (decode.rs, gated EC_AV1_TELL) at block_entry (decode_inter_block, right before skip_mode), post_is_inter, post_ref_frame, post_assign_mv, mirrored in /tmp/libaom-src/av1/decoder/decodemv.c (post_ref_frame, post_assign_mv) -- av1/decoder/decodeframe.c already had an unconditional EC_PART/EC_PART_VAL partition-read trace, reused as-is. Result for the pin block (mi(0,0), decode-order frame 1, bsize=32): aomdec: EC_PART tell=1 (128-level, implicit split, 0 bits) -> EC_PART bsize=12(64x64) ctx=12 tell=1, EC_PART_VAL value=3(SPLIT) -> EC_PART bsize=9(32x32) ctx=8 tell=4, EC_PART_VAL value=0(NONE) -> mode info starts at tell=4, post_is_inter tell=5, post_ref_frame tell=7, post_assign_mv tell=15. ours: block_entry (i.e. after our own 64->32 partition read, same 2 symbols: partition_w64 SPLIT then partition_w32 NONE, decode.rs:6984/7007) tell=19 already -- post_is_inter tell=19, post_ref_frame tell=21, post_assign_mv tell=29. The frame is confirmed exactly 64x64 (EC_PART only ever visits mi(0,0)/(0,8)/(8,0)/(8,8), one real 64x64 SB), so the 128-level implicit split costing 0 bits on both sides is correct and NOT the gap (the sb128 r1/r2 "not causal for 64x64x4" proof still holds for this file). Both decoders read the SAME TWO real partition symbols with the SAME decoded values (SPLIT then NONE) and reach the SAME leaf shape (side=32) -- but ours costs ~15 more bits for those same two symbol VALUES than aomdec does. A same-value, wildly different bit cost across the very first two symbols read in the tile is the signature of a CDF-CONTENT bug, not a missing/extra symbol read: either partition_w64[sb_ctx] or partition_w32[ctx32]'s actual probability table entering this frame's tile is badly skewed relative to aomdec's -- most likely explained by this frame's own CDF *forwarding* from frame 0 (the preceding key frame) carrying a wrong/stale partition CDF into frame 1, since a freshly-initialized default CDF would decode the same value at essentially the same cost aomdec's does. This FALSIFIES the round 8 charter's primed suspect (the interintra read at decode.rs:5391-5411): mv/ref/interintra/motion_mode/interp_filter are all downstream of an interval that has already desynced by the time `decode_inter_block` is even entered -- there is no still-unverified syntax element to isolate there. `enable_interintra_compound`'s own gate logic (BLOCK_8X8..=BLOCK_32X32, single-ref, SINGLE_INTER_MODE range) was cross-checked against libaom's is_interintra_allowed/_bsize/_mode/_ref and matches exactly -- CLOSE this suspect. NEW PRIME SUSPECT for round 9: this frame's own partition_w64/partition_w32 CDF forwarding from the preceding key frame (Cdfs::forward or whatever this crate's primary_ref_frame path calls) -- read cdf_state.rs's forwarding code, diff the two partition CDF tables' actual byte values entering frame 1's tile against libaom's own `cm->fc` right after `av1_setup_frame_size`/`load_previous_frame_stats`/whatever gates the CDF copy (decodeframe.c `read_uncompressed_header`'s primary_ref_frame branch), NOT any single-block syntax read. TELL checkpoints left in place under EC_AV1_TELL (decode.rs: block_entry/post_is_inter/post_ref_frame/post_assign_mv) and libaom decodemv.c (post_ref_frame/post_assign_mv) for round 9 to extend up through the partition CDF dump itself. Repro: EC_AV1_TELL=1 EC_AV1_PIN= EC_AV1_PIN_N=24 cargo test -p ec-av1 --release --lib scratch_isolate_pinned_mismatch -- --ignored --nocapture --- crates/ec-av1/src/decode.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index c17c7e72..485ce8ec 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -4660,6 +4660,12 @@ fn decode_inter_block( let (cpx, cpy) = (px / 2, py / 2); let chroma_side = side / 2; + if std::env::var_os("EC_AV1_TELL").is_some() { + eprintln!( + "TELL mi_row={} mi_col={} label=block_entry side={side} tell={}", + r * SUB_MI as usize, c * SUB_MI as usize, dec.debug_bitpos() + ); + } let skip_mode_ctx = usize::from(neighbours.above_skip_mode[c]) + usize::from(neighbours.left_skip_mode[r]); // lane-comppin r3: skip_mode desync isolation -- dump ctx + the pre-read @@ -4689,6 +4695,12 @@ fn decode_inter_block( let (above_inter, left_inter) = (neighbours.above_inter[c], neighbours.left_inter[r]); let ii_ctx = intra_inter_ctx(has_above, has_left, above_inter, left_inter); let is_inter = skip_mode || dec.symbol(&mut cdfs.intra_inter[ii_ctx]) == 1; + if std::env::var_os("EC_AV1_TELL").is_some() { + eprintln!( + "TELL mi_row={} mi_col={} label=post_is_inter skip_mode={skip_mode} skip={skip} is_inter={is_inter} tell={}", + r * SUB_MI as usize, c * SUB_MI as usize, dec.debug_bitpos() + ); + } let mode_for_tx; let (luma_grid, u_grid, v_grid); @@ -5278,6 +5290,13 @@ fn decode_inter_block( neighbours.left_ref1[r], ); ref_frame_for_lf = ref_frame; + if std::env::var_os("EC_AV1_TELL").is_some() { + let (mi_row, mi_col) = (r * SUB_MI as usize, c * SUB_MI as usize); + eprintln!( + "TELL mi_row={mi_row} mi_col={mi_col} label=post_ref_frame ref={ref_frame} tell={}", + dec.debug_bitpos() + ); + } // round 4-9 (lane-av1golden..lane-av1golden7): GOLDEN_FRAME's own // stacked defects (lf_level ref/mode-delta forwarding, the // switchable_interp ref-frame ctx gate, and a film-grain synthesis @@ -5388,6 +5407,12 @@ fn decode_inter_block( }; (mv, false) }; + if std::env::var_os("EC_AV1_TELL").is_some() { + eprintln!( + "TELL mi_row={mi_row} mi_col={mi_col} label=post_assign_mv tell={}", + dec.debug_bitpos() + ); + } // lane-sb128 r4: `interintra` (spec 5.11.24; libaom // `decodemv.c` read_inter_block_mode_info ~1490-1510), placed // right after `assign_mv` and before `read_motion_mode` below --