forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'main' into lane-sub8x4

Browse files at this commit

6890111665451a84dc38d4c6e275f0ad6e10b246Ahmet Kaan GümüşParent: 5106e8db09d6c1
crates/ec-av1/src/decode.rsmodified+7 -1
@@ -3012,7 +3012,7 @@ pub(crate) fn build_motion_field(
3012 const REFMVS_LIMIT: i32 = (1 << 12) - 1;3012 const REFMVS_LIMIT: i32 = (1 << 12) - 1;
3013 for row in 0..mi_rows {3013 for row in 0..mi_rows {
3014 for col in 0..mi_cols {3014 for col in 0..mi_cols {
3015- let Some(info) = grid.get(row, col) else {3015+ let Some(info) = grid.get_frame(row, col) else {
3016 continue;3016 continue;
3017 };3017 };
3018 // `av1_copy_frame_mvs` runs for EVERY block of an inter frame and3018 // `av1_copy_frame_mvs` runs for EVERY block of an inter frame and
@@ -3051,6 +3051,12 @@ pub(crate) fn build_motion_field(
3051 field.set(row, col, saved);3051 field.set(row, col, saved);
3052 }3052 }
3053 }3053 }
3054+ if std::env::var_os("EC_TRACE_TPL").is_some() {
3055+ eprintln!("EC_TPL_SAVED oh={order_hint}");
3056+ for (r, row) in field.occupancy().iter().enumerate() {
3057+ eprintln!("EC_TPL_SAVED r{r} {row}");
3058+ }
3059+ }
3054 field3060 field
3055 }3061 }
3056 3062
crates/ec-av1/src/motion_field.rsmodified+19 -0
@@ -75,6 +75,18 @@ impl MotionField {
75 }75 }
76 }76 }
77 77
78+ /// lane-mergefix r5 rung (`EC_TRACE_TPL`): occupancy map of the SAVED
79+ /// field, the input side of [`setup_motion_field`]'s projection.
80+ pub fn occupancy(&self) -> Vec<String> {
81+ (0..self.rows)
82+ .map(|r| {
83+ (0..self.cols)
84+ .map(|c| if self.cells[r * self.cols + c].is_some() { '#' } else { '.' })
85+ .collect()
86+ })
87+ .collect()
88+ }
89+
78 fn get(&self, row8: usize, col8: usize) -> Option<SavedMv> {90 fn get(&self, row8: usize, col8: usize) -> Option<SavedMv> {
79 if row8 < self.rows && col8 < self.cols {91 if row8 < self.rows && col8 < self.cols {
80 self.cells[row8 * self.cols + col8]92 self.cells[row8 * self.cols + col8]
@@ -95,6 +107,13 @@ pub struct TplField {
95 }107 }
96 108
97 impl TplField {109 impl TplField {
110+ /// lane-mergefix r5 rung (`EC_TPL`): how many 8x8 cells the projection
111+ /// actually filled -- an empty field means every temporal candidate is
112+ /// silently absent while the entropy stream still matches.
113+ pub fn filled_cells(&self) -> usize {
114+ self.cells.iter().filter(|c| c.is_some()).count()
115+ }
116+
98 fn get(&self, row8: usize, col8: usize) -> Option<((i32, i32), i32)> {117 fn get(&self, row8: usize, col8: usize) -> Option<((i32, i32), i32)> {
99 if row8 < self.rows && col8 < self.cols {118 if row8 < self.rows && col8 < self.cols {
100 self.cells[row8 * self.cols + col8]119 self.cells[row8 * self.cols + col8]
crates/ec-av1/src/mvstack.rsmodified+16 -0
@@ -274,6 +274,22 @@ impl MiGrid {
274 None274 None
275 }275 }
276 }276 }
277+
278+ /// The unit at `(row, col)` ignoring the tile window -- the frame-level
279+ /// read `av1_copy_frame_mvs` (this crate's
280+ /// `crate::decode::build_motion_field`) needs: it stores EVERY block of
281+ /// the frame, and it runs after the last tile has already narrowed
282+ /// [`Self::set_tile_bounds`], so reading it through [`Self::get`] saved
283+ /// only the last tile's columns into the motion field and every other
284+ /// tile's temporal candidates silently vanished from the next frame's
285+ /// MV stack.
286+ pub fn get_frame(&self, row: usize, col: usize) -> Option<&MiInfo> {
287+ if row < self.rows && col < self.cols {
288+ self.cells[row * self.cols + col].as_ref()
289+ } else {
290+ None
291+ }
292+ }
277 }293 }
278 294
279 /// One entry of the reference MV stack: a candidate motion vector and the295 /// One entry of the reference MV stack: a candidate motion vector and the
crates/ec-av1/src/stream.rsmodified+8 -0
@@ -779,6 +779,14 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
779 header.mi_cols as usize,779 header.mi_cols as usize,
780 )780 )
781 });781 });
782+ if std::env::var_os("EC_TPL").is_some() {
783+ eprintln!(
784+ "EC_TPL order_hint={} use_ref_frame_mvs={} cells={}",
785+ header.order_hint,
786+ header.use_ref_frame_mvs,
787+ tpl_field.as_ref().map_or(0, crate::motion_field::TplField::filled_cells)
788+ );
789+ }
782 let (picture, end_cdfs, motion_field) = decode_inter_frame_tile_with_cdfs(790 let (picture, end_cdfs, motion_field) = decode_inter_frame_tile_with_cdfs(
783 &tile_bufs,791 &tile_bufs,
784 &header.tile_info,792 &header.tile_info,
lanes/intra14-r3.report.mdadded+123 -0
@@ -0,0 +1,123 @@
1+# lane-intra14 r3 -- merge sqdrift, the r2 blocker dissolves, the real blocker is the recipe
2+
3+Branch `lane-intra14`, base main `48b35ab` + `lane-sqdrift 7d498c0`. **RED on the
4+gate, but the r2 blocker is closed**: the "pre-existing inter-frame pixel defect"
5+r2 was blocked on was lane-sqdrift's CFL-alphabet defect, and with it merged the
6+gate source decodes **pixel-exact on all 40 attempts**. What is left is a RECIPE
7+gap, not a decoder gap: no aomenc source found this round codes an INTRA block on
8+a 1:4 partition inside an INTER frame. Both gate arms stay `#[ignore]`d, on the
9+new MEASURED reason.
10+
11+## 1. Merges (f4b5419, 67a9bb3)
12+
13+* `git merge --no-commit main` (48b35ab) -- clean auto-merge, no conflict.
14+* `git merge --no-commit lane-sqdrift` (7d498c0, carries lane-sbrect10 9f1f108)
15+ -- one conflict, `read_intra_mode_rect` (decode.rs:5558). Resolved keeping
16+ **both**: sbrect10's `is_cfl_allowed` funnel first (`cfl && bw.max(bh) > 32`
17+ -> no-CFL alphabet, bumps `NOCFL_UV_MODE_HITS`), then this lane's
18+ intra-in-inter `skip` passthrough. This lane's own 1:4-in-inter reader
19+ (`decode_intra_rect_in_inter`, decode.rs:6234) reaches chroma through the same
20+ rule at decode.rs:6373 (`let cfl_allowed = bw.max(bh) <= 32`), never a private
21+ CFL read -- checked by grepping every `cdfs.uv_mode_cfl` site in decode.rs
22+ (4 sites: 5618 rect funnel, 6373 this lane, 8707 square funnel, 10572 sub8
23+ where every block is <= 8 so CFL is always allowed).
24+
25+md5 of files this lane does not own, merged vs lane-sqdrift: cdf.rs `d3de223b`,
26+cdf_state.rs `d0644312`, encode.rs `6c9f9f66`, mvstack.rs `9e6e3f59`,
27+motion_field.rs `fc33f264` -- all byte-identical.
28+
29+## 2. The r2 blocker was our own desync (c49c93a)
30+
31+Gate un-ignored and run on the merged tree, 8-bit, unchanged r2 recipe:
32+
33+| | r2 | r3 |
34+|---|---|---|
35+| attempts decoding whole | 3 / 40 | **40 / 40** |
36+| pixel-compared attempts mismatching | 3 / 3 | **0 / 40** |
37+| differing samples (40 streams x 8 frames x 3 planes) | ~4k then ~24k drift | **0** |
38+| `intra_rect4_strip_in_inter_hits` seed 52 | 64x16=4 16x64=3 | 0 0 0 0 |
39+
40+So r2's hit counter was produced by our own **desynced** decode of a mismatching
41+stream (class counter-from-refused-stream): decoded correctly, that same stream
42+contains no intra 1:4 strip at all. The r2 report's "pre-existing inter-frame
43+defect owned by no lane" is closed -- it was lane-sqdrift's 64x64 intra block in
44+an inter frame reading `uv_mode` off the CFL alphabet.
45+
46+## 3. Recipe hunt (this is the remaining blocker)
47+
48+A per-attempt counter probe was added to the gate (`intra14 probe` line: raw
49+`sb_rect4_*`, `rect4_32_*`, `intra_rect_strip_in_inter_hits`), so "no hit" can be
50+told apart from "no partition". Five 40-attempt sweeps, both counters read:
51+
52+| recipe | decodes exact | 1:4 partitions of ANY kind | intra 1:4 in inter |
53+|---|---|---|---|
54+| mandelbrot zoom, min-part 32, cpu 1..4 (r2 recipe) | 40/40 | `sb_rect4 0/0`, `rect4_32 0/0` | 0 |
55+| + every intra tool on (smooth/paeth/directional/angle-delta/**cfl-intra=1**) | 40/40 | 0 | 0 |
56+| + `--min-partition-size=16` | 40/40 | 0 | 0 |
57+| + `--sb-size=64 --cpu-used=0/1` | 40/40 | 0 | 0 |
58+| `gradients` (source of the repo's proven 1:4 gates), transposed on odd attempts | 21/40 (19 named refusals) | **`sb_rect4 h=4 v=16`** | 0 (all coded inter) |
59+| mandelbrot x gradients `blend=all_mode=average` | 30/40 | 0 | 0 |
60+
61+The mandelbrot source is excellent at intra-in-inter (589 2:1 intra strips over
62+40 streams, class `intra_rect_strip_in_inter_hits[1]`) and produces **zero** 1:4
63+partitions -- independently confirming sqdrift r1's aomdec partition histogram on
64+the same source. `gradients` is the reverse. The gate recipe is left on
65+`gradients` (the only arm reaching a 1:4 partition at all) with the full measured
66+table in the source above `intra_rect4_in_inter_gate`.
67+
68+Two lookups made this round: lavfi `gradients` `speed` is capped to `[0, 1]`
69+(ffmpeg rejected 12), and its animation steps per FRAME not per second -- a
70+rate=2 render is byte-identical to rate=25, so the sequence cannot be made
71+jumpier that way.
72+
73+The 19 gradients-recipe refusals are other lanes' surfaces: split intra strip
74+with a 64x32 TU (11), with a 32x64 TU (5), inter SB-level AB (2), HORZ/VERT intra
75+strip in a screen-content frame (1).
76+
77+EVIDENCE: $HOME/.cache/intra14-r3-8bit.log, -wide.log, -min16.log, -cpu0.log, -grad.log, -blend.log | gate un-ignored, 6 x 40-attempt aomenc sweeps under systemd-run scopes with a per-attempt counter probe | 40/40 attempts pixel-exact (0 differing samples) vs r2's 3/40 all-mismatching; 1:4 partitions 0 on every mandelbrot arm, sb_rect4 h=4 v=16 on gradients, intra-1:4-in-inter 0 everywhere
78+
79+## 4. `--enable-cfl-intra=1` arm (charter step 3)
80+
81+Ran, in the "every intra tool on" sweep above: 40/40 attempts decode pixel-exact
82+with `--enable-cfl-intra=1` (plus smooth/paeth/directional/angle-delta all 1).
83+That flag is now in the gate's recipe permanently. It fires no counter this lane
84+owns, so it is reported as a measurement, not as coverage.
85+
86+## 5. Film check
87+
88+`decode_probe` on a fresh 0.4 s extract at 4500 s of the 3840x1608 yuv420p10le
89+film (156 frame headers; r2's extract was reaped from /tmp, class
90+oracle-in-reaped-dir, so the two are not the same bytes):
91+
92+* stop string UNCHANGED: `a split intra strip whose transform unit is 64x32
93+ (no luma coefficient tables for that shape here)`
94+* `intra_rect4_in_inter: 64x16=0 16x64=4 32x8=0 8x32=0` (4 intra 16x64 strips in
95+ inter frames decoded before the stop), `rect4_32: horz=40 vert=36 coded=43`
96+* `EC_AV1_FINAL_DUMP` file count = **1** (r2 measured 0 on its extract)
97+
98+EVIDENCE: $HOME/.cache/intra14-r3-film.log | ffmpeg -ss 4500 -t 0.4 -c:v copy -f obu, then decode_probe under a 6G scope with EC_AV1_FINAL_DUMP | stop string "transform unit is 64x32", 4 intra 16x64 strips in inter frames, 1 dumped frame
99+
100+## 6. Suite
101+
102+`cargo test -p ec-av1 --lib` as a user systemd unit (MemoryMax=10G):
103+**382 passed; 0 failed; 35 ignored**; 1017.06s (r2: 370/0/34 -- the merges add
104+12 gates, the 35th ignored is unchanged: this lane's two arms plus the pre-existing
105+ignored set).
106+
107+EVIDENCE: $HOME/.cache/intra14-suite-r3.log | systemd-run --user --unit=intra14-suite-1788330813 -p MemoryMax=10G, EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1, nice -n 10 -j3 | test result: ok. 382 passed; 0 failed; 35 ignored; 1017.06s
108+
109+## Residue
110+
111+* fix-now (successor, this lane): find a source that codes an INTRA block on a
112+ 1:4 partition inside an INTER frame. Everything else is in place -- the reader,
113+ the counters and the pixel compare are all proven on the surrounding shapes.
114+ Two untried levers: (a) `--enable-1to4-partitions=1` with `--sb-size=64` on a
115+ gradients sequence containing hard CUTS (concat of per-frame gradients: the
116+ lavfi `concat` graph tried this round returns only 3 of 8 frames -- build the
117+ y4m by concatenating 8 single-frame renders in Rust instead); (b) drive the
118+ encoder with `--enable-global-motion=0 --lag-in-frames=0` at cq 25 on the
119+ gradients source so RD prices intra lower.
120+* accepted: the gate stays `#[ignore]`d. A refusal is lifted only with a gate
121+ that fires its counter; this one does not fire.
122+* accepted: the mandelbrot arm's 40/40 pixel-exact result is not turned into a
123+ new pin here -- the sibling 2:1-strip gate already covers that source.
lanes/intra14-r4.handoff.mdadded+41 -0
@@ -0,0 +1,41 @@
1+# lane-intra14 r4 handoff
2+
3+TIP: see `git log --oneline -1` on branch `lane-intra14` (r4 tip carries six
4+merges + the witness fixture + the report).
5+
6+MERGED THIS ROUND: main 1176a16, lane-intersub8 a5b9770, lane-uv8 7f372b9
7+(carries lane-interp3 10b801a), lane-inter16ab 2e711e1, lane-rectchroma2
8+48216c2, lane-sb128c fedb7fe. The non-textual resolutions are tabulated in
9+`lanes/intra14-r4.report.md` section 1; the one that is a real defect if
10+re-resolved wrongly: intersub8's `if write_w != write_h -> unsupported
11+COMPOUND_WEDGE` MUST be deleted, it shadows inter16ab's rect wedge codebook.
12+
13+STATE OF THE GOAL: the witness exists and is pinned.
14+`crates/ec-av1/fixtures/reelb_intra14_witness.obu` (163057 B, sha256
15+0eff603bf1608e47faf5e6729670c4c77cf5c674dbad3a1533ac6660151fd90e) = the film's
16+ss=90 segment truncated to 2 decode-order frames. Its frame 1 codes 3 intra
17+16x64 strips (`intra_rect4_in_inter` 16x64=3; truncated to 1 frame the counter
18+is 0, so attribution is pinned). The gate
19+`a_10bit_film_inter_frame_with_intra_1to4_strips_decodes_pixel_exact`
20+(crates/ec-av1/src/stream.rs, above `intra_rect4_in_inter_gate`) decodes it,
21+hard-asserts the counter moved and compares every plane of every frame vs
22+`ffmpeg_decode_sequence_10bit`.
23+
24+THE ONE BLOCKER: that frame refuses with "a split intra strip whose transform
25+unit is 64x32 (no luma coefficient tables for that shape here)". Land
26+TX_64X32/TX_32X64 luma coefficient tables, delete the `#[ignore]`, done.
27+Verify with:
28+`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-intra14 EC_NOMEMGUARD=1 nice -n 10 cargo test -p ec-av1 --lib -j3 -- a_10bit_film_inter_frame_with_intra_1to4_strips_decodes_pixel_exact --include-ignored --nocapture`
29+(today: refuses at that string, 27.98s).
30+
31+DO NOT REPEAT: the aomenc recipe hunt (r3 burned 6 x 40-attempt sweeps) and the
32+film sweep (r4, 27 segments at ss 0..6000: only ss=0/2/5/10 decode more than
33+one frame -- 33 -- and those code the shape ZERO times; every segment that
34+codes it stops at its first inter frame).
35+
36+SUITE: 404 passed / 2 failed / 36 ignored ($HOME/.cache/intra14-suite-r4.log).
37+Both failures arrived with the merges and are other lanes' shapes:
38+`a_frame_edge_straddling_band_decodes_pixel_exact` (192x68 cq61 frame 1 Y row 0
39+col 64, 6859 px) and
40+`a_real_aomenc_10bit_inter_sequence_with_a_split_transform_intra_block_decodes_pixel_exact`
41+(seed 54 frame 4 Y (48,16), 2341 samples).
lanes/intra14-r4.report.mdadded+124 -0
@@ -0,0 +1,124 @@
1+# lane-intra14 r4 -- six merges, the film witness located and pinned, blocked by a sibling refusal
2+
3+Branch `lane-intra14`. The r3 blocker ("no aomenc source codes an intra block
4+on a 1:4 partition inside an inter frame") is **closed as a search**: the shape
5+IS carried by the user's 2160p 10-bit film, it is now pinned as a tracked
6+fixture with the counter attributed to a single decode-order frame, and the
7+gate that decodes it is written. It stays `#[ignore]`d for one measured reason
8+that belongs to another lane: that frame stops at "a split intra strip whose
9+transform unit is 64x32".
10+
11+## 1. Merges (bc41417, 5d685f2, d8967dd, 4a449fd, d7ce5b3, e6284fd)
12+
13+`main` 1176a16 then, in order, `lane-intersub8 a5b9770`, `lane-uv8 7f372b9`
14+(carries `lane-interp3 10b801a` -- "Already up to date" for interp3 itself),
15+`lane-inter16ab 2e711e1`, `lane-rectchroma2 48216c2`, `lane-sb128c fedb7fe`.
16+Resolutions that were decisions, not text:
17+
18+| conflict | resolution |
19+|---|---|
20+| `read_intra_mode_rect` (decode.rs:5853) | main's `read_intrabc_info` read placed AFTER this lane's `skip` passthrough, then this lane's inter-vs-kf `y_mode` split |
21+| OBMC sentinel refusal wording | kept lane-uv8/interp3's ("no switchable symbol for that block"), inventory string moved with it |
22+| `masked_compound_used_wh` vs `is_any_masked_compound_used_here`, `bsize_index`+`wedge_used_wh` vs `bsize_all_index`+`wedge_used_bsize` | kept lane-inter16ab's pair -- it is the branch that landed the RECT wedge codebooks |
23+| the auto-merged `if write_w != write_h { return Err("a COMPOUND_WEDGE mask on a non-square inter block") }` | DELETED: it sat in front of lane-inter16ab's rect codebook lookup and would have made it dead code (class refusal-short-circuits-its-own-code) |
24+| `TxbSet::LumaRect8x4Inter` defined by BOTH intersub8 and inter16ab | one copy kept, both `*Set1`/`*1` siblings kept |
25+| 16x16-level AB `inter_leaf8!` macro vs sb128c's `if sb128_none` 128-root arm | both kept, macro first, one added closing brace |
26+| `vartx_leaves` LF fill | sb128c's `skip_inter_128` suppression prelude with lane-golomb's luma-only leaf comment inside |
27+
28+Three refusal strings were deleted because the merged tree no longer contains
29+them (the inventory test names each one): "an inter partition below 8x8",
30+"a COMPOUND_WEDGE mask on a non-square inter block", "a 1:4 rect strip that
31+actually uses a palette".
32+
33+## 2. Film sweep -- 27 segments, where the shape actually lives
34+
35+`ffmpeg -ss <t> -t 2 -c:v copy -f obu` of the 3840x1608 10-bit AV1 HDR10 film,
36+each decoded by `decode_probe` under a 6G scope with `EC_AV1_FINAL_DUMP`
37+(frames = completed frames actually dumped, hits = `intra_rect4_in_inter`):
38+
39+| ss | frames | intra 1:4 in inter | stop |
40+|---|---|---|---|
41+| 0, 2, 5, 10 | **33** | 0 | split intra strip TU 64x32 |
42+| 20, 60, 600, 2700, 6000 | 1 | 0 | split intra strip TU 64x32 / 32x64 |
43+| 30, 150 | 1 | 0 | intra 8x4/4x8 in a sub-8x8 inter partition |
44+| 45, 240, 900, 1200, 1800, 2100, 3300, 3600, 4200 | 1 | 0 | split (nonzero tx_depth) transform on an intra HORZ/VERT strip in an inter frame |
45+| 1500, 2400, 5400 | 1 | 0 | non-skip rectangular strip needs rectangular residual coding |
46+| 300 | 1 | 0 | split intra strip TU 32x64 |
47+| **90** | 1 | **16x64=3** | split intra strip TU 64x32 |
48+| 3000, 4500 | 1 | **16x64=4** | split intra strip TU 32x64 / 64x32 |
49+
50+The charter's premise that the `-ss 0` extract decodes 30 frames REPRODUCES
51+(33 frames here) -- and that prefix codes the shape zero times. Every segment
52+that DOES code the shape stops at its first inter frame.
53+
54+Attribution at ss=90, by truncation (`census4/trunc.py`, frames=1/2/3):
55+`n=1` decodes OK with hits 0/0/0/0; `n=2` and `n=3` both refuse with
56+`16x64=3`. So the three intra 16x64 strips are inside decode-order frame 1,
57+which is exactly the frame that refuses -- no completed frame in the whole
58+sweep contains the shape.
59+
60+EVIDENCE: /tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/b6d8a07f-96a4-4bbb-b378-af9ae25cf7c9/scratchpad/r4/probe*.log | 27 x (ffmpeg -ss N -t 2 -c:v copy -f obu, decode_probe under systemd-run --scope MemoryMax=6G, EC_AV1_FINAL_DUMP frame count) + a 3-point truncation ladder at ss=90 | 33 frames decode at the head with 0 hits; ss=90/3000/4500 fire 16x64=3/4/4 and every one of them is inside the first refusing inter frame
61+
62+## 3. The witness fixture and its gate (e04736b)
63+
64+`crates/ec-av1/fixtures/reelb_intra14_witness.obu`, 163057 bytes, sha256
65+`0eff603bf1608e47faf5e6729670c4c77cf5c674dbad3a1533ac6660151fd90e` -- the ss=90
66+extract truncated to its first two decode-order frames. Extracted TWICE from
67+independent `ffmpeg` runs; both hashed identically (class
68+seeded-fixture-not-reproducible).
69+
70+Gate `a_10bit_film_inter_frame_with_intra_1to4_strips_decodes_pixel_exact`
71+(stream.rs, next to `intra_rect4_in_inter_gate`): decodes the fixture, HARD-
72+asserts `intra_rect4_in_inter_counters()` moved, asserts 2 frames, and compares
73+EVERY plane of EVERY frame against `ffmpeg_decode_sequence_10bit` -- the same
74+helper `the_reelb_ss300_key_frame_skipped_cfl_decodes_pixel_exact` uses.
75+It is `#[ignore]`d with the blocking refusal quoted in the attribute: the
76+fixture's inter frame stops at "a split intra strip whose transform unit is
77+64x32 (no luma coefficient tables for that shape here)", a SIBLING lane's
78+surface (TX_64X32/TX_32X64 luma coefficient tables), not this lane's shape.
79+Un-ignoring is a one-line change once those tables land.
80+
81+Forced run of the ignored gate (`--include-ignored --nocapture`) -- the wiring
82+proof that the fixture reaches the reader and stops on the named sibling
83+surface, not on anything of this lane's:
84+
85+```
86+a_10bit_film_inter_frame_with_intra_1to4_strips_decodes_pixel_exact: decode_stream refused:
87+ unsupported: AV1 tile (a split intra strip whose transform unit is 64x32
88+ (no luma coefficient tables for that shape here))
89+test result: FAILED. 0 passed; 1 failed; 0 ignored; 442 filtered out; finished in 27.98s
90+```
91+
92+EVIDENCE: crates/ec-av1/fixtures/reelb_intra14_witness.obu (163057 B, sha256 0eff603bf1608e47faf5e6729670c4c77cf5c674dbad3a1533ac6660151fd90e) | two independent ffmpeg -ss 90 -t 2 extracts truncated to 2 frames, hashed identically; cargo test -p ec-av1 --lib -- a_10bit_film_inter_frame_with_intra_1to4_strips_decodes_pixel_exact --include-ignored --nocapture | forced run stops at the sibling refusal "split intra strip whose transform unit is 64x32"; the 3 intra 16x64 strips are in the same (refusing) frame
93+
94+## 4. Suite -- RED, 2 failures, both inherited with the merges
95+
96+`cargo test -p ec-av1 --lib` as a user systemd unit (MemoryMax=10G):
97+**404 passed; 2 failed; 36 ignored**; 1049.20s (r3 was 382/0/35 on a tree with
98+none of these six merges).
99+
100+| failing test | first sample | owner |
101+|---|---|---|
102+| `a_frame_edge_straddling_band_decodes_pixel_exact` | 192x68 cq61 frame 1 Y row 0 col 64, ours 56 vs ffmpeg 178, 6859 px | lane-tile2's known 192x68 tile_cols=1 regression (ledger dead-end: cross-tile temporal MV reads already exonerated) |
103+| `a_real_aomenc_10bit_inter_sequence_with_a_split_transform_intra_block_decodes_pixel_exact` | seed 54 frame 4 Y (48,16) 109 vs 303, 2341 samples; split intra-in-inter 16x16=5 | a merged sibling's surface (16x16 split-transform intra-in-inter), not the 1:4 shape -- this lane's reader fires 0 here |
104+
105+Neither failure touches the 1:4 shape (`intra_rect4_in_inter` is 0 in both) and
106+neither is reachable from this round's diff other than by having merged the
107+branch that carries it. Not fixed here -- outside this lane's shape and not
108+small.
109+
110+EVIDENCE: $HOME/.cache/intra14-suite-r4.log | systemd-run --user --unit=intra14-suite-1788348669 -p MemoryMax=10G, EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1, nice -n 10 -j3 | test result: FAILED. 404 passed; 2 failed; 36 ignored; 1049.20s
111+
112+## Residue
113+
114+* deferred(TX_64X32/TX_32X64 luma coefficient tables for a split intra strip):
115+ un-ignore `a_10bit_film_inter_frame_with_intra_1to4_strips_decodes_pixel_exact`.
116+ That single refusal is all that stands between this lane and a live,
117+ pixel-compared, counter-asserted witness -- the fixture is pinned and the
118+ gate is written.
119+* deferred(lane-tile2 / the split-transform intra-in-inter lane): the two suite
120+ failures above, inherited from the six merges, each reproduced with its first
121+ differing sample recorded.
122+* accepted: no aomenc recipe was hunted this round -- 27 film segments settled
123+ the question the recipe sweep was proxying for (the shape exists only in the
124+ film's inter frames, and every such frame refuses earlier).
lanes/mergefix-r1.handoff.mdadded+104 -0
@@ -0,0 +1,104 @@
1+# lane-mergefix r1 handoff
2+
3+Tip: see `git log -1` on lane-mergefix (fix commit "tx_size_context_txfm read
4+above_inter/left_inter at SUB granularity, not mi").
5+
6+## Bisection of the two reds (each gate run by name on a detached worktree)
7+
8+- `5d685f2` (main + intersub8): BOTH gates green.
9+- `d8967dd` (+ uv8): split-tx gate green, straddle gate RED (arm `68x192 cq35
10+ frames=5 10bit=true tile_cols=0`, first diff row 28 col 15, ours 196 vs 197).
11+- `4a449fd` (+ inter16ab): BOTH red.
12+- Neither red is a merge-resolution artifact: `git show --cc d8967dd -- crates/ec-av1/src/decode.rs`
13+ is EMPTY (clean merge, no hand-resolved hunk). Both are real decode defects that the
14+ merge UNCOVERED by lifting a refusal (class `refusal-hides-a-defect`): at `d8967dd`
15+ seed 54 was one of the split-tx gate's 21 named refusals (`buckets counted-exact=1
16+ uncounted-exact=9 named-refusals=21`); after inter16ab it decodes and mismatches.
17+
18+## GATE 2 -- `a_real_aomenc_10bit_inter_sequence_with_a_split_transform_intra_block_decodes_pixel_exact` : FIXED, GREEN
19+
20+Stream pinned: `~/.cache/mergefix-tmp/mk54.sh` -> `s54.obu`, md5
21+`c5c1c564e98b5d6348601edab6f7508e` (hashed twice, identical). 64x64 10-bit, seed 54.
22+
23+First diverging element (ours `EC_TRACE_MODE_STEP` vs instrumented aomdec, decode order):
24+frame 4, mi(4,12) (16x16 INTRA block inside an inter frame -- the block that owns the
25+reported pixel diff at row 16 col 48):
26+
27+ ours: EC_ISTEP mi_row=4 mi_col=12 name=tx_depth val=1 ctx=0 rng=46620
28+ aom : EC_ISTEP mi_row=4 mi_col=12 name=tx_depth val=1 ctx=1 cat=1 rng=51092
29+
30+Everything before that (partition ladder, mode/mv ladder, all earlier blocks' coefficients)
31+is range-identical.
32+
33+Root cause, `decode.rs` `tx_size_context_txfm`: `Neighbours::above_inter`/`left_inter` are
34+written PER MI cell (`record_inter_rect_mi`, `self.above_inter[c + cell]` over `0..w_mi`),
35+but the function indexed them `n.above_inter[mi_c / (SUB / MI)]` / `n.left_inter[mi_r / (SUB / MI)]`
36+-- i.e. it asked the block two mi away whether it was inter. libaom `get_tx_size_context`
37+(`pred_common.h`) lets an INTER neighbour contribute its BLOCK size instead of its transform
38+size; here the left neighbour mi(4,8) IS a var-tx-split inter 16x16, so libaom gets
39+`left = block_size_high(16) >= 16 = 1` while we fell back to `left_txfm[4] (=8) >= 16 = 0`
40+and read the `tx_depth` CDF from row 0 instead of row 1.
41+
42+Hunk (2 lines + comment) to port onto main:
43+
44+ - if has_above && n.above_inter[mi_c / (SUB / MI)] {
45+ + if has_above && n.above_inter[mi_c] {
46+ - if has_left && n.left_inter[mi_r / (SUB / MI)] {
47+ + if has_left && n.left_inter[mi_r] {
48+
49+Verified: `cargo test -p ec-av1 --lib -- <that gate name>` -> ok, buckets
50+`counted-exact=1 uncounted-exact=0 named-refusals=0 (attempts 1)`.
51+
52+## GATE 1 -- `a_frame_edge_straddling_band_decodes_pixel_exact` : STILL RED, no fix
53+
54+Unchanged by the tx_depth fix. Failing arm at the tip: `192x68 cq61 frames=5 10bit=false
55+tile_cols=1`, frame 1 plane Y, 6859 px, first at row 0 col 64.
56+Stream pinned: `~/.cache/mergefix-tmp/mkstr.sh` -> `str61.obu`, md5
57+`a14892ed0ba88b6ad2b566e251ea2d33`.
58+
59+First diverging element (same cross-decoder range ladder, EC_MODE/EC_ISTEP/EC_COEFF_STEP with
60+`tag=br|sign|golomb` and aomdec's no-op `tag=tx_type` dropped): frame 1 (our `EC_PICT idx=0`),
61+block mi(0,32) -- the 64x64 at x=128 split PARTITION_VERT into two 32x64 INTER strips
62+(aomdec `EC_PART mi_row=0 mi_col=32 bsize=12 value=2`). Mode/mv reads still agree
63+(`EC_MODE rng=46411`, `EC_MODE_VAL rng=47465` both sides). The divergence is inside the
64+var-tx tree of that 32x64 strip:
65+
66+ ours (from 47465): txfm_split_rect ctx=1 val=1 rng=51444
67+ txfm_split ctx=4 val=1 rng=45408 (mi 0,32)
68+ txfm_split ctx=4 val=1 rng=43372 (mi 8,32)
69+ then all_zero rng=64228 ...
70+ aom (from 47465): [var-tx symbols NOT traced by the oracle]
71+ EC_COEFF plane=0 row=0 col=0 tx_size=2 rng=43818
72+ all_zero rng=64988 ...
73+
74+So aomdec reaches the first TU at range 43818 where we reach 43372; both end at TX_16X16
75+leaves, so the SHAPE agrees and the divergence is in ctx/CDF of one of the three
76+`txfm_partition` symbols.
77+
78+Suspect + what was already verified by hand against libaom `txfm_partition_context`
79+(`av1_common_int.h`) -- all three CHECKED OUT, so do not re-audit them blind:
80+- `decode.rs` `txfm_partition_ctx_rect` (~12291): category for TX_32X64 in BLOCK_32X64 is
81+ `0` (`txsize_sqr_up_map[TX_32X64] == get_sqr_tx_size(max(32,64)) == TX_64X64`), for the
82+ TX_32X32 children `1` -> bases 0 and 3; our ctx 1 and 4 are consistent with
83+ above/left = (0,1) and (1,0) respectively, which is what the neighbour state should be
84+ at frame top row (`above_txfm` init 64) with a decoded left SB.
85+- `read_block_tx_size_rect` (~12790) reads exactly 3 symbols (1 rect + 2 square), matching
86+ libaom's `MAX_VARTX_DEPTH == 2` recursion from TX_32X64.
87+- Symbol COUNT and leaf shape match aomdec's TU list.
88+
89+Therefore the next step is NOT more reasoning about the ctx formula: instrument the oracle.
90+`~/.cache/aom-oracle/src` has NO `read_var_tx_size` trace rung (grep: only rungs from
91+`scripts/instrument-aom-oracle.sh`), so add a getenv-gated (`EC_VARTX`) fprintf around
92+`txfm_partition_cdf[ctx]` in libaom's `read_var_tx_size`/`read_tx_size_vartx` printing
93+`mi_row/mi_col/tx_size/ctx/rng`, rebuild only aomdec, and diff the three symbols. Gate the
94+print on a NEW env var so other lanes' traces are unaffected; never `git checkout` in that
95+tree (it carries other lanes' uncommitted instrumentation).
96+
97+Second lead if the ctx turns out identical: the `txfm_partition` CDF ROW may have adapted
98+differently earlier (a row swap that decodes the same value can leave the range identical
99+while adapting the wrong row) -- check the per-frame counter-reset list for
100+`txfm_partition` and the key frame's own reads.
101+
102+Note the earlier-arm history: at `d8967dd` this gate failed on `68x192 cq35 10bit=true
103+tile_cols=0`; at the tip that arm no longer fails first, so there may be more than one
104+defect behind this gate.
lanes/mergefix-r3.handoff.mdadded+39 -0
@@ -0,0 +1,39 @@
1+# lane-mergefix r3 handoff
2+
3+Tip: lane-mergefix 4d8a59d. Code is behaviourally identical to r2 (the r3 fix in
4+62a4cce was reverted in 4d8a59d); read `lanes/mergefix-r3.report.md` first.
5+
6+## Do not re-hunt
7+The straddling-band partition-ctx divergence at mi(16,32) is SOLVED and proven:
8+`decode_inter_block`'s var-tx branch (decode.rs ~20857) publishes `side, side` instead
9+of the strip's `write_w, write_h`. With the true footprint the ladder matches the
10+oracle exactly (ctx 0 -> 1 at rng=51641, exit 38495) and the gate goes 3622 -> 3376 px.
11+
12+## Why it is not in
13+Any form of that fix (4 variants measured, listed in the report) makes two attempts of
14+`real_aomenc_1to4_streams_..._rect_vartx_leaves_fire_before_a_named_refusal` refuse with
15+"a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding",
16+so that gate's leaf counter hits 0 and it fails. `side` at those call sites is not the
17+piece's parent bsize (sb128 pieces get side=64 under a 128 parent), so a parent-span
18+write keyed off `side` stamps the wrong span.
19+
20+## r4 job
21+Move the partition-context band write out of `decode_inter_block` into the partition
22+arms (SB-level and 64-level HORZ/VERT/1:4/AB, inter and intra), one write per
23+partition over the PARENT span with the subsize's width above / height left, exactly
24+like libaom `update_partition_context(xd, mi_row, mi_col, subsize, bsize)`; delete the
25+`side, side` publish for the non-square case at the same time. Re-run BOTH gates in one
26+invocation:
27+`cargo test -p ec-av1 --lib -- a_frame_edge_straddling_band_decodes_pixel_exact real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx`
28+
29+## Second, independent residue
30+Frame 1 of the pinned stream is entropy-exact (EC_MODE ladder for all 66 blocks;
31+coefficient all_zero/eob ladder 225/225) and still differs by 3376 px, first at row 0
32+col 64 = mi(0,16): a 32x32 compound SKIP block (mode=19 ref0=1 ref1=7 mv=(0,0)).
33+That is a compound-prediction reconstruction defect; drive it with EC_AV1_PREFILT_DUMP
34+on frame 1, not with an entropy ladder.
35+
36+## Environment
37+Stream `~/.cache/mergefix-tmp/str61.obu` md5 a14892ed0ba88b6ad2b566e251ea2d33 (recipe
38+`mkstr.sh`); instrumented oracle `~/.cache/mergefix-tmp/aom-build/aomdec` (EC_VARTX added
39+in r2). Suite log `$HOME/.cache/mergefix-suite-r3.log`.
lanes/mergefix-r3.report.mdadded+86 -0
@@ -0,0 +1,86 @@
1+# lane-mergefix r3 report
2+
3+## Verdict
4+Root cause of the `a_frame_edge_straddling_band_decodes_pixel_exact` partition-ctx
5+divergence FOUND and proven against the instrumented oracle; the fix is NOT shipped
6+because all three variants of it turn a green sibling gate red (class
7+`fix-trades-sibling-gate`). Branch is code-identical to r2 plus a `lane-mergefix r3`
8+comment at the site (`crates/ec-av1/src/decode.rs:20852`) naming the defect and the
9+three measured variants. Straddling gate stays RED at 3622 px, exactly as r2 left it.
10+
11+## Root cause (proven)
12+`decode_inter_block`'s var-tx branch (decode.rs ~20857) calls
13+`record_split_luma_rect_mi(at, side, side, ..)` on the comment's premise "a var-tx
14+block is always square, so `write_w == write_h == side`". FALSE: a superblock-level
15+`PARTITION_VERT` inter strip is 32x64 with `side == 64`, so the strip stamps the
16+PARENT's 64 into `above_side_mi`/`left_side_mi`. `Neighbours::partition_ctx_mi`
17+(decode.rs ~4985) then reads `above_side_mi[32] * 2 <= 64` as false and picks
18+partition CDF row 0 where libaom picks row 1. Class `tx-grid-published-block-side`,
19+7th instance.
20+
21+EVIDENCE: ladder at mi(16,32) of the pinned stream (md5 a14892ed0ba88b6ad2b566e251ea2d33,
22+192x68 cq61 tile_cols=1 8-bit, `~/.cache/mergefix-tmp/mkstr.sh`) |
23+`EC_TRACE_PART=1 <target>/debug/examples/decode_probe str61.obu` vs
24+`EC_TRACE_MODE=1 aomdec --rawvideo -o /dev/null str61.obu` |
25+ours `EC_PARTG mi_row=16 mi_col=32 bsize=12 ctx=0 rng=51641` -> with `write_w/write_h`
26+`ctx=1 rng=51641` then `bsize=9 rng=38495`, matching aomdec `EC_PART ... ctx=13
27+(= bsl*4+1) rng=51641 -> value=3 (SPLIT) rng=38495`.
28+
29+EVIDENCE: gate delta | `cargo test -p ec-av1 --lib -- a_frame_edge_straddling_band_decodes_pixel_exact`
30+with the fix applied | 3622 -> 3376 differing pixels, same first pixel (frame 1, row 0
31+col 64, ours 56 vs ffmpeg 178).
32+
33+## Why it is not shipped (the trade, measured 3 ways)
34+With the fix, `real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal`
35+goes green -> RED: two 8-bit attempts (16, 17) that previously decoded pixel-exact now
36+stop at the named refusal `unsupported: AV1 tile (a non-skip rectangular
37+(HORZ/VERT/HORZ_B) strip needs rectangular residual coding)`, so the gate's rect var-tx
38+leaf counter drops to 0 and it fails its own hard assert.
39+
40+Variants measured, each with both gates in one invocation:
41+1. `record_split_luma_rect_mi(at, write_w, write_h, ..)` -- straddling 3376, 1to4 "0 leaves, 0 refusals" FAIL.
42+2. keep the call at `side, side`, republish only `above_side_mi`/`left_side_mi` per piece with `write_w/write_h` -- straddling 3376, 1to4 2 refusals FAIL.
43+3. same, but over the PARENT span (`rmi & !(n-1)`, `n = side / MI`; libaom's `update_partition_context` takes `bsize`, not the piece) -- straddling 3376, 1to4 2 refusals FAIL.
44+4. variant 3 restricted to VERT shapes only (`write_w * 2 == side && write_h == side`) -- straddling 3376, 1to4 2 refusals FAIL.
45+
46+Reading: `side` at those 1:4-gate call sites is not necessarily the piece's PARENT
47+bsize (sb128 streams pass `side = 64` for pieces whose parent is 128), so a
48+parent-span write keyed off `side` stamps the wrong span there. The band write belongs
49+in the partition arms, where the parent bsize and origin are known -- that is the r4 job.
50+
51+## Swept sites (class sweep, `side`/parent dimension into a per-mi side band)
52+- decode.rs:20857 `record_split_luma_rect_mi(at, side, side, ..)` in `decode_inter_block` var-tx branch -- THE DEFECT (documented, not changed).
53+- decode.rs:6791 `record_split_luma_rect_mi(at_mi, bw, bh, ..)` -- already true footprint, OK.
54+- decode.rs:10798 `record_split_luma(at, side, ..)` in `decode_block` -- square intra block, `side` is its own, OK.
55+- decode.rs:5383 `record_mi_rect` / :5567 `record_split_luma_rect_mi` band writes -- take w/h from the caller, OK.
56+- decode.rs:8596, :11235, :11565, :11919, :21364, :21847 direct `above_side_mi`/`left_side_mi` writes -- all use the block's own `bw`/`bh` (or the documented 4/8 constants), OK.
57+- `record_rect_mi`/`record_inter_rect_mi`/`record_compound_ctx_rect_mi` square wrappers (:4821, :5097, :5497) -- callers are square blocks, OK.
58+No second instance of the parent-dimension shape found.
59+
60+## Second residue (unchanged by all of the above)
61+With the fix in place, frame 1 of the pinned stream is element-exact against the oracle
62+in BOTH ladders yet still differs by 3376 px: EC_MODE ladder identical for all 66
63+blocks of frame 1 (first divergence is frame 2's block at mi(0,16)); the
64+`tag=all_zero`/`tag=eob` range ladder is identical for its first 225 entries (all of
65+frames 0-1) and only then diverges. The first bad pixel is frame 1 row 0 col 64 =
66+mi(0,16), a 32x32 compound skip block (`EC_MODE ... is_inter=1 skip=1 side=32`,
67+`mode=19 ref0=1 ref1=7 mv0=(0,0)`), so frame 1 is a RECONSTRUCTION defect (compound
68+prediction), not an entropy one.
69+EVIDENCE: ~/.cache/mergefix-tmp/{ours.txt,aom.txt,oc.txt,ac.txt} | `EC_TRACE_MODE=1` and
70+`EC_TRACE_COEFF=1` on both decoders over str61.obu | `paste`d EC_MODE rng columns equal
71+through frame 1 (66 blocks), coefficient ladders equal for 225/225 entries.
72+
73+## Suite
74+`systemd-run --user --unit=mergefix-suite-r3-1788352226 ... cargo test -p ec-av1 --lib -j3`
75+(log `$HOME/.cache/mergefix-suite-r3.log`, run WITH variant 1 applied):
76+`test result: FAILED. 404 passed; 2 failed; 37 ignored` --
77+`a_frame_edge_straddling_band_decodes_pixel_exact` (3376 px) and
78+`real_aomenc_1to4_streams_..._rect_vartx_leaves_fire` (the trade above).
79+After reverting to the shipped state, the two gates re-run in one invocation give
80+`1 passed; 1 failed`: 1to4 ok, straddling 3622 px (r2's number, no regression).
81+
82+## Disposition
83+- fix-now for r4: move the partition-context band write out of `decode_inter_block` and
84+ into the partition arms (parent bsize + origin known there), then re-run BOTH gates.
85+- deferred: frame-1 compound-skip reconstruction defect at mi(0,16) -- unblocked by a
86+ prediction-side ladder (EC_AV1_PREFILT_DUMP on frame 1), independent of the above.
lanes/mergefix-r4.handoff.mdadded+37 -0
@@ -0,0 +1,37 @@
1+# lane-mergefix r4 handoff
2+
3+Tip: lane-mergefix 6bc2c8b (loop filter skip/pu_edge suppression + `blk_org_grid`).
4+Read `lanes/mergefix-r4.report.md`.
5+
6+## Do not re-hunt: decode-order frame 1 is NOT a compound-prediction defect
7+Its pre-filter reconstruction is BIT-EXACT vs the oracle (0 px, both before and after
8+this round's fix). The r3 charter's "3376 px starting at row 0 col 64 = a 32x32 compound
9+skip block" was reading the GATE's frame numbering: the pixel gate compares SHOWN frames,
10+so its "frame 1" is DECODE-order frame 2.
11+
12+## First differing prediction sample, and the rung that showed it
13+Decode-order frame 2, pre-filter (rung: ours `EC_AV1_PREFILT_DUMP16` cropped 192x68 u16 LE
14+vs aomdec `EC_AV1_PREFILT_DUMP` cropped 192x68 u8):
15+`row 0 col 97: ours 42, aomdec 8` (col 96 MATCHES). All 1306 differing px lie in the
16+single 32-px column band x=96..127, rows 0..63 -- one 32-wide block column. Frames 0 and 1
17+are 0 px at this rung. That band is the whole remaining straddling-gate failure.
18+
19+## Second, smaller residue (open)
20+Decode frame 1 post-deblock is 177 px off ON THE SHIPPED TREE, all in rows 61-67
21+(bottom straddling band), cols 130-191: 143 px we filter that libaom leaves alone, 15 the
22+other way -- a y=64 horizontal-edge decision in the partial last mi row. Numbers this
23+round: 7244 (before the fix) -> 255 (suppression without `pu_edge`) -> 177 (shipped).
24+
25+## Rung gotchas (cost this round two runs)
26+- aomdec `EC_AV1_PREFILT_DUMP16`/`POSTDEBLOCK_DUMP16` SEGFAULT on an 8-bit stream; use the
27+ 8-bit rungs there.
28+- aomdec `EC_AV1_POSTDEBLOCK_DUMP` writes the mi-ALIGNED buffer (192x72 luma, 20736 bytes
29+ total) while its `EC_AV1_PREFILT_DUMP` writes the crop (192x68, 19584): crop before diffing.
30+- New rung `EC_LFPARAMS=1` prints the frame's loop filter params; frame 1 is
31+ `level=[20,16,20,26] delta_enabled=true delta_update=false ref_deltas=[1,0,0,0,-1,0,-1,-1]`,
32+ so levels are NOT the defect.
33+
34+## Environment
35+Stream `~/.cache/mergefix-tmp/str61.obu` md5 a14892ed0ba88b6ad2b566e251ea2d33 (`mkstr.sh`);
36+oracle `~/.cache/mergefix-tmp/aom-build/aomdec`; artifacts `~/.cache/mergefix-tmp/r4_*`;
37+gate logs `$HOME/.cache/mergefix-r4-gates.log`, `$HOME/.cache/mergefix-r4-sib.log`.
lanes/mergefix-r4.report.mdadded+64 -0
@@ -0,0 +1,64 @@
1+# lane-mergefix r4 report
2+
3+## Verdict
4+The r3/charter premise is DISPROVED and a real root cause shipped: decode-order frame 1
5+of the pinned stream reconstructs BIT-EXACT (0 px) -- it is not a compound-prediction
6+defect. Our LOOP FILTER was filtering an interior transform-edge lattice the reference
7+never touches, because `edge_params` omitted spec 7.14.2's skip/`pu_edge` suppression.
8+Fixed; frame 1 post-deblock goes 7244 -> 177 wrong luma px (the 177 residue is the
9+bottom straddling band, rows 61-67, and is NOT closed). The straddling gate still
10+fails, but on a DIFFERENT, now-isolated defect (see residue) -- its reported count is
11+unchanged at 3622 because the gate compares SHOWN frames, and its "frame 1" is
12+decode-order frame 2.
13+
14+## Root cause + fix (crates/ec-av1/src/decode.rs)
15+- `edge_params` (~13300): a transform edge between two SKIPPED INTER blocks is filtered
16+ only when it is also a prediction (coded-block) edge -- libaom `set_lpf_parameters`
17+ `(curr_level || pv_lvl) && (!pv_skip || !curr_skipped || pu_edge)`. The old comment
18+ declared the term inert under "a coded block's transform is always its own full size";
19+ var-tx broke that invariant, so every var-tx 8-px interior edge inside skipped inter
20+ blocks was being filtered.
21+- `Neighbours::blk_org_grid` (new, ~4202/4309) + `fill_skip_grid_rect` (~4719): per-4x4-mi
22+ origin of the covering coded block -- the `pu_edge` term. Written where the skip flag
23+ already is (same `at_mi`, same call sites), so no new call-site sweep.
24+- `EC_LFPARAMS` rung (~12157): frame-level loop filter params, the instrument that ruled
25+ the filter LEVEL out.
26+
27+EVIDENCE: ~/.cache/mergefix-tmp/r4_{pre,aom,apd,ours,fix}.f* | ours
28+`EC_AV1_PREFILT_DUMP16`/`EC_AV1_POSTDEBLOCK_DUMP16` vs aomdec `EC_AV1_PREFILT_DUMP`/
29+`EC_AV1_POSTDEBLOCK_DUMP` on str61.obu (md5 a14892ed0ba88b6ad2b566e251ea2d33; aomdec's
30+postdeblock dump is the mi-ALIGNED 192x72 buffer -- crop to 68 rows first; its
31+`*_DUMP16` rung SEGFAULTS on an 8-bit stream) | decode-order frame 1: pre-filter 0 px
32+both before and after; post-deblock 7244 (unfixed) -> 255 (suppression
33+without the `pu_edge` term) -> 177 (SHIPPED, with it). Frame 0 is 0 in every build. The
34+177 residue is entirely rows 61-67, the bottom straddling band, cols 130-191: we filter
35+143 px libaom leaves, libaom filters 15 we leave -- an open sub-defect, not closed.
36+
37+## Gates
38+`cargo test -p ec-av1 --lib -j3 -- a_frame_edge_straddling_band_decodes_pixel_exact real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx`
39+-> `1 passed; 1 failed` (log `$HOME/.cache/mergefix-r4-gates.log`): the 1:4 rect-vartx
40+sibling gate PASSES (no r3-style trade), the straddling gate still fails with
41+`frame 1 plane Y: 3622 pixels differ, first at row 0 col 64 (ours 56 vs ffmpeg 178)`.
42+Sibling batch (the 9 gates named in the r2 report, one invocation):
43+`$HOME/.cache/mergefix-r4-sib.log`.
44+
45+## Residue (now precisely isolated, fix-now for r5)
46+Decode-order frame 2 (the gate's SHOWN frame 1) is wrong BEFORE any filtering: 1306
47+luma px, all inside the single 32-px column band x=96..127, rows 0..63; first at
48+row 0 col 97 (ours 42 vs aomdec 8; col 96 matches). That is the remaining prediction
49+defect the straddling gate reports. Second residue (open): 177 px in rows 61-67 (bottom
50+straddling band, cols 130-191) of decode frame 1's post-deblock output ON THE SHIPPED
51+TREE -- a horizontal edge at y=64 we filter and libaom does not (or vice versa, 15 px);
52+suspect the pu_edge/tx grid for blocks in the partial last mi row.
53+
54+## Disposition
55+- fix-now (r5): the decode-frame-2 32-px prediction band above.
56+- accepted: r3's partition-context finding stays unshipped (sibling-gate trade).
57+
58+## Sibling gate batch (one invocation, after the fix)
59+`cargo test -p ec-av1 --lib -j3 -- <the 9 r2 sibling names> a_frame_edge_straddling_band_decodes_pixel_exact real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx`
60+-> `test result: FAILED. 10 passed; 1 failed; 0 ignored` in 108.06s
61+(log `$HOME/.cache/mergefix-r4-sib.log`). The single failure is the lane's own straddling
62+gate at its pre-existing 3622 px; no sibling traded.
63+EVIDENCE: $HOME/.cache/mergefix-r4-sib.log | the 11 gates above in one invocation on the
64+shipped tree | 10 passed, 1 failed (straddling, unchanged 3622 px).
lanes/mergefix-r5.report.mdadded+59 -0
@@ -0,0 +1,59 @@
1+# lane-mergefix r5 report
2+
3+## Verdict
4+`a_frame_edge_straddling_band_decodes_pixel_exact` is GREEN. Root cause: the frame's
5+SAVED motion field (`build_motion_field`, this crate's `av1_copy_frame_mvs`) read the mi
6+grid through `MiGrid::get`, which is clamped to the CURRENT tile window -- and it runs
7+after the tile loop, so only the LAST tile's columns were ever stored. Every earlier
8+tile's temporal (MFMV) candidates were then absent from the next frame's MV stack.
9+
10+## Fix (2 files)
11+- `crates/ec-av1/src/mvstack.rs` (`MiGrid::get_frame`, new, after `get`): unclamped
12+ frame-level read.
13+- `crates/ec-av1/src/decode.rs` (`build_motion_field`): reads `get_frame` instead of `get`.
14+- Rungs kept (they are what found it): `EC_TPL` (stream.rs, per inter frame:
15+ `order_hint`, `use_ref_frame_mvs`, filled projected cells) and `EC_TPL_SAVED`
16+ (decode.rs under `EC_TRACE_TPL`, occupancy map of the saved field, via
17+ `MotionField::occupancy` / `TplField::filled_cells`).
18+
19+## Why the entropy stream never showed it
20+The mode/mv ladder of decode frame 2 is element-identical to the oracle (30 blocks, same
21+`rng` at every `EC_MODE`). A missing weight-2 temporal vote only REORDERS the stack: at
22+mi(0,24) (NEW_NEWMV, ref 1+7) aomdec's stack[1] is `this=(0,0) comp=(0,0) w=34` (17
23+temporal probes x 2), ours was `this=(36,0) w=2` -- the compound-extension zero-fill --
24+so the NEWMV predictor was 36 off and the decoded mv came out (32,0) vs (-4,0).
25+
26+EVIDENCE: ~/.cache/mergefix-tmp/r5/{o16,n16,aom}.f0-5 | ours `EC_AV1_PREFILT_DUMP16`
27+(cropped 192x68 u16 LE) vs aomdec `EC_AV1_PREFILT_DUMP` (192x68 u8) on str61.obu (md5
28+a14892ed0ba88b6ad2b566e251ea2d33) | pre-filter wrong luma px per decode-order frame
29+0..5: 0/0/1306/3358/5027/6622 BEFORE -> 0/0/0/0/0/0 AFTER.
30+
31+EVIDENCE: ~/.cache/mergefix-tmp/r5/{o,a}.tpl | `EC_TRACE_TPL=1` on both decoders |
32+aomdec has `EC_TPL mi_row=0 mi_col=24 blk=(0,0) mfmv0=(0,0) rfo=4`, ours INVALID; our
33+`EC_TPL_SAVED` occupancy map showed every frame's saved field filled only in x8 columns
34+16..23 (mi_col 32..47 = the last of the 2 tile columns) out of 24.
35+
36+## Gates (one invocation, log $HOME/.cache/cargo-target-mergefix-r5-gates.log)
37+`cargo test -p ec-av1 --lib -j3 -- a_frame_edge_straddling_band_decodes_pixel_exact <9 r2
38+siblings> real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx`
39+-> `10 passed; 1 failed`. The lane gate and all 9 siblings PASS (incl. both 10-bit arms,
40+sub8x8 inter split, 16x16 AB, split-transform SB/HORZ-VERT strips, 4:1/sub8 chroma strip).
41+
42+The one failure, `real_aomenc_1to4_streams_..._rect_vartx_leaves_fire_before_a_named_refusal`,
43+is PRE-EXISTING on the merged main state, not a trade: with the one-line fix reverted the
44+gate fails identically ("never fired (32x16=0, 16x32=0, 0 refusals, 0 compared)", 18
45+attempts, 0 mismatches) -- log `$HOME/.cache/cargo-target-mergefix-r5-prefix.log`. It is
46+the gate-recipe defect the ledger records after lane-rectres lifted its documented blocker.
47+
48+## Class sweep
49+Class: a frame-level consumer reading a per-tile-clamped map. Swept every `grid.get(`
50+in the crate: the other 20 sites are per-block neighbour scans inside the tile walk
51+(correctly clamped); `build_motion_field` is the only frame-level reader after the tile
52+loop (decode.rs:27980 is the only `grid` use past it).
53+
54+## Disposition
55+- accepted: `real_aomenc_1to4_streams_..._rect_vartx_leaves_fire` stays red (pre-existing
56+ recipe defect, needs an aomenc recipe that emits a 64x16/16x64 var-tx leaf).
57+- accepted: r3's partition-context finding stays unshipped (sibling-gate trade, r4).
58+- closed: r4's 177-px post-deblock residue in decode frame 1's bottom band -- gone with
59+ this fix (all frames 0 px pre-filter; the gate compares post-filter and is green).