diff --git a/crates/ec-av1/src/gate_coverage.rs b/crates/ec-av1/src/gate_coverage.rs index ac83f388..89f83c43 100644 --- a/crates/ec-av1/src/gate_coverage.rs +++ b/crates/ec-av1/src/gate_coverage.rs @@ -2592,8 +2592,30 @@ mod count_vacuity_tests { // A CEILING on the unpinned population, so a NEW site cannot be added // silently. Lower it as sites are fixed; a fix that does not lower it is // still a fix, but a NEW site is an immediate red. + // + // lane-av1pinspec: 43 -> 2. Each of the 41 fixes adds the ENCODE's own + // frame count as an `assert_eq!` ABOVE the `ffmpeg_decode_sequence*` + // call (`-frames:v 1` / `-vframes 1` / `--limit=N` / a helper's `frames` + // parameter / the arm tuple's `frame_count` / the wire's own OBU frame + // headers), so the count handed to the oracle is a value already proven + // against the encode instead of read off our decode. The two that remain + // are the two that are not a count to fix: + // * `an_svt_screen_palette_block_with_a_split_transform_decodes_exactly` + // reads the path `EC_AV1_SVT1_STREAM` names, and that crop is not + // committed to `fixtures/`, so no `--limit`, no `-frames:v` and no + // frame count exists anywhere in the tree for it. The doc comment's + // "12-frame stream" is prose about one capture and the env var + // accepts any file, so asserting 12 would pin a number nothing can + // check. Counting the stream's own OBU frame headers with + // `Av1Parser` would derive one, and is left on the table + // deliberately: the gate SKIPs on any box without that env var, so + // such an assert would ship unexercised. + // * a `///` DOC COMMENT quoting the pre-r4 body of + // `pinned_lr_sgr_stream_call_unique_dump`, which this line-based + // scan cannot tell from code. The gate it describes already spends + // `FRAMES` and asserts `pics.len() == FRAMES`. + const UNPINNED_CEILING: usize = 2; let unpinned = s.iter().filter(|x| x.pinned_by.is_none()).count(); - const UNPINNED_CEILING: usize = 43; assert!( unpinned <= UNPINNED_CEILING, "{unpinned} unpinned count site(s), ceiling is {UNPINNED_CEILING} -- a new one \ diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 3b8bfeea..aba2aa92 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -10502,6 +10502,15 @@ pub(crate) mod tests { match decoded { Ok(frames) => { assert!(!frames.is_empty(), "{NAME}: {arm} decoded no frame"); + // The ENCODE's frame count: the per-arm + // render (10417) builds + // `{src}=size=128x128:rate=25` with `-t 0.04` + // (10427) -- one frame -- and the aomenc args + // carry `--limit=1` (10467), so every + // (src, depth, cq, txs, tiles) arm codes + // exactly 1 frame. Asserted ABOVE the oracle + // call. + assert_eq!(frames.len(), 1, "{NAME}: {arm} key frame"); let theirs = if depth == 10 { ffmpeg_decode_sequence_10bit( &stream, @@ -10728,6 +10737,23 @@ pub(crate) mod tests { // report can still say whether the arm fired. let parts = decode::rect_partition_hits() - parts_before; let tus = decode::rect_coeff_tu_hits() - tus_before; + // The ENCODE's frame count: the fixture renders `mandelbrot=size=64x64:rate=25` + // with `-t "0.60"` (10677-10691) -- 25 x 0.60 = 15 frames -- and the + // caller's `args` carry no `--limit` (10823-10853), so every arm's stream + // codes all 15. Asserted ABOVE the oracle call, which is the fix for the + // misattribution this gate's own doc comment records: the + // `--enable-tx-size-search=0` arm is a stream ffmpeg cannot decode past + // frame 6 of 15, and with the count taken from our decode the helper's + // byte-length assert fires FIRST and reads as an ffmpeg fault. Naming the + // 15 here makes the shortfall ours to explain. + const ENCODED_FRAMES: usize = 15; + assert_eq!( + decoded.len(), + ENCODED_FRAMES, + "{name}: the encode codes {ENCODED_FRAMES} frames, the decode showed {} (rect \ + partitions {parts}, rect coefficient TUs {tus})", + decoded.len() + ); let reference = if ten_bit { ffmpeg_decode_sequence_10bit(&stream, width, height, decoded.len()) } else { @@ -11208,12 +11234,18 @@ pub(crate) mod tests { reconstruction is not ported, it must refuse by name" ); assert!(!frames.is_empty(), "{NAME}: {arm} decoded no frame"); + // The ENCODE's frame count, asserted ABOVE the oracle call: + // the per-arm render (11100) uses `-t 0.2` at TS/SB's + // `rate=25` (10987, 10988) -- 5 input frames -- and the aomenc + // args carry `--limit=1` (11145), so all eight arms code + // exactly 1 frame. The old comment below claimed a count + // assert here would be tautological; that is true of + // `ffmpeg_frames.len() == frames.len()` and false of this: + // `frames.len() == 1` is a fact about the ENCODE, checked + // before `frames.len()` is spent as ffmpeg's frame budget. + assert_eq!(frames.len(), 1, "{NAME}: {arm} key frame"); let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len()); - // No frame-count assert here: `ffmpeg_decode_sequence` was - // handed `frames.len()` as its frame budget, so - // `ffmpeg_frames.len() == frames.len()` holds by - // construction and the assert was tautological. // EVERY frame is compared; an arm whose decode never hit an // intrabc block proves nothing about the DV/prediction path, // so it is counted OUT OF SCOPE -- but a mismatch there is @@ -11380,8 +11412,14 @@ pub(crate) mod tests { crate::decode::rect4_16_intrabc_hits() > 0, "{NAME}: no 16x4/4x16 intrabc strip -- the pair body was not reached" ); + // The ENCODE's frame count, asserted ABOVE the oracle call: the y4m is + // rendered with `-frames:v 1` (11333) -- a single frame of + // `testsrc2=s=640x480:r=25` -- and aomenc runs with + // `--limit=1 --kf-max-dist=1` (11355, 11356), so the stream codes + // exactly 1 key frame. Below the call this assert could not fire + // first: `ffmpeg_decode_sequence` was already handed `frames.len()`. + assert_eq!(frames.len(), 1, "{NAME}: expected one key frame"); let refs = ffmpeg_decode_sequence(&out.stdout, width, height, frames.len()); - assert_eq!(frames.len(), 1); assert_eq!(frames[0].y, refs[0].y, "{NAME}: luma"); assert_eq!(frames[0].u, refs[0].u, "{NAME}: u"); assert_eq!(frames[0].v, refs[0].v, "{NAME}: v"); @@ -11452,6 +11490,13 @@ pub(crate) mod tests { crate::decode::rect4_16_lossless_chroma_hits() > 0, "{NAME}: no lossless 16x4/4x16 chroma pair -- the walk was not reached" ); + // The ENCODE's frame count: the y4m is rendered with `-frames:v 1` + // (11414) -- a single frame of `testsrc2=s=320x240:r=25` -- and aomenc + // runs with `--limit=1 --kf-max-dist=1` (11434, 11435), so the stream + // codes exactly 1 lossless key frame. Asserted ABOVE the oracle call: + // this gate then indexes `frames[0]`/`refs[0]`, which a zero-frame + // decode would panic on rather than report. + assert_eq!(frames.len(), 1, "{NAME}: expected one lossless key frame"); let refs = ffmpeg_decode_sequence(&out.stdout, width, height, frames.len()); let repaired = 128 * width; assert_eq!( @@ -11835,6 +11880,11 @@ pub(crate) mod tests { reader for this orientation is untested (coded horz/vert = {coded:?})", if *want_orient == 0 { "HORZ" } else { "VERT" } ); + // The ENCODE's frame count: the per-arm render (11756) uses `-t 0.2` + // at TS256/TS512's `rate=25` (11700, 11701) -- 5 input frames -- and + // the aomenc args carry `--limit=1` (11797), so all three arms code + // exactly 1 frame. Asserted ABOVE the oracle call. + assert_eq!(frames.len(), 1, "{NAME}: {arm} key frame"); let theirs = ffmpeg_decode_sequence(&stream, *width, *height, frames.len()); assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count"); for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() { @@ -11978,6 +12028,16 @@ pub(crate) mod tests { !frames.is_empty(), "{NAME}: {arm} decoded no frame at {threads} recon thread(s)" ); + // The ENCODE's frame count: the skip_arms encode (11904) renders + // TS512 with `-t 0.2` at `rate=25` (11907) and its aomenc runs + // with `--limit=1` (11945), so the stream holds 1 coded frame -- + // and this loop re-decodes those SAME bytes at each `threads` + // value, so the count is arm-invariant. Asserted ABOVE the call. + assert_eq!( + frames.len(), + 1, + "{NAME}: {arm} key frame at {threads} recon thread(s)" + ); let theirs = ffmpeg_decode_sequence(&stream, *width, *height, frames.len()); assert_eq!( frames.len(), @@ -12220,6 +12280,14 @@ pub(crate) mod tests { let blocks = crate::decode::intrabc_hits(); blocks_total += blocks; blocks_at_depth[usize::from(depth == 10)] += blocks; + // The ENCODE's frame count: + // `screen_intrabc_stream_at_depth` (12203) renders + // `smptebars=size=128x96:rate=25` with `-t 0.2` and + // `-vf tile=2x2` (12066, 12069) -- 5 frames in, 1 tiled frame + // out at 256x192 -- and its aomenc runs with `--limit=1` + // (12101), so all eight (depth, txs, cq) arms code exactly + // 1 frame. Asserted ABOVE the oracle call. + assert_eq!(frames.len(), 1, "{NAME}: {arm} key frame"); let theirs = if depth == 10 { ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) } else { @@ -12609,6 +12677,15 @@ pub(crate) mod tests { Ok(frames) => { let sub8 = crate::decode::sub8_split_hits() - sub8_before; sub8_total += sub8; + // The ENCODE's frame count: `screen_intrabc_stream_with` (12593) + // renders `smptebars=size=128x96:rate=25` with `-t 0.2` and + // `-vf tile=2x2` (12066, 12069) -- 5 frames in, 1 tiled frame + // out -- and its aomenc runs with `--limit=1` (12101), so both + // cq arms code exactly 1 frame. The census is report-only about + // the COUNTS, but its Ok arm asserts pixel-exactness, so the + // budget handed to ffmpeg is pinned here rather than derived + // from the decode under test. + assert_eq!(frames.len(), 1, "{NAME}: {arm} key frame"); let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len()); assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count"); for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() { @@ -12684,6 +12761,15 @@ pub(crate) mod tests { Ok(frames) => { let vartx = crate::decode::intrabc_vartx_hits(); vartx_total += vartx; + // The ENCODE's frame count: `screen_intrabc_stream` (12679) + // renders `smptebars=size=128x96:rate=25` with `-t 0.2` and + // `-vf tile=2x2` (12066, 12069) -- 5 frames in, 1 tiled frame + // out -- and its aomenc runs with `--limit=1` (12101), so all + // four cq arms code exactly 1 frame. The census is + // report-only about the COUNTS, but its Ok arm does assert + // pixel-exactness, so the budget it hands ffmpeg is pinned + // here rather than derived from the decode under test. + assert_eq!(frames.len(), 1, "{NAME}: {arm} key frame"); let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len()); assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count"); for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() { @@ -12788,6 +12874,12 @@ pub(crate) mod tests { "{NAME}: vacuous -- {trees} var-tx tree(s), {mixed} mixed: the \ capability this gate pins was never exercised" ); + // The ENCODE's frame count: `screen_intrabc_stream_with` (12766) + // renders `testsrc2=size=320x180:rate=25` with `-t 0.2` and + // `-vf tile=2x2` (12066, 12069) -- 5 frames in, 1 tiled frame out + // at 640x360 -- and its aomenc runs with `--limit=1` (12101), so + // the stream codes exactly 1 frame. Asserted ABOVE the call. + assert_eq!(frames.len(), 1, "{NAME}: key frame"); let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len()); assert_eq!(frames.len(), theirs.len(), "{NAME}: frame count"); let mut mismatched = 0usize; @@ -13090,6 +13182,12 @@ pub(crate) mod tests { "{NAME}: cq={cq} no longer reads the inter var-tx tree for an intrabc block" ); eprintln!("{NAME}: cq={cq} {blocks} intrabc block(s), {vartx} through var-tx"); + // The ENCODE's frame count: `screen_intrabc_stream` (12022) renders + // `smptebars=size=128x96:rate=25` with `-t 0.2` and `-vf tile=2x2` + // (12066, 12069) -- 5 frames in, 1 tiled frame out -- and its aomenc + // runs with `--limit=1` (12101), so both cq arms code exactly 1 + // frame. Asserted ABOVE the oracle call. + assert_eq!(frames.len(), 1, "{NAME}: cq={cq} key frame"); let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len()); assert_eq!(frames.len(), theirs.len(), "{NAME}: cq={cq} frame count"); for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() { @@ -13151,6 +13249,21 @@ pub(crate) mod tests { "{NAME}: only {headers} frame headers in the fixture" ); let frames = decode_stream(&stream).unwrap_or_else(|e| panic!("{NAME}: {e}")); + // The frame count, and it comes from the WIRE, not from our decode: the + // loop above parsed this stream's own OBU frame headers with + // `Av1Parser` and counted `headers` of them (>= 3, from the arm's + // `--limit=3` at 13127, which overrides the helper's `--limit=1` because + // aomenc keeps the last occurrence of a repeated flag). Asserted ABOVE + // the oracle call, so a decode that showed fewer frames than the bitstream + // codes reds naming the wire instead of asking ffmpeg for the same short + // count. Deriving it from `headers` rather than a literal keeps the pin + // honest if aomenc's frame count ever drifts. + assert_eq!( + frames.len(), + headers, + "{NAME}: the stream codes {headers} frame(s), the decode showed {}", + frames.len() + ); let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len()); assert_eq!(frames.len(), theirs.len(), "{NAME}: frame count"); for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() { @@ -13356,15 +13469,19 @@ pub(crate) mod tests { Err(e) => panic!("{NAME}: decode failed on {arm} at {depth}-bit: {e}"), }; let fired = decode::rect4_palette_hits() - before; + // The ENCODE's frame count, asserted ABOVE the oracle call: the + // y4m renders 5 frames (`-t 0.2` at every arm's `rate=25`, + // 13275) but aomenc is given `--limit=1` (13313), so the stream + // codes exactly 1 frame at both depths on every arm. Asserted + // here it is NOT the tautology the old comment below claimed: + // `frames.len() == 1` is a fact about the encode, checked before + // `frames.len()` is spent as ffmpeg's frame budget. + assert_eq!(frames.len(), 1, "{NAME}: {arm} at {depth}-bit key frame"); let ffmpeg_frames = if depth == 10 { ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) } else { ffmpeg_decode_sequence(&stream, width, height, frames.len()) }; - // No frame-count assert here: `ffmpeg_decode_sequence{,_10bit}` - // was handed `frames.len()` as its frame budget, so - // `ffmpeg_frames.len() == frames.len()` holds by construction - // and the assert was tautological. assert!( !frames.is_empty(), "{NAME}: {arm} at {depth}-bit decoded no frame" @@ -15494,6 +15611,21 @@ pub(crate) mod tests { .map(|((label, _), d)| format!("{label}={d}")) .collect(); let fired = fired.join(" "); + // The ENCODE's frame count, and it is this helper's `frames` PARAMETER + // (15446) -- not our decode's length. It is the same value handed to + // `encode_10bit_gradients_seed` (15469), which renders + // `frames / 25.0` seconds at `rate=25` (15928, 15940) and runs + // aomenc with no `--limit` of its own, so the stream codes exactly + // `frames` frames: 1 for the single-key-frame callers, 24 for the + // `--lag-in-frames=16` inter callers. Asserted ABOVE the oracle call, + // so a decode that showed fewer reds naming the encode rather than + // handing ffmpeg the same short count. + assert_eq!( + decoded.len(), + frames, + "{name}: seed {seed}: the encode codes {frames} frame(s), the decode showed {}", + decoded.len() + ); let reference = ffmpeg_decode_sequence_10bit(&stream, width, height, decoded.len()); assert_eq!( decoded.len(), @@ -27633,8 +27765,12 @@ pub(crate) mod tests { "{NAME}: the stream decoded but no coded (non-skip) rect leaf fired -- \ the gate proves nothing" ); - let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len()); + // The ENCODE's frame count, asserted ABOVE the oracle call: the y4m is + // rendered with `-t 1` and `-vframes 1` (27566) -- one frame at the + // source's default rate 25 -- and aomenc runs with no `--limit` and + // `--kf-max-dist=0` (27593), so the stream codes exactly 1 frame. assert_eq!(frames.len(), 1, "{NAME}: expected one key frame"); + let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len()); assert_eq!( ffmpeg_frames.len(), frames.len(), @@ -27761,8 +27897,13 @@ pub(crate) mod tests { // Counted only on an attempt that actually decoded AND is compared // below -- a refusal never contributes to the firing assert. let overrides = crate::decode::mode_mi_override_hits() - before; - let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len()); + // The ENCODE's frame count, asserted ABOVE the oracle call: the y4m is + // rendered ONCE outside this loop with `-t 1` and `-vframes 1` + // (27792) -- one frame at the source's default rate 25 -- and aomenc + // runs with no `--limit` and `--kf-max-dist=0` (27726), so both + // (rtx, filter_intra) arms code exactly 1 frame. assert_eq!(frames.len(), 1, "{NAME}: expected one key frame"); + let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len()); assert_eq!( ffmpeg_frames.len(), frames.len(), @@ -27929,16 +28070,20 @@ pub(crate) mod tests { let cfl_blocks = crate::decode::cfl_block_hits() - before_cfl; let angle_blocks = crate::decode::uv_angle_delta_hits() - before_angle; let uv_overrides = crate::decode::uv_mode_mi_override_hits() - before_uv; - let ffmpeg_frames = if depth == 10 { - ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) - } else { - ffmpeg_decode_sequence(&stream, width, height, frames.len()) - }; + // The ENCODE's frame count, asserted ABOVE the oracle call: the y4m is + // rendered with `-t 1` and `-vframes 1` (27852) -- one frame at the + // source's default rate 25 -- and aomenc runs with no `--limit` and + // `--kf-max-dist=0` (27890), so both depths code exactly 1 frame. assert_eq!( frames.len(), 1, "{NAME}: expected one key frame (depth={depth})" ); + let ffmpeg_frames = if depth == 10 { + ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) + } else { + ffmpeg_decode_sequence(&stream, width, height, frames.len()) + }; assert_eq!( ffmpeg_frames.len(), frames.len(), @@ -28125,6 +28270,12 @@ pub(crate) mod tests { // Counters read only on an attempt that decoded AND is compared. let after = crate::decode::reelc_chroma_counters(); let (skip_cfl, dir_pairs) = (after.0 - before.0, after.1 - before.1); + // The ENCODE's frame count: the y4m is rendered with `-t 1` and + // `-vframes 1` (28056) -- one frame at the source's default rate 25 + // -- and aomenc runs with no `--limit` and `--kf-max-dist=0` + // (28088), so both depths code exactly 1 frame. Asserted ABOVE the + // oracle call. + assert_eq!(frames.len(), 1, "{NAME}: depth={depth} key frame"); let ffmpeg_frames = if depth == 10 { ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) } else { @@ -28452,6 +28603,11 @@ pub(crate) mod tests { let after = crate::decode::ab16_hits_by_arm(); let this: Vec = (0..4).map(|i| after[i] - before[i]).collect(); eprintln!("{NAME}: {desc} decoded, arms this attempt={this:?}"); + // The ENCODE's frame count: every attempt's y4m is rendered with + // `-t 1` and `-vframes 1` (28367) -- one frame whatever the source's + // rate -- and aomenc carries `--limit=1` (28401), so all six arms + // code exactly 1 frame. Asserted ABOVE the oracle call. + assert_eq!(frames.len(), 1, "{NAME}: {desc} key frame"); let want = if a.ten_bit { ffmpeg_decode_sequence_10bit(&stream, a.w, a.h, frames.len()) } else { @@ -28606,6 +28762,18 @@ pub(crate) mod tests { eprintln!("x={start_x} cq={cq} rtx={rtx} fired={fired} REFUSED {e}") } Ok(frames) => { + // The ENCODE's frame count: the y4m is rendered with + // `-t 1` and `-vframes 1` (28747) -- one frame, and + // the sources carry no explicit `:rate=` so that + // `-vframes` is the binding bound -- and aomenc runs + // with `--kf-max-dist=0` and no `--limit` + // (28782), so all 126 arms code exactly 1 frame. + // This sweep asserts no verdict, but `bad` below is + // the NUMBER of mismatching frames it reports, so a + // decode that showed fewer frames than the wire + // would silently under-report it. Pinned here, above + // the oracle call, for that reason. + assert_eq!(frames.len(), 1, "x={start_x} cq={cq} rtx={rtx} key frame"); let want = ffmpeg_decode_sequence(&stream, width, height, frames.len()); let bad = frames .iter() @@ -29209,6 +29377,12 @@ pub(crate) mod tests { .map(|((label, _), d)| format!("{label}={d}")) .collect(); let fired = fired.join(" "); + // The ENCODE's frame count: `gradients_source` (6015) is rendered with + // `duration=0.04:rate=25` (29116) and `-frames:v 1` (29119) caps the + // y4m at one frame; aomenc runs with `--limit=1` and + // `--kf-max-dist=0` (29150) and so codes exactly that one. Asserted + // ABOVE the oracle call -- it holds for every one of the 16 seeds. + assert_eq!(frames.len(), 1, "{NAME}: seed {seed} key frame"); let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len()); assert_eq!( frames.len(), @@ -30643,6 +30817,12 @@ pub(crate) mod tests { // r4: the pixel filters are wired -- every `uses_lr` // frame must now decode Ok AND match an independent // decoder pixel-exact, not just refuse cleanly. + // The ENCODE's frame count: every `EC_FISTRIP_SRC` branch + // and the `gradients_source` default (30568-30573) render at + // `rate=25` with a 1-frame `duration=0.04`, and aomenc runs + // with no `--limit` (30590) -- so each attempt's stream codes + // exactly 1 frame. Asserted ABOVE the oracle call. + assert_eq!(pics.len(), 1, "{NAME}: seed {seed} key frame"); let reference = ffmpeg_decode_sequence(&stream, width, height, pics.len()); let mismatched = pics .iter() @@ -38221,6 +38401,20 @@ pub(crate) mod tests { }; let after = crate::decode::edge32_hits(); let delta: Vec = (0..8).map(|i| after[i] - before[i]).collect(); + // The ENCODE's frame count, and it is PER ARM: the arm tuple's + // `frame_count` field is what the y4m is built from + // (`duration = frame_count / 25.0`, 38085, rendered with + // `-t {duration}` at 38131) and this gate's aomenc carries no + // `--limit` and no `--lag-in-frames`, so the stream codes exactly + // `frame_count` frames (1 for the intra arms, 5 for the + // inter/straddling ones). Asserted ABOVE the oracle call, so a + // decode that dropped one reds naming the encode. + assert_eq!( + decoded.len(), + frame_count, + "{name}: {tag}: the encode codes {frame_count} frame(s), the decode showed {}", + decoded.len() + ); let reference = if ten_bit { ffmpeg_decode_sequence_10bit(&stream, width, height, decoded.len()) } else { @@ -41949,6 +42143,15 @@ pub(crate) mod tests { } let rect4_now = (crate::decode::sb_rect4_horz_hits() - rect4_before.0) + (crate::decode::sb_rect4_vert_hits() - rect4_before.1); + // The ENCODE's frame count: `rectchroma_stream` (42059) renders + // `duration=0.04:rate=25` (42082) with `-t 0.04` (42094) -- one + // frame -- and its aomenc runs with no `--limit`, so every + // attempt's stream codes exactly 1 frame at both depths. + assert_eq!( + frames.len(), + 1, + "{NAME}: {bit_depth}-bit cq {cq} seed {seed} key frame" + ); let reference = if bit_depth == 10 { ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) } else { @@ -42186,6 +42389,11 @@ pub(crate) mod tests { let stream = rectchroma_stream(bit_depth, 32, 4, width, height); let frames = decode_stream(&stream) .unwrap_or_else(|e| panic!("{NAME}: {bit_depth}-bit seed 46 refused: {e}")); + // The ENCODE's frame count: `rectchroma_stream` (42059) renders + // `duration=0.04:rate=25` (42082) with `-t 0.04` (42094) -- one frame + // -- and its aomenc runs with no `--limit`, so the stream codes + // exactly 1 frame at both depths. Asserted ABOVE the oracle call. + assert_eq!(frames.len(), 1, "{NAME}: {bit_depth}-bit seed 46 key frame"); let reference = if bit_depth == 10 { ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) } else { @@ -42355,6 +42563,15 @@ pub(crate) mod tests { } Ok(frames) => frames, }; + // The ENCODE's frame count: `duration=0.04:rate=25` (42263) is + // one frame and `-t 0.04` (42277) caps the y4m there, and aomenc + // runs with no `--limit` -- so every arm (both depths, all 10 + // seeds) codes exactly 1 frame. Asserted ABOVE the oracle call. + assert_eq!( + frames.len(), + 1, + "{NAME}: {bit_depth}-bit seed {seed} key frame" + ); let reference = if bit_depth == 10 { ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) } else { @@ -42564,6 +42781,16 @@ pub(crate) mod tests { }; let hits = crate::decode::edge_part_hits(); let skip_split_tx = crate::decode::skip_split_tx_hits(); + // The ENCODE's frame count: `-t 1` AND `-vframes 1` (42490) + // cap the y4m at one frame and aomenc is given that one frame + // with no `--limit`, so every arm's stream holds exactly 1 + // coded frame. Asserted ABOVE the oracle call so a decode that + // dropped it reds naming the encode. + assert_eq!( + frames.len(), + 1, + "{NAME}: {width}x{height} depth={depth} key frame" + ); let ffmpeg_frames = if depth == 10 { ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) } else { @@ -42790,6 +43017,18 @@ pub(crate) mod tests { } }; let narrow = crate::mc::rect_narrow_kern_hits(); + // The ENCODE's frame count, asserted ABOVE the oracle call, not + // our decode's length: `-vframes {FRAMES}` (42696) feeds aomenc + // exactly FRAMES frames and `--limit={FRAMES}` (42724) caps its + // output there. A decode that dropped a frame must red HERE, + // naming the encode, rather than hand the same short count to + // ffmpeg and let the helper's byte-length assert blame ffmpeg. + assert_eq!( + frames.len(), + FRAMES, + "{NAME}: not every coded frame was decoded ({width}x{height}, \ + depth={depth}, cq={cq})" + ); let ffmpeg_frames = if depth == 10 { ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) } else { @@ -42800,12 +43039,6 @@ pub(crate) mod tests { frames.len(), "{NAME}: ffmpeg frame count ({width}x{height}, depth={depth}, cq={cq})" ); - assert_eq!( - frames.len(), - FRAMES, - "{NAME}: not every coded frame was decoded ({width}x{height}, \ - depth={depth}, cq={cq})" - ); for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { assert_eq!( got.y, want.y, diff --git a/lanes/av1pinspec.report.md b/lanes/av1pinspec.report.md new file mode 100644 index 00000000..fddecc49 --- /dev/null +++ b/lanes/av1pinspec.report.md @@ -0,0 +1,346 @@ +# lane-av1pinspec — give each of the 43 unpinned count sites a spec-derived pin + +Branch `lane-av1pinspec`, worktree `~/.cache/wt/av1pinspec`, base `3b691e13` (wave-3e +main, with `pins5` + `txsizeaudit-r5` already merged). **Ten commits, test/comment +changes only — no decoder logic, and `decode.rs` is not touched at all.** + +``` +8a8a9717 gate_coverage: lower the count-vacuity unpinned ceiling 43 -> 2 +2375641e stream: pin the encode's frame count above 7 oracle calls (palette, rect-tx tool, screen intrabc, 16x4 pair) +38cf6255 stream: pin the encode's frame count in the intrabc rect/census family +37bc27ef stream: pin the ignored rect-tx recipe sweep and the 32-level AB gate +95e950fa stream: pin the restoration sweep and edge32_gate, whose spec is a parameter +71a190aa stream: pin the band and chroma-rect sweep family to one frame each +d960f5d3 stream: hoist the narrow-kernel gate's FRAMES assert above its oracle call +b5a45b2d stream: pin four more oracle counts, one of them off the wire itself +c887fa7f stream: pin eight single-key-frame oracle counts, three of them by hoisting +``` + +## 0. The fix shape, and what it changes about what a site counts + +Every fix adds **the ENCODE's own frame count** as an `assert_eq!` **above** the +`ffmpeg_decode_sequence*` call, so the value later spent as ffmpeg's frame budget is +already proven against the encode instead of read off our own decode. + +**It does not change what a site counts.** The call still spends `frames.len()`; the +assert above it makes that value a spec. This is deliberate, and it is the shape the +**17 already-pinned sites** already use — e.g. `stream.rs:5571` asserts +`decoded.len() == 4` and `:5576` then spends `decoded.len()` as ffmpeg's budget. The +sweep's population therefore stays at **60** and the change is visible as +`17 -> 58 spec-pinned` rather than as sites quietly disappearing. + +The alternative — spending a named constant in place of `.len()`, the r7 shape at +`stream.rs:3895` — is strictly stronger per site, but it deletes the site from the +sweep, and 43 deletions would put the population at 17 against a **floor of 40** +(`gate_coverage.rs:2390`). The floor is not lowered here, so the assert-above shape is +the one that keeps the class enumerable. That trade is the one judgement call in this +lane; everything else is mechanical. + +**Why the assert must sit above the call, in one line.** A wrong count reds either +way, but with the assert below, `ffmpeg_decode_sequence` has already been handed the +same short count, so its `out.stdout.len() == frame_bytes * frames` assert fires +first and the message blames ffmpeg for a number our decoder chose — the +misattributed-red class this whole sweep exists to name. Above the call, the failure +names the encode. + +## 1. The sweep line, before and after + +BEFORE, on `3b691e13`: + +``` +$ cargo test -p ec-av1 --lib -- count_vacuity_tests::every_locally_derived_oracle_count_is_reported --nocapture +count-vacuity sweep: 60 site(s); 17 spec-pinned by a prior assert, 43 not +``` + +AFTER: + +``` +$ cargo test -p ec-av1 --lib -- count_vacuity_tests --nocapture +count-vacuity sweep: 60 site(s); 58 spec-pinned by a prior assert, 2 not +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 +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 +test gate_coverage::count_vacuity_tests::every_locally_derived_oracle_count_is_reported ... ok +test gate_coverage::count_vacuity_tests::the_count_vacuity_sweep_finds_the_known_sites ... ok +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 760 filtered out +``` + +**`43 -> 2`. No site disappeared** — 60 before, 60 after — so the ceiling moves +**down** `43 -> 2` because 41 sites stopped being unpinned. The ceiling is not +raised. The floor (`>= 40` sites) and the `frames.len()` shape anchor are untouched. + +## 2. The 43-row table + +`b:` = line on `3b691e13`, `a:` = line on `lane-av1pinspec` (the sweep's own numbers +after the change). `value` is what the new assert compares against. + +| b: | a: | gate | expr | value | bucket | disposition | +|---|---|---|---|---|---|---| +| 5631 | 5631 | `an_svt_screen_palette_block_with_a_split_transform_decodes_exactly` | `decoded.len()` | — | **b** | hand forward, §3 | +| 10513 | 10522 | `a_real_aomenc_palette_stream_with_8x8_leaves_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed | +| 10732 | 10758 | `rect_tx_tool_gate` | `decoded.len()` | `15` | a | fixed | +| 10734 | 10760 | `rect_tx_tool_gate` | `decoded.len()` | `15` | a | fixed (one assert covers both) | +| 11212 | 11248 | `a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips` | `frames.len()` | `1` | a | fixed | +| 11383 | 11422 | `a_16x4_intrabc_pair_strip_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed, assert hoisted | +| 11455 | 11500 | `a_lossless_16x4_chroma_pair_repairs_the_measured_site` | `frames.len()` | `1` | a | fixed | +| 11838 | 11888 | `a_coded_rect_intrabc_block_reconstructs_in_both_orientations` (arms) | `frames.len()` | `1` | a | fixed | +| 11981 | 12041 | same gate (skip_arms) | `frames.len()` | `1` | a | fixed | +| 12224 | 12292 | `an_sb128_screen_stream_with_intrabc_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed | +| 12226 | 12294 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) | +| 12612 | 12689 | `a_sub8_leaf_census_over_intrabc_screen_streams_measures_the_sub8_refusal` | `frames.len()` | `1` | a | fixed | +| 12687 | 12773 | `an_intrabc_vartx_census_measures_the_mixed_leaf_refusal` | `frames.len()` | `1` | a | fixed | +| 12791 | 12883 | `a_real_aomenc_intrabc_mixed_vartx_tree_decodes_without_the_mixed_leaf_refusal` | `frames.len()` | `1` | a | fixed | +| 13093 | 13191 | `an_intrabc_block_under_tx_mode_select_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed | +| 13154 | 13267 | `a_real_aomenc_stream_with_cdf_update_disabled_decodes_pixel_exact` | `frames.len()` | wire frame headers | a | fixed | +| 13360 | 13481 | `a_real_aomenc_rect_strip_palette_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed | +| 13362 | 13483 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) | +| 15497 | 15629 | `ten_bit_tool_gate` (the sweep labels the gate `first_diff`) | `decoded.len()` | `frames` param | a | fixed | +| 27636 | 27773 | `a_real_aomenc_stream_with_a_coded_rect_strip_below_16x16_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed, assert hoisted | +| 27764 | 27906 | `a_real_aomenc_stream_whose_square_block_reads_a_sub16_neighbours_mode_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed, assert hoisted | +| 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 | +| 27935 | 28085 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) | +| 28129 | 28280 | `a_real_aomenc_sb128_stream_whose_skipped_cfl_and_1to4_chroma_pairs_decode_pixel_exact` | `frames.len()` | `1` | a | fixed | +| 28131 | 28282 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) | +| 28456 | 28612 | `a_real_aomenc_stream_with_ab_partitions_below_16x16_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed | +| 28458 | 28614 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) | +| 28609 | 28777 | `sweep_rectx_recipes` (`#[ignore]`) | `frames.len()` | `1` | a | fixed | +| 29212 | 29386 | `a_real_aomenc_stream_with_a_32_level_ab_partition_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed | +| 30646 | 30826 | `a_real_aomenc_stream_with_restoration_reads_lr_symbols_correctly` | `pics.len()` | `1` | a | fixed | +| 30744 | 30924 | same gate — a `///` doc comment | `pics.len()` | — | **c** | not a count, §3 | +| 38225 | 38419 | `edge32_gate` | `decoded.len()` | `frame_count` (arm) | a | fixed | +| 38227 | 38421 | `edge32_gate`, 8-bit arm | `decoded.len()` | `frame_count` (arm) | a | fixed (one assert covers both) | +| 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 | +| 41955 | 42158 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) | +| 42190 | 42398 | `the_chroma_rect_gates_excluded_seed_46_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed | +| 42192 | 42400 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) | +| 42359 | 42572 | `a_real_aomenc_band_stream_seed46_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed | +| 42361 | 42574 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) | +| 42568 | 42787 | `a_real_aomenc_stream_whose_frame_edge_partition_bit_is_horz_decodes_pixel_exact` | `frames.len()` | `1` | a | fixed | +| 42570 | 42789 | same gate, 8-bit arm | `frames.len()` | `1` | a | fixed (one assert covers both) | +| 42794 | 43025 | `a_real_aomenc_rect_inter_block_predicts_chroma_with_the_narrow_kernel_pixel_exact` | `frames.len()` | `FRAMES` (=6) | a | fixed, assert hoisted | +| 42796 | 43027 | same gate, 8-bit arm | `frames.len()` | `FRAMES` (=6) | a | fixed (one assert covers both) | + +**41 fixed, 1 handed forward (b), 1 not a count at all (c).** 6+8+4+8+2+3+8+2 = 41 +sites across the eight `stream.rs` commits. + +## 3. The two that are not fixed, and why + +**(b) `stream.rs:5631` — `an_svt_screen_palette_block_with_a_split_transform_decodes_exactly`.** +The stream is named by `EC_AV1_SVT1_STREAM` (`:5609`) and read from that path +(`:5617`). It is **not a committed pin** — the gate's own doc comment says the crop is +never committed to `fixtures/` — so no encode recipe, no `--limit`, no `-frames:v` +and no frame count exists anywhere in the tree for it. The "12-frame stream" in the +doc comment (`:5592`) is prose about one capture, and the env var accepts any file, so +asserting `12` would pin a number nothing can check. The one derivable alternative is +to count the stream's own OBU frame headers with `Av1Parser` (the shape used at +`:13267`; the parser is already imported at `:19`), which would make the count +wire-derived instead of decode-derived. Deliberately not done: the gate **SKIPs** on +any box without that env var (the battery reports it `ok` in 0 s here), so such an +assert would ship unexercised, and an OBU header count over-counts whenever the stream +carries `show_existing_frame`, which cannot be checked without the bytes. Handed +forward with the recipe. + +**(c) `stream.rs:30744` (now `:30924`) — a `///` DOC COMMENT, not a count.** +The matched line is + +``` +/// let reference = ffmpeg_decode_sequence(&stream, 192, 128, pics.len()); +``` + +a quoted fragment of the pre-r4 body of `pinned_lr_sgr_stream_call_unique_dump`, in +the doc comment that explains why that gate now takes its count from `FRAMES`. The +sweep scans raw source lines and cannot tell a doc comment from code. The gate it +describes is already correct: it calls `ffmpeg_decode_sequence(&stream, W, H, FRAMES)` +with `const FRAMES: usize = 1;` and asserts `pics.len() == FRAMES`. Left in place and +reported; making the scanner comment-aware is a change to the guard, not a fix to a +count. + +## 4. Where each derived value comes from + +Six derivations, every one read out of the gate's own encode call: + +1. **`-frames:v 1` / `-vframes 1` on the y4m** — `a_16x4_intrabc_pair_strip` + (`:11333`), `a_lossless_16x4_chroma_pair_repairs_the_measured_site` (`:11414`), + `..._coded_rect_strip_below_16x16` (`:27566`), + `..._square_block_reads_a_sub16_neighbours_mode` (`:27793`), + `..._chroma_edge_filter_reads_a_sub16_neighbours_uv_mode` (`:27852`), + `..._skipped_cfl_and_1to4_chroma_pairs` (`:28056`), + `..._ab_partitions_below_16x16` (`:28367`), + `..._a_32_level_ab_partition` (`:29119`), + `..._frame_edge_partition_bit_is_horz` (`:42490`), + `sweep_rectx_recipes` (`:28747`). Where the source carries no `:rate=`, `-vframes` + is the binding bound. +2. **`--limit=1`** — the 8x8-leaf palette gate (`:10467`), the screen key-frame + intrabc gate (`:11145`), both loops of the rect-intrabc gate (`:11797`, `:11945`), + `an_sb128_screen_stream_with_intrabc` and everything below it through + `screen_intrabc_stream_at_depth` (`:12101`), the rect-strip-palette gate + (`:13313`), and the band/chroma-rect family whose helper renders + `duration=0.04:rate=25` with `-t 0.04` and no limit (`:42082`, `:42094`, `:42263`, + `:42277`). +3. **`--limit=1` over `-t 0.2` at `rate=25` with `-vf tile=2x2`** — 5 input frames, + 1 tiled output frame: the two intrabc censuses, the mixed vart-x tree gate and the + tx-mode-select gate. +4. **`rate=25 x -t 0.60`, no `--limit`** — `rect_tx_tool_gate`, 15 frames (`:10690`). + The one multi-frame site; the count is named `const ENCODED_FRAMES: usize = 15;` + because 15 is an arithmetic fact about the fixture, not a flag someone typed. +5. **A value already in scope at the call** — `const FRAMES: usize = 6` + (`a_real_aomenc_rect_inter_block_predicts_chroma_with_the_narrow_kernel`, `:42670`, + driving both `-vframes {FRAMES}` and `--limit={FRAMES}`); `ten_bit_tool_gate`'s own + `frames` parameter (`:15446`, the same value handed to + `encode_10bit_gradients_seed` at `:15469` — 1 for the key-frame callers, 24 for the + `--lag-in-frames=16` inter ones); `edge32_gate`'s per-arm `frame_count` tuple field, + which is what the y4m is built from (`duration = frame_count / 25.0`, `:38117`) and + which aomenc runs uncapped, so 1 for the intra arms and 5 for the inter/straddling + ones. +6. **The wire itself** — `a_real_aomenc_stream_with_cdf_update_disabled` asserts + `frames.len() == headers`, where `headers` is this stream's own OBU frame-header + count, parsed with `Av1Parser` in the loop already sitting above the call + (`:13133-13147`). Derived from the bitstream rather than a literal, because the arm + overrides the helper's `--limit=1` with `--limit=3` (`:13127`) and aomenc keeps the + last occurrence of a repeated flag — so a literal `3` would be a claim about flag + precedence, and `headers` is the fact. + +## 5. Red-before + +### 5a. Per group — the guard's own message, one run per commit + +Each group's edits un-applied, the real guard run, then the tree restored: + +| commit | group | sites | guard says | +|---|---|---|---| +| `2375641e` | A palette / rect-tx tool / screen intrabc / 16x4 | 6 | `8 unpinned count site(s), ceiling is 2` | +| `38cf6255` | B intrabc rect + census family | 8 | `10 unpinned count site(s), ceiling is 2` | +| `b5a45b2d` | C cdf-update / rect-strip-palette / ten_bit_tool_gate | 4 | `6 unpinned count site(s), ceiling is 2` | +| `c887fa7f` | D single-key-frame gates | 8 | `10 unpinned count site(s), ceiling is 2` | +| `37bc27ef` | E ignored sweep + 32-level AB | 2 | `4 unpinned count site(s), ceiling is 2` | +| `95e950fa` | F restoration sweep + edge32_gate | 3 | `5 unpinned count site(s), ceiling is 2` | +| `71a190aa` | G band + chroma-rect family | 8 | `10 unpinned count site(s), ceiling is 2` | +| `d960f5d3` | H narrow-kernel | 2 | `4 unpinned count site(s), ceiling is 2` | + +Every row is `2 + that group's sites` against a ceiling of `2`, and every row is +`test result: FAILED`. Since the ceiling equals the number of sites that survive the +whole lane, **removing any one of the 41 asserts puts unpinned at 3 and reds the same +assert** — the constant and the per-group revert together are the per-site proof. + +Whole-branch revert, same result: + +``` +$ git checkout 3b691e13 -- crates/ec-av1/src/stream.rs # ceiling stays 2 +$ cargo test -p ec-av1 --lib -- count_vacuity_tests +thread '...' panicked at crates/ec-av1/src/gate_coverage.rs:2441:9: +43 unpinned count site(s), ceiling is 2 -- a new one was added (lower the ceiling only when a site is actually fixed) +test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 760 filtered out +``` + +### 5b. The new asserts themselves bite — value mutation + +One mutation per **derivation shape**, all six applied at once, on the real gates: + +``` +$ cargo test -p ec-av1 --lib -- --test-threads=4 +---- a_real_aomenc_8bit_stream_with_a_rect_transform_decodes_pixel_exact stdout ---- +assertion `left == right` failed: ...[cq20/tx1]: the encode codes 14 frames, the decode showed 15 + left: 15 + right: 14 +---- a_real_aomenc_10bit_rect_and_ab_partitions_decode_pixel_exact stdout ---- +assertion `left == right` failed: ... seed 42: the encode codes 24 frame(s), the decode showed 24 + left: 24 + right: 25 +---- a_frame_edge_straddling_band_decodes_pixel_exact stdout ---- +assertion `left == right` failed: ... 192x68 cq35 frames=5 10bit=false tile_cols=0: the encode codes 5 frame(s), the decode showed 5 + left: 5 + right: 6 +---- a_16x4_intrabc_pair_strip_decodes_pixel_exact stdout ---- +assertion `left == right` failed: a_16x4_intrabc_pair_strip_decodes_pixel_exact: expected one key frame + left: 1 + right: 2 +---- a_real_aomenc_stream_with_cdf_update_disabled_decodes_pixel_exact stdout ---- +assertion `left == right` failed: ... the stream codes 3 frame(s), the decode showed 3 + left: 3 + right: 4 +---- a_real_aomenc_rect_inter_block_predicts_chroma_with_the_narrow_kernel_pixel_exact stdout ---- +assertion `left == right` failed: ... not every coded frame was decoded (192x128, depth=8, cq=20) + left: 6 + right: 5 + +test result: FAILED. 0 passed; 6 failed; 0 ignored; 0 measured; 756 filtered out +``` + +The mutations were `ENCODED_FRAMES 15 -> 14`, `frames -> frames + 1`, +`frame_count -> frame_count + 1`, `1 -> 2`, `headers -> headers + 1`, +`FRAMES -> FRAMES - 1`. Every mutant fails, and **the "decode showed" column is the +proof the derived values are right, not just that the asserts exist**: this decoder +really produces 15 / 24 / 5 / 1 / 3 / 6 frames on those six fixtures, and the number +came out of the encode recipe, not out of the decode. Reverted, and all six green +again. + +## 6. Green + +Compile clean, no warnings: + +``` +$ cargo check -p ec-av1 --all-targets + Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.14s +``` + +Every gate this lane touched, plus the whole `gate_coverage` module, plus all nine +`ten_bit_tool_gate` callers and all three `edge32_gate` callers — 57 tests, +`aomenc` present and required (`EC_AV1_REQUIRE_AOMENC=1`): + +``` +$ cargo test -p ec-av1 --lib -- --test-threads=4 <39 gates> gate_coverage +test result: ok. 57 passed; 0 failed; 0 ignored; 0 measured; 705 filtered out; finished in 128.10s +``` + +The `#[ignore]`d one is run explicitly: + +``` +$ cargo test -p ec-av1 --lib -- --ignored sweep_rectx_recipes +test stream::tests::sweep_rectx_recipes ... ok +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 761 filtered out; finished in 14.72s +``` + +And the acceptance filter: + +``` +$ cargo test -p ec-av1 --lib -- gate_coverage pin_inventory count_vacuity +test gate_coverage::pin_inventory_tests::the_pin_scanner_sees_every_shape ... ok +test gate_coverage::pin_inventory_tests::the_pin_scanner_sees_the_directory_literal_shape ... ok +test gate_coverage::count_vacuity_tests::every_locally_derived_oracle_count_is_reported ... ok +test gate_coverage::count_vacuity_tests::the_count_vacuity_sweep_finds_the_known_sites ... ok +test gate_coverage::pin_inventory_tests::every_pin_a_gate_reads_is_committed_under_the_crate ... ok +test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 755 filtered out +``` + +## 7. Two things worth recording + +**A first attempt at the commit split corrupted one hunk, and the guard caught +nothing.** `git apply --cached --unidiff-zero` re-anchors a hunk by line number +alone, so the narrow-kernel assert landed inside a *refusal* arm — inside the +`if msg.contains("unsupported")` block, before its `continue` — where it would only +have run on arms the gate had already decided not to compare. The lane's own green +run would not have noticed, because the compared arms never reach that line. The +commits were rebuilt with exact-text, context-anchored replacement and an +`assert count == 1`, and the assembled branch was then checked **byte-identical** to +the tree the battery and the mutation run had been executed against. A commit-splitting +tool that can drop a gate assertion silently needs the same red-before discipline as +the code it is splitting. + +**The global `pre-commit` hook re-runs rustfmt on staged Rust** (`core.hooksPath` -> +`~/.omp/agent/hooks/git`), so two of the new asserts are committed wrapped across +lines even though they fit in 100 columns. Left as the hook produced them; the two +forms are the same assert with the same operands, and the wrapped form is what the +final verification run in §6 was executed against. + +## 8. Not done / deferred + +- `stream.rs:5631` (the SVT gate) — no derivable frame count; the exact recipe and + the two reasons not to guess are in §3. +- The `///` doc-comment site the sweep cannot see — left as-is and reported, §3. +- The *value* mutation in §5b runs one gate per derivation shape (six), not all 41 + individually. The guard-level per-group revert in §5a is the per-site proof; §5b is + what shows the asserts bite on the gates themselves. +- `an_svt_screen_palette_block_with_a_split_transform_decodes_exactly` and the + census gates' `pixel_comparing` column are the guard's own approximation, not a + re-measurement; the classification in §2 is from reading the gates, and each row + records the value that reading produced. +- No full `cargo test -p ec-av1` run — project-wide validation is Main's.