Merge branch 'lane-txd' (3c743b34): the full tx_depth context fix measured worse and is reverted; report only (split calibration is the blocker)
Browse files at this commit1 changed file +116 -0
- lanes/txd.report.md +116 -0
lanes/txd.report.mdadded+116 -0
| @@ -0,0 +1,116 @@ | |||
| 1 | +# lane-txd — the `tx_depth` context, both halves: BUILT, MEASURED, REFUTED | ||
| 2 | + | ||
| 3 | +Class `pricer-context-zero`, last site. lane-ctx2 built the KEY-frame half | ||
| 4 | +alone and it lost; the named cause was that an INTER frame's intra block reads | ||
| 5 | +a different band set (`TXFM_CONTEXT`, `tile::tx_size_ctx_txfm`, where an inter | ||
| 6 | +neighbour votes its own BLOCK size and a skipped inter block publishes its | ||
| 7 | +block size) which the encoder published nowhere. This lane built BOTH halves | ||
| 8 | +in one arm. It still loses, and the census below says why — so the arm is | ||
| 9 | +reverted whole (`75158510`; the tree is byte-identical to the control at | ||
| 10 | +`3c106765`) and the class closes as "no site left that pays". | ||
| 11 | + | ||
| 12 | +## The arm (commits 60c3cdf6 + 9c1d45f9, reverted by 75158510) | ||
| 13 | + | ||
| 14 | +* Key half: lane-ctx2's, restored verbatim — `above_tx`/`left_tx` bands in | ||
| 15 | + `encode_key_frame_inner` mirroring `Neighbours::record_tx`, the rule shared | ||
| 16 | + as `tile::tx_size_ctx_of`, the row threaded through `code_square`. | ||
| 17 | +* Inter half (new): one `u8` per mi cell beside `MiGrid::cells` (`txfm`, like | ||
| 18 | + `skips` — the cell stays 16 bytes), written by `record_mi` at every one of | ||
| 19 | + its six publication points, with `txfm_px(side, inter, skip, tx_depth)` — | ||
| 20 | + a skipped inter block records its BLOCK size, everything else its resolved | ||
| 21 | + transform, which is what all four `record_txfm` calls in | ||
| 22 | + `tile::write_tx_syntax_inter` leave over the block's whole span. | ||
| 23 | + `encode::tx_ctx_txfm` reads the above/left cell out of the grid (`MiGrid::get`'s | ||
| 24 | + tile window IS the writer's `has_above`/`has_left`) and the rule itself moved | ||
| 25 | + into `tile::tx_size_ctx_txfm_of`, which `Neighbours::tx_size_ctx_txfm` now | ||
| 26 | + calls too — one transcription for writer and pricer. | ||
| 27 | + | ||
| 28 | +## Gate (12-frame native, BD-rate vs libaom cpu-used 6 / rav1e speed 6) | ||
| 29 | + | ||
| 30 | +Control reproduced in this worktree at `3c106765`, all three rows, exactly the | ||
| 31 | +charter's numbers. | ||
| 32 | + | ||
| 33 | +| row | control | arm (both halves) | | ||
| 34 | +|---|---|---| | ||
| 35 | +| film A | +21.0 / −4.8 | +20.9 / −4.8 | | ||
| 36 | +| film B | +24.9 / −1.9 | **+25.2 / −1.6** | | ||
| 37 | +| screen | +14.5 / −33.2 | +14.5 / −33.2 | | ||
| 38 | +| bars 1080p | −2.0 / −17.6 | −2.0 / −17.6 | | ||
| 39 | +| bars 2160p | +8.7 / −13.4 | +8.7 / −13.4 | | ||
| 40 | + | ||
| 41 | +Film B moves the wrong way on BOTH columns by 0.3 while film A gains 0.1 on | ||
| 42 | +one: not "both films improve", not "one ≥0.5 down and the other flat ±0.3", | ||
| 43 | +not "a correctness fix flat within ±0.2 everywhere". No keep rule is met. | ||
| 44 | +`bd_rate_film_long_gop` was not run — it only decides a row that ships. | ||
| 45 | + | ||
| 46 | +## Census — why correct pricing costs | ||
| 47 | + | ||
| 48 | +Instrumented at the two ctx-derivation sites over the pin encode (key + inter | ||
| 49 | +pictures), plus the price each row charges: | ||
| 50 | + | ||
| 51 | +``` | ||
| 52 | +CENSUS key: ctx0 767 ctx1 457 ctx2 156 (total 1380, ctx2 11.3%) | ||
| 53 | +CENSUS inter-intra: ctx0 227 ctx1 731 ctx2 1902 (total 2860, ctx2 66.5%) | ||
| 54 | +PRICE side 8 depth 0: row0 0.715 row2 0.430 delta -0.284 | ||
| 55 | +PRICE side 16 depth 0: row0 1.417 row2 0.811 delta -0.606 | ||
| 56 | +PRICE side 32 depth 0: row0 1.335 row2 0.431 delta -0.904 | ||
| 57 | +PRICE side 64 depth 0: row0 2.503 row2 0.964 delta -1.539 | ||
| 58 | +PRICE side 8 depth 1: row0 1.356 row2 1.956 delta +0.599 | ||
| 59 | +PRICE side 16 depth 1: row0 0.872 row2 1.429 delta +0.557 | ||
| 60 | +PRICE side 32 depth 1: row0 3.901 row2 4.656 delta +0.755 | ||
| 61 | +PRICE side 64 depth 1: row0 2.525 row2 2.460 delta -0.065 | ||
| 62 | +``` | ||
| 63 | + | ||
| 64 | +libaom's default `TX_SIZE_CAT*` rows 0 and 1 are identical, so only ctx2 moves | ||
| 65 | +a price at all, and its direction is one-sided: **depth 0 gets 0.28–1.54 bits | ||
| 66 | +cheaper, depth 1 gets 0.56–0.76 bits dearer**. Correct pricing therefore | ||
| 67 | +discourages transform splitting everywhere it bites — and it bites two thirds | ||
| 68 | +of an inter frame's intra blocks against one ninth of a key frame's, which is | ||
| 69 | +precisely the asymmetry that makes film B (the inter-heavy row) the loser | ||
| 70 | +while film A barely moves. The reading: the search's residual/λ calibration | ||
| 71 | +was leaning on the row-0 handicap to reach the split rate that measures well; | ||
| 72 | +the symbol price is not the mispriced term. Fixing it in isolation is a | ||
| 73 | +correct change that the surrounding calibration is not ready for. | ||
| 74 | + | ||
| 75 | +## Unit test (RED shown, then green; reverted with the arm) | ||
| 76 | + | ||
| 77 | +`encode::tests::the_tx_depth_pricer_uses_the_writers_own_context_row` — the | ||
| 78 | +key-frame rule table, and an inter-frame 16x16 intra block at mi (4,4) with | ||
| 79 | +32x32 INTER neighbours published through `record_mi`. Red before, both halves: | ||
| 80 | + | ||
| 81 | +``` | ||
| 82 | +assertion `left == right` failed: the grid's row is not the writer's | ||
| 83 | + left: 0 | ||
| 84 | + right: 2 | ||
| 85 | +side 16 depth 0 at ctx 2: priced 1.4169172324970667, writer codes 0.8110248802158339 | ||
| 86 | +``` | ||
| 87 | + | ||
| 88 | +Green after the arm. Gone with the revert (it asserts on the reverted | ||
| 89 | +signature); the numbers are kept here because they are the whole finding. | ||
| 90 | + | ||
| 91 | +## Pins and suite | ||
| 92 | + | ||
| 93 | +* Stream pins on the arm: `[(150, 8381, 0x36ac_5783_4a20_499a), (60, 33016, | ||
| 94 | + 0xfcd0_be7a_3600_34ce)]` (was 8325 / 33014), green at the default preset and | ||
| 95 | + at `EC_AV1_SPEED=6`. No other byte pin went red. Back at 8325 / 33014 after | ||
| 96 | + the revert. | ||
| 97 | +* Split suite on the ARM build, release lib, all RC=0: `--skip stream::` 339 | ||
| 98 | + passed / 0 failed / 32 ignored; `stream:: --skip 10bit` 200 / 0 / 15; | ||
| 99 | + `10bit` 42 / 0 / 1. | ||
| 100 | +* `--ignored encoder::tests::every_speed_preset_decodes_sample_exact_through_both_decoders` | ||
| 101 | + passed (reverted tree). | ||
| 102 | +* `timeout 900 cargo check --workspace --all-targets -j4`: 0 errors, 0 ec-av1 | ||
| 103 | + warnings (the workspace's 25 are pre-existing, in ec-opus and ec-vorbis). | ||
| 104 | + | ||
| 105 | +## Disposition | ||
| 106 | + | ||
| 107 | +`deferred: the tx_size depth context — BOTH halves are now built and measured | ||
| 108 | +and the arm loses; what would unblock it is not more context plumbing but the | ||
| 109 | +split-decision calibration around it (λ or the residual term the depth trial | ||
| 110 | +is compared under), since the correct price is a one-sided push away from | ||
| 111 | +splitting. Do not rebuild the plumbing without first showing that the split | ||
| 112 | +rate the pricer produces is the one that measures best.` | ||
| 113 | + | ||
| 114 | +`deferred: the MV pricer — write_mv has PER-COMPONENT tables where the pricer | ||
| 115 | +has one shared set (the long-standing static-MV approximation); untouched, as | ||
| 116 | +in lane-ctx and lane-ctx2.` | ||