forge
Explore
Log in

Don't you dare go Hollow

R1 report -- TXFM_CTX_INIT root cause, gate RED at frame 2, residue

Browse files at this commit

88c3a382097d952bfe92a40ca745be004ede3ab6Ahmet Kaan GümüşParent: f66f359
  • docs
    • r1 report -- TXFM_CTX_INIT root cause, gate RED at frame 2, residue
Show full message
docs(txselect): r1 report -- TXFM_CTX_INIT root cause, gate RED at frame 2, residue
lanes/txselect-r1.report.mdadded+105 -0
@@ -0,0 +1,105 @@
1+# lane-txselect r1 — inter var-tx (`TxMode::Select`), spec 5.11.17
2+
3+Branch `lane-txselect`, commit `138c558` (on top of the orchestrator's WIP
4+snapshot `16d83e4`, itself off main `3808cf8`).
5+
6+## What changed
7+
8+- `crates/ec-av1/src/decode.rs`
9+ - `read_block_tx_size` / `read_var_tx_size` / `txfm_partition_ctx` /
10+ `txfm_partition_update` / `set_txfm_ctxs` — the recursive `txfm_split`
11+ tree, max square transform down to `MAX_VARTX_DEPTH = 2`, ported against
12+ `av1/decoder/decodeframe.c:1029-1090` and `av1/common/av1_common_int.h`
13+ (WIP snapshot; verified line by line against the oracle source this round).
14+ - `TXFM_CTX_INIT = 64` (`decode.rs`, next to `MAX_VARTX_DEPTH`) — **root
15+ cause of the first gate failure this round**. The WIP initialised
16+ `Neighbours::above_txfm`/`left_txfm` to 0 with a comment claiming that is
17+ "libaom's own tile-start value". It is not:
18+ `av1_common_int.h:1624` memsets the above txfm row to
19+ `tx_size_wide[TX_SIZES_LARGEST]` and `:1632` the left buffer to
20+ `tx_size_high[TX_SIZES_LARGEST]` — 64. An unwritten neighbour reads as the
21+ *widest* transform, so every frame-edge block took the wrong
22+ `txfm_partition` context.
23+ - `read_inter_luma8` + `split8` in `decode_inter_block8` — the 8x8 inter
24+ leaf now reads its own `txfm_split` symbol (a `BLOCK_8X8` does signal one)
25+ and, when it splits, decodes four 4x4 units, keeping plane-0 neighbour
26+ context per unit across the tail `record_mi`. All three of that function's
27+ branches (compound, single-ref, intra-in-inter) now call
28+ `read_block_tx_size`; without this an 8x8 inter block under `Select`
29+ desynced at its first coefficient.
30+ - two narrow refusals at their own site: a var-tx leaf larger than 32x32 (no
31+ 64-point *inter* coefficient tables here) and an intra block in an inter
32+ frame whose `tx_depth` splits (that path predicts the whole block at once).
33+- `crates/ec-av1/src/cdf.rs`, `cdf_state.rs` (WIP): `TXFM_PARTITION` (21
34+ contexts) in the table set, adaptation and the per-frame counter reset;
35+ `Luma4Inter`/`Luma4InterSet1` coefficient sets.
36+- `crates/ec-av1/src/stream.rs`
37+ - the blanket refusal *"an inter frame using TxMode::Select …"* is deleted,
38+ and `tx_mode == TxMode::Select` is threaded into
39+ `decode_inter_frame_tile_with_cdfs` (new `tx_select` param → thread-local
40+ `set_inter_tx_mode`).
41+ - new gate `a_real_aomenc_inter_sequence_with_tx_select_decodes_pixel_exact`.
42+- `crates/ec-av1/src/refusal_inventory.rs`: −1 blanket refusal, +2 narrow ones.
43+ `gate_coverage.rs` needs no change: it derives only `--enable-*` tool flags,
44+ and `--enable-tx-size-search` is *present* (as `=0`) in the sibling gates, so
45+ the tool was never on its `NEVER_EXERCISED` list.
46+
47+## How the existing inter gates restricted tx-mode
48+
49+`--enable-tx-size-search=0` — it appears **39** times in `stream.rs`
50+(`grep -c '"--enable-tx-size-search=0"'`), i.e. every inter gate. That flag is
51+exactly what pins a stream to `TxMode::Largest`. The new gate is the same
52+recipe as `a_real_aomenc_inter_sequence_with_cdf_forwarding_decodes_pixel_exact`
53+with that flag DELIBERATELY ABSENT (plus `--min-partition-size=16`, because
54+detailed content otherwise makes aomenc pick sub-16 inter partitions — a
55+separate, already-named refusal, hit on 30+ of 40 seeds).
56+
57+## Gate result — RED, honestly
58+
59+```
60+CARGO_TARGET_DIR=$HOME/.cache/cargo-target-txselect EC_AV1_REQUIRE_AOMENC=1 \
61+ cargo test -p ec-av1 --lib a_real_aomenc_inter_sequence_with_tx_select
62+```
63+
64+EVIDENCE: cargo test stderr (seed 43) | aomenc default tx-mode, 4-frame 64x64
65+mandelbrot inter sequence, decode_stream vs ffmpeg per frame |
66+`txfm_split reads=22 splits taken=8`; frame 0 (key) and frame 1 (first inter
67+frame, var-tx active) pixel-exact on Y/U/V; frame 2 Y first differs at (59,14)
68+`got 143 want 144`, 1774/4096 samples; frame 3 differs from (0,0).
69+
70+So: the var-tx read + per-TU residual path is real and correct for a whole key
71+frame and a whole inter frame, and the gate fires (8 splits actually taken).
72+It does not yet pass. **No refusal should be considered "proven lifted" on this
73+evidence** — the branch is not merge-ready.
74+
75+Before the `TXFM_CTX_INIT` fix the same gate failed at frame 2 (32,0) with
76+3209/4096 samples differing; after it, the first divergence moved to (59,14)
77+with 1774 — the fix is a real advance, not a reshuffle.
78+
79+## Residue
80+
81+- fix-now (next round, blocks the merge): frame 2 divergence. Shape: rows 0..13
82+ of frame 2 match everywhere; the first differing samples are on rows 14/15
83+ (x 34..62) with deltas of 1..3, then the error spreads to 43% of the frame.
84+ That is a late-in-block divergence inside the second/third 16x16..32x32
85+ block of the top block row, not a whole-frame desync from symbol 0.
86+ Next step is the ledger's blessed rung, not more reasoning: instrumented
87+ `aomdec` range ladder (`EC_TRACE=1`) vs our `EC_TRACE_MODE_STEP` on frame 2
88+ only, comparing msac RANGE element by element (never `tell()`), starting at
89+ the first block of frame 2. Prime suspects, in order: (1) `txfm_partition`
90+ CDF *adaptation* forwarded into frame 2 (frame 1 is clean, frame 2 is the
91+ first frame that inherits an adapted copy — the "CDF counter not reset"
92+ class, though `reset_counts` does list it); (2) `tx_size_context` for an
93+ intra block in an inter frame, which still reads the deblock `tx_grid`
94+ instead of libaom's `above_txfm_context`/`left_txfm_context` with the
95+ `is_inter_block` → block-size override (`pred_common.h:342-371`) — a known,
96+ unported divergence introduced the moment inter neighbours carry split
97+ transforms; (3) the deblock tx grid written per var-tx leaf.
98+- deferred(the frame-2 fix): 10-bit gate — his films are `yuv420p10le` and
99+ 10-bit is a separate standing refusal (`Picture` planes are `Vec<u8>`), so a
100+ 10-bit tx-select gate would prove nothing this round.
101+- deferred(the frame-2 fix): film probe (`decode_probe` on 0.4 s of each film)
102+ — pointless until the 8-bit gate is green.
103+- accepted (documented corner-cut, in the code): a var-tx block's chroma
104+ deblock edges read `tx_h_grid / 2`, i.e. they follow the luma leaves even
105+ though the block's uv transform is not split.