ec-av1: lane-av1-422d r1 -- 8x8 leaf chroma is one 4x8 rect unit per plane at ss (1,0), behind the header refusal
Browse files at this commit4280e519b85b8586d5cd7ef99c259c03ce09742dParent: 34390112 changed files +286 -41
- crates/ec-av1/src/decode.rs +194 -41
- lanes/av1422d.report.md +92 -0
crates/ec-av1/src/decode.rsmodified+194 -41
| @@ -15805,7 +15805,13 @@ fn read_intra_mode( | ||
| 15805 | 15805 | (side >> ss_x(fctx), side >> ss_y(fctx)), |
| 15806 | 15806 | (ss_x(fctx), ss_y(fctx)), |
| 15807 | 15807 | ); |
| 15808 | - let map = decode_color_index_map(dec, cdfs, n, side >> ss_x(fctx), on, true); | |
| 15808 | + // lane-av1-422d: the chroma map's extent is the PLANE BLOCK | |
| 15809 | + // `(side >> ss_x) x (side >> ss_y)` -- 4x8 at ss (1,0), not the | |
| 15810 | + // square call's `(side >> ss_x)`-squared (4x4), which left a | |
| 15811 | + // 16-entry map for a 32-sample unit and panicked the reconstruct. | |
| 15812 | + let map = decode_color_index_map_wh( | |
| 15813 | + dec, cdfs, n, side >> ss_x(fctx), side >> ss_y(fctx), on, true, | |
| 15814 | + ); | |
| 15809 | 15815 | hit!(PALETTE_UV_HITS); |
| 15810 | 15816 | if trace { |
| 15811 | 15817 | eprintln!( |
| @@ -18229,7 +18235,16 @@ fn decode_leaf8( | ||
| 18229 | 18235 | let (cpx, cpy) = (px >> ss_x(fctx), py >> ss_y(fctx)); |
| 18230 | 18236 | // 4:4:4: this 8x8 block's chroma plane block is 8x8 (same scan as luma, |
| 18231 | 18237 | // `scans.0`). 4:2:0 stays the 4x4 unit this leaf was written for. |
| 18238 | + // lane-av1-422d: 4:2:2 (ss 1/0) halves only the width, so the plane block | |
| 18239 | + // is 4x8 -- ONE rect transform unit per plane (`av1_get_max_uv_txsize( | |
| 18240 | + // BLOCK_8X8)` at ss (1,0) is `max_txsize_rect_lookup[BLOCK_4X8]` == | |
| 18241 | + // TX_4X8): one txb_skip + one scan per plane in the | |
| 18242 | + // [`TxbSet::ChromaRect8x4`] class [`decode_rect_split`] proves for the | |
| 18243 | + // shape, read through [`leaf8_chroma422_unit`] in each arm below. The | |
| 18244 | + // `(csz, cset, cscan)` selection keeps serving the square arms (444's | |
| 18245 | + // 8x8, 420's 4x4); the rect arms branch on [`chroma_422`] instead. | |
| 18232 | 18246 | let chroma_444 = ss_x(fctx) == 0 && ss_y(fctx) == 0; |
| 18247 | + let chroma_422 = ss_x(fctx) == 1 && ss_y(fctx) == 0; | |
| 18233 | 18248 | let (csz, cset, cscan) = if chroma_444 { |
| 18234 | 18249 | (8usize, TxbSet::Chroma8, scans.0) |
| 18235 | 18250 | } else { |
| @@ -18247,17 +18262,22 @@ fn decode_leaf8( | ||
| 18247 | 18262 | mv_to_q4(px, dv_col, 0), mv_to_q4(py, dv_row, 0), |
| 18248 | 18263 | 8, 8, mc::InterpFilterKind::Bilinear, &mut yb, fctx, |
| 18249 | 18264 | ); |
| 18250 | - let mut ub = vec![0u16; 4 * 4]; | |
| 18265 | + // lane-av1-422d: the DV copy covers the leaf's whole CHROMA PLANE | |
| 18266 | + // block -- 4x8 at ss (1,0), 4x4 at 4:2:0/4:4:4 (the 4:4:4 8x8 leaf's | |
| 18267 | + // own unit read is 8x8, so its 4x4 window here predates that lane's | |
| 18268 | + // rect walk and is untouched by this one). | |
| 18269 | + let (icw, ich) = if chroma_422 { (4usize, 8usize) } else { (4usize, 4usize) }; | |
| 18270 | + let mut ub = vec![0u16; icw * ich]; | |
| 18251 | 18271 | mc::predict_with_filter( |
| 18252 | 18272 | &u.data, u.width, u.true_width, u.true_height, |
| 18253 | 18273 | mv_to_q4(cpx, dv_col, ss_x(fctx)), mv_to_q4(cpy, dv_row, ss_y(fctx)), |
| 18254 | - 4, 4, mc::InterpFilterKind::Bilinear, &mut ub, fctx, | |
| 18274 | + icw, ich, mc::InterpFilterKind::Bilinear, &mut ub, fctx, | |
| 18255 | 18275 | ); |
| 18256 | - let mut vb = vec![0u16; 4 * 4]; | |
| 18276 | + let mut vb = vec![0u16; icw * ich]; | |
| 18257 | 18277 | mc::predict_with_filter( |
| 18258 | 18278 | &v.data, v.width, v.true_width, v.true_height, |
| 18259 | 18279 | mv_to_q4(cpx, dv_col, ss_x(fctx)), mv_to_q4(cpy, dv_row, ss_y(fctx)), |
| 18260 | - 4, 4, mc::InterpFilterKind::Bilinear, &mut vb, fctx, | |
| 18280 | + icw, ich, mc::InterpFilterKind::Bilinear, &mut vb, fctx, | |
| 18261 | 18281 | ); |
| 18262 | 18282 | (yb, ub, vb) |
| 18263 | 18283 | }); |
| @@ -18345,43 +18365,65 @@ fn decode_leaf8( | ||
| 18345 | 18365 | ); |
| 18346 | 18366 | } |
| 18347 | 18367 | let ac = alpha.map(|_| cfl_src(px, py, 8)); |
| 18348 | - if let Some((_, ub, _)) = &intrabc_bufs { | |
| 18349 | - set_palette_pred(ub.clone(), fctx); | |
| 18350 | - } else if let Some((ub, _)) = &palette_uv_bufs { | |
| 18351 | - set_palette_pred(ub.clone(), fctx); | |
| 18352 | - } | |
| 18353 | - push_intra(1, | |
| 18354 | - cpx, | |
| 18355 | - cpy, | |
| 18356 | - csz, | |
| 18357 | - uv_predict_mode, | |
| 18358 | - angle_delta_uv, | |
| 18359 | - reach, | |
| 18360 | - &ZERO_RESIDUAL[..csz * csz], | |
| 18361 | - alpha.zip(ac).map(|((au, _), ac)| (au, ac)), | |
| 18362 | - None, | |
| 18363 | - smooth_neighbor_uv, fctx, | |
| 18364 | - ); | |
| 18365 | - if let Some((_, _, vb)) = &intrabc_bufs { | |
| 18366 | - set_palette_pred(vb.clone(), fctx); | |
| 18367 | - } else if let Some((_, vb)) = &palette_uv_bufs { | |
| 18368 | - set_palette_pred(vb.clone(), fctx); | |
| 18368 | + if chroma_422 { | |
| 18369 | + // lane-av1-422d: a skipped leaf still predicts its 4x8 rect unit | |
| 18370 | + // per plane (CfL keeps its contribution, [`decode_block`]'s own | |
| 18371 | + // skip-arm rule); no coefficient symbol exists, so the entropy | |
| 18372 | + // context never enters the rect read. | |
| 18373 | + u_grid = leaf8_chroma422_unit( | |
| 18374 | + dec, cdfs, (false, false, 0), uv_predict_mode, angle_delta_uv, reach, | |
| 18375 | + 1, alpha.zip(ac).map(|((au, _), ac)| (au, ac)), true, | |
| 18376 | + intrabc_bufs.as_ref().map(|(_, ub, _)| ub.clone()) | |
| 18377 | + .or_else(|| palette_uv_bufs.as_ref().map(|(ub, _)| ub.clone())), | |
| 18378 | + u, cpx, cpy, smooth_neighbor_uv, fctx, | |
| 18379 | + )?; | |
| 18380 | + v_grid = leaf8_chroma422_unit( | |
| 18381 | + dec, cdfs, (false, false, 0), uv_predict_mode, angle_delta_uv, reach, | |
| 18382 | + 2, alpha.zip(ac).map(|((_, av), ac)| (av, ac)), true, | |
| 18383 | + intrabc_bufs.as_ref().map(|(_, _, vb)| vb.clone()) | |
| 18384 | + .or_else(|| palette_uv_bufs.as_ref().map(|(_, vb)| vb.clone())), | |
| 18385 | + v, cpx, cpy, smooth_neighbor_uv, fctx, | |
| 18386 | + )?; | |
| 18387 | + luma_grid = Grid::Zero(64); | |
| 18388 | + } else { | |
| 18389 | + if let Some((_, ub, _)) = &intrabc_bufs { | |
| 18390 | + set_palette_pred(ub.clone(), fctx); | |
| 18391 | + } else if let Some((ub, _)) = &palette_uv_bufs { | |
| 18392 | + set_palette_pred(ub.clone(), fctx); | |
| 18393 | + } | |
| 18394 | + push_intra(1, | |
| 18395 | + cpx, | |
| 18396 | + cpy, | |
| 18397 | + csz, | |
| 18398 | + uv_predict_mode, | |
| 18399 | + angle_delta_uv, | |
| 18400 | + reach, | |
| 18401 | + &ZERO_RESIDUAL[..csz * csz], | |
| 18402 | + alpha.zip(ac).map(|((au, _), ac)| (au, ac)), | |
| 18403 | + None, | |
| 18404 | + smooth_neighbor_uv, fctx, | |
| 18405 | + ); | |
| 18406 | + if let Some((_, _, vb)) = &intrabc_bufs { | |
| 18407 | + set_palette_pred(vb.clone(), fctx); | |
| 18408 | + } else if let Some((_, vb)) = &palette_uv_bufs { | |
| 18409 | + set_palette_pred(vb.clone(), fctx); | |
| 18410 | + } | |
| 18411 | + push_intra(2, | |
| 18412 | + cpx, | |
| 18413 | + cpy, | |
| 18414 | + csz, | |
| 18415 | + uv_predict_mode, | |
| 18416 | + angle_delta_uv, | |
| 18417 | + reach, | |
| 18418 | + &ZERO_RESIDUAL[..csz * csz], | |
| 18419 | + alpha.zip(ac).map(|((_, av), ac)| (av, ac)), | |
| 18420 | + None, | |
| 18421 | + smooth_neighbor_uv, fctx, | |
| 18422 | + ); | |
| 18423 | + luma_grid = Grid::Zero(64); | |
| 18424 | + u_grid = Grid::Zero(csz * csz); | |
| 18425 | + v_grid = Grid::Zero(csz * csz); | |
| 18369 | 18426 | } |
| 18370 | - push_intra(2, | |
| 18371 | - cpx, | |
| 18372 | - cpy, | |
| 18373 | - csz, | |
| 18374 | - uv_predict_mode, | |
| 18375 | - angle_delta_uv, | |
| 18376 | - reach, | |
| 18377 | - &ZERO_RESIDUAL[..csz * csz], | |
| 18378 | - alpha.zip(ac).map(|((_, av), ac)| (av, ac)), | |
| 18379 | - None, | |
| 18380 | - smooth_neighbor_uv, fctx, | |
| 18381 | - ); | |
| 18382 | - luma_grid = Grid::Zero(64); | |
| 18383 | - u_grid = Grid::Zero(csz * csz); | |
| 18384 | - v_grid = Grid::Zero(csz * csz); | |
| 18385 | 18427 | } else if resolved != 4 { |
| 18386 | 18428 | let around = neighbours.around_mi(leaf_mi, 8); |
| 18387 | 18429 | if let Some(buf) = &palette_y_buf { |
| @@ -18422,6 +18464,25 @@ fn decode_leaf8( | ||
| 18422 | 18464 | fctx.intrabc_chroma_tx.with(|c| c.set(Some(fctx.luma_tx_type.with(std::cell::Cell::get)))); |
| 18423 | 18465 | } |
| 18424 | 18466 | let ac = alpha.map(|_| cfl_src(px, py, 8)); |
| 18467 | + if chroma_422 { | |
| 18468 | + // lane-av1-422d: ONE 4x8 rect unit per plane (`av1_get_max_uv_txsize` | |
| 18469 | + // at ss (1,0) == TX_4X8), covering the plane block exactly, off the | |
| 18470 | + // leaf's own 8x8-span entropy context (`chroma_tiled`'s convention). | |
| 18471 | + u_grid = leaf8_chroma422_unit( | |
| 18472 | + dec, cdfs, around[1], uv_predict_mode, angle_delta_uv, reach, | |
| 18473 | + 1, alpha.zip(ac).map(|((au, _), ac)| (au, ac)), false, | |
| 18474 | + intrabc_bufs.as_ref().map(|(_, ub, _)| ub.clone()) | |
| 18475 | + .or_else(|| palette_uv_bufs.as_ref().map(|(ub, _)| ub.clone())), | |
| 18476 | + u, cpx, cpy, smooth_neighbor_uv, fctx, | |
| 18477 | + )?; | |
| 18478 | + v_grid = leaf8_chroma422_unit( | |
| 18479 | + dec, cdfs, around[2], uv_predict_mode, angle_delta_uv, reach, | |
| 18480 | + 2, alpha.zip(ac).map(|((_, av), ac)| (av, ac)), false, | |
| 18481 | + intrabc_bufs.as_ref().map(|(_, _, vb)| vb.clone()) | |
| 18482 | + .or_else(|| palette_uv_bufs.as_ref().map(|(_, vb)| vb.clone())), | |
| 18483 | + v, cpx, cpy, smooth_neighbor_uv, fctx, | |
| 18484 | + )?; | |
| 18485 | + } else { | |
| 18425 | 18486 | if let Some((_, ub, _)) = &intrabc_bufs { |
| 18426 | 18487 | set_palette_pred(ub.clone(), fctx); |
| 18427 | 18488 | } else if let Some((ub, _)) = &palette_uv_bufs { |
| @@ -18476,6 +18537,7 @@ fn decode_leaf8( | ||
| 18476 | 18537 | None, |
| 18477 | 18538 | smooth_neighbor_uv, fctx, |
| 18478 | 18539 | )?; |
| 18540 | + } | |
| 18479 | 18541 | // Disarm: `INTRABC_CHROMA_TX` is `Some` across exactly this block's |
| 18480 | 18542 | // two chroma reads (`decode_block`'s own tail does the same) -- left |
| 18481 | 18543 | // set, every later chroma block would inherit this luma tx_type, |
| @@ -18592,6 +18654,25 @@ fn decode_leaf8( | ||
| 18592 | 18654 | if fctx.intrabc_chroma_tx.with(std::cell::Cell::get).is_some() { |
| 18593 | 18655 | hit!(INTRABC_TX4_CHROMA_COPY_HITS); |
| 18594 | 18656 | } |
| 18657 | + if chroma_422 { | |
| 18658 | + // lane-av1-422d: the chroma unit does NOT follow the luma var-tx | |
| 18659 | + // split -- `uv_txsize` is `av1_get_max_uv_txsize` of the block, | |
| 18660 | + // still the one 4x8 rect unit per plane at ss (1,0). | |
| 18661 | + u_grid = leaf8_chroma422_unit( | |
| 18662 | + dec, cdfs, chroma_around[1], uv_predict_mode, angle_delta_uv, reach, | |
| 18663 | + 1, alpha.zip(ac).map(|((au, _), ac)| (au, ac)), false, | |
| 18664 | + intrabc_bufs.as_ref().map(|(_, ub, _)| ub.clone()) | |
| 18665 | + .or_else(|| palette_uv_bufs.as_ref().map(|(ub, _)| ub.clone())), | |
| 18666 | + u, cpx, cpy, smooth_neighbor_uv, fctx, | |
| 18667 | + )?; | |
| 18668 | + v_grid = leaf8_chroma422_unit( | |
| 18669 | + dec, cdfs, chroma_around[2], uv_predict_mode, angle_delta_uv, reach, | |
| 18670 | + 2, alpha.zip(ac).map(|((_, av), ac)| (av, ac)), false, | |
| 18671 | + intrabc_bufs.as_ref().map(|(_, _, vb)| vb.clone()) | |
| 18672 | + .or_else(|| palette_uv_bufs.as_ref().map(|(_, vb)| vb.clone())), | |
| 18673 | + v, cpx, cpy, smooth_neighbor_uv, fctx, | |
| 18674 | + )?; | |
| 18675 | + } else { | |
| 18595 | 18676 | if let Some((ub, _)) = &palette_uv_bufs { |
| 18596 | 18677 | set_palette_pred(ub.clone(), fctx); |
| 18597 | 18678 | } |
| @@ -18642,6 +18723,7 @@ fn decode_leaf8( | ||
| 18642 | 18723 | None, |
| 18643 | 18724 | smooth_neighbor_uv, fctx, |
| 18644 | 18725 | )?; |
| 18726 | + } | |
| 18645 | 18727 | // The two chroma reads above are the only consulters of this leaf's |
| 18646 | 18728 | // armed [`INTRABC_CHROMA_TX`]; leaving it set would make the NEXT |
| 18647 | 18729 | // leaf's chroma inherit this leaf's luma type instead of its own |
| @@ -18734,6 +18816,77 @@ fn decode_leaf8( | ||
| 18734 | 18816 | Ok(mode) |
| 18735 | 18817 | } |
| 18736 | 18818 | |
| 18819 | +/// lane-av1-422d: ONE 4:2:2 chroma transform unit of an 8x8 leaf | |
| 18820 | +/// ([`decode_leaf8`]). At ss (1,0) the plane block is 4x8 and | |
| 18821 | +/// `av1_get_max_uv_txsize(BLOCK_8X8)` resolves to | |
| 18822 | +/// `max_txsize_rect_lookup[BLOCK_4X8]` == TX_4X8, so the WHOLE plane block is | |
| 18823 | +/// a single rect unit -- one txb_skip + one scan per plane in the | |
| 18824 | +/// [`TxbSet::ChromaRect8x4`] class [`decode_rect_split`] proves for the | |
| 18825 | +/// shape. Mirrors [`sub8_leaf_chroma444`]'s rect arm at the leaf's halved | |
| 18826 | +/// position: the entropy context is the leaf's own 8x8 luma-span | |
| 18827 | +/// above/left state (the `chroma_tiled` arm's convention; no `+3` | |
| 18828 | +/// plane-block-bigger term -- the unit covers the plane block exactly), the | |
| 18829 | +/// CFL source is the leaf's whole 8x8 luma block, and the plane's predicted | |
| 18830 | +/// mode supplies the mode-derived default `tx_type` unless an armed | |
| 18831 | +/// [`INTRABC_CHROMA_TX`] slot carries the intrabc luma's own (the caller | |
| 18832 | +/// arms and disarms it, exactly as it does around its square reads). | |
| 18833 | +#[allow(clippy::too_many_arguments)] | |
| 18834 | +fn leaf8_chroma422_unit( | |
| 18835 | + dec: &mut SymbolDecoder, | |
| 18836 | + cdfs: &mut Cdfs, | |
| 18837 | + around: (bool, bool, i32), | |
| 18838 | + uv_predict_mode: usize, | |
| 18839 | + angle_delta_uv: i32, | |
| 18840 | + reach: Reach, | |
| 18841 | + plane_idx: usize, | |
| 18842 | + cfl: Option<(i32, CflSrc)>, | |
| 18843 | + skip: bool, | |
| 18844 | + // The prediction override the square arms feed through | |
| 18845 | + // `set_palette_pred`: an intrabc leaf's frame copy at the DV takes | |
| 18846 | + // priority over a palette block's colour-index map. | |
| 18847 | + pred_override: Option<Vec<u16>>, | |
| 18848 | + // Unread, like [`read_plane`]'s own: the borrow proves the caller holds | |
| 18849 | + // the plane exclusively while the unit's coefficients are parsed. | |
| 18850 | + _plane: &mut PlaneBuf<'static>, | |
| 18851 | + cpx: usize, | |
| 18852 | + cpy: usize, | |
| 18853 | + smooth_neighbor_uv: bool, fctx: &crate::decode::FrameCtx, | |
| 18854 | +) -> Result<Grid> { | |
| 18855 | + // The unit's prediction runs whether or not a residual follows it -- a | |
| 18856 | + // skipped leaf still predicts (the CfL contribution survives a skip), | |
| 18857 | + // and a skipped intrabc leaf still copies the frame at its DV. | |
| 18858 | + if let Some(buf) = pred_override { | |
| 18859 | + set_palette_pred(buf, fctx); | |
| 18860 | + } | |
| 18861 | + if skip { | |
| 18862 | + push_intra_rect( | |
| 18863 | + plane_idx, cpx, cpy, 4, 8, uv_predict_mode, angle_delta_uv, reach, | |
| 18864 | + &ZERO_RESIDUAL[..4 * 8], cfl, None, smooth_neighbor_uv, fctx, | |
| 18865 | + ); | |
| 18866 | + return Ok(Grid::Zero(4 * 8)); | |
| 18867 | + } | |
| 18868 | + let default_tx = fctx | |
| 18869 | + .intrabc_chroma_tx | |
| 18870 | + .with(std::cell::Cell::get) | |
| 18871 | + .unwrap_or_else(|| default_intra_tx_type(uv_predict_mode as u8)); | |
| 18872 | + let mut coding = cdfs.txb(TxbSet::ChromaRect8x4, uv_predict_mode); | |
| 18873 | + let (levels, tx_type) = read_coeffs_rect( | |
| 18874 | + dec, &mut coding, &SCAN_4X8, 4, 8, | |
| 18875 | + usize::from(around.0) + usize::from(around.1), | |
| 18876 | + dc_sign_ctx(around.2), default_tx, | |
| 18877 | + )?; | |
| 18878 | + let residual = dequant_and_inverse_typed_wh( | |
| 18879 | + &levels, 4, 8, crate::decode::bit_depth(fctx), block_q_idx(fctx), | |
| 18880 | + plane_q_delta(plane_idx, fctx).0, plane_q_delta(plane_idx, fctx).1, | |
| 18881 | + tx_type, block_iqmatrix(fctx, plane_idx, 4, 8, tx_type), | |
| 18882 | + ); | |
| 18883 | + push_intra_rect( | |
| 18884 | + plane_idx, cpx, cpy, 4, 8, uv_predict_mode, angle_delta_uv, reach, | |
| 18885 | + &residual, cfl, None, smooth_neighbor_uv, fctx, | |
| 18886 | + ); | |
| 18887 | + Ok(levels) | |
| 18888 | +} | |
| 18889 | + | |
| 18737 | 18890 | /// `read_intra_frame_mode_info`'s mode-info read for one `BLOCK_4X4` leaf |
| 18738 | 18891 | /// below an 8x8 partition (spec `decode_partition`'s `bSize < BLOCK_8X8` |
| 18739 | 18892 | /// bottom, where no partition symbol is read at all -- `decode_block` runs |
lanes/av1422d.report.mdadded+92 -0
| @@ -0,0 +1,92 @@ | ||
| 1 | +# lane-av1-422d — 8x8 leaf chroma unit ported at ss (1,0); refusal stays | |
| 2 | + | |
| 3 | +## Outcome | |
| 4 | + | |
| 5 | +STOP with the 4:2:2 header refusal in place. `decode_leaf8`'s chroma walk now | |
| 6 | +ports the 4:2:2 leaf unit (ONE 4x8 rect transform unit per plane, | |
| 7 | +`TxbSet::ChromaRect8x4` + `SCAN_4X8`, one txb_skip + one scan), and every leaf8 | |
| 8 | +chroma read on the measured fixture is rng-for-rng EXACT against the oracle. | |
| 9 | +The stream still desyncs LATER, at `decode_leaf_rect`'s chroma arm (next | |
| 10 | +section), so the refusal is retained byte-identical and the probe bypass was | |
| 11 | +reverted before commit. | |
| 12 | + | |
| 13 | +## Change (all inside decode_leaf8's own chroma scope) | |
| 14 | + | |
| 15 | +- `decode_leaf8` (decode.rs): `chroma_422 = ss_x == 1 && ss_y == 0`; all three | |
| 16 | + arms (skip, single-8x8-unit, TX4) branch to `leaf8_chroma422_unit` for the | |
| 17 | + rect unit. The 4:2:0 `(4, TxbSet::Chroma4, scans.1)` selection and the 4:4:4 | |
| 18 | + arm are untouched. The chroma unit does NOT follow the luma var-tx split | |
| 19 | + (`uv_txsize` is `av1_get_max_uv_txsize` of the block, still one 4x8 unit | |
| 20 | + when luma resolves TX_4X4). The intrabc DV copy covers the whole plane block | |
| 21 | + (4x8) at ss (1,0). | |
| 22 | +- `leaf8_chroma422_unit` (new, next to `decode_leaf8`): mirrors | |
| 23 | + `sub8_leaf_chroma444`'s rect arm at the leaf's halved position — entropy | |
| 24 | + context from the leaf's own 8x8 luma-span above/left state (no `+3`, the | |
| 25 | + unit covers the plane block exactly), CFL source the leaf's whole 8x8 luma | |
| 26 | + block, mode-derived default `tx_type` unless `INTRABC_CHROMA_TX` is armed, | |
| 27 | + prediction override (intrabc DV over palette) set inside, skip predicts with | |
| 28 | + `ZERO_RESIDUAL`. | |
| 29 | +- UV palette map extent (decode.rs:15808, leaf8's mode-info reader): the map | |
| 30 | + is decoded over `(side >> ss_x, side >> ss_y)` = 4x8 via | |
| 31 | + `decode_color_index_map_wh`, not the square call's `(side >> ss_x)`-squared | |
| 32 | + 4x4 (class: plane-block extent squared a rect). At 4:2:0/4:4:4 the arguments | |
| 33 | + evaluate identically; only ss (1,0) changes. Found live: the 16-entry map | |
| 34 | + fed a 16-sample prediction override into the first 32-sample rect unit and | |
| 35 | + panicked `reconstruct_rect` (`index out of bounds: the len is 16 but the | |
| 36 | + index is 16`). | |
| 37 | + | |
| 38 | +## Measurement | |
| 39 | + | |
| 40 | +Fixture `/tmp/t422.obu`, sha256 | |
| 41 | +`d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129` (reused | |
| 42 | +from av1422b/c by hash). Oracle `$HOME/.cache/aom-oracle/build/aomdec` | |
| 43 | +`EC_TRACE=1 EC_TRACE_MODE_STEP=1 EC_TRACE_COEFF=1`; ours `decode_probe` (debug, | |
| 44 | +private target dir) same env plus `EC_AV1_ALLOW_422_PROBE=1` (LOCAL bypass, | |
| 45 | +reverted). | |
| 46 | + | |
| 47 | +Coefficient-unit pairing (all_zero entry rng -> post rng), first HORZ_A 16x16 | |
| 48 | +of frame 0: | |
| 49 | + | |
| 50 | +- leaf (0,0): 4x luma TX_4X4 ✓, U `tx_size=5` entry 46416 -> 35360 ✓, V | |
| 51 | + entry 34824 -> 41920 ✓ (both my rect reads). | |
| 52 | +- leaf (0,2): luma TX_8X8 ✓ (post 45770 = oracle), U entry 37668 -> 33728 ✓, | |
| 53 | + V entry 60936 -> 58556 ✓. | |
| 54 | +- 16x8 strip: luma `tx_size=8` entry 59680 -> 58977 ✓. | |
| 55 | + | |
| 56 | +All four leaf8 chroma rect reads match the oracle rng-for-rng through their | |
| 57 | +full coefficient bodies (each next unit's entry rng proves the previous | |
| 58 | +body's bit consumption). | |
| 59 | + | |
| 60 | +## First remaining divergence (named next site) | |
| 61 | + | |
| 62 | +`decode_leaf_rect`'s chroma arm, decode.rs:13060-13067. For a 16x8/8x16 rect | |
| 63 | +leaf at ss (1,0) the chroma plane block is 8x8 — SQUARE | |
| 64 | +(`TxbSet::Chroma8` + `default_scan(8)` through `read_plane`, the | |
| 65 | +`chroma_tiled` (8,8) shape) — but the code picks `TxbSet::ChromaRect8x4` + | |
| 66 | +`SCAN_8X4`/`SCAN_4X8` keyed on `ss_x == 0`. Measured: the HORZ_A's 16x8 strip | |
| 67 | +(mi_row=2, mi_col=0) — oracle U/V units are `tx_size=1` (TX_8X8 class, 64- | |
| 68 | +position eob alphabet, ctx=8); ours enters the U unit's txb_skip at the same | |
| 69 | +rng 38672 and coincidentally matches that one symbol (the offset-7 row shares | |
| 70 | +`txb_skip_chroma_8`), then reads eob off the 32-position chroma-rect alphabet | |
| 71 | +(eob=27 vs oracle eob=32) and desyncs. Everything after shifts. | |
| 72 | + | |
| 73 | +## Second site behind it | |
| 74 | + | |
| 75 | +`decode_rect_split`'s chroma shape table (decode.rs:10114-10133) has no 4:2:2 | |
| 76 | +rows: a 16x64 luma strip's `(8, 64)` plane block fires | |
| 77 | +`EC_RECTCHROMA_GAP luma=16x64 tx=16x32 chroma=8x64` (decode stops at mi_row=16 | |
| 78 | +once the leaf_rect site is passed). Same class likely holds for other | |
| 79 | +unhalved-height plane blocks in that table. | |
| 80 | + | |
| 81 | +## State | |
| 82 | + | |
| 83 | +- Refusal `a chroma format of 4:2:2 (subsampling_x != subsampling_y)...` | |
| 84 | + byte-identical (bypass reverted; `git diff` shows only decode.rs). | |
| 85 | +- `decode_leaf_split4`, `sub8_leaf_chroma444`, `reconstruct_mc_rect`, the | |
| 86 | + resize header reader, decode.rs 34390-34440: untouched. | |
| 87 | +- 420 gate green: | |
| 88 | + `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_whose_tx_split_decodes_pixel_exact` | |
| 89 | + + its 10-bit twin — 6/6 pixel-exact matches each, 0 refusals (the gate | |
| 90 | + exercises the skip and TX4 arms this lane restructured). | |
| 91 | +- `cargo check -p ec-av1`: 0 warnings. | |
| 92 | +- No push. |