From 5a2f5efe3a0771ac7ca43d57bdf63c19a7b75ff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 2 Sep 2026 04:31:32 +0300 Subject: [PATCH] fix(av1): sub-8 rect leaves read use_filter_intra from BLOCK_4X4's CDF row and then refused the prediction -- 4x8/8x4 now decode filter intra pixel-exact `read_intra_mode_sub8` is shared by the 4x4 split leaves and lane-tx4x8's 4x8/8x4 rect leaves, and hardcoded `cdfs.filter_intra[0]` (BLOCK_4X4's row). `av1_filter_intra_allowed_bsize` allows BLOCK_4X8/BLOCK_8X4, so aomenc writes the flag for every DC_PRED one of them and libaom reads it with `default_filter_intra_cdfs[BLOCK_4X8]/[BLOCK_8X4]` (6743/5893): the same symbol VALUE out of a different interval, a desync a block or two later (wrong-alphabet-same-value). `cdf::FILTER_INTRA` gains those two rows (classes 8/9, generated by scripts/extract-filter-intra-cdfs.py and pinned by the domain test, whose 4x8/8x4 entries lose their now-stale BELOW_8X8 refusal), the class comes from `filter_intra_size_class_rect`, and the caller passes its leaf's own shape. Prediction: the refusal ("filter intra on a HORZ/VERT strip (this decoder predicts square-only)") was stale prose -- `predict_filter_intra` has taken a true bw x bh since lane-rectsplit -- so `filter_intra` is threaded into both whole-leaf `reconstruct_rect` calls and, under `tx_depth=1`, into each 4x4 transform unit's own `reconstruct`/`read_plane` (each predicted from the previous unit's reconstruction). The refusal leaves refusal_inventory. Sweep of the same class as 1a89ed9 (tx_type row under filter intra): the coded 16x8/8x16 and 32x16/16x32 strips also passed the block's raw DC_PRED `mode` to `cdfs.txb`; all three sites now go through the new `fi_tx_row` (`fimode_to_intradir`), which `read_plane` shares. GATE: a_real_aomenc_stream_with_filter_intra_on_a_sub8_rect_leaf_decodes_pixel_exact -- real aomenc, filter-intra ON as the first occurrence of the flag, three arms (8-bit tx-size-search=1/0, 10-bit =1), per attempt a nonzero filter_intra_rect_sub8_hits delta AND all three planes compared against ffmpeg; 3 firing pixel-exact runs per arm (5/5/4 filter-intra 4x8/8x4 leaves). --- crates/ec-av1/src/cdf.rs | 11 +- crates/ec-av1/src/cdf_state.rs | 4 +- crates/ec-av1/src/decode.rs | 97 ++++++++----- crates/ec-av1/src/refusal_inventory.rs | 3 - crates/ec-av1/src/stream.rs | 181 +++++++++++++++++++++++++ 5 files changed, 259 insertions(+), 37 deletions(-) diff --git a/crates/ec-av1/src/cdf.rs b/crates/ec-av1/src/cdf.rs index 7c690293..5b9192e5 100644 --- a/crates/ec-av1/src/cdf.rs +++ b/crates/ec-av1/src/cdf.rs @@ -463,7 +463,14 @@ pub const CFL_SIGN: [u16; 9] = [1418, 2123, 13340, 18405, 26972, 28343, 32294, 3 /// the flag was never read at that size at all (libaom reads it for every /// DC_PRED block whose sides are both <= 32), so every DC_PRED 16x8 strip /// dropped one symbol and desynced the tile from that block on. -pub const FILTER_INTRA: [[u16; 3]; 8] = [ +/// `[8]`/`[9]` (lane-fi8 r1) add `BLOCK_4X8`/`BLOCK_8X4`'s own rows +/// (6743/5893, `default_filter_intra_cdfs` index 1/2) -- the sub-8 rect +/// leaves [`crate::decode`]'s `decode_leaf_rect8` codes. Both are inside +/// `av1_filter_intra_allowed_bsize`, so the flag is written for every DC_PRED +/// one of them; before this round that read took `BLOCK_4X4`'s row (class 0), +/// the same value with a different interval (class `wrong-alphabet-same-value` +/// / `cdf-row-held-constant`). +pub const FILTER_INTRA: [[u16; 3]; 10] = [ [4621, 32768, 0], [7866, 32768, 0], [12408, 32768, 0], @@ -472,6 +479,8 @@ pub const FILTER_INTRA: [[u16; 3]; 8] = [ [14301, 32768, 0], [9394, 32768, 0], [12551, 32768, 0], + [6743, 32768, 0], + [5893, 32768, 0], ]; /// `default_filter_intra_mode_cdf` (entropymode.c): which of the five /// `FILTER_INTRA_MODES` a `use_filter_intra` block picks. diff --git a/crates/ec-av1/src/cdf_state.rs b/crates/ec-av1/src/cdf_state.rs index 3f53b485..cd73ab1d 100644 --- a/crates/ec-av1/src/cdf_state.rs +++ b/crates/ec-av1/src/cdf_state.rs @@ -535,9 +535,9 @@ pub(crate) struct Cdfs { pub dv_comp: [MvComponentCdfs; 2], /// The `use_filter_intra` flag, indexed by block-size class (`[0]`=4x4, /// `[1]`=8x8, `[2]`=16x16, `[3]`=32x32, `[4]`=32x16, `[5]`=16x32, - /// `[6]`=16x8, `[7]`=8x16) -- + /// `[6]`=16x8, `[7]`=8x16, `[8]`=4x8, `[9]`=8x4) -- /// see [`cdf::FILTER_INTRA`]. - pub filter_intra: [[u16; 3]; 8], + pub filter_intra: [[u16; 3]; 10], /// Which `FILTER_INTRA_MODES` entry a `use_filter_intra` block picks. pub filter_intra_mode: [u16; 6], /// `TxMode::Select`'s `tx_depth` flag at an 8x8 block, by `tx_size_context` diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 59be1127..ca660d7f 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -886,6 +886,19 @@ pub(crate) fn filter_intra_rect_sub16_hits() -> usize { FILTER_INTRA_RECT_SUB16_HITS.with(|c| c.get()) } +// As [`FILTER_INTRA_RECT_SUB16_HITS`], one partition level further down: +// 4x8/8x4 leaves of an 8x8 HORZ/VERT (lane-fi8 r1). A gate on the sub16 +// counter would be satisfied by a 16x8 strip and prove nothing here. +thread_local! { + static FILTER_INTRA_RECT_SUB8_HITS: std::cell::Cell = + const { std::cell::Cell::new(0) }; +} + +/// Current value of [`FILTER_INTRA_RECT_SUB8_HITS`]. +pub(crate) fn filter_intra_rect_sub8_hits() -> usize { + FILTER_INTRA_RECT_SUB8_HITS.with(|c| c.get()) +} + // How many [`read_coeffs`] reads resolved a `tx_type` outside `TX_CLASS_2D` // (`V_DCT`/`H_DCT`, spec 5.11.39's `TxClass::Horiz`/`Vert`), across every // call on the current thread -- the same before/after counter pattern as @@ -3949,6 +3962,15 @@ impl Neighbours { /// offered (`cfl`, `is_cfl_allowed`, spec 5.11.5), chroma-from-luma -- the /// third element carries that mode's `(alpha_q3_u, alpha_q3_v)`, `None` for /// plain DC chroma. +/// spec 5.11.47 / libaom `av1_read_tx_type`'s `fimode_to_intradir`: which +/// `intra_ext_tx_cdf` row a luma transform reads. A filter-intra block's +/// `mode` is always `DC_PRED`, so the row comes from the FILTER-INTRA mode +/// instead (the defect commit 1a89ed9 fixed at the square sites). +fn fi_tx_row(mode: usize, filter_intra: Option) -> usize { + const FIMODE_TO_INTRADIR: [usize; 5] = [DC_PRED, V_PRED, H_PRED, D157_PRED, DC_PRED]; + filter_intra.map_or(mode, |fi| FIMODE_TO_INTRADIR[fi]) +} + /// A block-size class index into [`cdf::FILTER_INTRA`]/`Cdfs::filter_intra`, /// or `None` when `side` is past `av1_filter_intra_allowed_bsize`'s <=32 /// bound (spec `filter_intra_mode_info` never reads a symbol there). @@ -3977,6 +3999,11 @@ fn filter_intra_size_class_rect(bw: usize, bh: usize) -> Option { // identical mode/uv_mode values, range 34808 vs the oracle's 40668). (16, 8) => Some(6), (8, 16) => Some(7), + // lane-fi8 r1: the sub-8 rect leaves are allowed too (both sides <= + // 32), and `decode_leaf_rect8` codes them -- rows 1/2 of + // `default_filter_intra_cdfs`, NOT BLOCK_4X4's row 0. + (4, 8) => Some(8), + (8, 4) => Some(9), _ if bw == bh => filter_intra_size_class(bw), _ => None, } @@ -4964,7 +4991,7 @@ fn decode_block_rect( // decoder consumed one that was never there. { let around = neighbours.around_rect(at, bw, bh); - let mut luma_coding = cdfs.txb(TxbSet::LumaRect32x16, mode); + let mut luma_coding = cdfs.txb(TxbSet::LumaRect32x16, fi_tx_row(mode, filter_intra)); let (luma_levels, luma_tx_type) = read_coeffs_rect( dec, &mut luma_coding, @@ -5245,7 +5272,7 @@ fn decode_leaf_rect( } else { TxbSet::LumaRect16x8Set1 }; - let mut luma_coding = cdfs.txb(luma_set, mode); + let mut luma_coding = cdfs.txb(luma_set, fi_tx_row(mode, filter_intra)); let (l_levels, luma_tx_type) = read_coeffs_rect( dec, &mut luma_coding, luma_scan, bw, bh, 0, dc_sign_ctx(around[0].2), TxType::DctDct, )?; @@ -6745,12 +6772,7 @@ fn read_plane( // filter-intra is on) -- caller passes the raw filter-intra mode 0..4 in // `filter_intra`, only meaningful for `plane_idx == 0` (chroma has no // filter-intra in AV1). - const FIMODE_TO_INTRADIR: [usize; 5] = [DC_PRED, V_PRED, H_PRED, D157_PRED, DC_PRED]; - let tx_mode = if plane_idx == 0 { - filter_intra.map_or(tx_mode, |fi| FIMODE_TO_INTRADIR[fi]) - } else { - tx_mode - }; + let tx_mode = if plane_idx == 0 { fi_tx_row(tx_mode, filter_intra) } else { tx_mode }; let mut coding = cdfs.txb(set, tx_mode); // Luma's `default_tx_type` is only a fallback for the sizes whose // `TxbSet` carries no symbol at all (32-point and up), which the spec @@ -7661,6 +7683,11 @@ fn read_intra_mode_sub8( left_mode: usize, has_chroma: bool, enable_filter_intra: bool, + // [`filter_intra_size_class_rect`] for the LEAF's own shape: 0 for a + // `BLOCK_4X4` split leaf, 8/9 for a 4x8/8x4 rect leaf. Reading the flag + // from the wrong row is the same VALUE with a different interval, so it + // desyncs a block or two later, not here (class `wrong-alphabet-same-value`). + fi_class: usize, skip_ctx: usize, allow_intrabc: bool, mi_r: usize, @@ -7718,9 +7745,7 @@ fn read_intra_mode_sub8( }; let mut filter_intra = None; if mode == DC_PRED && enable_filter_intra { - // `BLOCK_4X4`'s own row (class 0, `filter_intra_size_class(4)`) -- - // every sub-8x8 leaf here is a `BLOCK_4X4`. - let use_filter_intra = dec.symbol(&mut cdfs.filter_intra[0]) != 0; + let use_filter_intra = dec.symbol(&mut cdfs.filter_intra[fi_class]) != 0; if trace { eprintln!("TRACE sub8 use_filter_intra value={}", use_filter_intra as i32); } @@ -7800,8 +7825,9 @@ fn decode_leaf_split4( let has_chroma = i == 3; let skip_ctx = neighbours.skip_txfm_ctx(lmi.0, lmi.1); let (skip, mode, angle_delta_y, chroma, filter_intra) = read_intra_mode_sub8( - dec, cdfs, leaf_above, leaf_left, has_chroma, enable_filter_intra, skip_ctx, - allow_intrabc, lmi.0, lmi.1, + dec, cdfs, leaf_above, leaf_left, has_chroma, enable_filter_intra, + filter_intra_size_class(4).expect("BLOCK_4X4 has its own filter_intra row"), + skip_ctx, allow_intrabc, lmi.0, lmi.1, )?; leaf_modes[i] = mode; leaf_skips[i] = skip; @@ -7942,9 +7968,12 @@ fn decode_leaf_split4( /// = `{31, 30}` (width 4 above, height 8 left), not the `{31, 31}` a /// `BLOCK_4X4` split writes. /// -/// Filter intra on one of these leaves is refused by name: `predict_filter_intra` -/// is square-only in this decoder (the same refusal the 16x16-level rect -/// strips already carry). +/// Filter intra on one of these leaves is decoded (lane-fi8 r1): the flag is +/// read from `BLOCK_4X8`/`BLOCK_8X4`'s own `cdf::FILTER_INTRA` row (classes +/// 8/9, NOT `BLOCK_4X4`'s), the predictor is [`crate::intra::predict_filter_intra`] +/// over the leaf's true `bw`x`bh` -- per 4x4 transform unit, with that unit's +/// own edge, when `tx_depth` splits it -- and the coded `tx_type` row is +/// [`fi_tx_row`]'s `fimode_to_intradir`, not the block's raw `DC_PRED`. #[allow(clippy::too_many_arguments)] fn decode_leaf_rect8( dec: &mut SymbolDecoder, @@ -7994,13 +8023,19 @@ fn decode_leaf_rect8( let has_chroma = i == 1; let skip_ctx = neighbours.skip_txfm_ctx(lmi.0, lmi.1); let (skip, mode, angle_delta_y, chroma, filter_intra) = read_intra_mode_sub8( - dec, cdfs, leaf_above, leaf_left, has_chroma, enable_filter_intra, skip_ctx, - allow_intrabc, lmi.0, lmi.1, + dec, cdfs, leaf_above, leaf_left, has_chroma, enable_filter_intra, + filter_intra_size_class_rect(bw, bh) + .expect("BLOCK_4X8/BLOCK_8X4 are inside av1_filter_intra_allowed_bsize"), + skip_ctx, allow_intrabc, lmi.0, lmi.1, )?; if filter_intra.is_some() { - return Err(unsupported( - "filter intra on a HORZ/VERT strip (this decoder predicts square-only)", - )); + // lane-fi8 r1: `predict_filter_intra` walks its 4x2 patches over + // a true `bw`x`bh` block, so a 4x8/8x4 leaf predicts through the + // same `reconstruct_rect`/`reconstruct` calls below -- and under + // a split transform, per 4x4 unit with that unit's own edge, + // which is exactly what the depth-1 loop already does. + FILTER_INTRA_RECT_HITS.with(|c| c.set(c.get() + 1)); + FILTER_INTRA_RECT_SUB8_HITS.with(|c| c.set(c.get() + 1)); } // `TxMode::Select`'s `tx_depth` (spec 5.11.16) exists at a 4x8/8x4 // leaf too, and is read for every intra block, skipped or not. Its @@ -8057,8 +8092,8 @@ fn decode_leaf_rect8( // prediction of the same mode produces. let zeros = vec![0i32; 16]; y.reconstruct( - tu_px, tu_py, 4, mode, angle_delta_y, tu_reach, &zeros, None, None, - smooth_neighbor, + tu_px, tu_py, 4, mode, angle_delta_y, tu_reach, &zeros, None, + filter_intra, smooth_neighbor, ); neighbours.record_mi_luma(tu_mi, 4, &zeros); continue; @@ -8085,7 +8120,7 @@ fn decode_leaf_rect8( TX4, base_q_idx, None, - None, + filter_intra, Some(tu_skip_ctx), smooth_neighbor, )?; @@ -8111,7 +8146,8 @@ fn decode_leaf_rect8( let grid = if skip { let zeros = vec![0i32; bw * bh]; y.reconstruct_rect( - px, py, bw, bh, mode, angle_delta_y, reach, &zeros, None, None, smooth_neighbor, + px, py, bw, bh, mode, angle_delta_y, reach, &zeros, None, filter_intra, + smooth_neighbor, ); zeros } else { @@ -8124,7 +8160,7 @@ fn decode_leaf_rect8( } else { TxbSet::LumaRect4x8Set1 }; - let mut coding = cdfs.txb(set, mode); + let mut coding = cdfs.txb(set, fi_tx_row(mode, filter_intra)); let (levels, tx_type) = read_coeffs_rect( dec, &mut coding, @@ -8153,7 +8189,8 @@ fn decode_leaf_rect8( tx_type, ); y.reconstruct_rect( - px, py, bw, bh, mode, angle_delta_y, reach, &residual, None, None, smooth_neighbor, + px, py, bw, bh, mode, angle_delta_y, reach, &residual, None, filter_intra, + smooth_neighbor, ); levels }; @@ -18293,15 +18330,13 @@ mod tests { // string that blocks the shape otherwise. Either way the row is // pinned HERE, so the round that lifts one of those refusals cannot // land a wrong CDF row for the shape it unlocks. - const BELOW_8X8: &str = - "a partition below 8x8 (this decoder codes no leaf smaller than 8x8)"; const PART16: &str = "a HORZ_A/HORZ_B/VERT_A partition below 16x16 (this decoder codes \ only the square arms, HORZ, VERT, VERT_B, and a clean split below 16x16)"; const PART32: &str = "a 32x32 partition type this decoder does not code (value={part32})"; let libaom: &[(usize, usize, u16, Option<&str>)] = &[ (4, 4, 4621, None), - (4, 8, 6743, Some(BELOW_8X8)), - (8, 4, 5893, Some(BELOW_8X8)), + (4, 8, 6743, None), + (8, 4, 5893, None), (8, 8, 7866, None), (8, 16, 12551, None), (16, 8, 9394, None), diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index 217d1ce4..c9a2aaf3 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -67,9 +67,6 @@ const REFUSALS: &[&str] = &[ "an inter partition below 16x16 other than SPLIT (16x8/8x16 rect inter leaves are not coded yet)", "an intra mode this decoder does not code (round 2)", "an intra-coded HORZ/VERT strip needs rectangular intra prediction this decoder does not code yet", - // Lifted for the 16x8/8x16 leaf by lane-fistrip; still live one level - // down, at the 4x8/8x4 sub-8 leaf (lane-tx4x8's `decode_leaf_rect8`). - "filter intra on a HORZ/VERT strip (this decoder predicts square-only)", "warp prediction with a scaled reference (superres, unimplemented)", "an 8x8 partition leaf under a scaled reference (superres, unimplemented)", ]; diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index d3a03c7a..8d7000ac 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -10871,6 +10871,187 @@ mod tests { } } + /// lane-fi8 r1: the sub8 rect-leaf gate above with the tool under test + /// turned ON (`--enable-filter-intra=1`, appended AFTER the base recipe + /// -- aomenc takes the FIRST occurrence of a repeated flag, so the base + /// recipe below carries no `--enable-filter-intra` at all). A DC_PRED + /// `BLOCK_4X8`/`BLOCK_8X4` leaf carries a `use_filter_intra` flag + /// (`av1_filter_intra_allowed_bsize` is "both sides <= 32"), which this + /// decoder read from `BLOCK_4X4`'s CDF row until this round -- the same + /// VALUE, a different interval, so it desynced a block or two later + /// ([[wrong-alphabet-same-value]]) -- and then refused the prediction by + /// name. Per attempt, only runs whose [`decode::filter_intra_rect_sub8_hits`] + /// delta is nonzero AND whose three planes match ffmpeg count; the wider + /// `filter_intra_rect_hits` would be satisfied by a 16x8 strip and prove + /// nothing about these shapes. Arms cover both transform depths + /// (`--enable-tx-size-search=1`, where a leaf may split into two 4x4 + /// units each predicted from the previous one's reconstruction, and `=0`, + /// one whole-leaf transform) and both bit depths. + #[test] + fn a_real_aomenc_stream_with_filter_intra_on_a_sub8_rect_leaf_decodes_pixel_exact() { + const NAME: &str = + "a_real_aomenc_stream_with_filter_intra_on_a_sub8_rect_leaf_decodes_pixel_exact"; + if !have_ffmpeg() { + eprintln!("SKIP {NAME}: no ffmpeg"); + return; + } + if !have_aomenc() { + let msg = format!("no aomenc at {}", aomenc_path().display()); + assert!( + std::env::var_os("EC_AV1_REQUIRE_AOMENC").is_none(), + "EC_AV1_REQUIRE_AOMENC is set but {msg}" + ); + eprintln!("SKIP {NAME}: {msg}"); + return; + } + let (width, height) = (16usize, 16usize); + for (tx_search, bit_depth) in [("1", 8u8), ("0", 8u8), ("1", 10u8)] { + let mut refusals = Vec::new(); + let mut fired_runs = 0u32; + let mut fi_leaves = 0usize; + let mut split_tx = 0usize; + for attempt in 0..80u32 { + let seed = 300 + attempt; + let cq = 6 + (attempt % 8) * 6; + let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" }; + let y4m = Command::new("ffmpeg") + .args([ + "-v", "error", "-f", "lavfi", "-i", + &format!("testsrc2=size={width}x{height}:rate=25"), + "-vf", + &format!("noise=alls=40:allf=t:all_seed={seed},format={pix_fmt}"), + "-strict", "-1", "-t", "0.04", "-f", "yuv4mpegpipe", "-", + ]) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .output() + .expect("ffmpeg failed to run"); + assert!( + y4m.status.success(), + "ffmpeg fixture: {}", + String::from_utf8_lossy(&y4m.stderr) + ); + let mut child = Command::new(aomenc_path()) + .args([ + "--codec=av1", + "--passes=1", + "--end-usage=q", + &format!("--cq-level={cq}"), + "--cpu-used=0", + "--threads=1", + "--row-mt=0", + "--sb-size=64", + "--min-partition-size=4", + "--max-partition-size=8", + "--enable-rect-partitions=1", + "--enable-ab-partitions=0", + "--enable-1to4-partitions=0", + "--enable-palette=0", + "--enable-intrabc=0", + "--enable-restoration=0", + "--enable-cdef=0", + "--loopfilter-control=0", + "--enable-ref-frame-mvs=0", + // The tools under test, first occurrence in the + // command line (aomenc keeps the first). + "--enable-filter-intra=1", + &format!("--enable-tx-size-search={tx_search}"), + "--limit=1", + "--obu", + "-o", + "-", + "-", + ]) + .args(if bit_depth == 10 { + &["--input-bit-depth=10", "--bit-depth=10"][..] + } else { + &[][..] + }) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + child + .stdin + .take() + .expect("aomenc stdin") + .write_all(&y4m.stdout) + .expect("writing y4m to aomenc"); + let out = child.wait_with_output().expect("aomenc failed to run"); + if !out.status.success() { + refusals.push(format!("seed={seed} cq={cq}: aomenc itself refused")); + continue; + } + let stream = out.stdout; + let fi_before = decode::filter_intra_rect_sub8_hits(); + let split_before = decode::rect8_split_tx_hits(); + let frames = match decode_stream(&stream) { + Ok(frames) => frames, + Err(e) => { + let msg = e.to_string(); + assert!( + msg.starts_with("unsupported: "), + "decode error that is not a named refusal \ + (seed={seed} cq={cq} depth={bit_depth} txs={tx_search}): {msg}" + ); + refusals.push(format!("seed={seed} cq={cq}: {msg}")); + continue; + } + }; + let fi = decode::filter_intra_rect_sub8_hits() - fi_before; + if fi == 0 { + refusals.push(format!( + "seed={seed} cq={cq}: decoded, but no 4x8/8x4 leaf used filter intra" + )); + continue; + } + let ffmpeg_frames = if bit_depth == 10 { + ffmpeg_decode_sequence_10bit(&stream, width, height, 1) + } else { + ffmpeg_decode_sequence(&stream, width, height, 1) + }; + assert_eq!( + frames[0].y, ffmpeg_frames[0].y, + "luma vs ffmpeg (seed={seed} cq={cq} depth={bit_depth} txs={tx_search})" + ); + assert_eq!( + frames[0].u, ffmpeg_frames[0].u, + "U vs ffmpeg (seed={seed} cq={cq} depth={bit_depth} txs={tx_search})" + ); + assert_eq!( + frames[0].v, ffmpeg_frames[0].v, + "V vs ffmpeg (seed={seed} cq={cq} depth={bit_depth} txs={tx_search})" + ); + fired_runs += 1; + fi_leaves += fi; + split_tx += decode::rect8_split_tx_hits() - split_before; + if fired_runs >= 3 { + break; + } + } + assert!( + fired_runs >= 3, + "{NAME}: fewer than 3 firing+pixel-exact runs out of 80 attempts \ + (depth={bit_depth} txs={tx_search}), {fi_leaves} filter-intra sub8 leaves \ + seen:\n{}", + refusals.join("\n") + ); + if tx_search == "1" { + assert!( + split_tx > 0, + "{NAME}: no sub-8x8 rect leaf used a split (depth-1) transform in the \ + {fired_runs} pixel-exact runs (depth={bit_depth})" + ); + } + eprintln!( + "{NAME}: depth={bit_depth} txs={tx_search} {fired_runs} pixel-exact runs, \ + {fi_leaves} filter-intra 4x8/8x4 leaves, split_tx={split_tx}" + ); + } + } + /// lane-tx4x8 r3 ([[enumerate-table-domain]], [[tool-disabled-in-every-gate]]): /// a 16x8/8x16 intra strip whose DIRECTIONAL mode reads above-right or /// below-left samples. Which of those the decoder may read is