forge
Explore
Log in

Don't you dare go Hollow

The 8x8 intra leaf inside an inter frame read the REDUCED five-type tx_type set unconditionally

Browse files at this commit

564bd72dcc1e081a3f5054d938daec675d488c2fAhmet Kaan GümüşParent: db5c143
  • fix
    • the 8x8 intra leaf inside an inter frame read the REDUCED five-type tx_type set unconditionally
Show full message
fix(av1): the 8x8 intra leaf inside an inter frame read the REDUCED five-type tx_type set unconditionally

decode_inter_block8's intra arm passed a hardcoded TxbSet::Luma8 (the
reduced_tx_set==1 alphabet, EXT_TX_SET_DTT4_IDTX, five types) for the leaf's
8x8 luma transform. With reduced_tx_set==0 libaom's av1_get_ext_tx_set_type
returns EXT_TX_SET_DTT4_IDTX_1DDCT for is_inter==0 at tx_size_sqr==TX_8X8 --
seven types. Same symbol value, different narrowing: the msac range diverged at
the leaf's first tx_type and desynced the rest of the tile, which is what
produced the 30/30 "named refusal" attempts the r1/r2 gate logs showed.

Route the set through txbset_for(8, reduced_tx_set); reduced_tx_set was already
a parameter of this function. Per-TU range ladder against the instrumented
aomdec on the gate's own 192x128 8-bit stream goes from a first divergence at
TU 3392 (frame 2, mi 2,34) to 13986/13986 identical.

