lane-av1422liftrisk: the lift's blast radius -- film grain is the one 4:2:0-only module, and seven tests whose only assertion is the refusal
Browse files at this commitf3a29d1c4f9dfaf9b0ba570b220219169302f99eParent: 2d577741 changed file +352 -0
- lanes/av1422liftrisk.report.md +352 -0
lanes/av1422liftrisk.report.mdadded+352 -0
| @@ -0,0 +1,352 @@ | |||
| 1 | +# lane-av1422liftrisk — what breaks when the 4:2:2 sequence-header refusal is lifted | ||
| 2 | + | ||
| 3 | +**Read-only study. No source was changed. Target tree: `main` = `3d56fb60`.** | ||
| 4 | + | ||
| 5 | +**DELIVERABLE CAVEAT, read first.** This lane has no shell and `write` accepts only `xd://` | ||
| 6 | +targets, so I could **not** create `lanes/av1422liftrisk.report.md` nor create/commit branch | ||
| 7 | +`lane-av1422liftrisk`. This document is the report verbatim; the main agent should land it as | ||
| 8 | +the file and commit it. Every claim below carries `path:line`. Where I am reading intent rather | ||
| 9 | +than a mechanism I say so inline and mark confidence. | ||
| 10 | + | ||
| 11 | +--- | ||
| 12 | + | ||
| 13 | +## 0. THE TREE IS NOT WHAT THE CONTEXT SAYS — finding #1, read before anything else | ||
| 14 | + | ||
| 15 | +The context states the guard is live at `stream.rs:1803-1808`. The file on disk reads: | ||
| 16 | + | ||
| 17 | +``` | ||
| 18 | +1803 // TEMP-PROBE-BYPASS: EC_AV1_ALLOW_422_PROBE -- patch, run, restore. Never | ||
| 19 | +1804 // committed. | ||
| 20 | +1805 if false && seq.subsampling_x != seq.subsampling_y { | ||
| 21 | +1806 return Err(Error::unsupported( | ||
| 22 | +1807 "AV1 decode_stream", | ||
| 23 | +1808 "a chroma format of 4:2:2 (subsampling_x != subsampling_y): ...", | ||
| 24 | +``` | ||
| 25 | + | ||
| 26 | +`crates/ec-av1/src/stream.rs:1803-1808`. The probe bypass the sibling report says must **never** | ||
| 27 | +be committed is present in the checkout, and by its own comment it is not supposed to be here. | ||
| 28 | +I have no shell, so I cannot run `git status`/`git diff` to tell whether this is an uncommitted | ||
| 29 | +edit in the primary checkout or an actual commit. **Confidence: mechanism (the file text) is | ||
| 30 | +certain; the git state is unverified.** Either way, every statement in | ||
| 31 | +`lanes/av1422ffmpegbase.report.md` §7 ("`stream.rs:1803` still refuses 4:2:2 by name on | ||
| 32 | +`affe70dc`") and in the assignment's premise ("the guard will be LIFTED") describes a tree this | ||
| 33 | +checkout is not. Reconcile this before anyone lifts anything: the lift may already be half-done | ||
| 34 | +in the working tree, and the `if false &&` will silently make every "it refuses by name" gate | ||
| 35 | +in §3 go RED for the wrong reason. | ||
| 36 | + | ||
| 37 | +--- | ||
| 38 | + | ||
| 39 | +## 1. Every `subsampling_x`/`subsampling_y`/`ss_x`/`ss_y` read and write, classified | ||
| 40 | + | ||
| 41 | +### 1a. Correct today AND correct for 4:2:2 (per-axis, already ported) | ||
| 42 | + | ||
| 43 | +| site | what it does | | ||
| 44 | +|---|---| | ||
| 45 | +| `ec-av1-syntax/src/sequence.rs:455-497` | the only producer. `(0,1)` is unreachable by construction: `subsampling_y` is read only when `subsampling_x == 1` (`:481-485`) | | ||
| 46 | +| `crates/ec-av1/src/stream.rs:1408-1409` | `SeqFlags` copies both | | ||
| 47 | +| `crates/ec-av1/src/stream.rs:1914` | `set_subsampling` publishes both into `FrameCtx` | | ||
| 48 | +| `crates/ec-av1/src/decode.rs:680-693` | the two accessors, already separate | | ||
| 49 | +| `crates/ec-av1/src/decode.rs:697` | `round_ss(dim, ss)` — per-axis by construction | | ||
| 50 | +| `crates/ec-av1/src/decode.rs:35220-35221` | plane alloc `(width >> ss_x, height >> ss_y)`, `true_*` likewise | | ||
| 51 | +| `crates/ec-av1/src/decode.rs:33392, 33399-33401, 37531-37537, 37634-37655` | every output crop uses `round_ss(w, ss_x) x round_ss(h, ss_y)` | | ||
| 52 | +| `crates/ec-av1/src/decode.rs:38930-38939` | `ref_chroma_shape` has a real 4:2:2 arm (`half_w * height`) and an explicit odd-dimension 4:2:0 arm | | ||
| 53 | +| `crates/ec-av1/src/decode.rs:32567-32574` | deblock chroma crop `div_ceil(1 << ss_x)` / `div_ceil(1 << ss_y)` per axis | | ||
| 54 | +| `crates/ec-av1/src/decode.rs:33686` | CDEF chroma origin `(ox >> ss_x, oy >> ss_y)` | | ||
| 55 | +| `crates/ec-av1/src/decode.rs:33905-33907` | CDEF chroma band rows `(j*64) >> ss_y` | | ||
| 56 | +| `crates/ec-av1/src/decode.rs:28440, 33669-33671` | `CDEF_DIR_CONV422` + its dispatch, the asymmetric direction remap | | ||
| 57 | +| `crates/ec-av1/src/restoration.rs:424-441` | `RestorationGrid::with_ss` per axis | | ||
| 58 | +| `crates/ec-av1/src/restoration.rs:530-542` | `mi_size_x = MI_SIZE_8PX >> ss_x`, `mi_size_y = ... >> ss_y` — the split that was itself a 4:2:2 fix | | ||
| 59 | +| `crates/ec-av1/src/restoration.rs:1647` | `voffset = 8 >> ss_y` | | ||
| 60 | +| `crates/ec-av1-syntax/src/frame.rs:1633-1640` | `lr_uv_shift` read only at `ss (1,1)` — matches libaom | | ||
| 61 | +| `crates/ec-av1-syntax/src/frame.rs:1916` | film-grain `num_cb_points = 0` rule already keyed on the pair | | ||
| 62 | +| `crates/ec-av1/src/warp.rs:611-616` | `src_x << subsampling_x`, `dst_y >> subsampling_y` | | ||
| 63 | +| `crates/ec-av1/src/encode.rs:90-109` | `chroma_mi_shape` already carries `(4,4,1,0) -> (2,1)`, `(8,4,1,0)`, `(16,4,1,0)` | | ||
| 64 | +| `crates/ec-av1/src/cdf.rs:3173-3181` | `TXB_SKIP_CHROMA_8_BIG` / `16_BIG`, added specifically because 4:2:2 reaches `get_txb_ctx`'s `+10` arm | | ||
| 65 | + | ||
| 66 | +### 1b. Correct today but WRONG for 4:2:2 (the actual list) | ||
| 67 | + | ||
| 68 | +One module. `crates/ec-av1/src/film_grain.rs`: | ||
| 69 | + | ||
| 70 | +| site | the 4:2:0 assumption | | ||
| 71 | +|---|---| | ||
| 72 | +| `:39` | `const CHROMA_SUBBLOCK: i32 = 16; // LUMA_SUBBLOCK >> subsampling (always 1 here)` | | ||
| 73 | +| `:228-231` | `avgLuma` is a 2x2 luma quad; at 4:2:2 it must be a horizontal pair only | | ||
| 74 | +| `:351` | `let c_stride = (picture.width / 2) as i32;` — right for WIDTH at 4:2:2, but the row model below is not | | ||
| 75 | +| `:577` | `let n = chroma.len().min(grain.len()).min(luma.len() / 2);` — halves the luma operand | | ||
| 76 | +| `:1151` | `let c_stride = width / 2;` in `apply_grain` | | ||
| 77 | +| `:1206` | `let nrows = ((height / 2).max(0) as usize)...` — **half the chroma plane's rows** | | ||
| 78 | +| `:1276` | `while x < width / 2` chroma block column loop | | ||
| 79 | +| `:1413-1414` | `bh = (LUMA_SUBBLOCK >> 1).min(height / 2 - y)`, `bw = ... min(width / 2 - x)` | | ||
| 80 | +| `:1592, 1604, 1621, 1648` | chroma copy-area extents all derived from `>> 1` and `height/2` | | ||
| 81 | +| `:1889-1890` | the test-only reference: `let cw = w / 2; let ch = h / 2;` | | ||
| 82 | + | ||
| 83 | +Consequence at 4:2:2 (`chroma plane = round_ss(w,1) x h`): `c_rows` computed from | ||
| 84 | +`u.len() / c_stride` is `h`, but `nrows` is `h/2`, so the walk covers the **top half** of the | ||
| 85 | +chroma plane and `copy_clean_rows` leaves the bottom half ungrained. Inside the covered half, | ||
| 86 | +chroma row `y` is addressed at luma row `2y` (wrong at 4:2:2, where it should be `y`) and the | ||
| 87 | +`avgLuma` quad is 2x2 where libaom uses a pair. **No panic, no refusal, no counter** — the | ||
| 88 | +output is simply a different picture. `[INFERENCE on reachability]`: libaom ships | ||
| 89 | +`generate_grain_uv_422`, so 4:2:2 film grain is a codable cell; whether `aomenc` will emit it | ||
| 90 | +needs a measured answer (see risk list R3). | ||
| 91 | + | ||
| 92 | +One more, in a comment rather than code: `crates/ec-av1/src/decode.rs:16991-16992` says the | ||
| 93 | +`TxbSet::Chroma16` reader "the caller set is closed -- ... the sequence header admits ss 0/0 and | ||
| 94 | +1/1 only -- so the table is exhaustive". That claim is about the header, and post-lift it is | ||
| 95 | +false. The mechanism (`nw * nh > 1` shapes routing to `Chroma16`/tiled arms) was already | ||
| 96 | +extended for 4:2:2, so the code is fine and the *sentence* becomes a lie. Check it while | ||
| 97 | +editing anyway: the census found 44/51 cells byte-exact, so this table is not the problem. | ||
| 98 | + | ||
| 99 | +### 1c. Unreachable today, becomes a live arm (needs an assertion, not a comment) | ||
| 100 | + | ||
| 101 | +- `crates/ec-av1/src/decode.rs:23388-23398` — `SB128RECT_REPLAY_SPAN_MISMATCH_HITS`, whose own | ||
| 102 | + doc says "Zero on every stream this decoder admits: both supported chroma formats have | ||
| 103 | + `ss_x == ss_y` ... and 4:2:2 ... is refused by name at the sequence header ... so the arm is | ||
| 104 | + defensive until that format is ported." Post-lift it is a real detector. Two gates already | ||
| 105 | + read it and assert zero on 4:2:0/4:4:4 streams (`stream.rs:8577-8583`, `stream.rs:10135-10141`) | ||
| 106 | + — those two stay correct as written, but their prose ("the tripwire for the day it is not") | ||
| 107 | + expires. | ||
| 108 | +- `crates/ec-av1/src/decode.rs:2841-2844` — `RECT_TILED_CHROMA_NXN_HITS`, "only reachable at | ||
| 109 | + 4:2:2, which is refused, so this stays 0 on every admitted stream; kept so the match above is | ||
| 110 | + exhaustive". Post-lift it fires. | ||
| 111 | +- `crates/ec-av1/src/decode.rs:23137` — the `max_units_h` 4:2:2 arm under `ss_x==1 && ss_y==0`. | ||
| 112 | +- `crates/ec-av1/src/decode.rs:40953-41008` — the `chroma_side` enclosing-square / | ||
| 113 | + `chroma_stride` split. Already correct; the guard on it is the only 4:2:2 test. | ||
| 114 | +- The residual uncodable shape: `crates/ec-av1-syntax/src/sequence.rs:481` never reads | ||
| 115 | + `subsampling_y` when `subsampling_x == 0`, so `(0,1)` cannot arrive. Per this repo's rule | ||
| 116 | + that closes with an **assertion**, not a comment. | ||
| 117 | + | ||
| 118 | +### 1d. NOT a decode-path risk (encoder-only, 4:2:0 by construction) | ||
| 119 | + | ||
| 120 | +`crates/ec-av1/src/encoder.rs:76-78` and `crates/ec-av1/src/encode.rs:2232-2234` both hardcode | ||
| 121 | +`subsampling_x: 1, subsampling_y: 1`. `crates/ec-av1/src/tile.rs:417-423` explicitly documents | ||
| 122 | +the 128-root CHUNKS chroma square span as "a PORT note, not a live defect" because "refused by | ||
| 123 | +name at the sequence header today". `crates/ec-av1/src/tile.rs:5004-5006` | ||
| 124 | +`palette_uv_side(side) = (side/2).max(4)` is writer-side; the decoder's counterpart | ||
| 125 | +(`decode.rs:11754-11763` `palette_onscreen_uv`) is per-axis. A decode-only lift leaves all of | ||
| 126 | +these alone, and saying so is part of the answer. | ||
| 127 | + | ||
| 128 | +--- | ||
| 129 | + | ||
| 130 | +## 2. Tables and helpers indexed by the subsampling PAIR | ||
| 131 | + | ||
| 132 | +**Already correct (the recent 4:2:2 work added these; do not touch):** | ||
| 133 | +`chroma422_pair_plane` (`decode.rs:12333-12344`) with its `ss_size_lookup[..][1][0]` census test | ||
| 134 | +(`decode.rs:13626`); `around_mi_422_chroma` (`decode.rs:10362-10419`); `cfl_ac_ss`'s 4:2:2 arm | ||
| 135 | +(`decode.rs:20980-21003`); the per-axis mu-chunk chroma walk | ||
| 136 | +(`decode.rs:42474, 42588, 44287, 44381`); `chroma_side` vs `chroma_stride` | ||
| 137 | +(`decode.rs:40953-41008`); `ref_chroma_shape` (`decode.rs:38930`); `CDEF_DIR_CONV422` | ||
| 138 | +(`decode.rs:28440`); `obmc_skip_chroma_above` taking real `ss_x`/`ss_y` | ||
| 139 | +(`decode.rs:39778, 39939`); the per-axis `is_chroma_reference` arms (`decode.rs:26136, 26620, | ||
| 140 | +27296, 46453-46457, 46953, 47834, 48323, 54380`); `chroma_mi_shape`'s 4:2:2 rows | ||
| 141 | +(`encode.rs:94, 100, 106`); `TXB_SKIP_CHROMA_{8,16}_BIG` (`cdf.rs:3173-3181`). | ||
| 142 | + | ||
| 143 | +**INVALID or MISSING for 4:2:2:** | ||
| 144 | + | ||
| 145 | +1. **`film_grain.rs`'s whole geometry** (§1b). This is the one genuinely missing entry. | ||
| 146 | +2. **`refusal_inventory.rs:2129-2148`** — `every_chroma_unit_a_64_axis_strip_can_present_has_a_ | ||
| 147 | + coefficient_table` enumerates `for (ss_x, ss_y) in [(0,0), (1, 1)]` and asserts | ||
| 148 | + `checked == 8` with the message "the strip domain is not the four 64-axis strips x two | ||
| 149 | + supported formats". Post-lift it does not fail; it silently stops proving anything about | ||
| 150 | + 4:2:2. Its sibling at `refusal_inventory.rs:1871` already walks `[(0,0), (1,0), (1,1)]`, so | ||
| 151 | + the two halves of the same file disagree about the reachable set. That asymmetry is the | ||
| 152 | + cleanest single "would become vacuous" claim in the tree. | ||
| 153 | +3. **No 4:2:2 coefficient-unit census exists.** `set_census_444` | ||
| 154 | + (`decode.rs:2337-2338`, armed `stream.rs:1918`) enables the unit counters **only** at | ||
| 155 | + `ss_x == 0 && ss_y == 0`. At 4:2:2 every `census_444_units()`/`census_444_coded()` counter | ||
| 156 | + reads zero by design. So the non-vacuity requirement the sibling report §4.5 item 5 asks for | ||
| 157 | + ("the reachability counter for the arm each cell witnesses must be `> 0`") **cannot be | ||
| 158 | + written for 4:2:2** using the existing census. The 422 counter families | ||
| 159 | + (`chroma422_square/rect/sub8/chunk/pair_wide_hits`, printed by `decode_probe`) cover a | ||
| 160 | + subset of arms only. A 422 unit census is a prerequisite, not a nicety. | ||
| 161 | + | ||
| 162 | +**Would index out of range?** I found none. The `max_txsize_rect_lookup[255]` / | ||
| 163 | +BLOCK_INVALID cases the sibling report cites (`decode.rs:12393-12397`, `:13619-13623`, | ||
| 164 | +`:17004-17008`) are already handled by the `chroma_422_oob` / `chroma_422_pair_plane` arms and | ||
| 165 | +are guarded by the pinned oracle table at `decode.rs:13629-13640`. | ||
| 166 | + | ||
| 167 | +--- | ||
| 168 | + | ||
| 169 | +## 3. Tests: what goes vacuous, what goes red, what would assert the wrong thing | ||
| 170 | + | ||
| 171 | +From `lanes/av1422ffmpegbase.report.md` §4.3, confirmed against the file: | ||
| 172 | + | ||
| 173 | +| test | `path:line` | today | post-lift | | ||
| 174 | +|---|---|---|---| | ||
| 175 | +| `a_non_420_subsampled_sequence_header_is_refused_by_name` | `stream.rs:2316` (string `:2318`, assert `:2336-2339`) | builds a 4:2:2 header over a **4:2:0 tile from this crate's own encoder** (`:2321`, `:2330-2334`) and asserts the refusal | **goes RED, and it cannot simply be inverted.** The fixture is a header/tile mismatch; the tile is 4:2:0 data. It must be replaced with a real 4:2:2 stream, not flipped to "decodes" | | ||
| 176 | +| `the_440_cell_is_not_a_codable_chroma_shape` arm 3 | `stream.rs:2494`, assert `:2731-2734` | decodes `440_request_is_422.obu` and asserts it refuses by name | **goes RED, same reason and worse.** Per `gen_coverage_cells.rs:252-256` that pin is "a real 4:2:0 key frame's, byte for byte" behind a 4:2:2 header. Arms 1-2 (the shape enumeration, `:2600-2603`) stay valid | | ||
| 177 | +| `the_pinned_422_bigblock_witnesses_are_present_and_refuse_by_name` | `stream.rs:2766`, assert `:2784-2788` | size + `fnv1a64` pin, then `err.contains(REFUSAL)` | goes RED on the refusal assert; the pins stay load-bearing | | ||
| 178 | +| `the_pinned_422_intrabc_sb128_strip_witnesses_refuse_by_name` | `stream.rs:2822`, assert `:2849-2852` | same | same | | ||
| 179 | +| `the_pinned_422_lossless_inter_witnesses_are_present_and_refuse_by_name` | `stream.rs:3012`, assert `:3029-3032` | same | same | | ||
| 180 | +| `the_pinned_422_residual_compound_warp_witness_is_present_and_refuses_by_name` | `stream.rs:3328`, assert `:3346-3350` | same | same | | ||
| 181 | +| `the_pinned_422_lr_off_witness_is_present_and_refuses_by_name` | `stream.rs:3408`, assert `:3426-3429` | same | same | | ||
| 182 | + | ||
| 183 | +**Which pass ONLY because of the refusal.** All seven above. Each one's only behavioural | ||
| 184 | +assertion is `err.contains(REFUSAL)`, which is a statement about a *refusal*, not about pixels: | ||
| 185 | +they would pass unchanged on a tree where 4:2:2 decode is completely broken but still refused | ||
| 186 | +at the header. They are byte-pin tests wearing decode-test clothes. Inverting them to an | ||
| 187 | +ffmpeg byte-exact decode is the whole point of the lift. | ||
| 188 | + | ||
| 189 | +**Which become VACUOUS rather than red (the quieter failure):** | ||
| 190 | + | ||
| 191 | +- `refusal_inventory.rs:2129-2148` — the `(0,0)`/`(1,1)` strip enumeration (§2 item 2). Passes, | ||
| 192 | + proves nothing. | ||
| 193 | +- `refusal_inventory.rs:854` `the_decode_path_refuses_exactly_the_listed_cases` — asserts both | ||
| 194 | + directions. If the guard goes and the `REFUSALS` row at `:150` and the `PROVEN` tuple at | ||
| 195 | + `:530-533` do not, the "listed but no longer in the decode path" direction goes red. If all | ||
| 196 | + three go in the same commit, fine; if the string is retired but the tuple is not, red. | ||
| 197 | +- `refusal_inventory.rs:1732-1736` — the doc of the other enumeration names | ||
| 198 | + `a_non_420_subsampled_sequence_header_is_refused_by_name` as the thing that refuses `(1,0)`. | ||
| 199 | + After the lift the file lies in prose. | ||
| 200 | +- `stream.rs:51405-51418` `cfl_ac_q3_at_is_reached_only_through_the_420_fallthrough_of_cfl_ac_ss` | ||
| 201 | + — the doc asserts "4:2:2 is refused at the sequence header", but the **mechanism still holds**: | ||
| 202 | + `cfl_ac_ss` (`decode.rs:20980`) dispatches `(1,0)` before the 4:2:0 fallthrough. Do not | ||
| 203 | + "fix" this gate; fix its prose. | ||
| 204 | +- `decode.rs:5434-5439` `top_half_compound_hits` — `#[allow(dead_code)]`, doc says "NO COMMITTED | ||
| 205 | + TEST READS THIS, and none can while the 4:2:2 header refusal stands". Post-lift it is the | ||
| 206 | + natural non-vacuity anchor for the compound/warp cells and should get a reader. | ||
| 207 | + | ||
| 208 | +**Already correct, must not be touched:** the per-axis source-scan gates | ||
| 209 | +`the_422_lossless_inter_chroma_walk_sites_stay_per_axis` (`stream.rs:3058`, geometry table | ||
| 210 | +`:3204-3260`, including the `assert_ne!(plane_block(16,1,0), enclosing(16,1,0))` at `:3228-3234` | ||
| 211 | +that exists precisely to prove 4:2:2 is not square) and | ||
| 212 | +`the_intrabc_128rect_chroma_chunk_walk_stays_per_axis` (`stream.rs:2870`, per-axis unit counts | ||
| 213 | +`:2965-2967`). These are the gates that make the lift safe, and they pass on `main` today. | ||
| 214 | + | ||
| 215 | +--- | ||
| 216 | + | ||
| 217 | +## 4. Product-surface strings that become lies | ||
| 218 | + | ||
| 219 | +Searched the whole repo (including gitignored `.delta/` worktrees) for `4:2:2`, | ||
| 220 | +"decodes 4:2:0 and 4:4:4", "not ported", "is not supported". | ||
| 221 | + | ||
| 222 | +- `crates/ec-av1/src/stream.rs:1808` and `crates/ec-av1/src/refusal_inventory.rs:150` / `:530` — | ||
| 223 | + the refusal string itself. Removed with the guard. | ||
| 224 | +- `crates/ec-av1/examples/gen_coverage_cells.rs:33-37` ("the shape this decoder refuses by | ||
| 225 | + name"), `:256`, `:309` ("4:2:2, the shape this decoder refuses by name") — a **generator's** | ||
| 226 | + user-visible message. It will print a false claim. | ||
| 227 | +- `crates/ec-av1/src/stream.rs:1779-1781` and `:1791` — the guard's own doc comment ("the decoder | ||
| 228 | + hardcodes 4:2:0 everywhere", "4:2:2 (ss_x != ss_y) is not [decoded]"). | ||
| 229 | +- `crates/ec-av1/src/stream.rs:2302-2308` — the refusal test's doc. | ||
| 230 | +- `crates/ec-av1/src/stream.rs:1384-1388` — `SeqFlags`' doc: "these exist only for the | ||
| 231 | + sequence-level refusal ... nothing downstream reads them". Post-lift false; the whole | ||
| 232 | + per-axis port invalidates it. | ||
| 233 | +- `crates/ec-av1/src/stream.rs:2759-2763`, `:2816-2821`, `:2997-3002`, `:3323-3326`, `:3403-3406` | ||
| 234 | + — five doc blocks saying "with the header refusal standing, NO committed test can decode a | ||
| 235 | + 4:2:2 stream". | ||
| 236 | +- `crates/ec-av1/src/stream.rs:8560-8570`, `:10122-10128` — the two tripwire gates' prose. | ||
| 237 | +- `crates/ec-av1/src/decode.rs:23391-23398`, `:2841-2844`, `:16991-16992`. | ||
| 238 | +- `crates/ec-av1/src/refusal_inventory.rs:137-149`, `:1732-1736`, `:2007-2011`. | ||
| 239 | + | ||
| 240 | +**No public format declaration to correct.** `crates/ec-av1/src` exposes no `VideoFrame` / | ||
| 241 | +`PixelFormat` surface (grep for `PixelFormat|VideoFrame` in the crate: no matches), and | ||
| 242 | +`crates/ec-core/src/frame.rs:17, 23, 99` already carries `I422` / `I210` with | ||
| 243 | +`chroma_shift() -> (1, 0)` at `:99`. There is no README and no docs directory in | ||
| 244 | +`crates/ec-av1`. So the "user-visible text" surface is: the refusal error, the generator's | ||
| 245 | +message, and comments. There is no CLI banner and no capability table to lie. `[confidence: | ||
| 246 | +high — the search was repo-wide and the crate has no such file]` | ||
| 247 | + | ||
| 248 | +--- | ||
| 249 | + | ||
| 250 | +## 5. ORDERED LIFT RISK LIST — check these FIRST, quietest failure first | ||
| 251 | + | ||
| 252 | +**R1. `stream.rs:1805` is already `if false &&`.** Quietest failure of all: everything below | ||
| 253 | +looks like it "already works" and the guards are dead. Catch: `git diff --stat | ||
| 254 | +crates/ec-av1/src/stream.rs` and `grep -n 'if false &&' crates/ec-av1/src/stream.rs`. **First | ||
| 255 | +action, before any other.** | ||
| 256 | + | ||
| 257 | +**R2. `film_grain.rs` synthesises the wrong 4:2:2 picture, silently.** Bottom half of the | ||
| 258 | +chroma plane never grained; top half grained with a 4:2:0 row map and a 2x2 `avgLuma` quad. No | ||
| 259 | +panic, no counter, no refusal. Catch: | ||
| 260 | +`ffmpeg -f lavfi -i testsrc2=size=320x240 -pix_fmt yuv422p … | aomenc --profile=2 | ||
| 261 | +--film-grain-test=5 --obu` then compare our `decode_stream` output against ffmpeg's default | ||
| 262 | +decode of the same bytes. If aomenc refuses to emit 4:2:2 grain, the cell is latent-only and the | ||
| 263 | +site should be closed with a named assertion at `film_grain.rs:39`, not left as a comment. | ||
| 264 | +Secondary check: `crate::film_grain::grain_hits()` must be `> 0` on that stream, or the gate is | ||
| 265 | +the "params-without-apply" false green the 12-bit gate already guards against | ||
| 266 | +(`stream.rs:16626-16629`). | ||
| 267 | + | ||
| 268 | +**R3. 12-bit 4:2:2 is codable and has ZERO census coverage.** At profile 2 and 12 bits both | ||
| 269 | +subsampling bits are coded (`sequence.rs:479-485`), so `(1,0)` at 12 bits is a legal header. The | ||
| 270 | +sibling report's 51-cell corpus has 10-bit but **no 12-bit 4:2:2 cell**, and the sweep recipe | ||
| 271 | +it quotes (`lanes/av1422ffmpegbase.report.md:95-98`) passes `--input-bit-depth=$d` with `d ∈ | ||
| 272 | +{8,10}` only. Nothing in this tree has ever decoded a 12-bit 4:2:2 stream. Catch: the same | ||
| 273 | +`ffcensus.py` comparator with `-pix_fmt yuv422p12le` over a 12-bit 4:2:2 encode. | ||
| 274 | + | ||
| 275 | +**R4. The 7 known-diverging cells.** `s422_320x246`, `s422_322x240`, `s422_322x246`, | ||
| 276 | +`s422_352x242_10b`, `s422_384x240`, `s422_416x242_10b`, `s422_416x250_10b` | ||
| 277 | +(`lanes/av1422ffmpegbase.report.md:157-171`). Six are chroma-only, all at non-8-aligned | ||
| 278 | +geometries. The assignment says `s422_384x240` is the last one and belongs to another lane; | ||
| 279 | +the other six are **not** attributed to anyone in that report (§7: "It does not attribute any | ||
| 280 | +of the 7 divergences"). Whoever lifts must decide whether "lift with 6 known-red cells" is | ||
| 281 | +acceptable, because the gate in §4.5 of that report is 51/51. Catch: `ffcensus.py cells_ff.json` | ||
| 282 | +as written. | ||
| 283 | + | ||
| 284 | +**R5. `440_request_is_422.obu` is a 4:2:2 header over a 4:2:0 tile.** Post-lift it does not | ||
| 285 | +refuse — it decodes with wrong pixels or panics in a chroma extent. It is the one pin whose | ||
| 286 | +misleading content is *inside* the committed tree. Catch: `cargo test -p ec-av1 --lib | ||
| 287 | +the_440_cell_is_not_a_codable_chroma_shape` immediately after the guard change, and expect a | ||
| 288 | +panic, not a clean failure. | ||
| 289 | + | ||
| 290 | +**R6. The `440_request_is_422.obu`-shaped test constructions generally.** Same defect at | ||
| 291 | +`stream.rs:2321-2334`: any test that bolts a 4:2:2 header onto this crate's 4:2:0 encoder | ||
| 292 | +output cannot be inverted into an exactness gate. Enumerate them before editing — this is the | ||
| 293 | +class where a careless "invert the assert" produces a green gate over garbage. | ||
| 294 | + | ||
| 295 | +**R7. `refusal_inventory.rs:2129-2148` silently stops covering 4:2:2.** No failure, no output | ||
| 296 | +change. Catch: add `(1,0)` to the loop and re-run | ||
| 297 | +`cargo test -p ec-av1 --lib every_chroma_unit_a_64_axis_strip_can_present`; the `checked == 8` | ||
| 298 | +assert must move to 12 and every new unit must be in `arms`. | ||
| 299 | + | ||
| 300 | +**R8. No 4:2:2 unit census, so the non-vacuity gate is unwritable.** `set_census_444` | ||
| 301 | +(`decode.rs:2337`) enables the unit counters at `ss (0,0)` only. Until a 422 census exists, | ||
| 302 | +a byte-exact 4:2:2 gate can be green while exercising nothing. Catch: assert | ||
| 303 | +`census_444_units()` deltas — they will read `[0,0,0]` on every 4:2:2 cell today, which is the | ||
| 304 | +proof that the counter family is not the right one to gate on. | ||
| 305 | + | ||
| 306 | +**R9. Superres + 4:2:2 has no cell either.** The sweep recipe passes no `--enable-superres`; the | ||
| 307 | +superres upscale path (`decode.rs:37531-37537`, `:37581-37584`) is per-axis and looks right, but | ||
| 308 | +it is unmeasured at `(1,0)`. Catch: one `--enable-superres` 4:2:2 encode through the same | ||
| 309 | +comparator. | ||
| 310 | + | ||
| 311 | +**R10. Prose that lies.** §4 above. Zero behavioural risk, but a reviewer reading | ||
| 312 | +`stream.rs:1779` ("the decoder hardcodes 4:2:0 everywhere") after the lift will think the port | ||
| 313 | +never happened. Catch: `grep -n '4:2:2' crates/ec-av1/src crates/ec-av1/examples` and read each | ||
| 314 | +hit. | ||
| 315 | + | ||
| 316 | +**R11. The residual `(0,1)` guard.** `sequence.rs:481` makes it unreachable; per repo rule it | ||
| 317 | +closes with an assertion, not a comment. Catch: the assertion itself. | ||
| 318 | + | ||
| 319 | +--- | ||
| 320 | + | ||
| 321 | +## 6. Confidence statement | ||
| 322 | + | ||
| 323 | +- **Mechanism, certain** (I read the code): every `path:line` classification in §1a, §1b, §2, | ||
| 324 | + §3, §4; the film-grain row model; the census arming condition; the guard's current text. | ||
| 325 | +- **Intent, not mechanism** (flagged inline): whether libaom/aomenc can actually emit a 4:2:2 | ||
| 326 | + film-grain stream (R2) — I read libaom's naming, I did not run an encode. | ||
| 327 | +- **Unverified**: the git state of `stream.rs:1803-1805`. This lane has no shell, so I could | ||
| 328 | + not run `git status` or `git diff`. Finding §0 is a fact about the file, not about the index. | ||
| 329 | +- **Not re-derived, taken from the sibling report**: the 95-cell census and the 7 divergences | ||
| 330 | + (R4). I did not re-run it. | ||
| 331 | + | ||
| 332 | +--- | ||
| 333 | + | ||
| 334 | +## 0.1 LANDING NOTE (Main, after this study ran) | ||
| 335 | + | ||
| 336 | +Two things about §0 and R1, in the report's own framing of "the tree is not what the context says": | ||
| 337 | + | ||
| 338 | +1. **The bypass patch in the working tree was real and is now gone.** `crates/ec-av1/src/stream.rs` carried the | ||
| 339 | + uncommitted `if false && seq.subsampling_x != seq.subsampling_y` plus its `// TEMP-PROBE-BYPASS` comment in the | ||
| 340 | + PRIMARY checkout, left there by a patch-run-restore measurement. Main restored it (`git checkout -- | ||
| 341 | + crates/ec-av1/src/stream.rs`) and verified: the live file, `HEAD`, and every lane commit that `git log -S` | ||
| 342 | + flags all read the plain guard again (`grep -c 'if false &&' = 0`; `git log -S` hits were doc-comment mentions, | ||
| 343 | + and each flagged commit's `stream.rs` contains no bypass). **The near-miss is the finding**: nothing was | ||
| 344 | + committed, but the patch sat in the primary checkout across several merges, one `git add -A` away from | ||
| 345 | + committing a silently-admitted format. | ||
| 346 | +2. **The study was landed by Main, not by the lane.** This lane is a read-only scout with no shell and no way to | ||
| 347 | + write the file, so the report text was carried in its output; Main wrote it here verbatim (only this note is | ||
| 348 | + added). Branch `lane-av1422liftrisk` therefore does not exist — the file is on `main`. | ||
| 349 | + | ||
| 350 | +Everything below stands as written, including the classifications, which were made against the guard as the lane | ||
| 351 | +found it on disk and are unaffected by the restore (the file's *content* was the plain guard's neighbour, not a | ||
| 352 | +different arm). | ||