Lane-ab128 report
Browse files at this commit408f8b3e4d0f0d69bdfe2fb1bd8b0538d7ca757bParent: 7c89e33- docs
- lane-ab128 report
1 changed file +138 -0
- lanes/ab128.report.md +138 -0
lanes/ab128.report.mdadded+138 -0
| @@ -0,0 +1,138 @@ | |||
| 1 | +# lane-ab128 — the four AB shapes at the 128 superblock root | ||
| 2 | + | ||
| 3 | +`PARTITION_HORZ_A` (two 64x64 on top, one 128x64 below), `_HORZ_B` (one | ||
| 4 | +128x64 on top, two 64x64 below), `_VERT_A` (two 64x64 left, one 64x128 | ||
| 5 | +right), `_VERT_B` (one 64x128 left, two 64x64 right) are written, witnessed | ||
| 6 | +sample-exact through `decode_stream` AND ffmpeg on all four shapes, and | ||
| 7 | +measured on both gates. **They ship OFF** (`EC_AV1_B128AB=1` turns them on): | ||
| 8 | +every gate row is flat or 0.1 worse. The lane's value is the measurement and | ||
| 9 | +the machinery, not a shipped default. | ||
| 10 | + | ||
| 11 | +## 1. What was built | ||
| 12 | + | ||
| 13 | +* `crate::encode::ab128_pieces(symbol, (mi_row, mi_col))` — the three pieces | ||
| 14 | + of a shape, position and footprint, in libaom's `decode_partition` order | ||
| 15 | + and decode.rs' `sb128_ab` order (decode.rs ~35269): HORZ_A = TL, TR, bottom | ||
| 16 | + half; HORZ_B = top half, BL, BR; VERT_A = TL, BL, right half; VERT_B = left | ||
| 17 | + half, TR, BR. One table, read by the search, by the writer and by the | ||
| 18 | + winner's grid publication, so the three cannot drift (class | ||
| 19 | + *table and reader move together*). | ||
| 20 | +* `search_root_128_ab` — the three pieces priced through the same | ||
| 21 | + `search_skip_64` the NONE and HORZ/VERT arms use, each at its own | ||
| 22 | + footprint, each published into the mi grid (`record_mi_rect`) before the | ||
| 23 | + next is searched and the whole 32x32-mi window restored with | ||
| 24 | + `MiGrid::snapshot_rect`/`restore_rect` before returning (class | ||
| 25 | + *encoder-grid-drift-invisible-to-pixel-gate*). The cost carries the root's | ||
| 26 | + own `partition_bits_sym(128, symbol)`. | ||
| 27 | +* `Quadrant::Ab128(symbol, pieces)` on the root's top-left 32x32 entry, the | ||
| 28 | + fifteen others `Covered` — exactly as `Rect128` does. | ||
| 29 | +* The writer needed **no new block function**: a 64x64 AB piece is one inter | ||
| 30 | + block coded at side 64 with `write_w == write_h == 64`, and a half is the | ||
| 31 | + 128x64/64x128 `write_inter_block_128_rect` already codes. All three go | ||
| 32 | + through `write_inter_block_128_rect` at their own `(w, h)`. | ||
| 33 | +* `EC_AV1_B128AB` (default off), `force_b128_ab` (test knob, 0 or the | ||
| 34 | + partition symbol 4..=7), per-shape search and writer counters, and the | ||
| 35 | + `EC_AV1_B128_CENSUS` line extended with `AB roots a/b/c/d`. | ||
| 36 | + | ||
| 37 | +## 2. Charter premises checked against the code | ||
| 38 | + | ||
| 39 | +* **"decide whether the 64 pieces of an AB shape run the full 64-root search | ||
| 40 | + or the skip-64 search, and justify by measurement; the full search is what | ||
| 41 | + libaom does" — refuted by the syntax, so nothing to measure.** decode.rs' | ||
| 42 | + `sb128_ab` codes each 64x64 piece as ONE `decode_inter_block` at | ||
| 43 | + `side = SB` with no partition symbol of its own (`square64_inter!`), which | ||
| 44 | + is libaom's own AB shape: an AB piece is a whole block, never a | ||
| 45 | + further-partitionable root. A "full 64-root search" candidate could not be | ||
| 46 | + written at all. The pieces are `search_skip_64` at (64, 64), skip-only, for | ||
| 47 | + the same reason `search_root_128_rect`'s halves are: the 128 residual arm | ||
| 48 | + they would share is parked behind `EC_AV1_B128RES`. | ||
| 49 | +* **"Extend `cdef_unit_owner` for the two-unit shape and the four-way | ||
| 50 | + `pick_filters` grouping" — not needed, and NOT done (rung 1: it would be | ||
| 51 | + dead code).** `write_cdef_idx` writes a literal only for a NON-SKIP block; | ||
| 52 | + every AB piece and every HORZ/VERT half is skip, so such a root puts no | ||
| 53 | + `cdef_idx` in the stream at all and CDEF filters none of its (all-skip) | ||
| 54 | + units. `cdef_unit_owner` collapses units only for `Whole128`, which is the | ||
| 55 | + one 128-wide shape that can carry a residual (`EC_AV1_B128RES`). The same | ||
| 56 | + reasoning covers `Rect128`, which lane-b128hv also left out of the map — | ||
| 57 | + swept and confirmed inert, not a sibling defect. The day a piece carries a | ||
| 58 | + residual, `cdef_unit_owner` must learn `Rect128` and `Ab128` in the SAME | ||
| 59 | + diff; that is named as the constraint below. | ||
| 60 | +* `write_delta_q` needed no change: it already gates on the block's own | ||
| 61 | + position within the (128-wide) superblock, and no AB piece is the whole | ||
| 62 | + superblock, so `is_whole_sb = false` — what `write_inter_block_128_rect` | ||
| 63 | + passes — is right for all three. `intrabc_dv_pred` is intra-frame only and | ||
| 64 | + this is the inter writer. | ||
| 65 | +* The charter's witness fixtures ("4K bars + film B 12-frame fixtures used by | ||
| 66 | + `a_128_root_horz_and_vert_halves_decode_exact_through_both_decoders`") are | ||
| 67 | + stale: that test encodes ONE synthetic `testsrc2` 1280x768 12-frame clip. | ||
| 68 | + The AB witness mirrors it exactly. | ||
| 69 | + | ||
| 70 | +## 3. Witness | ||
| 71 | + | ||
| 72 | +`encode::tests::a_128_root_ab_shapes_decode_exact_through_both_decoders` | ||
| 73 | +(`--ignored`), five passes over the same clip — each shape forced at every | ||
| 74 | +root, then unforced: | ||
| 75 | + | ||
| 76 | + HORZ_A: search won [660, 0, 0, 0] writer coded [1320, 0, 0, 0] | ||
| 77 | + HORZ_B: search won [0, 660, 0, 0] writer coded [0, 1320, 0, 0] | ||
| 78 | + VERT_A: search won [0, 0, 660, 0] writer coded [0, 0, 1320, 0] | ||
| 79 | + VERT_B: search won [0, 0, 0, 660] writer coded [0, 0, 0, 660*2] | ||
| 80 | + unforced: search won [0, 0, 1, 1] writer coded [0, 0, 2, 2] | ||
| 81 | + | ||
| 82 | +Every pass sample-exact against the encoder's own reconstruction through | ||
| 83 | +`decode_stream` and through ffmpeg, first run, no bisect needed. RED before | ||
| 84 | +this lane by construction: `write_sb128_root` could name only NONE / HORZ / | ||
| 85 | +VERT / SPLIT. | ||
| 86 | + | ||
| 87 | +## 4. Census on real content (`EC_AV1_B128_CENSUS=1`, long-GOP films) | ||
| 88 | + | ||
| 89 | +171 inter frames: a typical frame is `7 whole 128 roots, 0-1 HORZ + 0-1 VERT, | ||
| 90 | +AB roots 0/0/0/1`, out of ~1050-1900 coded blocks. 44 of 171 frames took no | ||
| 91 | +AB root at all; the modal non-zero frame takes exactly one. The shapes are | ||
| 92 | +real but rare — which is the whole BD result below. | ||
| 93 | + | ||
| 94 | +## 5. Gates (arm = default-on build, control = `EC_AV1_B128AB=0`; lower is better) | ||
| 95 | + | ||
| 96 | +12-frame `bd_rate_screen_native` (`~/.cache/ab128/12arm.log`, `12ctl.log`): | ||
| 97 | + | ||
| 98 | +| row | arm vs libaom | ctl vs libaom | arm vs rav1e | ctl vs rav1e | | ||
| 99 | +| --- | --- | --- | --- | --- | | ||
| 100 | +| bars 1080p | -3.4% | -3.4% | -19.0% | -19.0% | | ||
| 101 | +| bars 2160p | +8.4% | +8.4% | -14.0% | -14.0% | | ||
| 102 | +| film A | +18.1% | +18.0% | -6.2% | -6.3% | | ||
| 103 | +| film B | +23.1% | +23.0% | -3.3% | -3.5% | | ||
| 104 | +| screen | +14.4% | +14.4% | -33.2% | -33.2% | | ||
| 105 | + | ||
| 106 | +Long-GOP `bd_rate_film_long_gop` — the deciding gate (`lgarm.log`, | ||
| 107 | +`lgctl.log`): | ||
| 108 | + | ||
| 109 | +| row | arm vs libaom | ctl vs libaom | arm vs rav1e | ctl vs rav1e | | ||
| 110 | +| --- | --- | --- | --- | --- | | ||
| 111 | +| film A | +22.0% | +21.9% | -8.5% | -8.6% | | ||
| 112 | +| film B | +75.8% | +75.8% | +0.8% | +0.8% | | ||
| 113 | + | ||
| 114 | +Wall (both arms run concurrently, so the contention is shared): long-GOP | ||
| 115 | +706.6 + 520.0 = 1226.6 s arm against 665.0 + 463.5 = 1128.5 s control, | ||
| 116 | +**+8.7%** — inside the +15% ceiling, but bought for nothing. | ||
| 117 | + | ||
| 118 | +**Keep rule: FAILED.** It asks for both film rows down on both columns, or | ||
| 119 | +one >= 0.5 down with the other flat. Film A is 0.1 WORSE on both columns, | ||
| 120 | +film B is unchanged to the decimal. The candidate costs a partition symbol on | ||
| 121 | +every root it wins and buys back less than it spends. Shipped off. | ||
| 122 | + | ||
| 123 | +Known under-pricing shared with lane-b128hv (unchanged by this lane): a | ||
| 124 | +non-origin AB piece codes no `delta_q` group, but the piece AT the superblock | ||
| 125 | +origin does, and nothing here prices it — lane-rectdq is adding the | ||
| 126 | +`delta_q_bits` pricer. The mispricing is under a bit per root and is the same | ||
| 127 | +for the rect arm, so it cannot explain a 0.1 BD miss on its own. | ||
| 128 | + | ||
| 129 | +## 6. Suite, pins, checks | ||
| 130 | + | ||
| 131 | +* Pins: `encode::tests::the_encoders_own_streams_are_byte_identical_to_their_pins` | ||
| 132 | + green at default and at `EC_AV1_SPEED=6`, **unmoved** (`pins2.log`) — the | ||
| 133 | + arm is off by default, so the default encoder is byte-identical to main's. | ||
| 134 | +* `--ignored --exact encoder::tests::every_speed_preset_decodes_sample_exact_through_both_decoders`: ok. | ||
| 135 | +* `--ignored` HORZ/VERT witness (lane-b128hv's): ok, unaffected by the | ||
| 136 | + counter split (a 64x64 piece no longer counts as a "64x128 half"). | ||
| 137 | +* Suite in three lanes and `cargo check --workspace --all-targets`: see | ||
| 138 | + section 7 (filled from `s1.log` / `s2.log` / `s3.log` / `chk.log`). | ||