forge
Explore
Log in

Don't you dare go Hollow

Lane-b128m report -- four 128-superblock defects, the gates and the flip

Browse files at this commit

e7bbd0f18b8dd65497361e5444a4645558fefb7dAhmet Kaan GümüşParent: ffb600b
  • docs
    • lane-b128m report -- four 128-superblock defects, the gates and the flip
Show full message
docs(av1): lane-b128m report -- four 128-superblock defects, the gates and the flip
crates/ec-av1/src/encode.rsmodified+6 -6
@@ -5905,14 +5905,14 @@ fn cfl_on() -> bool {
5905 ///5905 ///
5906 /// | row | 64 superblocks | 128 + the 128 root |5906 /// | row | 64 superblocks | 128 + the 128 root |
5907 /// |---|---|---|5907 /// |---|---|---|
5908-/// | bars 1080p | -2.6 / -18.3 | **-3.3 / -18.9** |5908+/// | bars 1080p | -3.1 / -18.7 | **-3.7 / -19.2** |
5909-/// | bars 2160p | +8.8 / -13.2 | **+7.9 / -14.0** |5909+/// | bars 2160p | +9.1 / -13.3 | **+8.5 / -13.8** |
5910-/// | film A | +20.6 / -5.1 | **+20.4 / -5.2** |5910+/// | film A | +20.3 / -5.0 | **+20.1 / -5.2** |
5911-/// | film B | +24.8 / -2.1 | **+24.2 / -2.5** |5911+/// | film B | +24.6 / -2.0 | **+24.3 / -2.2** |
5912 /// | screen capture | +14.6 / -33.2 | **+14.4 / -33.2** |5912 /// | screen capture | +14.6 / -33.2 | **+14.4 / -33.2** |
5913 ///5913 ///
5914-/// and the long-GOP gate agrees (film A +24.7/-7.5 -> +24.4/-7.7, film B5914+/// and the long-GOP gate agrees (film A +24.0/-7.6 -> +23.6/-7.9, film B
5915-/// +86.8/+7.4 -> +85.6/+6.6).5915+/// +85.8/+7.1 -> +85.1/+6.6). Both arms re-run on lane-b128m's own base.
5916 ///5916 ///
5917 /// ON since lane-b128m closed the eleven 128-superblock desyncs that held it5917 /// ON since lane-b128m closed the eleven 128-superblock desyncs that held it
5918 /// off (the delta_q unit at the 128 superblock, the superblock size travelling5918 /// off (the delta_q unit at the 128 superblock, the superblock size travelling
lanes/b128m.report.mdadded+127 -0
@@ -0,0 +1,127 @@
1+# lane-b128m — the eleven 128-superblock desyncs, and the default flip
2+
3+`SB128_DEFAULT` is **true**: every sequence this encoder writes codes
4+128x128 superblocks, with lane-b128's `PARTITION_NONE` 128 root inside them.
5+Four defects closed, each with its own first divergent symbol.
6+
7+## 1. The delta_q unit is the 128 superblock (`0aa5a5e3`)
8+
9+Defect 0 of the charter, and new at this merge (per-SB delta_q from lane-dq
10+met 128 superblocks from lane-b128 — class *merge cross-product defect*).
11+
12+- **First divergent symbol**: the SECOND 64x64 cell's `delta_q_abs` inside a
13+ 128 root. `tile::write_delta_q` gated on a hardcoded `SB_MI` (64), while
14+ decode.rs `maybe_read_delta_q` gates on `sb_mi_cur` — so the writer coded
15+ four symbol groups per 128 root and the reader read one. It surfaced frames
16+ later as the arf's "a reference frame selected with no picture at this
17+ frame's own ref_frame_idx slot".
18+- Two more halves of the same defect: the 64-root whole-block call passed
19+ `is_whole_sb = true` under a 128 superblock (which suppresses the read on
20+ the wrong side), and the search-side `sb_q` grid gave each 64 cell its own
21+ qindex when only the root's top-left one is coded — flattened per 128 root
22+ so a cell is quantized at the qindex its root signals.
23+- Witness: `encode::tests::a_128_superblock_clip_whose_root_search_codes_128x128_blocks_decodes_exact`
24+ (`--ignored`) — red with the refusal above, green after (405 blocks).
25+
26+## 2. The superblock size travels with a `FrameCtx` copy (`c0635108`'s parent)
27+
28+`decode::filter_ctx_copy` copied nine fields and not `sb128_flag` /
29+`reach_sb_px`, so a tile SEARCH worker (`encode::search_tiles`, threads > 1)
30+searched at 64 while the calling thread searched at 128.
31+
32+- Symptom: `tile_bytes_do_not_depend_on_the_thread_count`, 1x2 tiles, 9251
33+ bytes at one thread vs 9239 at four.
34+- Two neighbouring gates were TEST staleness and are pinned instead of
35+ fixed: `reach_matches_libaom_has_top_right_and_has_bottom_left` and
36+ `every_rect_shape_reaches_what_libaom_says_over_the_whole_superblock`
37+ transcribe libaom's 64-superblock tables, so they build a 64 context
38+ explicitly rather than following the process knob.
39+- `every_tile_layout_decodes_sample_exact_through_both_decoders` asserted
40+ `1 << log2` tiles; the SPEC derives the count from the superblock grid
41+ (`tileWidthSb = ceil(sbCols >> log2)`), and 640x384 has 5 128-superblock
42+ columns, so `tile_cols_log2 = 2` legitimately codes 3 tiles. The test now
43+ expects the encoder's own `TileLayout` (identical to `1 << log2` at 64).
44+
45+## 3. The writer's intrabc DV predictor (`c0635108`)
46+
47+- **First divergent symbol: none.** The writer's and the reader's symbol
48+ traces are identical for all 111384 symbols; only the `# MVDBG` annotation
49+ differs — writer DV (-48, 0) px, reader (-112, 0) px at mi=(36,4).
50+ `tile::intrabc_dv_pred` hardcoded `mib_size = 16` where decode.rs
51+ `read_intrabc_dv` takes `sb_mi_cur`, so `av1_find_ref_dv`'s fallback was one
52+ 64 superblock up on one side and one 128 on the other: same bits, different
53+ reconstruction.
54+- `Ibc::dv_valid` likewise counted libaom's 256-pixel intrabc delay in 64s
55+ (`>> 6`, `INTRABC_DELAY_SB64`), offering sources the 128 visit order had not
56+ reconstructed yet; it now derives both the shift and the delay from the
57+ superblock size.
58+- Witness: `a_repeated_pattern_key_frame_codes_intrabc_blocks_ffmpeg_decodes_exactly`.
59+
60+## 4. Seven test harnesses handed the encoder a 64 context (`b6e573a4`)
61+
62+The seven remaining `stream::tests` failures were one cause: each built a
63+plain `FrameCtx` (superblock 64) and passed it to `encode_*_with_ctx`, so the
64+encoder's own trial decode — and the raw tile decode beside it — read at 64
65+while the writer coded 128 roots.
66+
67+- **First divergent symbol** (`decode_stream_matches_the_tile_path_on_a_key_frame`,
68+ 216x96): index 33, the writer's 8-symbol `partition_w128` (value 3, SPLIT),
69+ which the reader skipped straight into the 10-symbol `partition_w64`.
70+ The other six surfaced as the ref-slot refusal inside the encoder's trial
71+ decode.
72+- Same class the lane-b128 merge swept through ten of their neighbours
73+ (`FrameCtx::for_encoder`); these seven were the rest of it.
74+
75+## The gates (both arms re-run on THIS tree)
76+
77+`bd_rate_screen_native`, 12 frames, BD-rate vs libaom cpu-6 / rav1e s6
78+(lower is better):
79+
80+| row | 64 superblocks (control) | 128 superblocks (default) |
81+|---|---|---|
82+| bars 1080p | -3.1 / -18.7 | **-3.7 / -19.2** |
83+| bars 2160p | +9.1 / -13.3 | **+8.5 / -13.8** |
84+| film A (1080p) | +20.3 / -5.0 | **+20.1 / -5.2** |
85+| film B (2160p) | +24.6 / -2.0 | **+24.3 / -2.2** |
86+| screen capture | +14.6 / -33.2 | **+14.4 / -33.2** |
87+
88+`bd_rate_film_long_gop`, 48 frames:
89+
90+| row | 64 superblocks | 128 superblocks |
91+|---|---|---|
92+| film A | +24.0 / -7.6 | **+23.6 / -7.9** |
93+| film B | +85.8 / +7.1 | **+85.1 / +6.6** |
94+
95+Every row is DOWN on both columns; screen is down on one and flat on the
96+other. The keep rule holds with room to spare.
97+
98+## Pins
99+
100+Re-taken for the flip (the same four pictures, now in 128 superblocks):
101+`(150, 8327, 0x33eb7bd59beaf2e3)`, `(60, 33194, 0xafded5cfca824703)` — was
102+`(150, 8252, ...)`, `(60, 33053, ...)`. `EC_AV1_SB128=0` restores the old
103+bytes exactly, which is also the proof that none of the four fixes moves the
104+64-superblock encoder. No other byte pin moved.
105+
106+## Suite / checks
107+
108+ EC_AV1_SB128=1 (before the flip)
109+ s1 --skip stream:: 341 passed; 0 failed; 34 ignored (only the 64-pins gate red)
110+ s2 stream:: 201 passed; 0 failed; 15 ignored RC=0
111+ s3 10bit 42 passed; 0 failed; 1 ignored RC=0
112+
113+ default (SB128_DEFAULT = true, pins re-taken)
114+ s1 342 passed; 0 failed; 34 ignored RC=0
115+ s2 201 passed; 0 failed; 15 ignored RC=0
116+ s3 42 passed; 0 failed; 1 ignored RC=0
117+ --ignored every_speed_preset_decodes_sample_exact_through_both_decoders ok
118+ --ignored a_128_superblock_clip_whose_root_search... ok (405 blocks)
119+ cargo check --workspace --all-targets 0 errors, 0 ec-av1 warnings
120+
121+## Disposition
122+
123+- `deferred`: HORZ / VERT at the 128 root, the 128 block's residual and its
124+ compound arm, and the intra 128 root on key frames — lane-b128's three
125+ deferrals, unchanged (the writer still refuses a non-skip 128 block).
126+- `open`: search-time vs write-time mv stacks still differ (lane-sb128b's own
127+ second open item); the writer's clamp makes it safe, not right.