Merge 86b328fd (422stripanchor) — suite green: 422stripanchor 624/0
Browse files at this commit3 changed files +320 -23
- crates/ec-av1/examples/decode_probe.rs +4 -0
- crates/ec-av1/src/decode.rs +213 -23
- 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+213 -23
| @@ -2107,6 +2107,21 @@ pub fn chroma422_chunk_hits() -> usize { | ||
| 2107 | 2107 | CHROMA422_CHUNK_HITS.with(|c| c.get()) |
| 2108 | 2108 | } |
| 2109 | 2109 | |
| 2110 | +// lane-av1-422stripanchor: how many 4-wide-strip PAIR chroma units | |
| 2111 | +// ([`decode_rect_split`]'s ported floored-pair anchor) decoded. A 4:2:0 or | |
| 2112 | +// 4:4:4 frame cannot increment it (the arm is keyed to a 2-px-wide chroma | |
| 2113 | +// block, which only a 1-mi-wide strip at ss (1, 0) produces), so a non-zero | |
| 2114 | +// read proves a stream routed a 4-wide strip through the split path. | |
| 2115 | +thread_local! { | |
| 2116 | + static CHROMA422_PAIR_WIDE_HITS: std::cell::Cell<usize> = | |
| 2117 | + const { std::cell::Cell::new(0) }; | |
| 2118 | +} | |
| 2119 | + | |
| 2120 | +/// Current value of [`CHROMA422_PAIR_WIDE_HITS`]. | |
| 2121 | +pub fn chroma422_pair_wide_hits() -> usize { | |
| 2122 | + CHROMA422_PAIR_WIDE_HITS.with(|c| c.get()) | |
| 2123 | +} | |
| 2124 | + | |
| 2110 | 2125 | // How many HORZ/VERT intra strips actually predicted with filter intra |
| 2111 | 2126 | // (lane-rectsplit r1) -- the case `decode_block_rect` refused by name |
| 2112 | 2127 | // ("this decoder predicts square-only") until `predict_filter_intra` took |
| @@ -10292,6 +10307,35 @@ fn depth_to_tx_wh( | ||
| 10292 | 10307 | (w, h) |
| 10293 | 10308 | } |
| 10294 | 10309 | |
| 10310 | +/// lane-av1-422stripanchor: [`decode_rect_split`]'s 4-wide-strip port of the | |
| 10311 | +/// split4 floored-pair anchor ([`sub8_leaf_chroma422`]'s rule). A 1-mi-wide | |
| 10312 | +/// strip (luma `(4, 16)` / `(4, 8)`) has NO chroma plane block of its own at | |
| 10313 | +/// ss (1, 0) -- `av1_ss_size_lookup[BLOCK_4X16][1][0]` and | |
| 10314 | +/// `[BLOCK_4X8][1][0]` are both BLOCK_INVALID (`common_data.c`), and a | |
| 10315 | +/// 2-px-wide area is not a transform shape. The strip pairs with its | |
| 10316 | +/// even-column sibling (`is_chroma_reference`'s `mi_col & 1` column clause, | |
| 10317 | +/// the rule [`decode_rect4_16_strip`] implements one partition level up), and | |
| 10318 | +/// the ODD-column strip codes the PAIR's `(4, bh)` plane anchored at | |
| 10319 | +/// `av1_setup_dst_planes`' mi-exact floor `(mi_col & !1) * MI >> ss_x`, with | |
| 10320 | +/// the entropy context on the floored cell. Returns | |
| 10321 | +/// `(pair block width, pair block height, write anchor x, entropy mi column)` | |
| 10322 | +/// for that pair, or `None` when the strip keeps its own plane block at its | |
| 10323 | +/// own origin -- which is every 4:2:0 and 4:4:4 cell (their chroma is never | |
| 10324 | +/// 2 px wide) and every 4:2:2 strip of 8 px or more. | |
| 10325 | +fn chroma422_pair_plane( | |
| 10326 | + ss_x: bool, | |
| 10327 | + ss_y: bool, | |
| 10328 | + mi_col: usize, | |
| 10329 | + bw: usize, | |
| 10330 | + bh: usize, | |
| 10331 | +) -> Option<(usize, usize, usize, usize)> { | |
| 10332 | + if ss_x && !ss_y && (bw >> 1) == 2 { | |
| 10333 | + Some((4, bh, ((mi_col & !1) * MI) >> 1, mi_col & !1)) | |
| 10334 | + } else { | |
| 10335 | + None | |
| 10336 | + } | |
| 10337 | +} | |
| 10338 | + | |
| 10295 | 10339 | /// Decodes the planes of one `bw`x`bh` HORZ/VERT intra strip whose luma |
| 10296 | 10340 | /// transform is SPLIT (`tx_depth != 0`) -- lane-rectsplit r1, the case every |
| 10297 | 10341 | /// rect path here refused by name until now ("per-unit rect prediction is not |
| @@ -10352,6 +10396,21 @@ fn decode_rect_split( | ||
| 10352 | 10396 | (bw, bh), |
| 10353 | 10397 | (8, 16) | (16, 32) | (32, 64) | (64, 128) | (8, 32) | (16, 64) |
| 10354 | 10398 | ); |
| 10399 | + // lane-av1-422stripanchor: the 4-wide strips' PAIR chroma -- the ported | |
| 10400 | + // floored-pair anchor. `chroma422_pair_plane` is `Some` exactly when this | |
| 10401 | + // strip's own chroma block would be 2 px wide at ss (1, 0); the pair's | |
| 10402 | + // plane is then `(4, chroma_h)` written at the FLOORED cell | |
| 10403 | + // (`chroma_x`), and the skip/tiled chroma arms below tile it in (4, 8) | |
| 10404 | + // units (the OOB `max_txsize_rect_lookup[BLOCK_INVALID]` byte, TX_4X8 -- | |
| 10405 | + // the same walk the (8, 32) class takes). The lossless raster arm keeps | |
| 10406 | + // the strip's own geometry: no caller of this function can present a | |
| 10407 | + // 4-wide strip yet (the enumeration test pins the five callers at | |
| 10408 | + // `8 <= min`), and the skip/tiled arms are the routes a future caller | |
| 10409 | + // needs. | |
| 10410 | + let chroma422_pair = chroma422_pair_plane(ss_x(fctx) == 1, ss_y(fctx) == 0, mi_c, bw, bh); | |
| 10411 | + let chroma_422_pair_wide = chroma422_pair.is_some(); | |
| 10412 | + let (chroma_block_w, chroma_block_h, chroma_x) = chroma422_pair | |
| 10413 | + .map_or((chroma_w, chroma_h, cpx), |(w, h, x, _)| (w, h, x)); | |
| 10355 | 10414 | // The chroma transform is picked before any symbol is read, so an |
| 10356 | 10415 | // unsupported chroma shape refuses before this strip desyncs the tile. |
| 10357 | 10416 | let chroma: Option<(TxbSet, &[u16])> = match (chroma_w, chroma_h) { |
| @@ -10387,7 +10446,8 @@ fn decode_rect_split( | ||
| 10387 | 10446 | // diagnostic names only the shapes that would actually refuse -- it used |
| 10388 | 10447 | // to fire for every tiled square too (the parent lane's `chroma=8x8` |
| 10389 | 10448 | // rows) and sent the next lane chasing handled shapes. |
| 10390 | - let chroma_tiled = chroma_422_oob | |
| 10449 | + let chroma_tiled = chroma_422_pair_wide | |
| 10450 | + || chroma_422_oob | |
| 10391 | 10451 | || matches!( |
| 10392 | 10452 | (chroma_w, chroma_h), |
| 10393 | 10453 | (64, 32) | (32, 64) | (64, 16) | (16, 64) | (32, 32) | (16, 16) | (8, 8) |
| @@ -10713,8 +10773,25 @@ fn decode_rect_split( | ||
| 10713 | 10773 | // `ll_chroma_units` and `decode_inter_block`'s `mu_chroma_units` tail |
| 10714 | 10774 | // already do. |
| 10715 | 10775 | let mut tiled_chroma_units: Vec<((usize, usize), usize, Grid, usize, usize)> = Vec::new(); |
| 10716 | - let ac = m.alpha.map(|_| cfl_src_rect(px, py, bw, bh)); | |
| 10717 | - let reach = block_reach; | |
| 10776 | + let ac = m.alpha.map(|_| { | |
| 10777 | + // lane-av1-422stripanchor: the pair unit's CfL source is the PAIR's | |
| 10778 | + // luma -- the 8-px-wide region the floored 4-px chroma block covers | |
| 10779 | + // (`av1_setup_dst_planes`' floor), never the odd strip's own 4 px. | |
| 10780 | + if chroma_422_pair_wide { | |
| 10781 | + cfl_src_rect((mi_c & !1) * MI, py, 8, bh) | |
| 10782 | + } else { | |
| 10783 | + cfl_src_rect(px, py, bw, bh) | |
| 10784 | + } | |
| 10785 | + }); | |
| 10786 | + let reach = if chroma_422_pair_wide { | |
| 10787 | + // The chroma units predict off the PAIR block's edges: an odd-column | |
| 10788 | + // strip's pair starts 4 luma px to the strip's left, so the strip's | |
| 10789 | + // own answer names the wrong above/right samples (the pair16 arm's | |
| 10790 | + // `pair_reach`, one partition level up). | |
| 10791 | + Reach::of_rect(8, bh, (mi_c & !1) * MI, py, y.width, y.height, fctx) | |
| 10792 | + } else { | |
| 10793 | + block_reach | |
| 10794 | + }; | |
| 10718 | 10795 | let (u_grid, v_grid) = if mono(fctx) { |
| 10719 | 10796 | // lane-av1mono: a monochrome frame codes no chroma coefficients on |
| 10720 | 10797 | // any block (`plane < av1_num_planes == 1`), so the whole chroma |
| @@ -10723,25 +10800,28 @@ fn decode_rect_split( | ||
| 10723 | 10800 | let zero = Grid::Zero(chroma_w * chroma_h); |
| 10724 | 10801 | (zero.clone(), zero) |
| 10725 | 10802 | } else if m.skip { |
| 10726 | - let zero = Grid::Zero(chroma_w * chroma_h); | |
| 10727 | - if chroma_422_oob { | |
| 10803 | + let zero = Grid::Zero(chroma_block_w * chroma_block_h); | |
| 10804 | + if chroma_422_pair_wide || chroma_422_oob { | |
| 10728 | 10805 | // lane-av1-422blockhalf: libaom predicts an INTRA strip's chroma |
| 10729 | 10806 | // per transform unit even when the strip is skipped |
| 10730 | 10807 | // (`decode_token_recon_block`'s per-TU plane walk runs before the |
| 10731 | 10808 | // skip guard), so the BLOCK_INVALID plane predicts as (4, 8) |
| 10732 | 10809 | // units -- one whole-plane push here would ask the intra |
| 10733 | 10810 | // predictor for a 1:8 rect it never needs. |
| 10811 | + // lane-av1-422stripanchor: the 4-wide strip's PAIR plane does the | |
| 10812 | + // same, over the pair's own `(chroma_block_w, chroma_block_h)` | |
| 10813 | + // grid at the floored anchor `chroma_x`. | |
| 10734 | 10814 | let (uw, uh) = (4usize, 8usize); |
| 10735 | 10815 | for plane_idx in 1..=2 { |
| 10736 | 10816 | if let Some((ub, vb)) = &m.palette_uv { |
| 10737 | 10817 | let buf = if plane_idx == 1 { ub } else { vb }; |
| 10738 | 10818 | set_palette_pred(buf.clone(), fctx); |
| 10739 | 10819 | } |
| 10740 | - for cu_row in 0..chroma_h / uh { | |
| 10741 | - for cu_col in 0..chroma_w / uw { | |
| 10820 | + for cu_row in 0..chroma_block_h / uh { | |
| 10821 | + for cu_col in 0..chroma_block_w / uw { | |
| 10742 | 10822 | push_intra_rect( |
| 10743 | 10823 | plane_idx, |
| 10744 | - cpx + cu_col * uw, | |
| 10824 | + chroma_x + cu_col * uw, | |
| 10745 | 10825 | cpy + cu_row * uh, |
| 10746 | 10826 | uw, |
| 10747 | 10827 | uh, |
| @@ -10846,10 +10926,13 @@ fn decode_rect_split( | ||
| 10846 | 10926 | let [ug, vg] = last; |
| 10847 | 10927 | (ug, vg) |
| 10848 | 10928 | } else if chroma_tiled { |
| 10849 | - let (uw, uh, set, scan): (usize, usize, TxbSet, &[u16]) = if chroma_422_oob { | |
| 10850 | - // lane-av1-422blockhalf: the BLOCK_INVALID-plane strip's (4, 8) | |
| 10851 | - // units -- the Release oracle's out-of-bounds | |
| 10852 | - // `max_txsize_rect_lookup[BLOCK_INVALID]` byte (see above). | |
| 10929 | + let (uw, uh, set, scan): (usize, usize, TxbSet, &[u16]) = | |
| 10930 | + if chroma_422_pair_wide || chroma_422_oob { | |
| 10931 | + // lane-av1-422blockhalf / lane-av1-422stripanchor: the | |
| 10932 | + // BLOCK_INVALID-plane chroma's (4, 8) units -- the Release | |
| 10933 | + // oracle's out-of-bounds `max_txsize_rect_lookup` byte (TX_4X8, | |
| 10934 | + // see above). For the 4-wide strip the units tile the PAIR's | |
| 10935 | + // plane, stepping from the floored anchor. | |
| 10853 | 10936 | (4, 8, TxbSet::ChromaRect8x4, &SCAN_4X8) |
| 10854 | 10937 | } else { |
| 10855 | 10938 | match (chroma_w, chroma_h) { |
| @@ -10868,8 +10951,15 @@ fn decode_rect_split( | ||
| 10868 | 10951 | if uw == uh && ss_x(fctx) == 1 && ss_y(fctx) == 0 { |
| 10869 | 10952 | hit!(CHROMA422_SQUARE_HITS); |
| 10870 | 10953 | } |
| 10871 | - let (nw, nh) = (chroma_w / uw, chroma_h / uh); | |
| 10872 | - let bigger = chroma_w * chroma_h > uw * uh; | |
| 10954 | + if chroma_422_pair_wide { | |
| 10955 | + hit!(CHROMA422_PAIR_WIDE_HITS); | |
| 10956 | + } | |
| 10957 | + let (nw, nh) = (chroma_block_w / uw, chroma_block_h / uh); | |
| 10958 | + // lane-av1-422stripanchor: the pair's plane block is BLOCK_INVALID | |
| 10959 | + // whatever the pair size (`num_pels_log2_lookup[255]` reads 0xff in | |
| 10960 | + // the pinned Release oracle), so its txb_skip rows always carry the | |
| 10961 | + // bigger-plane +3 (the av1422q rule the pair16 arm measures). | |
| 10962 | + let bigger = chroma_422_pair_wide || chroma_w * chroma_h > uw * uh; | |
| 10873 | 10963 | // `av1_get_ext_tx_set_type`: a chroma transform whose square-up size |
| 10874 | 10964 | // is TX_32X32 or bigger resolves to `EXT_TX_SET_DCTONLY` for intra; |
| 10875 | 10965 | // smaller rect units (the 4:2:2 BLOCK_INVALID-plane (4, 8)s) take the |
| @@ -10887,7 +10977,8 @@ fn decode_rect_split( | ||
| 10887 | 10977 | let luma_span_y = uh << ss_y(fctx); |
| 10888 | 10978 | let cu_mi = ( |
| 10889 | 10979 | mi_r + cu_row * (luma_span_y / MI), |
| 10890 | - mi_c + cu_col * (luma_span_x / MI), | |
| 10980 | + if chroma_422_pair_wide { mi_c & !1 } else { mi_c } | |
| 10981 | + + cu_col * (luma_span_x / MI), | |
| 10891 | 10982 | ); |
| 10892 | 10983 | // lane-av1-422blockhalf: the 4:2:2 (4, 8) units read their |
| 10893 | 10984 | // chroma context per chroma cell |
| @@ -10909,17 +11000,28 @@ fn decode_rect_split( | ||
| 10909 | 11000 | } else { |
| 10910 | 11001 | neighbours.around_mi_rect(cu_mi, luma_span_x, luma_span_y) |
| 10911 | 11002 | }; |
| 10912 | - let (cu_x, cu_y) = (cpx + cu_col * uw, cpy + cu_row * uh); | |
| 11003 | + let (cu_x, cu_y) = (chroma_x + cu_col * uw, cpy + cu_row * uh); | |
| 10913 | 11004 | let cfl = m.alpha.map(|(au, av)| { |
| 10914 | 11005 | let alpha = if plane_idx == 1 { au } else { av }; |
| 10915 | 11006 | ( |
| 10916 | 11007 | alpha, |
| 10917 | - cfl_src_rect( | |
| 10918 | - px + cu_col * luma_span_x, | |
| 10919 | - py + cu_row * luma_span_y, | |
| 10920 | - luma_span_x, | |
| 10921 | - luma_span_y, | |
| 10922 | - ), | |
| 11008 | + if chroma_422_pair_wide { | |
| 11009 | + // The unit's co-located luma is the PAIR's | |
| 11010 | + // 8-px-wide band at the floored mi column. | |
| 11011 | + cfl_src_rect( | |
| 11012 | + (mi_c & !1) * MI + cu_col * luma_span_x, | |
| 11013 | + py + cu_row * luma_span_y, | |
| 11014 | + luma_span_x, | |
| 11015 | + luma_span_y, | |
| 11016 | + ) | |
| 11017 | + } else { | |
| 11018 | + cfl_src_rect( | |
| 11019 | + px + cu_col * luma_span_x, | |
| 11020 | + py + cu_row * luma_span_y, | |
| 11021 | + luma_span_x, | |
| 11022 | + luma_span_y, | |
| 11023 | + ) | |
| 11024 | + }, | |
| 10923 | 11025 | ) |
| 10924 | 11026 | }); |
| 10925 | 11027 | // lane-av1-422kf: the palette colour map is consumed per |
| @@ -10932,7 +11034,14 @@ fn decode_rect_split( | ||
| 10932 | 11034 | if let Some((ub, vb)) = &m.palette_uv { |
| 10933 | 11035 | let buf = if plane_idx == 1 { ub } else { vb }; |
| 10934 | 11036 | set_palette_pred( |
| 10935 | - palette_window(buf, chroma_w, cu_col * uw, cu_row * uh, uw, uh), | |
| 11037 | + palette_window( | |
| 11038 | + buf, | |
| 11039 | + chroma_block_w, | |
| 11040 | + cu_col * uw, | |
| 11041 | + cu_row * uh, | |
| 11042 | + uw, | |
| 11043 | + uh, | |
| 11044 | + ), | |
| 10936 | 11045 | fctx, |
| 10937 | 11046 | ); |
| 10938 | 11047 | } |
| @@ -11277,6 +11386,87 @@ fn every_shape_that_allows_motion_variation_has_a_motion_mode_cdf_row() { | ||
| 11277 | 11386 | ); |
| 11278 | 11387 | } |
| 11279 | 11388 | |
| 11389 | +/// lane-av1-422stripanchor, format-cell census for the 4-wide-strip pair port | |
| 11390 | +/// ([`chroma422_pair_plane`], [`decode_rect_split`]'s chroma routing): over | |
| 11391 | +/// every `BLOCK_SIZES_ALL` footprint at every subsampling cell, the pair arm | |
| 11392 | +/// fires exactly when libaom's own `av1_ss_size_lookup[..][1][0]` column | |
| 11393 | +/// (`common_data.c`) marks the plane block BLOCK_INVALID AND the plane would | |
| 11394 | +/// be 2 px wide -- the 4-wide footprints. The tall/wide BLOCK_INVALID shapes | |
| 11395 | +/// stay on the pre-existing `chroma_422_oob` (4, 8) tiling, and 4:2:0 / | |
| 11396 | +/// 4:4:4 never enter either arm (the byte-identical claim, checked per cell). | |
| 11397 | +#[test] | |
| 11398 | +fn chroma422_pair_plane_matches_the_ss_size_lookup_cells() { | |
| 11399 | + // The `av1_ss_size_lookup[..][1][0]` column verbatim (pinned oracle, | |
| 11400 | + // `common_data.c`), keyed by footprint: `true` = BLOCK_INVALID. | |
| 11401 | + let ss10_invalid: &[(&str, bool)] = &[ | |
| 11402 | + ("4x4", false), | |
| 11403 | + ("4x8", true), | |
| 11404 | + ("8x4", false), | |
| 11405 | + ("8x8", false), | |
| 11406 | + ("8x16", true), | |
| 11407 | + ("16x8", false), | |
| 11408 | + ("16x16", false), | |
| 11409 | + ("16x32", true), | |
| 11410 | + ("32x16", false), | |
| 11411 | + ("32x32", false), | |
| 11412 | + ("32x64", true), | |
| 11413 | + ("64x32", false), | |
| 11414 | + ("64x64", false), | |
| 11415 | + ("64x128", true), | |
| 11416 | + ("128x64", false), | |
| 11417 | + ("128x128", false), | |
| 11418 | + ("4x16", true), | |
| 11419 | + ("16x4", false), | |
| 11420 | + ("8x32", true), | |
| 11421 | + ("32x8", false), | |
| 11422 | + ("16x64", true), | |
| 11423 | + ("64x16", false), | |
| 11424 | + ]; | |
| 11425 | + for (footprint, invalid10) in ss10_invalid { | |
| 11426 | + let (w, h) = footprint.split_once('x').unwrap(); | |
| 11427 | + let (bw, bh) = (w.parse::<usize>().unwrap(), h.parse::<usize>().unwrap()); | |
| 11428 | + // BLOCK_4X4 is the SQUARE path's leaf, never a strip: its ss cell is | |
| 11429 | + // valid because a (2, 4) plane area rounds UP to the 4x4 read | |
| 11430 | + // (`sub8_leaf_chroma422`'s own rule), and it never reaches | |
| 11431 | + // [`decode_rect_split`] at all. | |
| 11432 | + if (bw, bh) == (4, 4) { | |
| 11433 | + continue; | |
| 11434 | + } | |
| 11435 | + // 4:2:0 and 4:4:4: the port never fires, whatever the footprint. | |
| 11436 | + for (ss_x, ss_y) in [(false, false), (true, true)] { | |
| 11437 | + assert!( | |
| 11438 | + chroma422_pair_plane(ss_x, ss_y, 7, bw, bh).is_none(), | |
| 11439 | + "{bw}x{bh} at ss ({ss_x}, {ss_y}) must keep its own plane block" | |
| 11440 | + ); | |
| 11441 | + } | |
| 11442 | + // 4:2:2: the pair arm is exactly the 2-px-wide (4-wide) slice of the | |
| 11443 | + // BLOCK_INVALID column, anchored at the floored mi column. | |
| 11444 | + let pair = chroma422_pair_plane(true, false, 7, bw, bh); | |
| 11445 | + assert_eq!( | |
| 11446 | + pair.is_some(), | |
| 11447 | + *invalid10 && bw == 4, | |
| 11448 | + "{bw}x{bh} at ss (1, 0): pair routing disagrees with ss_size_lookup" | |
| 11449 | + ); | |
| 11450 | + if let Some((block_w, block_h, x, ctx_col)) = pair { | |
| 11451 | + assert_eq!((block_w, block_h), (4, bh), "{bw}x{bh} pair plane shape"); | |
| 11452 | + assert_eq!(x, ((7 & !1) * MI) >> 1, "{bw}x{bh} floored write anchor"); | |
| 11453 | + assert_eq!(ctx_col, 6, "{bw}x{bh} entropy cell is the floored column"); | |
| 11454 | + // An even-column strip anchors at its own cell. | |
| 11455 | + let (x_even, col_even) = match chroma422_pair_plane(true, false, 6, bw, bh) { | |
| 11456 | + Some((_, _, x, c)) => (x, c), | |
| 11457 | + None => panic!("{bw}x{bh} lost its pair arm at an even mi_col"), | |
| 11458 | + }; | |
| 11459 | + assert_eq!((x_even, col_even), (12, 6), "even column keeps its own cell"); | |
| 11460 | + } | |
| 11461 | + } | |
| 11462 | + // The tall/wide BLOCK_INVALID shapes (8 px wide or more) are the | |
| 11463 | + // `chroma_422_oob` tiling's residents, not the pair arm's: both are | |
| 11464 | + // 4:2:2-only, so the two arms partition the BLOCK_INVALID column. | |
| 11465 | + for (bw, bh) in [(8usize, 16), (16, 32), (32, 64), (64, 128), (8, 32), (16, 64)] { | |
| 11466 | + assert!(chroma422_pair_plane(true, false, 7, bw, bh).is_none()); | |
| 11467 | + } | |
| 11468 | +} | |
| 11469 | + | |
| 11280 | 11470 | fn decode_intra_rect_in_inter( |
| 11281 | 11471 | dec: &mut SymbolDecoder, |
| 11282 | 11472 | 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). |