diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 2e47b4d7..d8af7a4d 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -16325,57 +16325,88 @@ mod tests { #[test] fn filter_intra_classes_carry_their_own_libaom_default_row() { // `default_filter_intra_cdfs[bsize]`, BLOCK_SIZES_ALL order, as - // (width, height, default) for the shapes <= 32 on both axes. - let libaom: &[(usize, usize, u16)] = &[ - (4, 4, 4621), - (4, 8, 6743), - (8, 4, 5893), - (8, 8, 7866), - (8, 16, 12551), - (16, 8, 9394), - (16, 16, 12408), - (16, 32, 14301), - (32, 16, 12756), - (32, 32, 22343), - (4, 16, 16384), - (16, 4, 16384), - (8, 32, 16384), - (32, 8, 16384), + // (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)), ]; - // The shapes this decoder's partition tree can actually reach today - // (squares 4..32 plus the 16x16- and 32x32-level HORZ/VERT strips). - let reachable = [ - (4, 4), - (8, 8), - (16, 16), - (32, 32), - (32, 16), - (16, 32), - (8, 16), - (16, 8), - ]; - for &(bw, bh, default) in libaom { - let class = filter_intra_size_class_rect(bw, bh); - if reachable.contains(&(bw, bh)) { - let class = class.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_eq!( - crate::cdf::FILTER_INTRA[class][0], - default, - "{bw}x{bh} (class {class}) must carry default_filter_intra_cdfs' own row" - ); - } else { - // 4x8/8x4/4x16/16x4/8x32/32x8: sub-8x8 leaves and the 1:4 - // strips, neither of which this decoder codes yet (their - // partition levels refuse by name first), so no class exists. - assert!( - class.is_none(), - "{bw}x{bh} gained a class without a decode path to use it" - ); + 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)] { 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/stream.rs b/crates/ec-av1/src/stream.rs index 44361fe3..af2106ed 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -12784,6 +12784,11 @@ mod tests { /// 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 = "blocked on the coded (non-skip) rect strip below 16x16 refusal -- see doc"] #[test] fn a_real_aomenc_10bit_filter_intra_on_a_sub16_strip_decodes_pixel_exact() { @@ -12797,7 +12802,8 @@ mod tests { eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); return; } - let seeds: Vec = (42..62).collect(); + let mut seeds: Vec = (42..62).collect(); + seeds.push(213); ten_bit_tool_gate( NAME, 192, @@ -12898,15 +12904,20 @@ mod tests { /// [`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 THIS ROUND (lane-fistrip r1), which is why it is `#[ignore]`d - /// rather than green: over 200 seeds at cq 25 aomenc put filter intra on - /// an 8x16/16x8 strip TWICE, and both times that strip was `skip=0`, so + /// 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 (177 pixel-exact matches, 23 refusals, compared - /// sub16 delta 0, all-attempt delta 2). 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`]. - #[ignore = "blocked on the coded (non-skip) rect strip below 16x16 refusal -- see doc"] + /// 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 = "blocked on the coded (non-skip) rect strip below 16x16 refusal -- both firing seeds (49, 213) put filter intra on a skip=0 strip; see doc"] #[test] fn a_real_aomenc_stream_with_filter_intra_on_a_sub16_horz_vert_strip_decodes_pixel_exact() { const NAME: &str = @@ -12928,6 +12939,22 @@ mod tests { .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()) @@ -12939,8 +12966,7 @@ mod tests { // recipe reaches the feature but this decoder's other ceilings hide // it. let all_before = crate::decode::filter_intra_rect_sub16_hits(); - for attempt in 0..n_attempts { - let seed = 42 + attempt; + for &seed in &seeds { let source = gradients_source(seed, width, height, "duration=0.04:rate=25"); let y4m = Command::new("ffmpeg") .args([ @@ -13056,13 +13082,15 @@ mod tests { assert!( compared_hits > 0, "{NAME}: no 8x16/16x8 strip used filter intra ({matched} pixel-exact matches, \ - {named_refusals} refusals out of {n_attempts}) -- gate proved nothing this run" + {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 {n_attempts} attempts", - crate::decode::filter_intra_rect_sub16_hits() - all_before + refused: {}) out of {} attempts", + crate::decode::filter_intra_rect_sub16_hits() - all_before, + seeds.len() ); } 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}),")