lanes: av1pinspec2 report -- the SVT crop is committable, and the ledger is empty
Browse files at this commit9341fe5eb5e88d18a9445f82e34d9c50ff6f5fabParent: cefac451 changed file +222 -0
- lanes/av1pinspec2.report.md +222 -0
lanes/av1pinspec2.report.mdadded+222 -0
| @@ -0,0 +1,222 @@ | |||
| 1 | +# lane-av1pinspec2 — commit the SVT crop, count off the wire, and make the sweep comment-aware | ||
| 2 | + | ||
| 3 | +Branch `lane-av1pinspec2`, worktree `~/.cache/wt/av1pinspec2`, base `2c3d3b78` (main | ||
| 4 | +with lane-av1pinspec merged). **Two commits, and the ledger is empty.** | ||
| 5 | + | ||
| 6 | +``` | ||
| 7 | +e923b420 gate_coverage: make the count-vacuity scan comment-aware, ceiling 1 -> 0 | ||
| 8 | +37059b34 stream: run the SVT split-transform gate on a committed pin, count off the wire | ||
| 9 | +``` | ||
| 10 | + | ||
| 11 | +**Outcome (a) on the branch point Main asked me to decide: the SVT crop IS | ||
| 12 | +committable, and it is committed.** A bounded search found a byte-reproducible | ||
| 13 | +`-frames:v 1` libsvtav1 encode that reaches the fixed arm and is pixel-exact, so | ||
| 14 | +the gate now runs on a stock box and its count is derived from the wire. The | ||
| 15 | +alternative (leave the site, name it as an exception) was not needed. | ||
| 16 | + | ||
| 17 | +## 0. The sweep line, before and after | ||
| 18 | + | ||
| 19 | +``` | ||
| 20 | +before: count-vacuity sweep: 59 site(s); 58 spec-pinned by a prior assert, 1 not | ||
| 21 | +after: count-vacuity sweep: 58 site(s); 58 spec-pinned by a prior assert, 0 not | ||
| 22 | +``` | ||
| 23 | + | ||
| 24 | +`59 -> 58` is the SVT gate leaving the population: it no longer spends a | ||
| 25 | +decode-derived `.len()` at all, so it is not a site. `1 -> 0` is the doc-comment | ||
| 26 | +row ceasing to be a site. Ceiling `2 -> 1 -> 0`, tied to each commit's measured | ||
| 27 | +population. | ||
| 28 | + | ||
| 29 | +## 1. Commit 1 — the SVT crop is committable, and here it is | ||
| 30 | + | ||
| 31 | +### 1a. Why lane-svt1's own search missed, and the one parameter that fixes it | ||
| 32 | + | ||
| 33 | +`lanes/svt1.report.md` records a 6 sources x 5 sizes x 6 crf sweep that produced 8 | ||
| 34 | +streams reaching the fixed arm, and killed every one of them: 2 refused on an | ||
| 35 | +unrelated Golomb tail, 6 missed by ~200k-245k samples **on unrelated inter-frame | ||
| 36 | +defects**. That search ran **FOUR frames per stream**. A single key frame has no | ||
| 37 | +inter frames, which is the entire difference. | ||
| 38 | + | ||
| 39 | +The search here: 7 sources x 6 sizes x 6 crf, `-frames:v 1`, `r=12`, | ||
| 40 | +`screen-content-mode=1`, measuring for each candidate that reached the fixed arm | ||
| 41 | +(`skip_split_tx_override_hits > 0`) whether it also decoded and compared exact: | ||
| 42 | + | ||
| 43 | +``` | ||
| 44 | +SEARCH DONE: 1 stream(s) reached the fixed arm, 1 exact | ||
| 45 | +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 | ||
| 46 | +*** EXACT WINNER | ||
| 47 | +``` | ||
| 48 | + | ||
| 49 | +The six `crf=70` cells are the one dead spot in the sweep and are recorded here | ||
| 50 | +rather than hidden: `libsvtav1` rejects it (`Value 70.000000 for parameter 'crf' | ||
| 51 | +out of range [0 - 63]`). | ||
| 52 | + | ||
| 53 | +### 1b. The pin, and its provenance | ||
| 54 | + | ||
| 55 | +| path | sha256 | size | | ||
| 56 | +|---|---|---| | ||
| 57 | +| `crates/ec-av1/fixtures/svt1-split-tx-pin.obu` | `c9d9c0ae934fba72fc9a9374bc36853f290796a8a4d6442140e239669e0b341f` | 1838 B | | ||
| 58 | + | ||
| 59 | +**A REPLAY, not a fresh capture**, and that is the stronger property: two | ||
| 60 | +independent encodes of | ||
| 61 | + | ||
| 62 | +``` | ||
| 63 | +ffmpeg -v error -f lavfi \ | ||
| 64 | + -i "smptehdbars=s=192x152:r=12,drawgrid=w=8:h=8:t=1:c=black" \ | ||
| 65 | + -frames:v 1 -c:v libsvtav1 -preset 8 -crf 50 \ | ||
| 66 | + -svtav1-params "lp=1:screen-content-mode=1" -g 12 -f obu out.obu | ||
| 67 | +``` | ||
| 68 | + | ||
| 69 | +(SVT-AV1 v3.1.2) produce those exact bytes: | ||
| 70 | + | ||
| 71 | +``` | ||
| 72 | +c9d9c0ae934fba72fc9a9374bc36853f290796a8a4d6442140e239669e0b341f /tmp/svt1-repro1.obu | ||
| 73 | +c9d9c0ae934fba72fc9a9374bc36853f290796a8a4d6442140e239669e0b341f /tmp/svt1-repro2.obu | ||
| 74 | +c9d9c0ae934fba72fc9a9374bc36853f290796a8a4d6442140e239669e0b341f /tmp/svt1-win-192x152-crf50.obu | ||
| 75 | +``` | ||
| 76 | + | ||
| 77 | +Committed with `git add -f` — `.gitignore:2` is a bare `fixtures`, which git | ||
| 78 | +matches at any depth, so the crate's own fixture directory is ignored too. | ||
| 79 | + | ||
| 80 | +### 1c. The count, and the `show_existing_frame` question answered with evidence | ||
| 81 | + | ||
| 82 | +The gate parses the pin's own OBUs with `Av1Parser` and asserts | ||
| 83 | +`decoded.len() == frame_headers` **before** handing that number to the oracle — | ||
| 84 | +the same wire-derived shape lane-av1pinspec used at `stream.rs:13267` for the | ||
| 85 | +cdf-update gate, so there is now one idiom for "the count belongs to the wire" | ||
| 86 | +rather than two. | ||
| 87 | + | ||
| 88 | +A header count would **over-count** a stream carrying `show_existing_frame` | ||
| 89 | +(spec 5.9.5: it codes no pixels, so the header count exceeds the shown-frame | ||
| 90 | +count), which is exactly the objection that made this a hand-forward last round. | ||
| 91 | +It is settled by assertion rather than by argument — the loop **refuses** any | ||
| 92 | +frame header with `show_existing_frame` set: | ||
| 93 | + | ||
| 94 | +```rust | ||
| 95 | +assert!( | ||
| 96 | + !header.show_existing_frame, | ||
| 97 | + "{NAME}: frame header {frame_headers} sets show_existing_frame, so the header \ | ||
| 98 | + count is not the shown-frame count and this gate's oracle budget would be wrong" | ||
| 99 | +); | ||
| 100 | +``` | ||
| 101 | + | ||
| 102 | +so "one header == one shown frame" is a checked fact on this pin, and a future | ||
| 103 | +pin that does carry one reds with the reason instead of silently skewing the | ||
| 104 | +oracle budget. | ||
| 105 | + | ||
| 106 | +### 1d. Non-vacuity, measured, not asserted | ||
| 107 | + | ||
| 108 | +* The gate **runs on a stock box** — `EC_AV1_SVT1_STREAM` unset, `ok` in 0.18 s, | ||
| 109 | + **no SKIP line**. That was the whole reason for the hand-forward. | ||
| 110 | +* The premise bites: `skip_split_tx_override_hits() > 0` mutated to `> 1` reds, | ||
| 111 | + so the fixed arm fires **exactly once** on this pin and the gate cannot pass | ||
| 112 | + blind. | ||
| 113 | + | ||
| 114 | +``` | ||
| 115 | +$ cargo test -p ec-av1 --lib -- an_svt_screen_palette_block_with_a_split_transform_decodes_exactly | ||
| 116 | +an_svt_...: no skipped split-transform palette block in | ||
| 117 | + .../crates/ec-av1/fixtures/svt1-split-tx-pin.obu -- the gate would pass blind | ||
| 118 | +test result: FAILED. 0 passed; 1 failed | ||
| 119 | +``` | ||
| 120 | + | ||
| 121 | +### 1e. Red-before for the commit | ||
| 122 | + | ||
| 123 | +Revert `stream.rs`, keep the new ceiling of 1: | ||
| 124 | + | ||
| 125 | +``` | ||
| 126 | +$ git checkout HEAD -- crates/ec-av1/src/stream.rs | ||
| 127 | +$ cargo test -p ec-av1 --lib -- count_vacuity_tests | ||
| 128 | +2 unpinned count site(s), ceiling is 1 -- a new one was added (lower the ceiling only when a site is actually fixed) | ||
| 129 | +test result: FAILED. 1 passed; 1 failed | ||
| 130 | +``` | ||
| 131 | + | ||
| 132 | +And the new assert bites: | ||
| 133 | + | ||
| 134 | +``` | ||
| 135 | +$ # frame_headers -> frame_headers + 1 | ||
| 136 | +assertion `left == right` failed: an_svt_...: the stream codes 1 frame(s), the decode showed 1 | ||
| 137 | + left: 1 | ||
| 138 | + right: 2 | ||
| 139 | +test result: FAILED. 0 passed; 1 failed | ||
| 140 | +``` | ||
| 141 | + | ||
| 142 | +The "decode showed 1" is the proof the wire count and the decode agree on this | ||
| 143 | +pin, not merely that an assert exists. | ||
| 144 | + | ||
| 145 | +## 2. Commit 2 — the sweep is comment-aware | ||
| 146 | + | ||
| 147 | +The last unpinned row was not a count. It was a `///` doc comment quoting the | ||
| 148 | +pre-r4 body of `pinned_lr_sgr_stream_call_unique_dump` — prose about code, | ||
| 149 | +sitting inside the gate the prose describes, which already spends `FRAMES` and | ||
| 150 | +asserts `pics.len() == FRAMES`. A line-based scan cannot tell the two apart. | ||
| 151 | + | ||
| 152 | +`sites()` now skips lines whose trimmed start is `//`. **Only the SITE scan | ||
| 153 | +skips them**: the pin-window walk still sees every line, because a `//`-led line | ||
| 154 | +there is a comment *between* an assert and its call, not a site. | ||
| 155 | + | ||
| 156 | +### 2a. The capability test, both halves | ||
| 157 | + | ||
| 158 | +`count_vacuity_tests::a_doc_commented_count_call_is_not_a_site_but_real_code_still_is`, | ||
| 159 | +over a **SYNTHETIC** source rather than the live tree — a fix to the very gate | ||
| 160 | +that motivated this would otherwise delete the row that proves the scanner works, | ||
| 161 | +which is the failure mode `pin_inventory` already records as "a scanner that | ||
| 162 | +cannot see this shape is how 14 pins survived three rounds". | ||
| 163 | + | ||
| 164 | +* **half one** — a count call inside a `///` doc comment is NOT a site. This is | ||
| 165 | + the real row this change removes. | ||
| 166 | +* **half two, the control** — the *same call as real code* IS still a site, is | ||
| 167 | + attributed to the right gate, and is still **pinned** by an assert above it. | ||
| 168 | + This is the half that matters: a scanner that skips comments by skipping the | ||
| 169 | + wrong thing looks identical on half one, and a ceiling of 0 is exactly the | ||
| 170 | + state where an over-broad skip would go unnoticed. | ||
| 171 | + | ||
| 172 | +### 2b. Red-before for the commit | ||
| 173 | + | ||
| 174 | +The `t.starts_with("//")` guard removed, ceiling at 0 — **both halves red**: | ||
| 175 | + | ||
| 176 | +``` | ||
| 177 | +$ cargo test -p ec-av1 --lib -- count_vacuity_tests | ||
| 178 | +test ...::a_doc_commented_count_call_is_not_a_site_but_real_code_still_is ... FAILED | ||
| 179 | +test ...::the_count_vacuity_sweep_finds_the_known_sites ... FAILED | ||
| 180 | +1 unpinned count site(s), ceiling is 0 -- a new one was added (lower the ceiling only when a site is actually fixed) | ||
| 181 | +test result: FAILED. 1 passed; 2 failed | ||
| 182 | +``` | ||
| 183 | + | ||
| 184 | +The first half reds because the doc-comment site is counted again; the second | ||
| 185 | +because the population is 1 above a ceiling of 0. Neither half can be reverted | ||
| 186 | +silently. | ||
| 187 | + | ||
| 188 | +## 3. Green | ||
| 189 | + | ||
| 190 | +``` | ||
| 191 | +$ cargo check -p ec-av1 --all-targets | ||
| 192 | + Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.71s | ||
| 193 | + | ||
| 194 | +$ cargo test -p ec-av1 --lib -- gate_coverage pin_inventory count_vacuity | ||
| 195 | +test result: ok. 20 passed; 0 failed; 0 ignored; 0 measured; 744 filtered out; finished in 0.96s | ||
| 196 | + | ||
| 197 | +$ cargo test -p ec-av1 --lib -- count_vacuity_tests::every_locally_derived_oracle_count_is_reported --nocapture | ||
| 198 | +count-vacuity sweep: 58 site(s); 58 spec-pinned by a prior assert, 0 not | ||
| 199 | +``` | ||
| 200 | + | ||
| 201 | +`every_pin_a_gate_reads_is_committed_under_the_crate` passes **with the new pin in | ||
| 202 | +its scope**: `crate_pin` is called with a string **literal** on purpose, because | ||
| 203 | +the pin inventory matches a pin read by the quote that follows the callee name — | ||
| 204 | +a `const PIN` argument would have left this pin outside that invariant. That | ||
| 205 | +call is also why the comment above it must not quote the spelling: the scanner | ||
| 206 | +reads prose too, and a quoted spelling there parsed as a pin called | ||
| 207 | +`` ` and would not see a const argument, ... `` and failed the invariant. Both | ||
| 208 | +halves of that were found by running the invariant, not by reading the code. | ||
| 209 | + | ||
| 210 | +## 4. Not done / deferred | ||
| 211 | + | ||
| 212 | +Nothing is deferred. The ledger is empty (`0 not`), and the two rows lane-av1pinspec | ||
| 213 | +handed forward are both closed — one by committing the crop, one by teaching the | ||
| 214 | +scanner what prose is. | ||
| 215 | +- No full `cargo test -p ec-av1` run — project-wide validation is Main's. | ||
| 216 | +- The `crf=70` column of the search is out of `libsvtav1`'s range and is recorded | ||
| 217 | + as a dead cell rather than dropped; it does not affect the winner, which is | ||
| 218 | + `crf=50`. | ||
| 219 | +- The committed pin is 8-bit 4:2:0 at 192x152. It is a **key frame only**, so this | ||
| 220 | + gate says nothing about SVT's inter-frame coding — that is the defect surface | ||
| 221 | + `lanes/svt1.report.md` measured and this crate still does not decode, and it is | ||
| 222 | + untouched by this lane. | ||