forge
Explore
Log in

Don't you dare go Hollow

Merge lane-av1pinspec: 41 of 43 unpinned count sites spec-pinned, ceiling 43 -> 2

Browse files at this commit

b6966d6616e2705e9b1bfe46e0089ee402b41ecdAhmet Kaan GümüşParent: 44a0cfb5184128
Sweep unchanged in population (60 sites, floor 40 intact) and now reads 58 spec-pinned, 2 not.
Per-group red-before (un-apply one group -> the real guard reds) and six value mutations, one per
derivation shape, each printing the decoded count. Handed forward: the SVT gate site (stream named
by env, not a committed pin, so a wire-header assert would ship unexercised) and one doc-comment
false positive the line-based scanner cannot tell from code.
crates/ec-av1/src/gate_coverage.rsmodified+23 -1
@@ -2592,8 +2592,30 @@ mod count_vacuity_tests {
25922592 // A CEILING on the unpinned population, so a NEW site cannot be added
25932593 // silently. Lower it as sites are fixed; a fix that does not lower it is
25942594 // still a fix, but a NEW site is an immediate red.
2595+ //
2596+ // lane-av1pinspec: 43 -> 2. Each of the 41 fixes adds the ENCODE's own
2597+ // frame count as an `assert_eq!` ABOVE the `ffmpeg_decode_sequence*`
2598+ // call (`-frames:v 1` / `-vframes 1` / `--limit=N` / a helper's `frames`
2599+ // parameter / the arm tuple's `frame_count` / the wire's own OBU frame
2600+ // headers), so the count handed to the oracle is a value already proven
2601+ // against the encode instead of read off our decode. The two that remain
2602+ // are the two that are not a count to fix:
2603+ // * `an_svt_screen_palette_block_with_a_split_transform_decodes_exactly`
2604+ // reads the path `EC_AV1_SVT1_STREAM` names, and that crop is not
2605+ // committed to `fixtures/`, so no `--limit`, no `-frames:v` and no
2606+ // frame count exists anywhere in the tree for it. The doc comment's
2607+ // "12-frame stream" is prose about one capture and the env var
2608+ // accepts any file, so asserting 12 would pin a number nothing can
2609+ // check. Counting the stream's own OBU frame headers with
2610+ // `Av1Parser` would derive one, and is left on the table
2611+ // deliberately: the gate SKIPs on any box without that env var, so
2612+ // such an assert would ship unexercised.
2613+ // * a `///` DOC COMMENT quoting the pre-r4 body of
2614+ // `pinned_lr_sgr_stream_call_unique_dump`, which this line-based
2615+ // scan cannot tell from code. The gate it describes already spends
2616+ // `FRAMES` and asserts `pics.len() == FRAMES`.
2617+ const UNPINNED_CEILING: usize = 2;
25952618 let unpinned = s.iter().filter(|x| x.pinned_by.is_none()).count();
2596- const UNPINNED_CEILING: usize = 43;
25972619 assert!(
25982620 unpinned <= UNPINNED_CEILING,
25992621 "{unpinned} unpinned count site(s), ceiling is {UNPINNED_CEILING} -- a new one \
crates/ec-av1/src/stream.rsmodified+255 -22
@@ -10502,6 +10502,15 @@ pub(crate) mod tests {
1050210502 match decoded {
1050310503 Ok(frames) => {
1050410504 assert!(!frames.is_empty(), "{NAME}: {arm} decoded no frame");
10505+ // The ENCODE's frame count: the per-arm
10506+ // render (10417) builds
10507+ // `{src}=size=128x128:rate=25` with `-t 0.04`
10508+ // (10427) -- one frame -- and the aomenc args
10509+ // carry `--limit=1` (10467), so every
10510+ // (src, depth, cq, txs, tiles) arm codes
10511+ // exactly 1 frame. Asserted ABOVE the oracle
10512+ // call.
10513+ assert_eq!(frames.len(), 1, "{NAME}: {arm} key frame");
1050510514 let theirs = if depth == 10 {
1050610515 ffmpeg_decode_sequence_10bit(
1050710516 &stream,
@@ -10728,6 +10737,23 @@ pub(crate) mod tests {
1072810737 // report can still say whether the arm fired.
1072910738 let parts = decode::rect_partition_hits() - parts_before;
1073010739 let tus = decode::rect_coeff_tu_hits() - tus_before;
10740+ // The ENCODE's frame count: the fixture renders `mandelbrot=size=64x64:rate=25`
10741+ // with `-t "0.60"` (10677-10691) -- 25 x 0.60 = 15 frames -- and the
10742+ // caller's `args` carry no `--limit` (10823-10853), so every arm's stream
10743+ // codes all 15. Asserted ABOVE the oracle call, which is the fix for the
10744+ // misattribution this gate's own doc comment records: the
10745+ // `--enable-tx-size-search=0` arm is a stream ffmpeg cannot decode past
10746+ // frame 6 of 15, and with the count taken from our decode the helper's
10747+ // byte-length assert fires FIRST and reads as an ffmpeg fault. Naming the
10748+ // 15 here makes the shortfall ours to explain.
10749+ const ENCODED_FRAMES: usize = 15;
10750+ assert_eq!(
10751+ decoded.len(),
10752+ ENCODED_FRAMES,
10753+ "{name}: the encode codes {ENCODED_FRAMES} frames, the decode showed {} (rect \
10754+ partitions {parts}, rect coefficient TUs {tus})",
10755+ decoded.len()
10756+ );
1073110757 let reference = if ten_bit {
1073210758 ffmpeg_decode_sequence_10bit(&stream, width, height, decoded.len())
1073310759 } else {
@@ -11208,12 +11234,18 @@ pub(crate) mod tests {
1120811234 reconstruction is not ported, it must refuse by name"
1120911235 );
1121011236 assert!(!frames.is_empty(), "{NAME}: {arm} decoded no frame");
11237+ // The ENCODE's frame count, asserted ABOVE the oracle call:
11238+ // the per-arm render (11100) uses `-t 0.2` at TS/SB's
11239+ // `rate=25` (10987, 10988) -- 5 input frames -- and the aomenc
11240+ // args carry `--limit=1` (11145), so all eight arms code
11241+ // exactly 1 frame. The old comment below claimed a count
11242+ // assert here would be tautological; that is true of
11243+ // `ffmpeg_frames.len() == frames.len()` and false of this:
11244+ // `frames.len() == 1` is a fact about the ENCODE, checked
11245+ // before `frames.len()` is spent as ffmpeg's frame budget.
11246+ assert_eq!(frames.len(), 1, "{NAME}: {arm} key frame");
1121111247 let ffmpeg_frames =
1121211248 ffmpeg_decode_sequence(&stream, width, height, frames.len());
11213- // No frame-count assert here: `ffmpeg_decode_sequence` was
11214- // handed `frames.len()` as its frame budget, so
11215- // `ffmpeg_frames.len() == frames.len()` holds by
11216- // construction and the assert was tautological.
1121711249 // EVERY frame is compared; an arm whose decode never hit an
1121811250 // intrabc block proves nothing about the DV/prediction path,
1121911251 // so it is counted OUT OF SCOPE -- but a mismatch there is
@@ -11380,8 +11412,14 @@ pub(crate) mod tests {
1138011412 crate::decode::rect4_16_intrabc_hits() > 0,
1138111413 "{NAME}: no 16x4/4x16 intrabc strip -- the pair body was not reached"
1138211414 );
11415+ // The ENCODE's frame count, asserted ABOVE the oracle call: the y4m is
11416+ // rendered with `-frames:v 1` (11333) -- a single frame of
11417+ // `testsrc2=s=640x480:r=25` -- and aomenc runs with
11418+ // `--limit=1 --kf-max-dist=1` (11355, 11356), so the stream codes
11419+ // exactly 1 key frame. Below the call this assert could not fire
11420+ // first: `ffmpeg_decode_sequence` was already handed `frames.len()`.
11421+ assert_eq!(frames.len(), 1, "{NAME}: expected one key frame");
1138311422 let refs = ffmpeg_decode_sequence(&out.stdout, width, height, frames.len());
11384- assert_eq!(frames.len(), 1);
1138511423 assert_eq!(frames[0].y, refs[0].y, "{NAME}: luma");
1138611424 assert_eq!(frames[0].u, refs[0].u, "{NAME}: u");
1138711425 assert_eq!(frames[0].v, refs[0].v, "{NAME}: v");
@@ -11452,6 +11490,13 @@ pub(crate) mod tests {
1145211490 crate::decode::rect4_16_lossless_chroma_hits() > 0,
1145311491 "{NAME}: no lossless 16x4/4x16 chroma pair -- the walk was not reached"
1145411492 );
11493+ // The ENCODE's frame count: the y4m is rendered with `-frames:v 1`
11494+ // (11414) -- a single frame of `testsrc2=s=320x240:r=25` -- and aomenc
11495+ // runs with `--limit=1 --kf-max-dist=1` (11434, 11435), so the stream
11496+ // codes exactly 1 lossless key frame. Asserted ABOVE the oracle call:
11497+ // this gate then indexes `frames[0]`/`refs[0]`, which a zero-frame
11498+ // decode would panic on rather than report.
11499+ assert_eq!(frames.len(), 1, "{NAME}: expected one lossless key frame");
1145511500 let refs = ffmpeg_decode_sequence(&out.stdout, width, height, frames.len());
1145611501 let repaired = 128 * width;
1145711502 assert_eq!(
@@ -11835,6 +11880,11 @@ pub(crate) mod tests {
1183511880 reader for this orientation is untested (coded horz/vert = {coded:?})",
1183611881 if *want_orient == 0 { "HORZ" } else { "VERT" }
1183711882 );
11883+ // The ENCODE's frame count: the per-arm render (11756) uses `-t 0.2`
11884+ // at TS256/TS512's `rate=25` (11700, 11701) -- 5 input frames -- and
11885+ // the aomenc args carry `--limit=1` (11797), so all three arms code
11886+ // exactly 1 frame. Asserted ABOVE the oracle call.
11887+ assert_eq!(frames.len(), 1, "{NAME}: {arm} key frame");
1183811888 let theirs = ffmpeg_decode_sequence(&stream, *width, *height, frames.len());
1183911889 assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count");
1184011890 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {
@@ -11978,6 +12028,16 @@ pub(crate) mod tests {
1197812028 !frames.is_empty(),
1197912029 "{NAME}: {arm} decoded no frame at {threads} recon thread(s)"
1198012030 );
12031+ // The ENCODE's frame count: the skip_arms encode (11904) renders
12032+ // TS512 with `-t 0.2` at `rate=25` (11907) and its aomenc runs
12033+ // with `--limit=1` (11945), so the stream holds 1 coded frame --
12034+ // and this loop re-decodes those SAME bytes at each `threads`
12035+ // value, so the count is arm-invariant. Asserted ABOVE the call.
12036+ assert_eq!(
12037+ frames.len(),
12038+ 1,
12039+ "{NAME}: {arm} key frame at {threads} recon thread(s)"
12040+ );
1198112041 let theirs = ffmpeg_decode_sequence(&stream, *width, *height, frames.len());
1198212042 assert_eq!(
1198312043 frames.len(),
@@ -12220,6 +12280,14 @@ pub(crate) mod tests {
1222012280 let blocks = crate::decode::intrabc_hits();
1222112281 blocks_total += blocks;
1222212282 blocks_at_depth[usize::from(depth == 10)] += blocks;
12283+ // The ENCODE's frame count:
12284+ // `screen_intrabc_stream_at_depth` (12203) renders
12285+ // `smptebars=size=128x96:rate=25` with `-t 0.2` and
12286+ // `-vf tile=2x2` (12066, 12069) -- 5 frames in, 1 tiled frame
12287+ // out at 256x192 -- and its aomenc runs with `--limit=1`
12288+ // (12101), so all eight (depth, txs, cq) arms code exactly
12289+ // 1 frame. Asserted ABOVE the oracle call.
12290+ assert_eq!(frames.len(), 1, "{NAME}: {arm} key frame");
1222312291 let theirs = if depth == 10 {
1222412292 ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
1222512293 } else {
@@ -12609,6 +12677,15 @@ pub(crate) mod tests {
1260912677 Ok(frames) => {
1261012678 let sub8 = crate::decode::sub8_split_hits() - sub8_before;
1261112679 sub8_total += sub8;
12680+ // The ENCODE's frame count: `screen_intrabc_stream_with` (12593)
12681+ // renders `smptebars=size=128x96:rate=25` with `-t 0.2` and
12682+ // `-vf tile=2x2` (12066, 12069) -- 5 frames in, 1 tiled frame
12683+ // out -- and its aomenc runs with `--limit=1` (12101), so both
12684+ // cq arms code exactly 1 frame. The census is report-only about
12685+ // the COUNTS, but its Ok arm asserts pixel-exactness, so the
12686+ // budget handed to ffmpeg is pinned here rather than derived
12687+ // from the decode under test.
12688+ assert_eq!(frames.len(), 1, "{NAME}: {arm} key frame");
1261212689 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());
1261312690 assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count");
1261412691 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {
@@ -12684,6 +12761,15 @@ pub(crate) mod tests {
1268412761 Ok(frames) => {
1268512762 let vartx = crate::decode::intrabc_vartx_hits();
1268612763 vartx_total += vartx;
12764+ // The ENCODE's frame count: `screen_intrabc_stream` (12679)
12765+ // renders `smptebars=size=128x96:rate=25` with `-t 0.2` and
12766+ // `-vf tile=2x2` (12066, 12069) -- 5 frames in, 1 tiled frame
12767+ // out -- and its aomenc runs with `--limit=1` (12101), so all
12768+ // four cq arms code exactly 1 frame. The census is
12769+ // report-only about the COUNTS, but its Ok arm does assert
12770+ // pixel-exactness, so the budget it hands ffmpeg is pinned
12771+ // here rather than derived from the decode under test.
12772+ assert_eq!(frames.len(), 1, "{NAME}: {arm} key frame");
1268712773 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());
1268812774 assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count");
1268912775 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {
@@ -12788,6 +12874,12 @@ pub(crate) mod tests {
1278812874 "{NAME}: vacuous -- {trees} var-tx tree(s), {mixed} mixed: the \
1278912875 capability this gate pins was never exercised"
1279012876 );
12877+ // The ENCODE's frame count: `screen_intrabc_stream_with` (12766)
12878+ // renders `testsrc2=size=320x180:rate=25` with `-t 0.2` and
12879+ // `-vf tile=2x2` (12066, 12069) -- 5 frames in, 1 tiled frame out
12880+ // at 640x360 -- and its aomenc runs with `--limit=1` (12101), so
12881+ // the stream codes exactly 1 frame. Asserted ABOVE the call.
12882+ assert_eq!(frames.len(), 1, "{NAME}: key frame");
1279112883 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());
1279212884 assert_eq!(frames.len(), theirs.len(), "{NAME}: frame count");
1279312885 let mut mismatched = 0usize;
@@ -13090,6 +13182,12 @@ pub(crate) mod tests {
1309013182 "{NAME}: cq={cq} no longer reads the inter var-tx tree for an intrabc block"
1309113183 );
1309213184 eprintln!("{NAME}: cq={cq} {blocks} intrabc block(s), {vartx} through var-tx");
13185+ // The ENCODE's frame count: `screen_intrabc_stream` (12022) renders
13186+ // `smptebars=size=128x96:rate=25` with `-t 0.2` and `-vf tile=2x2`
13187+ // (12066, 12069) -- 5 frames in, 1 tiled frame out -- and its aomenc
13188+ // runs with `--limit=1` (12101), so both cq arms code exactly 1
13189+ // frame. Asserted ABOVE the oracle call.
13190+ assert_eq!(frames.len(), 1, "{NAME}: cq={cq} key frame");
1309313191 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());
1309413192 assert_eq!(frames.len(), theirs.len(), "{NAME}: cq={cq} frame count");
1309513193 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {
@@ -13151,6 +13249,21 @@ pub(crate) mod tests {
1315113249 "{NAME}: only {headers} frame headers in the fixture"
1315213250 );
1315313251 let frames = decode_stream(&stream).unwrap_or_else(|e| panic!("{NAME}: {e}"));
13252+ // The frame count, and it comes from the WIRE, not from our decode: the
13253+ // loop above parsed this stream's own OBU frame headers with
13254+ // `Av1Parser` and counted `headers` of them (>= 3, from the arm's
13255+ // `--limit=3` at 13127, which overrides the helper's `--limit=1` because
13256+ // aomenc keeps the last occurrence of a repeated flag). Asserted ABOVE
13257+ // the oracle call, so a decode that showed fewer frames than the bitstream
13258+ // codes reds naming the wire instead of asking ffmpeg for the same short
13259+ // count. Deriving it from `headers` rather than a literal keeps the pin
13260+ // honest if aomenc's frame count ever drifts.
13261+ assert_eq!(
13262+ frames.len(),
13263+ headers,
13264+ "{NAME}: the stream codes {headers} frame(s), the decode showed {}",
13265+ frames.len()
13266+ );
1315413267 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());
1315513268 assert_eq!(frames.len(), theirs.len(), "{NAME}: frame count");
1315613269 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {
@@ -13356,15 +13469,19 @@ pub(crate) mod tests {
1335613469 Err(e) => panic!("{NAME}: decode failed on {arm} at {depth}-bit: {e}"),
1335713470 };
1335813471 let fired = decode::rect4_palette_hits() - before;
13472+ // The ENCODE's frame count, asserted ABOVE the oracle call: the
13473+ // y4m renders 5 frames (`-t 0.2` at every arm's `rate=25`,
13474+ // 13275) but aomenc is given `--limit=1` (13313), so the stream
13475+ // codes exactly 1 frame at both depths on every arm. Asserted
13476+ // here it is NOT the tautology the old comment below claimed:
13477+ // `frames.len() == 1` is a fact about the encode, checked before
13478+ // `frames.len()` is spent as ffmpeg's frame budget.
13479+ assert_eq!(frames.len(), 1, "{NAME}: {arm} at {depth}-bit key frame");
1335913480 let ffmpeg_frames = if depth == 10 {
1336013481 ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
1336113482 } else {
1336213483 ffmpeg_decode_sequence(&stream, width, height, frames.len())
1336313484 };
13364- // No frame-count assert here: `ffmpeg_decode_sequence{,_10bit}`
13365- // was handed `frames.len()` as its frame budget, so
13366- // `ffmpeg_frames.len() == frames.len()` holds by construction
13367- // and the assert was tautological.
1336813485 assert!(
1336913486 !frames.is_empty(),
1337013487 "{NAME}: {arm} at {depth}-bit decoded no frame"
@@ -15494,6 +15611,21 @@ pub(crate) mod tests {
1549415611 .map(|((label, _), d)| format!("{label}={d}"))
1549515612 .collect();
1549615613 let fired = fired.join(" ");
15614+ // The ENCODE's frame count, and it is this helper's `frames` PARAMETER
15615+ // (15446) -- not our decode's length. It is the same value handed to
15616+ // `encode_10bit_gradients_seed` (15469), which renders
15617+ // `frames / 25.0` seconds at `rate=25` (15928, 15940) and runs
15618+ // aomenc with no `--limit` of its own, so the stream codes exactly
15619+ // `frames` frames: 1 for the single-key-frame callers, 24 for the
15620+ // `--lag-in-frames=16` inter callers. Asserted ABOVE the oracle call,
15621+ // so a decode that showed fewer reds naming the encode rather than
15622+ // handing ffmpeg the same short count.
15623+ assert_eq!(
15624+ decoded.len(),
15625+ frames,
15626+ "{name}: seed {seed}: the encode codes {frames} frame(s), the decode showed {}",
15627+ decoded.len()
15628+ );
1549715629 let reference = ffmpeg_decode_sequence_10bit(&stream, width, height, decoded.len());
1549815630 assert_eq!(
1549915631 decoded.len(),
@@ -27633,8 +27765,12 @@ pub(crate) mod tests {
2763327765 "{NAME}: the stream decoded but no coded (non-skip) rect leaf fired -- \
2763427766 the gate proves nothing"
2763527767 );
27636- let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len());
27768+ // The ENCODE's frame count, asserted ABOVE the oracle call: the y4m is
27769+ // rendered with `-t 1` and `-vframes 1` (27566) -- one frame at the
27770+ // source's default rate 25 -- and aomenc runs with no `--limit` and
27771+ // `--kf-max-dist=0` (27593), so the stream codes exactly 1 frame.
2763727772 assert_eq!(frames.len(), 1, "{NAME}: expected one key frame");
27773+ let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len());
2763827774 assert_eq!(
2763927775 ffmpeg_frames.len(),
2764027776 frames.len(),
@@ -27761,8 +27897,13 @@ pub(crate) mod tests {
2776127897 // Counted only on an attempt that actually decoded AND is compared
2776227898 // below -- a refusal never contributes to the firing assert.
2776327899 let overrides = crate::decode::mode_mi_override_hits() - before;
27764- let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len());
27900+ // The ENCODE's frame count, asserted ABOVE the oracle call: the y4m is
27901+ // rendered ONCE outside this loop with `-t 1` and `-vframes 1`
27902+ // (27792) -- one frame at the source's default rate 25 -- and aomenc
27903+ // runs with no `--limit` and `--kf-max-dist=0` (27726), so both
27904+ // (rtx, filter_intra) arms code exactly 1 frame.
2776527905 assert_eq!(frames.len(), 1, "{NAME}: expected one key frame");
27906+ let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len());
2776627907 assert_eq!(
2776727908 ffmpeg_frames.len(),
2776827909 frames.len(),
@@ -27929,16 +28070,20 @@ pub(crate) mod tests {
2792928070 let cfl_blocks = crate::decode::cfl_block_hits() - before_cfl;
2793028071 let angle_blocks = crate::decode::uv_angle_delta_hits() - before_angle;
2793128072 let uv_overrides = crate::decode::uv_mode_mi_override_hits() - before_uv;
27932- let ffmpeg_frames = if depth == 10 {
27933- ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
27934- } else {
27935- ffmpeg_decode_sequence(&stream, width, height, frames.len())
27936- };
28073+ // The ENCODE's frame count, asserted ABOVE the oracle call: the y4m is
28074+ // rendered with `-t 1` and `-vframes 1` (27852) -- one frame at the
28075+ // source's default rate 25 -- and aomenc runs with no `--limit` and
28076+ // `--kf-max-dist=0` (27890), so both depths code exactly 1 frame.
2793728077 assert_eq!(
2793828078 frames.len(),
2793928079 1,
2794028080 "{NAME}: expected one key frame (depth={depth})"
2794128081 );
28082+ let ffmpeg_frames = if depth == 10 {
28083+ ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
28084+ } else {
28085+ ffmpeg_decode_sequence(&stream, width, height, frames.len())
28086+ };
2794228087 assert_eq!(
2794328088 ffmpeg_frames.len(),
2794428089 frames.len(),
@@ -28125,6 +28270,12 @@ pub(crate) mod tests {
2812528270 // Counters read only on an attempt that decoded AND is compared.
2812628271 let after = crate::decode::reelc_chroma_counters();
2812728272 let (skip_cfl, dir_pairs) = (after.0 - before.0, after.1 - before.1);
28273+ // The ENCODE's frame count: the y4m is rendered with `-t 1` and
28274+ // `-vframes 1` (28056) -- one frame at the source's default rate 25
28275+ // -- and aomenc runs with no `--limit` and `--kf-max-dist=0`
28276+ // (28088), so both depths code exactly 1 frame. Asserted ABOVE the
28277+ // oracle call.
28278+ assert_eq!(frames.len(), 1, "{NAME}: depth={depth} key frame");
2812828279 let ffmpeg_frames = if depth == 10 {
2812928280 ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
2813028281 } else {
@@ -28452,6 +28603,11 @@ pub(crate) mod tests {
2845228603 let after = crate::decode::ab16_hits_by_arm();
2845328604 let this: Vec<usize> = (0..4).map(|i| after[i] - before[i]).collect();
2845428605 eprintln!("{NAME}: {desc} decoded, arms this attempt={this:?}");
28606+ // The ENCODE's frame count: every attempt's y4m is rendered with
28607+ // `-t 1` and `-vframes 1` (28367) -- one frame whatever the source's
28608+ // rate -- and aomenc carries `--limit=1` (28401), so all six arms
28609+ // code exactly 1 frame. Asserted ABOVE the oracle call.
28610+ assert_eq!(frames.len(), 1, "{NAME}: {desc} key frame");
2845528611 let want = if a.ten_bit {
2845628612 ffmpeg_decode_sequence_10bit(&stream, a.w, a.h, frames.len())
2845728613 } else {
@@ -28606,6 +28762,18 @@ pub(crate) mod tests {
2860628762 eprintln!("x={start_x} cq={cq} rtx={rtx} fired={fired} REFUSED {e}")
2860728763 }
2860828764 Ok(frames) => {
28765+ // The ENCODE's frame count: the y4m is rendered with
28766+ // `-t 1` and `-vframes 1` (28747) -- one frame, and
28767+ // the sources carry no explicit `:rate=` so that
28768+ // `-vframes` is the binding bound -- and aomenc runs
28769+ // with `--kf-max-dist=0` and no `--limit`
28770+ // (28782), so all 126 arms code exactly 1 frame.
28771+ // This sweep asserts no verdict, but `bad` below is
28772+ // the NUMBER of mismatching frames it reports, so a
28773+ // decode that showed fewer frames than the wire
28774+ // would silently under-report it. Pinned here, above
28775+ // the oracle call, for that reason.
28776+ assert_eq!(frames.len(), 1, "x={start_x} cq={cq} rtx={rtx} key frame");
2860928777 let want = ffmpeg_decode_sequence(&stream, width, height, frames.len());
2861028778 let bad = frames
2861128779 .iter()
@@ -29209,6 +29377,12 @@ pub(crate) mod tests {
2920929377 .map(|((label, _), d)| format!("{label}={d}"))
2921029378 .collect();
2921129379 let fired = fired.join(" ");
29380+ // The ENCODE's frame count: `gradients_source` (6015) is rendered with
29381+ // `duration=0.04:rate=25` (29116) and `-frames:v 1` (29119) caps the
29382+ // y4m at one frame; aomenc runs with `--limit=1` and
29383+ // `--kf-max-dist=0` (29150) and so codes exactly that one. Asserted
29384+ // ABOVE the oracle call -- it holds for every one of the 16 seeds.
29385+ assert_eq!(frames.len(), 1, "{NAME}: seed {seed} key frame");
2921229386 let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len());
2921329387 assert_eq!(
2921429388 frames.len(),
@@ -30643,6 +30817,12 @@ pub(crate) mod tests {
3064330817 // r4: the pixel filters are wired -- every `uses_lr`
3064430818 // frame must now decode Ok AND match an independent
3064530819 // decoder pixel-exact, not just refuse cleanly.
30820+ // The ENCODE's frame count: every `EC_FISTRIP_SRC` branch
30821+ // and the `gradients_source` default (30568-30573) render at
30822+ // `rate=25` with a 1-frame `duration=0.04`, and aomenc runs
30823+ // with no `--limit` (30590) -- so each attempt's stream codes
30824+ // exactly 1 frame. Asserted ABOVE the oracle call.
30825+ assert_eq!(pics.len(), 1, "{NAME}: seed {seed} key frame");
3064630826 let reference = ffmpeg_decode_sequence(&stream, width, height, pics.len());
3064730827 let mismatched = pics
3064830828 .iter()
@@ -38221,6 +38401,20 @@ pub(crate) mod tests {
3822138401 };
3822238402 let after = crate::decode::edge32_hits();
3822338403 let delta: Vec<usize> = (0..8).map(|i| after[i] - before[i]).collect();
38404+ // The ENCODE's frame count, and it is PER ARM: the arm tuple's
38405+ // `frame_count` field is what the y4m is built from
38406+ // (`duration = frame_count / 25.0`, 38085, rendered with
38407+ // `-t {duration}` at 38131) and this gate's aomenc carries no
38408+ // `--limit` and no `--lag-in-frames`, so the stream codes exactly
38409+ // `frame_count` frames (1 for the intra arms, 5 for the
38410+ // inter/straddling ones). Asserted ABOVE the oracle call, so a
38411+ // decode that dropped one reds naming the encode.
38412+ assert_eq!(
38413+ decoded.len(),
38414+ frame_count,
38415+ "{name}: {tag}: the encode codes {frame_count} frame(s), the decode showed {}",
38416+ decoded.len()
38417+ );
3822438418 let reference = if ten_bit {
3822538419 ffmpeg_decode_sequence_10bit(&stream, width, height, decoded.len())
3822638420 } else {
@@ -41949,6 +42143,15 @@ pub(crate) mod tests {
4194942143 }
4195042144 let rect4_now = (crate::decode::sb_rect4_horz_hits() - rect4_before.0)
4195142145 + (crate::decode::sb_rect4_vert_hits() - rect4_before.1);
42146+ // The ENCODE's frame count: `rectchroma_stream` (42059) renders
42147+ // `duration=0.04:rate=25` (42082) with `-t 0.04` (42094) -- one
42148+ // frame -- and its aomenc runs with no `--limit`, so every
42149+ // attempt's stream codes exactly 1 frame at both depths.
42150+ assert_eq!(
42151+ frames.len(),
42152+ 1,
42153+ "{NAME}: {bit_depth}-bit cq {cq} seed {seed} key frame"
42154+ );
4195242155 let reference = if bit_depth == 10 {
4195342156 ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
4195442157 } else {
@@ -42186,6 +42389,11 @@ pub(crate) mod tests {
4218642389 let stream = rectchroma_stream(bit_depth, 32, 4, width, height);
4218742390 let frames = decode_stream(&stream)
4218842391 .unwrap_or_else(|e| panic!("{NAME}: {bit_depth}-bit seed 46 refused: {e}"));
42392+ // The ENCODE's frame count: `rectchroma_stream` (42059) renders
42393+ // `duration=0.04:rate=25` (42082) with `-t 0.04` (42094) -- one frame
42394+ // -- and its aomenc runs with no `--limit`, so the stream codes
42395+ // exactly 1 frame at both depths. Asserted ABOVE the oracle call.
42396+ assert_eq!(frames.len(), 1, "{NAME}: {bit_depth}-bit seed 46 key frame");
4218942397 let reference = if bit_depth == 10 {
4219042398 ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
4219142399 } else {
@@ -42355,6 +42563,15 @@ pub(crate) mod tests {
4235542563 }
4235642564 Ok(frames) => frames,
4235742565 };
42566+ // The ENCODE's frame count: `duration=0.04:rate=25` (42263) is
42567+ // one frame and `-t 0.04` (42277) caps the y4m there, and aomenc
42568+ // runs with no `--limit` -- so every arm (both depths, all 10
42569+ // seeds) codes exactly 1 frame. Asserted ABOVE the oracle call.
42570+ assert_eq!(
42571+ frames.len(),
42572+ 1,
42573+ "{NAME}: {bit_depth}-bit seed {seed} key frame"
42574+ );
4235842575 let reference = if bit_depth == 10 {
4235942576 ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
4236042577 } else {
@@ -42564,6 +42781,16 @@ pub(crate) mod tests {
4256442781 };
4256542782 let hits = crate::decode::edge_part_hits();
4256642783 let skip_split_tx = crate::decode::skip_split_tx_hits();
42784+ // The ENCODE's frame count: `-t 1` AND `-vframes 1` (42490)
42785+ // cap the y4m at one frame and aomenc is given that one frame
42786+ // with no `--limit`, so every arm's stream holds exactly 1
42787+ // coded frame. Asserted ABOVE the oracle call so a decode that
42788+ // dropped it reds naming the encode.
42789+ assert_eq!(
42790+ frames.len(),
42791+ 1,
42792+ "{NAME}: {width}x{height} depth={depth} key frame"
42793+ );
4256742794 let ffmpeg_frames = if depth == 10 {
4256842795 ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
4256942796 } else {
@@ -42790,6 +43017,18 @@ pub(crate) mod tests {
4279043017 }
4279143018 };
4279243019 let narrow = crate::mc::rect_narrow_kern_hits();
43020+ // The ENCODE's frame count, asserted ABOVE the oracle call, not
43021+ // our decode's length: `-vframes {FRAMES}` (42696) feeds aomenc
43022+ // exactly FRAMES frames and `--limit={FRAMES}` (42724) caps its
43023+ // output there. A decode that dropped a frame must red HERE,
43024+ // naming the encode, rather than hand the same short count to
43025+ // ffmpeg and let the helper's byte-length assert blame ffmpeg.
43026+ assert_eq!(
43027+ frames.len(),
43028+ FRAMES,
43029+ "{NAME}: not every coded frame was decoded ({width}x{height}, \
43030+ depth={depth}, cq={cq})"
43031+ );
4279343032 let ffmpeg_frames = if depth == 10 {
4279443033 ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
4279543034 } else {
@@ -42800,12 +43039,6 @@ pub(crate) mod tests {
4280043039 frames.len(),
4280143040 "{NAME}: ffmpeg frame count ({width}x{height}, depth={depth}, cq={cq})"
4280243041 );
42803- assert_eq!(
42804- frames.len(),
42805- FRAMES,
42806- "{NAME}: not every coded frame was decoded ({width}x{height}, \
42807- depth={depth}, cq={cq})"
42808- );
4280943042 for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
4281043043 assert_eq!(
4281143044 got.y, want.y,
lanes/av1pinspec.report.mdadded+346 -0
@@ -0,0 +1,346 @@
1+# lane-av1pinspec — give each of the 43 unpinned count sites a spec-derived pin
2+
3+Branch `lane-av1pinspec`, worktree `~/.cache/wt/av1pinspec`, base `3b691e13` (wave-3e
4+main, with `pins5` + `txsizeaudit-r5` already merged). **Ten commits, test/comment
5+changes only — no decoder logic, and `decode.rs` is not touched at all.**
6+
7+```
8+8a8a9717 gate_coverage: lower the count-vacuity unpinned ceiling 43 -> 2
9+2375641e stream: pin the encode's frame count above 7 oracle calls (palette, rect-tx tool, screen intrabc, 16x4 pair)
10+38cf6255 stream: pin the encode's frame count in the intrabc rect/census family
11+37bc27ef stream: pin the ignored rect-tx recipe sweep and the 32-level AB gate
12+95e950fa stream: pin the restoration sweep and edge32_gate, whose spec is a parameter
13+71a190aa stream: pin the band and chroma-rect sweep family to one frame each
14+d960f5d3 stream: hoist the narrow-kernel gate's FRAMES assert above its oracle call
15+b5a45b2d stream: pin four more oracle counts, one of them off the wire itself
16+c887fa7f stream: pin eight single-key-frame oracle counts, three of them by hoisting
17+```
18+
19+## 0. The fix shape, and what it changes about what a site counts
20+
21+Every fix adds **the ENCODE's own frame count** as an `assert_eq!` **above** the
22+`ffmpeg_decode_sequence*` call, so the value later spent as ffmpeg's frame budget is
23+already proven against the encode instead of read off our own decode.
24+
25+**It does not change what a site counts.** The call still spends `frames.len()`; the
26+assert above it makes that value a spec. This is deliberate, and it is the shape the
27+**17 already-pinned sites** already use — e.g. `stream.rs:5571` asserts
28+`decoded.len() == 4` and `:5576` then spends `decoded.len()` as ffmpeg's budget. The
29+sweep's population therefore stays at **60** and the change is visible as
30+`17 -> 58 spec-pinned` rather than as sites quietly disappearing.
31+
32+The alternative — spending a named constant in place of `.len()`, the r7 shape at
33+`stream.rs:3895` — is strictly stronger per site, but it deletes the site from the
34+sweep, and 43 deletions would put the population at 17 against a **floor of 40**
35+(`gate_coverage.rs:2390`). The floor is not lowered here, so the assert-above shape is
36+the one that keeps the class enumerable. That trade is the one judgement call in this
37+lane; everything else is mechanical.
38+
39+**Why the assert must sit above the call, in one line.** A wrong count reds either
40+way, but with the assert below, `ffmpeg_decode_sequence` has already been handed the
41+same short count, so its `out.stdout.len() == frame_bytes * frames` assert fires
42+first and the message blames ffmpeg for a number our decoder chose — the
43+misattributed-red class this whole sweep exists to name. Above the call, the failure
44+names the encode.
45+
46+## 1. The sweep line, before and after
47+
48+BEFORE, on `3b691e13`:
49+
50+```
51+$ cargo test -p ec-av1 --lib -- count_vacuity_tests::every_locally_derived_oracle_count_is_reported --nocapture
52+count-vacuity sweep: 60 site(s); 17 spec-pinned by a prior assert, 43 not
53+```
54+
55+AFTER:
56+
57+```
58+$ cargo test -p ec-av1 --lib -- count_vacuity_tests --nocapture
59+count-vacuity sweep: 60 site(s); 58 spec-pinned by a prior assert, 2 not
60+ROW 5631 | an_svt_screen_palette_block_with_a_split_transform_decodes_exactly | decoded.len() | bucket=a | candidate=- | spec_in_scope=- | stream read from disk: count belongs to the pin | pixel_comparing=true
61+ROW 30924 | a_real_aomenc_stream_with_restoration_reads_lr_symbols_correctly | pics.len() | bucket=b | candidate=- | spec_in_scope=- | live aomenc encode: count belongs to the encoder | pixel_comparing=true
62+test gate_coverage::count_vacuity_tests::every_locally_derived_oracle_count_is_reported ... ok
63+test gate_coverage::count_vacuity_tests::the_count_vacuity_sweep_finds_the_known_sites ... ok
64+test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 760 filtered out
65+```
66+
67+**`43 -> 2`. No site disappeared** — 60 before, 60 after — so the ceiling moves
68+**down** `43 -> 2` because 41 sites stopped being unpinned. The ceiling is not
69+raised. The floor (`>= 40` sites) and the `frames.len()` shape anchor are untouched.
70+
71+## 2. The 43-row table
72+
73+`b:` = line on `3b691e13`, `a:` = line on `lane-av1pinspec` (the sweep's own numbers
74+after the change). `value` is what the new assert compares against.
75+
76+| b: | a: | gate | expr | value | bucket | disposition |
77+|---|---|---|---|---|---|---|
78+| 5631 | 5631 | `an_svt_screen_palette_block_with_a_split_transform_decodes_exactly` | `decoded.len()` | — | **b** | hand forward, §3 |
79+| 10513 | 10522 | `a_real_aomenc_palette_stream_with_8x8_leaves_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed |
80+| 10732 | 10758 | `rect_tx_tool_gate` | `decoded.len()` | `15` | a | fixed |
81+| 10734 | 10760 | `rect_tx_tool_gate` | `decoded.len()` | `15` | a | fixed (one assert covers both) |
82+| 11212 | 11248 | `a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips` | `frames.len()` | `1` | a | fixed |
83+| 11383 | 11422 | `a_16x4_intrabc_pair_strip_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed, assert hoisted |
84+| 11455 | 11500 | `a_lossless_16x4_chroma_pair_repairs_the_measured_site` | `frames.len()` | `1` | a | fixed |
85+| 11838 | 11888 | `a_coded_rect_intrabc_block_reconstructs_in_both_orientations` (arms) | `frames.len()` | `1` | a | fixed |
86+| 11981 | 12041 | same gate (skip_arms) | `frames.len()` | `1` | a | fixed |
87+| 12224 | 12292 | `an_sb128_screen_stream_with_intrabc_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed |
88+| 12226 | 12294 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) |
89+| 12612 | 12689 | `a_sub8_leaf_census_over_intrabc_screen_streams_measures_the_sub8_refusal` | `frames.len()` | `1` | a | fixed |
90+| 12687 | 12773 | `an_intrabc_vartx_census_measures_the_mixed_leaf_refusal` | `frames.len()` | `1` | a | fixed |
91+| 12791 | 12883 | `a_real_aomenc_intrabc_mixed_vartx_tree_decodes_without_the_mixed_leaf_refusal` | `frames.len()` | `1` | a | fixed |
92+| 13093 | 13191 | `an_intrabc_block_under_tx_mode_select_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed |
93+| 13154 | 13267 | `a_real_aomenc_stream_with_cdf_update_disabled_decodes_pixel_exact` | `frames.len()` | wire frame headers | a | fixed |
94+| 13360 | 13481 | `a_real_aomenc_rect_strip_palette_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed |
95+| 13362 | 13483 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) |
96+| 15497 | 15629 | `ten_bit_tool_gate` (the sweep labels the gate `first_diff`) | `decoded.len()` | `frames` param | a | fixed |
97+| 27636 | 27773 | `a_real_aomenc_stream_with_a_coded_rect_strip_below_16x16_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed, assert hoisted |
98+| 27764 | 27906 | `a_real_aomenc_stream_whose_square_block_reads_a_sub16_neighbours_mode_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed, assert hoisted |
99+| 27933 | 28083 | `a_real_aomenc_stream_whose_chroma_edge_filter_reads_a_sub16_neighbours_uv_mode_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed, assert hoisted |
100+| 27935 | 28085 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) |
101+| 28129 | 28280 | `a_real_aomenc_sb128_stream_whose_skipped_cfl_and_1to4_chroma_pairs_decode_pixel_exact` | `frames.len()` | `1` | a | fixed |
102+| 28131 | 28282 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) |
103+| 28456 | 28612 | `a_real_aomenc_stream_with_ab_partitions_below_16x16_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed |
104+| 28458 | 28614 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) |
105+| 28609 | 28777 | `sweep_rectx_recipes` (`#[ignore]`) | `frames.len()` | `1` | a | fixed |
106+| 29212 | 29386 | `a_real_aomenc_stream_with_a_32_level_ab_partition_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed |
107+| 30646 | 30826 | `a_real_aomenc_stream_with_restoration_reads_lr_symbols_correctly` | `pics.len()` | `1` | a | fixed |
108+| 30744 | 30924 | same gate — a `///` doc comment | `pics.len()` | — | **c** | not a count, §3 |
109+| 38225 | 38419 | `edge32_gate` | `decoded.len()` | `frame_count` (arm) | a | fixed |
110+| 38227 | 38421 | `edge32_gate`, 8-bit arm | `decoded.len()` | `frame_count` (arm) | a | fixed (one assert covers both) |
111+| 41953 | 42156 | `a_real_aomenc_stream_with_a_coded_strip_whose_chroma_is_a_4to1_or_sub8_rect_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed |
112+| 41955 | 42158 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) |
113+| 42190 | 42398 | `the_chroma_rect_gates_excluded_seed_46_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed |
114+| 42192 | 42400 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) |
115+| 42359 | 42572 | `a_real_aomenc_band_stream_seed46_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed |
116+| 42361 | 42574 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) |
117+| 42568 | 42787 | `a_real_aomenc_stream_whose_frame_edge_partition_bit_is_horz_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed |
118+| 42570 | 42789 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) |
119+| 42794 | 43025 | `a_real_aomenc_rect_inter_block_predicts_chroma_with_the_narrow_kernel_pixel_exact` | `frames.len()` | `FRAMES` (=6) | a | fixed, assert hoisted |
120+| 42796 | 43027 | same gate, 8-bit arm | `frames.len()` | `FRAMES` (=6) | a | fixed (one assert covers both) |
121+
122+**41 fixed, 1 handed forward (b), 1 not a count at all (c).** 6+8+4+8+2+3+8+2 = 41
123+sites across the eight `stream.rs` commits.
124+
125+## 3. The two that are not fixed, and why
126+
127+**(b) `stream.rs:5631` — `an_svt_screen_palette_block_with_a_split_transform_decodes_exactly`.**
128+The stream is named by `EC_AV1_SVT1_STREAM` (`:5609`) and read from that path
129+(`:5617`). It is **not a committed pin** — the gate's own doc comment says the crop is
130+never committed to `fixtures/` — so no encode recipe, no `--limit`, no `-frames:v`
131+and no frame count exists anywhere in the tree for it. The "12-frame stream" in the
132+doc comment (`:5592`) is prose about one capture, and the env var accepts any file, so
133+asserting `12` would pin a number nothing can check. The one derivable alternative is
134+to count the stream's own OBU frame headers with `Av1Parser` (the shape used at
135+`:13267`; the parser is already imported at `:19`), which would make the count
136+wire-derived instead of decode-derived. Deliberately not done: the gate **SKIPs** on
137+any box without that env var (the battery reports it `ok` in 0 s here), so such an
138+assert would ship unexercised, and an OBU header count over-counts whenever the stream
139+carries `show_existing_frame`, which cannot be checked without the bytes. Handed
140+forward with the recipe.
141+
142+**(c) `stream.rs:30744` (now `:30924`) — a `///` DOC COMMENT, not a count.**
143+The matched line is
144+
145+```
146+/// let reference = ffmpeg_decode_sequence(&stream, 192, 128, pics.len());
147+```
148+
149+a quoted fragment of the pre-r4 body of `pinned_lr_sgr_stream_call_unique_dump`, in
150+the doc comment that explains why that gate now takes its count from `FRAMES`. The
151+sweep scans raw source lines and cannot tell a doc comment from code. The gate it
152+describes is already correct: it calls `ffmpeg_decode_sequence(&stream, W, H, FRAMES)`
153+with `const FRAMES: usize = 1;` and asserts `pics.len() == FRAMES`. Left in place and
154+reported; making the scanner comment-aware is a change to the guard, not a fix to a
155+count.
156+
157+## 4. Where each derived value comes from
158+
159+Six derivations, every one read out of the gate's own encode call:
160+
161+1. **`-frames:v 1` / `-vframes 1` on the y4m** — `a_16x4_intrabc_pair_strip`
162+ (`:11333`), `a_lossless_16x4_chroma_pair_repairs_the_measured_site` (`:11414`),
163+ `..._coded_rect_strip_below_16x16` (`:27566`),
164+ `..._square_block_reads_a_sub16_neighbours_mode` (`:27793`),
165+ `..._chroma_edge_filter_reads_a_sub16_neighbours_uv_mode` (`:27852`),
166+ `..._skipped_cfl_and_1to4_chroma_pairs` (`:28056`),
167+ `..._ab_partitions_below_16x16` (`:28367`),
168+ `..._a_32_level_ab_partition` (`:29119`),
169+ `..._frame_edge_partition_bit_is_horz` (`:42490`),
170+ `sweep_rectx_recipes` (`:28747`). Where the source carries no `:rate=`, `-vframes`
171+ is the binding bound.
172+2. **`--limit=1`** — the 8x8-leaf palette gate (`:10467`), the screen key-frame
173+ intrabc gate (`:11145`), both loops of the rect-intrabc gate (`:11797`, `:11945`),
174+ `an_sb128_screen_stream_with_intrabc` and everything below it through
175+ `screen_intrabc_stream_at_depth` (`:12101`), the rect-strip-palette gate
176+ (`:13313`), and the band/chroma-rect family whose helper renders
177+ `duration=0.04:rate=25` with `-t 0.04` and no limit (`:42082`, `:42094`, `:42263`,
178+ `:42277`).
179+3. **`--limit=1` over `-t 0.2` at `rate=25` with `-vf tile=2x2`** — 5 input frames,
180+ 1 tiled output frame: the two intrabc censuses, the mixed vart-x tree gate and the
181+ tx-mode-select gate.
182+4. **`rate=25 x -t 0.60`, no `--limit`** — `rect_tx_tool_gate`, 15 frames (`:10690`).
183+ The one multi-frame site; the count is named `const ENCODED_FRAMES: usize = 15;`
184+ because 15 is an arithmetic fact about the fixture, not a flag someone typed.
185+5. **A value already in scope at the call** — `const FRAMES: usize = 6`
186+ (`a_real_aomenc_rect_inter_block_predicts_chroma_with_the_narrow_kernel`, `:42670`,
187+ driving both `-vframes {FRAMES}` and `--limit={FRAMES}`); `ten_bit_tool_gate`'s own
188+ `frames` parameter (`:15446`, the same value handed to
189+ `encode_10bit_gradients_seed` at `:15469` — 1 for the key-frame callers, 24 for the
190+ `--lag-in-frames=16` inter ones); `edge32_gate`'s per-arm `frame_count` tuple field,
191+ which is what the y4m is built from (`duration = frame_count / 25.0`, `:38117`) and
192+ which aomenc runs uncapped, so 1 for the intra arms and 5 for the inter/straddling
193+ ones.
194+6. **The wire itself** — `a_real_aomenc_stream_with_cdf_update_disabled` asserts
195+ `frames.len() == headers`, where `headers` is this stream's own OBU frame-header
196+ count, parsed with `Av1Parser` in the loop already sitting above the call
197+ (`:13133-13147`). Derived from the bitstream rather than a literal, because the arm
198+ overrides the helper's `--limit=1` with `--limit=3` (`:13127`) and aomenc keeps the
199+ last occurrence of a repeated flag — so a literal `3` would be a claim about flag
200+ precedence, and `headers` is the fact.
201+
202+## 5. Red-before
203+
204+### 5a. Per group — the guard's own message, one run per commit
205+
206+Each group's edits un-applied, the real guard run, then the tree restored:
207+
208+| commit | group | sites | guard says |
209+|---|---|---|---|
210+| `2375641e` | A palette / rect-tx tool / screen intrabc / 16x4 | 6 | `8 unpinned count site(s), ceiling is 2` |
211+| `38cf6255` | B intrabc rect + census family | 8 | `10 unpinned count site(s), ceiling is 2` |
212+| `b5a45b2d` | C cdf-update / rect-strip-palette / ten_bit_tool_gate | 4 | `6 unpinned count site(s), ceiling is 2` |
213+| `c887fa7f` | D single-key-frame gates | 8 | `10 unpinned count site(s), ceiling is 2` |
214+| `37bc27ef` | E ignored sweep + 32-level AB | 2 | `4 unpinned count site(s), ceiling is 2` |
215+| `95e950fa` | F restoration sweep + edge32_gate | 3 | `5 unpinned count site(s), ceiling is 2` |
216+| `71a190aa` | G band + chroma-rect family | 8 | `10 unpinned count site(s), ceiling is 2` |
217+| `d960f5d3` | H narrow-kernel | 2 | `4 unpinned count site(s), ceiling is 2` |
218+
219+Every row is `2 + that group's sites` against a ceiling of `2`, and every row is
220+`test result: FAILED`. Since the ceiling equals the number of sites that survive the
221+whole lane, **removing any one of the 41 asserts puts unpinned at 3 and reds the same
222+assert** — the constant and the per-group revert together are the per-site proof.
223+
224+Whole-branch revert, same result:
225+
226+```
227+$ git checkout 3b691e13 -- crates/ec-av1/src/stream.rs # ceiling stays 2
228+$ cargo test -p ec-av1 --lib -- count_vacuity_tests
229+thread '...' panicked at crates/ec-av1/src/gate_coverage.rs:2441:9:
230+43 unpinned count site(s), ceiling is 2 -- a new one was added (lower the ceiling only when a site is actually fixed)
231+test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 760 filtered out
232+```
233+
234+### 5b. The new asserts themselves bite — value mutation
235+
236+One mutation per **derivation shape**, all six applied at once, on the real gates:
237+
238+```
239+$ cargo test -p ec-av1 --lib -- --test-threads=4 <the six gates>
240+---- a_real_aomenc_8bit_stream_with_a_rect_transform_decodes_pixel_exact stdout ----
241+assertion `left == right` failed: ...[cq20/tx1]: the encode codes 14 frames, the decode showed 15
242+ left: 15
243+ right: 14
244+---- a_real_aomenc_10bit_rect_and_ab_partitions_decode_pixel_exact stdout ----
245+assertion `left == right` failed: ... seed 42: the encode codes 24 frame(s), the decode showed 24
246+ left: 24
247+ right: 25
248+---- a_frame_edge_straddling_band_decodes_pixel_exact stdout ----
249+assertion `left == right` failed: ... 192x68 cq35 frames=5 10bit=false tile_cols=0: the encode codes 5 frame(s), the decode showed 5
250+ left: 5
251+ right: 6
252+---- a_16x4_intrabc_pair_strip_decodes_pixel_exact stdout ----
253+assertion `left == right` failed: a_16x4_intrabc_pair_strip_decodes_pixel_exact: expected one key frame
254+ left: 1
255+ right: 2
256+---- a_real_aomenc_stream_with_cdf_update_disabled_decodes_pixel_exact stdout ----
257+assertion `left == right` failed: ... the stream codes 3 frame(s), the decode showed 3
258+ left: 3
259+ right: 4
260+---- a_real_aomenc_rect_inter_block_predicts_chroma_with_the_narrow_kernel_pixel_exact stdout ----
261+assertion `left == right` failed: ... not every coded frame was decoded (192x128, depth=8, cq=20)
262+ left: 6
263+ right: 5
264+
265+test result: FAILED. 0 passed; 6 failed; 0 ignored; 0 measured; 756 filtered out
266+```
267+
268+The mutations were `ENCODED_FRAMES 15 -> 14`, `frames -> frames + 1`,
269+`frame_count -> frame_count + 1`, `1 -> 2`, `headers -> headers + 1`,
270+`FRAMES -> FRAMES - 1`. Every mutant fails, and **the "decode showed" column is the
271+proof the derived values are right, not just that the asserts exist**: this decoder
272+really produces 15 / 24 / 5 / 1 / 3 / 6 frames on those six fixtures, and the number
273+came out of the encode recipe, not out of the decode. Reverted, and all six green
274+again.
275+
276+## 6. Green
277+
278+Compile clean, no warnings:
279+
280+```
281+$ cargo check -p ec-av1 --all-targets
282+ Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.14s
283+```
284+
285+Every gate this lane touched, plus the whole `gate_coverage` module, plus all nine
286+`ten_bit_tool_gate` callers and all three `edge32_gate` callers — 57 tests,
287+`aomenc` present and required (`EC_AV1_REQUIRE_AOMENC=1`):
288+
289+```
290+$ cargo test -p ec-av1 --lib -- --test-threads=4 <39 gates> gate_coverage
291+test result: ok. 57 passed; 0 failed; 0 ignored; 0 measured; 705 filtered out; finished in 128.10s
292+```
293+
294+The `#[ignore]`d one is run explicitly:
295+
296+```
297+$ cargo test -p ec-av1 --lib -- --ignored sweep_rectx_recipes
298+test stream::tests::sweep_rectx_recipes ... ok
299+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 761 filtered out; finished in 14.72s
300+```
301+
302+And the acceptance filter:
303+
304+```
305+$ cargo test -p ec-av1 --lib -- gate_coverage pin_inventory count_vacuity
306+test gate_coverage::pin_inventory_tests::the_pin_scanner_sees_every_shape ... ok
307+test gate_coverage::pin_inventory_tests::the_pin_scanner_sees_the_directory_literal_shape ... ok
308+test gate_coverage::count_vacuity_tests::every_locally_derived_oracle_count_is_reported ... ok
309+test gate_coverage::count_vacuity_tests::the_count_vacuity_sweep_finds_the_known_sites ... ok
310+test gate_coverage::pin_inventory_tests::every_pin_a_gate_reads_is_committed_under_the_crate ... ok
311+test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 755 filtered out
312+```
313+
314+## 7. Two things worth recording
315+
316+**A first attempt at the commit split corrupted one hunk, and the guard caught
317+nothing.** `git apply --cached --unidiff-zero` re-anchors a hunk by line number
318+alone, so the narrow-kernel assert landed inside a *refusal* arm — inside the
319+`if msg.contains("unsupported")` block, before its `continue` — where it would only
320+have run on arms the gate had already decided not to compare. The lane's own green
321+run would not have noticed, because the compared arms never reach that line. The
322+commits were rebuilt with exact-text, context-anchored replacement and an
323+`assert count == 1`, and the assembled branch was then checked **byte-identical** to
324+the tree the battery and the mutation run had been executed against. A commit-splitting
325+tool that can drop a gate assertion silently needs the same red-before discipline as
326+the code it is splitting.
327+
328+**The global `pre-commit` hook re-runs rustfmt on staged Rust** (`core.hooksPath` ->
329+`~/.omp/agent/hooks/git`), so two of the new asserts are committed wrapped across
330+lines even though they fit in 100 columns. Left as the hook produced them; the two
331+forms are the same assert with the same operands, and the wrapped form is what the
332+final verification run in §6 was executed against.
333+
334+## 8. Not done / deferred
335+
336+- `stream.rs:5631` (the SVT gate) — no derivable frame count; the exact recipe and
337+ the two reasons not to guess are in §3.
338+- The `///` doc-comment site the sweep cannot see — left as-is and reported, §3.
339+- The *value* mutation in §5b runs one gate per derivation shape (six), not all 41
340+ individually. The guard-level per-group revert in §5a is the per-site proof; §5b is
341+ what shows the asserts bite on the gates themselves.
342+- `an_svt_screen_palette_block_with_a_split_transform_decodes_exactly` and the
343+ census gates' `pixel_comparing` column are the guard's own approximation, not a
344+ re-measurement; the classification in §2 is from reading the gates, and each row
345+ records the value that reading produced.
346+- No full `cargo test -p ec-av1` run — project-wide validation is Main's.