The 8x8 intra leaf inside an inter frame read the REDUCED five-type tx_type set unconditionally
Browse files at this commit564bd72dcc1e081a3f5054d938daec675d488c2fParent: db5c143- fix
- the 8x8 intra leaf inside an inter frame read the REDUCED five-type tx_type set unconditionally
3 changed files +56 -2
- crates/ec-av1/src/decode.rs +9 -1
- crates/ec-av1/src/stream.rs +5 -1
- lanes/uv8-r3.report.md +42 -0
crates/ec-av1/src/decode.rsmodified+9 -1
| @@ -22045,7 +22045,15 @@ fn decode_inter_block8( | ||
| 22045 | 22045 | luma_grid = read_plane( |
| 22046 | 22046 | dec, |
| 22047 | 22047 | 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), | |
| 22049 | 22057 | scan8, |
| 22050 | 22058 | 0, |
| 22051 | 22059 | around[0], |
crates/ec-av1/src/stream.rsmodified+5 -1
| @@ -5890,7 +5890,11 @@ mod tests { | ||
| 5890 | 5890 | // class [[gate-skips-on-its-own-failure]]: a decode that succeeded |
| 5891 | 5891 | // is ALWAYS pixel-compared; the counter only decides whether the |
| 5892 | 5892 | // 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; | |
| 5894 | 5898 | if !counted { |
| 5895 | 5899 | uncounted_exact += 1; |
| 5896 | 5900 | 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). |