The compound 8x8 leaf voted its reference-frame CDFs off a hard-coded LAST_FRAME and cleared both per-slot is_global_mv_block flags -- entropy on the dual-filter/OBMC 8x8 stream is now range-exact end to end
Browse files at this commitdb58f21c581fa11aff1fd6a46e1cac9381b68b11Parent: c9ff494- fix
- the compound 8x8 leaf voted its reference-frame CDFs off a hard-coded LAST_FRAME and cleared both per-slot is_global_mv_block flags -- entropy on the dual-filter/OBMC 8x8 stream is now range-exact end to end
2 changed files +45 -15
- crates/ec-av1/src/decode.rs +29 -2
- crates/ec-av1/src/stream.rs +16 -13
crates/ec-av1/src/decode.rsmodified+29 -2
| @@ -19406,6 +19406,22 @@ fn decode_inter_block8( | ||
| 19406 | 19406 | SCALED_BLOCK8_HITS.with(|c| c.set(c.get() + 1)); |
| 19407 | 19407 | } |
| 19408 | 19408 | |
| 19409 | + // lane-interp3 r2 (class twin-functions-drift): both slots | |
| 19410 | + // used to be stamped `false`, while [`decode_inter_block`]'s | |
| 19411 | + // compound arm computes libaom's PER-SLOT `is_global_mv_block` | |
| 19412 | + // (blockd.h:421-429 -- mode GLOBAL_GLOBALMV, block >= 8x8 | |
| 19413 | + // (always true for this leaf) and THAT slot's own gm model > | |
| 19414 | + // TRANSLATION). A neighbour carrying the flag makes | |
| 19415 | + // `setup_ref_mv_list` substitute the READER's global mv for | |
| 19416 | + // the neighbour's stored one, so a cleared flag fed the next | |
| 19417 | + // block's stack a stored mv where libaom has the global | |
| 19418 | + // candidate -- a wrong mv stack, wrong mode contexts, and a | |
| 19419 | + // desync one block later. | |
| 19420 | + let is_globalmv_c = compound_mode == 6; | |
| 19421 | + let is_global_mv0_c = is_globalmv_c | |
| 19422 | + && global_motion[(ref0 - LAST_FRAME) as usize].model as u8 > 1; | |
| 19423 | + let is_global_mv1_c = is_globalmv_c | |
| 19424 | + && global_motion[(ref1 - LAST_FRAME) as usize].model as u8 > 1; | |
| 19409 | 19425 | for dr in 0..2 { |
| 19410 | 19426 | for dc in 0..2 { |
| 19411 | 19427 | grid.set( |
| @@ -19420,8 +19436,8 @@ fn decode_inter_block8( | ||
| 19420 | 19436 | is_new_mv: matches!(compound_mode, 2 | 3 | 4 | 5 | 7), |
| 19421 | 19437 | size: 2, |
| 19422 | 19438 | size_h: 2, |
| 19423 | - is_global_mv0: false, | |
| 19424 | - is_global_mv1: false, | |
| 19439 | + is_global_mv0: is_global_mv0_c, | |
| 19440 | + is_global_mv1: is_global_mv1_c, | |
| 19425 | 19441 | }, |
| 19426 | 19442 | ); |
| 19427 | 19443 | } |
| @@ -19723,6 +19739,17 @@ fn decode_inter_block8( | ||
| 19723 | 19739 | &gm_table, |
| 19724 | 19740 | tpl, |
| 19725 | 19741 | ); |
| 19742 | + // lane-interp3 r2: same per-entry EC_STACK ladder | |
| 19743 | + // [`decode_inter_block`]'s single-ref arm prints, so this leaf's stack | |
| 19744 | + // diffs line for line against the oracle's. | |
| 19745 | + if std::env::var_os("EC_TRACE_MODE").is_some() { | |
| 19746 | + for (i, e) in stack.entries.iter().enumerate() { | |
| 19747 | + eprintln!( | |
| 19748 | + "EC_STACK mi_row={mi_row} mi_col={mi_col} ref={ref_frame} i={i} this=({},{}) comp=(0,0) w={}", | |
| 19749 | + e.mv.0, e.mv.1, e.weight | |
| 19750 | + ); | |
| 19751 | + } | |
| 19752 | + } | |
| 19726 | 19753 | |
| 19727 | 19754 | let not_new = dec.symbol(&mut cdfs.new_mv[stack.new_mv_ctx]) == 1; |
| 19728 | 19755 | let mut is_globalmv = false; |
crates/ec-av1/src/stream.rsmodified+16 -13
| @@ -6312,19 +6312,22 @@ mod tests { | ||
| 6312 | 6312 | /// arrived: a compound 8x8 leaf that really read the filter, a block whose |
| 6313 | 6313 | /// two dual-filter directions DIFFER (impossible with dual filter off), |
| 6314 | 6314 | /// and an 8x8 OBMC blend. |
| 6315 | - // lane-interp3 r1: RED, and ignored rather than deleted -- MEASURED, not | |
| 6316 | - // assumed. At `EC_INTERP3_FRAMES=4` (the other arms' length) aomenc codes | |
| 6317 | - // no compound block at all and the stream decodes; from 5 frames on it | |
| 6318 | - // does, and the decode then stops at "an inter 16x16-level AB or 1:4 | |
| 6319 | - // partition" WITH this round's filter read and at "an inter partition | |
| 6320 | - // below 8x8" WITHOUT it (measured by ablating the read) -- both are | |
| 6321 | - // impossible on a `--enable-ab-partitions=0 --enable-1to4-partitions=0 | |
| 6322 | - // --min-partition-size=8` recipe, so BOTH are our own desync | |
| 6323 | - // (class refusal-from-own-desync) and the compound 8x8 leaf carries at | |
| 6324 | - // least one more missing/misplaced symbol beyond the interp filter this | |
| 6325 | - // round added. Next round: EC_TRACE range ladder vs aomdec on the first | |
| 6326 | - // compound leaf of frame 5. | |
| 6327 | - #[ignore = "lane-interp3 r1: the compound 8x8 leaf still desyncs past the interp-filter read (surfaces as a bogus AB/1:4 refusal); the panic it used to end in is now a named refusal"] | |
| 6315 | + // lane-interp3 r2: the ENTROPY desync r1 measured is CLOSED -- the full | |
| 6316 | + // 16-frame stream now parses end to end and every `EC_MODE`/`EC_MODE_VAL` | |
| 6317 | + // element's msac RANGE matches the instrumented aomdec's line for line | |
| 6318 | + // (570/570 mode elements, 0 diff). Two twin-drift root causes, both in | |
| 6319 | + // `decode_inter_block8`'s compound arm: `read_compound_ref_frames` was | |
| 6320 | + // passed a hard-coded `LAST_FRAME` for every inter neighbour instead of | |
| 6321 | + // the real per-mi band, and the grid stamp cleared both per-slot | |
| 6322 | + // `is_global_mv_block` flags. This gate stays RED and ignored on a | |
| 6323 | + // RECONSTRUCTION residue, not an entropy one: luma-only, |delta| <= 8, | |
| 6324 | + // first at decode frame 7 pixel (42,15) -- the 8x8 leaf at mi (10,4), | |
| 6325 | + // spilling one pixel across its left/bottom deblock edges -- growing to | |
| 6326 | + // 222 Y + 4 U + 1 V samples by frame 15 (pure propagation; chroma stays | |
| 6327 | + // exact until frame 14). Next round: the OBMC blend over a compound | |
| 6328 | + // neighbour (the oracle's `EC_OBMC` rung prints `filt=` per neighbour; | |
| 6329 | + // this decoder has no `EC_OBMC` emitter yet -- build it first). | |
| 6330 | + #[ignore = "lane-interp3 r2: entropy is now exact on the whole stream (range ladder 570/570); RED on a luma-only reconstruction residue from decode frame 7 (|delta| <= 8, first at the 8x8 leaf mi (10,4))"] | |
| 6328 | 6331 | #[test] |
| 6329 | 6332 | fn a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact() { |
| 6330 | 6333 | const NAME: &str = |