Gate uv_mode_in_inter8_gate: 3/3 arms (8-bit, 10-bit, two-tile) pixel-exact on
attempt 0 with all three chroma classes firing; the counted predicate is
tightened to require all three on the same compared attempt.
crates/ec-av1/src/decode.rsmodified+9 -1
@@ -22045,7 +22045,15 @@ fn decode_inter_block8(
2204522045 luma_grid = read_plane(
2204622046 dec,
2204722047 cdfs,
22048- TxbSet::Luma8,
22048+ // lane-uv8 r3: an intra leaf inside an inter frame is
22049+ // `is_inter == 0` in `av1_get_ext_tx_set_type`, so its 8x8
22050+ // luma reads the INTRA set -- seven-type
22051+ // `EXT_TX_SET_DTT4_IDTX_1DDCT` when `reduced_tx_set == 0`,
22052+ // five-type `EXT_TX_SET_DTT4_IDTX` when it is 1. Hardcoding
22053+ // the reduced set read the wrong ALPHABET (class
22054+ // [[wrong-alphabet-same-value]]) and desynced at the leaf's
22055+ // first `tx_type`.
22056+ txbset_for(8, reduced_tx_set),
2204922057 scan8,
2205022058 0,
2205122059 around[0],
crates/ec-av1/src/stream.rsmodified+5 -1
@@ -5890,7 +5890,11 @@ mod tests {
58905890 // class [[gate-skips-on-its-own-failure]]: a decode that succeeded
58915891 // is ALWAYS pixel-compared; the counter only decides whether the
58925892 // attempt counts as firing.
5893- let counted = fired.0 + fired.1 + fired.2 != 0;
5893+ // lane-uv8 r3: every one of the three chroma classes this gate
5894+ // exists for (directional, smooth/paeth, CfL) must fire on the
5895+ // SAME pixel-compared attempt -- a sum-nonzero predicate would
5896+ // pass on an attempt that only ever hit DC-adjacent CfL.
5897+ let counted = fired.0 > 0 && fired.1 > 0 && fired.2 > 0;
58945898 if !counted {
58955899 uncounted_exact += 1;
58965900 refusals.push(format!(
lanes/uv8-r3.report.mdadded+42 -0
@@ -0,0 +1,42 @@
1+# lane-uv8 r3 — GREEN (root cause: wrong tx_type ALPHABET on the 8x8 intra-in-inter leaf)
2+
3+## Root cause
4+`decode_inter_block8`'s INTRA arm passed a hardcoded `TxbSet::Luma8` to `read_plane` for the
5+leaf's 8x8 luma transform. `TxbSet::Luma8` is the `reduced_tx_set == 1` set
6+(`EXT_TX_SET_DTT4_IDTX`, FIVE types); with `reduced_tx_set == 0` libaom's
7+`av1_get_ext_tx_set_type` (`av1/common/blockd.h`) returns, for `is_inter == 0` and
8+`tx_size_sqr == TX_8X8`, `EXT_TX_SET_DTT4_IDTX_1DDCT` — SEVEN types
9+(`TxbSet::Luma8Set1`). Same symbol, different alphabet: the CDF narrowing differed, so the
10+msac range diverged at the leaf's first `tx_type` and every following block desynced. The
11+desync manufactured the 30/30 "named refusals" the r1/r2 gate logs showed
12+(class [[refusal-from-own-desync]] + [[wrong-alphabet-same-value]]).
13+
14+Charter suspect (1) (the `fimode_to_intradir` row) was already correct: `fi_tx_row` is applied
15+at every luma `txb` call site including this one, and `fimode_to_intradir[0] == DC_PRED`
16+equals this block's `y_mode` anyway, so that row was inert here.
17+
18+## Change
19+- `crates/ec-av1/src/decode.rs:22057` — `TxbSet::Luma8` -> `txbset_for(8, reduced_tx_set)`
20+ (`reduced_tx_set` was already a parameter of `decode_inter_block8`).
21+- `crates/ec-av1/src/stream.rs:5897` — gate `counted` predicate tightened from
22+ "sum nonzero" to "all three uv classes fired on the same pixel-compared attempt".
23+
24+## Sweep (class: hardcoded reduced-set TxbSet)
25+`grep -n 'TxbSet::Luma\(4\|8\|16\|32\),' decode.rs` — the only reduced-sensitive hardcodes are
26+sizes 8 and 4; after this fix there are ZERO outside `txbset_for`/`txbset_for_inter`. Every
27+`Luma16`/`Luma32` literal is alphabet-invariant to `reduced_tx_set` (`txbset_for` maps 16 and
28+32 identically for both values). The rect-strip and >=16 square intra-in-inter arms already go
29+through `txbset_for`/`txbset_for_inter` (decode.rs:6053, 7167, 7777, 7857, 9594, 11075).
30+
31+## EVIDENCE
32+EVIDENCE: ~/.cache/uv8-tmp/ref.tu + ours3.tu | aomdec EC_TRACE_COEFF vs our EC_TRACE_COEFF on ~/.cache/uv8-tmp/a0.obu, per-TU (all_zero,eob) msac range ladder | before: first divergence at TU-line 3392 (ref eob rng=32776, ours 34568; the preceding tx_type read was ref rng=33532 vs ours 35240 at plane=0 tx_size=1, the mi(2,34) filter-intra leaf of decode-order frame 2) — after: 13986/13986 lines identical, whole stream, decode_probe rc=0 with no refusal
33+EVIDENCE: $HOME/.cache/uv8-gate-r3.log | `cargo test -p ec-av1 --lib -- --test-threads=1 --nocapture non_dc_chroma_8x8_intra_leaf` | 3 passed / 0 failed; every arm exact on attempt 0 with all three classes firing — 8bit/1tile dir 159 smooth-paeth 172 cfl 211; 10bit/1tile 112/126/120; 8bit/2tile 83/66/80; buckets counted-exact=1 uncounted-exact=0 named-refusals=0 on each
34+
35+## Residue
36+- deferred: the 8x8 intra-in-inter leaf whose `tx_depth` splits to four TX_4X4 units is still
37+ refused by name (decode.rs ~21996). Unblocked by an arm with `--enable-tx-size-search=1`
38+ plus a 4x4-TU prediction loop in this leaf path — out of this lane's charter, which fixed the
39+ depth-0 alphabet. Its refusal string stays in refusal_inventory.rs.
40+- accepted: `frames` from `decode_stream` is decode order; the gate recipe has
41+ `--lag-in-frames=0 --auto-alt-ref=0`, so decode order == display order and all 8 frames are
42+ compared (class [[gate-blind-to-hidden-frames]] does not apply).