forge
Explore
Log in

Don't you dare go Hollow

A split-transform superblock-level strip published no TXFM_CONTEXT band

Browse files at this commit

79abd1e668357c06c30c5f4c752925eefdbda491Ahmet Kaan GümüşParent: a43f3c7
  • fix
    • a split-transform superblock-level strip published no TXFM_CONTEXT band
Show full message
fix(av1): a split-transform superblock-level strip published no TXFM_CONTEXT band

`decode_block_rect64`'s `depth != 0` arm returns early, past the tail
`txfm_partition_update_rect` lane-frame36 r1 added, so a SPLIT 64x16/16x64/
64x32/32x64 strip left the above/left TXFM_CONTEXT bands holding the row's
init value 64. libaom runs `set_txfm_ctxs(mbmi->tx_size, ...)` for EVERY
block, with the SPLIT unit's size.

Measured on the 10-bit 3840x1608 stream (58-OBU prefix), decode-order frame
33 (the hidden ARF): after the split 16x64 strip at mi(192,140)
(`tx_depth=1` -> TX_16X32) the 32x64 intra block at mi(192,144) read
`left_txfm=64` and took `tx_size_cat3` row 2 where aomdec takes row 1 --
same value, different range, desync from there to the end of the frame.

With the fix every superblock entry range of every traced frame equals
aomdec's, and all 37 output frames of the prefix are byte-exact against
ffmpeg (frame 36 was 765464 differing bytes at r1's tip, 1992768 before it).

Also adds the oracle's own `EC_ISTEP ... name=tx_depth ... cat=` line to the
2:1 intra-in-inter arm, which is what named this defect.
crates/ec-av1/src/decode.rsmodified+17 -1
@@ -7542,11 +7542,18 @@ fn decode_intra_rect_in_inter(
75427542 // The INTER frame's own `TXFM_CONTEXT` bands, not the key frame's
75437543 // deblock-grid approximation -- [`tx_size_context_txfm_rect`].
75447544 let ctx = tx_size_context_txfm_rect(neighbours, (mi_r, mi_c), bw.min(64), bh.min(64));
7545- match tx_cat {
7545+ let d = match tx_cat {
75467546 1 => dec.symbol(&mut cdfs.tx_size_cat1[ctx]),
75477547 2 => dec.symbol(&mut cdfs.tx_size_cat2[ctx]),
75487548 _ => dec.symbol(&mut cdfs.tx_size_cat3[ctx]),
7549+ };
7550+ if std::env::var_os("EC_TRACE_MODE_STEP").is_some() {
7551+ eprintln!(
7552+ "EC_ISTEP mi_row={mi_r} mi_col={mi_c} name=tx_depth val={d} ctx={ctx} cat={tx_cat} rng={}",
7553+ dec.debug_state().0
7554+ );
75497555 }
7556+ d
75507557 } else {
75517558 0
75527559 };
@@ -9584,6 +9591,15 @@ fn decode_block_rect64(
95849591 let (puv_size, puv_colors) =
95859592 palette_uv.as_ref().map_or((0, [0u16; 8]), |p| (p.size, p.u_colors));
95869593 neighbours.record_palette_uv_rect((mi_r, mi_c), bw, bh, puv_size, puv_colors);
9594+ // lane-frame36 r2: `set_txfm_ctxs` runs for EVERY block and this early
9595+ // return skips the fn's own tail, so a SPLIT superblock-level strip
9596+ // published no TXFM_CONTEXT band and the next block read the row's init
9597+ // value 64 as its left transform height. Measured on the 10-bit
9598+ // 3840x1608 stream, decode-order frame 33: after the split 16x64 strip
9599+ // at mi(192,140) (`tx_depth=1` -> TX_16X32) the 32x64 block at
9600+ // mi(192,144) took `tx_size_cat3` row 2 where libaom takes row 1. The
9601+ // bands carry the SPLIT unit's size, not the block's.
9602+ txfm_partition_update_rect(neighbours, (mi_r, mi_c), (tx_w, tx_h), (bw, bh));
95879603 RECT_PARTITION_HITS.with(|c| c.set(c.get() + 1));
95889604 return Ok(());
95899605 }