forge
Explore
Log in

Don't you dare go Hollow

Intrabc coverage closes on an engagement counter, not a flag -- 10-bit sb128 screen arms assert decoded intrabc blocks per depth

Browse files at this commit

fe5d4c82ed8ce67f1df1bd6158684678f54a8f55Ahmet Kaan GümüşParent: 332f251
  • test
    • intrabc coverage closes on an engagement counter, not a flag -- 10-bit sb128 screen arms assert decoded intrabc blocks per depth
Show full message
test(av1): intrabc coverage closes on an engagement counter, not a flag -- 10-bit sb128 screen arms assert decoded intrabc blocks per depth
crates/ec-av1/examples/decode_probe.rsmodified+1 -0
@@ -47,6 +47,7 @@ fn main() {
4747 ec_av1::stream::rect64_corner_tu_hits(1)
4848 );
4949 println!("leaf8_intrabc_hits: {}", ec_av1::stream::leaf8_intrabc_hits());
50+ println!("intrabc_hits: {}", ec_av1::stream::intrabc_hits());
5051 let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters();
5152 println!("rect_inter: tu={rtu} txsplit={rsplit} obmc_leaf={robmc}");
5253 println!("sub8_inter_split: groups={}", ec_av1::decode::sub8_inter_split_hits());
crates/ec-av1/src/gate_coverage.rsmodified+15 -5
@@ -49,6 +49,10 @@ const NEVER_EXERCISED: &[(&str, &str)] = &[
4949 // `a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips`
5050 // spells `--enable-intrabc=1` and decodes three such 8-bit streams whole-
5151 // frame pixel-exact against ffmpeg, with the block counter asserted > 0.
52+ // Re-verified 2026-09-17 (lane-av1-intrabc) at main f715d70c: 185 rect
53+ // `use_intrabc` symbols read, 5 intrabc blocks decoded, 7 frames
54+ // compared pixel-exact, 1 named refusal (rect-strip intrabc), 0
55+ // mismatches -- the counts the assert above stands on.
5256 ];
5357
5458 /// The `--enable-*` tools this decoder cares about, whether or not any gate
@@ -204,11 +208,17 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ // lane-cwarp's 10-bit comp
204208 // flip/identity/1D transform types are proven to reach a real 10-bit stream
205209 // this decoder reconstructs exactly (10 of its rect coefficient TUs carry a
206210 // 1D tx class).
207- // `enable-intrabc` LEFT this 10-bit list on 2026-09-02 (lane-kf900 r6):
208- // `a_real_aomenc_rect_strip_palette_decodes_pixel_exact`'s new
209- // `smptebars-screen-txs-cq40/cq55` arms spell `--enable-intrabc=1` and are
210- // decoded and pixel-compared at 10 bit as well as 8, so the tool reaches a
211- // real 10-bit stream this decoder reconstructs exactly.
211+ // `enable-intrabc` LEFT this 10-bit list on 2026-09-02 (lane-kf900 r6).
212+ // The entry it first rested on was a flag spelling -- the palette gate's
213+ // `smptebars-screen-txs-cq40/cq55` arms pass `--enable-intrabc=1` -- and
214+ // lane-av1-intrabc MEASURED that those arms decode ZERO intrabc blocks at
215+ // both depths, so they retired the entry without a stream carrying the
216+ // tool (class `tool-disabled-in-every-gate`, the same defect this list
217+ // exists for). The closing evidence is now
218+ // `an_sb128_screen_stream_with_intrabc_decodes_pixel_exact`: its sb128
219+ // screen recipes run at 10 bits and hard-assert a decoded intrabc block
220+ // per depth (4-6 per arm), every frame pixel-compared against ffmpeg's own
221+ // 10-bit decode.
212222 ("enable-rect-tx", "hole at both depths, see the 8-bit list"),
213223 ];
214224
crates/ec-av1/src/stream.rsmodified+91 -35
@@ -177,6 +177,14 @@ pub fn leaf8_intrabc_hits() -> usize {
177177 crate::decode::leaf8_intrabc_hits()
178178 }
179179
180+/// Blocks reconstructed with intra block copy at ANY shape: every block whose
181+/// `use_intrabc` symbol came out 1 and was predicted from the current frame.
182+/// The engagement counter the intrabc gates assert on; [`leaf8_intrabc_hits`]
183+/// is its 8x8-leaf subset.
184+pub fn intrabc_hits() -> usize {
185+ crate::decode::intrabc_hits()
186+}
187+
180188 /// lane-sb128c r8: the 128 root's INTRA (key-frame) rect arm -- (128x64
181189 /// blocks, 64x128 blocks, blocks per resolved intra `tx_depth` 0/1/2).
182190 pub fn intra_sb128_counters() -> (usize, usize, [usize; 3]) {
@@ -5968,13 +5976,32 @@ pub(crate) mod tests {
59685976 square_only: bool,
59695977 extra: &[&str],
59705978 ) -> Vec<u8> {
5979+ screen_intrabc_stream_at_depth(src, cq, txs, tiled, square_only, 8, extra)
5980+ }
5981+
5982+ /// [`screen_intrabc_stream_with`] at an explicit bit depth (8 or 10): the
5983+ /// lavfi source is rendered straight to that depth's yuv4mpegpipe pixel
5984+ /// format and aomenc is told to encode at the matching
5985+ /// `--bit-depth`/`--input-bit-depth`, so a 10-bit arm produces a genuine
5986+ /// high-bit-depth stream rather than an 8-bit one in disguise.
5987+ fn screen_intrabc_stream_at_depth(
5988+ src: &str,
5989+ cq: &str,
5990+ txs: &str,
5991+ tiled: bool,
5992+ square_only: bool,
5993+ depth: usize,
5994+ extra: &[&str],
5995+ ) -> Vec<u8> {
5996+ assert!(depth == 8 || depth == 10, "unsupported bit depth {depth}");
5997+ let pix_fmt = if depth == 10 { "yuv420p10le" } else { "yuv420p" };
59715998 let mut ff = Command::new("ffmpeg");
59725999 ff.args(["-v", "error", "-f", "lavfi", "-i", src, "-t", "0.2"]);
59736000 if tiled {
59746001 ff.args(["-vf", "tile=2x2"]);
59756002 }
59766003 let out = ff
5977- .args(["-pix_fmt", "yuv420p", "-strict", "-1", "-f", "yuv4mpegpipe", "-"])
6004+ .args(["-pix_fmt", pix_fmt, "-strict", "-1", "-f", "yuv4mpegpipe", "-"])
59786005 .stdin(Stdio::null())
59796006 .stdout(Stdio::piped())
59806007 .stderr(Stdio::piped())
@@ -5983,10 +6010,9 @@ pub(crate) mod tests {
59836010 assert!(out.status.success(), "ffmpeg failed for {src}");
59846011 let y4m = out.stdout;
59856012 let mut child = Command::new(aomenc_path())
6013+ .args(["--codec=av1"])
6014+ .args([format!("--bit-depth={depth}"), format!("--input-bit-depth={depth}")])
59866015 .args([
5987- "--codec=av1",
5988- "--bit-depth=8",
5989- "--input-bit-depth=8",
59906016 "--passes=1",
59916017 "--end-usage=q",
59926018 "--cpu-used=0",
@@ -6079,6 +6105,17 @@ pub(crate) mod tests {
60796105 /// [`crate::decode::read_intrabc_dv`] hardcoded 64. Every arm is compared
60806106 /// to ffmpeg and the decoded-intrabc-block counter is asserted non-zero,
60816107 /// so a stream that stopped using intrabc could not make this vacuous.
6108+ ///
6109+ /// lane-av1-intrabc (2026-09-17): the four recipes now run at 10 bits as
6110+ /// well, and both depths must SHOW the engagement -- `blocks_at_depth`
6111+ /// below hard-asserts a decoded intrabc block per depth. The 10-bit
6112+ /// coverage the guard records for `enable-intrabc` used to rest on a gate
6113+ /// that only SPELLED `--enable-intrabc=1`: measured (same round), all five
6114+ /// arms of `a_real_aomenc_rect_strip_palette_decodes_pixel_exact` decode
6115+ /// ZERO intrabc blocks at BOTH depths, so the spelling proved nothing and
6116+ /// the entry was one encoder-RD change away from being vacuous again
6117+ /// (class `tool-disabled-in-every-gate`). An arm here that stops engaging
6118+ /// intrabc now fails this gate instead of retiring the entry unproven.
60826119 #[test]
60836120 fn an_sb128_screen_stream_with_intrabc_decodes_pixel_exact() {
60846121 const NAME: &str = "an_sb128_screen_stream_with_intrabc_decodes_pixel_exact";
@@ -6089,40 +6126,52 @@ pub(crate) mod tests {
60896126 let (width, height) = (256usize, 192usize);
60906127 let _guard = lock_gate_counters();
60916128 let (mut blocks_total, mut frames_compared) = (0usize, 0u32);
6092- for txs in ["0", "1"] {
6093- for cq in ["30", "45"] {
6094- let arm = format!("sb128 txs={txs} cq={cq}");
6095- let stream = screen_intrabc_stream_with(
6096- "smptebars=size=128x96:rate=25",
6097- cq,
6098- txs,
6099- true,
6100- true,
6101- &["--sb-size=128"],
6102- );
6103- let (sb128, intrabc_frames) = sb128_and_intrabc_frames(&stream);
6104- assert!(
6105- sb128 && intrabc_frames > 0,
6106- "{NAME}: {arm} no longer codes sb128 + allow_intrabc"
6107- );
6108- crate::decode::reset_intrabc_hits();
6109- let frames = decode_stream(&stream).unwrap_or_else(|e| panic!("{NAME}: {arm}: {e}"));
6110- let blocks = crate::decode::intrabc_hits();
6111- blocks_total += blocks;
6112- let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());
6113- assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count");
6114- for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {
6129+ let mut blocks_at_depth = [0usize; 2];
6130+ for depth in [8usize, 10] {
6131+ for txs in ["0", "1"] {
6132+ for cq in ["30", "45"] {
6133+ let arm = format!("sb128 {depth}-bit txs={txs} cq={cq}");
6134+ let stream = screen_intrabc_stream_at_depth(
6135+ "smptebars=size=128x96:rate=25",
6136+ cq,
6137+ txs,
6138+ true,
6139+ true,
6140+ depth,
6141+ &["--sb-size=128"],
6142+ );
6143+ let (sb128, intrabc_frames) = sb128_and_intrabc_frames(&stream);
61156144 assert!(
6116- ours.y == ref_frame.y && ours.u == ref_frame.u && ours.v == ref_frame.v,
6117- "{NAME}: {arm} frame {i} does not match ffmpeg"
6145+ sb128 && intrabc_frames > 0,
6146+ "{NAME}: {arm} no longer codes sb128 + allow_intrabc"
6147+ );
6148+ crate::decode::reset_intrabc_hits();
6149+ let frames =
6150+ decode_stream(&stream).unwrap_or_else(|e| panic!("{NAME}: {arm}: {e}"));
6151+ let blocks = crate::decode::intrabc_hits();
6152+ blocks_total += blocks;
6153+ blocks_at_depth[usize::from(depth == 10)] += blocks;
6154+ let theirs = if depth == 10 {
6155+ ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
6156+ } else {
6157+ ffmpeg_decode_sequence(&stream, width, height, frames.len())
6158+ };
6159+ assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count");
6160+ for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {
6161+ assert!(
6162+ ours.y == ref_frame.y
6163+ && ours.u == ref_frame.u
6164+ && ours.v == ref_frame.v,
6165+ "{NAME}: {arm} frame {i} does not match ffmpeg"
6166+ );
6167+ frames_compared += 1;
6168+ }
6169+ eprintln!(
6170+ "{NAME}: {arm} intrabc_frames={intrabc_frames} intrabc_blocks={blocks} \
6171+ DECODED {} frame(s) exact",
6172+ frames.len()
61186173 );
6119- frames_compared += 1;
61206174 }
6121- eprintln!(
6122- "{NAME}: {arm} intrabc_frames={intrabc_frames} intrabc_blocks={blocks} \
6123- DECODED {} frame(s) exact",
6124- frames.len()
6125- );
61266175 }
61276176 }
61286177 assert!(frames_compared > 0, "{NAME}: no frame was compared");
@@ -6130,6 +6179,13 @@ pub(crate) mod tests {
61306179 blocks_total > 0,
61316180 "{NAME}: gate is vacuous -- no arm decoded a single intrabc block"
61326181 );
6182+ assert!(
6183+ blocks_at_depth[0] > 0 && blocks_at_depth[1] > 0,
6184+ "{NAME}: 8-bit={} 10-bit={} -- an arm at that depth no longer decodes an intrabc \
6185+ block, so `enable-intrabc` coverage there would rest on the flag spelling alone",
6186+ blocks_at_depth[0],
6187+ blocks_at_depth[1]
6188+ );
61336189 }
61346190
61356191 /// lane-t900 r33, CENSUS for "a sub-8x8 leaf that uses intrabc".
lanes/av1-intrabc-r1.report.mdadded+97 -0
@@ -0,0 +1,97 @@
1+# lane-av1-intrabc r1 — the fifth gate-integrity entry closes with an engagement counter, not a flag
2+
3+Branch `lane-av1-intrabc`, base `f715d70c`. Closes the last clause of
4+`debt|gate-integrity|ec-av1: five aomenc coding tools …` (deleted from
5+`~/.omp/agent/debts/DEBTS-home-user-Documents-Code-Rust-edith_codecs.md`).
6+
7+## What the debt premise got wrong at HEAD
8+
9+`--enable-intrabc` is NOT off in all real-aomenc gates at `f715d70c`. lane-kf900 r6/r7 and
10+lane-t900 r31-r34 landed between 2026-09-02 and HEAD:
11+
12+- `stream::tests::a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips` —
13+ `--enable-intrabc=1`, assert `rect_intrabc_reads > 0 && intrabc_hits > 0 && leaf8_intrabc_hits > 0`,
14+ one named refusal expected (rect-strip intrabc).
15+- `stream::tests::an_sb128_screen_stream_with_intrabc_decodes_pixel_exact`
16+- `stream::tests::an_intrabc_block_under_tx_mode_select_decodes_pixel_exact`
17+- `stream::tests::a_sub8_leaf_census_over_intrabc_screen_streams_measures_the_sub8_refusal`
18+ and `an_intrabc_vartx_census_measures_the_mixed_leaf_refusal` (censuses).
19+
20+Re-run at HEAD (all pass, one command, `--nocapture`):
21+
22+ cargo test -p ec-av1 --release --lib -- --nocapture --test-threads=1 intrabc
23+ -> 7 passed; 0 failed; 1 ignored. `a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips`:
24+ 185 rect use_intrabc symbol(s) read, 5 intrabc block(s) decoded across 4 arm(s),
25+ 1 refused by name, 7 frames compared, 3 out of scope (0 mismatched), 1 intrabc block at an 8x8 leaf.
26+
27+## The real hole this round found and closed: the 10-bit entry rested on a SPELLING
28+
29+`gate_coverage.rs`'s 10-bit `enable-intrabc` closure cited
30+`a_real_aomenc_rect_strip_palette_decodes_pixel_exact`'s `smptebars-screen-txs-cq40/cq55` arms, which
31+merely pass `--enable-intrabc=1`. Measured with a temporary per-arm delta print: those arms decode
32+**0** intrabc blocks at both depths (all 5 arms × 2 depths), i.e. the entry was retired by a flag on a
33+command line — the exact defect the guard exists for.
34+
35+Fix: `screen_intrabc_stream_at_depth` (depth-aware twin of `screen_intrabc_stream_with`) +
36+`an_sb128_screen_stream_with_intrabc_decodes_pixel_exact` now runs its four sb128 screen recipes at
37+8 AND 10 bits and hard-asserts a decoded intrabc block per depth (`blocks_at_depth[0] > 0 &&
38+blocks_at_depth[1] > 0`), every frame pixel-compared against ffmpeg's own decode at that depth
39+(`ffmpeg_decode_sequence_10bit` at 10 bits). Observed:
40+
41+ sb128 8-bit txs=0/1 × cq=30/45: intrabc_frames=1, intrabc_blocks=4/4/5/4, exact
42+ sb128 10-bit txs=0/1 × cq=30/45: intrabc_frames=1, intrabc_blocks=4/4/6/5, exact
43+
44+Engagement is encoder-side too: libaom resets `allow_intrabc` when no block selected intrabc
45+(encodeframe.c:2335-2337), so a frame header that keeps `allow_intrabc=1` proves the encoder picked
46+it; the gate asserts `intrabc_frames > 0` off the parsed header as well.
47+
48+`gate_coverage.rs` comments updated: the 8-bit paragraph records the re-verified counts; the 10-bit
49+paragraph records that the palette-gate citation was a measured zero-engagement spelling and names
50+the new closing witness. Case closed in report.
51+
52+`decode::intrabc_hits()` is now exposed as `ec_av1::stream::intrabc_hits()` and printed by
53+`examples/decode_probe.rs`, so the standalone pair below prints the counter.
54+
55+## Standalone command pair (prints engagement + comparison)
56+
57+Fixture (outside git, `~/.cache/intrabc-fixture/`):
58+
59+ ffmpeg -v error -f lavfi -i 'smptebars=size=128x96:rate=25' -t 0.2 -vf tile=2x2 \
60+ -pix_fmt yuv420p10le -strict -1 -f yuv4mpegpipe - \
61+ | ~/.cache/aom-oracle/build/aomenc --codec=av1 --bit-depth=10 --input-bit-depth=10 --passes=1 \
62+ --end-usage=q --cpu-used=0 --lag-in-frames=0 --kf-max-dist=1 --limit=1 --threads=1 \
63+ --tile-columns=0 --min-partition-size=8 --max-partition-size=32 --sb-size=64 \
64+ --tune-content=screen --enable-intrabc=1 --enable-palette=0 --cq-level=30 \
65+ --enable-tx-size-search=1 --enable-rect-partitions=0 --enable-1to4-partitions=0 --sb-size=128 \
66+ --obu -o sb128-10bit-cq30.obu -
67+
68+Engagement + result:
69+
70+ EC_PROBE_HDR=1 cargo run --release --example decode_probe -- sb128-10bit-cq30.obu
71+ -> HDR 0: type=Key … screen_tools=true intrabc=true … tx_mode=Select
72+ OK: 1 frames decoded, 256x192 ; intrabc_hits: 6
73+ cargo run --release --example dump_yuv -- sb128-10bit-cq30.obu ours
74+ ffmpeg -v error -i sb128-10bit-cq30.obu -pix_fmt yuv420p10le -f rawvideo ref.yuv
75+ cmp ours.f0.yuv ref.yuv -> BYTE-EXACT-10BIT
76+ sha256 de0d83756d22e422b19413e9e1c20325b9bd68fe2f27aae872da2d4736f6a007 (both files)
77+
78+The arbiter agrees, and the oracle's own decoder accepts the stream
79+(`aomdec --i420 --output-bit-depth=10 --md5`: md5 `f1b7222466d15d1dda3e25fdbd8577fe`).
80+
81+## Refusals — genuine capability gaps, all pinned
82+
83+- `intra block copy on a HORZ/VERT/1:4 rect intra strip (reconstruction is not ported at this shape)` —
84+ the reader consumes the symbol and refuses by name; gate asserts exactly one such refusal
85+ (`a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips`, `refused == 1`).
86+- sub-8x8 leaf intrabc and intrabc var-tx mixed-leaf shapes have their own censuses that assert the
87+ premise is reached before reading anything into the refusal firing. Current run: var-tx census
88+ decoded 5 intrabc blocks through the var-tx tree, 0 mixed-leaf resolutions, 4 frames exact.
89+ No bug localized; no arm with a decoded intrabc block mismatched ffmpeg (0 mismatches).
90+
91+## Gates run
92+
93+ EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --release --lib -- --nocapture --test-threads=1 intrabc
94+ -> 7 passed / 0 failed / 1 ignored
95+ cargo test -p ec-av1 --release --lib -- --exact gate_coverage::tests::never_exercised_8bit_matches_the_gate_recipes gate_coverage::tests::never_exercised_10bit_matches_the_gate_recipes
96+ -> ok (derived hole set unchanged: 8-bit 5 holes, 10-bit 2; `enable-intrabc` in neither)
97+ cargo check -p ec-av1 --all-targets -> 0 warnings