forge
Explore
Log in

Don't you dare go Hollow

Lane-svt1 report -- skipped palette block with a split transform

Browse files at this commit

68e4b83f1c2a07dc486a65ea113e595b27a289a7Ahmet Kaan GümüşParent: 1edcdab
  • docs
    • lane-svt1 report -- skipped palette block with a split transform
Show full message
docs(av1): lane-svt1 report -- skipped palette block with a split transform
lanes/svt1.report.mdadded+122 -0
@@ -0,0 +1,122 @@
1+# lane-svt1 — one SVT-AV1 screen stream, one palette block, 10122 samples
2+
3+Stream: `libsvtav1 -preset 8 -crf 35 -svtav1-params lp=1 -g 12 -f obu`, screen
4+capture crop, **1920x1024** (the charter said 1920x768; `ffprobe` says 1024 and
5+the reference yuv is 12 x 2949120 bytes, i.e. 1920x1024 4:2:0), 12 frames, kept
6+outside the repo at `$HOME/.cache/svt1/svt-p8-crf35-screen.obu`.
7+
8+## The premise was wrong, in our favour
9+
10+The charter's "ONE sample off, frame 0 Y 1471489" is a mis-read. Diffing
11+`ours.f*.yuv` (u16 LE) against ffmpeg's 8-bit `ref.yuv`:
12+
13+| frame | differing samples | plane | rows | cols |
14+|---|---|---|---|---|
15+| 0 | 812 | Y only | 766..833 | 766..786 |
16+| 1..6 | 825 each | Y only | 763..834 | 766..786 |
17+| 7..11 | 872 each | Y only | 763..834 | 765..786 |
18+
19+**10122 samples total, luma only, chroma exact in every frame.** Sample 1471489
20+is (row 766, col 769) at width 1920, not (766, 1729). Max |delta| 144.
21+
22+## First divergent stage: pre-filter reconstruction
23+
24+Bisected with the decoder's own debug rungs, not with the stage dump:
25+`EC_AV1_DEBUG_SKIP_DEBLOCK=1`, `EC_AV1_DEBUG_SKIP_CDEF=1` and a new
26+`EC_AV1_DEBUG_SKIP_LR=1` (added beside its two siblings, and to
27+`pipe_filters_ok`'s stage-flag list). With every filter off the band is still
28+wrong and still flat, so no post-filter creates it — it is reconstruction.
29+
30+`EC_TRACE_MODE_STEP=1` through both decoders then diffs **clean**: all 49080
31+mode-ladder lines of frame 0 (`skip`, `cdef`, `dq`, `mode`, `angle_y`,
32+`uv_mode`, `angle_uv`, `tx_depth`) agree with the instrumented aomdec value for
33+value AND range for range. Right symbols, wrong pixels.
34+
35+The block: `EC_PALSYN=1` says `mi=192,192 bsize=6 mode=0 uv=0 ctx=1 y=8` — a
36+16x16 **palette** block (8 colours) at pixel (768, 768), `skip=1`,
37+`tx_depth=1`. libaom prints no `EC_PRED`/`EC_PREDOUT8` for its luma (palette
38+does not predict off edges); it does print the chroma DC. Ours filled the whole
39+16x16 with 54 = the DC of its top edge, and the six 8x8 `V_PRED skip` blocks
40+below it (mi rows 196..206, col 192) then propagated that flat value down the
41+next 48 rows, which is the 64-row tall band in the table above.
42+
43+## Root cause
44+
45+`crates/ec-av1/src/decode.rs`, `decode_block` (square intra):
46+
47+```rust
48+if let Some(buf) = &palette_y_buf && logical_tx == side { set_palette_pred(...) }
49+```
50+
51+A **skipped** block predicts the whole `side`x`side` in ONE call — the skip
52+branch's per-unit walk (`split_tx_skip`) explicitly excludes palette/intrabc
53+blocks — so gating the arm on `logical_tx == side` left every skipped palette
54+(or intrabc) block whose `tx_depth` split the transform with an empty override
55+slot and an edge prediction. Fix: `&& (logical_tx == side || skip)`. Neither
56+prediction is edge-derived, so the whole-block buffer at the block's own stride
57+is exactly what that single call consumes.
58+
59+Class: **override-slot-on-one-arm** (the memory entry of that name is the same
60+shape: an override installed on the skip arm only).
61+
62+## Same-shape sweep
63+
64+`grep -n 'logical_tx == side\|split_tx_skip'` — one site, now fixed. Every
65+sibling path already arms on both arms and was checked by reading:
66+
67+* `decode_leaf8` (8x8, TX_4X4 split): arms inside the non-split `else`, and its
68+ `resolved == 4 && palette_y_buf.is_none()` guard is the same rule — correct.
69+* `decode_rect_split`: windows the map per transform unit including the skip
70+ arm — correct.
71+* `decode_block_rect`, `decode_block_rect64`: arm unconditionally before the
72+ skip branch — correct.
73+* the intra-in-inter var-tx walk (`vartx_leaves`): windows per unit, skip arm
74+ included — correct.
75+
76+## Witness
77+
78+`skip_split_tx_override_hits()` (new counter, incremented on the SHAPE, not on
79+the fixed arm, so it also counts pre-fix) fires **exactly once** in the whole
80+12-frame stream — that one block.
81+
82+No lavfi recipe witnesses the defect in a stream this decoder otherwise
83+decodes. Measured: 6 sources x 5 sizes (384x152, 320x184, 256x190, 640x366,
84+320x240) x 6 crf (25..50), all `libsvtav1 -preset 8 -svtav1-params
85+lp=1:screen-content-mode=1`, 4 frames. 8 streams reach the fixed arm
86+(`hits=1`); of those, 2 are REFUSED by this decoder ("a Golomb tail longer than
87+this decoder reads") and 6 miss by ~200k-245k samples on unrelated inter-frame
88+defects. `smptebars,drawgrid` at 384x152 is the only family that reaches the
89+arm at all; `smptebars` alone, `pal75bars`, `testsrc`, `testsrc2` and
90+`color+drawgrid` never do.
91+
92+So the gate rides the kept stream, per the charter's own fallback:
93+`stream::tests::an_svt_screen_palette_block_with_a_split_transform_decodes_exactly`,
94+gated on `EC_AV1_SVT1_STREAM` (SKIPs with a printed reason when unset, or when
95+ffmpeg is missing, or when the path does not read). It asserts the counter is
96+non-zero before comparing, so it cannot pass on a stream that never reaches the
97+path (class gate-blind-to-feature). The screen crop is NOT committed.
98+
99+* RED (fix reverted, counter kept): `assertion left == right failed: frame 0
100+ luma vs ffmpeg`, `test result: FAILED` (`$HOME/.cache/svt1/redtest2.log`).
101+* GREEN: `test result: ok. 1 passed` (`$HOME/.cache/svt1/greentest.log`), and a
102+ full 12-frame `dump_yuv` vs ffmpeg diff reads **0 differing samples in every
103+ plane of every frame**.
104+
105+## The stall finding
106+
107+Not reproduced, and not tested: the bisect never needed the stage dump. Every
108+decode here ran under `systemd-run --user` and finished in seconds (12 frames
109+of 1920x1024: `dump_yuv` ~5 s, instrumented `aomdec --limit=1` ~10 s). The two
110+prior agents ran the dump command in the FOREGROUND; nothing in this lane
111+suggests the instrument itself hangs, but nothing here exercises it either —
112+`EC_AV1_PREFILT_DUMP`/`EC_AV1_POSTDEBLOCK_DUMP` remain untested by this lane.
113+
114+## Open (not this lane's fix)
115+
116+* `unsupported: AV1 tile (a Golomb tail longer than this decoder reads)` on 2
117+ of 8 synthetic SVT-AV1 screen streams (e.g.
118+ `smptebars=s=384x152:r=12,drawgrid=w=8:h=8:t=1:c=black`, preset 8, crf 35,
119+ `screen-content-mode=1`). Streams are under `$HOME/.cache/svt1/w3/`.
120+* ~200k-sample misses on the INTER frames of those same synthetic screen
121+ streams (their frame 0 is not the only wrong frame). A separate lane: this
122+ one only closes the key-frame palette block.