forge
Explore
Log in

Don't you dare go Hollow

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 commit

f6ca882b18cbd5558887761bb379dd6fdef835aaAhmet Kaan GümüşParent: e44e6aa
Gates re-run on lane-av1-444-film (CARGO_TARGET_DIR=~/.cache/cargo-target-av1444film):
- a_10bit_128sb_film_frames_with_warp_cdef_and_interintra_decode_pixel_exact: ok (15 frames pixel-exact)
- a_10bit_film_frames_with_small_side_globalmv_and_rect_warp_reach_decode_pixel_exact: ok (33 frames pixel-exact)
crates/ec-av1/src/decode.rsmodified+84 -7
@@ -10031,6 +10031,15 @@ fn decode_rect_split(
1003110031 // next block then read `dc_sign_ctx` 1 where libaom reads 0). They are
1003210032 // collected here and replayed after that record.
1003310033 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();
1003410043 let ac = m.alpha.map(|_| cfl_src_rect(px, py, bw, bh));
1003510044 let reach = block_reach;
1003610045 let (u_grid, v_grid) = if mono(fctx) {
@@ -10179,6 +10188,13 @@ fn decode_rect_split(
1017910188 levels
1018010189 };
1018110190 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+ ));
1018210198 last[plane_idx - 1] = levels;
1018310199 }
1018410200 }
@@ -10270,6 +10286,9 @@ fn decode_rect_split(
1027010286 for (cu_mi, plane, unit) in &ll_chroma_units {
1027110287 neighbours.record_mi_chroma(*cu_mi, 8, 8, *plane, unit);
1027210288 }
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+ }
1027310292 neighbours.fill_skip_grid_rect((mi_r, mi_c), bw / MI, bh / MI, m.skip);
1027410293 neighbours.fill_lf_grid_rect((mi_r, mi_c), bw / MI, bh / MI, tx_w as u8, tx_h as u8, 0, fctx);
1027510294 if crate::envflags::env_flag!("EC_AV1_TRACE") {
@@ -13320,6 +13339,13 @@ fn decode_block_rect64(
1332013339 let bigger = nw * nh > 1;
1332113340 let mut u_levels = vec![0i32; chroma_w * chroma_h];
1332213341 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();
1332313349 for plane_idx in 1..=2 {
1332413350 for cu_row in 0..nh {
1332513351 for cu_col in 0..nw {
@@ -13387,11 +13413,24 @@ fn decode_block_rect64(
1338713413 (mi_r + cu_row * (lsy / MI), mi_c + cu_col * (lsx / MI)),
1338813414 lsx, lsy, plane_idx, &levels,
1338913415 );
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+ ));
1339013423 }
1339113424 }
1339213425 }
1339313426 }
1339413427 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+ }
1339513434 hit!(RECT_COEFF_HITS);
1339613435 }
1339713436 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(
1970419743 mode_for_tx: usize,
1970519744 luma_tx_type: TxType,
1970619745 fctx: &crate::decode::FrameCtx,
19707-) -> Result<(Grid, Grid)> {
19746+) -> Result<(Grid, Grid, Vec<((usize, usize), usize, Grid, usize, usize)>)> {
1970819747 let (uw, uh) = (write_chroma_w.min(32), write_chroma_h.min(32));
1970919748 let (nx, ny) = (write_chroma_w / uw, write_chroma_h / uh);
1971019749 let multi = nx * ny > 1;
1971119750 let set = rect_inter_chroma_set(uw, uh)?;
1971219751 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();
1971319759 if multi {
1971419760 hit!(CHROMA_SPLIT_TX_HITS);
1971519761 assembled = [
@@ -19760,6 +19806,7 @@ fn read_inter_rect_chroma(
1976019806 let start = (cu_row * uh + rr) * chroma_side + cu_col * uw;
1976119807 dst[start..start + uw].copy_from_slice(&cu_grid[rr * uw..][..uw]);
1976219808 }
19809+ units.push((cu_mi, plane_idx, cu_grid, span_x, span_y));
1976319810 } else {
1976419811 assembled[plane_idx - 1] = embed_rect_grid(&cu_grid, uw, uh, chroma_side);
1976519812 }
@@ -19767,7 +19814,7 @@ fn read_inter_rect_chroma(
1976719814 }
1976819815 }
1976919816 let [ug, vg] = assembled;
19770- Ok((Grid::Own(ug), Grid::Own(vg)))
19817+ Ok((Grid::Own(ug), Grid::Own(vg), units))
1977119818 }
1977219819
1977319820 /// [`read_inter_plane`] for a rectangular transform unit (lane-inter4 r2):
@@ -28296,6 +28343,12 @@ fn decode_inter_block(
2829628343 let mode_for_tx;
2829728344 let uv_predict_mode;
2829828345 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();
2829928352 let block_filter;
2830028353 let ref_frame_for_lf;
2830128354 let globalmv_for_lf;
@@ -29509,7 +29562,7 @@ fn decode_inter_block(
2950929562 } else if rect_tu {
2951029563 // One chroma read for the whole strip at 4:2:0, two
2951129564 // 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(
2951329566 dec,
2951429567 cdfs,
2951529568 neighbours,
@@ -30892,7 +30945,7 @@ fn decode_inter_block(
3089230945 } else if rect_tu {
3089330946 // One chroma read for the whole strip at 4:2:0, two
3089430947 // 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(
3089630949 dec,
3089730950 cdfs,
3089830951 neighbours,
@@ -31794,7 +31847,7 @@ fn decode_inter_block(
3179431847 // the partial right superblock read row 1 where libaom reads row 2). The
3179531848 // units are collected here and re-stamped after that record, in mu-chunk
3179631849 // 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 {
3179831851 // lane-lossless2: the unit is TX_32X32 (one per 64x64 mu chunk)
3179931852 // normally and TX_4X4 on a lossless frame, where the whole chroma
3180031853 // plane block is a raster of them.
@@ -31859,6 +31912,9 @@ fn decode_inter_block(
3185931912 } else {
3186031913 Vec::new()
3186131914 };
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);
3186231918 // libaom `av1_reset_entropy_context` / `av1_set_entropy_contexts`:
3186331919 // `nplanes = 1 + (num_planes - 1) * xd->is_chroma_ref` -- a block that is
3186431920 // NOT the chroma reference of its 4:2:0 pair codes no chroma transform at
@@ -32608,7 +32664,20 @@ fn decode_inter_sub8_split4(
3260832664 // block's `get_intra_edge_filter_type` must see that SMOOTH_H left
3260932665 // neighbour, not the DC_PRED this stamp used to paint over it). So the
3261032666 // 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 {
3261232681 neighbours.record_uv_mode_mi(gr, gc, 2, 2, DC_PRED);
3261332682 }
3261432683 // lane-t900 r23 (class [[new-map-ignores-tile-edge]]: a neighbour map
@@ -33883,7 +33952,15 @@ fn decode_inter_sub8_rect2(
3388333952 // over an intra piece's real `uv_mode` and the next block's
3388433953 // `get_intra_edge_filter_type` lost the smooth neighbour (same class as
3388533954 // [`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 {
3388733964 neighbours.record_uv_mode_mi(gr, gc, 2, 2, DC_PRED);
3388833965 }
3388933966 // 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
250250 the documented kill-child/drain/isolated-rerun protocol).
251251 - `a_10bit_128sb_film_frames_with_warp_cdef_and_interintra_...` and
252252 `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.
260270 All named regression gates green in this run and the witness table:
261271 4:2:2 refused (`a_non_420_subsampled_sequence_header_is_refused_by_name
262272 ok`), qmatrix refused, cdf gates, mono 60f, reelb_* 10-bit — all `ok`.