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