Lane-sbpart r2 charter -- decode_block_rect64 then HORZ/VERT at 64x64
Browse files at this commit61401f0a8c17c203fd88d849da5bc44df8fc954fParent: 664f2e4- docs
- lane-sbpart r2 charter -- decode_block_rect64 then HORZ/VERT at 64x64
1 changed file +76 -0
- lanes/sbpart-r2.charter.md +76 -0
lanes/sbpart-r2.charter.mdadded+76 -0
| @@ -0,0 +1,76 @@ | |||
| 1 | +# lane-sbpart r2 — build decode_block_rect64, wire HORZ/VERT at 64x64 | ||
| 2 | + | ||
| 3 | +At a2bc6dc. Read `lanes/sbpart.report.md` — it is a typing plan with the | ||
| 4 | +formulas already worked out. Do not re-derive it. | ||
| 5 | + | ||
| 6 | +**Correction to the r1 charter, on the record:** it said this lane was "mostly | ||
| 7 | +extending an existing recursion, not new theory". That was wrong, and r1's | ||
| 8 | +report says why: `decode_block_rect` (32x16 / 16x32) has no truncation logic | ||
| 9 | +because 32 and 16 both fit inside the 32-coefficient cap. A 64x32 / 32x64 strip | ||
| 10 | +does not — its luma plane needs the corner truncation `decode_block` does for a | ||
| 11 | +plain 64x64 square, and `read_plane`'s `tx_side != side` branch is square-only. | ||
| 12 | +That is genuinely new work for a rectangular block, and r1 was right to spend | ||
| 13 | +its round establishing it rather than typing something that could not work. | ||
| 14 | + | ||
| 15 | +## Already landed (0e04b79, green, inert by design) | ||
| 16 | +- `cdf.rs`: `EOB_PT_512_CHROMA`, the true 512-position chroma end-of-block CDF | ||
| 17 | + from libaom's `av1_default_eob_multi512_cdfs[*][1][*]` (token_cdfs.h:874-901). | ||
| 18 | + libaom's default is the same flat distribution at all four q-contexts, so it | ||
| 19 | + is one constant with no `_Q0`/`_Q1`/`_Q3` siblings. | ||
| 20 | +- `cdf_state.rs`: `TxbSet::ChromaRect32x16` with its field, reset, `pick()` / | ||
| 21 | + defaults wiring and `txb()` arm. Shares everything `Chroma32` does except | ||
| 22 | + `eob_pt`. | ||
| 23 | + | ||
| 24 | +r1 also resolved which entropy context each axis lands on, via | ||
| 25 | +`get_txsize_entropy_ctx` = `(txsize_sqr_map[tx] + txsize_sqr_up_map[tx] + 1) >> 1` | ||
| 26 | +(common_data.h:302-341): LUMA TX_64X32/TX_32X64 resolves to **TX_64X64**, so the | ||
| 27 | +already-landed `TxbSet::Luma64` + `SCAN_32` are correct and no new table is | ||
| 28 | +needed; CHROMA TX_32X16/TX_16X32 resolves to **TX_32X32**, which is `Chroma32`'s | ||
| 29 | +tables except the eob — hence this round's new variant. | ||
| 30 | + | ||
| 31 | +## Build, in this order — COMMIT AT EVERY GREEN STEP | ||
| 32 | +1. `decode_block_rect64(bw, bh)` (or generalize `decode_block_rect`): | ||
| 33 | + - mode via `read_intra_mode_rect`, which is already bw/bh-generic but | ||
| 34 | + unverified above 32x16 — check its angle-delta and filter-intra ranges do | ||
| 35 | + not assume `bw, bh <= 32`; | ||
| 36 | + - luma: read a real 32x32 corner with `read_coeffs` (not `_rect`) using | ||
| 37 | + `TxbSet::Luma64` / `SCAN_32`, embed it top-left of a `bw*bh` zero grid | ||
| 38 | + (mirror `read_plane`'s `tx_side != side` branch, generalized to | ||
| 39 | + non-square), then `dequant_and_inverse_typed_wh` over the whole grid; | ||
| 40 | + - chroma: read the real `bw/2 x bh/2` corner with `read_coeffs_rect` using | ||
| 41 | + `TxbSet::ChromaRect32x16` and the matching `SCAN_32X16` / `SCAN_16X32` | ||
| 42 | + (both already exist). | ||
| 43 | +2. Wire `PARTITION_HORZ` / `PARTITION_VERT` into the `_ =>` arm of the `match` | ||
| 44 | + at decode.rs ~5292 (intra tile path, 64x64 level), exactly the way HORZ/VERT | ||
| 45 | + are already wired at the 32x32 level just above it — two calls to the new | ||
| 46 | + function at `at` and `(at.0 + 2, at.1)` or `(at.0, at.1 + 2)`, mi units, | ||
| 47 | + `SUB_MI`-scaled for the 64 level. | ||
| 48 | +3. The gate, with r1's verified recipe (it reproduces the refusal live): | ||
| 49 | + `aomenc --codec=av1 --passes=1 --end-usage=q --cq-level=45 --cpu-used=0 | ||
| 50 | + --threads=1 --row-mt=0 --sb-size=64 --enable-rect-partitions=1 | ||
| 51 | + --enable-ab-partitions=0 --enable-1to4-partitions=0 --min-partition-size=32 | ||
| 52 | + --max-partition-size=64 --enable-restoration=0 --enable-palette=0 | ||
| 53 | + --deltaq-mode=0 --enable-filter-intra=0 --enable-cfl-intra=0 | ||
| 54 | + --enable-intrabc=0 --obu` on a 192x128 `gradients` source blended with | ||
| 55 | + `testsrc2` so it is not flat. `min/max-partition-size=32/64` is the key: it | ||
| 56 | + stops the RD search recursing below 32x32, so every SB-level decision is | ||
| 57 | + genuinely NONE/SPLIT/HORZ/VERT. `EC_AV1_REQUIRE_AOMENC=1`, attempt loop | ||
| 58 | + requiring at least one decode, HARD-asserted firing count. | ||
| 59 | +4. Then the 32x32-level `part32` values, then the inter path's two refusals. | ||
| 60 | + | ||
| 61 | +## The rule this batch has now paid for twice | ||
| 62 | +Do NOT remove a refusal in a commit that does not also gate it. A green suite | ||
| 63 | +proves the removal broke nothing that already ran — it cannot prove the | ||
| 64 | +newly-allowed path, because until the gate exists nothing takes it. Two sibling | ||
| 65 | +lanes lifted refusals on a green suite this batch; one of them turned out to | ||
| 66 | +have a firing counter that was never incremented, so its own assert was blind. | ||
| 67 | +If you cannot gate it this round, leave the refusal in place and say so. | ||
| 68 | + | ||
| 69 | +Merge note: main is at 93d9510 (multi-tile decode landed, gated). Report every | ||
| 70 | +refusal string you remove, verbatim, for `refusal_inventory.rs`. | ||
| 71 | + | ||
| 72 | +Hard rules: `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-sbpart`; foreground | ||
| 73 | +`nice -n 19 cargo ... -j4`; every `cargo test` a timeout >= 600000 ms. Sibling | ||
| 74 | +worktrees have live agents — never build in or edit them. Never push, never | ||
| 75 | +merge into `main`. 75-turn cap, does not reset: COMMIT AT EVERY GREEN STEP. | ||
| 76 | +End with `lanes/sbpart-r2.report.md`, VERDICT on line 1. | ||