forge
Explore
Log in

Don't you dare go Hollow

Re-take the encoder's own stream pins after the pricer context fixes

Browse files at this commit

4ec79bcb37cb5e0b20ac3c647f5a17c714d7a959Ahmet Kaan GümüşParent: 628f49e
  • test
    • re-take the encoder's own stream pins after the pricer context fixes
Show full message
test(av1): re-take the encoder's own stream pins after the pricer context fixes
crates/ec-av1/src/encode.rsmodified+6 -1
@@ -16072,8 +16072,13 @@ mod tests {
1607216072 // reference through the tree and the neighbour contexts the writer
1607316073 // really codes it with, so every inter picture's reference decisions
1607416074 // move -- 8562 -> 8535 at q=150 and 33357 -> 33221 at q=60.
16075+ // Re-taken on lane-ctx: the RD pricer reads the writer's own contexts
16076+ // for `skip`/`is_inter` and for the whole compound reference tree, so
16077+ // every inter block's cost -- and with it the skip and reference
16078+ // decisions -- moved: 8535 -> 8311 bytes at q=150 and 33221 -> 33087
16079+ // at q=60.
1607516080 let pins: [(u8, usize, u64); 2] =
16076- [(150, 8535, 0x7b7f_4eeb_1080_7b45), (60, 33221, 0x720b_821e_5dd2_90e4)];
16081+ [(150, 8311, 0xfb6d_75a4_5d13_3833), (60, 33087, 0x4d11_a03c_bdc6_e2d5)];
1607716082 let coded: Vec<(u8, usize, u64)> = pins
1607816083 .iter()
1607916084 .map(|&(q, _, _)| {
lanes/ctx.report.mdadded+25 -0
@@ -0,0 +1,25 @@
1+# lane-ctx — the RD pricer's remaining context-zero sites
2+
3+Class: `pricer-context-zero`. lane-pricer fixed `single_ref_bits`; the sweep it
4+left named the rest. This lane took them.
5+
6+## 1. Enumeration — every `symbol_bits(&cdf::` site in `crates/ec-av1/src/encode.rs`
7+
8+| pricer site (encode.rs) | writer (tile.rs) | how the writer picks the context | verdict |
9+|---|---|---|---|
10+| `SKIP[0]` — `code_square_inter`, `search_skip_64`'s `fixed`, the b64 `unskip` term, `search_inter_block` | `enc.symbol(block.skip, &mut cdfs.skip[skip_ctx])` (4 sites: 6275/6673/6936/7189) | `above_skip[mi_c] + left_skip[mi_r]` | **arm A — FIXED** (`skip_bits_at`) |
11+| `INTRA_INTER[0]` — same four functions | `cdfs.intra_inter[ii_ctx]` (6284/6681/6944/7196) | `intra_inter_ctx(has_above, has_left, above_inter, left_inter)` | **arm A — FIXED** (`intra_inter_bits_at`) |
12+| `TX_SIZE_CAT0..3[0]` — `tx_depth_bits` (5 call sites in `code_square`) | `write_luma_select` / var-tx twin (4343/4436) | `Neighbours::tx_size_ctx(at_mi, max_tx)` = above/left published transform side >= this block's `max_tx`, and `tx_size_ctx_txfm` on the var-tx path | **arm B — DEFERRED** (see §5) |
13+| `COMP_MODE[0]` (3 sites) | `write_comp_mode` (1154) | `reference_mode_ctx(above_nbr, left_nbr)` | **arm C — FIXED** |
14+| `COMP_REF_TYPE[0]` (3) | `write_compound_ref_frames` (856) | `comp_reference_type_ctx(above, left)` | **arm C — FIXED** |
15+| `COMP_REF[0][0]=0`, `[0][1]=0` (3) | 889 / 899 | `single_ref_p3_ctx` / `single_ref_p4_ctx`; value right only because compound `ref0` is always LAST | **arm C — FIXED** (real pair) |
16+| `COMP_BWDREF[0][0]=1` (3) | 905 / 910 | `single_ref_p2_ctx`, then `single_ref_p6_ctx` when `ref1 != ALTREF` | **arm C — FIXED**: the constant priced BWDREF/ALTREF2 as ALTREF and dropped p6 |
17+| `UNI_COMP_REF[0][0]=0,[0][1]=1,[0][2]=1` (3) | 862 / 876 / 881 | `single_ref_p1_ctx` / `uni_comp_ref_p1_ctx` / `single_ref_p5_ctx` | **arm C — FIXED**: the constants priced every forward partner as GOLDEN |
18+| `SINGLE_REF[p*_ctx]` | `write_single_ref` | its own `single_ref_p*_ctx` | already fixed (lane-pricer) |
19+| `TXFM_PARTITION[ctx(..)]`, `DRL_MODE[stack.drl_ctx[..]]`, `NEW_MV`/`ZERO_MV`/`REF_MV`/`INTER_COMPOUND_MODE`, `ANGLE_DELTA[mode - V_PRED]`, `UV_MODE_CFL[mode]`, `Y_MODE[SIZE_GROUP_32]`, `FILTER_INTRA_MODE` | — | already the writer's own context/row | no change |
20+| `MV_JOINT`/`MV_SIGN`/`MV_CLASS`/`MV_BIT`/`MV_FR`/`MV_CLASS0_*` | `write_mv` | writer has PER-COMPONENT tables where the pricer has one shared set | out of this lane (long-standing static-MV approximation) |
21+
22+Open, found while enumerating: the single-reference candidates pay **no**
23+`comp_mode = 0` term at all while the compound ones pay `comp_mode = 1`, so
24+compound is still overcharged by `comp_mode(0)` relative to single. Left alone
25+here so arm C measures one thing.