diff --git a/crates/ec-av1/fixtures/filter_intra_8x16_strip_seed49.obu b/crates/ec-av1/fixtures/filter_intra_8x16_strip_seed49.obu new file mode 100644 index 0000000000000000000000000000000000000000..59a823ff271b21a1b17e4b2445392e9a8cb4933e GIT binary patch literal 95 zcmV-l0HFU80165K000BE|MUOk0Wwbz0E~bLAp!{*GPGX31J6G&jxuz3vqaU)o~rvf zM_cyp8G0ckX)Zf{f48&)&n~~BbRBI?$@t-Whf9U0M BDenLP literal 0 HcmV?d00001 diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 897b1831..59be1127 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -871,6 +871,21 @@ pub(crate) fn filter_intra_rect_hits() -> usize { FILTER_INTRA_RECT_HITS.with(|c| c.get()) } +// As [`FILTER_INTRA_RECT_HITS`], counting only the strips BELOW 16x16 +// (8x16/16x8 leaves of a 16x16 HORZ/VERT partition, lane-fistrip r1) -- the +// shapes whose `use_filter_intra` symbol had no CDF class before this round. +// A gate asserting the wider counter would be satisfied by a 32x16 strip and +// prove nothing about the new shapes. +thread_local! { + static FILTER_INTRA_RECT_SUB16_HITS: std::cell::Cell = + const { std::cell::Cell::new(0) }; +} + +/// Current value of [`FILTER_INTRA_RECT_SUB16_HITS`]. +pub(crate) fn filter_intra_rect_sub16_hits() -> usize { + FILTER_INTRA_RECT_SUB16_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 @@ -5170,9 +5185,12 @@ fn decode_leaf_rect( eprintln!(" skip={skip} mode={mode} angle_delta_y={angle_delta_y} uv_mode={uv_mode}"); } if filter_intra.is_some() { - return Err(unsupported( - "filter intra on a HORZ/VERT strip (this decoder predicts square-only)", - )); + // lane-fistrip r1: `predict_filter_intra` already walks its 4x2 + // patches over a true `bw`x`bh` block (lane-rectsplit r1), so an + // 8x16/16x8 strip predicts through the same call `reconstruct_rect` + // below already makes; this refusal was square-only prose. + FILTER_INTRA_RECT_HITS.with(|c| c.set(c.get() + 1)); + FILTER_INTRA_RECT_SUB16_HITS.with(|c| c.set(c.get() + 1)); } let uv_predict_mode = if uv_mode == UV_CFL_PRED { DC_PRED } else { uv_mode }; let depth = if tx_select { @@ -18251,6 +18269,109 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( #[cfg(test)] mod tests { + + /// lane-fistrip r1 (class `enumerate-the-table-domain`): every block + /// shape this decoder can hand [`filter_intra_size_class_rect`], against + /// `av1_filter_intra_allowed_bsize` (`block_size_wide <= 32 && + /// block_size_high <= 32`) and `default_filter_intra_cdfs` + /// (entropymode.c) row by row. A class that exists must carry ITS OWN + /// bsize's default probability -- a wrong row is a silently different + /// symbol, not a decode error. The shapes with no class are listed here + /// with their reason so the residue is pinned rather than implied. + #[test] + fn filter_intra_classes_carry_their_own_libaom_default_row() { + // `default_filter_intra_cdfs[bsize]`, BLOCK_SIZES_ALL order, as + // (width, height, default, refused_by) for the shapes <= 32 on both + // axes. The first three fields are GENERATED from the oracle by + // `scripts/extract-filter-intra-cdfs.py` (it reads BLOCK_SIZES_ALL's + // order from enums.h and the table from entropymode.c, so no hand + // transcription can drift -- lane-fistrip r1 listed the four 1:4 + // shapes as 16384 out of exactly that kind of guess; their real rows + // are 12770/10368/20229/18101). `refused_by` is `None` for a shape + // this decoder's partition tree reaches today -- it must own a class, + // and that class must carry exactly this row -- and the refusal + // 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)), + (8, 8, 7866, None), + (8, 16, 12551, None), + (16, 8, 9394, None), + (16, 16, 12408, None), + (16, 32, 14301, None), + (32, 16, 12756, None), + (32, 32, 22343, None), + // The 1:4 strips: a 16x16-level PARTITION_HORZ_4/VERT_4 gives + // 4x16/16x4, a 32x32-level one 8x32/32x8, and both partition + // values refuse by name before any leaf is coded. + (4, 16, 12770, Some(PART16)), + (16, 4, 10368, Some(PART16)), + (8, 32, 20229, Some(PART32)), + (32, 8, 18101, Some(PART32)), + ]; + let mut classes_seen = std::collections::BTreeSet::new(); + for &(bw, bh, default, refused_by) in libaom { + match filter_intra_size_class_rect(bw, bh) { + Some(class) => { + assert!( + refused_by.is_none(), + "{bw}x{bh} has a CDF class but is listed as refused by {refused_by:?} -- \ + one of the two is stale" + ); + assert_eq!( + crate::cdf::FILTER_INTRA[class][0], + default, + "{bw}x{bh} (class {class}) must carry default_filter_intra_cdfs' own row" + ); + assert_eq!( + &crate::cdf::FILTER_INTRA[class][1..], + &[32768u16, 0][..], + "{bw}x{bh} (class {class}) is a 2-symbol CDF: {{p, 32768, count}}" + ); + assert!( + classes_seen.insert(class), + "class {class} is claimed by two shapes -- one of them reads the other's \ + probability" + ); + } + None => { + let why = refused_by.unwrap_or_else(|| { + panic!( + "{bw}x{bh} is inside av1_filter_intra_allowed_bsize and reachable, \ + but has no CDF class -- its use_filter_intra symbol is never read" + ) + }); + assert!(!why.is_empty(), "{bw}x{bh}'s refusal string must name the blocker"); + } + } + } + // The other direction: every row of `cdf::FILTER_INTRA` was claimed + // by exactly one shape above, so no row can be left over (or shared) + // once a class is added or removed. + assert_eq!( + classes_seen.len(), + crate::cdf::FILTER_INTRA.len(), + "cdf::FILTER_INTRA has {} rows but only {:?} are claimed by an allowed shape", + crate::cdf::FILTER_INTRA.len(), + classes_seen + ); + // Past the bound on either axis: no symbol at all (spec + // `filter_intra_mode_info` never reads one). + for (bw, bh) in [(64, 64), (64, 32), (32, 64)] { + assert!( + filter_intra_size_class_rect(bw, bh).is_none(), + "{bw}x{bh} is past av1_filter_intra_allowed_bsize's <=32 bound" + ); + } + } use super::*; /// lane-tx64x16 r3: the two new 4:1 chroma scans are a TRANSPOSED PAIR -- diff --git a/crates/ec-av1/src/intra.rs b/crates/ec-av1/src/intra.rs index 03c5809d..13e5c218 100644 --- a/crates/ec-av1/src/intra.rs +++ b/crates/ec-av1/src/intra.rs @@ -865,6 +865,198 @@ mod tests { .sum() } + /// libaom `av1_filter_intra_taps` (reconintra.c:807-858), transcribed + /// here INDEPENDENTLY of [`FILTER_INTRA_TAPS`] -- the point of the test + /// below is that two transcriptions of the reference agree, so it must + /// not read the table it is checking. (libaom's rows are 8 wide with the + /// 8th tap always 0; only seven are used.) + const LIBAOM_FILTER_INTRA_TAPS: [[[i32; 7]; 8]; 5] = [ + [ + [-6, 10, 0, 0, 0, 12, 0], + [-5, 2, 10, 0, 0, 9, 0], + [-3, 1, 1, 10, 0, 7, 0], + [-3, 1, 1, 2, 10, 5, 0], + [-4, 6, 0, 0, 0, 2, 12], + [-3, 2, 6, 0, 0, 2, 9], + [-3, 2, 2, 6, 0, 2, 7], + [-3, 1, 2, 2, 6, 3, 5], + ], + [ + [-10, 16, 0, 0, 0, 10, 0], + [-6, 0, 16, 0, 0, 6, 0], + [-4, 0, 0, 16, 0, 4, 0], + [-2, 0, 0, 0, 16, 2, 0], + [-10, 16, 0, 0, 0, 0, 10], + [-6, 0, 16, 0, 0, 0, 6], + [-4, 0, 0, 16, 0, 0, 4], + [-2, 0, 0, 0, 16, 0, 2], + ], + [ + [-8, 8, 0, 0, 0, 16, 0], + [-8, 0, 8, 0, 0, 16, 0], + [-8, 0, 0, 8, 0, 16, 0], + [-8, 0, 0, 0, 8, 16, 0], + [-4, 4, 0, 0, 0, 0, 16], + [-4, 0, 4, 0, 0, 0, 16], + [-4, 0, 0, 4, 0, 0, 16], + [-4, 0, 0, 0, 4, 0, 16], + ], + [ + [-2, 8, 0, 0, 0, 10, 0], + [-1, 3, 8, 0, 0, 6, 0], + [-1, 2, 3, 8, 0, 4, 0], + [0, 1, 2, 3, 8, 2, 0], + [-1, 4, 0, 0, 0, 3, 10], + [-1, 3, 4, 0, 0, 4, 6], + [-1, 2, 3, 4, 0, 4, 4], + [-1, 2, 2, 3, 4, 3, 3], + ], + [ + [-12, 14, 0, 0, 0, 14, 0], + [-10, 0, 14, 0, 0, 12, 0], + [-9, 0, 0, 14, 0, 11, 0], + [-8, 0, 0, 0, 14, 10, 0], + [-10, 12, 0, 0, 0, 0, 14], + [-9, 1, 12, 0, 0, 0, 12], + [-8, 0, 0, 12, 0, 1, 11], + [-7, 0, 0, 1, 12, 1, 9], + ], + ]; + + /// A straight port of `av1_filter_intra_predictor_c` / + /// `highbd_filter_intra_predictor` (reconintra.c:860-905 / 908-955 -- + /// identical except for the clip), written from the C rather than from + /// [`predict_filter_intra`]. `above` is the C `&above[-1]`, i.e. the + /// corner followed by `bw` samples; `left` is `bh` samples. + fn libaom_filter_intra_predictor( + dst: &mut [u16], + bw: usize, + bh: usize, + above: &[u16], + left: &[u16], + mode: usize, + bd: u32, + ) { + assert!(bw <= 32 && bh <= 32); + let mut buffer = [[0i32; 33]; 33]; + for r in 0..bh { + buffer[r + 1][0] = i32::from(left[r]); + } + for c in 0..bw + 1 { + buffer[0][c] = i32::from(above[c]); + } + let max = (1i32 << bd) - 1; + let mut r = 1; + while r < bh + 1 { + let mut c = 1; + while c < bw + 1 { + let p = [ + buffer[r - 1][c - 1], + buffer[r - 1][c], + buffer[r - 1][c + 1], + buffer[r - 1][c + 2], + buffer[r - 1][c + 3], + buffer[r][c - 1], + buffer[r + 1][c - 1], + ]; + for k in 0..8 { + let mut pr = 0i32; + for t in 0..7 { + pr += LIBAOM_FILTER_INTRA_TAPS[mode][k][t] * p[t]; + } + // ROUND_POWER_OF_TWO(pr, 4) then clip_pixel[_highbd]. + let v = ((pr + 8) >> 4).clamp(0, max); + buffer[r + (k >> 2)][c + (k & 3)] = v; + } + c += 4; + } + r += 2; + } + for row in 0..bh { + for col in 0..bw { + dst[row * bw + col] = buffer[row + 1][col + 1] as u16; + } + } + } + + /// lane-fistrip r2: [`predict_filter_intra`] had NO unit test at all -- + /// the 8x16/16x8 strips r1 unblocked read their `use_filter_intra` flag + /// with zero pixel evidence behind it (every firing strip is `skip=0` + /// and refuses, see `stream.rs`'s ignored gate). This compares it + /// bit-exact against the independent C port above for every filter-intra + /// mode, every shape `av1_filter_intra_allowed_bsize` allows (both sides + /// <= 32, squares and both orientations of 1:2 and 1:4), 8- and 10-bit, + /// on three seeded random edges. + #[test] + fn filter_intra_matches_the_libaom_predictor_for_every_mode_and_shape() { + // xorshift64*: a seeded stream, so a failure names one (shape, mode, + // seed) triple that reproduces. + let mut rng = |state: &mut u64| { + *state ^= *state << 13; + *state ^= *state >> 7; + *state ^= *state << 17; + *state + }; + let shapes = [ + (4usize, 4usize), + (8, 8), + (16, 16), + (32, 32), + (4, 8), + (8, 4), + (8, 16), + (16, 8), + (16, 32), + (32, 16), + (4, 16), + (16, 4), + (8, 32), + (32, 8), + ]; + let mut compared = 0u32; + for bd in [8u32, 10] { + crate::decode::set_bit_depth(bd as u8); + let max = (1u32 << bd) - 1; + for &(bw, bh) in &shapes { + for mode in 0..5usize { + for seed in [1u64, 0x5eed_5eed, 0xdead_beef_cafe] { + let mut state = seed + .wrapping_mul(0x9E37_79B9_7F4A_7C15) + .wrapping_add((bw * 97 + bh * 7 + mode) as u64) + | 1; + let sample = |state: &mut u64| (rng(state) % u64::from(max + 1)) as u16; + let corner = sample(&mut state); + let above: Vec = (0..bw).map(|_| sample(&mut state)).collect(); + let left: Vec = (0..bh).map(|_| sample(&mut state)).collect(); + let mut want = vec![0u16; bw * bh]; + let mut c_above = vec![corner]; + c_above.extend_from_slice(&above); + libaom_filter_intra_predictor( + &mut want, bw, bh, &c_above, &left, mode, bd, + ); + let mut got = vec![0u16; bw * bh]; + predict_filter_intra( + mode, + Some(&above), + Some(&left), + Some(corner), + bw, + bh, + &mut got, + ); + assert_eq!( + got, want, + "filter intra mode {mode}, {bw}x{bh}, {bd}-bit, seed {seed:#x}" + ); + compared += 1; + } + } + } + } + crate::decode::set_bit_depth(8); + assert_eq!(compared, 2 * 14 * 5 * 3, "every shape/mode/seed was compared"); + } + /// lane-intrarect r1: checksum-verify DC/SMOOTH/PAETH and a directional /// sweep across all three zones, `enable_edge_filter`/`smooth_neighbor` /// on and off, for eight rect shapes (both 1:2 and 1:4, both diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index edf63b19..217d1ce4 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -67,6 +67,8 @@ 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 1257cef2..d3a03c7a 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -9172,7 +9172,16 @@ mod tests { let mut other_refusals = Vec::new(); for attempt in 0..n_attempts { let seed = 42 + attempt; - let source = gradients_source(seed, width, height, "duration=0.04:rate=25"); + // Diagnosis knob: which content makes RD pick an 8x16/16x8 strip + // AND filter intra on it is a search (see lanes/fistrip-r1.report.md). + let source = match std::env::var("EC_FISTRIP_SRC").unwrap_or_default().as_str() { + "bars" => format!("smptebars=size={width}x{height}:duration=0.04:rate=25"), + "src2" => format!("testsrc2=size={width}x{height}:duration=0.04:rate=25"), + "noise" => format!( + "nullsrc=size={width}x{height}:duration=0.04:rate=25,geq=random(1)*255:128:128" + ), + _ => gradients_source(seed, width, height, "duration=0.04:rate=25"), + }; let y4m = Command::new("ffmpeg") .args(["-v", "error", "-f", "lavfi", "-i"]) .arg(&source) @@ -14147,6 +14156,327 @@ mod tests { ); } + /// lane-fistrip r1, the 10-bit arm of the strip gate (his films are + /// yuv420p10le). Same ceiling as its 8-bit twin -- kept `#[ignore]`d + /// with the measurement rather than weakened: MEASURED over seeds + /// 42..61 the 8x16/16x8 strips aomenc writes filter intra on are + /// `skip=0`, which `decode_leaf_rect` refuses, so + /// `filter_intra_rect_sub16_hits` never reaches a pixel compare. + /// lane-fistrip r2 adds seeds 49 and 213 to the window: those are the two + /// seeds measured to fire the feature on the 8-BIT twin's recipe (this + /// arm's 10-bit encode is a different stream, so they are a widening, not + /// a measured firing set for this recipe -- the round that un-ignores + /// this gate must re-measure which 10-bit seeds fire it). + #[ignore = "2026-09-02, re-measured on the merged tree: the coded-strip refusal is lifted, but every firing 10-bit seed now stops at the sub16 SPLIT-TRANSFORM refusal (49, 55) or palette-in-screen-content (45, 46); 16 attempts decode pixel-exact with 0 hits, so the gate would prove nothing"] + #[test] + fn a_real_aomenc_10bit_filter_intra_on_a_sub16_strip_decodes_pixel_exact() { + const NAME: &str = "a_real_aomenc_10bit_filter_intra_on_a_sub16_strip_decodes_pixel_exact"; + let _gate_lock = lock_gate_counters(); + if !have_ffmpeg() { + eprintln!("SKIP {NAME}: no ffmpeg"); + return; + } + if !have_aomenc() { + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); + return; + } + let mut seeds: Vec = (42..62).collect(); + seeds.push(213); + ten_bit_tool_gate( + NAME, + 192, + 128, + 1, + &[ + "--limit=1", + "--cq-level=25", + "--cpu-used=0", + "--threads=1", + "--row-mt=0", + "--sb-size=64", + "--enable-rect-partitions=1", + "--enable-ab-partitions=0", + "--enable-1to4-partitions=0", + "--min-partition-size=8", + "--max-partition-size=32", + "--enable-restoration=0", + "--enable-palette=0", + "--deltaq-mode=0", + "--enable-filter-intra=1", + "--enable-cfl-intra=0", + "--enable-intrabc=0", + ], + &seeds, + &[( + "filter_intra_rect_sub16_hits", + crate::decode::filter_intra_rect_sub16_hits as fn() -> usize, + )], + ); + } + + /// lane-fistrip r1, the pinned half of this lane's proof: one real + /// `aomenc` stream (recipe below, byte-reproducible -- md5 + /// ac3a64773e5454ee9b5d8650507063cd, hashed twice) whose key frame + /// carries four `BLOCK_16X8` DC_PRED leaves, one of which sets + /// `use_filter_intra`. `av1_filter_intra_allowed_bsize` allows 16x8, so + /// aomenc writes that flag; before this round `filter_intra_size_class_rect` + /// had no row for the shape, the symbol was never read, and the tile + /// desynced ON THAT BLOCK -- observable as a DIFFERENT named refusal + /// ("a HORZ/VERT intra strip below 16x16 with a split transform", a + /// `tx_depth` read out of a desynced stream) instead of this one. + /// + /// The stream cannot be pixel-compared yet: the 16x8 strip that carries + /// the flag is `skip=0`, and a coded rect strip below 16x16 has no + /// residual path here (its own refusal, another lane's ceiling). What + /// this test pins is the SYMBOL: the flag is read, the counter fires + /// once, and the decode stops at the coded-strip ceiling rather than + /// wandering off a desynced stream. + /// + /// Fixture recipe (`crates/ec-av1/fixtures/filter_intra_8x16_strip_seed49.obu`): + /// `ffmpeg -f lavfi -i gradients=size=192x128:c0=0x986ae1:c1=0xd3e49a: + /// c2=0x0b1e53:c3=0x42980c:seed=49:duration=0.04:rate=25 -pix_fmt yuv420p` + /// into `aomenc --codec=av1 --passes=1 --end-usage=q --cq-level=25 + /// --cpu-used=0 --threads=1 --row-mt=0 --sb-size=64 + /// --enable-rect-partitions=1 --enable-ab-partitions=0 + /// --enable-1to4-partitions=0 --min-partition-size=8 + /// --max-partition-size=32 --enable-restoration=0 --enable-palette=0 + /// --deltaq-mode=0 --enable-filter-intra=1 --enable-cfl-intra=0 + /// --enable-intrabc=0 --obu`. + #[test] + fn a_pinned_aomenc_16x8_strip_reads_its_use_filter_intra_flag() { + const NAME: &str = "a_pinned_aomenc_16x8_strip_reads_its_use_filter_intra_flag"; + let _gate_lock = lock_gate_counters(); + let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) + .join("fixtures/filter_intra_8x16_strip_seed49.obu"); + let stream = std::fs::read(&path) + .unwrap_or_else(|e| panic!("{NAME}: reading {}: {e}", path.display())); + let before = crate::decode::filter_intra_rect_sub16_hits(); + let err = decode_stream(&stream).expect_err( + "{NAME}: this stream's 16x8 filter-intra strip is skip=0, which this decoder \ + still refuses -- a clean decode means the coded-strip ceiling moved and this \ + test should become a pixel compare", + ); + let hits = crate::decode::filter_intra_rect_sub16_hits() - before; + assert_eq!( + hits, 1, + "{NAME}: expected exactly one 16x8 strip to read use_filter_intra=1 (aomdec's own \ + EC_TRACE_MODE shows four BLOCK_16X8 DC_PRED leaves here); got {hits}" + ); + let msg = err.to_string(); + assert!( + // 2026-09-02, merging lane-fistrip onto a main that already carries + // lane-rectx: the coded-strip ceiling this fixture used to hit is + // gone, and the very next one on the SAME block is the split + // transform under a sub-16 strip (per-unit rect prediction is not + // ported). Still a refusal ON that block, still not a desync. + msg.contains("a HORZ/VERT intra strip below 16x16 with a split transform"), + "{NAME}: decode must reach the sub16 split-transform ceiling ON that block, not \ + wander off a desynced stream; got: {msg}" + ); + } + + /// lane-fistrip r1: the filter-intra strip gate above, one partition + /// level DOWN (`--min-partition-size=8`, so a 16x16 HORZ/VERT splits + /// into 8x16/16x8 leaves). `av1_filter_intra_allowed_bsize` is + /// `wide <= 32 && high <= 32`, which both of those satisfy, so aomenc + /// writes a `use_filter_intra` flag on every DC_PRED one of them -- + /// `filter_intra_size_class_rect` had no row for either shape and + /// [`crate::decode::read_intra_mode_rect`] therefore never READ that + /// symbol (class `symbol-consumption-gap`, a silent desync rather than + /// a refusal). Hard-asserts + /// [`crate::decode::filter_intra_rect_sub16_hits`], not the wider + /// `filter_intra_rect_hits`: a 32x16 strip firing filter intra would + /// satisfy that one and prove nothing about the new shapes. + /// MEASURED (lane-fistrip r1, seeds 42..=241; r2 re-ran 50..=241), which + /// is why it is `#[ignore]`d rather than green: over those 200 seeds at + /// cq 25 aomenc put filter intra on an 8x16/16x8 strip exactly TWICE -- + /// **seed 49 and seed 213** -- and both times that strip was `skip=0`, so + /// the attempt refused at the coded-rect-strip-below-16x16 ceiling before + /// any pixel compare (r1: 177 pixel-exact matches, 23 refusals, compared + /// sub16 delta 0, all-attempt delta 2; r2 seeds 50..=241: 172 matches, 20 + /// refusals, the one all-attempt hit at seed 213). BOTH firing seeds are + /// appended to this gate's seed window below, so the un-ignore compares + /// two real hits. Un-ignore this the round that ceiling lifts; the symbol + /// itself is pinned by + /// [`a_pinned_aomenc_16x8_strip_reads_its_use_filter_intra_flag`], whose + /// `expect_err` must become a pixel compare in that same round. + #[ignore = "2026-09-02, re-measured on the merged tree: 35 of 41 attempts decode pixel-exact with ZERO mismatches, but both firing seeds (49, 213) stop at the sub16 split-transform / HORZ_A-B refusals, so no filter-intra 8x16/16x8 strip is compared yet"] + #[test] + fn a_real_aomenc_stream_with_filter_intra_on_a_sub16_horz_vert_strip_decodes_pixel_exact() { + const NAME: &str = + "a_real_aomenc_stream_with_filter_intra_on_a_sub16_horz_vert_strip_decodes_pixel_exact"; + let _gate_lock = lock_gate_counters(); + if !have_ffmpeg() { + eprintln!("SKIP {NAME}: no ffmpeg"); + return; + } + if !have_aomenc() { + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); + return; + } + let (width, height) = (192usize, 128usize); + let mut named_refusals = 0u32; + let mut matched = 0u32; + let mut compared_hits = 0usize; + let n_attempts: u32 = std::env::var("EC_FISTRIP_GATE_ATTEMPTS") + .ok() + .and_then(|s| s.parse().ok()) + .unwrap_or(40); + // lane-fistrip r2: the two seeds that MEASURABLY fire filter intra on + // an 8x16/16x8 strip are 49 and 213 -- the only two in seeds 42..=241 + // (r1 measured 42..=241 and reported "all-attempt delta 2" with seed + // 49; r2 re-ran seeds 50..=241 and found the second, log + // `$HOME/.cache/fistrip-seedscan-r2.log`: "seed 213 refused with sub16 + // filter-intra delta 1"). Both are appended to whatever window + // `EC_FISTRIP_GATE_ATTEMPTS` asks for, so the un-ignore after the + // coded-rect-strip ceiling lifts compares TWO real hits instead of + // depending on the default window happening to contain one. + const FIRING_SEEDS: [u32; 2] = [49, 213]; + let mut seeds: Vec = (0..n_attempts).map(|a| 42 + a).collect(); + for s in FIRING_SEEDS { + if !seeds.contains(&s) { + seeds.push(s); + } + } + let cq = format!( + "--cq-level={}", + std::env::var("EC_FISTRIP_CQ").unwrap_or_else(|_| "25".into()) + ); + // Diagnosis: the counter over EVERY attempt, refused ones included -- + // a filter-intra 8x16 strip inside an attempt that later refused + // (non-skip, split transform) fires this but never reaches + // `compared_hits`, and the two numbers differing is what says the + // recipe reaches the feature but this decoder's other ceilings hide + // it. + let all_before = crate::decode::filter_intra_rect_sub16_hits(); + for &seed in &seeds { + let source = gradients_source(seed, width, height, "duration=0.04:rate=25"); + let y4m = Command::new("ffmpeg") + .args([ + "-v", "error", "-f", "lavfi", "-i", &source, "-pix_fmt", "yuv420p", "-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 args: Vec<&str> = vec![ + "--codec=av1", + "--passes=1", + "--end-usage=q", + &cq, + "--cpu-used=0", + "--threads=1", + "--row-mt=0", + "--sb-size=64", + "--enable-rect-partitions=1", + "--enable-ab-partitions=0", + "--enable-1to4-partitions=0", + // The point of this gate: one level below the 32x16/16x32 + // strips the sibling gate covers. + "--min-partition-size=8", + "--max-partition-size=32", + "--enable-restoration=0", + "--enable-palette=0", + "--deltaq-mode=0", + "--enable-filter-intra=1", + "--enable-cfl-intra=0", + "--enable-intrabc=0", + "--obu", + "-o", + "-", + "-", + ]; + // Diagnosis knob only (default: every intra mode on) -- the same + // subset search the 32x16/16x32 sibling gate carries. + let mut args = args; + let off = std::env::var("EC_FISTRIP_OFF").unwrap_or_default(); + for tool in off.split(',').filter(|t| !t.is_empty()) { + args.push(match tool { + "smooth" => "--enable-smooth-intra=0", + "paeth" => "--enable-paeth-intra=0", + "dir" => "--enable-directional-intra=0", + "angle" => "--enable-angle-delta=0", + other => panic!("unknown EC_FISTRIP_OFF entry {other}"), + }); + } + let mut child = Command::new(aomenc_path()) + .args(&args) + .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"); + assert!( + out.status.success(), + "aomenc refused the fixture: {}", + String::from_utf8_lossy(&out.stderr) + ); + let stream = out.stdout; + assert!(!stream.is_empty(), "{NAME}: aomenc wrote an empty stream (seed {seed})"); + let attempt_before = crate::decode::filter_intra_rect_sub16_hits(); + let frames = match decode_stream(&stream) { + Err(e) => { + let msg = e.to_string(); + assert!( + msg.contains("unsupported"), + "{NAME} failed outright, not a named refusal (seed {seed}): {msg}" + ); + // Diagnosis: a refused attempt that DID fire the feature + // says which other ceiling of this decoder hides it. + eprintln!( + "{NAME}: seed {seed} refused with sub16 filter-intra delta {}: {msg}", + crate::decode::filter_intra_rect_sub16_hits() - attempt_before + ); + named_refusals += 1; + continue; + } + Ok(frames) => frames, + }; + let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); + assert_eq!(frames.len(), 1, "{NAME}: expected one frame (seed {seed})"); + assert_eq!(frames[0].y, ffmpeg_frames[0].y, "{NAME}: luma vs ffmpeg (seed {seed})"); + assert_eq!(frames[0].u, ffmpeg_frames[0].u, "{NAME}: U vs ffmpeg (seed {seed})"); + assert_eq!(frames[0].v, ffmpeg_frames[0].v, "{NAME}: V vs ffmpeg (seed {seed})"); + compared_hits += crate::decode::filter_intra_rect_sub16_hits() - attempt_before; + matched += 1; + } + eprintln!( + "{NAME}: filter_intra_rect_sub16_hits over ALL attempts (refused included) = {}", + crate::decode::filter_intra_rect_sub16_hits() - all_before + ); + assert!( + matched > 0, + "{NAME}: every attempt refused ({named_refusals} named refusals) -- gate decoded nothing" + ); + assert!( + compared_hits > 0, + "{NAME}: no 8x16/16x8 strip used filter intra ({matched} pixel-exact matches, \ + {named_refusals} refusals out of {} attempts) -- gate proved nothing this run", + seeds.len() + ); + eprintln!( + "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals, \ + filter_intra_rect_sub16_hits delta={compared_hits} (all attempts including \ + refused: {}) out of {} attempts", + crate::decode::filter_intra_rect_sub16_hits() - all_before, + seeds.len() + ); + } + /// lane-rectsplit r1 gate (b): [`a_real_aomenc_stream_with_a_superblock_level_horz_vert_partition_decodes_pixel_exact`]'s /// own recipe (`--sb-size=64`, `--min/max-partition-size=32/64`, so every /// SB-level decision is genuinely NONE/SPLIT/HORZ/VERT) with its diff --git a/lanes/fistrip-r1.report.md b/lanes/fistrip-r1.report.md new file mode 100644 index 00000000..2d9c5efe --- /dev/null +++ b/lanes/fistrip-r1.report.md @@ -0,0 +1,128 @@ +# lane-fistrip r1 — filter intra on a rect strip + +Branch `lane-fistrip` off main `df5d630`. Worktree +`/home/user/Documents/Code/Rust/edith_codecs-fistrip`, +`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-fistrip`. + +## Charter premise: stale, corrected by measurement + +The charter said `predict_filter_intra` is square-only. It is not: lane-rectsplit r1 +already gave it `bw`x`bh` (`crates/ec-av1/src/intra.rs:773`), and 32x16/16x32 strips +already predict filter intra with a real-aomenc gate +(`a_real_aomenc_stream_with_filter_intra_on_a_horz_vert_strip_decodes_pixel_exact`). + +The real defect one level down was a **symbol-consumption gap**, not a prediction gap: +`filter_intra_size_class_rect` (`decode.rs:3491`) returned `None` for 8x16/16x8, so +`read_intra_mode_rect` never read the `use_filter_intra` flag that +`av1_filter_intra_allowed_bsize` (`wide <= 32 && high <= 32`, oracle +`av1/common/reconintra.h`) makes aomenc write on every DC_PRED 8x16/16x8 leaf. The +`decode_leaf_rect` refusal "filter intra on a HORZ/VERT strip (this decoder predicts +square-only)" (old `decode.rs:4661`) was DEAD CODE behind that `None` — it never fired; +the tile desynced silently instead. + +Film stops measured on main `df5d630` (release `decode_probe`), BEFORE any change: +- `hghead.obu` (ReelB 0.4 s head): `a partition below 8x8 (this decoder codes no + leaf smaller than 8x8)` — earlier than filter intra, as the charter suspected, so the + film is not this lane's gate. +- `reelb5.obu`: `a superblock-level HORZ/VERT strip with a split transform (per-unit rect + prediction is not ported)`. + +## Changed + +- `crates/ec-av1/src/cdf.rs:424` — `FILTER_INTRA` grows to 8 rows: `[6]`=8x16 (12551), + `[7]`=16x8 (9394), `default_filter_intra_cdfs` index 4/5 (oracle + `av1/common/entropymode.c:821`). +- `crates/ec-av1/src/cdf_state.rs:462` — the field's type/doc follow. +- `crates/ec-av1/src/decode.rs:3491` — `filter_intra_size_class_rect` maps + `(8,16)`/`(16,8)` to those rows, so the symbol is READ where aomenc writes it. +- `crates/ec-av1/src/decode.rs` (`decode_leaf_rect`) — the dead square-only refusal + replaced by the counters; the strip predicts through the `reconstruct_rect` call that + was already there. +- `crates/ec-av1/src/decode.rs` — new `FILTER_INTRA_RECT_SUB16_HITS` / + `filter_intra_rect_sub16_hits()`: a gate asserting the wider `filter_intra_rect_hits` + would be satisfied by a 32x16 strip and prove nothing about the new shapes. +- `crates/ec-av1/src/refusal_inventory.rs` — the square-only line removed. +- `crates/ec-av1/src/decode.rs` tests — `filter_intra_classes_carry_their_own_libaom_default_row` + enumerates every shape inside `av1_filter_intra_allowed_bsize` against + `default_filter_intra_cdfs` row by row and pins the shapes still without a class + (4x8/8x4/4x16/16x4/8x32/32x8 — their partition levels refuse first). +- `crates/ec-av1/src/stream.rs` — `a_pinned_aomenc_16x8_strip_reads_its_use_filter_intra_flag` + (green) plus the pixel gate + `a_real_aomenc_stream_with_filter_intra_on_a_sub16_horz_vert_strip_decodes_pixel_exact` + (`#[ignore]`d with its measurement, see below). +- `crates/ec-av1/fixtures/filter_intra_8x16_strip_seed49.obu` — the pinned stream + (md5 `ac3a64773e5454ee9b5d8650507063cd`, hashed twice from the same recipe; `.gitignore` + ignores `fixtures`, so it is committed with `git add -f`). + +## Gate status — honest + +The charter's gate (`..._on_a_rect_strip_decodes_pixel_exact`) is written and **cannot be +green on this tree**, so it ships `#[ignore]`d carrying its measurement rather than +weakened: over **200 aomenc streams** (seeds 42..241, cq 25, `--min-partition-size=8 +--max-partition-size=32 --enable-filter-intra=1`) aomenc put filter intra on an 8x16/16x8 +strip exactly **twice**, and **both** strips were `skip=0`, which +`decode_leaf_rect` still refuses ("a coded (non-skip) HORZ/VERT rect strip below 16x16"). +Sweeps that found nothing better: cq {15,20,25,30,34,40,45,55}; content +{gradients, testsrc2, smptebars-style, geq noise}; intra-tool subsets +{none, smooth+paeth off, smooth+paeth+dir+angle off} — the last kills filter intra +entirely. Flag-arrival note (coordinator correction, aomenc keeps the LAST repeated +`--enable-*`): this gate spells every flag once and appends the `EC_FISTRIP_OFF` +diagnosis overrides AFTER the base recipe, and arrival of `--enable-filter-intra=1` is +proven decoder-side by the counters, not by the command line. + +10-bit arm (`a_real_aomenc_10bit_filter_intra_on_a_sub16_strip_decodes_pixel_exact`, +`ten_bit_tool_gate`, seeds 42..61, same recipe): **16/20 attempts decode pixel-exact at +10 bits** with the new CDF rows in place (no regression), and the same seed 49 refuses at +the coded-strip ceiling -- `filter_intra_rect_sub16_hits` never reaches a compare, so this +arm is `#[ignore]`d with its measurement too. + +What IS proven, green, and pinned: the symbol read. On the pinned stream aomdec's own +`EC_TRACE_MODE` shows four `BLOCK_16X8` (`bsize=5`) DC_PRED leaves; our decoder now reads +`use_filter_intra` on them, fires the counter once, and stops at the coded-strip ceiling +ON that block. Before the fix the same stream refused with a DIFFERENT string — "a +HORZ/VERT intra strip below 16x16 with a split transform" — a `tx_depth` read out of an +already-desynced stream, which is the desync this round removes. + +EVIDENCE: `crates/ec-av1/fixtures/filter_intra_8x16_strip_seed49.obu` | pre-fix release +`decode_probe` on main df5d630 vs post-fix `cargo test -p ec-av1 --lib +a_pinned_aomenc_16x8_strip_reads_its_use_filter_intra_flag` | refusal string moves +"split transform" -> "coded (non-skip) rect strip below 16x16", +`filter_intra_rect_sub16_hits` delta 0 -> 1 +EVIDENCE: oracle `EC_TRACE_MODE=1 aomdec` on that fixture | grep `bsize=` | 4x BLOCK_16X8 +DC_PRED leaves (`skip=0`), 6x 16x16, 4x 32x16-class, 20x 32x32 + +## Residue + +- deferred: pixel-exact gate for filter intra on 8x16/16x8 — blocked on the "coded + (non-skip) HORZ/VERT rect strip below 16x16" refusal (needs TX_16X8/TX_8X16 luma plus + 8x4/4x8 chroma coefficient tables) — un-ignore the gate the round that lands. +- deferred: the 10-bit pixel arm rides the same ceiling as the 8-bit one. +- deferred: 8x32/32x8 (HORZ_4/VERT_4) and 4x8/8x4 (sub-8x8) filter-intra classes — their + partition levels refuse before the mode read; the domain test pins them as absent. +- accepted: the capability claim "filter intra on a superblock-level HORZ/VERT strip + (never expected -- av1_filter_intra_allowed_bsize caps at 32x32)" stays; 64x32/32x64 + are past the <=32 bound on one axis, verified in the same domain test. + +## Film probes after the fix (release `decode_probe`, this branch) + +- `hghead.obu`: `a partition below 8x8 (this decoder codes no leaf smaller than 8x8)` (unchanged) +- `reelb5.obu`: `a superblock-level HORZ/VERT strip with a split transform (per-unit rect + prediction is not ported)` (unchanged) + +Both films stop before any 8x16/16x8 filter-intra strip, so this lane moves neither +frontier; it removes a silent desync that would have bitten once those two lift. + +## Suite totals + +`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib` (log `$HOME/.cache/fistrip-suite.log`, +826 s): **300 passed, 1 failed, 29 ignored**. + +The one failure is PRE-EXISTING on main `df5d630` and not this lane's: +`decode::tests::nz_map_ctx_offset_tables_match_the_rect_rule` — "32x64 nz_map offset at +display (row 0, col 2): left 6, right 11", the known rectsplit-r4 `table[col][row]` vs +`[row][col]` convention clash already in the ledger. This lane touched neither +`NZ_MAP_CTX_OFFSET_*` nor `base_ctx_rect`. + +New/changed tests, all green: `filter_intra_classes_carry_their_own_libaom_default_row`, +`a_pinned_aomenc_16x8_strip_reads_its_use_filter_intra_flag`; the two pixel arms are among +the 29 ignored, each carrying its measurement in its doc. diff --git a/lanes/fistrip-r2.report.md b/lanes/fistrip-r2.report.md new file mode 100644 index 00000000..7e8329ad --- /dev/null +++ b/lanes/fistrip-r2.report.md @@ -0,0 +1,116 @@ +# lane-fistrip r2 — verifier fix-now items + +Round 1 (57f1fcb) landed the defect fix (8x16/16x8 strips never read their +`use_filter_intra` flag). This round closes the four fix-now items the verifier +raised against it. No decode-path behaviour changed: every edit is a test, a +generator script, or a gate's seed window. + +## 1. The filter-intra CDF row table is generated from the oracle, and pins every allowed shape + +`scripts/extract-filter-intra-cdfs.py` (new) reads `BLOCK_SIZES_ALL`'s order from +`av1/common/enums.h` and `default_filter_intra_cdfs` from `av1/common/entropymode.c` +in the oracle tree and prints the `(width, height, default)` rows for the shapes +`av1_filter_intra_allowed_bsize` allows. r1 had guessed 16384 for the four 1:4 +shapes; their real rows are **4x16=12770, 16x4=10368, 8x32=20229, 32x8=18101** +(entropymode.c:827-828, BLOCK_SIZES_ALL indices 16..19). + +`decode.rs` `filter_intra_classes_carry_their_own_libaom_default_row` now lists all +14 allowed shapes with their true row plus a `refused_by` note for the six with no +class today (4x8/8x4 → "a partition below 8x8 …"; 4x16/16x4 → the 16x16-level +partition refusal; 8x32/32x8 → "a 32x32 partition type this decoder does not code"), +and asserts, per shape: the class's row equals the oracle default, the row is a real +2-symbol CDF (`{p, 32768, 0}`), no two shapes share a class, and every one of +`cdf::FILTER_INTRA`'s 8 rows is claimed by exactly one shape. So the round that +lifts one of those refusals cannot land a wrong CDF row for the shape it unlocks. + +## 2. `predict_filter_intra` now has a bit-exact unit test + +`intra.rs` `filter_intra_matches_the_libaom_predictor_for_every_mode_and_shape`: +`av1_filter_intra_taps` and `av1_filter_intra_predictor_c` / +`highbd_filter_intra_predictor` (reconintra.c:807-955) are transcribed into the test +module from the C, independently of `FILTER_INTRA_TAPS`, and compared against +`predict_filter_intra` for **5 modes x 14 shapes (4x4 … 32x32, both orientations of +1:2 and 1:4) x 3 seeded random edge sets x {8-bit, 10-bit} = 420 blocks**, whole +block, bit-exact. Before this round the predictor had no unit test at all. + +## 3. Both firing seeds are inside the ignored gate's default window + +r1 recorded only the first firing seed (49) of its 200-seed measurement. r2 re-ran +just the missing window (seeds 50..=241, `EC_FISTRIP_GATE_SEED0=50 +EC_FISTRIP_GATE_ATTEMPTS=192`, 31 s): **172 pixel-exact matches, 20 named refusals, +exactly one attempt with a sub16 filter-intra delta -- seed 213**, refusing at +"a coded (non-skip) HORZ/VERT rect strip below 16x16". So over seeds 42..=241 the +firing set is exactly {49, 213}, both `skip=0`. + +The 8-bit gate now builds its seed list as `(0..n_attempts).map(|a| 42 + a)` plus +`FIRING_SEEDS = [49, 213]` (appended when the window misses them), so the default +40-attempt run -- and even a 2-attempt one -- carries both hits; the doc and the +`#[ignore]` string both name them. The 10-bit arm gets seed 213 appended too, marked +in its doc as a widening from the 8-bit recipe's measurement, NOT a measured 10-bit +firing set (its encode is a different stream; the round that un-ignores it must +re-measure). The temporary `EC_FISTRIP_GATE_SEED0` knob used for the scan was removed +again -- the seeds are in the source, not in an env var. + +## 4. MERGE NOTE + +`a_pinned_aomenc_16x8_strip_reads_its_use_filter_intra_flag` (stream.rs) asserts +`decode_stream(...).expect_err(...)` on the refusal +"a coded (non-skip) HORZ/VERT rect strip below 16x16". **The round that lifts that +refusal MUST flip this test from `expect_err` to a full pixel compare against ffmpeg** +(the fixture's strip is `skip=0`, so it becomes decodable the moment the ceiling +moves) and un-ignore +`a_real_aomenc_stream_with_filter_intra_on_a_sub16_horz_vert_strip_decodes_pixel_exact` +plus its 10-bit twin. A green `expect_err` after that lift is a stale refusal claim, +not a pass. + +## Files changed + +- `scripts/extract-filter-intra-cdfs.py` (new) — generates the `default_filter_intra_cdfs` + rows from the oracle tree; no hand transcription. +- `crates/ec-av1/src/decode.rs:16315` — the domain test now pins all 14 allowed shapes + (true rows for the six refused ones) + row shape + class uniqueness + full table coverage. +- `crates/ec-av1/src/intra.rs` (tests) — independent C port of + `av1_filter_intra_taps`/`av1_filter_intra_predictor_c` and the 420-block bit-exact compare. +- `crates/ec-av1/src/stream.rs` — 8-bit sub16 gate: seed window + `FIRING_SEEDS = [49, 213]`, + doc and `#[ignore]` string record both firing seeds; 10-bit arm: seed 213 appended with + its "widening, not measured" note. + +## EVIDENCE + +EVIDENCE: `scripts/extract-filter-intra-cdfs.py` output | run against `~/.cache/aom-oracle/src` | +14 rows, 1:4 shapes = 12770/10368/20229/18101 (r1 had 16384 for all four) + +EVIDENCE: `cargo test -p ec-av1 --lib filter_intra` | 5 passed, 0 failed, 2 ignored (14.9 s) | +`filter_intra_matches_the_libaom_predictor_for_every_mode_and_shape` compares 420 blocks +(2 depths x 14 shapes x 5 modes x 3 seeds), all bit-exact; the test asserts that count + +EVIDENCE: `$HOME/.cache/fistrip-seedscan-r2.log` | `EC_FISTRIP_GATE_SEED0=50 +EC_FISTRIP_GATE_ATTEMPTS=192` on the ignored 8-bit gate | 172 matches, 20 refusals, one +sub16 delta: "seed 213 refused with sub16 filter-intra delta 1" + +EVIDENCE: `EC_FISTRIP_GATE_ATTEMPTS=2 ... -- --ignored --nocapture` | default window of 2 +attempts + FIRING_SEEDS | "seed 49 ... delta 1", "seed 213 ... delta 1", +"filter_intra_rect_sub16_hits over ALL attempts (refused included) = 2"; the gate still +fails its `compared_hits > 0` assert, which is exactly the ceiling it is ignored for + +## Residue + +- deferred: the pixel gates (8- and 10-bit) stay `#[ignore]`d — blocked on + "a coded (non-skip) HORZ/VERT rect strip below 16x16"; un-ignore + flip the pinned + test's `expect_err` (MERGE NOTE above) the round that lifts it. +- deferred: 10-bit firing seeds are unmeasured — the 10-bit encode is a different stream; + measure when that gate un-ignores. +- accepted: `predict_filter_intra` is now proven on all 14 shapes including the four 1:4 + ones whose partition levels refuse — prediction ahead of reach, deliberately. + +## Suite totals + +`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib` under `systemd-run --user` +(log `$HOME/.cache/fistrip-suite-r2.log`, 257 s): **301 passed, 1 failed, 29 ignored** +(r1: 300/1/29 — the new predictor test is the +1). + +The single failure is the PRE-EXISTING one already red on main `df5d630`: +`decode::tests::nz_map_ctx_offset_tables_match_the_rect_rule` (32x64 nz_map offset at +display row 0 col 2), the rectsplit-r4 `[col][row]` convention clash. This round touched +neither `NZ_MAP_CTX_OFFSET_*` nor `base_ctx_rect`. +`refusal_inventory` (3 passed) and `gate_coverage` (9 passed) both green. diff --git a/scripts/extract-filter-intra-cdfs.py b/scripts/extract-filter-intra-cdfs.py new file mode 100755 index 00000000..261962e5 --- /dev/null +++ b/scripts/extract-filter-intra-cdfs.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +"""Emit `default_filter_intra_cdfs` as (width, height, default) straight from +the libaom oracle source, so the ec-av1 test that pins those rows is never +transcribed by hand (class: shared-oracle blindness / table-indexed-by-raw). + +Reads BLOCK_SIZES_ALL's order from av1/common/enums.h and the CDF table from +av1/common/entropymode.c, and prints the Rust literal rows for the shapes +`av1_filter_intra_allowed_bsize` allows (both sides <= 32). + + scripts/extract-filter-intra-cdfs.py [] +""" +import re +import sys +from pathlib import Path + +src = Path(sys.argv[1] if len(sys.argv) > 1 else Path.home() / ".cache/aom-oracle/src") + +enums = (src / "av1/common/enums.h").read_text() +body = enums[enums.index(" BLOCK_4X4,"):enums.index(" BLOCK_SIZES_ALL,")] +sizes = [tuple(int(x) for x in m) for m in re.findall(r"BLOCK_(\d+)X(\d+),", body)] + +ent = (src / "av1/common/entropymode.c").read_text() +start = ent.index("default_filter_intra_cdfs") +table = ent[start:ent.index("};", start)] +values = [int(v) for v in re.findall(r"AOM_CDF2\((\d+)\)", table)] + +assert len(values) == len(sizes), f"{len(values)} rows vs {len(sizes)} block sizes" +for (w, h), v in zip(sizes, values): + if w <= 32 and h <= 32: + print(f" ({w}, {h}, {v}),")