forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-rectdq' (5b30b689): the 128 root search prices the delta_q group every non-skipped shape at a superblock origin codes; exact pricer witnessed over the whole domain; BD-neutral, ships as correctness; pins unmoved at 8291 / 33227

Browse files at this commit

e01aa805fcc54f29bf13ba0afece48b500a0c0cbAhmet Kaan GümüşParent: fd1e74a619bdeb
delta_q_bits prices write_delta_q's symbol, escape literals and sign through SymbolEncoder::pricer (a table-entry sum under-priced the escape by 0.43 bits at abs=20: the literal bits are EC_MIN_PROB-floored symbols). Charged on the rect arm's first half, on the NONE arm when not skipped, and on the four-superblock arm; only a skipped whole-128 root is free. The writer's running CurrentQIndex is unknowable in the search, so the previous 128 root's target in raster order stands in. 12-frame film A flat, film B -0.2/-0.2, screen byte-identical; long-GOP film A +0.1/+0.1, film B -0.1/-0.1 (EC_AV1_RECTDQ=0 is the control). Open: the same shape with 128 superblocks off (skipped 64 NONE root free, its quadrant arm not) is unpriced.
crates/ec-av1/src/encode.rsmodified+124 -3
@@ -798,6 +798,93 @@ fn b128_rect() -> bool {
798 ENV.unwrap_or(true) && b128_root()798 ENV.unwrap_or(true) && b128_root()
799 }799 }
800 800
801+/// lane-rectdq: whether the delta_q symbol group is priced on the root
802+/// candidates that really code it. `EC_AV1_RECTDQ=0` is this fix's
803+/// attribution control (the pre-lane pricing, where a 128 rect root and the
804+/// four-superblock arm were both priced as if the group were free).
805+fn rectdq() -> bool {
806+ static ENV: std::sync::LazyLock<Option<bool>> = std::sync::LazyLock::new(|| {
807+ crate::envflags::var("EC_AV1_RECTDQ").ok().map(|v| v != "0")
808+ });
809+ ENV.unwrap_or(true)
810+}
811+
812+/// lane-rectdq: what `crate::tile::write_delta_q` spends to move
813+/// `CurrentQIndex` from `cur` to `target` at `1 << delta_q_res` steps of
814+/// `res` -- the same three pieces that writer codes, in its order: the
815+/// `delta_q_abs` symbol of `min(abs, 3)` against the DEFAULT table (the
816+/// writer's own `cdfs.delta_q`, which every tile arms fresh, adapts from
817+/// exactly this row), the escape literal pair when `abs >= 3`, and the sign
818+/// bit when `abs != 0`. Zero when the plan is disarmed (`res <= 0`).
819+pub(crate) fn delta_q_bits(target: i32, cur: i32, res: i32) -> f64 {
820+ if res <= 0 {
821+ return 0.0;
822+ }
823+ /// spec `DELTA_Q_SMALL`, as in the writer.
824+ const DELTA_Q_SMALL: usize = 3;
825+ let reduced = (target - cur) / res;
826+ let abs = reduced.unsigned_abs() as usize;
827+ // A pricing coder, not a sum of table entries: the escape's literal bits
828+ // are equiprobable SYMBOLS whose narrowing carries the `EC_MIN_PROB`
829+ // floor, so each really costs a little over one bit (class
830+ // `price-the-narrowing-not-the-table`). Read off the same
831+ // `SymbolEncoder::bits` account the writer's own coder keeps.
832+ let mut enc = crate::msac::SymbolEncoder::pricer();
833+ enc.reset_bits();
834+ enc.symbol_fixed(abs.min(DELTA_Q_SMALL), &cdf::DELTA_Q);
835+ if abs >= DELTA_Q_SMALL {
836+ let rem_bits = 31 - ((abs as u32) - 1).leading_zeros();
837+ enc.literal(rem_bits - 1, 3);
838+ enc.literal(abs as u32 - ((1u32 << rem_bits) + 1), rem_bits);
839+ }
840+ if abs != 0 {
841+ enc.literal(u32::from(reduced < 0), 1);
842+ }
843+ enc.bits()
844+}
845+
846+/// [`delta_q_bits`] for the 128 superblock root at `(root_r, root_c)` (in 64
847+/// superblock units): the group every root shape but a SKIPPED
848+/// `PARTITION_NONE` root codes, since decode.rs' `whole_sb` asks for
849+/// `side == write_w == write_h == sb_px` and neither a rect half nor a 64
850+/// superblock under a 128 grid is that.
851+///
852+/// The target is the root's own cell of the `sb_q` grid, exactly the entry
853+/// `write_delta_q` indexes. `CurrentQIndex` is NOT knowable in the search --
854+/// the writer's `plan.cur` only advances at the roots that really code a
855+/// group, and which those are is decided by this very comparison -- so the
856+/// PREVIOUS 128 root's target in raster order stands in for it (the frame's
857+/// `base_q_idx` at the first root of the frame, which is also the writer's
858+/// own per-tile reset). Wrong only where a neighbouring root came out a
859+/// skipped NONE block, and then only by the difference of two adjacent tpl
860+/// cells.
861+fn delta_q_bits_at_root(
862+ sb_q: Option<&Vec<u8>>,
863+ sb_cols: usize,
864+ base_q_idx: u8,
865+ res: i32,
866+ (root_r, root_c): (usize, usize),
867+) -> f64 {
868+ if !rectdq() || res <= 0 {
869+ return 0.0;
870+ }
871+ let Some(q) = sb_q.filter(|q| !q.is_empty()) else {
872+ return 0.0;
873+ };
874+ let at = |r: usize, c: usize| i32::from(q[(r * sb_cols + c).min(q.len() - 1)]);
875+ let target = at(root_r, root_c);
876+ let cur = if root_c >= 2 {
877+ at(root_r, root_c - 2)
878+ } else if root_r >= 2 {
879+ // The last 128 root of the row above, i.e. the previous one in the
880+ // writer's raster walk.
881+ at(root_r - 2, (sb_cols.saturating_sub(1)) & !1)
882+ } else {
883+ i32::from(base_q_idx)
884+ };
885+ delta_q_bits(target, cur, res)
886+}
887+
801 /// How many 128 roots the search left as two 128x64 (HORZ) / 64x128 (VERT)888 /// How many 128 roots the search left as two 128x64 (HORZ) / 64x128 (VERT)
802 /// halves since the last take (class `gate-blind-to-feature`).889 /// halves since the last take (class `gate-blind-to-feature`).
803 static B128_HORZ_HITS: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);890 static B128_HORZ_HITS: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);
@@ -9641,6 +9728,9 @@ fn search_root_128(
9641 sb_cols: usize,9728 sb_cols: usize,
9642 tpl_cells_x: usize,9729 tpl_cells_x: usize,
9643 base_q_idx: u8,9730 base_q_idx: u8,
9731+ // lane-rectdq: `1 << delta_q_res` when this frame codes a delta_q plan,
9732+ // zero when it does not -- what [`delta_q_bits_at_root`] prices with.
9733+ dq_res: i32,
9644 reference: &Picture,9734 reference: &Picture,
9645 // The `LAST` + extra-reference pairs at THIS ROOT's own 32x32-mi window,9735 // The `LAST` + extra-reference pairs at THIS ROOT's own 32x32-mi window,
9646 // built by the caller off the same grid the tile writer rebuilds its9736 // built by the caller off the same grid the tile writer rebuilds its
@@ -9798,8 +9888,16 @@ fn search_root_128(
9798 }9888 }
9799 let after = snapshot(luma, chroma, (x128, y128), SIDE);9889 let after = snapshot(luma, chroma, (x128, y128), SIDE);
9800 restore(luma, chroma, (x128, y128), SIDE, &base);9890 restore(luma, chroma, (x128, y128), SIDE, &base);
9891+ // lane-rectdq: a SKIPPED whole-superblock root is the one shape that
9892+ // codes no delta_q group (`write_delta_q`'s `is_whole_sb && skip`); the
9893+ // residual arm above codes it like every other block does.
9894+ let dq = if block.skip {
9895+ 0.0
9896+ } else {
9897+ delta_q_bits_at_root(sb_q, sb_cols, base_q_idx, dq_res, (root_r, root_c))
9898+ };
9801 Some((9899 Some((
9802- cost + lambda * crate::tile::partition_bits(SIDE, false),9900+ cost + lambda * (crate::tile::partition_bits(SIDE, false) + dq),
9803 lambda,9901 lambda,
9804 block,9902 block,
9805 after,9903 after,
@@ -9836,6 +9934,8 @@ fn search_root_128_rect(
9836 sb_cols: usize,9934 sb_cols: usize,
9837 tpl_cells_x: usize,9935 tpl_cells_x: usize,
9838 base_q_idx: u8,9936 base_q_idx: u8,
9937+ // lane-rectdq: see [`search_root_128`]'s own `dq_res`.
9938+ dq_res: i32,
9839 reference: &Picture,9939 reference: &Picture,
9840 // The `LAST` + extra-reference pairs offered at this root; only the9940 // The `LAST` + extra-reference pairs offered at this root; only the
9841 // reference and its picture are read here, since each HALF derives its9941 // reference and its picture are read here, since each HALF derives its
@@ -9957,8 +10057,13 @@ fn search_root_128_rect(
9957 grid.restore_rect(mi_row, mi_col, SIDE_MI, SIDE_MI, &grid_base);10057 grid.restore_rect(mi_row, mi_col, SIDE_MI, SIDE_MI, &grid_base);
9958 let symbol = if horz { 1 } else { 2 };10058 let symbol = if horz { 1 } else { 2 };
9959 let [b0, b1] = <[BlockCoeffs; 2]>::try_from(halves).ok()?;10059 let [b0, b1] = <[BlockCoeffs; 2]>::try_from(halves).ok()?;
10060+ // lane-rectdq: the FIRST half sits at the root's own mode-info origin and
10061+ // codes the delta_q group whether it is skipped or not
10062+ // (`write_inter_block_128_rect` passes `is_whole_sb = false`); the second
10063+ // half is at a non-origin mi and codes none.
10064+ let dq = delta_q_bits_at_root(sb_q, sb_cols, base_q_idx, dq_res, (root_r, root_c));
9960 Some((10065 Some((
9961- cost + lambda * crate::tile::partition_bits_sym(SIDE, symbol),10066+ cost + lambda * (crate::tile::partition_bits_sym(SIDE, symbol) + dq),
9962 lambda,10067 lambda,
9963 [b0, b1],10068 [b0, b1],
9964 after,10069 after,
@@ -12690,6 +12795,9 @@ pub(crate) fn encode_inter_frame(
12690 header.delta.q_present = true;12795 header.delta.q_present = true;
12691 header.delta.q_res = res.trailing_zeros() as u8;12796 header.delta.q_res = res.trailing_zeros() as u8;
12692 }12797 }
12798+ // lane-rectdq: what the tile writer's own `arm_delta_q` is armed with
12799+ // below, so the root search prices the group the writer really codes.
12800+ let dq_res: i32 = deltaq_res.filter(|_| sb_q.is_some()).unwrap_or(0);
12693 if let Some(g) = &sb_q {12801 if let Some(g) = &sb_q {
12694 let mut levels: Vec<u8> = g.clone();12802 let mut levels: Vec<u8> = g.clone();
12695 levels.sort_unstable();12803 levels.sort_unstable();
@@ -12841,6 +12949,7 @@ pub(crate) fn encode_inter_frame(
12841 sb_cols,12949 sb_cols,
12842 tpl_cells_x,12950 tpl_cells_x,
12843 base_q_idx,12951 base_q_idx,
12952+ dq_res,
12844 reference,12953 reference,
12845 &root_compound,12954 &root_compound,
12846 fctx,12955 fctx,
@@ -12870,6 +12979,7 @@ pub(crate) fn encode_inter_frame(
12870 sb_cols,12979 sb_cols,
12871 tpl_cells_x,12980 tpl_cells_x,
12872 base_q_idx,12981 base_q_idx,
12982+ dq_res,
12873 reference,12983 reference,
12874 &root_compound,12984 &root_compound,
12875 horz,12985 horz,
@@ -13525,8 +13635,19 @@ pub(crate) fn encode_inter_frame(
13525 cands.retain(|c| c.2 == usize::from(forced_ab));13635 cands.retain(|c| c.2 == usize::from(forced_ab));
13526 }13636 }
13527 cands.sort_by(|a, b| a.0.total_cmp(&b.0));13637 cands.sort_by(|a, b| a.0.total_cmp(&b.0));
13638+ // lane-rectdq class sweep: under a 128 superblock grid the FOUR-
13639+ // superblock arm codes the delta_q group too -- the Whole64 writer
13640+ // (tile.rs `sb_coeff_inter_frame_tile_cdfs`, the `write_delta_q` call
13641+ // with `!sb128_armed()`) and every smaller shape below it pass
13642+ // `is_whole_sb = false` under a 128 grid, so the arm's first
13643+ // (root-origin) superblock codes the group even when skipped. Only the skipped 128
13644+ // NONE root escapes it, so the split side is charged here at the same
13645+ // root lambda the candidates are priced with.
13646+ let split_dq =
13647+ delta_q_bits_at_root(sb_q.as_ref(), sb_cols, base_q_idx, dq_res, (root_r, root_c));
13528 if let Some((cost128, lambda128, shape, halves, after)) = cands.into_iter().next()13648 if let Some((cost128, lambda128, shape, halves, after)) = cands.into_iter().next()
13529- && (cost128 < root_cost + lambda128 * crate::tile::partition_bits(128, true)13649+ && (cost128
13650+ < root_cost + lambda128 * (crate::tile::partition_bits(128, true) + split_dq)
13530 // The witness knobs take the root whatever it costs, so the13651 // The witness knobs take the root whatever it costs, so the
13531 // forced block really reaches the writer.13652 // forced block really reaches the writer.
13532 || FORCE_B128_ROOT.load(std::sync::atomic::Ordering::Relaxed)13653 || FORCE_B128_ROOT.load(std::sync::atomic::Ordering::Relaxed)
crates/ec-av1/src/tile.rsmodified+42 -0
@@ -10939,4 +10939,46 @@ mod tests {
10939 "KF_Y_MODE's different probabilities must decode a different mode"10939 "KF_Y_MODE's different probabilities must decode a different mode"
10940 );10940 );
10941 }10941 }
10942+
10943+ /// lane-rectdq witness: [`crate::encode::delta_q_bits`] prices exactly
10944+ /// what [`write_delta_q`] writes, over the whole `delta_q_abs` domain
10945+ /// (0..=20 steps, both signs -- the escape literal pair starts at 3 and
10946+ /// its `rem_bits` widens at 4, 5, 9 and 17). The writer is run into a
10947+ /// PRICING coder whose account (`SymbolEncoder::bits`) is the same
10948+ /// arithmetic-coder cost the pricer's `symbol_bits` sums, so the two
10949+ /// agree to floating-point noise, not to a tolerance band.
10950+ ///
10951+ /// Both sides read the DEFAULT `delta_q` row: the writer's `cdfs` is
10952+ /// rebuilt per case, exactly as every tile's is armed before its first
10953+ /// superblock.
10954+ #[test]
10955+ fn the_delta_q_pricer_matches_the_writer_over_the_whole_domain() {
10956+ const RES: i32 = 4;
10957+ const CUR: i32 = 128;
10958+ for steps in -20i32..=20 {
10959+ let target = CUR + steps * RES;
10960+ arm_delta_q(RES, 1, vec![u8::try_from(target).expect("in range")], 128);
10961+ let mut cdfs = Cdfs::new(2);
10962+ let mut enc = SymbolEncoder::pricer();
10963+ enc.reset_bits();
10964+ // `is_whole_sb = false`: the rect half / 64-superblock shape,
10965+ // the one whose pricer this witnesses.
10966+ write_delta_q(&mut enc, &mut cdfs, (0, 0), false, true);
10967+ let written = enc.bits();
10968+ let priced = crate::encode::delta_q_bits(target, CUR, RES);
10969+ assert!(
10970+ (written - priced).abs() < 1e-9,
10971+ "steps {steps}: writer {written} bits, pricer {priced}"
10972+ );
10973+ }
10974+ // Disarmed plan: the writer codes nothing and the pricer charges
10975+ // nothing.
10976+ arm_delta_q(0, 1, Vec::new(), 128);
10977+ let mut cdfs = Cdfs::new(2);
10978+ let mut enc = SymbolEncoder::pricer();
10979+ enc.reset_bits();
10980+ write_delta_q(&mut enc, &mut cdfs, (0, 0), false, true);
10981+ assert!(enc.bits().abs() < 1e-9, "a disarmed plan writes no symbol");
10982+ assert!((crate::encode::delta_q_bits(200, 128, 0)).abs() < 1e-9);
10983+ }
10942 }10984 }
lanes/rectdq.report.mdadded+131 -0
@@ -0,0 +1,131 @@
1+# lane-rectdq — the 128 rect root pays for the delta_q group it codes
2+
3+Branch `lane-rectdq` off main 748e4328. Class name: **pricer omits a group the
4+writer codes** (sibling of `pricer-context-zero`: there the pricer priced the
5+right tree at the wrong context, here it priced a tree with a whole symbol
6+group missing).
7+
8+## The defect
9+
10+`crate::tile::write_delta_q` codes its symbol group for every block that sits
11+at its superblock's mode-info origin, with ONE exception: a block that is the
12+whole superblock AND is skipped (`if is_whole_sb && skip { return }`), which
13+mirrors decode.rs' `whole_sb = (side == write_w == write_h == sb_px)`.
14+
15+So at a 128 superblock root:
16+
17+| root shape | codes the delta_q group? | was it priced? |
18+|---|---|---|
19+| `PARTITION_NONE`, skipped | no | n/a (correct) |
20+| `PARTITION_NONE`, residual (`EC_AV1_B128RES`) | yes | NO |
21+| `PARTITION_HORZ`/`VERT` halves (first half only) | yes | NO |
22+| four 64 superblocks under a 128 grid (first cell) | yes | NO |
23+
24+The rect arm and the split arm were both under-priced by the group's bits on
25+every root of every frame that arms a delta_q plan (preset 0 has objective tpl
26+delta_q on, `DQ_TPL_K`) — the rect arm was measured against a NONE arm that
27+really is free, so it looked cheaper than it is. The class sweep
28+(`grep -n write_delta_q crates/ec-av1/src/tile.rs`) found the four writer sites
29+beyond the two 128 ones (Whole64 at `!sb128_armed()`, the 32 square, and both
30+inter leaves); under a 128 grid every one of them passes `is_whole_sb = false`,
31+which is why the four-superblock arm is charged here too.
32+
33+## The fix
34+
35+* `encode::delta_q_bits(target, cur, res)` — the writer's own three pieces in
36+ the writer's order, priced through a `SymbolEncoder::pricer` rather than a
37+ sum of table entries, because the escape's literal bits are equiprobable
38+ SYMBOLS carrying the `EC_MIN_PROB` floor and cost a little over one bit each
39+ (class `price-the-narrowing-not-the-table`; a table-entry sum was 0.43 bits
40+ light at `abs = 20`).
41+* `encode::delta_q_bits_at_root(...)` — the charge at one 128 root: the target
42+ is the root's own `sb_q` cell, exactly the entry `write_delta_q` indexes.
43+ **Stated approximation:** the writer's `CurrentQIndex` (`plan.cur`) is not
44+ knowable in the search — it only advances at the roots that really code a
45+ group, and which those are is what this very comparison decides — so the
46+ PREVIOUS 128 root's target in raster order stands in for it (`base_q_idx` at
47+ the first root, which is also the writer's per-tile reset). Wrong only where
48+ a neighbouring root came out a skipped NONE block, and then only by the
49+ difference between two adjacent tpl cells.
50+* Charged in `search_root_128_rect` for the FIRST half only (the second half
51+ sits at a non-origin mi and codes no group — `write_inter_block_128_rect`,
52+ tile.rs:517), in `search_root_128` only when the block is NOT skipped, and on
53+ the four-superblock side of the root comparison.
54+* `EC_AV1_RECTDQ=0` is the attribution control (pre-lane pricing).
55+
56+## Witness
57+
58+`tile::tests::the_delta_q_pricer_matches_the_writer_over_the_whole_domain`
59+enumerates the domain — `delta_q_abs` steps -20..=20, both signs, `res = 4` —
60+running `write_delta_q` into a pricing coder and comparing its `bits()` account
61+against `delta_q_bits`. Agreement is exact (`< 1e-9`), plus the disarmed case.
62+
63+ cargo test -p ec-av1 --release --lib -- --exact \
64+ tile::tests::the_delta_q_pricer_matches_the_writer_over_the_whole_domain
65+
66+Result: ok, 1 passed.
67+
68+## Gates (lower BD = better; control = `EC_AV1_RECTDQ=0`, arm = default)
69+
70+12 frames, `encode::tests::bd_rate_screen_native`, all five rows
71+(`~/.cache/rectdq/s.log`):
72+
73+| row | vs libaom ctl → arm | vs rav1e ctl → arm | wall ours ctl → arm |
74+|---|---|---|---|
75+| bars 1080p | -3.4% → **-3.5%** | -19.0% → **-19.1%** | 186.2s → 189.2s |
76+| bars 2160p | +8.4% → +8.4% | -14.0% → -14.0% | 160.2s → 181.4s |
77+| film A | +18.0% → +18.0% | -6.3% → -6.3% | 177.6s → 179.1s |
78+| film B | +23.0% → **+22.8%** | -3.5% → **-3.7%** | 155.9s → 138.5s |
79+| screen capture | +14.4% → +14.4% | -33.2% → -33.2% | 144.6s → 106.9s |
80+
81+48 frames, `encode::tests::bd_rate_film_long_gop` (`~/.cache/rectdq/g.log`):
82+
83+| row | vs libaom ctl → arm | vs rav1e ctl → arm | wall ours ctl → arm |
84+|---|---|---|---|
85+| film A (`EC_AV1_NATIVE_FILM=1`) | +21.9% → +22.0% | -8.6% → -8.5% | 655.6s → 698.9s |
86+| film B (`EC_AV1_NATIVE_FILM4K=1`) | +75.8% → **+75.7%** | +0.8% → **+0.7%** | 494.1s → 464.7s |
87+
88+Wall: every row inside +15% (the +13% on bars 2160p and +6.6% on long-GOP film
89+A are contention — two gate units shared the box, and the arm's own film B rows
90+came out FASTER on both gates; the search does one extra pricer call per root).
91+
92+**Keep rule, honestly:** not met as written. No row goes >=0.5 down. The arm is
93+BD-NEUTRAL: the largest move in either direction is 0.2 (12f film B, down on
94+both columns), long-GOP film B is 0.1 down on both, long-GOP film A is 0.1 UP
95+on both, screen is byte-identical. It ships default-on as a CORRECTNESS fix
96+(the pricer now prices the tree the writer writes, witnessed exactly), not as a
97+win; the b128hv "+0.1 on the 12-frame film rows" premise this lane was chartered
98+from is not explained by the missing group — the group is worth ~2-9 bits a
99+root against roots costing thousands.
100+
101+## Pins
102+
103+`encode::tests::the_encoders_own_streams_are_byte_identical_to_their_pins` PASS
104+at default and at `EC_AV1_SPEED=6` — the pins did NOT move (the pin fixtures
105+arm no delta_q plan, so `delta_q_bits_at_root` returns 0 there).
106+`encoder::tests::every_speed_preset_decodes_sample_exact_through_both_decoders`
107+PASS; `encode::tests::a_128_root_horz_and_vert_halves_decode_exact_through_both_decoders`
108+PASS (`~/.cache/rectdq/p.log`).
109+
110+## Suite
111+
112+Three detached lanes, all green (`~/.cache/rectdq/t.log`):
113+
114+* `cargo test -p ec-av1 --release -j4 -- --skip stream::` — 346 passed, 0 failed, 39 ignored (460s)
115+* `... -- stream:: --skip 10bit` — 202 passed, 0 failed, 15 ignored (927s)
116+* `... -- 10bit` — 42 passed, 0 failed, 1 ignored (66s)
117+* `timeout 900 cargo check --workspace --all-targets -j4` — 0 errors, 0 ec-av1 warnings (the only warnings are the pre-existing ec-vorbis `decode_capture` and ec-opus ones).
118+
119+## Deviations from the charter
120+
121+1. The charter's gate commands omit `--ignored`; both BD tests are `#[ignore]`,
122+ so `--ignored` was added or they would have filtered out silently.
123+2. The 12-frame gate was run WITHOUT `EC_AV1_NATIVE_FILM*` (one run per arm
124+ covering all five rows) instead of two per-film runs: the same two film rows
125+ plus the screen row the keep rule asks for, at half the runs.
126+3. The charge is made on the four-superblock arm as well as on the rect arm
127+ (charter item 2's class sweep) — charging only the rect arm would have
128+ biased the comparison toward SPLIT, which codes the same group. Both are
129+ under the single `EC_AV1_RECTDQ` knob.
130+4. The unit witness lives in `tile.rs`'s test module (it needs the private
131+ `write_delta_q`), not in `encode.rs`.