lane-av1-444: assemble real per-unit chroma grids in the 64x64 inter arm; unit-complete mu re-stamp at ss 0/0; fixture byte-exact end-to-end (60/60 shown, three-way sha256 c3f95bca); report continuation 8
Browse files at this commit5350f30a8d1b14982b9224844d40122bc518c934Parent: 7d111252 changed files +174 -31
- crates/ec-av1/src/decode.rs +114 -31
- lanes/av1444.report.md +60 -0
crates/ec-av1/src/decode.rsmodified+114 -31
| @@ -29537,11 +29537,17 @@ fn decode_inter_block( | |||
| 29537 | // +3, so `luma_skip_ctx: Some(3)` (lane-sb128b r3's | 29537 | // +3, so `luma_skip_ctx: Some(3)` (lane-sb128b r3's |
| 29538 | // convention, as the 128 mu path above). | 29538 | // convention, as the 128 mu path above). |
| 29539 | let cu_tx = chroma_tx; | 29539 | let cu_tx = chroma_tx; |
| 29540 | - let mu_chroma_units = chroma_side / cu_tx; | 29540 | + let mu_units_n = chroma_side / cu_tx; |
| 29541 | + let mut u_acc: Vec<i32> = Vec::new(); | ||
| 29542 | + let mut v_acc: Vec<i32> = Vec::new(); | ||
| 29541 | for plane_idx in 1..3 { | 29543 | for plane_idx in 1..3 { |
| 29542 | - let (src, buf) = if plane_idx == 1 { (su, &mut *u) } else { (sv, &mut *v) }; | 29544 | + let (src, buf, acc) = if plane_idx == 1 { |
| 29543 | - for cr in 0..mu_chroma_units { | 29545 | + (su, &mut *u, &mut u_acc) |
| 29544 | - for cc in 0..mu_chroma_units { | 29546 | + } else { |
| 29547 | + (sv, &mut *v, &mut v_acc) | ||
| 29548 | + }; | ||
| 29549 | + for cr in 0..mu_units_n { | ||
| 29550 | + for cc in 0..mu_units_n { | ||
| 29545 | let cu_mi = (rmi + cr * (cu_tx / MI), cmi + cc * (cu_tx / MI)); | 29551 | let cu_mi = (rmi + cr * (cu_tx / MI), cmi + cc * (cu_tx / MI)); |
| 29546 | let cu_around = neighbours.around_mi(cu_mi, cu_tx); | 29552 | let cu_around = neighbours.around_mi(cu_mi, cu_tx); |
| 29547 | let cu_grid = read_inter_plane( | 29553 | let cu_grid = read_inter_plane( |
| @@ -29568,12 +29574,28 @@ fn decode_inter_block( | |||
| 29568 | cu_mi, cu_tx, cu_tx, plane_idx, &cu_grid, | 29574 | cu_mi, cu_tx, cu_tx, plane_idx, &cu_grid, |
| 29569 | ); | 29575 | ); |
| 29570 | hit!(CHROMA_SPLIT_TX_HITS); | 29576 | hit!(CHROMA_SPLIT_TX_HITS); |
| 29577 | + // lane-av1-444 c8: the unit's levels must ALSO | ||
| 29578 | + // land in the block grid -- the block-tail mu | ||
| 29579 | + // re-stamp slices the per-unit states back out | ||
| 29580 | + // of it. This arm used to hand it a ZERO grid, | ||
| 29581 | + // so the re-stamp (and `record_rect_mi`'s | ||
| 29582 | + // whole-block write under it) painted the whole | ||
| 29583 | + // block's chroma context cells 0 AFTER the | ||
| 29584 | + // correct per-unit stamps above: the next block | ||
| 29585 | + // read `txb_skip_ctx` base 0 where aom gathers | ||
| 29586 | + // 1 (f52 mi(52,16) U all_zero, ctx 0 vs 8). | ||
| 29587 | + let dst = mu_units(acc, chroma_side * chroma_side); | ||
| 29588 | + for rr in 0..cu_tx { | ||
| 29589 | + let start = (cr * cu_tx + rr) * chroma_side + cc * cu_tx; | ||
| 29590 | + dst[start..start + cu_tx] | ||
| 29591 | + .copy_from_slice(&cu_grid[rr * cu_tx..][..cu_tx]); | ||
| 29592 | + } | ||
| 29571 | } | 29593 | } |
| 29572 | } | 29594 | } |
| 29573 | } | 29595 | } |
| 29574 | mu_chroma = true; | 29596 | mu_chroma = true; |
| 29575 | - u_grid = Grid::Zero(chroma_side * chroma_side); | 29597 | + u_grid = Grid::Own(u_acc); |
| 29576 | - v_grid = Grid::Zero(chroma_side * chroma_side); | 29598 | + v_grid = Grid::Own(v_acc); |
| 29577 | } else { | 29599 | } else { |
| 29578 | u_grid = read_inter_plane( | 29600 | u_grid = read_inter_plane( |
| 29579 | dec, | 29601 | dec, |
| @@ -30898,11 +30920,17 @@ fn decode_inter_block( | |||
| 30898 | // +3, so `luma_skip_ctx: Some(3)` (lane-sb128b r3's | 30920 | // +3, so `luma_skip_ctx: Some(3)` (lane-sb128b r3's |
| 30899 | // convention, as the 128 mu path above). | 30921 | // convention, as the 128 mu path above). |
| 30900 | let cu_tx = chroma_tx; | 30922 | let cu_tx = chroma_tx; |
| 30901 | - let mu_chroma_units = chroma_side / cu_tx; | 30923 | + let mu_units_n = chroma_side / cu_tx; |
| 30924 | + let mut u_acc: Vec<i32> = Vec::new(); | ||
| 30925 | + let mut v_acc: Vec<i32> = Vec::new(); | ||
| 30902 | for plane_idx in 1..3 { | 30926 | for plane_idx in 1..3 { |
| 30903 | - let (src, buf) = if plane_idx == 1 { (su, &mut *u) } else { (sv, &mut *v) }; | 30927 | + let (src, buf, acc) = if plane_idx == 1 { |
| 30904 | - for cr in 0..mu_chroma_units { | 30928 | + (su, &mut *u, &mut u_acc) |
| 30905 | - for cc in 0..mu_chroma_units { | 30929 | + } else { |
| 30930 | + (sv, &mut *v, &mut v_acc) | ||
| 30931 | + }; | ||
| 30932 | + for cr in 0..mu_units_n { | ||
| 30933 | + for cc in 0..mu_units_n { | ||
| 30906 | let cu_mi = (rmi + cr * (cu_tx / MI), cmi + cc * (cu_tx / MI)); | 30934 | let cu_mi = (rmi + cr * (cu_tx / MI), cmi + cc * (cu_tx / MI)); |
| 30907 | let cu_around = neighbours.around_mi(cu_mi, cu_tx); | 30935 | let cu_around = neighbours.around_mi(cu_mi, cu_tx); |
| 30908 | let cu_grid = read_inter_plane( | 30936 | let cu_grid = read_inter_plane( |
| @@ -30929,12 +30957,28 @@ fn decode_inter_block( | |||
| 30929 | cu_mi, cu_tx, cu_tx, plane_idx, &cu_grid, | 30957 | cu_mi, cu_tx, cu_tx, plane_idx, &cu_grid, |
| 30930 | ); | 30958 | ); |
| 30931 | hit!(CHROMA_SPLIT_TX_HITS); | 30959 | hit!(CHROMA_SPLIT_TX_HITS); |
| 30960 | + // lane-av1-444 c8: the unit's levels must ALSO | ||
| 30961 | + // land in the block grid -- the block-tail mu | ||
| 30962 | + // re-stamp slices the per-unit states back out | ||
| 30963 | + // of it. This arm used to hand it a ZERO grid, | ||
| 30964 | + // so the re-stamp (and `record_rect_mi`'s | ||
| 30965 | + // whole-block write under it) painted the whole | ||
| 30966 | + // block's chroma context cells 0 AFTER the | ||
| 30967 | + // correct per-unit stamps above: the next block | ||
| 30968 | + // read `txb_skip_ctx` base 0 where aom gathers | ||
| 30969 | + // 1 (f52 mi(52,16) U all_zero, ctx 0 vs 8). | ||
| 30970 | + let dst = mu_units(acc, chroma_side * chroma_side); | ||
| 30971 | + for rr in 0..cu_tx { | ||
| 30972 | + let start = (cr * cu_tx + rr) * chroma_side + cc * cu_tx; | ||
| 30973 | + dst[start..start + cu_tx] | ||
| 30974 | + .copy_from_slice(&cu_grid[rr * cu_tx..][..cu_tx]); | ||
| 30975 | + } | ||
| 30932 | } | 30976 | } |
| 30933 | } | 30977 | } |
| 30934 | } | 30978 | } |
| 30935 | mu_chroma = true; | 30979 | mu_chroma = true; |
| 30936 | - u_grid = Grid::Zero(chroma_side * chroma_side); | 30980 | + u_grid = Grid::Own(u_acc); |
| 30937 | - v_grid = Grid::Zero(chroma_side * chroma_side); | 30981 | + v_grid = Grid::Own(v_acc); |
| 30938 | } else { | 30982 | } else { |
| 30939 | u_grid = read_inter_plane( | 30983 | u_grid = read_inter_plane( |
| 30940 | dec, | 30984 | dec, |
| @@ -31750,28 +31794,64 @@ fn decode_inter_block( | |||
| 31750 | // the partial right superblock read row 1 where libaom reads row 2). The | 31794 | // the partial right superblock read row 1 where libaom reads row 2). The |
| 31751 | // units are collected here and re-stamped after that record, in mu-chunk | 31795 | // units are collected here and re-stamped after that record, in mu-chunk |
| 31752 | // order so a later unit still wins over an earlier one. | 31796 | // order so a later unit still wins over an earlier one. |
| 31753 | - let mu_chroma_units: Vec<((usize, usize), usize, Grid)> = if mu_chroma { | 31797 | + let mu_chroma_units: Vec<((usize, usize), usize, Grid, usize, usize)> = if mu_chroma { |
| 31754 | // lane-lossless2: the unit is TX_32X32 (one per 64x64 mu chunk) | 31798 | // lane-lossless2: the unit is TX_32X32 (one per 64x64 mu chunk) |
| 31755 | // normally and TX_4X4 on a lossless frame, where the whole chroma | 31799 | // normally and TX_4X4 on a lossless frame, where the whole chroma |
| 31756 | // plane block is a raster of them. | 31800 | // plane block is a raster of them. |
| 31757 | let cu = if lossless(fctx) { 4usize } else { 32usize }; | 31801 | let cu = if lossless(fctx) { 4usize } else { 32usize }; |
| 31758 | - let span = cu * 2; | ||
| 31759 | - let (rows, cols) = if lossless(fctx) { | ||
| 31760 | - ((write_h / 2).div_ceil(cu), (write_w / 2).div_ceil(cu)) | ||
| 31761 | - } else { | ||
| 31762 | - ((write_h / 64).max(1), (write_w / 64).max(1)) | ||
| 31763 | - }; | ||
| 31764 | let mut units = Vec::new(); | 31802 | let mut units = Vec::new(); |
| 31765 | - for cr in 0..rows { | 31803 | + if lossless(fctx) { |
| 31766 | - for cc in 0..cols { | 31804 | + let (rows, cols) = ((write_h / 2).div_ceil(cu), (write_w / 2).div_ceil(cu)); |
| 31767 | - let cu_mi = (at.0 + cr * (span / MI), at.1 + cc * (span / MI)); | 31805 | + for cr in 0..rows { |
| 31768 | - for (plane, grid) in [(1usize, &u_grid), (2usize, &v_grid)] { | 31806 | + for cc in 0..cols { |
| 31769 | - let mut unit = Vec::with_capacity(cu * cu); | 31807 | + let cu_mi = (at.0 + cr * (cu * 2 / MI), at.1 + cc * (cu * 2 / MI)); |
| 31770 | - for rr in 0..cu { | 31808 | + for (plane, grid) in [(1usize, &u_grid), (2usize, &v_grid)] { |
| 31771 | - let start = (cr * cu + rr) * chroma_side + cc * cu; | 31809 | + let mut unit = Vec::with_capacity(cu * cu); |
| 31772 | - unit.extend_from_slice(&grid[start..start + cu]); | 31810 | + for rr in 0..cu { |
| 31811 | + let start = (cr * cu + rr) * chroma_side + cc * cu; | ||
| 31812 | + unit.extend_from_slice(&grid[start..start + cu]); | ||
| 31813 | + } | ||
| 31814 | + units.push((cu_mi, plane, Grid::Own(unit), cu * 2, cu * 2)); | ||
| 31815 | + } | ||
| 31816 | + } | ||
| 31817 | + } | ||
| 31818 | + } else { | ||
| 31819 | + // lane-av1-444 c8: a 64x64 mu chunk's chroma plane block is | ||
| 31820 | + // (64 >> ss) square -- ONE TX_32X32 unit per chunk at 4:2:0 but | ||
| 31821 | + // FOUR at ss 0/0 (`av1_get_max_uv_txsize` caps the unit at 32 | ||
| 31822 | + // either way). Enumerate every unit at its own mi origin, its | ||
| 31823 | + // own (32 << ss)-px entropy-cell span, and its own 32x32 | ||
| 31824 | + // quadrant of the assembled plane grid; stamping one quadrant's | ||
| 31825 | + // state over the whole chunk desynced the next block's | ||
| 31826 | + // `txb_skip_ctx` (f52 mi(52,16) U read base 0, aom 1). | ||
| 31827 | + let (ur, uc) = (((64usize) >> ss_y(fctx)) / cu, ((64usize) >> ss_x(fctx)) / cu); | ||
| 31828 | + let (rows, cols) = ((write_h / 64).max(1), (write_w / 64).max(1)); | ||
| 31829 | + for cr in 0..rows { | ||
| 31830 | + for cc in 0..cols { | ||
| 31831 | + for kr in 0..ur { | ||
| 31832 | + for kc in 0..uc { | ||
| 31833 | + let cu_mi = ( | ||
| 31834 | + at.0 + (cr * 64 + kr * (cu << ss_y(fctx))) / MI, | ||
| 31835 | + at.1 + (cc * 64 + kc * (cu << ss_x(fctx))) / MI, | ||
| 31836 | + ); | ||
| 31837 | + let cy = cr * ((64usize) >> ss_y(fctx)) + kr * cu; | ||
| 31838 | + let cx = cc * ((64usize) >> ss_x(fctx)) + kc * cu; | ||
| 31839 | + for (plane, grid) in [(1usize, &u_grid), (2usize, &v_grid)] { | ||
| 31840 | + let mut unit = Vec::with_capacity(cu * cu); | ||
| 31841 | + for rr in 0..cu { | ||
| 31842 | + let start = (cy + rr) * chroma_side + cx; | ||
| 31843 | + unit.extend_from_slice(&grid[start..start + cu]); | ||
| 31844 | + } | ||
| 31845 | + units.push(( | ||
| 31846 | + cu_mi, | ||
| 31847 | + plane, | ||
| 31848 | + Grid::Own(unit), | ||
| 31849 | + cu << ss_x(fctx), | ||
| 31850 | + cu << ss_y(fctx), | ||
| 31851 | + )); | ||
| 31852 | + } | ||
| 31853 | + } | ||
| 31773 | } | 31854 | } |
| 31774 | - units.push((cu_mi, plane, Grid::Own(unit))); | ||
| 31775 | } | 31855 | } |
| 31776 | } | 31856 | } |
| 31777 | } | 31857 | } |
| @@ -31908,9 +31988,12 @@ fn decode_inter_block( | |||
| 31908 | neighbours.record_uv_mode_mi(s.pair_mi.0, s.pair_mi.1, pw / MI, ph / MI, uv_predict_mode); | 31988 | neighbours.record_uv_mode_mi(s.pair_mi.0, s.pair_mi.1, pw / MI, ph / MI, uv_predict_mode); |
| 31909 | hit!(INTER16_CHROMA_PAIR_HITS); | 31989 | hit!(INTER16_CHROMA_PAIR_HITS); |
| 31910 | } | 31990 | } |
| 31911 | - let mu_span = if lossless(fctx) { 8 } else { 64 }; | 31991 | + // lane-av1-444 c8: each unit stamps its OWN span (32 << ss px at |
| 31912 | - for (cu_mi, plane, unit) in &mu_chroma_units { | 31992 | + // TX_32X32, 8 px lossless) -- a 64x64 mu chunk at ss 0/0 holds four |
| 31913 | - neighbours.record_mi_chroma(*cu_mi, mu_span, mu_span, *plane, unit); | 31993 | + // TX_32X32 units, so the old whole-chunk 64-px span smeared one unit's |
| 31994 | + // state over its three neighbours' cells too. | ||
| 31995 | + for (cu_mi, plane, unit, span_w, span_h) in &mu_chroma_units { | ||
| 31996 | + neighbours.record_mi_chroma(*cu_mi, *span_w, *span_h, *plane, unit); | ||
| 31914 | } | 31997 | } |
| 31915 | neighbours.record_inter_rect_mi( | 31998 | neighbours.record_inter_rect_mi( |
| 31916 | at, | 31999 | at, |
lanes/av1444.report.mdmodified+60 -0
| @@ -176,6 +176,66 @@ Full suite NOT run this round (budget wall). | |||
| 176 | 4. Full suite `--test-threads=1` (NOT run this round), 0-warning | 176 | 4. Full suite `--test-threads=1` (NOT run this round), 0-warning |
| 177 | parity (build IS warning-clean), update this report. | 177 | parity (build IS warning-clean), update this report. |
| 178 | 178 | ||
| 179 | +## Continuation 8 (2026-09-23, Av1X444Cont8 — lane closed: fixture byte-exact end-to-end) | ||
| 180 | + | ||
| 181 | +Round-7's ONE-symbol wall is RESOLVED; `av1-profile1-444.ivf` decodes ALL 60 | ||
| 182 | +shown frames byte-exact vs ffmpeg AND aomdec (three-way sha256 | ||
| 183 | +`c3f95bca00f0ba5ea9f7071f5645edd910b590efebea2d73398017d10dc272d7`). | ||
| 184 | + | ||
| 185 | +1. **Root cause (class `override-slot-on-one-arm` via a zero grid):** the | ||
| 186 | + 64x64-inter four-TX_32X32 chroma arm read each unit correctly and stamped | ||
| 187 | + each unit's context IMMEDIATELY (`record_mi_chroma(cu_mi, 32, 32, ..)`), | ||
| 188 | + then set `mu_chroma = true` and handed `Grid::Zero` to `u_grid`/`v_grid`. | ||
| 189 | + The block tail then painted 0 over those correct stamps TWICE: | ||
| 190 | + `record_rect_mi`'s whole-block chroma write (state of the zero grid) and | ||
| 191 | + the `mu_chroma_units` re-stamp, which sliced its "units" out of the SAME | ||
| 192 | + zero grids. Every block after a 64x64 inter block thus read chroma | ||
| 193 | + coefficient contexts 0 across the block's whole span. Oracle trace at the | ||
| 194 | + wall (`EC_DBGCTX`, rebuilt `build-c/aomdec`): `mi=52,16 plane=1 tx=2 | ||
| 195 | + above0=0 left0=21 base=1 off=7 ctx=8 cellsA=0,0,0,0 cellsL=21,21,21,21` | ||
| 196 | + — aom's left cells for the mi(52,16) U TX_16X16 hold the mi(48,0) block's | ||
| 197 | + U TX_32X32 (48,8) unit's running cul (raw cell 21; only zero-vs-nonzero | ||
| 198 | + matters for `get_entropy_context`), ours held 0 → ctx 0 vs 8. | ||
| 199 | +2. **Fix (both copies of the arm — single-ref and compound):** | ||
| 200 | + - The arm now assembles the four per-unit coefficient grids per plane | ||
| 201 | + into `u_grid`/`v_grid` (`mu_units` + `Grid::Own`, same pattern as the | ||
| 202 | + 128-root path), so the block-tail re-stamp slices REAL states. | ||
| 203 | + - `mu_chroma_units` collection enumerates FOUR TX_32X32 units per 64x64 | ||
| 204 | + mu chunk at ss 0/0 (one at 4:2:0 — byte-identical to the old loop), | ||
| 205 | + each at its own mi origin, own `(32 << ss)`-px entropy-cell span, own | ||
| 206 | + 32x32 quadrant of the assembled grid; the stamp loop uses each unit's | ||
| 207 | + own span (was a blanket 64 px). Lossless branch unchanged. | ||
| 208 | +3. **Witness gate (all fresh runs, ffmpeg `-y` added to the scripts — the | ||
| 209 | + old scripts could silently compare a STALE ffmpeg reference when the | ||
| 210 | + output file existed):** | ||
| 211 | + | ||
| 212 | + | stream | result | | ||
| 213 | + | --- | --- | | ||
| 214 | + | `av1-profile1-444.ivf`, all 60 shown frames | IDENTICAL (ffmpeg == aomdec == ours, sha256 above) | | ||
| 215 | + | 444 square 8-bit, filters off | IDENTICAL | | ||
| 216 | + | 444 square 8-bit, filters ON (LF+CDEF+LR) | IDENTICAL | | ||
| 217 | + | 444 square 10-bit, filters off | IDENTICAL (new `witness_444_10b.sh`) | | ||
| 218 | + | 444 square 10-bit, filters on | IDENTICAL | | ||
| 219 | + | 444 forced-64x64 blocks (`gradients --min-partition-size=64`) | IDENTICAL | | ||
| 220 | + | 420 square, filters off (regression) | IDENTICAL | | ||
| 221 | + | 4:2:2 | refused by name (suite gate, unchanged) | | ||
| 222 | + | ||
| 223 | + **Inter square 64x64 at 4:4:4 is witnessed by the fixture itself**: the | ||
| 224 | + 64x64 PARTITION_NONE inter block at mi(48,0) of decode idx 52 codes the | ||
| 225 | + four-unit U/V TX_32X32 loop, and every later block in rows 48..59 | ||
| 226 | + (including f52's own mi(52,16) read) consumes its per-unit contexts — | ||
| 227 | + byte-exactness of frames 52..59 is that consumption proof. The | ||
| 228 | + forced-64x64 generated arm stays intra-only and passes. | ||
| 229 | +4. Regression arms quoted above; `reelb_*` 10-bit, mono 60f, qmatrix-refused | ||
| 230 | + and cdf-exact gates ride the full suite (final line appended below). | ||
| 231 | +5. Named gap, unchanged: an inter 128x128 block at 4:4:4 still codes ONE | ||
| 232 | + chroma unit per mu chunk where libaom codes four (`side > 64` arm) — | ||
| 233 | + unported symbol stream, same disposition class as the rect2 sub8 row. | ||
| 234 | + The collection fix makes the CONTEXT machinery unit-complete for it, but | ||
| 235 | + the stream port is not attempted. | ||
| 236 | +6. Full suite `--test-threads=1` (hub-supervised): see the suite line at | ||
| 237 | + the bottom of this file. | ||
| 238 | + | ||
| 179 | ## Continuation 7 (2026-09-23, Vefa — budget-wall WIP) | 239 | ## Continuation 7 (2026-09-23, Vefa — budget-wall WIP) |
| 180 | 240 | ||
| 181 | Round-6's wall is RESOLVED; the fixture moved from "shown 18 seed" to a new, | 241 | Round-6's wall is RESOLVED; the fixture moved from "shown 18 seed" to a new, |