forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-l2' (da856b88): LAST2's deciding long-GOP table filled on the current substrate -- the machinery already shipped in lane-last2; arm measures film A +20.9/-9.0 -> +20.6/-9.1 and film B +70.4/-2.2 -> +70.3/-2.1 against a to-the-digit control, LAST2 codes 0.5-1.1% of film blocks, keep rule not met (best -0.3) so EC_AV1_LAST2 stays off; the stale 'week of wall' doc premise retired; pins unmoved at 8291 / 33227

Browse files at this commit

03b25c74961d636a3e42a12651a99166eafd8a31Ahmet Kaan GümüşParent: da2b9281100a98
crates/ec-av1/src/encode.rsmodified+12 -9
@@ -21044,15 +21044,18 @@ mod tests {
21044 eprintln!("PARITY q={q} bytes={} fnv1a={hash:016x} speed={} pyramid {:?} effective {:?}",21044 eprintln!("PARITY q={q} bytes={} fnv1a={hash:016x} speed={} pyramid {:?} effective {:?}",
21045 e.stream.len(), crate::speed::speed(), crate::encoder::Pyramid::from_env(), last_sequence_pyramid());21045 e.stream.len(), crate::speed::speed(), crate::encoder::Pyramid::from_env(), last_sequence_pyramid());
21046 }21046 }
21047- /// lane-refs: IS A SECOND PAST REFERENCE WORTH RETAINING? `encoder.rs`'s21047+ /// lane-refs/lane-last2: IS A SECOND PAST REFERENCE WORTH RETAINING? The
21048- /// `ref_frame_idx` maps `LAST2`/`LAST3` onto `LAST`'s own DPB slot, so no21048+ /// lever this census priced SHIPS since lane-last2 (merge `321b2dc1`):
21049- /// block can predict from the picture before `LAST` -- while rav1e's ARFs21049+ /// `EC_AV1_LAST2` (default OFF) retains a second past leaf picture in
21050- /// read LAST@-4 plus LAST2@-8 and libaom holds up to seven distinct21050+ /// `LEAF_SLOTS`, names it `ref_frame_idx[1]`, and offers it to the 32x32
21051- /// pictures. Building that (a second retained slot, the search offering21051+ /// search with its own `NEWMV` (`EC_AV1_LAST2_NEW`); the ARF-level lags
21052- /// it, a witness, a second motion search per block) is a week of wall on21052+ /// the census's far row measures were already banked by `arf_altref`.
21053- /// the stage that already owns most of the encode, so this census prices21053+ /// This census stays the PRICING arm (class `gate-blind-to-feature`): its
21054- /// the lever FIRST (class `gate-blind-to-feature`, "count how often the21054+ /// best-of-two SAD shares are read against the fire share the gate census
21055- /// feature would fire before building the machine").21055+ /// prints (`references ... LAST2 n (n%)`) and the refutation in
21056+ /// `lanes/last2.report.md` §4 -- a pure-SAD best-of-two over-counts the
21057+ /// lever by more than an order of magnitude once NEAR/NEAREST/DRL off
21058+ /// `LAST`, the backward `ALTREF`, and the rate term price in.
21056 ///21059 ///
21057 /// The measurement is on the gate's own window and loader (`gate_crop`,21060 /// The measurement is on the gate's own window and loader (`gate_crop`,
21058 /// 12 pictures) of the two real films: every 16x16 luma block of every21061 /// 12 pictures) of the two real films: every 16x16 luma block of every
lanes/l2.charter.mdadded+88 -0
@@ -0,0 +1,88 @@
1+# lane-l2 — re-judge LAST2 on the current substrate: the deciding long-GOP gate
2+
3+GOAL: LAST2 is a second retained past reference (`LAST2_FRAME` naming its own
4+DPB slot instead of aliasing `LAST`'s). The machinery SHIPS at base `a8f2186a`
5+from lane-last2 (merge `321b2dc1`): `EC_AV1_LAST2` knob default OFF
6+(`encoder.rs` `last2()` / `const LAST2 = false`), leaf chain alternating
7+`LEAF_SLOTS = [0, 7]` with `leaf_hist` carried across mini-GOPs,
8+`ref_frame_idx[1]` + per-slot `sign_bias`/`order_hints` coding, the 32x32
9+`extra` search offer with LAST2's own `NEWMV` search
10+(`EC_AV1_LAST2_NEW=0` = search-free arm), the RD pricer's LAST2 leaf, and the
11+witness `a_leaf_predicts_off_last2_when_the_picture_two_back_matches`. What
12+lane-last2 NEVER measured: the long-GOP gate (its handover: "No long-GOP arm
13+was run because nothing ships"), and its 12-frame refutation predates
14+lane-intertx / lane-rectres / lane-tplhalf — the RD landscape moved. This lane
15+re-judges the lever on the current substrate, on the gates the keep rule
16+actually reads, and either flips the default or documents the standing
17+refutation with the deciding table filled in.
18+
19+Work ONLY in this worktree (`lane-l2`,
20+`/home/user/Documents/Code/Rust/edith_codecs-l2`). Absolute paths only.
21+Never touch main's checkout, never push, never `git checkout <file>`, never
22+repo-wide `cargo fmt`. `export
23+CARGO_TARGET_DIR=$HOME/.cache/cargo-target-l2` on every cargo command. Logs
24+under `~/.cache/l2/`. Gates on server-1 (`user@host-e`) per
25+`skill://ec-av1-remote-gate-runners`: repo `/home/user/gates/repo-l2`, target
26+`/home/user/gates/target-l2`, `systemd-run --user -p MemoryMax=5G`,
27+`--ignored --exact` FULL test paths, one gate at a time, LOADAVG before AND
28+after, logs tee'd under `~/.cache/l2/`. Pins 8291 / 33227. Keep rule: one film
29+row ≥0.5 BD down on a column, the other flat within ±0.3, screen not worse by
30+0.3, wall ≤+15%. Sign: BD-rate, lower better.
31+
32+## 1. Charter / census ground truth
33+
34+- Commit this charter first.
35+- The stale premise in `encode.rs` `last2_census`'s doc comment (~L21048,
36+ "no block can predict from the picture before LAST ... a week of wall") is
37+ OBSOLETE — the machinery exists and is default-off. Refresh it to name what
38+ ships and where the lever's measurement lives (clean cutover: no comment
39+ claiming a gap the code no longer has).
40+- The per-lag SAD census (`last2_census`, `--ignored`) is the arm that priced
41+ the lever (`refs.report.md` §1: leaf best-of-two removes 6.99% film A /
42+ 7.25% film B of SAD energy; ARF row already banked by `arf_altref`). Re-run
43+ it on the current HEAD if the real films are reachable locally; cite the
44+ numbers next to the fire share.
45+- The gate census already prints LAST2's real share
46+ (`references LAST n LAST2 n GOLDEN n ALTREF n of m inter blocks (LAST2 %)`,
47+ `encode.rs` `bd_rate_screen_native`, one `take_ref_frame_hits()` read, no
48+ drain-then-read). Keep it; every arm row must show it.
49+
50+## 2. Witnesses FIRST (before any BD gate)
51+
52+- Re-run `encoder::tests::a_leaf_predicts_off_last2_when_the_picture_two_back_matches`
53+ locally (release): it must show the lever OFF coding 0 LAST2 blocks and ON
54+ coding a real count (>0 — the `gate-blind-to-feature` guard), and both
55+ decoders (`decode_stream` AND ffmpeg) sample-exact.
56+- OFF must stay today's behavior bit-exact: the pins test stays green with
57+ the knob untouched (8291 / 33227).
58+
59+If any witness shows an encoder-reconstruction mismatch: STOP, do not gate,
60+report class + path:line, default stays OFF.
61+
62+## 3. Measure (server-1, per the skill recipe)
63+
64+Control = default (knob off), arm = `EC_AV1_LAST2=1`, same HEAD. Sanity gate
65+FIRST: the control must reproduce the standing table within ±0.2/cell
66+(long-GOP film A +20.9/-9.0, film B +70.4/-2.2; native rows per
67+`lanes/rectres.report.md` §3b off columns), else STOP and report substrate
68+suspicion.
69+
70+- `encode::tests::bd_rate_film_long_gop` (deciding; both films in one run).
71+- `encode::tests::bd_rate_screen_native` (all five rows).
72+- Census share per clip from both arm logs; walls ours off→on; LOADAVG pairs.
73+
74+## 4. Keep rule
75+
76+Met → default ON at the measured presets + pins at default and
77+`EC_AV1_SPEED=6` + three-lane lib suite LOCALLY
78+(`--skip stream::` / `stream:: --skip 10bit` / `10bit`) +
79+`timeout 900 cargo check --workspace --all-targets -j4` (0 ec-av1 warnings).
80+Not met → default stays OFF, document. Mismatch → OFF, report (see §2).
81+
82+## DONE
83+
84+Commits on `lane-l2` (charter, code-if-any, report) +
85+`lanes/l2.report.md` with EVIDENCE lines
86+(`EVIDENCE: <artifact> | <steps> | <measurement>`), disposition
87+`ships-on | stays-off | stopped`, BD tables both gates, LAST2 census share per
88+clip, walls, LOADAVG pairs, pins line. Never merge or push.
lanes/l2.report.mdadded+185 -0
@@ -0,0 +1,185 @@
1+# lane-l2 — re-judge LAST2 on the current substrate: the deciding long-GOP gate
2+
3+Base: `a8f2186a` (lane-l2 worktree). Disposition: **stays-off** — on the
4+deciding gate the lever was never in the keep rule's reach (best delta
5+anywhere is -0.3 BD, the rule asks ≥0.5), it fires for real but tiny
6+(0.5-1.1% of inter blocks on the films, 0.0% on bars 2160p and screen), and
7+it costs +4.4-9.7% encoder wall. The machinery from lane-last2 (merge
8+`321b2dc1`) stays behind `EC_AV1_LAST2` (default OFF = today's behavior bit
9+for bit — the control reproduces the standing table to the digit on four of
10+five native rows and both long-GOP rows). Pins untouched at 8291 / 33227 (no
11+default change, so no pin run, no lib suite). Never merged, never pushed.
12+
13+## 0. What this lane actually was (the stale premise, corrected)
14+
15+The task text priced the lever from `last2_census`'s doc comment, which still
16+claimed `ref_frame_idx` aliases `LAST2` onto `LAST`'s slot and called the
17+build "a week of wall". That premise was STALE at the base: lane-last2
18+already shipped the whole machine — `EC_AV1_LAST2` knob (default OFF,
19+`encoder.rs` `last2()`/`const LAST2 = false`), the leaf chain alternating its
20+refresh over `LEAF_SLOTS = [0, 7]` with `leaf_hist` carried across mini-GOPs,
21+`ref_frame_idx[1]` + per-slot `sign_bias`/`order_hints` coding, the 32x32
22+`extra` search offer with LAST2's own `NEWMV` (`EC_AV1_LAST2_NEW`), the RD
23+pricer's LAST2 leaf, the OBMC picture table, the trial-decode `RefPix` slot,
24+the witness, and the gate census line. What lane-last2 NEVER measured: the
25+long-GOP gate (its own handover: "No long-GOP arm was run because nothing
26+ships"), and its 12-frame refutation predates lane-intertx/lane-rectres/
27+lane-tplhalf. So this lane re-ran the per-lag SAD census, re-witnessed, and
28+filled in the deciding table on server-1; the only source change needed was
29+retiring the stale doc comment itself.
30+
31+## 1. What shipped (commits `eaf64ec4`, `eeae0580`)
32+
33+- `lanes/l2.charter.md` — this lane's charter, committed first.
34+- `encode.rs` `last2_census` doc comment rewritten: it now states what ships
35+ (the lever is real, `EC_AV1_LAST2`, leaf chain, 32x32 offer with its own
36+ NEWMV), that the census stays the PRICING arm, and that its best-of-two SAD
37+ shares over-count the lever by more than an order of magnitude once
38+ NEAR/NEAREST/DRL off `LAST`, the backward `ALTREF`, and the rate term price
39+ in — pointing at `last2.report.md` §4's refutation and the gate census's
40+ fire share. Comment-only; no behavior change.
41+- No other source change: the charter's build steps (1) DPB slot, (2) search
42+ offer + own motion search, (3) witness, (4) census share — were all
43+ already in the base and are measured here as they shipped.
44+
45+## 2. Witnesses (all local, release, BEFORE any gate)
46+
47+- `encoder::tests::a_leaf_predicts_off_last2_when_the_picture_two_back_matches`
48+ PASS in 1.53 s: lever OFF codes LAST 101 / **LAST2 0** / GOLDEN 18 /
49+ ALTREF 3 (2933 B); lever ON codes LAST 54 / **LAST2 40** / GOLDEN 16 /
50+ ALTREF 0 (2449 B) — the census/counter guard (`off == 0`, `on >= 8`)
51+ proves the blocks were really CODED off LAST2 and that OFF is today's
52+ behavior; `decode_stream` AND ffmpeg both reconstruct all nine display
53+ positions sample-exact; one `show_existing_frame` per hidden frame.
54+ EVIDENCE: ~/.cache/l2/witness.log | cargo test --release --lib --
55+ a_leaf_predicts_off_last2_when_the_picture_two_back_matches --nocapture |
56+ "off: ... LAST2 0 ... on: ... LAST2 40 ...", ok, both decoders exact.
57+ LOADAVG 1.57/1.17/1.11 before, 1.52/1.17/1.11 after (1.6 s run).
58+- `encode::tests::the_encoders_own_streams_are_byte_identical_to_their_pins`
59+ PASS in 4.85 s at the default (knob untouched): OFF is bit-exact at the
60+ pins. EVIDENCE: local run, pins test ok, 8291 / 33227 unchanged.
61+- Per-lag SAD census `encode::tests::last2_census` re-run on this HEAD,
62+ reproduces `refs.report.md` §1 EXACTLY (deterministic): film A leaf 6.99% /
63+ ARF 10.31%, film B leaf 7.25% / ARF 8.38% of prediction SAD removed by
64+ best-of-two. The pricing census is unchanged and the refutation stands:
65+ pure-SAD over-counts the lever ~an order of magnitude (38% of blocks by
66+ SAD vs 0.5-1.1% coded once rate, NEAR/NEAREST/DRL and the backward ALTREF
67+ price in). EVIDENCE: ~/.cache/l2/sad-census.log | --ignored --exact
68+ encode::tests::last2_census | table identical to refs.report §1, 2.63 s.
69+
70+## 3. BD measurement (server-1 user@host-e, per the skill recipe)
71+
72+Repo `/home/user/gates/repo-l2`, target `/home/user/gates/target-l2`,
73+rsync of worktree `eeae0580` (`--exclude /fixtures/ /target/ /.git/`),
74+fixtures symlink, `rm -f .git && git init -q`, warm release compile 56.5 s.
75+Four gates run STRICTLY serially by one remote chain
76+(`/home/user/gates/gate-chain-l2.sh`): control = `EC_AV1_LAST2=0`, arm =
77+`EC_AV1_LAST2=1`, same HEAD, `MemoryMax=5G`, ffmpeg PATH shim, `--ignored
78+--exact` full test paths, per-gate logs on the server and copied to
79+`~/.cache/l2/`.
80+
81+Sanity gate PASSED: the control reproduces the standing table within the
82+±0.2/cell requirement — long-GOP film A +20.9/-9.0 and film B +70.4/-2.2 TO
83+THE DIGIT, native rows bars 1080p -3.3/-19.0, bars 2160p +8.4/-13.9, film A
84++17.9/-6.3, film B +22.6/-3.8 TO THE DIGIT. The fifth native row reads
85++13.7/-33.6 where `rectres.report.md` §3b records +14.4/-33.2 — exactly the
86+screen-default improvement lane-intertx's merge (`c736be2c`) documents
87+("+14.4 -> +13.7"), which this HEAD contains; against the corrected standing
88+number the row reproduces to the digit too. This is a documented base change,
89+not substrate suspicion.
90+
91+### 3a. Long-GOP BD (deciding; 48 pictures, gop=48, both films)
92+
93+BD-rate, lower better:
94+
95+| row | off vs libaom | off vs rav1e | on vs libaom | on vs rav1e | wall ours off->on |
96+|---|---|---|---|---|---|
97+| film A (1080p) 1920x768 | +20.9% | -9.0% | +20.6% | -9.1% | 1398.2s -> 1479.8s (+5.8%) |
98+| film B (2160p HDR) 1920x1024 | +70.4% | -2.2% | +70.3% | -2.1% | 1100.9s -> 1156.8s (+5.1%) |
99+
100+EVIDENCE: ~/.cache/l2/lg-control.log | server-1 gate, MemoryMax=5G, ffmpeg shim
101+PATH | film A +20.9%/-9.0%, film B +70.4%/-2.2% (== standing table to the
102+digit), LAST2 0.0% both films; test ok (exactness assertions held at every
103+clip x q x frame). Service runtime 52m07.6s. LOADAVG 0.52/0.45/0.23 before,
104+1.26/1.19/1.11 after.
105+EVIDENCE: ~/.cache/l2/lg-arm.log | server-1 gate, EC_AV1_LAST2=1 |
106+film A +20.6%/-9.1%, film B +70.3%/-2.1%; LAST2 1289 of 235454 (0.5%) film A,
107+2358 of 220341 (1.1%) film B. Service runtime 54m25.0s. LOADAVG
108+1.26/1.19/1.11 before, 1.06/1.11/1.09 after.
109+
110+### 3b. 12-frame native guard (all five rows)
111+
112+| row | off vs libaom | off vs rav1e | on vs libaom | on vs rav1e | wall ours off->on |
113+|---|---|---|---|---|---|
114+| bars 1080p | -3.3% | -19.0% | -3.4% | -19.0% | 423.1s -> 451.8s (+6.8%) |
115+| bars 2160p | +8.4% | -13.9% | +8.4% | -13.9% | 353.6s -> 388.0s (+9.7%) |
116+| film A | +17.9% | -6.3% | +17.7% | -6.5% | 370.0s -> 389.8s (+5.4%) |
117+| film B | +22.6% | -3.8% | +22.6% | -3.8% | 317.4s -> 332.1s (+4.6%) |
118+| screen capture | +13.7% | -33.6% | +13.7% | -33.6% | 235.7s -> 241.4s (+2.4%) |
119+
120+EVIDENCE: ~/.cache/l2/nat-control.log | server-1 gate, five rows | table above
121+"off" columns; four rows == the standing table to the digit, screen row ==
122+the intertx-corrected standing number. Service runtime 34m31.7s. LOADAVG
123+1.06/1.11/1.09 before, 1.08/1.13/1.11 after.
124+EVIDENCE: ~/.cache/l2/nat-arm.log | server-1 gate, five rows, EC_AV1_LAST2=1 |
125+table above "on" columns; screen row byte-identical to control (LAST2 0
126+coded there). Service runtime 36m20.9s. LOADAVG 1.08/1.13/1.11 before,
127+1.09/1.13/1.09 after.
128+
129+### LAST2 census share per clip (the arm runs' gate census)
130+
131+| clip | LAST2 / inter blocks | share |
132+|---|---|---|
133+| film A long-GOP (192 frames) | 1289 / 235454 | 0.5% |
134+| film B long-GOP (192 frames) | 2358 / 220341 | 1.1% |
135+| bars 1080p (48 frames) | 134 / 21474 | 0.6% |
136+| bars 2160p (48 frames) | 0 / 14557 | 0.0% |
137+| film A 12f (48 frames) | 330 / 53433 | 0.6% |
138+| film B 12f (48 frames) | 326 / 48822 | 0.7% |
139+| screen capture (48 frames) | 0 / 11162 | 0.0% |
140+
141+The lever FIRES on real film and is NOT a dead knob (the counter is read
142+once per clip by `take_ref_frame_hits` — no drain-then-read), it is simply
143+chosen by ~1 block in 150 on the long-GOP films, and the screen clip never
144+takes it.
145+
146+## 4. Keep rule — NOT met; disposition
147+
148+- One film row ≥0.5 BD down on a column: best delta anywhere is -0.3 (film A
149+ long-GOP vs libaom; -0.2 on the 12-frame film A row). FAILS.
150+- Other film row flat within ±0.3: yes (-0.1/+0.1).
151+- Screen not worse by 0.3: yes (byte-identical, 0.0).
152+- Wall ≤+15%: yes (+2.4% to +9.7%).
153+
154+The deciding clause fails on the gate that decides — consistent with
155+lane-last2's 12-frame refutation at its older base, now confirmed on the
156+current substrate with the long-GOP table filled in. Default stays OFF; no
157+pin run, no three-lane suite (the default did not flip); the pins themselves
158+were re-verified green at the default locally, and the OFF path's bit-exactness
159+is additionally proven by the control reproducing the standing table to the
160+digit. `fix-now | deferred(<unblock>) | accepted`: nothing deferred — the
161+charter's measurement is complete; the arm stays parked behind `EC_AV1_LAST2`
162+(witnessed, census-visible). A future change that makes the older picture
163+worth MORE (e.g. a prediction lever that specifically prices lag-2 content)
164+re-runs the same four gates, not the census.
165+
166+## 5. Procedure notes (for the next lane on server-1)
167+
168+- A sequential multi-gate chain script on the server (one systemd-run unit per
169+ gate, `--wait`, per-gate log files, LOADAVG before/after each unit echoed
170+ into one chain log) keeps "one gate at a time" honest across a ~3 h batch
171+ without a babysitting ssh session; the four gates cost 52m/54m/35m/36m.
172+- A control row may legitimately differ from the standing table where a
173+ MERGED default changed it — diff the delta against the merge message's own
174+ recorded number (here intertx's "+14.4 -> +13.7") before declaring
175+ substrate suspicion. Reproduce-to-the-digit everywhere else is what makes
176+ the one moving row attributable.
177+- `--ignored --exact` needs the full test path even for the diagnostic
178+ censuses (`encode::tests::last2_census`, not `last2_census`).
179+
180+## 6. Non-goals respected
181+
182+Main checkout untouched, never pushed/merged, no repo-wide formatters (the
183+only source commit is a comment block, `git show eeae0580` is 12+/9-), media
184+files read-only, one gate at a time on server-1 (serial chain, LOADAVG pairs
185+recorded), logs under ~/.cache/l2/ and /home/user/gates/logs/.