lanes/av1tilerows: class sweep — 32 Reach::of_tu sites inventoried
Browse files at this commit6a7145584b8a0d10e08cc560170c377fc3bb84e0Parent: eb652421 changed file +90 -4
- lanes/av1tilerows.report.md +90 -4
lanes/av1tilerows.report.mdmodified+90 -4
| @@ -186,13 +186,99 @@ introduced here, and neither is a tile-row defect): | ||
| 186 | 186 | |
| 187 | 187 | ## 7. Hygiene |
| 188 | 188 | |
| 189 | -- No temporary instrumentation added: the diagnosis used existing env-gated | |
| 190 | - rungs only (`EC_SYMR`, `EC_TRACE` on the oracle). Nothing to remove — | |
| 191 | - `git diff` touches `decode.rs` (the two reach calls + comments), `stream.rs` | |
| 192 | - (the gate) and the pinned fixture. | |
| 189 | +- The H4 diagnosis added no instrumentation: it used existing env-gated rungs | |
| 190 | + only (`EC_SYMR`, `EC_TRACE` on the oracle). | |
| 191 | +- The §8 class sweep DID add one temporary env-gated counter | |
| 192 | + (`EC_TMP_SB128CHROMA`, at the `decode.rs:41930` arm) to prove 4:4:4 | |
| 193 | + reachability. It is **removed** — `grep -c EC_TMP_SB128CHROMA | |
| 194 | + crates/ec-av1/src/decode.rs` is 0 at HEAD and `git status` is clean against | |
| 195 | + the lane commit. | |
| 196 | +- `git diff` for the fix itself touches `decode.rs` (the two reach calls + | |
| 197 | + comments), `stream.rs` (the gate) and the pinned fixture. Nothing else. | |
| 193 | 198 | - No formatters run. |
| 194 | 199 | - Local runs used `EC_NOMEMGUARD=1`: the repo's `scripts/memguard-runner.sh` |
| 195 | 200 | transient-scope wrapper collided with stale `run-p*.scope` units on this box |
| 196 | 201 | ("Unit run-p…scope was already loaded"), which aborts `cargo test` before any |
| 197 | 202 | test runs. That is an environment artefact, not a test failure — every gate |
| 198 | 203 | above was run with the wrapper bypassed. |
| 204 | + | |
| 205 | +## 8. Class sweep — is the class closed repo-wide? | |
| 206 | + | |
| 207 | +Enumerated **every** production call site of `tu_reach`, `tu_reach_rect` and | |
| 208 | +`Reach::of_tu` (excluding the two wrapper bodies at `decode.rs:1593`/`1622` and | |
| 209 | +`encode.rs:16024`/`16031`/`16180`, which are inside `mod tests`). Result: | |
| 210 | +**32 production sites — 27 ss-aware, 4 4:2:2-only, 1 remaining hardcoded | |
| 211 | +4:2:0-shaped site.** `Reach` is referenced by no crate outside | |
| 212 | +`crates/ec-av1/src/{decode,encode}.rs`, and no site sits behind a feature or | |
| 213 | +`cfg` other than `#[cfg(test)]`. | |
| 214 | + | |
| 215 | +Three correct conventions exist, and no fourth: | |
| 216 | + | |
| 217 | +- **A — canonical ss shift** `ox << ss_x(fctx), oy << ss_y(fctx), 4 << ss_x(fctx)`: | |
| 218 | + 17401, 17488 (fixed here), 35359 (the reference form). | |
| 219 | +- **B — hoisted per-axis luma-span locals** (`span_x = 4 << ss_x`, | |
| 220 | + `luma_span_x = chroma_tx << ss_x`, …): 11610, 20401, 20660, 21021, 21618, | |
| 221 | + 42370, 42497. Semantically identical to A. | |
| 222 | +- **C — 4:4:4-gated identity literal** (a bare `4` / `chroma_tx`, no shift): | |
| 223 | + 22235, 22288, 42249, 44605. Each sits under a guard that *names* | |
| 224 | + `ss_x == 0 && ss_y == 0` (or `chroma_444`), so the literal IS the identity | |
| 225 | + and the guard is load-bearing. Correct as written, but these are the four | |
| 226 | + sites that would break first if a 4:2:0/4:2:2 sibling arm were ever added | |
| 227 | + beside them — flagged, not changed. | |
| 228 | + | |
| 229 | +All remaining luma sites pass pure luma pixel offsets and are SS_AWARE by | |
| 230 | +construction. The 4 HARDCODED_422_ONLY sites (15514, 15782, 17567, 17650) are | |
| 231 | +guarded by `chroma422_rect32 = … && ss_x == 1 && ss_y == 0` (15417) and | |
| 232 | +`chroma422_pair16 = … && ss_x == 1` (17341) — 4:2:2, refused by name at | |
| 233 | +`stream.rs:1749`, and unreachable at 4:4:4. Their `(0, unit_row*8, 8, 8)` is | |
| 234 | +exactly the ss(1,0) luma footprint of a 4x8 chroma unit. | |
| 235 | + | |
| 236 | +### The one remaining member: `decode.rs:41934` — reachable at 4:4:4, NOT fixed here | |
| 237 | + | |
| 238 | +```rust | |
| 239 | +if side > 64 { // plain geometry, not a subsampling test | |
| 240 | + let cu_tx = 32usize; // a CHROMA extent, the 4:2:0 answer | |
| 241 | + let luma_span = cu_tx * 2; // 4:2:0 luma scale -- THE CLASS | |
| 242 | + let (cu_x, cu_y) = (cpx + cc * cu_tx, cpy + cr * cu_tx); | |
| 243 | + let cu_reach = crate::decode::tu_reach(side, side, cc * luma_span, cr * luma_span, luma_span, …); | |
| 244 | +``` | |
| 245 | + | |
| 246 | +**Reachability PROVED by counter, not by argument.** A temporary env-gated | |
| 247 | +counter (added, measured, removed — `grep EC_TMP_SB128CHROMA` is 0 at HEAD) | |
| 248 | +fired **32 times at `ss=(0,0) side=128`** on a 4:4:4 lossy | |
| 249 | +`--sb-size=128 --cq-level=20` stream. 4:4:4 is admitted; only | |
| 250 | +`subsampling_x != subsampling_y` is refused. No committed 4:4:4 fixture fires | |
| 251 | +it (`444_sb128rect_lr_witness`, `444_leaf8_oob`, and all three `ll444_*` pins | |
| 252 | +each fire **0**), so this arm has **no 4:4:4 coverage at all**. | |
| 253 | + | |
| 254 | +**Why it is not patched.** I could not build a witness, and I will not ship an | |
| 255 | +unvalidated change into a path with zero coverage: | |
| 256 | + | |
| 257 | +1. The only recipes that fire the arm are also broken by the **pre-existing H1 | |
| 258 | + entropy fork** — 31272 wrong from frame 3, and byte-identical between base | |
| 259 | + `4155c7c7` and this lane's tip, so it is not mine. A reach delta is invisible | |
| 260 | + under that much damage: A/B-ing `luma_span = cu_tx << ss_x(fctx)` against | |
| 261 | + `cu_tx * 2` gave **byte-identical output on every frame**. | |
| 262 | +2. Every recipe that IS pixel-exact at 4:4:4 refuses to fire the arm | |
| 263 | + (`--enable-rect-partitions=0` and `--enable-1to4-partitions=0` both give 0 | |
| 264 | + fires across six cq/geometry variants, all exact). | |
| 265 | +3. `luma_span` is not the whole defect. Per `blockd.h:1372`, | |
| 266 | + `av1_get_max_uv_txsize(BLOCK_128X128, 0, 0)` is | |
| 267 | + `max_txsize_rect_lookup[BLOCK_128X128]` = `TX_64X64` (adjusted → itself), | |
| 268 | + **not** the `TX_32X32` the comment assumes: at 4:2:0 the plane block is | |
| 269 | + halved to `BLOCK_64X64` first. So at 4:4:4 `cu_tx` should be 64 and | |
| 270 | + `cu_x = cpx + cc * cu_tx` should be `cc * 64`, not `cc * 32` — the arm | |
| 271 | + addresses the wrong chroma region entirely, independently of the reach | |
| 272 | + argument. Patching only `luma_span` would be a **half fix**: it would change | |
| 273 | + the reach answer in an arm whose unit geometry is still 4:2:0-shaped, with | |
| 274 | + no gate able to catch the difference. | |
| 275 | + | |
| 276 | +**Recommendation.** Fix H1 first; this site then becomes witnessable and | |
| 277 | +should be repaired as a unit (`cu_tx = 32 << ss_x(fctx)`, `luma_span = | |
| 278 | +cu_tx << ss_x(fctx)`, and the per-chunk chroma origin with it), with the same | |
| 279 | +`<< 1 == * 2` 4:2:0 identity argument. The 4:2:0 identity is not in question — | |
| 280 | +`32 << 1 == 64` — so the repair is provably a no-op for the only format with | |
| 281 | +committed coverage on this path. | |
| 282 | + | |
| 283 | +**Net class status: the class is closed except for this one site, which is | |
| 284 | +proven reachable and documented rather than silently changed.** |