forge
Explore
Log in

Don't you dare go Hollow

lane-av1422warp: instrument -- EC_SYMR carries a phase, and a CORRECTED inter mi

Browse files at this commit

c39e6f5ba90abb7fe03f496998d5782e5d1a08e5Ahmet Kaan GümüşParent: 2be479d
No behaviour change: `set_symr_phase` and the extra `set_symr_mi` only feed
the env-gated print. Identity re-proved after the edit: 4:2:0 control
a420.obu byte-identical to aomdec --rawvideo, 4:4:4
444_sb128rect_lr_witness.obu byte-identical to the pre-lane build, both
pinned 422 witnesses pixel-exact.

Two changes, both prompted by round 26's failed coverage check.

1. PHASE on every read. The coefficient rungs stop well before the frame-3
divergence on BOTH sides, so the per-read stream is the only instrument that
reaches it, and a read with no phase is unattributable. `EC_SYMR` now prints
`ph=`: "inter" over the inter mode-info path, "inter8" over the sub-8x8 arm,
"" elsewhere.

2. THE INTER mi LABEL WAS WRONG, and fixing it changes the answer. Round 27
first published the mi from `decode_inter_block`'s entry `at`, which labels
a DIFFERENT block -- it reported mi(28,52) for reads this decoder makes for
mi(30,62). The `EC_MODE_VAL8` rung, printed by the function that actually
reads the mode, reports mi(30,62). The phase/mi are now also published from
`decode_inter_block8` at the block's own `leaf_mi`, which is what makes the
inter mi trustworthy -- round 22's misattribution was exactly this class of
error, and it is now closed at the source rather than worked around.

With the label correct, reads 107514-107516 pair at mi(30,62) on both sides
and the divergence is clean: the oracle reads two n=2 inter-mode symbols
(107517, 107518) that this decoder does not, and its n=8 at 107519 is
identical to our n=8 at 107517 -- a two-symbol shift, same block.
crates/ec-av1/src/decode.rsmodified+12 -0
@@ -33045,6 +33045,11 @@ fn decode_inter_block(
33045 // combinations that don't implement scaled MC yet.33045 // combinations that don't implement scaled MC yet.
33046 frame_width: usize, fctx: &crate::decode::FrameCtx,33046 frame_width: usize, fctx: &crate::decode::FrameCtx,
33047 ) -> Result<()> {33047 ) -> Result<()> {
33048+ // Round 27: the per-read trace is the only instrument that reaches the inter
33049+ // path (the coefficient rungs stop well before the frame-3 divergence),
33050+ // so publish the phase and the block's mi for every read it makes.
33051+ crate::msac::SymbolDecoder::set_symr_phase("inter");
33052+ crate::msac::SymbolDecoder::set_symr_mi(at.0 as i64, at.1 as i64);
33048 33053
33049 // lane-inter4 r1: `at` is in MI units (4 px) so a 32-level 1:4 strip can33054 // lane-inter4 r1: `at` is in MI units (4 px) so a 32-level 1:4 strip can
33050 // name an 8-px offset; `(r, c)` stays the enclosing 16-px cell for the33055 // name an 8-px offset; `(r, c)` stays the enclosing 16-px cell for the
@@ -40400,6 +40405,13 @@ fn decode_inter_block8(
40400 // (`use_superres`) -- mirrors [`decode_inter_block`]'s own param.40405 // (`use_superres`) -- mirrors [`decode_inter_block`]'s own param.
40401 frame_width: usize, fctx: &crate::decode::FrameCtx,40406 frame_width: usize, fctx: &crate::decode::FrameCtx,
40402 ) -> Result<(bool, bool, bool, Option<(i8, i8, u8, u8)>, [u8; 2], (i8, Option<i8>))> {40407 ) -> Result<(bool, bool, bool, Option<(i8, i8, u8, u8)>, [u8; 2], (i8, Option<i8>))> {
40408+ // Round 27: this is the function whose mode read carries the block's real
40409+ // mi (the `EC_MODE_VAL8` rung prints it). The `decode_inter_block`
40410+ // entry sets the same label from ITS `at`, which is a different block --
40411+ // publishing from here is what makes the EC_SYMR mi trustworthy on the
40412+ // inter path, which is what round 22 got wrong by assuming it was not.
40413+ crate::msac::SymbolDecoder::set_symr_phase("inter8");
40414+ crate::msac::SymbolDecoder::set_symr_mi(leaf_mi.0 as i64, leaf_mi.1 as i64);
40403 const LAST_FRAME: i8 = 1;40415 const LAST_FRAME: i8 = 1;
40404 // lane-gmaffine r2: the leaf's OWN switchable-filter symbols, handed back40416 // lane-gmaffine r2: the leaf's OWN switchable-filter symbols, handed back
40405 // so the caller stamps them into `Neighbours` instead of the `[3, 3]`40417 // so the caller stamps them into `Neighbours` instead of the `[3, 3]`
crates/ec-av1/src/msac.rsmodified+12 -1
@@ -329,6 +329,12 @@ thread_local! {
329 /// rounds 22 and 23. Set by the mode readers at entry; `(-1,-1)` outside.329 /// rounds 22 and 23. Set by the mode readers at entry; `(-1,-1)` outside.
330 pub(crate) static SYMR_MI: std::cell::Cell<(i64, i64)> =330 pub(crate) static SYMR_MI: std::cell::Cell<(i64, i64)> =
331 const { std::cell::Cell::new((-1, -1)) };331 const { std::cell::Cell::new((-1, -1)) };
332+ /// A short tag for the READER PHASE ("intra", "inter", "mv", ...), printed
333+ /// on every `EC_SYMR` line. The coefficient rungs stop well before some
334+ /// divergences, so the per-read stream is the only instrument that covers
335+ /// the inter path; without a phase its reads are unattributable.
336+ pub(crate) static SYMR_PHASE: std::cell::Cell<&'static str> =
337+ const { std::cell::Cell::new("") };
332 }338 }
333 339
334 impl<'a> SymbolDecoder<'a> {340 impl<'a> SymbolDecoder<'a> {
@@ -407,6 +413,10 @@ impl<'a> SymbolDecoder<'a> {
407 413
408 /// `decode_symbol` (spec 8.2.6), with the adaptation of 8.3.2.414 /// `decode_symbol` (spec 8.2.6), with the adaptation of 8.3.2.
409 ///415 ///
416+ pub(crate) fn set_symr_phase(p: &'static str) {
417+ SYMR_PHASE.with(|c| c.set(p));
418+ }
419+
410 pub(crate) fn set_symr_mi(mi_r: i64, mi_c: i64) {420 pub(crate) fn set_symr_mi(mi_r: i64, mi_c: i64) {
411 SYMR_MI.with(|c| c.set((mi_r, mi_c)));421 SYMR_MI.with(|c| c.set((mi_r, mi_c)));
412 }422 }
@@ -445,7 +455,8 @@ impl<'a> SymbolDecoder<'a> {
445 }455 }
446 if symr {456 if symr {
447 eprintln!(457 eprintln!(
448- "EC_SYMR mi=({},{}) pre=({},{},{}) cdf0={} n={} s={} post_rng={}",458+ "EC_SYMR ph={} mi=({},{}) pre=({},{},{}) cdf0={} n={} s={} post_rng={}",
459+ SYMR_PHASE.with(std::cell::Cell::get),
449 SYMR_MI.with(std::cell::Cell::get).0,460 SYMR_MI.with(std::cell::Cell::get).0,
450 SYMR_MI.with(std::cell::Cell::get).1,461 SYMR_MI.with(std::cell::Cell::get).1,
451 pre_value,462 pre_value,