diff --git a/crates/ec-av1/fixtures/svt1-split-tx-pin.obu b/crates/ec-av1/fixtures/svt1-split-tx-pin.obu new file mode 100644 index 0000000000000000000000000000000000000000..1b3f64d651955a019e950722f85db4dc506e8344 GIT binary patch literal 1838 zcmV+}2hsQv016HO000BM{J7QgAV5H%fHIj56aXb~A(l)qBriVj2+#EG3DhD_k&30^ zvBGmm-C)c>vPWhvTGbqU0yUy_P;TD9eG5M6PhGu=f>0PN7Vqu2sbUSOkB-C73~fq% zim$cB0%RR>6j;tC7N9C*+vRLSn<+%@*z$%j?c_U?%!c<~9CM2*-rl|vxOX9nf>zbP z@%xOe+sFzO$1(pszodY5i@_}@aCB71TNabUX!Wy5PI9BTbA;*UrdLG^U{fP0^Y+VV zOz`1pec;N=1aA`p%bY^aoxVt!^h@xb{CFC8TA4 zJtOyJmlVz9va1DJ6kPy2%1B(GlG%J$Enu!%;?4^x``u6?#bk(x2x<6j9 zZJ5JQ6H)E)mj>KmpEJ6a)vk(Qu2U#$FGhV5z~v4M^#8!T>MNmi-3k*K4w93zSUlWh zVRuw%kFNJTj%E*Umkw)FuLRZlJmL_S?fsq(<& zz~*(gX1+@l*b?0&0x0o*LX-hLs^koEQ>q!u2vo)FHkD)lfLgZ&T76?jyl{0R?w0XF zkoclA{xOYw_>*V9YLiAAdCy{HNQF+J*m3k`Et2fxhwhL)ntmOcWm7ePrks~PHys#l z@nBZrPL7AF8c9B5u1X4Q)aT=RqF>-@Zm1%M7zo@N7!&)ahDT! zC&(ZiyG&o@$EU=abUJt6JfOi>?f!=a3~|0bC&jmiGrBor9TN8~2|T*G5r+b^0B8uu z;f|1Bo`QNMjD9U+Kq_s?2pa6JDm@XAb?8Ta1r`?y76TX0z@o@nL}$BbXidODe;0Wd z%kOjqfx1T_s+ib7r$;k5>(JeF-e34!6wB-2X{HVhCP{bG=>$UqG;@Ra!+7*PmJ{b@ zsbY=IyY*jQ!A&(|Q=U>^7z9~vsw-BuJ9Rg_-av8U0WHr^*wCg~!!QbSE8J-dl%v$b=>V(kdbs&xNX9e0*2Ga!ZN}6J-*~yC29~srP>=%Z zznaudPgy|MM1vOL%qYA+HLA6cV9`k!{Vw#_IBRutGD!}?0IMcKsFICma)1Oe%S=!; zn$G1n`QXVuY@8y3w}UA&)1E0{6;Q`_Y&}V5()$fboW=4&;>!k$<8N4kBz<5;U=^&v z4l2XO(E*rkJ>#GF>SJlIrR(3{7=6G+rcIPlCb9#OrY4EUSjo& z7zHSbc^Y>n5b@TJcevZS_(#`)tMA!YOKwdlxXik!ma6ZT*j; zYDvjg>@45biAKsubCq?H;{(1bBXQ$($d!fep={ow=}uTu#}RHzMnxqLTEX5*#I83lsz|I7K8Bb6tUG0aZtZk#qIUEZ5uItTg} zcXV(2q@OTX;Sx?XtjE?G$#d>Y25Z7t|6!d%Hhus>^S7EnK9+m``RloMYc^SzAM(bL z!W=}YIBb9UPbD=~NAd7s_p{DUB{nb5HkQ={YnVGW#3Lt0zF5>5&_NaG8925ohbjO7 c00AHy$pj=mSKG~v(n1FF4%#~jfR)^|U|#uxqyPW_ literal 0 HcmV?d00001 diff --git a/crates/ec-av1/src/gate_coverage.rs b/crates/ec-av1/src/gate_coverage.rs index 89f83c43..23184d52 100644 --- a/crates/ec-av1/src/gate_coverage.rs +++ b/crates/ec-av1/src/gate_coverage.rs @@ -2250,8 +2250,12 @@ mod count_vacuity { let mut out: Vec<(String, &str)> = Vec::new(); for (i, line) in lines.iter().enumerate() { let t = line.trim_start(); - let Some(rest) = t.strip_prefix("fn ") else { continue }; - let Some(nm) = rest.split('(').next() else { continue }; + let Some(rest) = t.strip_prefix("fn ") else { + continue; + }; + let Some(nm) = rest.split('(').next() else { + continue; + }; if nm.contains(' ') { continue; } @@ -2289,6 +2293,21 @@ mod count_vacuity { } } } + // A DOC COMMENT is prose about code, not code. One row in the ledger + // was a `///` line quoting a gate's pre-fix body (`stream.rs:30924`, + // inside `pinned_lr_sgr_stream_call_unique_dump`) and the sweep + // counted it as an unpinned count site for a whole round: the gate + // it describes already spends `FRAMES` and asserts + // `pics.len() == FRAMES`. Skipping comment lines is not cosmetic -- + // without it the ledger carries a row no reader can act on, and the + // ceiling can never reach 0. + // + // Only the SITE scan skips comments. The pin-window walk further + // down still sees every line, because a `//`-led line there is a + // comment BETWEEN the assert and the call, not a site. + if t.starts_with("//") { + continue; + } for callee in CALLEES { let Some(at) = line.find(callee) else { continue; @@ -2551,7 +2570,6 @@ mod count_vacuity { s.len() ); } - } #[cfg(test)] @@ -2598,23 +2616,30 @@ mod count_vacuity_tests { // 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: + // against the encode instead of read off our decode. Two rows survived + // that round; lane-av1pinspec2 closed both, so the ceiling is now 0. + // + // lane-av1pinspec2: 2 -> 0, in two steps. // * `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 + // was handed forward because the count was underivable: the stream + // came from `EC_AV1_SVT1_STREAM`, was never committed, and the gate + // SKIPped on a stock box -- so a wire-derived assert would have been + // an unexercised assert wearing a pin's clothes. The crop is now + // COMMITTED (`fixtures/svt1-split-tx-pin.obu`, a byte-reproducible + // replay of a `-frames:v 1` libsvtav1 encode), the gate reads it, and + // its count comes from the stream's own OBU frame headers with + // `show_existing_frame` asserted false so a header count cannot + // over-count. The gate runs on a stock box, so the assert executes. + // * the other row was 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; + // scan could not tell from code. `sites()` now skips comment lines, + // so the row is no longer a site at all. + // + // RED-BEFORE for the comment skip, which is a coverage change and not a + // cosmetic one: with the `t.starts_with("//")` guard removed and this + // ceiling at 0, the doc-comment row comes BACK as an unpinned site and + // reds with "1 unpinned count site(s), ceiling is 0". + const UNPINNED_CEILING: usize = 0; let unpinned = s.iter().filter(|x| x.pinned_by.is_none()).count(); assert!( unpinned <= UNPINNED_CEILING, @@ -2677,4 +2702,76 @@ mod count_vacuity_tests { "a site has no owning gate -- the sweep's gate attribution is broken" ); } + + /// The comment skip is a COVERAGE change, so it is held to the same shape + /// the `pin_inventory` capability tests use: a SYNTHETIC source, not the + /// live tree, with BOTH halves. Run against the live tree instead, a fix + /// to the very gate that motivated it would delete the row that proves the + /// scanner still works -- the failure mode `pin_inventory` already records + /// as "a scanner that cannot see this shape is how 14 pins survived three + /// rounds". + /// + /// Half one: a count call that lives INSIDE a doc comment must not be a + /// site. That is the real `stream.rs:30924` row, which spent a whole round + /// in the ledger as an unpinned count no reader could act on -- the gate it + /// quotes already spends `FRAMES` and asserts `pics.len() == FRAMES`. + /// + /// Half two, the control: the SAME call as real code must still be a site, + /// and must still be pinned by an assert above it. A scanner that skips + /// comments by skipping the wrong thing looks identical on half one, and a + /// ceiling of 0 is exactly the state where an over-broad skip would go + /// unnoticed. + #[test] + fn a_doc_commented_count_call_is_not_a_site_but_real_code_still_is() { + let commented = r#" + /// The old body passed the wrong count to the oracle: + /// let reference = ffmpeg_decode_sequence(&stream, 192, 128, pics.len()); + /// so a decoder that emitted zero frames asked ffmpeg for zero frames. + fn a_gate_whose_doc_comment_quotes_the_old_body() { + let pics = decode_stream(&data).unwrap(); + } +"#; + let commented_sites = sites(commented); + assert!( + commented_sites.is_empty(), + "a count call inside a `///` doc comment was counted as a site: {:?} -- a line-based \ + scan cannot tell prose from code, and this row is why it now skips comment lines", + commented_sites + .iter() + .map(|x| (x.line, x.count_expr.clone())) + .collect::>() + ); + + let real = r#" + fn a_gate_that_really_spends_its_own_decode_length() { + let pics = decode_stream(&data).unwrap(); + assert_eq!(pics.len(), 7, "{NAME}: expected seven key frames"); + let reference = ffmpeg_decode_sequence(&stream, 192, 128, pics.len()); + } +"#; + let found = sites(real); + assert_eq!( + found.len(), + 1, + "the control did not find its one real site: {:?} -- the comment skip is over-broad \ + if the same call is skipped as code", + found + .iter() + .map(|x| (x.line, x.count_expr.clone(), x.gate.clone())) + .collect::>() + ); + assert_eq!( + found[0].count_expr, "pics.len()", + "control: wrong count expr" + ); + assert_eq!( + found[0].gate, "a_gate_that_really_spends_its_own_decode_length", + "control: wrong gate attribution" + ); + assert!( + found[0].pinned_by.is_some(), + "the control's site is UNPINNED: the comment skip changed the pin window too, \ + because a `//` line between an assert and its call is still walked" + ); + } } diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 0c0e3e2f..b8aa2361 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -5599,23 +5599,52 @@ pub(crate) mod tests { } } - /// lane-svt1: an SVT-AV1 (v3.1.2, `-preset 8 -crf 35`) screen key frame - /// codes 16x16 PALETTE blocks with `skip == 1` whose `tx_depth` split the - /// luma transform. [`crate::decode::decode_block`] armed the palette - /// prediction only when the transform covered the whole block, so that one - /// block predicted DC off its own edges instead: the right symbols (the - /// whole mode ladder diffs clean against an instrumented aomdec) and the - /// wrong pixels -- 812 luma samples in frame 0, carried by the V_PRED - /// blocks under it to 10122 samples over the 12-frame stream. - /// - /// No lavfi recipe witnesses it in a stream this decoder otherwise decodes: - /// 6 sources x 5 sizes x 6 crf values through `libsvtav1 -preset 8 - /// -svtav1-params screen-content-mode=1` produced 8 streams that reach the - /// path, and every one of them either refuses on an unrelated Golomb tail - /// or misses by ~200k samples on unrelated inter-frame defects (both - /// recorded in `lanes/svt1.report.md`). So the gate rides the kept stream - /// named by `EC_AV1_SVT1_STREAM` and SKIPs when it is unset -- the screen - /// crop itself is never committed to `fixtures/`. + /// lane-svt1: an SVT-AV1 (v3.1.2, `-preset 8`) screen key frame codes 16x16 + /// PALETTE blocks with `skip == 1` whose `tx_depth` split the luma + /// transform. [`crate::decode::decode_block`] armed the palette prediction + /// only when the transform covered the whole block, so that one block + /// predicted DC off its own edges instead: the right symbols (the whole mode + /// ladder diffs clean against an instrumented aomdec) and the wrong pixels + /// -- 812 luma samples in frame 0, carried by the V_PRED blocks under it to + /// 10122 samples over the 12-frame stream the defect was found on. + /// + /// lane-av1pinspec2: the gate used to RIDE an external crop named by + /// `EC_AV1_SVT1_STREAM` and SKIP when that was unset, so it never ran on a + /// stock box -- which is exactly why its oracle count could not be pinned + /// (an assert on a gate that never executes is an unexercised assert wearing + /// a pin's clothes). It now runs on the COMMITTED pin + /// `crates/ec-av1/fixtures/svt1-split-tx-pin.obu`. + /// + /// The pin is a REPLAY, not a fresh capture, and the recipe is recorded + /// because it reproduces the bytes exactly (two independent encodes on this + /// box, SVT-AV1 v3.1.2, both sha256 + /// `c9d9c0ae934fba72fc9a9374bc36853f290796a8a4d6442140e239669e0b341f`, + /// 1838 bytes): + /// + /// ffmpeg -v error -f lavfi \ + /// -i "smptehdbars=s=192x152:r=12,drawgrid=w=8:h=8:t=1:c=black" \ + /// -frames:v 1 -c:v libsvtav1 -preset 8 -crf 50 \ + /// -svtav1-params "lp=1:screen-content-mode=1" -g 12 -f obu out.obu + /// + /// `-frames:v 1` is the part lane-svt1's search lacked: its 6x5x6 sweep ran + /// FOUR frames per stream, and the ~200k-sample misses that killed every + /// candidate were on the INTER frames (`lanes/svt1.report.md`). One key + /// frame has no inter frames, and this one reaches the fixed arm + /// (`skip_split_tx_override_hits == 1`) and is pixel-exact. + /// + /// THE COUNT, and why it is derived from the wire rather than from a + /// literal. The oracle is handed the number of frame OBUs this stream + /// actually codes, counted with `Av1Parser` below -- never our decode's + /// length, which is the thing under test. A header count would OVER-count + /// a stream carrying `show_existing_frame` (spec 5.9.5: it codes no pixels, + /// so the header count is larger than the shown-frame count), so that case + /// is asserted impossible on this pin rather than assumed: the loop refuses + /// any frame header with `show_existing_frame` set, which is what makes + /// "one header == one shown frame" a checked fact here instead of an + /// argument. + /// + /// `EC_AV1_SVT1_STREAM` still overrides the pin, so a re-capture is one env + /// var away; `crate_pin` falls back to `pin_dir()` for the same reason. /// /// `skip_split_tx_override_hits` is asserted non-zero so the row cannot /// pass on a stream that never reaches the fixed arm (class @@ -5623,29 +5652,67 @@ pub(crate) mod tests { #[test] fn an_svt_screen_palette_block_with_a_split_transform_decodes_exactly() { const NAME: &str = "an_svt_screen_palette_block_with_a_split_transform_decodes_exactly"; - let Ok(path) = std::env::var("EC_AV1_SVT1_STREAM") else { - eprintln!("SKIP {NAME}: EC_AV1_SVT1_STREAM names no stream"); - return; - }; + const PIN: &str = "svt1-split-tx-pin.obu"; if !have_ffmpeg() { eprintln!("SKIP {NAME}: no ffmpeg"); return; } - let data = match std::fs::read(&path) { - Ok(data) => data, - Err(e) => { - eprintln!("SKIP {NAME}: {path}: {e}"); - return; - } + let path = match std::env::var("EC_AV1_SVT1_STREAM") { + Ok(p) => std::path::PathBuf::from(p), + // The name is spelled as a LITERAL here even though `PIN` is right + // above, on purpose: `gate_coverage::pin_inventory` matches a pin + // read by the quote that follows the callee name, so a const + // argument would leave this pin outside the "every pin a gate reads + // is a committed crate-local copy" invariant. The dup is the + // coverage -- and it is also why this comment must NOT quote that + // spelling: the scanner reads prose too, and a quoted spelling here + // parses as a pin called " and would not see a const argument, ...". + Err(_) => crate_pin("svt1-split-tx-pin.obu"), }; + let data = require_pin(&path, PIN); + // The ENCODE's frame count, read off the WIRE: parse this stream's own + // OBUs and count the frame headers. `show_existing_frame` is refused + // here on purpose -- such a header codes no pixels, so counting it + // would make this count larger than the frames the oracle can decode. + let mut parser = Av1Parser::new(); + let mut pos = 0usize; + let mut frame_headers = 0usize; + while pos < data.len() { + let Ok(obu) = parser.parse_obu(&data[pos..]) else { + break; + }; + pos += obu.total_size.max(1); + let header = match &obu.kind { + ObuKind::Frame(h, _) | ObuKind::FrameHeader(h) => h, + _ => continue, + }; + assert!( + !header.show_existing_frame, + "{NAME}: frame header {frame_headers} sets show_existing_frame, so the header \ + count is not the shown-frame count and this gate's oracle budget would be wrong" + ); + frame_headers += 1; + } + assert!( + frame_headers > 0, + "{NAME}: {} carries no frame header at all", + path.display() + ); crate::decode::reset_skip_split_tx_override_hits(); - let decoded = decode_stream(&data).expect("the kept SVT-AV1 screen stream decodes"); + let decoded = decode_stream(&data).expect("the pinned SVT-AV1 screen stream decodes"); assert!( crate::decode::skip_split_tx_override_hits() > 0, - "{NAME}: no skipped split-transform palette block in {path} -- the gate would pass blind" + "{NAME}: no skipped split-transform palette block in {} -- the gate would pass blind", + path.display() + ); + assert_eq!( + decoded.len(), + frame_headers, + "{NAME}: the stream codes {frame_headers} frame(s), the decode showed {}", + decoded.len() ); let (width, height) = (decoded[0].width, decoded[0].height); - let want = ffmpeg_decode_sequence(&data, width, height, decoded.len()); + let want = ffmpeg_decode_sequence(&data, width, height, frame_headers); for (i, (got, want)) in decoded.iter().zip(&want).enumerate() { assert_eq!(got.y, want.y, "frame {i} luma vs ffmpeg"); assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg"); diff --git a/lanes/av1pinspec2.report.md b/lanes/av1pinspec2.report.md new file mode 100644 index 00000000..d0b741fe --- /dev/null +++ b/lanes/av1pinspec2.report.md @@ -0,0 +1,222 @@ +# lane-av1pinspec2 — commit the SVT crop, count off the wire, and make the sweep comment-aware + +Branch `lane-av1pinspec2`, worktree `~/.cache/wt/av1pinspec2`, base `2c3d3b78` (main +with lane-av1pinspec merged). **Two commits, and the ledger is empty.** + +``` +e923b420 gate_coverage: make the count-vacuity scan comment-aware, ceiling 1 -> 0 +37059b34 stream: run the SVT split-transform gate on a committed pin, count off the wire +``` + +**Outcome (a) on the branch point Main asked me to decide: the SVT crop IS +committable, and it is committed.** A bounded search found a byte-reproducible +`-frames:v 1` libsvtav1 encode that reaches the fixed arm and is pixel-exact, so +the gate now runs on a stock box and its count is derived from the wire. The +alternative (leave the site, name it as an exception) was not needed. + +## 0. The sweep line, before and after + +``` +before: count-vacuity sweep: 59 site(s); 58 spec-pinned by a prior assert, 1 not +after: count-vacuity sweep: 58 site(s); 58 spec-pinned by a prior assert, 0 not +``` + +`59 -> 58` is the SVT gate leaving the population: it no longer spends a +decode-derived `.len()` at all, so it is not a site. `1 -> 0` is the doc-comment +row ceasing to be a site. Ceiling `2 -> 1 -> 0`, tied to each commit's measured +population. + +## 1. Commit 1 — the SVT crop is committable, and here it is + +### 1a. Why lane-svt1's own search missed, and the one parameter that fixes it + +`lanes/svt1.report.md` records a 6 sources x 5 sizes x 6 crf sweep that produced 8 +streams reaching the fixed arm, and killed every one of them: 2 refused on an +unrelated Golomb tail, 6 missed by ~200k-245k samples **on unrelated inter-frame +defects**. That search ran **FOUR frames per stream**. A single key frame has no +inter frames, which is the entire difference. + +The search here: 7 sources x 6 sizes x 6 crf, `-frames:v 1`, `r=12`, +`screen-content-mode=1`, measuring for each candidate that reached the fixed arm +(`skip_split_tx_override_hits > 0`) whether it also decoded and compared exact: + +``` +SEARCH DONE: 1 stream(s) reached the fixed arm, 1 exact +CANDIDATE hits=1 frames=1 192x152 crf=50 bad=0 bytes=1838 :: smptehdbars=s={w}x{h}:r=12,drawgrid=w=8:h=8:t=1:c=black +*** EXACT WINNER +``` + +The six `crf=70` cells are the one dead spot in the sweep and are recorded here +rather than hidden: `libsvtav1` rejects it (`Value 70.000000 for parameter 'crf' +out of range [0 - 63]`). + +### 1b. The pin, and its provenance + +| path | sha256 | size | +|---|---|---| +| `crates/ec-av1/fixtures/svt1-split-tx-pin.obu` | `c9d9c0ae934fba72fc9a9374bc36853f290796a8a4d6442140e239669e0b341f` | 1838 B | + +**A REPLAY, not a fresh capture**, and that is the stronger property: two +independent encodes of + +``` +ffmpeg -v error -f lavfi \ + -i "smptehdbars=s=192x152:r=12,drawgrid=w=8:h=8:t=1:c=black" \ + -frames:v 1 -c:v libsvtav1 -preset 8 -crf 50 \ + -svtav1-params "lp=1:screen-content-mode=1" -g 12 -f obu out.obu +``` + +(SVT-AV1 v3.1.2) produce those exact bytes: + +``` +c9d9c0ae934fba72fc9a9374bc36853f290796a8a4d6442140e239669e0b341f /tmp/svt1-repro1.obu +c9d9c0ae934fba72fc9a9374bc36853f290796a8a4d6442140e239669e0b341f /tmp/svt1-repro2.obu +c9d9c0ae934fba72fc9a9374bc36853f290796a8a4d6442140e239669e0b341f /tmp/svt1-win-192x152-crf50.obu +``` + +Committed with `git add -f` — `.gitignore:2` is a bare `fixtures`, which git +matches at any depth, so the crate's own fixture directory is ignored too. + +### 1c. The count, and the `show_existing_frame` question answered with evidence + +The gate parses the pin's own OBUs with `Av1Parser` and asserts +`decoded.len() == frame_headers` **before** handing that number to the oracle — +the same wire-derived shape lane-av1pinspec used at `stream.rs:13267` for the +cdf-update gate, so there is now one idiom for "the count belongs to the wire" +rather than two. + +A header count would **over-count** a stream carrying `show_existing_frame` +(spec 5.9.5: it codes no pixels, so the header count exceeds the shown-frame +count), which is exactly the objection that made this a hand-forward last round. +It is settled by assertion rather than by argument — the loop **refuses** any +frame header with `show_existing_frame` set: + +```rust +assert!( + !header.show_existing_frame, + "{NAME}: frame header {frame_headers} sets show_existing_frame, so the header \ + count is not the shown-frame count and this gate's oracle budget would be wrong" +); +``` + +so "one header == one shown frame" is a checked fact on this pin, and a future +pin that does carry one reds with the reason instead of silently skewing the +oracle budget. + +### 1d. Non-vacuity, measured, not asserted + +* The gate **runs on a stock box** — `EC_AV1_SVT1_STREAM` unset, `ok` in 0.18 s, + **no SKIP line**. That was the whole reason for the hand-forward. +* The premise bites: `skip_split_tx_override_hits() > 0` mutated to `> 1` reds, + so the fixed arm fires **exactly once** on this pin and the gate cannot pass + blind. + +``` +$ cargo test -p ec-av1 --lib -- an_svt_screen_palette_block_with_a_split_transform_decodes_exactly +an_svt_...: no skipped split-transform palette block in + .../crates/ec-av1/fixtures/svt1-split-tx-pin.obu -- the gate would pass blind +test result: FAILED. 0 passed; 1 failed +``` + +### 1e. Red-before for the commit + +Revert `stream.rs`, keep the new ceiling of 1: + +``` +$ git checkout HEAD -- crates/ec-av1/src/stream.rs +$ cargo test -p ec-av1 --lib -- count_vacuity_tests +2 unpinned count site(s), ceiling is 1 -- a new one was added (lower the ceiling only when a site is actually fixed) +test result: FAILED. 1 passed; 1 failed +``` + +And the new assert bites: + +``` +$ # frame_headers -> frame_headers + 1 +assertion `left == right` failed: an_svt_...: the stream codes 1 frame(s), the decode showed 1 + left: 1 + right: 2 +test result: FAILED. 0 passed; 1 failed +``` + +The "decode showed 1" is the proof the wire count and the decode agree on this +pin, not merely that an assert exists. + +## 2. Commit 2 — the sweep is comment-aware + +The last unpinned row was not a count. It was a `///` doc comment quoting the +pre-r4 body of `pinned_lr_sgr_stream_call_unique_dump` — prose about code, +sitting inside the gate the prose describes, which already spends `FRAMES` and +asserts `pics.len() == FRAMES`. A line-based scan cannot tell the two apart. + +`sites()` now skips lines whose trimmed start is `//`. **Only the SITE scan +skips them**: the pin-window walk still sees every line, because a `//`-led line +there is a comment *between* an assert and its call, not a site. + +### 2a. The capability test, both halves + +`count_vacuity_tests::a_doc_commented_count_call_is_not_a_site_but_real_code_still_is`, +over a **SYNTHETIC** source rather than the live tree — a fix to the very gate +that motivated this would otherwise delete the row that proves the scanner works, +which is the failure mode `pin_inventory` already records as "a scanner that +cannot see this shape is how 14 pins survived three rounds". + +* **half one** — a count call inside a `///` doc comment is NOT a site. This is + the real row this change removes. +* **half two, the control** — the *same call as real code* IS still a site, is + attributed to the right gate, and is still **pinned** by an assert above it. + This is the half that matters: a scanner that skips comments by skipping the + wrong thing looks identical on half one, and a ceiling of 0 is exactly the + state where an over-broad skip would go unnoticed. + +### 2b. Red-before for the commit + +The `t.starts_with("//")` guard removed, ceiling at 0 — **both halves red**: + +``` +$ cargo test -p ec-av1 --lib -- count_vacuity_tests +test ...::a_doc_commented_count_call_is_not_a_site_but_real_code_still_is ... FAILED +test ...::the_count_vacuity_sweep_finds_the_known_sites ... FAILED +1 unpinned count site(s), ceiling is 0 -- a new one was added (lower the ceiling only when a site is actually fixed) +test result: FAILED. 1 passed; 2 failed +``` + +The first half reds because the doc-comment site is counted again; the second +because the population is 1 above a ceiling of 0. Neither half can be reverted +silently. + +## 3. Green + +``` +$ cargo check -p ec-av1 --all-targets + Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.71s + +$ cargo test -p ec-av1 --lib -- gate_coverage pin_inventory count_vacuity +test result: ok. 20 passed; 0 failed; 0 ignored; 0 measured; 744 filtered out; finished in 0.96s + +$ cargo test -p ec-av1 --lib -- count_vacuity_tests::every_locally_derived_oracle_count_is_reported --nocapture +count-vacuity sweep: 58 site(s); 58 spec-pinned by a prior assert, 0 not +``` + +`every_pin_a_gate_reads_is_committed_under_the_crate` passes **with the new pin in +its scope**: `crate_pin` is called with a string **literal** on purpose, because +the pin inventory matches a pin read by the quote that follows the callee name — +a `const PIN` argument would have left this pin outside that invariant. That +call is also why the comment above it must not quote the spelling: the scanner +reads prose too, and a quoted spelling there parsed as a pin called +`` ` and would not see a const argument, ... `` and failed the invariant. Both +halves of that were found by running the invariant, not by reading the code. + +## 4. Not done / deferred + +Nothing is deferred. The ledger is empty (`0 not`), and the two rows lane-av1pinspec +handed forward are both closed — one by committing the crop, one by teaching the +scanner what prose is. +- No full `cargo test -p ec-av1` run — project-wide validation is Main's. +- The `crf=70` column of the search is out of `libsvtav1`'s range and is recorded + as a dead cell rather than dropped; it does not affect the winner, which is + `crf=50`. +- The committed pin is 8-bit 4:2:0 at 192x152. It is a **key frame only**, so this + gate says nothing about SVT's inter-frame coding — that is the defect surface + `lanes/svt1.report.md` measured and this crate still does not decode, and it is + untouched by this lane.