diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 0dc7f071..b1d5987f 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -33539,6 +33539,7 @@ fn decode_inter_block( && enable_masked_compound && is_any_masked_compound_used_here(write_w, write_h) { + crate::msac::SymbolDecoder::set_symr_cdf("comp_group_idx"); dec.symbol(&mut cdfs.comp_group_idx[group_ctx]) } else { 0 @@ -33831,6 +33832,7 @@ fn decode_inter_block( ref_order_hints[(ref0 - LAST_FRAME) as usize], ref_order_hints[(ref1 - LAST_FRAME) as usize], ); + crate::msac::SymbolDecoder::set_symr_cdf("compound_idx"); let idx = dec.symbol(&mut cdfs.compound_idx[idx_ctx]); if crate::envflags::env_flag!("EC_TRACE_MODE") { eprintln!( @@ -34998,6 +35000,7 @@ fn decode_inter_block( // TRUE footprint -- a 16x8 strip is group 1, a 32x16 strip // group 2, not their square `side`'s 2/3. let bsize_group = size_group_wh(write_w, write_h); + crate::msac::SymbolDecoder::set_symr_cdf("interintra"); let interintra = dec.symbol(&mut cdfs.interintra[bsize_group]) == 1; if interintra { // lane-interintra r1 (decodemv.c 1540-1555): interintra_mode, @@ -40691,6 +40694,7 @@ fn decode_inter_block8( && enable_masked_compound && is_any_masked_compound_used_here(SIDE, SIDE) { + crate::msac::SymbolDecoder::set_symr_cdf("comp_group_idx"); dec.symbol(&mut cdfs.comp_group_idx[group_ctx]) } else { 0 @@ -40747,6 +40751,7 @@ fn decode_inter_block8( ref_order_hints[(ref0 - LAST_FRAME) as usize], ref_order_hints[(ref1 - LAST_FRAME) as usize], ); + crate::msac::SymbolDecoder::set_symr_cdf("compound_idx"); let idx = dec.symbol(&mut cdfs.compound_idx[idx_ctx]); if idx == 1 { (8, 8, 1u8) @@ -41498,6 +41503,7 @@ ss_y(fctx), let mut interintra_mode: Option = None; let mut wedge_mask: Option<(&'static [u8], usize)> = None; if enable_interintra_compound && !skip_mode { + crate::msac::SymbolDecoder::set_symr_cdf("interintra"); let interintra = dec.symbol(&mut cdfs.interintra[SIZE_GROUP_8]) == 1; if interintra { // lane-interintra r1: same read pair as the 16/32 site; diff --git a/crates/ec-av1/src/msac.rs b/crates/ec-av1/src/msac.rs index 4f4b208e..c24fcaea 100644 --- a/crates/ec-av1/src/msac.rs +++ b/crates/ec-av1/src/msac.rs @@ -335,6 +335,12 @@ thread_local! { /// the inter path; without a phase its reads are unattributable. pub(crate) static SYMR_PHASE: std::cell::Cell<&'static str> = const { std::cell::Cell::new("") }; + /// The CDF TABLE NAME for the read about to be made, mirroring the + /// oracle's `ec_symr_cdf_tag`. `cdf0` alone cannot identify a table -- + /// two rows can share a first entry -- so this is what turns "two + /// 2-symbol reads" into a named pair. + pub(crate) static SYMR_CDF: std::cell::Cell<&'static str> = + const { std::cell::Cell::new("") }; } impl<'a> SymbolDecoder<'a> { @@ -413,6 +419,10 @@ impl<'a> SymbolDecoder<'a> { /// `decode_symbol` (spec 8.2.6), with the adaptation of 8.3.2. /// + pub(crate) fn set_symr_cdf(t: &'static str) { + SYMR_CDF.with(|c| c.set(t)); + } + pub(crate) fn set_symr_phase(p: &'static str) { SYMR_PHASE.with(|c| c.set(p)); } @@ -455,7 +465,8 @@ impl<'a> SymbolDecoder<'a> { } if symr { eprintln!( - "EC_SYMR ph={} mi=({},{}) pre=({},{},{}) cdf0={} n={} s={} post_rng={}", + "EC_SYMR ph={} cdf={} mi=({},{}) pre=({},{},{}) cdf0={} n={} s={} post_rng={}", + SYMR_PHASE.with(std::cell::Cell::get), SYMR_PHASE.with(std::cell::Cell::get), SYMR_MI.with(std::cell::Cell::get).0, SYMR_MI.with(std::cell::Cell::get).1,