wip(av1): msac symbol_fixed hand-verified correct; real desync is a switchable_interp read aomdec never performs for this block. Round 6, capped at budget.
Browse files at this commit21c832090b62b7b73239fcf7d59cda4a6a386507Parent: ea8acbf2 changed files +22 -1
- crates/ec-av1/src/decode.rs +14 -1
- crates/ec-av1/src/msac.rs +8 -0
crates/ec-av1/src/decode.rsmodified+14 -1
| @@ -551,7 +551,8 @@ fn read_eob(dec: &mut SymbolDecoder, coding: &mut TxbTables, class: TxClass) -> | |||
| 551 | (_, Some(class1)) => class1, | 551 | (_, Some(class1)) => class1, |
| 552 | }; | 552 | }; |
| 553 | if std::env::var_os("EC_AV1_EOBPT_CDF").is_some() && eob_pt.len() == 12 { | 553 | if std::env::var_os("EC_AV1_EOBPT_CDF").is_some() && eob_pt.len() == 12 { |
| 554 | - eprintln!("EC_AV1_EOBPT_CDF {eob_pt:?}"); | 554 | + let (range, value) = dec.debug_state(); |
| 555 | + eprintln!("EC_AV1_EOBPT_CDF {eob_pt:?} range={range} value={value}"); | ||
| 555 | } | 556 | } |
| 556 | let group = dec.symbol(eob_pt) + 1; | 557 | let group = dec.symbol(eob_pt) + 1; |
| 557 | if trace { | 558 | if trace { |
| @@ -622,10 +623,18 @@ fn read_coeffs( | |||
| 622 | let trace = std::env::var_os("EC_AV1_TRACE").is_some(); | 623 | let trace = std::env::var_os("EC_AV1_TRACE").is_some(); |
| 623 | let side = coding.side; | 624 | let side = coding.side; |
| 624 | let mut grid = vec![0i32; side * side]; | 625 | let mut grid = vec![0i32; side * side]; |
| 626 | + if std::env::var_os("EC_AV1_EOBPT_CDF").is_some() { | ||
| 627 | + let (range, value) = dec.debug_state(); | ||
| 628 | + eprintln!("EC_AV1_STATE_BEFORE_TXBSKIP range={range} value={value}"); | ||
| 629 | + } | ||
| 625 | let all_zero = dec.symbol(&mut coding.txb_skip[skip_ctx]) == 1; | 630 | let all_zero = dec.symbol(&mut coding.txb_skip[skip_ctx]) == 1; |
| 626 | if trace { | 631 | if trace { |
| 627 | eprintln!("TRACE all_zero ctx={skip_ctx} value={}", all_zero as i32); | 632 | eprintln!("TRACE all_zero ctx={skip_ctx} value={}", all_zero as i32); |
| 628 | } | 633 | } |
| 634 | + if std::env::var_os("EC_AV1_EOBPT_CDF").is_some() { | ||
| 635 | + let (range, value) = dec.debug_state(); | ||
| 636 | + eprintln!("EC_AV1_STATE_AFTER_TXBSKIP range={range} value={value}"); | ||
| 637 | + } | ||
| 629 | if all_zero { | 638 | if all_zero { |
| 630 | return Ok((grid, TxType::DctDct)); | 639 | return Ok((grid, TxType::DctDct)); |
| 631 | } | 640 | } |
| @@ -644,6 +653,10 @@ fn read_coeffs( | |||
| 644 | eprintln!("EC_AV1_TXTYPE32_CDF {tx_type_cdf:?}"); | 653 | eprintln!("EC_AV1_TXTYPE32_CDF {tx_type_cdf:?}"); |
| 645 | } | 654 | } |
| 646 | let t = dec.symbol(tx_type_cdf); | 655 | let t = dec.symbol(tx_type_cdf); |
| 656 | + if std::env::var_os("EC_AV1_EOBPT_CDF").is_some() { | ||
| 657 | + let (range, value) = dec.debug_state(); | ||
| 658 | + eprintln!("EC_AV1_STATE_AFTER_TXTYPE range={range} value={value}"); | ||
| 659 | + } | ||
| 647 | if trace { | 660 | if trace { |
| 648 | eprintln!("TRACE tx_type value={t} len={len}"); | 661 | eprintln!("TRACE tx_type value={t} len={len}"); |
| 649 | } | 662 | } |
crates/ec-av1/src/msac.rsmodified+8 -0
| @@ -335,6 +335,14 @@ impl<'a> SymbolDecoder<'a> { | |||
| 335 | self.bit | 335 | self.bit |
| 336 | } | 336 | } |
| 337 | 337 | ||
| 338 | + /// Debug-only: the raw coder state (`range`, `value`) entering the next | ||
| 339 | + /// read, for a byte-for-byte diff against a reference decoder's own | ||
| 340 | + /// `r->ec.rng`/`r->ec.dif` while chasing a desync (see | ||
| 341 | + /// `EC_AV1_EOBPT_CDF`). Not spec output, just the two live fields. | ||
| 342 | + pub(crate) fn debug_state(&self) -> (u32, u32) { | ||
| 343 | + (self.range, self.value) | ||
| 344 | + } | ||
| 345 | + | ||
| 338 | /// Reads `bits` raw bits, most significant first — the `L(n)` descriptor | 346 | /// Reads `bits` raw bits, most significant first — the `L(n)` descriptor |
| 339 | /// of spec 4.10.4. | 347 | /// of spec 4.10.4. |
| 340 | pub fn literal(&mut self, bits: u32) -> u32 { | 348 | pub fn literal(&mut self, bits: u32) -> u32 { |