forge
Explore
Log in

Don't you dare go Hollow

Lane-rectres charter -- non-skip residual on Rect128/Ab128 pieces

Browse files at this commit

fbd2ef1eeaf762643fce8c16a975143825a6b2ccAhmet Kaan GümüşParent: 8fbaba4
  • docs
    • lane-rectres charter -- non-skip residual on Rect128/Ab128 pieces
Show full message
docs(av1): lane-rectres charter -- non-skip residual on Rect128/Ab128 pieces
lanes/rectres.charter.mdadded+92 -0
@@ -0,0 +1,92 @@
1+# lane-rectres — non-skip residual on Rect128/Ab128 pieces
2+
3+GOAL: the Whole128 residual arm (`EC_AV1_B128RES`) is exact but INERT
4+(0.4-1.9 writer fires/frame, re-measured lane-b128res on 3b4673fe) —
5+whole 128 roots almost never win RD. The 128 root's rectangular pieces
6+DO win: lane-b128hv ships HORZ/VERT skip halves and lane-ab128 ships the
7+four AB shapes (`EC_AV1_B128AB=1` default ON). But those pieces are
8+skip-only: `write_inter_block_128_rect` refuses a rect half carrying a
9+residual, and `crate::tile::cdef_unit_owner` (tile.rs) is Whole128-only.
10+This lane turns Rect128 and Ab128 pieces into residual carriers and
11+measures whether RD taking them moves BD.
12+
13+Work ONLY in this worktree (`lane-rectres`,
14+`/home/user/Documents/Code/Rust/edith_codecs-rectres`). Absolute paths
15+only. Never touch main's checkout, never push, never `git checkout
16+<file>`, never repo-wide `cargo fmt`. `export
17+CARGO_TARGET_DIR=$HOME/.cache/cargo-target-rectres` on every cargo
18+command. Logs under `~/.cache/rectres/`. TMPDIR only on gate command
19+lines, not on the sccache server. Gates: `systemd-run --user -p
20+MemoryMax=14G`, `--ignored --exact` on both BD tests (they are
21+`#[ignore]`; without `--ignored` they measure nothing). One gate at a
22+time; record LOADAVG before AND after. Pins 8291 / 33227. Keep rule: one
23+film row ≥0.5 BD down on a column, the other flat within ±0.3, screen
24+not worse by 0.3, wall ≤+15%. Sign: BD-rate, lower better.
25+
26+## 1. Write residual on rect/AB pieces
27+
28+- Lift the refusal in `write_inter_block_128_rect`: a Rect128 half
29+ (HORZ/VERT) or an Ab128 shape piece with a real residual codes its
30+ coefficients like any inter block of that w×h. The decoder side is
31+ spec — `decode_stream` and ffmpeg both already read residual on any
32+ inter partition shape; the burden is on the ENCODER writer and the
33+ encoder reconstruction path being identical.
34+- Knob in the `EC_AV1_*` convention (e.g. `EC_AV1_RECTRES`), default
35+ OFF, gated next to `b128_residual` in encode.rs. OFF = today's
36+ behavior bit-exact.
37+- INVARIANT (lane-edge128's bug class): a 128-wide piece that writes a
38+ residual also codes `cdef_idx` per the syntax it carries, while
39+ `read_cdef` copies ONE literal over every 64x64 unit the piece spans.
40+ Extend `cdef_unit_owner` past Whole128 to the rect/AB shapes so the
41+ CDEF search prices the ONE index the syntax carries, not one per unit.
42+ Skip-only pieces still write no `cdef_idx` — owner map must not fire
43+ for them.
44+- RD side: let the rect/AB search arm price non-skip outcomes (residual
45+ cost) instead of skip-only, under the knob.
46+
47+## 2. Witnesses FIRST (before any BD gate)
48+
49+Add witnesses in the standing pattern (see
50+`a_128_root_block_with_a_real_residual_decodes_exact_through_both_decoders`
51+and `a_128_root_residual_block_under_a_per_unit_cdef_list_decodes_exact`,
52+both `--ignored`, fixture q=60 after lane-b128res re-vitalization):
53+
54+- a Rect128 half with a real residual decodes sample-exact through
55+ ffmpeg AND `decode_stream`, with a `coded > 0` assert as the guard.
56+- same for at least one Ab128 shape.
57+- a rect/AB residual piece spanning multiple CDEF units takes the owner
58+ unit's literal, byte-exact through both decoders (the edge128
59+ interaction, now on rect shapes).
60+
61+If any witness shows an encoder-reconstruction mismatch: STOP, do not
62+ship, report class + path:line, default stays OFF.
63+
64+## 3. Measure
65+
66+Control = default (knob off) on this HEAD. Arm = knob on.
67+
68+- `cargo test -p ec-av1 --release --lib -- --ignored --exact --nocapture
69+ encode::tests::bd_rate_film_long_gop` (deciding). Both films.
70+- 12-frame guard: `encode::tests::bd_rate_screen_native`, all five rows,
71+ control and arm.
72+- Fire census: extend the standing native-arm census line so rect/AB
73+ residual fires (search won / writer coded) print next to the 128-root
74+ census, and report fires/frame per clip like lane-b128res §4. If the
75+ writer still codes ~0 rect/AB residuals, the arm is inert — say so.
76+
77+Keep rule met → default ON, drop the refusal comment. Inert + exact →
78+leave OFF, document fires. Mismatch → OFF, report (see §2).
79+
80+## 4. Pins / suite (only if you change the default)
81+
82+Pins at default and `EC_AV1_SPEED=6`. Workspace check `timeout 900 cargo
83+check --workspace --all-targets -j4` (0 ec-av1 warnings). Do NOT run the
84+full lib suite unless you change the default; if you do, three lanes:
85+`--skip stream::` / `stream:: --skip 10bit` / `10bit`.
86+
87+## DONE
88+
89+Commit on `lane-rectres` + `lanes/rectres.report.md` with EVIDENCE lines
90+(`EVIDENCE: <artifact> | <steps> | <measurement>`), fire counts, BD
91+tables, witness results, disposition `ships-on | stays-off | stopped`.
92+Never merge or push.