ec-av1: lane-av1-422stripanchor -- decode_rect_split's 4-wide strips ported to the split4 floored-pair anchor
Browse files at this commit01e4e7796aa9494db47e2d37706d6bc2acf16eabParent: 8dcaf0a3 changed files +321 -24
- crates/ec-av1/examples/decode_probe.rs +4 -0
- crates/ec-av1/src/decode.rs +214 -24
- lanes/av1422stripanchor.report.md +103 -0
crates/ec-av1/examples/decode_probe.rsmodified+4 -0
| @@ -46,6 +46,10 @@ fn main() { | ||
| 46 | 46 | "chroma422_chunk: {}", |
| 47 | 47 | ec_av1::decode::chroma422_chunk_hits() |
| 48 | 48 | ); |
| 49 | + println!( | |
| 50 | + "chroma422_pair_wide: {}", | |
| 51 | + ec_av1::decode::chroma422_pair_wide_hits() | |
| 52 | + ); | |
| 49 | 53 | let (h, v, c) = ec_av1::stream::rect4_32_counters(); |
| 50 | 54 | println!("rect4_32: horz={h} vert={v} coded={c}"); |
| 51 | 55 | println!( |
crates/ec-av1/src/decode.rsmodified+214 -24
| @@ -2099,6 +2099,21 @@ pub fn chroma422_chunk_hits() -> usize { | ||
| 2099 | 2099 | CHROMA422_CHUNK_HITS.with(|c| c.get()) |
| 2100 | 2100 | } |
| 2101 | 2101 | |
| 2102 | +// lane-av1-422stripanchor: how many 4-wide-strip PAIR chroma units | |
| 2103 | +// ([`decode_rect_split`]'s ported floored-pair anchor) decoded. A 4:2:0 or | |
| 2104 | +// 4:4:4 frame cannot increment it (the arm is keyed to a 2-px-wide chroma | |
| 2105 | +// block, which only a 1-mi-wide strip at ss (1, 0) produces), so a non-zero | |
| 2106 | +// read proves a stream routed a 4-wide strip through the split path. | |
| 2107 | +thread_local! { | |
| 2108 | + static CHROMA422_PAIR_WIDE_HITS: std::cell::Cell<usize> = | |
| 2109 | + const { std::cell::Cell::new(0) }; | |
| 2110 | +} | |
| 2111 | + | |
| 2112 | +/// Current value of [`CHROMA422_PAIR_WIDE_HITS`]. | |
| 2113 | +pub fn chroma422_pair_wide_hits() -> usize { | |
| 2114 | + CHROMA422_PAIR_WIDE_HITS.with(|c| c.get()) | |
| 2115 | +} | |
| 2116 | + | |
| 2102 | 2117 | // How many HORZ/VERT intra strips actually predicted with filter intra |
| 2103 | 2118 | // (lane-rectsplit r1) -- the case `decode_block_rect` refused by name |
| 2104 | 2119 | // ("this decoder predicts square-only") until `predict_filter_intra` took |
| @@ -10168,6 +10183,35 @@ fn depth_to_tx_wh( | ||
| 10168 | 10183 | (w, h) |
| 10169 | 10184 | } |
| 10170 | 10185 | |
| 10186 | +/// lane-av1-422stripanchor: [`decode_rect_split`]'s 4-wide-strip port of the | |
| 10187 | +/// split4 floored-pair anchor ([`sub8_leaf_chroma422`]'s rule). A 1-mi-wide | |
| 10188 | +/// strip (luma `(4, 16)` / `(4, 8)`) has NO chroma plane block of its own at | |
| 10189 | +/// ss (1, 0) -- `av1_ss_size_lookup[BLOCK_4X16][1][0]` and | |
| 10190 | +/// `[BLOCK_4X8][1][0]` are both BLOCK_INVALID (`common_data.c`), and a | |
| 10191 | +/// 2-px-wide area is not a transform shape. The strip pairs with its | |
| 10192 | +/// even-column sibling (`is_chroma_reference`'s `mi_col & 1` column clause, | |
| 10193 | +/// the rule [`decode_rect4_16_strip`] implements one partition level up), and | |
| 10194 | +/// the ODD-column strip codes the PAIR's `(4, bh)` plane anchored at | |
| 10195 | +/// `av1_setup_dst_planes`' mi-exact floor `(mi_col & !1) * MI >> ss_x`, with | |
| 10196 | +/// the entropy context on the floored cell. Returns | |
| 10197 | +/// `(pair block width, pair block height, write anchor x, entropy mi column)` | |
| 10198 | +/// for that pair, or `None` when the strip keeps its own plane block at its | |
| 10199 | +/// own origin -- which is every 4:2:0 and 4:4:4 cell (their chroma is never | |
| 10200 | +/// 2 px wide) and every 4:2:2 strip of 8 px or more. | |
| 10201 | +fn chroma422_pair_plane( | |
| 10202 | + ss_x: bool, | |
| 10203 | + ss_y: bool, | |
| 10204 | + mi_col: usize, | |
| 10205 | + bw: usize, | |
| 10206 | + bh: usize, | |
| 10207 | +) -> Option<(usize, usize, usize, usize)> { | |
| 10208 | + if ss_x && !ss_y && (bw >> 1) == 2 { | |
| 10209 | + Some((4, bh, ((mi_col & !1) * MI) >> 1, mi_col & !1)) | |
| 10210 | + } else { | |
| 10211 | + None | |
| 10212 | + } | |
| 10213 | +} | |
| 10214 | + | |
| 10171 | 10215 | /// Decodes the planes of one `bw`x`bh` HORZ/VERT intra strip whose luma |
| 10172 | 10216 | /// transform is SPLIT (`tx_depth != 0`) -- lane-rectsplit r1, the case every |
| 10173 | 10217 | /// rect path here refused by name until now ("per-unit rect prediction is not |
| @@ -10228,6 +10272,21 @@ fn decode_rect_split( | ||
| 10228 | 10272 | (bw, bh), |
| 10229 | 10273 | (8, 16) | (16, 32) | (32, 64) | (64, 128) | (8, 32) | (16, 64) |
| 10230 | 10274 | ); |
| 10275 | + // lane-av1-422stripanchor: the 4-wide strips' PAIR chroma -- the ported | |
| 10276 | + // floored-pair anchor. `chroma422_pair_plane` is `Some` exactly when this | |
| 10277 | + // strip's own chroma block would be 2 px wide at ss (1, 0); the pair's | |
| 10278 | + // plane is then `(4, chroma_h)` written at the FLOORED cell | |
| 10279 | + // (`chroma_x`), and the skip/tiled chroma arms below tile it in (4, 8) | |
| 10280 | + // units (the OOB `max_txsize_rect_lookup[BLOCK_INVALID]` byte, TX_4X8 -- | |
| 10281 | + // the same walk the (8, 32) class takes). The lossless raster arm keeps | |
| 10282 | + // the strip's own geometry: no caller of this function can present a | |
| 10283 | + // 4-wide strip yet (the enumeration test pins the five callers at | |
| 10284 | + // `8 <= min`), and the skip/tiled arms are the routes a future caller | |
| 10285 | + // needs. | |
| 10286 | + let chroma422_pair = chroma422_pair_plane(ss_x(fctx) == 1, ss_y(fctx) == 0, mi_c, bw, bh); | |
| 10287 | + let chroma_422_pair_wide = chroma422_pair.is_some(); | |
| 10288 | + let (chroma_block_w, chroma_block_h, chroma_x) = chroma422_pair | |
| 10289 | + .map_or((chroma_w, chroma_h, cpx), |(w, h, x, _)| (w, h, x)); | |
| 10231 | 10290 | // The chroma transform is picked before any symbol is read, so an |
| 10232 | 10291 | // unsupported chroma shape refuses before this strip desyncs the tile. |
| 10233 | 10292 | let chroma: Option<(TxbSet, &[u16])> = match (chroma_w, chroma_h) { |
| @@ -10272,7 +10331,8 @@ fn decode_rect_split( | ||
| 10272 | 10331 | // diagnostic names only the shapes that would actually refuse -- it used |
| 10273 | 10332 | // to fire for every tiled square too (the parent lane's `chroma=8x8` |
| 10274 | 10333 | // rows) and sent the next lane chasing handled shapes. |
| 10275 | - let chroma_tiled = chroma_422_oob | |
| 10334 | + let chroma_tiled = chroma_422_pair_wide | |
| 10335 | + || chroma_422_oob | |
| 10276 | 10336 | || matches!( |
| 10277 | 10337 | (chroma_w, chroma_h), |
| 10278 | 10338 | (64, 32) | (32, 64) | (64, 16) | (16, 64) | (32, 32) | (16, 16) | (8, 8) |
| @@ -10586,8 +10646,25 @@ fn decode_rect_split( | ||
| 10586 | 10646 | // `ll_chroma_units` and `decode_inter_block`'s `mu_chroma_units` tail |
| 10587 | 10647 | // already do. |
| 10588 | 10648 | let mut tiled_chroma_units: Vec<((usize, usize), usize, Grid, usize, usize)> = Vec::new(); |
| 10589 | - let ac = m.alpha.map(|_| cfl_src_rect(px, py, bw, bh)); | |
| 10590 | - let reach = block_reach; | |
| 10649 | + let ac = m.alpha.map(|_| { | |
| 10650 | + // lane-av1-422stripanchor: the pair unit's CfL source is the PAIR's | |
| 10651 | + // luma -- the 8-px-wide region the floored 4-px chroma block covers | |
| 10652 | + // (`av1_setup_dst_planes`' floor), never the odd strip's own 4 px. | |
| 10653 | + if chroma_422_pair_wide { | |
| 10654 | + cfl_src_rect((mi_c & !1) * MI, py, 8, bh) | |
| 10655 | + } else { | |
| 10656 | + cfl_src_rect(px, py, bw, bh) | |
| 10657 | + } | |
| 10658 | + }); | |
| 10659 | + let reach = if chroma_422_pair_wide { | |
| 10660 | + // The chroma units predict off the PAIR block's edges: an odd-column | |
| 10661 | + // strip's pair starts 4 luma px to the strip's left, so the strip's | |
| 10662 | + // own answer names the wrong above/right samples (the pair16 arm's | |
| 10663 | + // `pair_reach`, one partition level up). | |
| 10664 | + Reach::of_rect(8, bh, (mi_c & !1) * MI, py, y.width, y.height, fctx) | |
| 10665 | + } else { | |
| 10666 | + block_reach | |
| 10667 | + }; | |
| 10591 | 10668 | let (u_grid, v_grid) = if mono(fctx) { |
| 10592 | 10669 | // lane-av1mono: a monochrome frame codes no chroma coefficients on |
| 10593 | 10670 | // any block (`plane < av1_num_planes == 1`), so the whole chroma |
| @@ -10596,25 +10673,28 @@ fn decode_rect_split( | ||
| 10596 | 10673 | let zero = Grid::Zero(chroma_w * chroma_h); |
| 10597 | 10674 | (zero.clone(), zero) |
| 10598 | 10675 | } else if m.skip { |
| 10599 | - let zero = Grid::Zero(chroma_w * chroma_h); | |
| 10600 | - if chroma_422_oob { | |
| 10676 | + let zero = Grid::Zero(chroma_block_w * chroma_block_h); | |
| 10677 | + if chroma_422_pair_wide || chroma_422_oob { | |
| 10601 | 10678 | // lane-av1-422blockhalf: libaom predicts an INTRA strip's chroma |
| 10602 | 10679 | // per transform unit even when the strip is skipped |
| 10603 | 10680 | // (`decode_token_recon_block`'s per-TU plane walk runs before the |
| 10604 | 10681 | // skip guard), so the BLOCK_INVALID plane predicts as (4, 8) |
| 10605 | 10682 | // units -- one whole-plane push here would ask the intra |
| 10606 | 10683 | // predictor for a 1:8 rect it never needs. |
| 10684 | + // lane-av1-422stripanchor: the 4-wide strip's PAIR plane does the | |
| 10685 | + // same, over the pair's own `(chroma_block_w, chroma_block_h)` | |
| 10686 | + // grid at the floored anchor `chroma_x`. | |
| 10607 | 10687 | let (uw, uh) = (4usize, 8usize); |
| 10608 | 10688 | for plane_idx in 1..=2 { |
| 10609 | 10689 | if let Some((ub, vb)) = &m.palette_uv { |
| 10610 | 10690 | let buf = if plane_idx == 1 { ub } else { vb }; |
| 10611 | 10691 | set_palette_pred(buf.clone(), fctx); |
| 10612 | 10692 | } |
| 10613 | - for cu_row in 0..chroma_h / uh { | |
| 10614 | - for cu_col in 0..chroma_w / uw { | |
| 10693 | + for cu_row in 0..chroma_block_h / uh { | |
| 10694 | + for cu_col in 0..chroma_block_w / uw { | |
| 10615 | 10695 | push_intra_rect( |
| 10616 | 10696 | plane_idx, |
| 10617 | - cpx + cu_col * uw, | |
| 10697 | + chroma_x + cu_col * uw, | |
| 10618 | 10698 | cpy + cu_row * uh, |
| 10619 | 10699 | uw, |
| 10620 | 10700 | uh, |
| @@ -10706,10 +10786,13 @@ fn decode_rect_split( | ||
| 10706 | 10786 | let [ug, vg] = last; |
| 10707 | 10787 | (ug, vg) |
| 10708 | 10788 | } else if 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). | |
| 10789 | + let (uw, uh, set, scan): (usize, usize, TxbSet, &[u16]) = | |
| 10790 | + if chroma_422_pair_wide || chroma_422_oob { | |
| 10791 | + // lane-av1-422blockhalf / lane-av1-422stripanchor: the | |
| 10792 | + // BLOCK_INVALID-plane chroma's (4, 8) units -- the Release | |
| 10793 | + // oracle's out-of-bounds `max_txsize_rect_lookup` byte (TX_4X8, | |
| 10794 | + // see above). For the 4-wide strip the units tile the PAIR's | |
| 10795 | + // plane, stepping from the floored anchor. | |
| 10713 | 10796 | (4, 8, TxbSet::ChromaRect8x4, &SCAN_4X8) |
| 10714 | 10797 | } else { |
| 10715 | 10798 | match (chroma_w, chroma_h) { |
| @@ -10728,8 +10811,15 @@ fn decode_rect_split( | ||
| 10728 | 10811 | if uw == uh && ss_x(fctx) == 1 && ss_y(fctx) == 0 { |
| 10729 | 10812 | hit!(CHROMA422_SQUARE_HITS); |
| 10730 | 10813 | } |
| 10731 | - let (nw, nh) = (chroma_w / uw, chroma_h / uh); | |
| 10732 | - let bigger = chroma_w * chroma_h > uw * uh; | |
| 10814 | + if chroma_422_pair_wide { | |
| 10815 | + hit!(CHROMA422_PAIR_WIDE_HITS); | |
| 10816 | + } | |
| 10817 | + let (nw, nh) = (chroma_block_w / uw, chroma_block_h / uh); | |
| 10818 | + // lane-av1-422stripanchor: the pair's plane block is BLOCK_INVALID | |
| 10819 | + // whatever the pair size (`num_pels_log2_lookup[255]` reads 0xff in | |
| 10820 | + // the pinned Release oracle), so its txb_skip rows always carry the | |
| 10821 | + // bigger-plane +3 (the av1422q rule the pair16 arm measures). | |
| 10822 | + let bigger = chroma_422_pair_wide || chroma_w * chroma_h > uw * uh; | |
| 10733 | 10823 | // `av1_get_ext_tx_set_type`: a chroma transform whose square-up size |
| 10734 | 10824 | // is TX_32X32 or bigger resolves to `EXT_TX_SET_DCTONLY` for intra; |
| 10735 | 10825 | // smaller rect units (the 4:2:2 BLOCK_INVALID-plane (4, 8)s) take the |
| @@ -10747,7 +10837,8 @@ fn decode_rect_split( | ||
| 10747 | 10837 | let luma_span_y = uh << ss_y(fctx); |
| 10748 | 10838 | let cu_mi = ( |
| 10749 | 10839 | mi_r + cu_row * (luma_span_y / MI), |
| 10750 | - mi_c + cu_col * (luma_span_x / MI), | |
| 10840 | + if chroma_422_pair_wide { mi_c & !1 } else { mi_c } | |
| 10841 | + + cu_col * (luma_span_x / MI), | |
| 10751 | 10842 | ); |
| 10752 | 10843 | // lane-av1-422blockhalf: the 4:2:2 (4, 8) units read their |
| 10753 | 10844 | // chroma context per chroma cell |
| @@ -10755,22 +10846,33 @@ fn decode_rect_split( | ||
| 10755 | 10846 | // rule) -- the plain rect walk samples one chroma cell |
| 10756 | 10847 | // twice at ss_x 1. Every pre-existing shape keeps its own |
| 10757 | 10848 | // walk. |
| 10758 | - let cu_around = if chroma_422_oob { | |
| 10849 | + let cu_around = if chroma_422_pair_wide || chroma_422_oob { | |
| 10759 | 10850 | neighbours.around_mi_422_chroma(cu_mi, luma_span_x, luma_span_y) |
| 10760 | 10851 | } else { |
| 10761 | 10852 | neighbours.around_mi_rect(cu_mi, luma_span_x, luma_span_y) |
| 10762 | 10853 | }; |
| 10763 | - let (cu_x, cu_y) = (cpx + cu_col * uw, cpy + cu_row * uh); | |
| 10854 | + let (cu_x, cu_y) = (chroma_x + cu_col * uw, cpy + cu_row * uh); | |
| 10764 | 10855 | let cfl = m.alpha.map(|(au, av)| { |
| 10765 | 10856 | let alpha = if plane_idx == 1 { au } else { av }; |
| 10766 | 10857 | ( |
| 10767 | 10858 | alpha, |
| 10768 | - cfl_src_rect( | |
| 10769 | - px + cu_col * luma_span_x, | |
| 10770 | - py + cu_row * luma_span_y, | |
| 10771 | - luma_span_x, | |
| 10772 | - luma_span_y, | |
| 10773 | - ), | |
| 10859 | + if chroma_422_pair_wide { | |
| 10860 | + // The unit's co-located luma is the PAIR's | |
| 10861 | + // 8-px-wide band at the floored mi column. | |
| 10862 | + cfl_src_rect( | |
| 10863 | + (mi_c & !1) * MI + cu_col * luma_span_x, | |
| 10864 | + py + cu_row * luma_span_y, | |
| 10865 | + luma_span_x, | |
| 10866 | + luma_span_y, | |
| 10867 | + ) | |
| 10868 | + } else { | |
| 10869 | + cfl_src_rect( | |
| 10870 | + px + cu_col * luma_span_x, | |
| 10871 | + py + cu_row * luma_span_y, | |
| 10872 | + luma_span_x, | |
| 10873 | + luma_span_y, | |
| 10874 | + ) | |
| 10875 | + }, | |
| 10774 | 10876 | ) |
| 10775 | 10877 | }); |
| 10776 | 10878 | // lane-av1-422kf: the palette colour map is consumed per |
| @@ -10783,7 +10885,14 @@ fn decode_rect_split( | ||
| 10783 | 10885 | if let Some((ub, vb)) = &m.palette_uv { |
| 10784 | 10886 | let buf = if plane_idx == 1 { ub } else { vb }; |
| 10785 | 10887 | set_palette_pred( |
| 10786 | - palette_window(buf, chroma_w, cu_col * uw, cu_row * uh, uw, uh), | |
| 10888 | + palette_window( | |
| 10889 | + buf, | |
| 10890 | + chroma_block_w, | |
| 10891 | + cu_col * uw, | |
| 10892 | + cu_row * uh, | |
| 10893 | + uw, | |
| 10894 | + uh, | |
| 10895 | + ), | |
| 10787 | 10896 | fctx, |
| 10788 | 10897 | ); |
| 10789 | 10898 | } |
| @@ -11116,6 +11225,87 @@ fn every_shape_that_allows_motion_variation_has_a_motion_mode_cdf_row() { | ||
| 11116 | 11225 | ); |
| 11117 | 11226 | } |
| 11118 | 11227 | |
| 11228 | +/// lane-av1-422stripanchor, format-cell census for the 4-wide-strip pair port | |
| 11229 | +/// ([`chroma422_pair_plane`], [`decode_rect_split`]'s chroma routing): over | |
| 11230 | +/// every `BLOCK_SIZES_ALL` footprint at every subsampling cell, the pair arm | |
| 11231 | +/// fires exactly when libaom's own `av1_ss_size_lookup[..][1][0]` column | |
| 11232 | +/// (`common_data.c`) marks the plane block BLOCK_INVALID AND the plane would | |
| 11233 | +/// be 2 px wide -- the 4-wide footprints. The tall/wide BLOCK_INVALID shapes | |
| 11234 | +/// stay on the pre-existing `chroma_422_oob` (4, 8) tiling, and 4:2:0 / | |
| 11235 | +/// 4:4:4 never enter either arm (the byte-identical claim, checked per cell). | |
| 11236 | +#[test] | |
| 11237 | +fn chroma422_pair_plane_matches_the_ss_size_lookup_cells() { | |
| 11238 | + // The `av1_ss_size_lookup[..][1][0]` column verbatim (pinned oracle, | |
| 11239 | + // `common_data.c`), keyed by footprint: `true` = BLOCK_INVALID. | |
| 11240 | + let ss10_invalid: &[(&str, bool)] = &[ | |
| 11241 | + ("4x4", false), | |
| 11242 | + ("4x8", true), | |
| 11243 | + ("8x4", false), | |
| 11244 | + ("8x8", false), | |
| 11245 | + ("8x16", true), | |
| 11246 | + ("16x8", false), | |
| 11247 | + ("16x16", false), | |
| 11248 | + ("16x32", true), | |
| 11249 | + ("32x16", false), | |
| 11250 | + ("32x32", false), | |
| 11251 | + ("32x64", true), | |
| 11252 | + ("64x32", false), | |
| 11253 | + ("64x64", false), | |
| 11254 | + ("64x128", true), | |
| 11255 | + ("128x64", false), | |
| 11256 | + ("128x128", false), | |
| 11257 | + ("4x16", true), | |
| 11258 | + ("16x4", false), | |
| 11259 | + ("8x32", true), | |
| 11260 | + ("32x8", false), | |
| 11261 | + ("16x64", true), | |
| 11262 | + ("64x16", false), | |
| 11263 | + ]; | |
| 11264 | + for (footprint, invalid10) in ss10_invalid { | |
| 11265 | + let (w, h) = footprint.split_once('x').unwrap(); | |
| 11266 | + let (bw, bh) = (w.parse::<usize>().unwrap(), h.parse::<usize>().unwrap()); | |
| 11267 | + // BLOCK_4X4 is the SQUARE path's leaf, never a strip: its ss cell is | |
| 11268 | + // valid because a (2, 4) plane area rounds UP to the 4x4 read | |
| 11269 | + // (`sub8_leaf_chroma422`'s own rule), and it never reaches | |
| 11270 | + // [`decode_rect_split`] at all. | |
| 11271 | + if (bw, bh) == (4, 4) { | |
| 11272 | + continue; | |
| 11273 | + } | |
| 11274 | + // 4:2:0 and 4:4:4: the port never fires, whatever the footprint. | |
| 11275 | + for (ss_x, ss_y) in [(false, false), (true, true)] { | |
| 11276 | + assert!( | |
| 11277 | + chroma422_pair_plane(ss_x, ss_y, 7, bw, bh).is_none(), | |
| 11278 | + "{bw}x{bh} at ss ({ss_x}, {ss_y}) must keep its own plane block" | |
| 11279 | + ); | |
| 11280 | + } | |
| 11281 | + // 4:2:2: the pair arm is exactly the 2-px-wide (4-wide) slice of the | |
| 11282 | + // BLOCK_INVALID column, anchored at the floored mi column. | |
| 11283 | + let pair = chroma422_pair_plane(true, false, 7, bw, bh); | |
| 11284 | + assert_eq!( | |
| 11285 | + pair.is_some(), | |
| 11286 | + *invalid10 && bw == 4, | |
| 11287 | + "{bw}x{bh} at ss (1, 0): pair routing disagrees with ss_size_lookup" | |
| 11288 | + ); | |
| 11289 | + if let Some((block_w, block_h, x, ctx_col)) = pair { | |
| 11290 | + assert_eq!((block_w, block_h), (4, bh), "{bw}x{bh} pair plane shape"); | |
| 11291 | + assert_eq!(x, ((7 & !1) * MI) >> 1, "{bw}x{bh} floored write anchor"); | |
| 11292 | + assert_eq!(ctx_col, 6, "{bw}x{bh} entropy cell is the floored column"); | |
| 11293 | + // An even-column strip anchors at its own cell. | |
| 11294 | + let (x_even, col_even) = match chroma422_pair_plane(true, false, 6, bw, bh) { | |
| 11295 | + Some((_, _, x, c)) => (x, c), | |
| 11296 | + None => panic!("{bw}x{bh} lost its pair arm at an even mi_col"), | |
| 11297 | + }; | |
| 11298 | + assert_eq!((x_even, col_even), (12, 6), "even column keeps its own cell"); | |
| 11299 | + } | |
| 11300 | + } | |
| 11301 | + // The tall/wide BLOCK_INVALID shapes (8 px wide or more) are the | |
| 11302 | + // `chroma_422_oob` tiling's residents, not the pair arm's: both are | |
| 11303 | + // 4:2:2-only, so the two arms partition the BLOCK_INVALID column. | |
| 11304 | + for (bw, bh) in [(8usize, 16), (16, 32), (32, 64), (64, 128), (8, 32), (16, 64)] { | |
| 11305 | + assert!(chroma422_pair_plane(true, false, 7, bw, bh).is_none()); | |
| 11306 | + } | |
| 11307 | +} | |
| 11308 | + | |
| 11119 | 11309 | fn decode_intra_rect_in_inter( |
| 11120 | 11310 | dec: &mut SymbolDecoder, |
| 11121 | 11311 | cdfs: &mut Cdfs, |
lanes/av1422stripanchor.report.mdadded+103 -0
| @@ -0,0 +1,103 @@ | ||
| 1 | +# lane-av1-422stripanchor — `decode_rect_split`'s 4-wide-strip chroma ported to | |
| 2 | +# the split4 floored-pair anchor (`chroma422_pair_plane`), the ported pair | |
| 3 | +# plane tiled in the (4, 8) OOB units, and the (2, 16)/(2, 8) refusal shapes | |
| 4 | +# handled — frame 0 of the pinned t422 fixture stays byte-exact at | |
| 5 | +# PREFILT/POSTDEBLOCK/POSTCDEF/FINAL (first round with the FINAL rung | |
| 6 | +# measured), all 16 frames decode, and the port is measured inert on the | |
| 7 | +# fixture (`chroma422_pair_wide: 0`): NO stream reaches it today, so the lift | |
| 8 | +# is by construction and stays unwitnessed | |
| 9 | + | |
| 10 | +## Outcome | |
| 11 | + | |
| 12 | +1. `chroma422_pair_plane` (decode.rs, beside `depth_to_tx_wh`): the split4 | |
| 13 | + floored-pair anchor ported to `decode_rect_split`'s 1-mi-wide strips. A | |
| 14 | + strip whose own chroma block would be 2 px wide at ss (1, 0) — luma | |
| 15 | + `(4, 16)`/`(4, 8)`, the footprints `av1_ss_size_lookup[BLOCK_4X16]`/ | |
| 16 | + `[BLOCK_4X8][1][0]` mark BLOCK_INVALID (verified in the pinned oracle's | |
| 17 | + `common_data.c`, not from prose) — codes the PAIR's `(4, bh)` plane: | |
| 18 | + WRITE/PREDICTION anchor `((mi_col & !1) * MI) >> ss_x` | |
| 19 | + (`av1_setup_dst_planes`' mi-exact floor, the lane-av1-422kf2/ | |
| 20 | + `sub8_leaf_chroma422` rule), entropy cell at the floored mi column, and | |
| 21 | + the odd-column strip is the chroma reference (`is_chroma_reference`'s | |
| 22 | + `mi_col & 1` clause, the rule `decode_rect4_16_strip`'s pair16 arm | |
| 23 | + implements one partition level up). `None` on every other cell: 4:2:0 and | |
| 24 | + 4:4:4 can never produce a 2-px-wide chroma block, so their routing is | |
| 25 | + unchanged per format cell. | |
| 26 | +2. The skip and tiled chroma arms take the pair geometry: per-(4, 8) unit | |
| 27 | + walks over `(chroma_block_w, chroma_block_h)` at the floored anchor | |
| 28 | + `chroma_x` (the blockhalf lane's per-unit skip-push lesson kept), | |
| 29 | + `around_mi_422_chroma` per chroma cell, `bigger` forced (the invalid | |
| 30 | + plane's `num_pels_log2_lookup[255]` byte reads 0xff — the av1422q +3 rows) | |
| 31 | + , CfL source over the PAIR's 8-px luma band, and the chroma `reach` is the | |
| 32 | + pair block's (`Reach::of_rect(8, bh, pair_px, py, ..)`), not the odd | |
| 33 | + strip's own. Every pre-existing expression reduces to its old value when | |
| 34 | + `chroma_422_pair_wide` is false; the lossless raster arm is untouched (its | |
| 35 | + domain cannot present a 4-wide strip). | |
| 36 | +3. The `(2, 16)` refusal (the inventory string "a coded HORZ/VERT strip whose | |
| 37 | + chroma transform has no rect coefficient tables here") therefore no longer | |
| 38 | + fires for the 4-wide shapes — they are handled. The string STAYS: it | |
| 39 | + remains the shape guard for genuinely-untabled shapes, and the | |
| 40 | + lane-t900-r33 enumeration test still pins the five callers. | |
| 41 | +4. GATE: `chroma422_pair_plane_matches_the_ss_size_lookup_cells` — a | |
| 42 | + format-cell census over all 22 `BLOCK_SIZES_ALL` footprints: the pair arm | |
| 43 | + fires exactly on the 2-px-wide slice of the real `ss_size_lookup[..][1][0]` | |
| 44 | + BLOCK_INVALID column ((4, 8), (4, 16); BLOCK_4X4 excluded as the square | |
| 45 | + path's own sub-8 rounding rule), the tall/wide BLOCK_INVALID shapes stay | |
| 46 | + on `chroma_422_oob` (the two arms partition the column), and 4:2:0/4:4:4 | |
| 47 | + return `None` at every footprint. Floored-anchor math asserted for odd and | |
| 48 | + even mi columns. | |
| 49 | +5. WITNESS COUNTER: `CHROMA422_PAIR_WIDE_HITS` (+ accessor, + | |
| 50 | + `decode_probe` line). Reads 0 on the pinned fixture — the arm is provably | |
| 51 | + inert there. | |
| 52 | +6. MEASURED (fixture `/tmp/t422.obu`, sha256 | |
| 53 | + `d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129`, | |
| 54 | + reused by hash; frame-0 cut `/tmp/t422f0.obu` sha256 | |
| 55 | + `3dd3f768ef553c02316848c2d3184c3765030c0a6fcb95887e4719add9ded3af`; | |
| 56 | + ours = `decode_probe --release` under | |
| 57 | + `$HOME/.cache/cargo-target-av1422stripanchor`, oracle = | |
| 58 | + `$HOME/.cache/aom-oracle/build/aomdec`, padded-u8-vs-cropped-u8 compare): | |
| 59 | + - frame 0: **0 diffs on Y, U and V at PREFILT, POSTDEBLOCK, POSTCDEF and | |
| 60 | + FINAL** — the FINAL rung is measured this round (the parent lane's | |
| 61 | + round bracketed it by POSTCDEF). | |
| 62 | + - all 16 frames decode; counters unchanged from the parent lane | |
| 63 | + (chroma422_rect 682, chroma422_sub8 122, chroma422_chunk 344) and | |
| 64 | + `chroma422_pair_wide: 0`. | |
| 65 | +7. WHY NO WITNESS STREAM (the acceptance's fallback): the (2, 16) lift is | |
| 66 | + by construction and UNWITNESSABLE today — no current stream can route a | |
| 67 | + 4-wide strip into `decode_rect_split`. The five callers pass only the ten | |
| 68 | + rect footprints with `8 <= min` (the enumeration test pins both the caller | |
| 69 | + set and the domain); the real 4-wide readers — `decode_rect4_16_strip` | |
| 70 | + (16-level 1:4, whose depth walk is inlined precisely because the chroma is | |
| 71 | + pair-owned: the pair16 arm already carries the floored anchor + (4, 8) | |
| 72 | + tiling), `decode_leaf_rect8` + `decode_inter_sub8_rect2` (8-level | |
| 73 | + HORZ/VERT, both per-piece floored arms from lane-av1-422h/blockhalf) and | |
| 74 | + the inter `PARTITION_*_4` walk — never call it. Three fresh | |
| 75 | + `aomenc --profile=2` probes (testsrc2 cpu-used=1 + tx-size-search, | |
| 76 | + mandelbrot cpu-used=0, smptebars screen tune) all decode or diverge | |
| 77 | + without touching the arm. A witness requires a future caller that routes | |
| 78 | + 4-wide strips here (a capability change the enumeration test will force a | |
| 79 | + re-derivation for); the counter is wired so that stream proves itself the | |
| 80 | + moment it exists. | |
| 81 | + | |
| 82 | +## Observed, not chased | |
| 83 | + | |
| 84 | +- The mandelbrot probe (`s2.obu`, frames 1+) crashes in | |
| 85 | + `push_mc_rect_tx` ("range end index 32 out of range for slice of length | |
| 86 | + 0") — frame 0 alone decodes clean. Read as a downstream symptom of the | |
| 87 | + known frames-1+ partition-dispatch desync (mi(8,10), Agent204's lane) on | |
| 88 | + heavy-motion content: a desynced shape walk reaches the MC push with an | |
| 89 | + empty pred buffer. Not attributed to this port; named for the desync lane's | |
| 90 | + ledger. | |
| 91 | + | |
| 92 | +## Decision | |
| 93 | + | |
| 94 | +- The header refusal STAYS unconditional in `stream.rs`; the | |
| 95 | + `EC_AV1_ALLOW_422_PROBE` bypass was re-applied for the measurement runs and | |
| 96 | + reverted byte-identical afterwards (0 occurrences; | |
| 97 | + `a_non_420_subsampled_sequence_header_is_refused_by_name` green post-revert). | |
| 98 | +- 4:2:0/4:4:4 byte-identical by ss-keying, checked per format cell by the | |
| 99 | + census gate and by measurement on the fixture. | |
| 100 | +- `read_coeffs_rect`, the chroma table rows and the 4:2:0 group-tail SKIP arm | |
| 101 | + untouched. | |
| 102 | +- cargo check 0 warnings; targeted gates green (enumeration, 422 refusal, | |
| 103 | + lossless sample-exact, rect-strip filter-intra, the new census). |