forge
Explore
Log in

Don't you dare go Hollow

The two cells, the discriminator run, the ablation that separates H1 from 4e151813, and the retraction inside this lane

Browse files at this commit

c3cf7c0e66326f7e87243ee0a9bd6e7ea29ef8a3Ahmet Kaan GümüşParent: 5aa9f3d
  • docs
    • the two cells, the discriminator run, the ablation that separates H1 from 4e151813, and the retraction inside this lane
Show full message
docs(av1444edge): the two cells, the discriminator run, the ablation that separates H1 from 4e151813, and the retraction inside this lane
lanes/av1444edge.report.mdadded+357 -0
@@ -0,0 +1,357 @@
1+# lane-av1444edge — the two 4:4:4 cells the chroma-format sweep handed over
2+
3+**Base** `4155c7c7`. **Branch** three commits on top of it, in this order:
4+
5+| commit | what | owner |
6+|---|---|---|
7+| `dc35d607` | the inter-frame pre-filter rung (`EC_AV1_PREFILT_WIDE_DUMP`) did not exist, and its counter restarted — **measurement only, no decode-path edit, merges independently of everything else here** | this lane |
8+| `e10a3b25` | cherry-pick `-x` of `f92776ba`, lane-av1444rect's H1 fix — **not mine**; see §5 | Agent04-2 |
9+| `a9e5034e` | the gate + the two pinned fixtures | this lane |
10+
11+Both cells the sweep handed over are **one class, and the fix already
12+existed on another lane's branch**. The work here is the discriminator
13+run the sweep said it did not have, plus the rung defect that made the
14+discriminator run necessary, plus the matrix correction in §6.
15+
16+---
17+
18+## 1. The two cells, pinned
19+
20+Both are the sweep's own §6.2 recipes, byte-reproduced. The truncated
21+sha256 prefixes the sweep recorded (`c87ac65b…`, `06621606…`) both
22+match, so these are the same bytes it measured.
23+
24+| cell | fixture | bytes | sha256 |
25+|---|---|---|---|
26+| 4:4:4 odd coded dims 130x122 | `fixtures/444_lossy_rect4_odd_130x122.obu` | 8945 | `c87ac65b77579afd2938669b0cbe3ec44c3abf775c0223cacb9d14b8c2eee27c` |
27+| "4:4:4 superres" 256x128 | `fixtures/444_lossy_rect4_wide_256x128.obu` | 15239 | `06621606c11ae805f784a1c9736db6301a925a4fa3154e2fc38db1df7ad9b826` |
28+
29+Recipe (both arms; `W`/`H` = 130/122 and 256/128):
30+
31+```text
32+ffmpeg -f lavfi -i "testsrc2=size=<W>x<H>:rate=25" -frames:v 4 \
33+ -pix_fmt yuv444p -strict -1 -f yuv4mpegpipe - | \
34+aomenc --codec=av1 --passes=1 --end-usage=q --cq-level=20 --cpu-used=2 \
35+ --threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 \
36+ --limit=4 --obu -o - -
37+```
38+
39+`rate=25` is load-bearing (`testsrc2`'s pattern is time-parameterised).
40+Both streams: 4 decode-order frames, 0 hidden, single tile, ss (0,0),
41+8-bit, profile 1, `use_superres=false` on all four frames (see §6).
42+
43+Measured against the instrumented aomdec (`EC_AV1_FINAL_DUMP`, decode
44+order), asserting equal frame COUNTS and equal per-frame byte LENGTHS
45+before any sample is read:
46+
47+| | 130x122 | 256x128 |
48+|---|---|---|
49+| base `4155c7c7` | frames 0-2 **EXACT**, frame 3 11521 samples, first (f3, s2208) = **Y(128,16)** ours 134 / oracle 170 | frames 0-1 **EXACT**, frame 2 25296 first **Y(192,0)** ours 92 / oracle 106, frame 3 51108 first Y(0,0) |
50+
51+Both numbers are the sweep's, exactly.
52+
53+---
54+
55+## 2. The class, and how it was separated from the other candidate
56+
57+Two candidate fixes were on the table and the two cells are evidence for
58+exactly one of them.
59+
60+| arm (each `git reset --hard 4155c7c7` + a verified rebuild) | 130x122 | 256x128 |
61+|---|---|---|
62+| base | DIVERGENT f3 11521 | DIVERGENT f2 25296 + f3 51108 |
63+| base + rung + `4e151813` | DIVERGENT f3 11521 — **byte-identical to base** | DIVERGENT f2 25296 + f3 51108 — **byte-identical** |
64+| base + rung + `f92776ba` | **EXACT 4/4** | **EXACT 4/4** |
65+| base + rung + both | EXACT 4/4 | EXACT 4/4 |
66+
67+**The class is H1, `f92776ba` (lane-av1444rect).** `4e151813` is inert
68+here, and the code says why rather than leaving it to the numbers: it
69+patches only the two `tu_reach` call sites in `decode_rect4_16_strip`,
70+and both sit inside that function's `if lossless_pair {` arm. The lossy
71+path is the `} else if skip {` at `decode.rs:17579`. These two cells are
72+4:4:4 **lossy** cq-20, so they are structurally out of its reach.
73+
74+**Class statement.** `decode_inter_block`'s `around_c` gathered a 1:4
75+(HORZ_4 / VERT_4) inter strip's chroma coefficient context at the 4:2:0
76+PAIR extent — `(16, 8)` HORZ / `(8, 16)` VERT — with no `ss` gate. At
77+4:4:4 `is_chroma_reference` (`av1_common_int.h:1454`) reduces both parity
78+clauses to `!subsampling_y` / `!subsampling_x`, so every block is its own
79+chroma reference and no pair exists: the strip codes its own 16x4 chroma
80+over its own context. The gather read one extra luma mi row of LEFT
81+chroma context, the U unit's `get_txb_ctx` saw a neighbour libaom does
82+not have, and the arithmetic coder forked.
83+
84+What the two new geometries add over the existing H1 gate (128x96): a
85+partial-frame right edge (130x122 — neither dimension a multiple of 8,
86+and the sweep's own odd-dimension gate is 4:2:0 only, so the 4:4:4
87+partial-column walk had no exactness evidence anywhere), and 256x128 with
88+CDEF and loop restoration both live on the last two frames. 66x66 is
89+EXACT at the same settings, which is what made the sweep call the
90+partial-frame walk "right at one odd geometry and wrong at another" — it
91+is not the geometry, it is whether the stream codes a 1:4 inter strip.
92+
93+### 2a. A retraction inside this lane
94+
95+An earlier version of the table above said `4e151813` alone was
96+sufficient. **It was not, and the arm never ran.** The tree was reset
97+with `git checkout -- <files>`, which restores from the INDEX — and after
98+`git cherry-pick -n` the index still held the second pick, so the arm
99+re-measured the both-commits tree, and cargo saw byte-identical sources
100+so it did not even relink. The wrong table was sent to two peers, one of
101+whom had already written it into their report; both were told within the
102+hour and the retracted version is recorded in their report as retracted.
103+The table above is the re-run. Kept here because the failure is the
104+lesson: **the dangerous measurement is the one that returns a number.**
105+Two agents hit the same class independently the same session (mine via a
106+stale index, Agent13-2's via a "fix" worktree that was itself a merge of
107+two commits).
108+
109+---
110+
111+## 3. Localizing, because the discriminator is the reusable part
112+
113+**The pre-loop-filter reconstruction already diverges at the identical
114+first sample as the final output**, on both cells (130x122 frame 3 at
115+Y(128,16); 256x128 frame 2 at Y(192,0)). No filter is involved, so the
116+deblock/CDEF/LR ladder is not where this lives — and that verdict was
117+only reachable because of the rung fix in §4. Before it, the nearest
118+usable rungs were unreadable: `EC_AV1_POSTDEBLOCK_DUMP` /
119+`EC_AV1_POSTCDEF_DUMP` came out 61440 B against the oracle's 52224 B
120+(our 160x128 padded surface vs its 136x128 aligned buffer), and the
121+oracle's POSTDEBLOCK wrote 3 files for a 4-frame stream.
122+
123+**Order the wrong superblocks by DECODE order, not raster.** Raster order
124+puts the first wrong sample at Y(192,0) (SBcol3/SBrow0). Decode order
125+puts it in **SBcol2/SBrow0**, first wrong pixel **(128,48) = mi(12,32)**,
126+with **zero** wrong pixels in any superblock decoded before it.
127+
128+**And the block at mi(12,32) has IDENTICAL mode, ref0 and mv0 on both
129+sides.** The `EC_MODE` ladder (compared per decode-order frame, ours
130+split by `EC_PICT`, the oracle's by `aomdec --limit`) agrees through its
131+first 175 entries of frame 2 and then forks on the very next block,
132+mi(13,32):
133+
134+```text
135+AOM mi_row=12 mi_col=32 mode=13 ref0=1 mv0=(-32,0) stack=1
136+OUR mi_row=12 mi_col=32 mode=13 ref0=1 mv0=(-32,0) stack=1 <- same
137+AOM mi_row=13 mi_col=32 mode=13 ref0=1 mv0=(-32,0) stack=2
138+OUR mi_row=13 mi_col=32 mode=13 ref0=4 mv0=(-32,0) stack=2 <- ref0 LAST vs GOLDEN
139+```
140+
141+After the fork the ladder is garbage: 226 entries against the oracle's
142+299 in frame 2, 40 against 361 in frame 3.
143+
144+**A wrong pixel cannot cause a mode fork.** Mode context is built from
145+mode info, not from reconstructed samples. So one bsize/footprint error
146+has to feed both symptoms, and it is upstream of the pixels rather than a
147+consequence of them. That argument is what rules out "the reconstruction
148+diverged, therefore the chroma context followed".
149+
150+**What the ladder could not have told me:** `EC_MODE`'s print carries no
151+`bsize`, so a partition or block-size fork is invisible to it by
152+construction. Nor is its `rng` field a cross-decoder invariant here
153+(libaom's 16-bit `ec.rng` against a 15-bit `log2` range) — only the
154+semantic fields compare. The oracle's `EC_PART` rung prints 4x4 mi while
155+ours prints 16x16-PIXEL units at the sub-node levels, so positions do not
156+compare either; the read-VALUE sequences do, and over the key frames they
157+agree. Our `EC_PART` rung is also key-frame-path only, so it says nothing
158+about these inter frames at all.
159+
160+---
161+
162+## 4. The rung fix (`dc35d607`, measurement only)
163+
164+`EC_AV1_PREFILT_WIDE_DUMP` is the only rung that writes the
165+pre-loop-filter reconstruction cropped to each plane's mi-ALIGNED extent
166+— the shape aomdec's rung 7 writes (`y_width`/`y_height`) — so it is the
167+rung that separates "already wrong in reconstruction" from "introduced by
168+a loop filter". Two defects, both reporting success:
169+
170+1. **It was inlined in the key-frame tile path only.** The inter-frame
171+ path had no wide prefilter dump at all.
172+2. **Its counter was a function-local `static IDX2`.** Rust gives each
173+ monomorphisation its own copy, so the index restarted and every frame
174+ after the first overwrote `.f0` — a per-frame bisection silently
175+ compared the LAST decoded frame and reported it as frame 0. Measured
176+ directly: before the change the rung wrote exactly one file for a
177+ four-frame stream.
178+
179+Now: a shared `dump_prefilter_wide` called from both tile paths, beside
180+each path's existing padded `EC_AV1_PREFILT_DUMP` so the two agree on the
181+point they sample, indexed by the process-global per-var `dump_stage_idx`
182+map. After the change both cells produce 4 files at exactly the oracle's
183+byte count. No decode-path behaviour changes: every write stays inside the
184+existing `if let Ok(path) = crate::envflags::var(...)` arm, which is off
185+unless the env var is set.
186+
187+Agent04-2 has flagged this to Main as standalone and mergeable
188+independently. It should not wait on the rest of this lane.
189+
190+---
191+
192+## 5. Ownership — this is a handback, not a new fix
193+
194+The fix is `f92776ba`, cherry-picked here with `-x` so the merge is
195+idempotent and the branch is green. **Agent04-2 owns it.** What this lane
196+contributes beyond the cherry-pick:
197+
198+- the discriminator run the sweep said it did not have, and the ablation
199+ that separates H1 from the other candidate;
200+- two geometries H1 did not cover, with red-before on both, so the class
201+ is no longer a single-geometry claim;
202+- the rung fix, which is what made the discriminator run possible;
203+- the matrix correction in §6.
204+
205+The fixtures deliberately sit **next to the gate that fixes them**, not
206+next to a gate that does not (Agent13-2's explicit preference, and the
207+right call: they invite exactly the misattribution §2a records).
208+
209+---
210+
211+## 6. Matrix correction: "4:4:4 superres" is not a superres cell
212+
213+**`--superres-mode=1` without `--superres-denominator` scales nothing.**
214+The sweep's recipe omitted the denominator, so it was left to the
215+encoder's energy heuristic — `get_superres_denom_for_qindex`
216+(`av1/encoder/superres_scale.c:143`) returns `SCALE_NUMERATOR` unless
217+the frame is a KF/ARF update and the horizontal-energy test passes, and
218+on a smooth `testsrc2` source it chose 8. Parsed from the stream, all
219+four frame headers of `444_lossy_rect4_wide_256x128.obu` carry:
220+
221+```text
222+FH0 frame=256x128 upscaled=256 use_superres=false denom=8
223+```
224+
225+(through `FH3`). The cell was a plain 4:4:4 lossy cq-20 stream wearing a
226+superres label — the same family as the sweep's own §6.0 trap 2, which
227+caught `--tile-rows=1` being a no-op at 256x128.
228+
229+With an explicit denominator the cell is real and **byte-exact 4/4**:
230+
231+```text
232+ffmpeg -f lavfi -i "testsrc2=size=256x128:rate=25" -frames:v 4 \
233+ -pix_fmt yuv444p -strict -1 -f yuv4mpegpipe - | \
234+aomenc --codec=av1 --passes=1 --end-usage=q --cq-level=20 --cpu-used=2 \
235+ --threads=1 --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 \
236+ --limit=4 --superres-mode=1 --superres-denominator=12 \
237+ --superres-kf-denominator=12 --obu -o - -
238+```
239+
240+14808 B, sha256 `450caa3e31526a8973b9f64d5030a2f11b87bd60fac07aef121cb62af9bf85ff`;
241+all four headers `frame=171x128 upscaled=256 use_superres=true denom=12`;
242+`predict_scaled_hits=2130`, `scaled leaf8=83 sub8=372`, so scaled MC
243+really ran. Verdict: **4/4 decode-order frames byte-exact vs aomdec**,
244+measured on `a9e5034e`'s parent (`dc35d607` + `f92776ba`) with no
245+4:4:4-specific fix involved beyond H1.
246+
247+So the sweep's §1 matrix row `4:4:4 / superres / 8-bit` should read
248+**exact, not D**, and the cell needed a denominator to be a cell at all.
249+A 36-point sweep over {testsrc2, noise, smptebars} x cq {0,10,20,30} x
250+denominator {9,12,16} found a scaled 4:4:4 stream in every combination
251+once the denominator is given.
252+
253+Not gated: the recipe is a hand-quoted flag set with no pinned fixture
254+here, and the eight committed superres gates are 4:2:0. Recorded as the
255+open item rather than closed with a gate I have not mutation-proved.
256+
257+---
258+
259+## 7. Gate and its red-before
260+
261+`a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries`
262+(`crates/ec-av1/src/stream.rs`). Per arm it asserts:
263+
264+- the pinned bytes — length and FNV-1a-64 (my FNV implementation was
265+ validated against the sibling gate's published pair, 6441 B /
266+ `0x4368_8b2d_2e91_72b0`, before being used on new bytes);
267+- a non-zero **DELTA** of 1:4 inter strips. `inter16_rect4_counters()` is
268+ process-wide with no reset, so an absolute count would be a
269+ non-vacuity assertion that passes on residue from another stream in a
270+ full-suite run. Measured deltas: 28 and 76.
271+- `decode::rect4_inter_own_chroma444_hits() > 0` — the corrected route
272+ demonstrably ran. Measured: 12 and 24.
273+- the 4:4:4 full-resolution chroma shape (`f.u.len() == w * h`), so the
274+ compare cannot stand in for the shape claim;
275+- 4 frames, the claimed dimensions, and every decode-order frame
276+ byte-exact through `decode_all_frames_vs_oracle`.
277+
278+**Green** (`--nocapture`, `EC_AV1_REQUIRE_AOMENC=1`, no SKIP line):
279+
280+```text
281+a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries:
282+ fixtures/444_lossy_rect4_odd_130x122.obu 4 decode-order frame(s) (0 hidden)
283+ byte-exact vs aomdec, 12 own-extent 1:4 chroma gather(s), 28 1:4 inter strip(s)
284+ fixtures/444_lossy_rect4_wide_256x128.obu 4 decode-order frame(s) (0 hidden)
285+ byte-exact vs aomdec, 24 own-extent 1:4 chroma gather(s), 76 1:4 inter strip(s)
286+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 704 filtered out
287+```
288+
289+**Red before, by mutation on this gate's own arms.** The `ss_x == 0`
290+own-extent arm was pointed back at the 4:2:0 `(16, 8)` pair extent, with
291+the counter left firing so the run goes red on the PIXEL compare and not
292+on a "counter is zero" assertion:
293+
294+```text
295+panicked at crates/ec-av1/src/stream.rs:8469:
296+a_444_lossy_rect4_strip_stream_decodes_pixel_exact_at_odd_and_wide_geometries:
297+ decode-order frame 3 of 4 (4 shown, 0 hidden) differs from the oracle at
298+ byte 4260 (ours 0 vs 38), 9203 bytes differ
299+test result: FAILED. 0 passed; 1 failed
300+```
301+
302+The same mutation measured by hand on both arms: 256x128 goes to 76404
303+samples with first wrong Y(192,0) — the sweep's exact number — and
304+130x122 to 9203 with first wrong Y(100,32). Note the mutation changes
305+the first wrong sample on 130x122, so the base defect and the mutated
306+defect are not the same fork; the gate is red either way, which is what a
307+mutation is for.
308+
309+---
310+
311+## 8. Identity
312+
313+All on `a9e5034e`, `--nocapture`, single-threaded, no SKIP except the one
314+noted.
315+
316+| family | gates | result |
317+|---|---|---|
318+| `a_444*` (both H1 gates among them) | 4 | ok |
319+| `a_lossless_444*` + `a_real_aomenc_lossless_444*` | 5 | ok |
320+| superres (`a_superres*`, `a_real_aomenc_*superres*`) | 8 | ok |
321+| rect-strip (`a_real_aomenc_*rect_strip*`, intra-rect-strip, skipped-lossless-intrabc) | 5 | ok |
322+| the sweep's three chroma-format gates (cherry-picked `aeb696da` into a throwaway worktree at `a9e5034e`) | 3 | ok |
323+
324+The three sweep gates, quoted:
325+
326+```text
327+a_real_aomenc_odd_coded_dimension_streams_decode_pixel_exact: 6 arms, 4 frames
328+ byte-exact each, frame-edge walks [0,6,0,4,48,12] [0,0,0,4,0,6] [0,4,0,10,0,10]
329+ [0,4,0,8,0,12] [0,4,0,8,0,8] [0,0,0,12,0,14]
330+a_lossless_444_10bit_inter_stream_decodes_pixel_exact: 6 frames byte-exact vs aomdec at 10-bit 4:4:4
331+a_444_12bit_inter_sequence_decodes_pixel_exact: 6 frames byte-exact vs aomdec at 12-bit 4:4:4
332+test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 705 filtered out
333+```
334+
335+**One SKIP, pre-existing and not mine:**
336+`a_real_aomenc_lossless_444_key_frame_decodes_sample_exact` prints "no
337+pinned bytes at `fixtures/ll444-lossless-key.obu`". That file has no
338+entry in `git log` for the path — it was never committed, so the gate has
339+always skipped on this base.
340+
341+No suite run beyond the named gates: full validation is Main's, once
342+after all subagents land.
343+
344+---
345+
346+## 9. Handed on
347+
348+- **Agent04-2** — `f92776ba` is the fix, cherry-picked here with `-x`;
349+ it now has two more geometries and a red-before on each. The
350+ retraction in §2a is recorded in their report.
351+- **Agent13-2** — `4e151813` is confirmed lossless-only by a structural
352+ argument (`lossless_pair` arm) and by byte-identical divergence counts.
353+ Independently reached the same conclusion, by a different contaminated
354+ A/B.
355+- **Main** — `dc35d607` is standalone, measurement-only, and mergeable
356+ now. The matrix row `4:4:4 / superres / 8-bit` should read exact (§6).
357+ Open item: the real 4:4:4 superres cell is exact but ungated.