forge
Explore
Log in

Don't you dare go Hollow

R2 report -- scan-table root cause pinned, fix not landed

Browse files at this commit

4f7d6d1e821ee1bc6775e4feab47e3f5f127d88eAhmet Kaan GümüşParent: f9547e3
  • docs
    • r2 report -- scan-table root cause pinned, fix not landed
Show full message
docs(part32): r2 report -- scan-table root cause pinned, fix not landed
lanes/part32-r2.report.mdadded+107 -0
@@ -0,0 +1,107 @@
1+# lane-part32 round 2
2+
3+## State: NOT DONE, red, committed (4bff66c)
4+
5+Charter: fix decode_block_rect64's pre-existing pixel mismatch exposed by
6+round 1's refusal lift.
7+
8+## True mismatch geometry (measured on THIS tree, not inherited)
9+
10+Reproduced live: `cargo test -p ec-av1 --lib
11+a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact`
12+-> 266 passed, 1 failed, matches the trial-merge count I was handed.
13+
14+Pinned the mismatching seed-42 stream via `EC_AV1_GATE_DUMP`, added an
15+`#[ignore]`d debug test (`debug_part32_r2_sbpart_pin_mismatch_geometry`,
16+`stream.rs`) that decodes it and prints exact per-pixel diffs.
17+
18+- Full-frame post-filter comparison against ffmpeg: 17873/24576 luma pixels
19+ differ, spanning the entire frame past x=91,y=0. This is NOT a single
20+ off-by-one -- it's a cascade: once one block's pixels are wrong, every
21+ block that intra-predicts from it downstream inherits and compounds the
22+ error, eventually corrupting nearly all of SB row 1 (y>=64).
23+- Root of the cascade, isolated via aom-oracle's `EC_AV1_PREFILT_DUMP` rung
24+ (pre-loop-filter ground truth) plus two new env-gated bypasses
25+ (`EC_AV1_DEBUG_SKIP_DEBLOCK`/`_CDEF`, off by default) on our side: our own
26+ PRE-FILTER reconstruction matches the oracle's pre-filter output exactly
27+ through SB(1,0)'s first VERT-64 sub-block (mi_c=16..23, all-zero DC,
28+ correct). The very first wrong pixel is (96,0) -- the first pixel of the
29+ SECOND VERT-64 sub-block (mi_c=24..31, real coefficients, eob_nonzero=true):
30+ oracle=81, ours=76.
31+
32+## Entropy layer: DIVERGES, inside this exact block
33+
34+Compared msac RANGE (never `tell()`) against the aom-oracle's `EC_TRACE_COEFF`
35+rung, element by element:
36+- Ranges agree exactly up through `rng=63764` at the entry to this block's
37+ luma coefficient read (`EC_COEFF plane=0 ... tx_size=64corner/11
38+ rng=63764` on both sides).
39+- Both sides read `eob=6` (agreement).
40+- The oracle's per-step trace assigns nonzero level=1 at scan indices
41+ 0, 1, 2, 4, 5 (skipping 3). Ours (`scan32 = default_scan(TX32)`, a plain
42+ square 32x32 scan) walks physical positions (0,0)(0,1)(1,0)(2,0)(1,1)(0,2)
43+ for the same six scan indices -- a different position-to-index mapping
44+ than whatever the oracle used.
45+- Post-block range: ours=37896, oracle=46344. Diverged.
46+
47+Conclusion: this is a genuine in-block entropy desync (wrong scan table),
48+not a post-processing (deblock/CDEF, both proven innocent by disabling them)
49+and not a dequant/reconstruction-only bug.
50+
51+## Root cause (identified, not yet fixed)
52+
53+`decode_block_rect64` (crates/ec-av1/src/decode.rs:3559) reads the luma
54+corner with `scan32 = default_scan(TX32)` -- the square TX_32X32 scan --
55+for BOTH genuine square 64x64 blocks and truncated-corner VERT-64/HORZ-64
56+strips (bw=32,bh=64 or bw=64,bh=32). The function's own doc comment already
57+documents an analogous, already-fixed asymmetry for the nz_map *context*
58+table (`NZ_MAP_CTX_OFFSET_32X64`/`_64X32`, lane-sbpart r8) but the *scan
59+order itself* was never given the same treatment. AV1 spec names a distinct
60+Default_Scan_32x64/64x32 table (libaom `av1_scan_orders[TX_32X64]` /
61+`[TX_64X32]`), and this decoder does not have it.
62+
63+Same shape as this repo's existing `table-indexed-by-raw-size` and
64+`scan-weights-cross-axis` ledger classes.
65+
66+## Fix NOT landed this round
67+
68+Turn budget spent entirely on localization (per charter's own step-2
69+instruction, "if ranges diverge, that's decisive"). Porting a correct
70+1024-entry SCAN_32X64/SCAN_64X32 table from libaom and wiring it in at the
71+`decode_block_rect64` call site (mirroring how `chroma_scan` already
72+branches on `bw == 64` a few lines below) is the next round's whole job --
73+should be mechanical once the table exists, but deriving/verifying a new
74+1024-entry table safely needs its own round, not the tail end of this one.
75+
76+## Gates
77+
78+- Part32's own AB gate (round 1's):
79+ `a_real_aomenc_intra_stream_with_ab_partitions_decodes_pixel_exact` --
80+ not re-run this round (untouched by this round's changes; round 1 already
81+ proved it 40/40 and this round made zero changes to part32's own code
82+ paths).
83+- Target gate
84+ (`a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact`):
85+ still RED, root cause pinned, fix not landed.
86+- `cargo check --workspace --all-targets`: clean.
87+- Full `cargo test -p ec-av1 --lib` NOT re-run this round after the debug
88+ additions (both are `#[ignore]`d / env-gated no-ops by default; the only
89+ change to non-test code is the two early-return guards in
90+ `apply_deblock`/`apply_cdef`, both env-gated and off by default -- zero
91+ behavior change verified by the identical `cargo check` above).
92+
93+## rect64q contradiction: explained
94+
95+lane-rect64q's own reproduction (row0 col91=81, matching ffmpeg, no
96+mismatch) used a stream from ITS OWN worktree, which did not have this
97+lane's AB arms and so took a genuinely different aomenc encode (different
98+partition decisions entirely) -- not a contradiction of this round's
99+finding, a different stream. This round's own pinned stream, decoded fresh
100+on this tree, reproduces the failure deterministically and traces to a real,
101+narrow, named defect (wrong scan table for TX_32X64/TX_64X32 corner-truncated
102+luma).
103+
104+## HEAD
105+
106+`4bff66c` -- "wip(part32): pin decode_block_rect64's block2 defect to a
107+scan-table mismatch"