forge
Explore
Log in

Don't you dare go Hollow

Lane-ctx2 report -- comp_mode term ships, tx_size depth context refuted

Browse files at this commit

e61e88b032719682ee1c8cb1f9eb1ef4dd5ffbcfAhmet Kaan GümüşParent: c46955e
  • docs
    • lane-ctx2 report -- comp_mode term ships, tx_size depth context refuted
Show full message
docs(av1): lane-ctx2 report -- comp_mode term ships, tx_size depth context refuted
lanes/ctx2.report.mdadded+109 -0
@@ -0,0 +1,109 @@
1+# lane-ctx2 — the last two `pricer-context-zero` sites
2+
3+Class `pricer-context-zero`: the RD pricer in `crates/ec-av1/src/encode.rs`
4+priced symbols at CDF row 0 (or with the wrong tree) while the writer in
5+`crates/ec-av1/src/tile.rs` derives every context from neighbours. lane-pricer
6+and lane-ctx took single refs, `skip`, `is_inter` and the compound tree. This
7+lane took the two left: the `comp_mode` term (arm D, SHIPS) and the `tx_size`
8+depth context (arm B, REFUTED and reverted).
9+
10+## arm D — a single-reference candidate pays `comp_mode = 0`
11+
12+On a `reference_select` frame `tile::write_comp_mode` codes one `comp_mode`
13+symbol ahead of EVERY inter block's reference syntax. `compound_ref_bits`
14+already paid `comp_mode = 1`; `single_ref_bits` paid nothing at all, so the
15+compound side of every leaf carried the whole symbol as a handicap.
16+`single_ref_bits` now adds `comp_mode = 0` at the writer's own
17+`reference_mode_ctx`, and pays zero on a frame that carries no
18+`reference_select` bit -- exactly where `write_comp_mode` returns early.
19+
20+12-frame native gate, BD-rate vs libaom cpu-used 6 / rav1e speed 6:
21+
22+| row | control (09590c10) | arm D |
23+|---|---|---|
24+| film A | +21.0 / −4.8 | +21.0 / −4.8 |
25+| film B | +25.0 / −1.8 | **+24.9 / −1.9** |
26+| screen | +14.5 / −33.2 | +14.5 / −33.2 |
27+| bars 1080p | −1.8 / −17.5 | −2.0 / −17.6 |
28+| bars 2160p | +8.8 / −13.3 | +8.7 / −13.4 |
29+
30+Ships under the charter's THIRD keep rule (a correctness fix flat within ±0.2
31+everywhere): film B improves 0.1 on both columns, both bars rows improve, film
32+A and screen are unmoved. The long-GOP gate is where it reads as a real win:
33+
34+| row | control | arm D |
35+|---|---|---|
36+| film A | +25.2 / −7.1 | **+25.2 / −7.2** |
37+| film B | +87.1 / +7.7 | **+86.7 / +7.3** |
38+
39+Control note: the control was NOT re-run at 09590c10 in this worktree (each row
40+is ~2 min of wall on top of six gate runs). It is corroborated instead -- film A
41+and screen come back byte-identical to the charter's control numbers on the arm
42+row, which a stale control could not do.
43+
44+## arm B — the `tx_size` depth context, REFUTED
45+
46+`tx_depth_bits` priced every block's `tx_depth` symbol at row 0, the row where
47+both neighbours are NARROWER than this block's transform and splitting reads
48+cheapest. Built as lane-ctx's recipe asked, for the key-frame path: the
49+key-frame tile search keeps the same two bands `Neighbours::record_tx`
50+publishes (each coded block's resolved transform side over its own 4x4 units,
51+frame-absolute so a superblock row needs no reset, a losing trial overwritten
52+by the winner's own publish exactly as `above_mode`/`left_mode` are), the
53+context rule itself moved into `tile::tx_size_ctx_of` so writer and pricer read
54+ONE function, and `code_square` takes the row its caller derives.
55+
56+| row | control (arm D) | arm B |
57+|---|---|---|
58+| film A | +21.0 / −4.8 | +21.1 / −4.6 |
59+| film B | +24.9 / −1.9 | +25.0 / −1.9 |
60+| screen | +14.5 / −33.2 | +14.5 / −33.2 |
61+| bars 1080p | −2.0 / −17.6 | −2.0 / −17.6 |
62+| bars 2160p | +8.7 / −13.4 | +8.7 / −13.4 |
63+
64+Every film column moves the wrong way for no win anywhere, so the keep rule is
65+not met and the commit is reverted (`77347164`). The likely reason it costs:
66+this is HALF the fix. An INTER frame's intra block takes its row from the
67+`TXFM_CONTEXT` bands instead (`tx_size_ctx_txfm`, where an inter neighbour
68+votes its own BLOCK size), which the encoder publishes nowhere, so with arm B
69+in, key frames and inter frames judge the same depth-versus-split margin
70+against different rows. What would unblock a second attempt: publish the
71+`TXFM_CONTEXT` band on the inter path too (the `MiGrid` already carries
72+`size`/`is_inter` for the inter-neighbour half) and price BOTH paths at once.
73+
74+## Unit tests
75+
76+* `encode::tests::the_single_ref_pricer_pays_the_writers_own_symbol_sequence`
77+ — extended with the `comp_mode` term and a compound left neighbour (which is
78+ what takes `reference_mode_ctx` off row 0). RED before arm D:
79+ `ref 1 above (None, None) left (None, None): priced 2.0905436498760297 bits,
80+ writer codes 2.5376944668507715`. Green after.
81+* `encode::tests::the_tx_depth_pricer_uses_the_writers_own_context_row` — arm
82+ B's, green while arm B was in, gone with the revert. Recorded here because it
83+ named the thing that limits the whole arm: libaom's default `TX_SIZE_CAT*`
84+ tables give rows 0 and 1 IDENTICAL probabilities, so the only row that moves
85+ a price at all is row 2 (both neighbours at least as wide).
86+
87+## Pins and suite
88+
89+* Stream pins re-taken on arm D: `[(150, 8325, 0xf004_8258_bc60_ff05),
90+ (60, 33014, 0x5bc2_5dfd_bd13_18de)]` (was 8311 / 33087), green at the default
91+ preset and at `EC_AV1_SPEED=6`. No other byte pin went red.
92+* Split suite, release lib, all RC=0: `--skip stream::` 338 passed / 0 failed /
93+ 32 ignored; `stream:: --skip 10bit` 200 / 0 / 15; `10bit` 42 / 0 / 1.
94+ `--ignored
95+ encoder::tests::every_speed_preset_decodes_sample_exact_through_both_decoders`
96+ passed.
97+* `timeout 900 cargo check --workspace --all-targets -j4`: 0 errors, 0 ec-av1
98+ warnings (the workspace's 22 are pre-existing, in ec-opus and ec-vorbis).
99+
100+## Deferred
101+
102+`deferred: the tx_size depth context — the key-frame half is built and
103+measured (arm B above) and LOSES on its own; what unblocks it is the inter
104+half, a TXFM_CONTEXT band published on the inter path so both frame types
105+price the depth symbol at the writer's row at the same time.`
106+
107+`deferred: the MV pricer — write_mv has PER-COMPONENT tables where the pricer
108+has one shared set (the long-standing static-MV approximation); untouched
109+here, as in lane-ctx.`