forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

intertx.report.md258 lines, 13.8 KiBHistoryRawDownload
1# lane-intertx — the inter tx-type search on film (chroma inheritance made honest)
2
3Base: `810d8972` (charter). Fix commit: `9af60b4d`. Regression fix + report
4commit: this one. Disposition: **stays-off**
5(`crate::speed::TX_TYPE_SEARCH_INTER` keeps `Screen` at presets 0-6; the keep
6rule's deciding column fails at best -0.1 against the required -0.5), but the
7lane's correctness work is real and committed: the chroma inheritance desync
8was LIVE and is fixed, the wider inter search is reachable and honest on
9`reduced_tx_set = 0` frames, and on screen content the fix itself measures
10-0.7/-0.4 BD against the pre-lane standing table. Pins untouched at
118291 / 33227 (default non-screen streams byte-identical; pin test re-run
12green). Never merged, never pushed.
13
14## 1. The chroma inheritance desync: LIVE, fixed
15
16The wider inter search (`inter_tx_type_candidates`' seven-type `INTER_WIDE`
17list) was unreachable: `inter_luma_set` named only the plain `Luma*Inter`
18sets, so the `Set1` arms were dead code. The refusal reason lane-txi recorded
19(the refs lane's DPB bookkeeping) was already known wrong; the real blocker
20was `refusal-from-own-desync` in the CHROMA inheritance:
21
22- (a) the encoder never set `FrameCtx::reduced_tx_set_inter` on the shared
23 frame context, so `recode_inter_chroma`'s
24 `reduce_inherited_chroma_tx_type` reduced against a STALE allowance —
25 whatever the previous frame's own trial decode had last left in the cell —
26 while a `reduced_tx_set = 0` frame's decoder allows the full set;
27- (b) `tile::write_block_planes` coded every chroma plane as `DCT_DCT`.
28 Chroma codes no `tx_type` symbol, but the type names the transform class,
29 and the class picks the scan, the `eob_pt` row and the neighbour contexts
30 (`write_coeffs`' lane-txw note) — so an inherited 1-D type desynced the
31 chroma exactly as luma once did.
32
33Fix (commit `9af60b4d`): (a) `encode_inter_frame` sets
34`fctx.reduced_tx_set_inter` from the frame's own header bit the moment it is
35decided (`header.reduced_tx_set = !wide_tx_set(screen)`); (b) the writer
36derives each inter block's chroma type from the first luma unit's coded type
37via the new `decode::reduce_inherited_chroma_tx_type_flagged` against
38`Cdfs::reduced_tx_set` — the frame's own honest bit — and codes chroma with
39it; the search names the Set1 sets through `luma_set_for` (the intra search's
40own shape) at both the flat and the split-unit trial, so every candidate is
41priced in the alphabet its symbol is coded into. All six
42`write_block_planes` callers now pass the block's inter flag; intra chroma
43rides `DCT_DCT`'s 2D class exactly as before.
44
45Witness `encoder::tests::a_non_screen_inter_clip_codes_a_one_d_type_both_decoders_read_every_plane_exactly`
46(process-global `set_inter_tx_search(Some(true))` + `set_wide_tx_set(Some(true))`
47+ `force_screen(Some(false))` under `knob_write`, 320x192 moving
48steps/ramps/plateaus, gop 4, q 90): the inter search WON and CODED
49non-`DCT_DCT` types on the non-screen clip, and ALL THREE planes read
50sample-exact through `decode_stream` AND ffmpeg at every frame.
51
52EVIDENCE: ~/.cache/intertx/witness-green.log | --ignored --exact --nocapture
53run of the witness on `9af60b4d` | "inter wide-set witness: inter hits
54[200, 979, 3, 97, 111, 40, 521, 0, ...], 8143 bytes" — coded>0 guards pass
55for `IDTX` (200) and for the 1-D types (`V_DCT`=40 + `H_DCT`=521); all three
56planes identical to ffmpeg on all four frames. ok.
57
58RED run (desync live): with the widening applied and fix (b) neutralized —
59chroma coded `DCT_DCT` unconditionally, the pre-lane writer — the same encode
60FAILS inside its own trial decode: the reader inherits the 1-D chroma type
61the writer refused to code with, the tile desyncs, and the derail surfaces as
62"a reference frame selected with no picture at this frame's own
63ref_frame_idx slot" (class `refusal-from-own-desync`, not a real ref defect).
64
65EVIDENCE: ~/.cache/intertx/witness-red.log | same witness, fix (b) probe
66removed | FAILED: trial-decode refusal aborts the encode at flush.
67
68Standing witnesses re-run green on the fixed HEAD: the wide witness now codes
691-D inter units on its screen card too (`V_DCT`=41, `H_DCT`=405, `IDTX`=702
70of 1305) and reads every frame exact; the two-type inter witness passes.
71
72EVIDENCE: ~/.cache/intertx/standing-witnesses.log | --ignored --exact and
73default runs | "a_wide_tx_set_clip... ok", "an_inter_clip... ok".
74
75## 2. Long-GOP BD (deciding; 48 pictures, gop=48, both films, server-1)
76
77Control = default (lever `Screen`), arm = `EC_AV1_TXSET_INTER=all`, same HEAD
78`9af60b4d`, same ladder (`encode::tests::bd_rate_film_long_gop`,
79`--ignored --exact`). BD-rate, lower better:
80
81| row | ctrl vs libaom | ctrl vs rav1e | arm vs libaom | arm vs rav1e |
82|---|---|---|---|---|
83| film A (1080p) 1920x768 | +20.9% | -9.0% | +20.8% | -9.1% |
84| film B (2160p HDR) 1920x1024 | +70.4% | -2.2% | +70.3% | -2.1% |
85
86Arm-minus-control: film A -0.1/-0.1, film B -0.1/+0.1. The control
87reproduces the standing table (b128res-era film A +20.9/-9.0, film B
88+70.4/-2.2) to the digit on a different HEAD.
89
90Wall ours: film A 1314.7s -> 1395.1s (+6.1%), film B 1031.5s -> 1074.0s
91(+4.1%). LOADAVG 0.28/0.35/0.20 before, 1.30/1.20/1.11 after (control);
920.93/1.12/1.09 before, 1.12/1.10/1.09 after (arm).
93
94EVIDENCE: ~/.cache/intertx/longgop-control.log | gate 2 control, server-1,
95MemoryMax=5G, `systemd-run --user` | film A +20.9%/-9.0%, film B
96+70.4%/-2.2%; census 100.0% `DCT_DCT` on both films. ok.
97EVIDENCE: ~/.cache/intertx/longgop-arm.log | gate 2 arm, EC_AV1_TXSET_INTER=all |
98film A +20.8%/-9.1%, film B +70.3%/-2.1%. ok.
99
100## 3. 12-frame native guard (all five rows, server-1)
101
102`encode::tests::bd_rate_screen_native`, control and arm:
103
104| row | ctrl vs libaom | ctrl vs rav1e | arm vs libaom | arm vs rav1e |
105|---|---|---|---|---|
106| bars 1080p | -3.3% | -19.0% | -3.5% | -19.0% |
107| bars 2160p | +8.4% | -13.9% | +8.5% | -13.8% |
108| film A | +17.9% | -6.3% | +17.8% | -6.4% |
109| film B | +22.6% | -3.8% | +22.7% | -3.7% |
110| screen capture | +13.7% | -33.6% | +13.7% | -33.6% |
111
112The screen row is byte-identical between control and arm (same PSNR/bytes at
113every point, same census) — exactly the charter's prediction: the search is
114already on for screen frames, so `All` can add nothing there.
115
116Wall ours: bars 1080p 396.2s -> 411.1s (+3.8%), bars 2160p 336.3s -> 358.1s
117(+6.5%), film A 350.9s -> 371.0s (+5.7%), film B 301.4s -> 309.8s (+2.8%),
118screen capture 226.1s -> 225.1s (-0.4%). LOADAVG 0.88/1.05/1.07 before,
1191.07/1.14/1.11 after (control); 0.91/1.10/1.10 before, 1.12/1.13/1.09 after
120(arm).
121
122Screen-content attribution note: the control screen row against the
123b128res-era standing table moved +14.4% -> +13.7% (libaom) and -33.2% ->
124-33.6% (rav1e). That delta is THIS lane's fix reaching the screen default:
125the widened inter candidates are now offered to screen frames at preset 0,
126where the lever already said `Screen`, and the census shows the new types
127coding (below). Cross-HEAD comparison, so attribution is indicative only.
128
129EVIDENCE: ~/.cache/intertx/native-control.log | gate 3 control, five rows |
130table above, control columns; three-way exactness held at every clip x q x
131frame. ok.
132EVIDENCE: ~/.cache/intertx/native-arm.log | gate 3 arm, EC_AV1_TXSET_INTER=all |
133table above, arm columns. ok.
134
135## 4. Inter tx-type census (search won / coded, per clip)
136
137Non-`DCT_DCT` share of COMMITTED inter luma units (the census names types
138that were really coded), arm runs:
139
140| clip | inter units | coded non-DCT_DCT | share |
141|---|---|---|---|
142| film A long-GOP | 1468708 | 35618 `IDTX` | 2.4% |
143| film B long-GOP | 1250132 | 41586 `IDTX` | 3.3% |
144| bars 1080p 12f | 115907 | 21033 `IDTX` | 18.1% |
145| bars 2160p 12f | 83614 | 20634 `IDTX` | 24.7% |
146| film A 12f | 330189 | 7311 `IDTX` | 2.2% |
147| film B 12f | 310009 | 7002 `IDTX` | 2.3% |
148| screen capture 12f | 59731 | 1080 `IDTX` + 266 `ADST_ADST` + 346 `ADST_DCT` + 187 `DCT_ADST` + 455 `V_DCT` + 1572 `H_DCT` | 6.5% |
149
150Controls: 100.0% `DCT_DCT` on every non-screen clip (lever off there);
151screen capture control already carries the wider alphabet (the fix's doing).
152With `all`, film takes only the two-type set's `IDTX` (2.2-3.3%) — the
153arm is INERT ON FILM, the same 0-to-small band the b128res arm showed.
154Every one of these units decoded three-way exact (encoder == ffmpeg ==
155decode_stream) at every q point of every run — the gates' standing
156exactness assertion covers the whole census, native resolution, both films
157and all five native rows.
158
159## 5. Keep rule — NOT met
160
161One film row >=0.5 BD down on a column: best delta anywhere is -0.1 (film A
162long-GOP and 12-frame; native bars rows are not film). Other film row flat
163within +/-0.3: yes (max 0.1). Screen not worse by 0.3: yes (byte-identical).
164Wall <= +15%: yes (max +6.5%). The deciding column fails at -0.1 against the
165required -0.5: `IDTX` at 2-3% of film units buys a tenth of a point. The
166lever stays `Screen` at every preset; `speed.rs` is untouched.
167
168## 6. Pins, witnesses, scope
169
170- Pins `encode::tests::the_encoders_own_streams_are_byte_identical_to_their_pins`:
171 re-run green on `9af60b4d` — `(150, 8291, 0x1f00bb0eb099a27f)` and
172 `(60, 33227, 0x57ee6b1f8eacd881)` stand. The pin fixture is the non-screen
173 h264 clip, where the fix changes nothing by construction (the widened
174 candidates need `reduced_tx_set = 0`, which only screen frames code at the
175 default preset). No pin re-take.
176
177EVIDENCE: ~/.cache/intertx/pins.log | default-preset pin run on 9af60b4d |
178ok, both pins byte-identical.
179
180- server-1 provisioning verified before the first gate: filmA-gate.mkv 8833494
181 bytes, filmB-gate.mkv 195927872 bytes, no partial files.
182- Gate recipe deviations from charter §3 (all recorded): `systemd-run`
183 needs `-p WorkingDirectory=` (the unit does not inherit the shell's cwd),
184 `PATH`/`CARGO_TARGET_DIR` must be set INSIDE the unit (a
185 `bash -lc` wrapper), and the synced repo's `.git` was a stale worktree
186 pointer file that broke the memguard runner's `git rev-parse` — replaced
187 with a fresh `git init` on the server. One gate at a time throughout.
188- Not verified: nothing in the charter's scope is unverified. The
189 three-lane lib suite and `cargo check --workspace --all-targets` were NOT
190 run — charter §2 requires them only on the keep-rule-met (ships-on)
191 branch; the stays-off branch carries the scoped local checks (ec-av1 lib
192 + tests compile warning-free; the three tx witnesses; the pin test) and
193 project-wide validation stays with the main agent. `FLIPADST` family and
194 the 1-D ADSTs remain unoffered (the standing lane-txi deferral).
195
196## 7. Regression caught by the merge tier: the raw-tile decode wrapper's
197## stale `reduced_tx_set`
198
199Main's regression tier caught three `decode::tests` failures on the lane
200HEAD (`a_gop_round_trips_bit_exact_against_the_encoder_reconstruction`,
201`an_odd_size_gop_round_trips_bit_exact_against_the_encoder_reconstruction`,
202`ffmpeg_and_this_decoder_agree_on_a_gop`), all refusing with "a reference
203frame selected with no picture at this frame's own ref_frame_idx slot".
204
205Root cause (class: **test asserts against a stale header** -- the wrapper's
206own parameter docs document five prior instances of exactly this class):
207`decode::decode_inter_frame_tile_lr`, the raw-tile decode helper the GOP
208round-trip tests use, hard-coded `reduced_tx_set: true`
209(`decode.rs:34552` at the fix commit's parent) with the comment "this
210wrapper's callers are the decoder's own tests, which all code the reduced
211sets". True until this lane: no inter block ever inherited a non-`DCT_DCT`
212chroma type. With the widened inter search live, a screen-detected GOP at
213the default preset codes `reduced_tx_set = 0` frames whose inter luma takes
214`V_DCT` (the traces show the first inter block at (0,0) 16x16 winning
215exactly that), and the chroma inheritance reduces the inherited type
216against the very bit the wrapper guessed: the test's decode derived
217`DCT_DCT` from `inh=Some(V_DCT)` at chroma 8x8 where the writer coded
218`V_DCT`, desynced, and the garbage symbols eventually read a ref_frame_idx
219that names an empty slot -- the named refusal is downstream noise, the
220first divergence is the chroma type.
221
222Fix (this commit): the wrapper takes the frame's own
223`reduced_tx_set: bool` (placed before `tx_select`, mirroring the plural
224fn), `Encoded` carries the bit (`encode.rs`, the `screen`/`tx_select`
225pattern), the GOP tests and the key-frame tile test (`stream.rs`, whose
226"our own encoder always writes `reduced_tx_set: true`" comment had the
227same latent stale-header bug) pass the honest value.
228
229Why the gates and witnesses did not see it: every production decode path
230(`stream.rs`'s parser, `decode_stream`, ffmpeg) reads the bit off the wire
231honestly -- the gates' three-way exactness and all witnesses ride those.
232Only the raw-tile test helper guessed.
233
234Encoder output is UNCHANGED by the fix: the diff touches the `Encoded`
235metadata struct, the test-facing decode wrappers and one test call -- no
236writer or search code (tile.rs is not in the fix diff at all), and the
237three witnesses code byte-identical streams after it (8143 / 8211 bytes,
238same census). The server-1 BD tables in sections 2-4 remain valid; no gate
239re-run needed.
240
241EVIDENCE: ~/.cache/intertx/regression-repro.log | the three tests on the
242unfixed lane HEAD | 3 failed, all with the named refusal.
243EVIDENCE: ~/.cache/intertx/regression-fix.log | the three tests + the pin
244test after the fix | 4 passed.
245EVIDENCE: ~/.cache/intertx/witness-rerun.log | all three tx witnesses
246re-run after the fix | byte-identical streams (8143 / 8211 bytes), ok.
247
248## 8. Full suite and workspace check (post-fix)
249
250Three-lane lib suite LOCALLY on the fix commit, `--release --lib`:
251`--skip stream::` 348 passed / 0 failed; `stream:: --skip 10bit` 202
252passed / 0 failed; `10bit` 42 passed / 0 failed -- **592 passed, 0
253failed**. `timeout 900 cargo check --workspace --all-targets -j4`: 0
254ec-av1 warnings (the 25 workspace warnings are ec-opus's, pre-existing).
255
256EVIDENCE: ~/.cache/intertx/suite-lane1.log | --skip stream:: | 348 passed.
257EVIDENCE: ~/.cache/intertx/suite-lane2.log | stream:: --skip 10bit | 202 passed.
258EVIDENCE: ~/.cache/intertx/suite-lane3.log | 10bit | 42 passed.