lane-av1422warp: instrument -- EC_SYMR carries a phase, and a CORRECTED inter mi
Browse files at this commitc39e6f5ba90abb7fe03f496998d5782e5d1a08e5Parent: 2be479d2 changed files +24 -1
- crates/ec-av1/src/decode.rs +12 -0
- crates/ec-av1/src/msac.rs +12 -1
crates/ec-av1/src/decode.rsmodified+12 -0
| @@ -33045,6 +33045,11 @@ fn decode_inter_block( | ||
| 33045 | 33045 | // combinations that don't implement scaled MC yet. |
| 33046 | 33046 | frame_width: usize, fctx: &crate::decode::FrameCtx, |
| 33047 | 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 | 33054 | // lane-inter4 r1: `at` is in MI units (4 px) so a 32-level 1:4 strip can |
| 33050 | 33055 | // name an 8-px offset; `(r, c)` stays the enclosing 16-px cell for the |
| @@ -40400,6 +40405,13 @@ fn decode_inter_block8( | ||
| 40400 | 40405 | // (`use_superres`) -- mirrors [`decode_inter_block`]'s own param. |
| 40401 | 40406 | frame_width: usize, fctx: &crate::decode::FrameCtx, |
| 40402 | 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 | 40415 | const LAST_FRAME: i8 = 1; |
| 40404 | 40416 | // lane-gmaffine r2: the leaf's OWN switchable-filter symbols, handed back |
| 40405 | 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 | 329 | /// rounds 22 and 23. Set by the mode readers at entry; `(-1,-1)` outside. |
| 330 | 330 | pub(crate) static SYMR_MI: std::cell::Cell<(i64, i64)> = |
| 331 | 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 | 340 | impl<'a> SymbolDecoder<'a> { |
| @@ -407,6 +413,10 @@ impl<'a> SymbolDecoder<'a> { | ||
| 407 | 413 | |
| 408 | 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 | 420 | pub(crate) fn set_symr_mi(mi_r: i64, mi_c: i64) { |
| 411 | 421 | SYMR_MI.with(|c| c.set((mi_r, mi_c))); |
| 412 | 422 | } |
| @@ -445,7 +455,8 @@ impl<'a> SymbolDecoder<'a> { | ||
| 445 | 455 | } |
| 446 | 456 | if symr { |
| 447 | 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 | 460 | SYMR_MI.with(std::cell::Cell::get).0, |
| 450 | 461 | SYMR_MI.with(std::cell::Cell::get).1, |
| 451 | 462 | pre_value, |