lane-av1-444: 10-bit film regression fix -- sub8 group uv stamps gated !chroma_444 && !intra_chroma (port of lane-av1-cfl 7c6dad53); three same-class per-unit chroma re-stamps (decode_rect_split chroma_tiled, decode_block_rect64 bigger arm, read_inter_rect_chroma multi arm -> mu_chroma_units replay); report continuation 8 attribution corrected: both 10-bit film gates are THIS LANE's regression (fail at 1ad7e0fc/b9530604, pass on main 73f3ac64), now green
Browse files at this commitf6ca882b18cbd5558887761bb379dd6fdef835aaParent: e44e6aa2 changed files +101 -14
- crates/ec-av1/src/decode.rs +84 -7
- lanes/av1444.report.md +17 -7
crates/ec-av1/src/decode.rsmodified+84 -7
| @@ -10031,6 +10031,15 @@ fn decode_rect_split( | ||
| 10031 | 10031 | // next block then read `dc_sign_ctx` 1 where libaom reads 0). They are |
| 10032 | 10032 | // collected here and replayed after that record. |
| 10033 | 10033 | let mut ll_chroma_units: Vec<((usize, usize), usize, Grid)> = Vec::new(); |
| 10034 | + // The chroma_tiled arm below stamps each unit's coefficient context | |
| 10035 | + // immediately (so the NEXT unit reads it), then the whole-strip | |
| 10036 | + // `record_split_luma_rect_mi` rewrites every chroma cell with ONE | |
| 10037 | + // whole-strip state and the per-unit DC signs and levels are lost | |
| 10038 | + // (class `override-slot-on-one-arm`). The units are collected here and | |
| 10039 | + // replayed after that record, the way the lossless arm's | |
| 10040 | + // `ll_chroma_units` and `decode_inter_block`'s `mu_chroma_units` tail | |
| 10041 | + // already do. | |
| 10042 | + let mut tiled_chroma_units: Vec<((usize, usize), usize, Grid, usize, usize)> = Vec::new(); | |
| 10034 | 10043 | let ac = m.alpha.map(|_| cfl_src_rect(px, py, bw, bh)); |
| 10035 | 10044 | let reach = block_reach; |
| 10036 | 10045 | let (u_grid, v_grid) = if mono(fctx) { |
| @@ -10179,6 +10188,13 @@ fn decode_rect_split( | ||
| 10179 | 10188 | levels |
| 10180 | 10189 | }; |
| 10181 | 10190 | neighbours.record_mi_chroma(cu_mi, luma_span_x, luma_span_y, plane_idx, &levels); |
| 10191 | + tiled_chroma_units.push(( | |
| 10192 | + cu_mi, | |
| 10193 | + plane_idx, | |
| 10194 | + levels.clone(), | |
| 10195 | + luma_span_x, | |
| 10196 | + luma_span_y, | |
| 10197 | + )); | |
| 10182 | 10198 | last[plane_idx - 1] = levels; |
| 10183 | 10199 | } |
| 10184 | 10200 | } |
| @@ -10270,6 +10286,9 @@ fn decode_rect_split( | ||
| 10270 | 10286 | for (cu_mi, plane, unit) in &ll_chroma_units { |
| 10271 | 10287 | neighbours.record_mi_chroma(*cu_mi, 8, 8, *plane, unit); |
| 10272 | 10288 | } |
| 10289 | + for (cu_mi, plane, unit, span_w, span_h) in &tiled_chroma_units { | |
| 10290 | + neighbours.record_mi_chroma(*cu_mi, *span_w, *span_h, *plane, unit); | |
| 10291 | + } | |
| 10273 | 10292 | neighbours.fill_skip_grid_rect((mi_r, mi_c), bw / MI, bh / MI, m.skip); |
| 10274 | 10293 | neighbours.fill_lf_grid_rect((mi_r, mi_c), bw / MI, bh / MI, tx_w as u8, tx_h as u8, 0, fctx); |
| 10275 | 10294 | if crate::envflags::env_flag!("EC_AV1_TRACE") { |
| @@ -13320,6 +13339,13 @@ fn decode_block_rect64( | ||
| 13320 | 13339 | let bigger = nw * nh > 1; |
| 13321 | 13340 | let mut u_levels = vec![0i32; chroma_w * chroma_h]; |
| 13322 | 13341 | let mut v_levels = vec![0i32; chroma_w * chroma_h]; |
| 13342 | + // The tiled units below stamp their own coefficient context | |
| 13343 | + // immediately, then the whole-strip `record_rect` rewrite paints | |
| 13344 | + // every chroma cell with ONE whole-strip state and the per-unit DC | |
| 13345 | + // signs and levels are lost (class `override-slot-on-one-arm`, same | |
| 13346 | + // shape as `decode_rect_split`'s chroma_tiled clobber). Collected | |
| 13347 | + // here and replayed after that record, the c8 `mu_chroma_units` way. | |
| 13348 | + let mut tiled_chroma_units: Vec<((usize, usize), usize, Grid, usize, usize)> = Vec::new(); | |
| 13323 | 13349 | for plane_idx in 1..=2 { |
| 13324 | 13350 | for cu_row in 0..nh { |
| 13325 | 13351 | for cu_col in 0..nw { |
| @@ -13387,11 +13413,24 @@ fn decode_block_rect64( | ||
| 13387 | 13413 | (mi_r + cu_row * (lsy / MI), mi_c + cu_col * (lsx / MI)), |
| 13388 | 13414 | lsx, lsy, plane_idx, &levels, |
| 13389 | 13415 | ); |
| 13416 | + tiled_chroma_units.push(( | |
| 13417 | + (mi_r + cu_row * (lsy / MI), mi_c + cu_col * (lsx / MI)), | |
| 13418 | + plane_idx, | |
| 13419 | + levels.clone(), | |
| 13420 | + lsx, | |
| 13421 | + lsy, | |
| 13422 | + )); | |
| 13390 | 13423 | } |
| 13391 | 13424 | } |
| 13392 | 13425 | } |
| 13393 | 13426 | } |
| 13394 | 13427 | neighbours.record_rect(at, bw, bh, mode, uv_predict_mode, &[&luma_levels[..], &u_levels[..], &v_levels[..]]); |
| 13428 | + // The per-unit re-stamp: `record_rect` above wrote the whole strip's | |
| 13429 | + // chroma cells from the assembled grids' one whole-strip state, | |
| 13430 | + // overwriting exactly the stamps the tiled loop just made. | |
| 13431 | + for (cu_mi, plane, unit, span_w, span_h) in &tiled_chroma_units { | |
| 13432 | + neighbours.record_mi_chroma(*cu_mi, *span_w, *span_h, *plane, unit); | |
| 13433 | + } | |
| 13395 | 13434 | hit!(RECT_COEFF_HITS); |
| 13396 | 13435 | } |
| 13397 | 13436 | let (py_size, py_colors) = palette_y.as_ref().map_or((0, [0u16; 8]), |p| (p.size, p.colors)); |
| @@ -19704,12 +19743,19 @@ fn read_inter_rect_chroma( | ||
| 19704 | 19743 | mode_for_tx: usize, |
| 19705 | 19744 | luma_tx_type: TxType, |
| 19706 | 19745 | fctx: &crate::decode::FrameCtx, |
| 19707 | -) -> Result<(Grid, Grid)> { | |
| 19746 | +) -> Result<(Grid, Grid, Vec<((usize, usize), usize, Grid, usize, usize)>)> { | |
| 19708 | 19747 | let (uw, uh) = (write_chroma_w.min(32), write_chroma_h.min(32)); |
| 19709 | 19748 | let (nx, ny) = (write_chroma_w / uw, write_chroma_h / uh); |
| 19710 | 19749 | let multi = nx * ny > 1; |
| 19711 | 19750 | let set = rect_inter_chroma_set(uw, uh)?; |
| 19712 | 19751 | let mut assembled: [Vec<i32>; 2] = [Vec::new(), Vec::new()]; |
| 19752 | + // The multi-unit stamps below are rewritten by the caller's whole-block | |
| 19753 | + // record (`record_rect_mi`/`record_split_luma_rect_mi` write ONE | |
| 19754 | + // whole-block chroma state, class `override-slot-on-one-arm`). The | |
| 19755 | + // block tail's square-mu derivation cannot express a non-square strip's | |
| 19756 | + // units, so the TRUE units travel back for the tail's `mu_chroma_units` | |
| 19757 | + // replay (the c8 re-stamp, at the strip's own tiling). | |
| 19758 | + let mut units: Vec<((usize, usize), usize, Grid, usize, usize)> = Vec::new(); | |
| 19713 | 19759 | if multi { |
| 19714 | 19760 | hit!(CHROMA_SPLIT_TX_HITS); |
| 19715 | 19761 | assembled = [ |
| @@ -19760,6 +19806,7 @@ fn read_inter_rect_chroma( | ||
| 19760 | 19806 | let start = (cu_row * uh + rr) * chroma_side + cu_col * uw; |
| 19761 | 19807 | dst[start..start + uw].copy_from_slice(&cu_grid[rr * uw..][..uw]); |
| 19762 | 19808 | } |
| 19809 | + units.push((cu_mi, plane_idx, cu_grid, span_x, span_y)); | |
| 19763 | 19810 | } else { |
| 19764 | 19811 | assembled[plane_idx - 1] = embed_rect_grid(&cu_grid, uw, uh, chroma_side); |
| 19765 | 19812 | } |
| @@ -19767,7 +19814,7 @@ fn read_inter_rect_chroma( | ||
| 19767 | 19814 | } |
| 19768 | 19815 | } |
| 19769 | 19816 | let [ug, vg] = assembled; |
| 19770 | - Ok((Grid::Own(ug), Grid::Own(vg))) | |
| 19817 | + Ok((Grid::Own(ug), Grid::Own(vg), units)) | |
| 19771 | 19818 | } |
| 19772 | 19819 | |
| 19773 | 19820 | /// [`read_inter_plane`] for a rectangular transform unit (lane-inter4 r2): |
| @@ -28296,6 +28343,12 @@ fn decode_inter_block( | ||
| 28296 | 28343 | let mode_for_tx; |
| 28297 | 28344 | let uv_predict_mode; |
| 28298 | 28345 | let (luma_grid, u_grid, v_grid); |
| 28346 | + // The rect_tu arms' chroma helper returns its TRUE per-unit coefficient | |
| 28347 | + // context stamps (see `read_inter_rect_chroma`); they are appended to | |
| 28348 | + // `mu_chroma_units` below so the block tail replays them after the | |
| 28349 | + // whole-block record. `mu_chroma`'s own square-mu derivation cannot | |
| 28350 | + // express a non-square strip's units. | |
| 28351 | + let mut rect_chroma_units: Vec<((usize, usize), usize, Grid, usize, usize)> = Vec::new(); | |
| 28299 | 28352 | let block_filter; |
| 28300 | 28353 | let ref_frame_for_lf; |
| 28301 | 28354 | let globalmv_for_lf; |
| @@ -29509,7 +29562,7 @@ fn decode_inter_block( | ||
| 29509 | 29562 | } else if rect_tu { |
| 29510 | 29563 | // One chroma read for the whole strip at 4:2:0, two |
| 29511 | 29564 | // 32-capped units at 4:4:4 -- see the helper. |
| 29512 | - (u_grid, v_grid) = read_inter_rect_chroma( | |
| 29565 | + (u_grid, v_grid, rect_chroma_units) = read_inter_rect_chroma( | |
| 29513 | 29566 | dec, |
| 29514 | 29567 | cdfs, |
| 29515 | 29568 | neighbours, |
| @@ -30892,7 +30945,7 @@ fn decode_inter_block( | ||
| 30892 | 30945 | } else if rect_tu { |
| 30893 | 30946 | // One chroma read for the whole strip at 4:2:0, two |
| 30894 | 30947 | // 32-capped units at 4:4:4 -- see the helper. |
| 30895 | - (u_grid, v_grid) = read_inter_rect_chroma( | |
| 30948 | + (u_grid, v_grid, rect_chroma_units) = read_inter_rect_chroma( | |
| 30896 | 30949 | dec, |
| 30897 | 30950 | cdfs, |
| 30898 | 30951 | neighbours, |
| @@ -31794,7 +31847,7 @@ fn decode_inter_block( | ||
| 31794 | 31847 | // the partial right superblock read row 1 where libaom reads row 2). The |
| 31795 | 31848 | // units are collected here and re-stamped after that record, in mu-chunk |
| 31796 | 31849 | // order so a later unit still wins over an earlier one. |
| 31797 | - let mu_chroma_units: Vec<((usize, usize), usize, Grid, usize, usize)> = if mu_chroma { | |
| 31850 | + let mut mu_chroma_units: Vec<((usize, usize), usize, Grid, usize, usize)> = if mu_chroma { | |
| 31798 | 31851 | // lane-lossless2: the unit is TX_32X32 (one per 64x64 mu chunk) |
| 31799 | 31852 | // normally and TX_4X4 on a lossless frame, where the whole chroma |
| 31800 | 31853 | // plane block is a raster of them. |
| @@ -31859,6 +31912,9 @@ fn decode_inter_block( | ||
| 31859 | 31912 | } else { |
| 31860 | 31913 | Vec::new() |
| 31861 | 31914 | }; |
| 31915 | + // The rect_tu strips' true units (`read_inter_rect_chroma`'s return): | |
| 31916 | + // replayed by the same loop below, after the whole-block record. | |
| 31917 | + mu_chroma_units.extend(rect_chroma_units); | |
| 31862 | 31918 | // libaom `av1_reset_entropy_context` / `av1_set_entropy_contexts`: |
| 31863 | 31919 | // `nplanes = 1 + (num_planes - 1) * xd->is_chroma_ref` -- a block that is |
| 31864 | 31920 | // NOT the chroma reference of its 4:2:0 pair codes no chroma transform at |
| @@ -32608,7 +32664,20 @@ fn decode_inter_sub8_split4( | ||
| 32608 | 32664 | // block's `get_intra_edge_filter_type` must see that SMOOTH_H left |
| 32609 | 32665 | // neighbour, not the DC_PRED this stamp used to paint over it). So the |
| 32610 | 32666 | // group-level stamp runs only where the 4:2:0 group unit is real. |
| 32611 | - if !chroma_444 { | |
| 32667 | + // | |
| 32668 | + // 4:2:0 "real" means the group unit was painted by the INTER arm below: | |
| 32669 | + // when the chroma-reference sub-block was INTRA, that leaf's own tail | |
| 32670 | + // ([`decode_intra_sub8_leaf`]) already recorded the group cell with its | |
| 32671 | + // real `uv_predict_mode` -- possibly a SMOOTH mode the next block's | |
| 32672 | + // chroma edge filter must see. The 444 delta's unconditional | |
| 32673 | + // `!chroma_444` stamp ran after it and painted DC over the mi-exact | |
| 32674 | + // cell, so every later chroma block read `intra_edge_filter_type` 0 | |
| 32675 | + // where libaom (and the pre-delta tree) read 1 -- 188 chroma ops of the | |
| 32676 | + // gm_small_side witness flipped their smooth flag and 10-bit film | |
| 32677 | + // frames mismatched ffmpeg by +-1..7 (class | |
| 32678 | + // `override-slot-on-one-arm`, this lane's own 10-bit film gate | |
| 32679 | + // regression at 1ad7e0fc; port of lane-av1-cfl's 7c6dad53). | |
| 32680 | + if !chroma_444 && !intra_chroma { | |
| 32612 | 32681 | neighbours.record_uv_mode_mi(gr, gc, 2, 2, DC_PRED); |
| 32613 | 32682 | } |
| 32614 | 32683 | // lane-t900 r23 (class [[new-map-ignores-tile-edge]]: a neighbour map |
| @@ -33883,7 +33952,15 @@ fn decode_inter_sub8_rect2( | ||
| 33883 | 33952 | // over an intra piece's real `uv_mode` and the next block's |
| 33884 | 33953 | // `get_intra_edge_filter_type` lost the smooth neighbour (same class as |
| 33885 | 33954 | // [`decode_inter_sub8_split4`]'s tail, frame 19 of the fixture). |
| 33886 | - if !chroma_444 { | |
| 33955 | + // 4:2:0 needs the same second half as the split twin: the stamp must run | |
| 33956 | + // only when the group unit was painted by the INTER arm below. When the | |
| 33957 | + // chroma-reference sub-block was INTRA, its own | |
| 33958 | + // [`decode_intra_sub8_leaf`] tail recorded the group cell with the real | |
| 33959 | + // `uv_predict_mode`, and this DC stamp ran after it and flattened the | |
| 33960 | + // mi-exact cell (class `override-slot-on-one-arm`, this lane's own | |
| 33961 | + // 10-bit film gate regression at 1ad7e0fc; port of lane-av1-cfl's | |
| 33962 | + // 7c6dad53). | |
| 33963 | + if !chroma_444 && !intra_chroma { | |
| 33887 | 33964 | neighbours.record_uv_mode_mi(gr, gc, 2, 2, DC_PRED); |
| 33888 | 33965 | } |
| 33889 | 33966 | // lane-t900 r23 (class [[new-map-ignores-tile-edge]]: a neighbour map |
lanes/av1444.report.mdmodified+17 -7
| @@ -250,13 +250,23 @@ shown frames byte-exact vs ffmpeg AND aomdec (three-way sha256 | ||
| 250 | 250 | the documented kill-child/drain/isolated-rerun protocol). |
| 251 | 251 | - `a_10bit_128sb_film_frames_with_warp_cdef_and_interintra_...` and |
| 252 | 252 | `a_10bit_film_frames_with_small_side_globalmv_and_rect_warp_reach_...` |
| 253 | - — PRE-EXISTING at the parent commit b9530604 (reproduced in a throwaway | |
| 254 | - base worktree, identical failures), i.e. silent regressions from | |
| 255 | - continuations 5-7's shared-code changes that rounds 5-7 never caught | |
| 256 | - because the 10-bit film arms were not rerun. 1920x792 10-bit films, | |
| 257 | - scattered reconstruction-level diffs; fix-now deferred to a dedicated | |
| 258 | - 10-bit-film round (they are outside this lane's 444 arm list; the | |
| 259 | - named 10-bit SQUARE witness passes). | |
| 253 | + — ATTRIBUTION CORRECTED (2026-09-24, lane-av1-444-film): the earlier | |
| 254 | + "pre-existing at b9530604" line above was WRONG — the reviewer reran | |
| 255 | + all three trees and these two gates FAIL at 1ad7e0fc and b9530604 but | |
| 256 | + PASS on main 73f3ac64 and fork 7f8d6cf6. They are THIS LANE's | |
| 257 | + regression, and continuation 7 had already diagnosed the mechanism: | |
| 258 | + the 444 delta moved the sub8 group tails' | |
| 259 | + `record_uv_mode_mi(gr, gc, 2, 2, DC_PRED)` to a bare `!chroma_444` | |
| 260 | + gate, which at 4:2:0 stamps DC over an INTRA chroma-reference piece's | |
| 261 | + real `uv_predict_mode` (continuation 7's trace: pieces 12/11/9/12 at | |
| 262 | + (42,54..55) wiped to 0) and drops the next block's chroma intra-edge | |
| 263 | + filter (class `override-slot-on-one-arm`). 1920x792 10-bit films, | |
| 264 | + scattered +-1..7 reconstruction diffs. FIXED on lane-av1-444-film: | |
| 265 | + both stamps gated `!chroma_444 && !intra_chroma` (port of | |
| 266 | + lane-av1-cfl's 7c6dad53), plus three same-class per-unit chroma | |
| 267 | + re-stamps (decode_rect_split chroma_tiled, decode_block_rect64 | |
| 268 | + bigger arm, read_inter_rect_chroma multi arm) matching the in-tree c8 | |
| 269 | + `mu_chroma_units` pattern. | |
| 260 | 270 | All named regression gates green in this run and the witness table: |
| 261 | 271 | 4:2:2 refused (`a_non_420_subsampled_sequence_header_is_refused_by_name |
| 262 | 272 | ok`), qmatrix refused, cdf gates, mono 60f, reelb_* 10-bit — all `ok`. |