ec-av1: decode_inter_block's 422 chroma half on the per-axis plane-block model
Browse files at this commite371b5781e41f4018625eff6769000c661377946Parent: 19f693e2 changed files +557 -130
- crates/ec-av1/src/decode.rs +424 -130
- lanes/av1422blockhalf.report.md +133 -0
crates/ec-av1/src/decode.rsmodified+424 -130
| @@ -10213,6 +10213,21 @@ fn decode_rect_split( | ||
| 10213 | 10213 | let (px, py) = (mi_c * MI, mi_r * MI); |
| 10214 | 10214 | let (cpx, cpy) = (px >> ss_x(fctx), py >> ss_y(fctx)); |
| 10215 | 10215 | let (chroma_w, chroma_h) = (bw >> ss_x(fctx), bh >> ss_y(fctx)); |
| 10216 | + // lane-av1-422blockhalf: at ss (1,0) the tall/wide 1:2 and 1:4 strips' | |
| 10217 | + // chroma plane block is BLOCK_INVALID (`av1_ss_size_lookup[...][1][0]`, | |
| 10218 | + // blockd.h -- the 4:2:2 column maps BLOCK_8X16/16X32/32X64/64X128 and | |
| 10219 | + // BLOCK_8X32/16X64, plus 4-wide BLOCK_4X16, to BLOCK_INVALID), so | |
| 10220 | + // `av1_get_max_uv_txsize` indexes `max_txsize_rect_lookup` OUT OF BOUNDS | |
| 10221 | + // and the pinned Release oracle byte there is TX_4X8 (the lane-av1-422m | |
| 10222 | + // measurement). The plane is still coded -- `decode_token_recon_block` | |
| 10223 | + // steps it in that (4, 8) unit shape -- so the strip's chroma tiles into | |
| 10224 | + // 4x8 rect units, plane-major. | |
| 10225 | + let chroma_422_oob = ss_x(fctx) == 1 | |
| 10226 | + && ss_y(fctx) == 0 | |
| 10227 | + && matches!( | |
| 10228 | + (bw, bh), | |
| 10229 | + (8, 16) | (16, 32) | (32, 64) | (64, 128) | (8, 32) | (16, 64) | |
| 10230 | + ); | |
| 10216 | 10231 | // The chroma transform is picked before any symbol is read, so an |
| 10217 | 10232 | // unsupported chroma shape refuses before this strip desyncs the tile. |
| 10218 | 10233 | let chroma: Option<(TxbSet, &[u16])> = match (chroma_w, chroma_h) { |
| @@ -10251,12 +10266,22 @@ fn decode_rect_split( | ||
| 10251 | 10266 | }); |
| 10252 | 10267 | } |
| 10253 | 10268 | } |
| 10254 | - if chroma.is_none() { | |
| 10255 | - // Diagnostic for the next caller that lands here (class | |
| 10256 | - // refusal-names-a-correlate: the message names the tool, not the | |
| 10257 | - // shape); the refusal below keeps its inventory-pinned wording. | |
| 10258 | - eprintln!("EC_RECTCHROMA_GAP luma={bw}x{bh} tx={tx_w}x{tx_h} chroma={chroma_w}x{chroma_h}"); | |
| 10259 | - } | |
| 10269 | + } | |
| 10270 | + // lane-av1-422blockhalf: the tiled arms below handle every shape this | |
| 10271 | + // strip can carry (including the 4:2:2 BLOCK_INVALID planes), so the | |
| 10272 | + // diagnostic names only the shapes that would actually refuse -- it used | |
| 10273 | + // to fire for every tiled square too (the parent lane's `chroma=8x8` | |
| 10274 | + // rows) and sent the next lane chasing handled shapes. | |
| 10275 | + let chroma_tiled = chroma_422_oob | |
| 10276 | + || matches!( | |
| 10277 | + (chroma_w, chroma_h), | |
| 10278 | + (64, 32) | (32, 64) | (64, 16) | (16, 64) | (32, 32) | (16, 16) | (8, 8) | |
| 10279 | + ); | |
| 10280 | + if !m.skip && chroma.is_none() && !chroma_tiled { | |
| 10281 | + // Diagnostic for the next caller that lands here (class | |
| 10282 | + // refusal-names-a-correlate: the message names the tool, not the | |
| 10283 | + // shape); the refusal below keeps its inventory-pinned wording. | |
| 10284 | + eprintln!("EC_RECTCHROMA_GAP luma={bw}x{bh} tx={tx_w}x{tx_h} chroma={chroma_w}x{chroma_h}"); | |
| 10260 | 10285 | } |
| 10261 | 10286 | // lane-rectsplit r2 (verifier finding): with both callers wired |
| 10262 | 10287 | // (`decode_block_rect`'s 32x16/16x32 and `decode_block_rect64`'s |
| @@ -10273,7 +10298,6 @@ fn decode_rect_split( | ||
| 10273 | 10298 | // (16x8 luma -> 8x8 chroma) -- the square rows below. At 4:2:0 and 4:4:4 a |
| 10274 | 10299 | // rect strip's chroma is itself rect, so the square rows are unreachable |
| 10275 | 10300 | // there and cannot change their results. |
| 10276 | - let chroma_tiled = matches!((chroma_w, chroma_h), (64, 32) | (32, 64) | (64, 16) | (16, 64) | (32, 32) | (16, 16) | (8, 8)); | |
| 10277 | 10301 | if !m.skip && chroma.is_none() && !chroma_tiled { |
| 10278 | 10302 | return Err(unsupported( |
| 10279 | 10303 | "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here", |
| @@ -10573,20 +10597,59 @@ fn decode_rect_split( | ||
| 10573 | 10597 | (zero.clone(), zero) |
| 10574 | 10598 | } else if m.skip { |
| 10575 | 10599 | let zero = Grid::Zero(chroma_w * chroma_h); |
| 10576 | - if let Some((ub, _)) = &m.palette_uv { | |
| 10577 | - set_palette_pred(ub.clone(), fctx); | |
| 10578 | - } | |
| 10579 | - push_intra_rect(1, | |
| 10580 | - cpx, cpy, chroma_w, chroma_h, m.uv_predict_mode, m.angle_delta_uv, reach, &zero, | |
| 10581 | - m.alpha.zip(ac).map(|((au, _), ac)| (au, ac)), None, m.smooth_neighbor_uv, fctx, | |
| 10582 | - ); | |
| 10583 | - if let Some((_, vb)) = &m.palette_uv { | |
| 10584 | - set_palette_pred(vb.clone(), fctx); | |
| 10600 | + if chroma_422_oob { | |
| 10601 | + // lane-av1-422blockhalf: libaom predicts an INTRA strip's chroma | |
| 10602 | + // per transform unit even when the strip is skipped | |
| 10603 | + // (`decode_token_recon_block`'s per-TU plane walk runs before the | |
| 10604 | + // skip guard), so the BLOCK_INVALID plane predicts as (4, 8) | |
| 10605 | + // units -- one whole-plane push here would ask the intra | |
| 10606 | + // predictor for a 1:8 rect it never needs. | |
| 10607 | + let (uw, uh) = (4usize, 8usize); | |
| 10608 | + for plane_idx in 1..=2 { | |
| 10609 | + if let Some((ub, vb)) = &m.palette_uv { | |
| 10610 | + let buf = if plane_idx == 1 { ub } else { vb }; | |
| 10611 | + set_palette_pred(buf.clone(), fctx); | |
| 10612 | + } | |
| 10613 | + for cu_row in 0..chroma_h / uh { | |
| 10614 | + for cu_col in 0..chroma_w / uw { | |
| 10615 | + push_intra_rect( | |
| 10616 | + plane_idx, | |
| 10617 | + cpx + cu_col * uw, | |
| 10618 | + cpy + cu_row * uh, | |
| 10619 | + uw, | |
| 10620 | + uh, | |
| 10621 | + m.uv_predict_mode, | |
| 10622 | + m.angle_delta_uv, | |
| 10623 | + reach, | |
| 10624 | + &ZERO_RESIDUAL[..uw * uh], | |
| 10625 | + m.alpha.zip(ac.clone()).map(|((au, av), ac)| { | |
| 10626 | + ( | |
| 10627 | + if plane_idx == 1 { au } else { av }, | |
| 10628 | + ac, | |
| 10629 | + ) | |
| 10630 | + }), | |
| 10631 | + None, | |
| 10632 | + m.smooth_neighbor_uv, fctx, | |
| 10633 | + ); | |
| 10634 | + } | |
| 10635 | + } | |
| 10636 | + } | |
| 10637 | + } else { | |
| 10638 | + if let Some((ub, _)) = &m.palette_uv { | |
| 10639 | + set_palette_pred(ub.clone(), fctx); | |
| 10640 | + } | |
| 10641 | + push_intra_rect(1, | |
| 10642 | + cpx, cpy, chroma_w, chroma_h, m.uv_predict_mode, m.angle_delta_uv, reach, &zero, | |
| 10643 | + m.alpha.zip(ac).map(|((au, _), ac)| (au, ac)), None, m.smooth_neighbor_uv, fctx, | |
| 10644 | + ); | |
| 10645 | + if let Some((_, vb)) = &m.palette_uv { | |
| 10646 | + set_palette_pred(vb.clone(), fctx); | |
| 10647 | + } | |
| 10648 | + push_intra_rect(2, | |
| 10649 | + cpx, cpy, chroma_w, chroma_h, m.uv_predict_mode, m.angle_delta_uv, reach, &zero, | |
| 10650 | + m.alpha.zip(ac).map(|((_, av), ac)| (av, ac)), None, m.smooth_neighbor_uv, fctx, | |
| 10651 | + ); | |
| 10585 | 10652 | } |
| 10586 | - push_intra_rect(2, | |
| 10587 | - cpx, cpy, chroma_w, chroma_h, m.uv_predict_mode, m.angle_delta_uv, reach, &zero, | |
| 10588 | - m.alpha.zip(ac).map(|((_, av), ac)| (av, ac)), None, m.smooth_neighbor_uv, fctx, | |
| 10589 | - ); | |
| 10590 | 10653 | (zero.clone(), zero) |
| 10591 | 10654 | } else if lossless(fctx) { |
| 10592 | 10655 | // lane-lossless: the strip's chroma plane block is coded as 4x4 |
| @@ -10643,15 +10706,22 @@ fn decode_rect_split( | ||
| 10643 | 10706 | let [ug, vg] = last; |
| 10644 | 10707 | (ug, vg) |
| 10645 | 10708 | } else if chroma_tiled { |
| 10646 | - let (uw, uh, set, scan): (usize, usize, TxbSet, &[u16]) = match (chroma_w, chroma_h) { | |
| 10647 | - (64, 32) | (32, 64) | (32, 32) => (32, 32, TxbSet::Chroma32, default_scan(32)), | |
| 10648 | - (64, 16) => (32, 16, TxbSet::ChromaRect32x16, &SCAN_32X16), | |
| 10649 | - (16, 64) => (16, 32, TxbSet::ChromaRect32x16, &SCAN_16X32), | |
| 10650 | - // lane-av1-422: the 4:2:2 square chroma planes (height unhalved), | |
| 10651 | - // through the square reader like every other square chroma unit. | |
| 10652 | - (16, 16) => (16, 16, TxbSet::Chroma16, default_scan(16)), | |
| 10653 | - (8, 8) => (8, 8, TxbSet::Chroma8, default_scan(8)), | |
| 10654 | - _ => unreachable!("chroma_tiled"), | |
| 10709 | + let (uw, uh, set, scan): (usize, usize, TxbSet, &[u16]) = if chroma_422_oob { | |
| 10710 | + // lane-av1-422blockhalf: the BLOCK_INVALID-plane strip's (4, 8) | |
| 10711 | + // units -- the Release oracle's out-of-bounds | |
| 10712 | + // `max_txsize_rect_lookup[BLOCK_INVALID]` byte (see above). | |
| 10713 | + (4, 8, TxbSet::ChromaRect8x4, &SCAN_4X8) | |
| 10714 | + } else { | |
| 10715 | + match (chroma_w, chroma_h) { | |
| 10716 | + (64, 32) | (32, 64) | (32, 32) => (32, 32, TxbSet::Chroma32, default_scan(32)), | |
| 10717 | + (64, 16) => (32, 16, TxbSet::ChromaRect32x16, &SCAN_32X16), | |
| 10718 | + (16, 64) => (16, 32, TxbSet::ChromaRect32x16, &SCAN_16X32), | |
| 10719 | + // lane-av1-422: the 4:2:2 square chroma planes (height unhalved), | |
| 10720 | + // through the square reader like every other square chroma unit. | |
| 10721 | + (16, 16) => (16, 16, TxbSet::Chroma16, default_scan(16)), | |
| 10722 | + (8, 8) => (8, 8, TxbSet::Chroma8, default_scan(8)), | |
| 10723 | + _ => unreachable!("chroma_tiled"), | |
| 10724 | + } | |
| 10655 | 10725 | }; |
| 10656 | 10726 | // lane-av1-422: the witness counter, keyed to ss (1,0) so only a 4:2:2 |
| 10657 | 10727 | // frame's square chroma units count it. |
| @@ -10660,7 +10730,15 @@ fn decode_rect_split( | ||
| 10660 | 10730 | } |
| 10661 | 10731 | let (nw, nh) = (chroma_w / uw, chroma_h / uh); |
| 10662 | 10732 | let bigger = chroma_w * chroma_h > uw * uh; |
| 10663 | - let default_tx = TxType::DctDct; | |
| 10733 | + // `av1_get_ext_tx_set_type`: a chroma transform whose square-up size | |
| 10734 | + // is TX_32X32 or bigger resolves to `EXT_TX_SET_DCTONLY` for intra; | |
| 10735 | + // smaller rect units (the 4:2:2 BLOCK_INVALID-plane (4, 8)s) take the | |
| 10736 | + // mode-indexed default, the same rule the unsplit arm below applies. | |
| 10737 | + let default_tx = if uw.max(uh) >= 32 { | |
| 10738 | + TxType::DctDct | |
| 10739 | + } else { | |
| 10740 | + default_intra_tx_type(m.uv_predict_mode as u8) | |
| 10741 | + }; | |
| 10664 | 10742 | let mut last = [Grid::Zero(uw * uh), Grid::Zero(uw * uh)]; |
| 10665 | 10743 | for plane_idx in 1..=2 { |
| 10666 | 10744 | for cu_row in 0..nh { |
| @@ -10671,7 +10749,17 @@ fn decode_rect_split( | ||
| 10671 | 10749 | mi_r + cu_row * (luma_span_y / MI), |
| 10672 | 10750 | mi_c + cu_col * (luma_span_x / MI), |
| 10673 | 10751 | ); |
| 10674 | - let cu_around = neighbours.around_mi_rect(cu_mi, luma_span_x, luma_span_y); | |
| 10752 | + // lane-av1-422blockhalf: the 4:2:2 (4, 8) units read their | |
| 10753 | + // chroma context per chroma cell | |
| 10754 | + // ([`Neighbours::around_mi_422_chroma`], the block-8 | |
| 10755 | + // rule) -- the plain rect walk samples one chroma cell | |
| 10756 | + // twice at ss_x 1. Every pre-existing shape keeps its own | |
| 10757 | + // walk. | |
| 10758 | + let cu_around = if chroma_422_oob { | |
| 10759 | + neighbours.around_mi_422_chroma(cu_mi, luma_span_x, luma_span_y) | |
| 10760 | + } else { | |
| 10761 | + neighbours.around_mi_rect(cu_mi, luma_span_x, luma_span_y) | |
| 10762 | + }; | |
| 10675 | 10763 | let (cu_x, cu_y) = (cpx + cu_col * uw, cpy + cu_row * uh); |
| 10676 | 10764 | let cfl = m.alpha.map(|(au, av)| { |
| 10677 | 10765 | let alpha = if plane_idx == 1 { au } else { av }; |
| @@ -23228,6 +23316,12 @@ fn read_inter_rect_chroma( | ||
| 23228 | 23316 | let (nx, ny) = (write_chroma_w / uw, write_chroma_h / uh); |
| 23229 | 23317 | let multi = nx * ny > 1; |
| 23230 | 23318 | let set = rect_inter_chroma_set(uw, uh)?; |
| 23319 | + // lane-av1-422blockhalf: the assembled block grid is the PRED stride x | |
| 23320 | + // the plane's true height -- at 4:2:2 a square block's plane is | |
| 23321 | + // (side/2, side), so the old `chroma_side`-square sizing under-allocated | |
| 23322 | + // every row past `chroma_stride` once the caller began passing the | |
| 23323 | + // per-axis stride. | |
| 23324 | + let assembled_h = write_chroma_h.max(chroma_side); | |
| 23231 | 23325 | let mut assembled: [Vec<i32>; 2] = [Vec::new(), Vec::new()]; |
| 23232 | 23326 | // The multi-unit stamps below are rewritten by the caller's whole-block |
| 23233 | 23327 | // record (`record_rect_mi`/`record_split_luma_rect_mi` write ONE |
| @@ -23239,8 +23333,8 @@ fn read_inter_rect_chroma( | ||
| 23239 | 23333 | if multi { |
| 23240 | 23334 | hit!(CHROMA_SPLIT_TX_HITS); |
| 23241 | 23335 | assembled = [ |
| 23242 | - vec![0i32; chroma_side * chroma_side], | |
| 23243 | - vec![0i32; chroma_side * chroma_side], | |
| 23336 | + vec![0i32; chroma_side * assembled_h], | |
| 23337 | + vec![0i32; chroma_side * assembled_h], | |
| 23244 | 23338 | ]; |
| 23245 | 23339 | } |
| 23246 | 23340 | for plane_idx in 1..=2 { |
| @@ -23291,7 +23385,12 @@ fn read_inter_rect_chroma( | ||
| 23291 | 23385 | } |
| 23292 | 23386 | units.push((cu_mi, plane_idx, cu_grid, span_x, span_y)); |
| 23293 | 23387 | } else { |
| 23294 | - assembled[plane_idx - 1] = embed_rect_grid(&cu_grid, uw, uh, chroma_side); | |
| 23388 | + let mut full = vec![0i32; chroma_side * assembled_h]; | |
| 23389 | + for rr in 0..uh { | |
| 23390 | + full[rr * chroma_side..][..uw] | |
| 23391 | + .copy_from_slice(&cu_grid[rr * uw..][..uw]); | |
| 23392 | + } | |
| 23393 | + assembled[plane_idx - 1] = full; | |
| 23295 | 23394 | } |
| 23296 | 23395 | } |
| 23297 | 23396 | } |
| @@ -31827,6 +31926,20 @@ fn decode_inter_block( | ||
| 31827 | 31926 | } |
| 31828 | 31927 | _ => (write_w >> ss_x(fctx), write_h >> ss_y(fctx)), |
| 31829 | 31928 | }; |
| 31929 | + // lane-av1-422blockhalf: the chroma PREDICTION buffers take the PLANE | |
| 31930 | + // BLOCK's own per-axis shape at 4:2:2 -- (side/2, side) -- instead of the | |
| 31931 | + // enclosing square `chroma_side` the pre-port model indexed, and the | |
| 31932 | + // masked-compound blend reads its luma mask through the plane's real | |
| 31933 | + // subsampling shifts (aom_dsp/blend-a64-mask.c's four branches; the | |
| 31934 | + // stop-note this lane owns). Every consumer below strides with | |
| 31935 | + // `chroma_stride`. At 4:2:0 and 4:4:4 both values reduce to the square | |
| 31936 | + // `chroma_side` verbatim, so only 4:2:2 changes shape. | |
| 31937 | + let chroma_422 = ss_x(fctx) == 1 && ss_y(fctx) == 0; | |
| 31938 | + let (chroma_stride, chroma_buf_h) = if chroma_422 { | |
| 31939 | + (write_chroma_w, write_chroma_h) | |
| 31940 | + } else { | |
| 31941 | + (chroma_side, chroma_side) | |
| 31942 | + }; | |
| 31830 | 31943 | let (chroma_set, chroma_tx, scan_chroma) = |
| 31831 | 31944 | if ss_x(fctx) == 0 && ss_y(fctx) == 0 && strip_chroma.is_none() { |
| 31832 | 31945 | let tx = if side >= 64 { 32 } else { side }; |
| @@ -32708,7 +32821,7 @@ fn decode_inter_block( | ||
| 32708 | 32821 | mc::combine_compound(&inter0_y, &inter1_y, fwd_offset, bck_offset, &mut pred_y, fctx); |
| 32709 | 32822 | } |
| 32710 | 32823 | |
| 32711 | - let mut inter0_u = vec![0i32; chroma_side * chroma_side]; | |
| 32824 | + let mut inter0_u = vec![0i32; chroma_stride * chroma_buf_h]; | |
| 32712 | 32825 | mc::predict_compound_intermediate_kern( |
| 32713 | 32826 | &pu0.data, |
| 32714 | 32827 | pu0.width, |
| @@ -32717,8 +32830,8 @@ fn decode_inter_block( | ||
| 32717 | 32830 | mv_to_q4(cpx, mv0.1, ss_x(fctx)), |
| 32718 | 32831 | mv_to_q4(cpy, mv0.0, ss_x(fctx)), |
| 32719 | 32832 | scale0, |
| 32720 | - chroma_side, | |
| 32721 | - chroma_side, | |
| 32833 | + chroma_stride, | |
| 32834 | + chroma_buf_h, | |
| 32722 | 32835 | write_chroma_w, |
| 32723 | 32836 | write_chroma_h, |
| 32724 | 32837 | h_filter, |
| @@ -32732,11 +32845,11 @@ fn decode_inter_block( | ||
| 32732 | 32845 | crate::warp::warp_affine_compound( |
| 32733 | 32846 | wp, &pu0.data, pu0.true_width as i32, pu0.true_height as i32, |
| 32734 | 32847 | pu0.width as i32, &mut inter0_u, cpx as i32, cpy as i32, |
| 32735 | - chroma_side as i32, chroma_side as i32, chroma_side as i32, ss_x(fctx) as i32, ss_y(fctx) as i32, fctx, | |
| 32848 | + chroma_stride as i32, chroma_buf_h as i32, chroma_stride as i32, ss_x(fctx) as i32, ss_y(fctx) as i32, fctx, | |
| 32736 | 32849 | ); |
| 32737 | 32850 | } |
| 32738 | 32851 | } |
| 32739 | - let mut inter1_u = vec![0i32; chroma_side * chroma_side]; | |
| 32852 | + let mut inter1_u = vec![0i32; chroma_stride * chroma_buf_h]; | |
| 32740 | 32853 | mc::predict_compound_intermediate_kern( |
| 32741 | 32854 | &pu1.data, |
| 32742 | 32855 | pu1.width, |
| @@ -32745,8 +32858,8 @@ fn decode_inter_block( | ||
| 32745 | 32858 | mv_to_q4(cpx, mv1.1, ss_x(fctx)), |
| 32746 | 32859 | mv_to_q4(cpy, mv1.0, ss_x(fctx)), |
| 32747 | 32860 | scale1, |
| 32748 | - chroma_side, | |
| 32749 | - chroma_side, | |
| 32861 | + chroma_stride, | |
| 32862 | + chroma_buf_h, | |
| 32750 | 32863 | write_chroma_w, |
| 32751 | 32864 | write_chroma_h, |
| 32752 | 32865 | h_filter, |
| @@ -32760,35 +32873,33 @@ fn decode_inter_block( | ||
| 32760 | 32873 | crate::warp::warp_affine_compound( |
| 32761 | 32874 | wp, &pu1.data, pu1.true_width as i32, pu1.true_height as i32, |
| 32762 | 32875 | pu1.width as i32, &mut inter1_u, cpx as i32, cpy as i32, |
| 32763 | - chroma_side as i32, chroma_side as i32, chroma_side as i32, ss_x(fctx) as i32, ss_y(fctx) as i32, fctx, | |
| 32876 | + chroma_stride as i32, chroma_buf_h as i32, chroma_stride as i32, ss_x(fctx) as i32, ss_y(fctx) as i32, fctx, | |
| 32764 | 32877 | ); |
| 32765 | 32878 | } |
| 32766 | 32879 | } |
| 32767 | - let mut pred_u = refill(std::mem::take(&mut out[1]), chroma_side * chroma_side); | |
| 32880 | + let mut pred_u = refill(std::mem::take(&mut out[1]), chroma_stride * chroma_buf_h); | |
| 32768 | 32881 | if let Some(mask_y) = mask_y { |
| 32769 | - // lane-av1-422sub8rect stop-note: this fn's 4:2:2 chroma | |
| 32770 | - // prediction is still the square-cut model (the owning | |
| 32771 | - // parent-lane surface) -- its buffer is `chroma_side`-square | |
| 32772 | - // and cannot be indexed by the subsampled-axis mask walks, | |
| 32773 | - // so at ss_x != ss_y the blend keeps the direct | |
| 32774 | - // luma-resolution read (the pre-port behaviour, known | |
| 32775 | - // divergent there) until that surface itself is ported. | |
| 32882 | + // lane-av1-422blockhalf: the blend walks this plane's own | |
| 32883 | + // (chroma_stride x chroma_buf_h) rect through the plane's | |
| 32884 | + // real subsampling shifts -- the mask read is aom_dsp/ | |
| 32885 | + // blend-a64-mask.c's `(1, 0)` branch at 4:2:2, the direct | |
| 32886 | + // luma sample at 4:2:0/4:4:4. | |
| 32776 | 32887 | mc::blend_masked_compound( |
| 32777 | 32888 | &inter0_u, |
| 32778 | 32889 | &inter1_u, |
| 32779 | 32890 | mask_y, |
| 32780 | 32891 | side, |
| 32781 | - chroma_side, | |
| 32782 | - chroma_side, | |
| 32783 | - if ss_x(fctx) == ss_y(fctx) { ss_x(fctx) } else { 0 }, | |
| 32784 | - if ss_x(fctx) == ss_y(fctx) { ss_y(fctx) } else { 0 }, | |
| 32892 | + chroma_stride, | |
| 32893 | + chroma_buf_h, | |
| 32894 | + ss_x(fctx), | |
| 32895 | + ss_y(fctx), | |
| 32785 | 32896 | &mut pred_u, fctx, |
| 32786 | 32897 | ); |
| 32787 | 32898 | } else { |
| 32788 | 32899 | mc::combine_compound(&inter0_u, &inter1_u, fwd_offset, bck_offset, &mut pred_u, fctx); |
| 32789 | 32900 | } |
| 32790 | 32901 | |
| 32791 | - let mut inter0_v = vec![0i32; chroma_side * chroma_side]; | |
| 32902 | + let mut inter0_v = vec![0i32; chroma_stride * chroma_buf_h]; | |
| 32792 | 32903 | mc::predict_compound_intermediate_kern( |
| 32793 | 32904 | &pv0.data, |
| 32794 | 32905 | pv0.width, |
| @@ -32797,8 +32908,8 @@ fn decode_inter_block( | ||
| 32797 | 32908 | mv_to_q4(cpx, mv0.1, ss_x(fctx)), |
| 32798 | 32909 | mv_to_q4(cpy, mv0.0, ss_x(fctx)), |
| 32799 | 32910 | scale0, |
| 32800 | - chroma_side, | |
| 32801 | - chroma_side, | |
| 32911 | + chroma_stride, | |
| 32912 | + chroma_buf_h, | |
| 32802 | 32913 | write_chroma_w, |
| 32803 | 32914 | write_chroma_h, |
| 32804 | 32915 | h_filter, |
| @@ -32812,11 +32923,11 @@ fn decode_inter_block( | ||
| 32812 | 32923 | crate::warp::warp_affine_compound( |
| 32813 | 32924 | wp, &pv0.data, pv0.true_width as i32, pv0.true_height as i32, |
| 32814 | 32925 | pv0.width as i32, &mut inter0_v, cpx as i32, cpy as i32, |
| 32815 | - chroma_side as i32, chroma_side as i32, chroma_side as i32, ss_x(fctx) as i32, ss_y(fctx) as i32, fctx, | |
| 32926 | + chroma_stride as i32, chroma_buf_h as i32, chroma_stride as i32, ss_x(fctx) as i32, ss_y(fctx) as i32, fctx, | |
| 32816 | 32927 | ); |
| 32817 | 32928 | } |
| 32818 | 32929 | } |
| 32819 | - let mut inter1_v = vec![0i32; chroma_side * chroma_side]; | |
| 32930 | + let mut inter1_v = vec![0i32; chroma_stride * chroma_buf_h]; | |
| 32820 | 32931 | mc::predict_compound_intermediate_kern( |
| 32821 | 32932 | &pv1.data, |
| 32822 | 32933 | pv1.width, |
| @@ -32825,8 +32936,8 @@ fn decode_inter_block( | ||
| 32825 | 32936 | mv_to_q4(cpx, mv1.1, ss_x(fctx)), |
| 32826 | 32937 | mv_to_q4(cpy, mv1.0, ss_x(fctx)), |
| 32827 | 32938 | scale1, |
| 32828 | - chroma_side, | |
| 32829 | - chroma_side, | |
| 32939 | + chroma_stride, | |
| 32940 | + chroma_buf_h, | |
| 32830 | 32941 | write_chroma_w, |
| 32831 | 32942 | write_chroma_h, |
| 32832 | 32943 | h_filter, |
| @@ -32840,28 +32951,26 @@ fn decode_inter_block( | ||
| 32840 | 32951 | crate::warp::warp_affine_compound( |
| 32841 | 32952 | wp, &pv1.data, pv1.true_width as i32, pv1.true_height as i32, |
| 32842 | 32953 | pv1.width as i32, &mut inter1_v, cpx as i32, cpy as i32, |
| 32843 | - chroma_side as i32, chroma_side as i32, chroma_side as i32, ss_x(fctx) as i32, ss_y(fctx) as i32, fctx, | |
| 32954 | + chroma_stride as i32, chroma_buf_h as i32, chroma_stride as i32, ss_x(fctx) as i32, ss_y(fctx) as i32, fctx, | |
| 32844 | 32955 | ); |
| 32845 | 32956 | } |
| 32846 | 32957 | } |
| 32847 | - let mut pred_v = refill(std::mem::take(&mut out[2]), chroma_side * chroma_side); | |
| 32958 | + let mut pred_v = refill(std::mem::take(&mut out[2]), chroma_stride * chroma_buf_h); | |
| 32848 | 32959 | if let Some(mask_y) = mask_y { |
| 32849 | - // lane-av1-422sub8rect stop-note: this fn's 4:2:2 chroma | |
| 32850 | - // prediction is still the square-cut model (the owning | |
| 32851 | - // parent-lane surface) -- its buffer is `chroma_side`-square | |
| 32852 | - // and cannot be indexed by the subsampled-axis mask walks, | |
| 32853 | - // so at ss_x != ss_y the blend keeps the direct | |
| 32854 | - // luma-resolution read (the pre-port behaviour, known | |
| 32855 | - // divergent there) until that surface itself is ported. | |
| 32960 | + // lane-av1-422blockhalf: the blend walks this plane's own | |
| 32961 | + // (chroma_stride x chroma_buf_h) rect through the plane's | |
| 32962 | + // real subsampling shifts -- the mask read is aom_dsp/ | |
| 32963 | + // blend-a64-mask.c's `(1, 0)` branch at 4:2:2, the direct | |
| 32964 | + // luma sample at 4:2:0/4:4:4. | |
| 32856 | 32965 | mc::blend_masked_compound( |
| 32857 | 32966 | &inter0_v, |
| 32858 | 32967 | &inter1_v, |
| 32859 | 32968 | mask_y, |
| 32860 | 32969 | side, |
| 32861 | - chroma_side, | |
| 32862 | - chroma_side, | |
| 32863 | - if ss_x(fctx) == ss_y(fctx) { ss_x(fctx) } else { 0 }, | |
| 32864 | - if ss_x(fctx) == ss_y(fctx) { ss_y(fctx) } else { 0 }, | |
| 32970 | + chroma_stride, | |
| 32971 | + chroma_buf_h, | |
| 32972 | + ss_x(fctx), | |
| 32973 | + ss_y(fctx), | |
| 32865 | 32974 | &mut pred_v, fctx, |
| 32866 | 32975 | ); |
| 32867 | 32976 | } else { |
| @@ -32877,8 +32986,8 @@ fn decode_inter_block( | ||
| 32877 | 32986 | push_pred(fctx, build); |
| 32878 | 32987 | ( |
| 32879 | 32988 | Pred::Cur { plane: 0, stride: side, off: 0 }, |
| 32880 | - Pred::Cur { plane: 1, stride: chroma_side, off: 0 }, | |
| 32881 | - Pred::Cur { plane: 2, stride: chroma_side, off: 0 }, | |
| 32989 | + Pred::Cur { plane: 1, stride: chroma_stride, off: 0 }, | |
| 32990 | + Pred::Cur { plane: 2, stride: chroma_stride, off: 0 }, | |
| 32882 | 32991 | ) |
| 32883 | 32992 | } else { |
| 32884 | 32993 | let mut built: [Vec<u16>; 3] = Default::default(); |
| @@ -32887,8 +32996,8 @@ fn decode_inter_block( | ||
| 32887 | 32996 | (pred_y, pred_u, pred_v) = (by, bu, bv); |
| 32888 | 32997 | ( |
| 32889 | 32998 | Pred::Inline(&pred_y, side), |
| 32890 | - Pred::Inline(&pred_u, chroma_side), | |
| 32891 | - Pred::Inline(&pred_v, chroma_side), | |
| 32999 | + Pred::Inline(&pred_u, chroma_stride), | |
| 33000 | + Pred::Inline(&pred_v, chroma_stride), | |
| 32892 | 33001 | ) |
| 32893 | 33002 | }; |
| 32894 | 33003 | |
| @@ -32929,24 +33038,24 @@ fn decode_inter_block( | ||
| 32929 | 33038 | push_mc_rect(1, |
| 32930 | 33039 | cpx, |
| 32931 | 33040 | cpy, |
| 32932 | - chroma_side, | |
| 33041 | + chroma_stride, | |
| 32933 | 33042 | write_chroma_w, |
| 32934 | 33043 | write_chroma_h, |
| 32935 | 33044 | su, |
| 32936 | - &ZERO_RESIDUAL[..chroma_side * chroma_side], fctx, | |
| 33045 | + &ZERO_RESIDUAL[..chroma_stride * chroma_buf_h], fctx, | |
| 32937 | 33046 | ); |
| 32938 | 33047 | push_mc_rect(2, |
| 32939 | 33048 | cpx, |
| 32940 | 33049 | cpy, |
| 32941 | - chroma_side, | |
| 33050 | + chroma_stride, | |
| 32942 | 33051 | write_chroma_w, |
| 32943 | 33052 | write_chroma_h, |
| 32944 | 33053 | sv, |
| 32945 | - &ZERO_RESIDUAL[..chroma_side * chroma_side], fctx, | |
| 33054 | + &ZERO_RESIDUAL[..chroma_stride * chroma_buf_h], fctx, | |
| 32946 | 33055 | ); |
| 32947 | 33056 | luma_grid = Grid::Zero(side * side); |
| 32948 | - u_grid = Grid::Zero(chroma_side * chroma_side); | |
| 32949 | - v_grid = Grid::Zero(chroma_side * chroma_side); | |
| 33057 | + u_grid = Grid::Zero(chroma_stride * chroma_buf_h); | |
| 33058 | + v_grid = Grid::Zero(chroma_stride * chroma_buf_h); | |
| 32950 | 33059 | } else { |
| 32951 | 33060 | // lane-inter4 r2: a rect strip's coefficient context spans its |
| 32952 | 33061 | // OWN width above and height left -- reading `side` cells both |
| @@ -33277,12 +33386,12 @@ fn decode_inter_block( | ||
| 33277 | 33386 | // root a rect (128x64/64x128) block's chroma is per mu |
| 33278 | 33387 | // chunk too, so this test comes BEFORE the `rect_tu` one. |
| 33279 | 33388 | u_grid = if u_units.is_empty() { |
| 33280 | - Grid::Zero(chroma_side * chroma_side) | |
| 33389 | + Grid::Zero(chroma_stride * chroma_buf_h) | |
| 33281 | 33390 | } else { |
| 33282 | 33391 | Grid::Own(std::mem::take(&mut u_units)) |
| 33283 | 33392 | }; |
| 33284 | 33393 | v_grid = if v_units.is_empty() { |
| 33285 | - Grid::Zero(chroma_side * chroma_side) | |
| 33394 | + Grid::Zero(chroma_stride * chroma_buf_h) | |
| 33286 | 33395 | } else { |
| 33287 | 33396 | Grid::Own(std::mem::take(&mut v_units)) |
| 33288 | 33397 | }; |
| @@ -33293,7 +33402,7 @@ fn decode_inter_block( | ||
| 33293 | 33402 | read_inter_chroma_lossless( |
| 33294 | 33403 | dec, cdfs, neighbours, u, v, su, sv, at_mi, (cpx, cpy), |
| 33295 | 33404 | (0, 0), (write_chroma_w, write_chroma_h), |
| 33296 | - (write_chroma_w, write_chroma_h), chroma_side, | |
| 33405 | + (write_chroma_w, write_chroma_h), chroma_stride, | |
| 33297 | 33406 | mode_for_tx, base_q_idx, &mut uo, &mut vo, fctx, |
| 33298 | 33407 | )?; |
| 33299 | 33408 | let zero = chroma_side * chroma_side; |
| @@ -33328,7 +33437,7 @@ fn decode_inter_block( | ||
| 33328 | 33437 | at_mi, |
| 33329 | 33438 | (cpx, cpy), |
| 33330 | 33439 | (write_chroma_w, write_chroma_h), |
| 33331 | - chroma_side, | |
| 33440 | + chroma_stride, | |
| 33332 | 33441 | mode_for_tx, |
| 33333 | 33442 | luma_tx_type, fctx, |
| 33334 | 33443 | )?; |
| @@ -34107,7 +34216,7 @@ fn decode_inter_block( | ||
| 34107 | 34216 | side, |
| 34108 | 34217 | write_w, |
| 34109 | 34218 | write_h, |
| 34110 | - chroma_side, | |
| 34219 | + chroma_stride, | |
| 34111 | 34220 | px, |
| 34112 | 34221 | py, |
| 34113 | 34222 | cpx, |
| @@ -34129,8 +34238,8 @@ fn decode_inter_block( | ||
| 34129 | 34238 | return; |
| 34130 | 34239 | }; |
| 34131 | 34240 | let mut pred_y = refill(std::mem::take(&mut out[0]), side * side); |
| 34132 | - let mut pred_u = refill(std::mem::take(&mut out[1]), chroma_side * chroma_side); | |
| 34133 | - let mut pred_v = refill(std::mem::take(&mut out[2]), chroma_side * chroma_side); | |
| 34241 | + let mut pred_u = refill(std::mem::take(&mut out[1]), chroma_stride * chroma_buf_h); | |
| 34242 | + let mut pred_v = refill(std::mem::take(&mut out[2]), chroma_stride * chroma_buf_h); | |
| 34134 | 34243 | if luma_scale == mc::REF_NO_SCALE { |
| 34135 | 34244 | mc::predict_with_filters_kern( |
| 34136 | 34245 | &py_ref.data, |
| @@ -34154,8 +34263,8 @@ fn decode_inter_block( | ||
| 34154 | 34263 | pu_ref.true_height, |
| 34155 | 34264 | mv_to_q4(cpx, mv.1, ss_x(fctx)), |
| 34156 | 34265 | mv_to_q4(cpy, mv.0, ss_x(fctx)), |
| 34157 | - chroma_side, | |
| 34158 | - chroma_side, | |
| 34266 | + chroma_stride, | |
| 34267 | + chroma_buf_h, | |
| 34159 | 34268 | write_chroma_w, |
| 34160 | 34269 | write_chroma_h, |
| 34161 | 34270 | h_filter, |
| @@ -34169,8 +34278,8 @@ fn decode_inter_block( | ||
| 34169 | 34278 | pv_ref.true_height, |
| 34170 | 34279 | mv_to_q4(cpx, mv.1, ss_x(fctx)), |
| 34171 | 34280 | mv_to_q4(cpy, mv.0, ss_x(fctx)), |
| 34172 | - chroma_side, | |
| 34173 | - chroma_side, | |
| 34281 | + chroma_stride, | |
| 34282 | + chroma_buf_h, | |
| 34174 | 34283 | write_chroma_w, |
| 34175 | 34284 | write_chroma_h, |
| 34176 | 34285 | h_filter, |
| @@ -34202,8 +34311,8 @@ fn decode_inter_block( | ||
| 34202 | 34311 | mv_to_q4(cpx, mv.1, ss_x(fctx)), |
| 34203 | 34312 | mv_to_q4(cpy, mv.0, ss_x(fctx)), |
| 34204 | 34313 | luma_scale, |
| 34205 | - chroma_side, | |
| 34206 | - chroma_side, | |
| 34314 | + chroma_stride, | |
| 34315 | + chroma_buf_h, | |
| 34207 | 34316 | write_chroma_w, |
| 34208 | 34317 | write_chroma_h, |
| 34209 | 34318 | h_filter, |
| @@ -34218,8 +34327,8 @@ fn decode_inter_block( | ||
| 34218 | 34327 | mv_to_q4(cpx, mv.1, ss_x(fctx)), |
| 34219 | 34328 | mv_to_q4(cpy, mv.0, ss_x(fctx)), |
| 34220 | 34329 | luma_scale, |
| 34221 | - chroma_side, | |
| 34222 | - chroma_side, | |
| 34330 | + chroma_stride, | |
| 34331 | + chroma_buf_h, | |
| 34223 | 34332 | write_chroma_w, |
| 34224 | 34333 | write_chroma_h, |
| 34225 | 34334 | h_filter, |
| @@ -34259,13 +34368,11 @@ fn decode_inter_block( | ||
| 34259 | 34368 | if warp_plane_allowed(write_chroma_w, write_chroma_h) { |
| 34260 | 34369 | crate::warp::warp_affine( |
| 34261 | 34370 | params, &pu_ref.data, pu_ref.true_width as i32, pu_ref.true_height as i32, |
| 34262 | - pu_ref.width as i32, &mut pred_u, cpx as i32, cpy as i32, chroma_side as i32, | |
| 34263 | - chroma_side as i32, chroma_side as i32, ss_x(fctx) as i32, ss_y(fctx) as i32, fctx, | |
| 34371 | + pu_ref.width as i32, &mut pred_u, cpx as i32, cpy as i32, chroma_stride as i32, chroma_buf_h as i32, chroma_stride as i32, ss_x(fctx) as i32, ss_y(fctx) as i32, fctx, | |
| 34264 | 34372 | ); |
| 34265 | 34373 | crate::warp::warp_affine( |
| 34266 | 34374 | params, &pv_ref.data, pv_ref.true_width as i32, pv_ref.true_height as i32, |
| 34267 | - pv_ref.width as i32, &mut pred_v, cpx as i32, cpy as i32, chroma_side as i32, | |
| 34268 | - chroma_side as i32, chroma_side as i32, ss_x(fctx) as i32, ss_y(fctx) as i32, fctx, | |
| 34375 | + pv_ref.width as i32, &mut pred_v, cpx as i32, cpy as i32, chroma_stride as i32, chroma_buf_h as i32, chroma_stride as i32, ss_x(fctx) as i32, ss_y(fctx) as i32, fctx, | |
| 34269 | 34376 | ); |
| 34270 | 34377 | } |
| 34271 | 34378 | } |
| @@ -34279,11 +34386,11 @@ fn decode_inter_block( | ||
| 34279 | 34386 | } |
| 34280 | 34387 | interintra_blend(y, px, py, write_w, write_h, side, 0, 0, ii, wedge_mask, &mut pred_y, fctx); |
| 34281 | 34388 | interintra_blend( |
| 34282 | - u, cpx, cpy, write_chroma_w, write_chroma_h, chroma_side, ss_x(fctx), | |
| 34389 | + u, cpx, cpy, write_chroma_w, write_chroma_h, chroma_stride, ss_x(fctx), | |
| 34283 | 34390 | ss_y(fctx), ii, wedge_mask, &mut pred_u, fctx, |
| 34284 | 34391 | ); |
| 34285 | 34392 | interintra_blend( |
| 34286 | - v, cpx, cpy, write_chroma_w, write_chroma_h, chroma_side, ss_x(fctx), | |
| 34393 | + v, cpx, cpy, write_chroma_w, write_chroma_h, chroma_stride, ss_x(fctx), | |
| 34287 | 34394 | ss_y(fctx), ii, wedge_mask, &mut pred_v, fctx, |
| 34288 | 34395 | ); |
| 34289 | 34396 | } |
| @@ -34322,7 +34429,7 @@ fn decode_inter_block( | ||
| 34322 | 34429 | &mut piece, fctx, |
| 34323 | 34430 | ); |
| 34324 | 34431 | for row in 0..piece_h { |
| 34325 | - dst[row * chroma_side..row * chroma_side + piece_w] | |
| 34432 | + dst[row * chroma_stride..row * chroma_stride + piece_w] | |
| 34326 | 34433 | .copy_from_slice(&piece[row * piece_w..(row + 1) * piece_w]); |
| 34327 | 34434 | } |
| 34328 | 34435 | } |
| @@ -34347,8 +34454,8 @@ fn decode_inter_block( | ||
| 34347 | 34454 | push_pred(fctx, build); |
| 34348 | 34455 | ( |
| 34349 | 34456 | Pred::Cur { plane: 0, stride: side, off: 0 }, |
| 34350 | - Pred::Cur { plane: 1, stride: chroma_side, off: 0 }, | |
| 34351 | - Pred::Cur { plane: 2, stride: chroma_side, off: 0 }, | |
| 34457 | + Pred::Cur { plane: 1, stride: chroma_stride, off: 0 }, | |
| 34458 | + Pred::Cur { plane: 2, stride: chroma_stride, off: 0 }, | |
| 34352 | 34459 | ) |
| 34353 | 34460 | } else { |
| 34354 | 34461 | if interintra_mode.is_some() { |
| @@ -34372,8 +34479,8 @@ fn decode_inter_block( | ||
| 34372 | 34479 | // through to the ordinary whole-block predictor. |
| 34373 | 34480 | ( |
| 34374 | 34481 | Pred::Inline(&pred_y, side), |
| 34375 | - Pred::Inline(&pred_u, chroma_side), | |
| 34376 | - Pred::Inline(&pred_v, chroma_side), | |
| 34482 | + Pred::Inline(&pred_u, chroma_stride), | |
| 34483 | + Pred::Inline(&pred_v, chroma_stride), | |
| 34377 | 34484 | ) |
| 34378 | 34485 | }; |
| 34379 | 34486 | |
| @@ -34418,25 +34525,25 @@ fn decode_inter_block( | ||
| 34418 | 34525 | push_mc_rect(1, |
| 34419 | 34526 | cpx, |
| 34420 | 34527 | cpy, |
| 34421 | - chroma_side, | |
| 34528 | + chroma_stride, | |
| 34422 | 34529 | write_chroma_w, |
| 34423 | 34530 | write_chroma_h, |
| 34424 | 34531 | su, |
| 34425 | - &ZERO_RESIDUAL[..chroma_side * chroma_side], fctx, | |
| 34532 | + &ZERO_RESIDUAL[..chroma_stride * chroma_buf_h], fctx, | |
| 34426 | 34533 | ); |
| 34427 | 34534 | push_mc_rect(2, |
| 34428 | 34535 | cpx, |
| 34429 | 34536 | cpy, |
| 34430 | - chroma_side, | |
| 34537 | + chroma_stride, | |
| 34431 | 34538 | write_chroma_w, |
| 34432 | 34539 | write_chroma_h, |
| 34433 | 34540 | sv, |
| 34434 | - &ZERO_RESIDUAL[..chroma_side * chroma_side], fctx, | |
| 34541 | + &ZERO_RESIDUAL[..chroma_stride * chroma_buf_h], fctx, | |
| 34435 | 34542 | ); |
| 34436 | 34543 | } |
| 34437 | 34544 | luma_grid = Grid::Zero(side * side); |
| 34438 | - u_grid = Grid::Zero(chroma_side * chroma_side); | |
| 34439 | - v_grid = Grid::Zero(chroma_side * chroma_side); | |
| 34545 | + u_grid = Grid::Zero(chroma_stride * chroma_buf_h); | |
| 34546 | + v_grid = Grid::Zero(chroma_stride * chroma_buf_h); | |
| 34440 | 34547 | } else { |
| 34441 | 34548 | // lane-inter4 r2: a rect strip's coefficient context spans its |
| 34442 | 34549 | // OWN width above and height left -- reading `side` cells both |
| @@ -34781,19 +34888,19 @@ fn decode_inter_block( | ||
| 34781 | 34888 | // `reconstruct_inter_block`'s `for (plane...)` guarded by |
| 34782 | 34889 | // `xd->is_chroma_ref`) codes NO chroma transform here, so |
| 34783 | 34890 | // neither symbol nor context exists. |
| 34784 | - u_grid = Grid::Zero(chroma_side * chroma_side); | |
| 34785 | - v_grid = Grid::Zero(chroma_side * chroma_side); | |
| 34891 | + u_grid = Grid::Zero(chroma_stride * chroma_buf_h); | |
| 34892 | + v_grid = Grid::Zero(chroma_stride * chroma_buf_h); | |
| 34786 | 34893 | } else if side > 64 { |
| 34787 | 34894 | // Already read inside the mu-chunk loop above -- at the 128 |
| 34788 | 34895 | // root a rect (128x64/64x128) block's chroma is per mu |
| 34789 | 34896 | // chunk too, so this test comes BEFORE the `rect_tu` one. |
| 34790 | 34897 | u_grid = if u_units.is_empty() { |
| 34791 | - Grid::Zero(chroma_side * chroma_side) | |
| 34898 | + Grid::Zero(chroma_stride * chroma_buf_h) | |
| 34792 | 34899 | } else { |
| 34793 | 34900 | Grid::Own(std::mem::take(&mut u_units)) |
| 34794 | 34901 | }; |
| 34795 | 34902 | v_grid = if v_units.is_empty() { |
| 34796 | - Grid::Zero(chroma_side * chroma_side) | |
| 34903 | + Grid::Zero(chroma_stride * chroma_buf_h) | |
| 34797 | 34904 | } else { |
| 34798 | 34905 | Grid::Own(std::mem::take(&mut v_units)) |
| 34799 | 34906 | }; |
| @@ -34804,7 +34911,7 @@ fn decode_inter_block( | ||
| 34804 | 34911 | read_inter_chroma_lossless( |
| 34805 | 34912 | dec, cdfs, neighbours, u, v, su, sv, at_mi, (cpx, cpy), |
| 34806 | 34913 | (0, 0), (write_chroma_w, write_chroma_h), |
| 34807 | - (write_chroma_w, write_chroma_h), chroma_side, | |
| 34914 | + (write_chroma_w, write_chroma_h), chroma_stride, | |
| 34808 | 34915 | mode_for_tx, base_q_idx, &mut uo, &mut vo, fctx, |
| 34809 | 34916 | )?; |
| 34810 | 34917 | let zero = chroma_side * chroma_side; |
| @@ -34836,7 +34943,7 @@ fn decode_inter_block( | ||
| 34836 | 34943 | at_mi, |
| 34837 | 34944 | (cpx, cpy), |
| 34838 | 34945 | (write_chroma_w, write_chroma_h), |
| 34839 | - chroma_side, | |
| 34946 | + chroma_stride, | |
| 34840 | 34947 | mode_for_tx, |
| 34841 | 34948 | luma_tx_type, fctx, |
| 34842 | 34949 | )?; |
| @@ -35541,12 +35648,12 @@ fn decode_inter_block( | ||
| 35541 | 35648 | // Chroma is already coded and reconstructed per mu chunk above. |
| 35542 | 35649 | luma_grid = Grid::Zero(side * side); |
| 35543 | 35650 | u_grid = if u_units.is_empty() { |
| 35544 | - Grid::Zero(chroma_side * chroma_side) | |
| 35651 | + Grid::Zero(chroma_stride * chroma_buf_h) | |
| 35545 | 35652 | } else { |
| 35546 | 35653 | Grid::Own(std::mem::take(&mut u_units)) |
| 35547 | 35654 | }; |
| 35548 | 35655 | v_grid = if v_units.is_empty() { |
| 35549 | - Grid::Zero(chroma_side * chroma_side) | |
| 35656 | + Grid::Zero(chroma_stride * chroma_buf_h) | |
| 35550 | 35657 | } else { |
| 35551 | 35658 | Grid::Own(std::mem::take(&mut v_units)) |
| 35552 | 35659 | }; |
| @@ -37700,6 +37807,28 @@ fn decode_inter_sub8_rect2( | ||
| 37700 | 37807 | // there is no shared group unit (aomdec EC_COEFF on |
| 37701 | 37808 | // `av1-profile1-444.ivf` decode-order frame 1, mi (3,8)). |
| 37702 | 37809 | let chroma_444 = ss_x(fctx) == 0 && ss_y(fctx) == 0; |
| 37810 | + // lane-av1-422blockhalf: at ss (1,0) the chroma reference is PER PIECE | |
| 37811 | + // too, keyed by `is_chroma_reference`'s own terms: an 8x4 HORZ piece is | |
| 37812 | + // 2 mi wide (`!(bw & 1)`), so BOTH pieces of the group are references; | |
| 37813 | + // a 4x8 VERT piece is 1 mi wide, so only the ODD-column piece is | |
| 37814 | + // (`mi_col & 1`) -- measured on the pinned t422 fixture frame 1: the | |
| 37815 | + // horz group at mi (8,10)/(9,10) reads U+V TX_4X4 after EACH piece's | |
| 37816 | + // luma (rng 37134/37852 then 63752/50952), and the vert group at | |
| 37817 | + // (3,10)/(3,11) reads U+V on the odd-column piece (3,11) alone. The old | |
| 37818 | + // `i == 1` rule coded the group's chroma on the wrong piece (and, for | |
| 37819 | + // horz, half of the units) and desynced frame 1 at (8,10)'s uv_mode. | |
| 37820 | + let chroma_422 = ss_x(fctx) == 1 && ss_y(fctx) == 0; | |
| 37821 | + // 4:4:4: every piece. 4:2:2: both horz pieces, the odd-column vert piece. | |
| 37822 | + // 4:2:0 keeps its existing second-piece model untouched. | |
| 37823 | + let piece_is_chroma_ref = |i: usize| -> bool { | |
| 37824 | + if ss_x(fctx) == 0 && ss_y(fctx) == 0 { | |
| 37825 | + true | |
| 37826 | + } else if chroma_422 { | |
| 37827 | + !vert || ((gc + i) & 1) == 1 | |
| 37828 | + } else { | |
| 37829 | + i == 1 | |
| 37830 | + } | |
| 37831 | + }; | |
| 37703 | 37832 | // This piece's first transform's luma `tx_type` (libaom `mbmi->tx_type`): |
| 37704 | 37833 | // an inter block's chroma plane never codes its own symbol but inherits |
| 37705 | 37834 | // the colocated luma type (`av1_get_tx_type`, blockd.h:1291). |
| @@ -37760,7 +37889,7 @@ fn decode_inter_sub8_rect2( | ||
| 37760 | 37889 | "EC_SUB8INTRA shape={}x{} sub={i} has_chroma={} skip={skip} mi={rmi},{cmi} tx_select={}", |
| 37761 | 37890 | bw, |
| 37762 | 37891 | bh, |
| 37763 | - i == 1, | |
| 37892 | + piece_is_chroma_ref(i), | |
| 37764 | 37893 | fctx.tx_select_inter.with(std::cell::Cell::get), |
| 37765 | 37894 | ); |
| 37766 | 37895 | } |
| @@ -37778,7 +37907,7 @@ fn decode_inter_sub8_rect2( | ||
| 37778 | 37907 | group_mi, |
| 37779 | 37908 | lmi, |
| 37780 | 37909 | (bw, bh), |
| 37781 | - chroma_444 || i == 1, | |
| 37910 | + piece_is_chroma_ref(i), | |
| 37782 | 37911 | skip, |
| 37783 | 37912 | scan4, |
| 37784 | 37913 | y, |
| @@ -37789,7 +37918,7 @@ fn decode_inter_sub8_rect2( | ||
| 37789 | 37918 | fctx.tx_select_inter.with(std::cell::Cell::get), |
| 37790 | 37919 | reduced_tx_set, fctx, |
| 37791 | 37920 | )?; |
| 37792 | - if i == 1 { | |
| 37921 | + if piece_is_chroma_ref(i) { | |
| 37793 | 37922 | intra_chroma = true; |
| 37794 | 37923 | } |
| 37795 | 37924 | continue; |
| @@ -38199,6 +38328,166 @@ fn decode_inter_sub8_rect2( | ||
| 38199 | 38328 | neighbours.record_mi_chroma(lmi, bw, bh, 1, &ug); |
| 38200 | 38329 | neighbours.record_mi_chroma(lmi, bw, bh, 2, &vg); |
| 38201 | 38330 | } |
| 38331 | + // lane-av1-422blockhalf: the 4:2:2 per-piece arm. The chroma | |
| 38332 | + // reference piece codes its own U and V TX_4X4 units right after its | |
| 38333 | + // luma -- both pieces of a horz group, the odd-column piece of a | |
| 38334 | + // vert one (see `piece_is_chroma_ref` above; measured on the pinned | |
| 38335 | + // t422 fixture frame 1, horz group (8,10)/(9,10) and vert group | |
| 38336 | + // (3,10)/(3,11)). The unit anchors at the FLOORED chroma cell | |
| 38337 | + // (`av1_setup_dst_planes`' `(mi_col & !1) * MI >> ss_x`, the | |
| 38338 | + // lane-av1-422kf2 rule) and reads through | |
| 38339 | + // [`Neighbours::around_mi_422_chroma`]'s per-chroma-cell context. | |
| 38340 | + // A horz piece IS 4x4 chroma (8 luma wide, ss_y 0): its unit | |
| 38341 | + // predicts whole from its own mv/filters. A vert piece is 2 chroma | |
| 38342 | + // px wide, so its 4-px unit predicts in halves -- | |
| 38343 | + // `build_inter_predictors_sub8x8`'s rule: the left 2x4 from the | |
| 38344 | + // piece to the LEFT (the group's own left piece, or the decoded | |
| 38345 | + // neighbour when the group starts on an odd column), the right 2x4 | |
| 38346 | + // from this piece. A skipped reference piece still predicts (spec | |
| 38347 | + // 7.11.3) but codes no coefficients. | |
| 38348 | + } else if chroma_422 && piece_is_chroma_ref(i) { | |
| 38349 | + const B4: usize = 4; | |
| 38350 | + let (pc_ref, pc_mv, pc_hf, pc_vf) = piece[i].expect("inter piece recorded above"); | |
| 38351 | + let unit_x = ((lmi.1 & !1) * MI) >> ss_x(fctx); | |
| 38352 | + let unit_y = py; | |
| 38353 | + // The left 2x4 half's source: the in-group left piece when this | |
| 38354 | + // piece is the group's second, else the decoded neighbour one mi | |
| 38355 | + // to the left (an odd-column group start). Its interp filters | |
| 38356 | + // are not on the mi grid, so an outside neighbour borrows this | |
| 38357 | + // piece's own. | |
| 38358 | + let left_piece = if i > 0 { | |
| 38359 | + piece[i - 1] | |
| 38360 | + } else if lmi.1 > 0 { | |
| 38361 | + grid.get(rmi, lmi.1 - 1).filter(|mi| mi.is_inter).map( | |
| 38362 | + |mi| { | |
| 38363 | + ( | |
| 38364 | + mi.ref_frame, | |
| 38365 | + (i32::from(mi.mv.0), i32::from(mi.mv.1)), | |
| 38366 | + pc_hf, | |
| 38367 | + pc_vf, | |
| 38368 | + ) | |
| 38369 | + }, | |
| 38370 | + ) | |
| 38371 | + } else { | |
| 38372 | + None | |
| 38373 | + }; | |
| 38374 | + let build_c = move |_y: &mut PlaneBuf<'static>, | |
| 38375 | + _u: &mut PlaneBuf<'static>, | |
| 38376 | + _v: &mut PlaneBuf<'static>, | |
| 38377 | + fctx: &crate::decode::FrameCtx, | |
| 38378 | + out: &mut [Vec<u16>; 3]| { | |
| 38379 | + let Some((pc_ref_y, sref_u, sref_v)) = ref_planes_deferred(pc_ref, refpix) else { | |
| 38380 | + return; | |
| 38381 | + }; | |
| 38382 | + let pc_scale = mc::scale_factor(pc_ref_y.width, frame_width); | |
| 38383 | + let mut pred_u = refill(std::mem::take(&mut out[1]), B4 * B4); | |
| 38384 | + let mut pred_v = refill(std::mem::take(&mut out[2]), B4 * B4); | |
| 38385 | + for (plane, dst) in [(sref_u, &mut pred_u), (sref_v, &mut pred_v)] { | |
| 38386 | + let mut buf = vec![0u16; B4 * B4]; | |
| 38387 | + if vert { | |
| 38388 | + // Right 2x4 half: this piece's own ref/mv/filters. | |
| 38389 | + let mut half = vec![0u16; 2 * 4]; | |
| 38390 | + mc::predict_maybe_scaled( | |
| 38391 | + &plane.data, | |
| 38392 | + plane.width, | |
| 38393 | + plane.true_width, | |
| 38394 | + plane.true_height, | |
| 38395 | + mv_to_q4(unit_x + 2, pc_mv.1, ss_x(fctx)), | |
| 38396 | + mv_to_q4(unit_y, pc_mv.0, ss_y(fctx)), | |
| 38397 | + pc_scale, | |
| 38398 | + 2, | |
| 38399 | + 4, | |
| 38400 | + pc_hf, | |
| 38401 | + pc_vf, | |
| 38402 | + &mut half, fctx, | |
| 38403 | + ); | |
| 38404 | + for row in 0..4 { | |
| 38405 | + buf[row * B4 + 2..row * B4 + 4] | |
| 38406 | + .copy_from_slice(&half[row * 2..row * 2 + 2]); | |
| 38407 | + } | |
| 38408 | + // Left 2x4 half: the piece to the left (an | |
| 38409 | + // intra/off-frame neighbour reduces to whole-from-own, | |
| 38410 | + // `is_sub8x8_inter`'s rule). | |
| 38411 | + let (l_ref, l_mv, l_hf, l_vf) = match left_piece { | |
| 38412 | + Some((l_ref, l_mv, l_hf, l_vf)) => (l_ref, l_mv, l_hf, l_vf), | |
| 38413 | + None => (pc_ref, pc_mv, pc_hf, pc_vf), | |
| 38414 | + }; | |
| 38415 | + let Some((l_y, l_u, _)) = ref_planes_deferred(l_ref, refpix) else { | |
| 38416 | + continue; | |
| 38417 | + }; | |
| 38418 | + mc::predict_maybe_scaled( | |
| 38419 | + &l_u.data, | |
| 38420 | + l_u.width, | |
| 38421 | + l_u.true_width, | |
| 38422 | + l_u.true_height, | |
| 38423 | + mv_to_q4(unit_x, l_mv.1, ss_x(fctx)), | |
| 38424 | + mv_to_q4(unit_y, l_mv.0, ss_y(fctx)), | |
| 38425 | + mc::scale_factor(l_y.width, frame_width), | |
| 38426 | + 2, | |
| 38427 | + 4, | |
| 38428 | + l_hf, | |
| 38429 | + l_vf, | |
| 38430 | + &mut half, fctx, | |
| 38431 | + ); | |
| 38432 | + for row in 0..4 { | |
| 38433 | + buf[row * B4..row * B4 + 2] | |
| 38434 | + .copy_from_slice(&half[row * 2..row * 2 + 2]); | |
| 38435 | + } | |
| 38436 | + } else { | |
| 38437 | + mc::predict_maybe_scaled( | |
| 38438 | + &plane.data, | |
| 38439 | + plane.width, | |
| 38440 | + plane.true_width, | |
| 38441 | + plane.true_height, | |
| 38442 | + mv_to_q4(unit_x, pc_mv.1, ss_x(fctx)), | |
| 38443 | + mv_to_q4(unit_y, pc_mv.0, ss_y(fctx)), | |
| 38444 | + pc_scale, | |
| 38445 | + B4, | |
| 38446 | + B4, | |
| 38447 | + pc_hf, | |
| 38448 | + pc_vf, | |
| 38449 | + &mut buf, fctx, | |
| 38450 | + ); | |
| 38451 | + } | |
| 38452 | + dst.copy_from_slice(&buf); | |
| 38453 | + } | |
| 38454 | + out[1] = pred_u; | |
| 38455 | + out[2] = pred_v; | |
| 38456 | + }; | |
| 38457 | + let (pred_cu, pred_cv): (Vec<u16>, Vec<u16>); | |
| 38458 | + let (su, sv) = if recon_deferred(fctx) { | |
| 38459 | + push_pred(fctx, build_c); | |
| 38460 | + ( | |
| 38461 | + Pred::Cur { plane: 1, stride: B4, off: 0 }, | |
| 38462 | + Pred::Cur { plane: 2, stride: B4, off: 0 }, | |
| 38463 | + ) | |
| 38464 | + } else { | |
| 38465 | + let mut built: [Vec<u16>; 3] = Default::default(); | |
| 38466 | + build_c(y, u, v, fctx, &mut built); | |
| 38467 | + let [_, bu, bv] = built; | |
| 38468 | + (pred_cu, pred_cv) = (bu, bv); | |
| 38469 | + (Pred::Inline(&pred_cu, B4), Pred::Inline(&pred_cv, B4)) | |
| 38470 | + }; | |
| 38471 | + let ctx_mi = (lmi.0, lmi.1 & !1); | |
| 38472 | + let ca = neighbours.around_mi_422_chroma(ctx_mi, 8, 4); | |
| 38473 | + if skip { | |
| 38474 | + push_mc(1, unit_x, unit_y, B4, su, &ZERO_RESIDUAL[..B4 * B4], fctx); | |
| 38475 | + push_mc(2, unit_x, unit_y, B4, sv, &ZERO_RESIDUAL[..B4 * B4], fctx); | |
| 38476 | + neighbours.record_mi_chroma(ctx_mi, 8, 4, 1, &ZERO_RESIDUAL[..B4 * B4]); | |
| 38477 | + neighbours.record_mi_chroma(ctx_mi, 8, 4, 2, &ZERO_RESIDUAL[..B4 * B4]); | |
| 38478 | + } else { | |
| 38479 | + hit!(CHROMA422_INTER_SUB8_HITS); | |
| 38480 | + let (ug, _) = read_inter_plane( | |
| 38481 | + dec, cdfs, TxbSet::Chroma4, scan4, 1, ca[1], 0, u, unit_x, unit_y, B4, | |
| 38482 | + base_q_idx, su, Some(piece_tx_type), None, fctx, | |
| 38483 | + )?; | |
| 38484 | + let (vg, _) = read_inter_plane( | |
| 38485 | + dec, cdfs, TxbSet::Chroma4, scan4, 2, ca[2], 0, v, unit_x, unit_y, B4, | |
| 38486 | + base_q_idx, sv, Some(piece_tx_type), None, fctx, | |
| 38487 | + )?; | |
| 38488 | + neighbours.record_mi_chroma(ctx_mi, 8, 4, 1, &ug); | |
| 38489 | + neighbours.record_mi_chroma(ctx_mi, 8, 4, 2, &vg); | |
| 38490 | + } | |
| 38202 | 38491 | } |
| 38203 | 38492 | neighbours.record_mode_mi(rmi, cmi, w_mi, h_mi, DC_PRED); |
| 38204 | 38493 | neighbours.record_inter_rect_mi(lmi, w_mi, h_mi, skip, true, ref_frame, resolved_filter, false); |
| @@ -38220,8 +38509,10 @@ fn decode_inter_sub8_rect2( | ||
| 38220 | 38509 | // `uv_predict_mode`, and this DC stamp ran after it and flattened the |
| 38221 | 38510 | // mi-exact cell (class `override-slot-on-one-arm`, this lane's own |
| 38222 | 38511 | // 10-bit film gate regression at 1ad7e0fc; port of lane-av1-cfl's |
| 38223 | - // 7c6dad53). | |
| 38224 | - if !chroma_444 && !intra_chroma { | |
| 38512 | + // 7c6dad53). lane-av1-422blockhalf: 4:2:2 never takes it either -- the | |
| 38513 | + // group unit does not exist there; every chroma-reference piece coded | |
| 38514 | + // (and recorded) its own unit inside the loop above. | |
| 38515 | + if !chroma_444 && !chroma_422 && !intra_chroma { | |
| 38225 | 38516 | neighbours.record_uv_mode_mi(gr, gc, 2, 2, DC_PRED); |
| 38226 | 38517 | } |
| 38227 | 38518 | // lane-t900 r23 (class [[new-map-ignores-tile-edge]]: a neighbour map |
| @@ -38235,7 +38526,10 @@ fn decode_inter_sub8_rect2( | ||
| 38235 | 38526 | record_strip_palette(neighbours, (gr, gc), 8, 8, 0, [0u16; 8], 0, [0u16; 8]); |
| 38236 | 38527 | // lane-sub8intra: when the chroma-reference sub-block was INTRA it coded |
| 38237 | 38528 | // and reconstructed the group's one chroma unit itself. |
| 38238 | - if !chroma_444 && !intra_chroma { | |
| 38529 | + // lane-av1-422blockhalf: 4:2:2 never runs this tail -- the shared group | |
| 38530 | + // unit does not exist at ss (1,0); each chroma-reference piece coded its | |
| 38531 | + // own U/V TX_4X4 inside the loop above, exactly like the 4:4:4 arm. | |
| 38532 | + if !chroma_444 && !chroma_422 && !intra_chroma { | |
| 38239 | 38533 | // The group's single 4x4 chroma unit per plane, on the chroma-reference |
| 38240 | 38534 | // (second) sub-block's own skip flag. |
| 38241 | 38535 | const B4: usize = 4; |
lanes/av1422blockhalf.report.mdadded+133 -0
| @@ -0,0 +1,133 @@ | ||
| 1 | +# lane-av1-422blockhalf — `decode_inter_block`'s 4:2:2 chroma half ported to the | |
| 2 | +# per-axis plane-block model (per-axis pred buffers + real-subsampling masked | |
| 3 | +# compound blend), the `EC_RECTCHROMA_GAP` 16x8 / 8x32 chroma shapes coded as | |
| 4 | +# the (4, 8) unit tiling the Release oracle's OOB `max_txsize_rect_lookup[ | |
| 5 | +# BLOCK_INVALID]` byte produces, and `decode_inter_sub8_rect2`'s has_chroma | |
| 6 | +# gating moved from `i == 1` to the per-piece `is_chroma_reference` rule; | |
| 7 | +# frame 0 stays byte-exact at PREFILT/POSTDEB/POSTCDEF, all 16 frames now | |
| 8 | +# decode (the frame-11 `(4, 32)` refusal is gone), and the inter-frame | |
| 9 | +# divergence is REMEASURED and REATTRIBUTED to a partition-dispatch defect | |
| 10 | +# upstream of the chroma half (ours dispatches SPLIT4 where the oracle codes | |
| 11 | +# HORZ at mi(8,10)) — frame exactness NOT claimed for frames 1+ | |
| 12 | + | |
| 13 | +## Outcome | |
| 14 | + | |
| 15 | +1. `decode_inter_block`'s chroma PREDICTION buffers (compound and | |
| 16 | + single-ref arms, OBMC plan, interintra stride, skip pushes, su/sv Pred | |
| 17 | + strides, the `read_inter_rect_chroma`/`read_inter_chroma_lossless` pred | |
| 18 | + strides) are keyed to the PLANE BLOCK's own per-axis shape at ss (1, 0): | |
| 19 | + `(chroma_stride, chroma_buf_h) = (write_chroma_w, write_chroma_h)` | |
| 20 | + instead of the enclosing square `chroma_side`. The two masked-compound | |
| 21 | + blend sites now pass the plane's REAL subsampling shifts — the | |
| 22 | + stop-note's pre-port direct luma-resolution mask read is gone | |
| 23 | + (aom_dsp/blend-a64-mask.c's `(1, 0)` branch at 4:2:2). Every replaced | |
| 24 | + expression reduces to the parent values at 4:2:0/4:4:4 | |
| 25 | + (`chroma_stride == chroma_buf_h == chroma_side` there), byte-identical | |
| 26 | + by construction. | |
| 27 | +2. `read_inter_rect_chroma` now takes the per-axis stride correctly: its | |
| 28 | + assembled block grid is `stride x plane-height` (`assembled_h`), the | |
| 29 | + single-unit embed included — the old square `chroma_side * chroma_side` | |
| 30 | + allocation panicked (`range end index 20 out of range for slice of | |
| 31 | + length 16`) the moment the per-axis stride reached it. | |
| 32 | +3. `decode_rect_split`'s 4:2:2 BLOCK_INVALID chroma planes: the tall/wide | |
| 33 | + 1:2 and 1:4 strips (`8x16, 16x32, 32x64, 8x32, 16x64`, + `64x128` for | |
| 34 | + 128-SB streams) have NO chroma plane block | |
| 35 | + (`av1_ss_size_lookup[...][1][0] == BLOCK_INVALID`); the plane is still | |
| 36 | + coded, tiled into (4, 8) rect units — the Release oracle's | |
| 37 | + out-of-bounds `max_txsize_rect_lookup[BLOCK_INVALID]` byte is TX_4X8 | |
| 38 | + (lane-av1-422m's measurement), and `decode_token_recon_block` steps the | |
| 39 | + plane in that unit shape. Units read `TxbSet::ChromaRect8x4`/`SCAN_4X8` | |
| 40 | + with `around_mi_422_chroma` ctx, mode-indexed intra tx type (the | |
| 41 | + `< 32` square-up rule, pre-existing rect units unchanged at DctDct), | |
| 42 | + per-unit stamps + units replay. SKIP strips predict per (4, 8) unit as | |
| 43 | + well (`decode_token_recon_block`'s per-TU plane walk runs before the | |
| 44 | + skip guard) — the old single whole-plane zero push asked the intra | |
| 45 | + predictor for a 1:8 rect (`dc_rect_multiplier` panic, bw=8 bh=64). | |
| 46 | + `EC_RECTCHROMA_GAP` now prints only truly-unhandled shapes (it used to | |
| 47 | + misfire on every tiled square — the parent lane's `chroma=8x8` rows); | |
| 48 | + it prints ZERO times on the fixture now. `chroma422_chunk` = 344 on the | |
| 49 | + full fixture (new units provably fire). | |
| 50 | +4. `decode_inter_sub8_rect2`'s has_chroma gating: per-piece | |
| 51 | + `is_chroma_reference` — 4:4:4 every piece, 4:2:2 both horz pieces | |
| 52 | + (`!(bw & 1)`) / the odd-column vert piece (`mi_col & 1`), 4:2:0 keeps | |
| 53 | + `i == 1` verbatim. The inter pieces take a per-piece inline chroma arm | |
| 54 | + at 4:2:2 (U then V TX_4X4 at the floored cell, `around_mi_422_chroma` | |
| 55 | + ctx, inherited piece tx type; horz predicts whole-from-own mv, vert | |
| 56 | + predicts halves `build_inter_predictors_sub8x8`-style, left half from | |
| 57 | + the in-group left piece or the decoded grid neighbour when the group | |
| 58 | + starts on an odd column — filters unavailable on the grid, so an | |
| 59 | + outside neighbour borrows this piece's filters). The 4:2:0 group tail | |
| 60 | + (and the group DC stamp) are gated off at 4:2:2. | |
| 61 | +5. MEASURED (17-frame probe, per-OBU cut harness `/tmp/i422/cut_frames.py`, | |
| 62 | + comparator ours-padded-u8-cropped vs instrumented | |
| 63 | + `$HOME/.cache/aom-oracle/build` aomdec-cropped-u8; fixture `/tmp/t422.obu` | |
| 64 | + sha256 `d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`): | |
| 65 | + - frame 0: byte-exact at PREFILT, POSTDEB and POSTCDEF on Y, U and V — | |
| 66 | + 0 diffs everywhere (FINAL not re-run this round; frame 0's final state | |
| 67 | + is bracketed by POSTCDEF on a key frame). | |
| 68 | + - all 16 frames decode, exit 0 — the parent lane's frame-11 refusal | |
| 69 | + (`a coded HORZ/VERT strip whose chroma transform has no rect | |
| 70 | + coefficient tables here`, the `luma=8x32 tx=8x8 chroma=4x32` GAP) is | |
| 71 | + gone. | |
| 72 | + - frames 1..15 still diverge (~24-36k Y, ~13-18k U/V per stage; ladder | |
| 73 | + in `/tmp/i422/ladder/`). **Frame exactness is NOT claimed.** | |
| 74 | +6. REATTRIBUTION (the round's real finding): the frames-1+ divergence is | |
| 75 | + NOT the chroma half. Strict stream-order EC_ISTEP pairing on the | |
| 76 | + frames-0-1 cut puts the first entropy divergence at index 167 — the | |
| 77 | + 8x8 group at mi(8,10): the ORACLE codes PARTITION_HORZ (pieces (8,10) | |
| 78 | + and (9,10) only, both intra with uv; oracle partition trace | |
| 79 | + `EC_PART mi_row=8 mi_col=10 bsize=3 ctx=0 value=1`) while OURS | |
| 80 | + dispatches decode_inter_sub8_split4 (EC_SUB8INTRA: `shape=4x4 sub=0 | |
| 81 | + has_chroma=false mi=8,10` ... four pieces, one extra uv_mode | |
| 82 | + consumption on the (9,11) odd piece). Same bits, different partition | |
| 83 | + outcome at the 8x8-leaf partition read (`partition_w8` ctx/value — | |
| 84 | + ours `ctx=2` at the (8,8) sibling). Every downstream diff in the | |
| 85 | + ladder is walk-shift noise from that point. This is a pre-existing | |
| 86 | + defect upstream of the named chroma surfaces, newly visible now that | |
| 87 | + the chroma shapes no longer refuse. | |
| 88 | + | |
| 89 | +## Decision | |
| 90 | + | |
| 91 | +- The header refusal STAYS unconditional in `stream.rs`; the bypass was | |
| 92 | + local-only, applied and reverted byte-identical (0 occurrences left; | |
| 93 | + `stream::tests::a_non_420_subsampled_sequence_header_is_refused_by_name` | |
| 94 | + green after the revert). | |
| 95 | +- 4:2:0/4:4:4 untouched by construction (ss-keyed arms; the 4:2:0 sub8 | |
| 96 | + group tail and `i == 1` rule verbatim). | |
| 97 | +- `read_coeffs_rect` untouched; the 4:2:0 group-tail SKIP arm untouched. | |
| 98 | + | |
| 99 | +## Deferred | |
| 100 | + | |
| 101 | +(a) The (8,10)-class partition-dispatch defect (ours SPLIT4 vs oracle | |
| 102 | + HORZ) — the frames-1+ exactness blocker. Unblock: capture the 8x8 | |
| 103 | + leaf partition context both sides (ours `EC_TRACE_PART`, oracle's | |
| 104 | + shipped partition probe) and compare `partition_ctx_mi` vs libaom's | |
| 105 | + `partition_context` gather at that leaf; the chroma half itself is | |
| 106 | + now shape-honest and rides on the fix. | |
| 107 | +(b) 4-wide strips (4x16, 4x8 luma) at 4:2:2: `decode_rect_split` still | |
| 108 | + refuses `(2, 16)` chroma by name (no pair-anchor machinery there; the | |
| 109 | + 4:2:0 `(4, 16)` single-unit arm would be wrong at ss (1, 0)). | |
| 110 | + Unblock: the split4-style floored-pair anchor ported to the 1-mi-wide | |
| 111 | + strip callers, then the OOB (4, 8) tiling. | |
| 112 | +(c) 128-root 4:2:2 chroma chunking (`decode_inter_block`'s side > 64 | |
| 113 | + mu-chunk chroma) still passes the square `chroma_side` geometry — | |
| 114 | + unreachable on <=64-superblock streams (this fixture is 64-SB); | |
| 115 | + flagged for whoever lands 4:2:2 128-SB support. | |
| 116 | + | |
| 117 | +## Verification | |
| 118 | + | |
| 119 | +- `cargo check -p ec-av1` (target `~/.cache/cargo-target-av1422blockhalf`): | |
| 120 | + 0 warnings, 0 errors. | |
| 121 | +- Refusal gate green post-revert (1 passed). | |
| 122 | +- Probe: `OK: 16 frames decoded`; 0 `EC_RECTCHROMA_GAP` prints; | |
| 123 | + `chroma422_chunk=344`, `chroma422_square=197` on the full fixture. | |
| 124 | +- Ladder: frame 0 = 0 diffs at PREFILT/POSTDEB/POSTCDEF (Y=U=V); frames | |
| 125 | + 1..15 divergent (see 5/6 — attributed, not claimed). | |
| 126 | + | |
| 127 | +## State | |
| 128 | + | |
| 129 | +- Commit on lane-av1-422blockhalf (no push): the per-axis decode_inter_block | |
| 130 | + chroma half, the read_inter_rect_chroma stride fix, the decode_rect_split | |
| 131 | + (4, 8) chroma tiling incl. per-unit skip prediction, the rect2 per-piece | |
| 132 | + has_chroma gating, and this report. | |
| 133 | +- Ladder dumps under `/tmp/i422/ladder/` (scratch, not committed). |