lane-av1gates444: report -- three measured-EXACT 4:4:4 lossy cells pinned with live aomenc gates, recipe byte-identical to the sweep's, red-before measured on two mutations, and the third cell measured NOT to be a superres cell
Browse files at this commit064c55984a1398bd133bebfb6f7d0b8975e941ceParent: fe8f0151 changed file +173 -0
- lanes/av1gates444.report.md +173 -0
lanes/av1gates444.report.mdadded+173 -0
| @@ -0,0 +1,173 @@ | |||
| 1 | +# lane-av1gates444 — three measured-EXACT 4:4:4 lossy cells, pinned | ||
| 2 | + | ||
| 3 | +## 1. What this lane is | ||
| 4 | + | ||
| 5 | +Tests only. `crates/ec-av1/src/decode.rs` is **not** edited in the committed | ||
| 6 | +tree (`git diff --stat` on the lane commit: `crates/ec-av1/src/stream.rs | 225 | ||
| 7 | +insertions(+), 0 deletions`). No new `#[ignore]`. No new `tests/*.rs` file — | ||
| 8 | +all three gates live in the existing `ec-av1` lib test binary | ||
| 9 | +(`crates/ec-av1/src/stream.rs`, `pub(crate) mod tests`). | ||
| 10 | + | ||
| 11 | +Branch `lane-av1gates444`, one commit `81f88fd1` on top of `a21f3680`. | ||
| 12 | + | ||
| 13 | +## 2. The cells, and the recipe that reproduces them | ||
| 14 | + | ||
| 15 | +The three cells come from `lanes/av1formatsweep.report.md` §6.2 and | ||
| 16 | +`lanes/av1444rect.report.md` §8. All three were **EXACT 4/4 with no committed | ||
| 17 | +gate**; only the lane report carried the evidence. | ||
| 18 | + | ||
| 19 | +The sweep's encode is reproduced byte-for-byte. The stream sizes and sha256 | ||
| 20 | +prefixes below match the sweep's table exactly, which is how the recipe is | ||
| 21 | +confirmed rather than approximated: | ||
| 22 | + | ||
| 23 | +```text | ||
| 24 | +ffmpeg -f lavfi -i "testsrc2=size=<W>x<H>:rate=25" -frames:v 4 \ | ||
| 25 | + -pix_fmt yuv444p -f yuv4mpegpipe - | \ | ||
| 26 | +aomenc --codec=av1 --profile=1 --passes=1 --end-usage=q --cq-level=20 \ | ||
| 27 | + --cpu-used=2 --threads=1 --row-mt=0 --lag-in-frames=0 \ | ||
| 28 | + --kf-max-dist=100 --limit=4 --obu -o - - | ||
| 29 | +``` | ||
| 30 | + | ||
| 31 | +| cell | gate | bytes | sha256 | sweep said | | ||
| 32 | +|---|---|---|---|---| | ||
| 33 | +| odd 66x66 | `a_444_lossy_odd_66x66_stream_decodes_pixel_exact` | 5938 | `973eddf4…` | 5938 / `973eddf4…` | | ||
| 34 | +| odd 130x122 | `a_444_lossy_odd_130x122_stream_decodes_pixel_exact` | 8945 | `c87ac65b…` | 8945 / `c87ac65b…` | | ||
| 35 | +| 256x128 | `a_444_lossy_256x128_stream_decodes_pixel_exact` | 15239 | `06621606…` | 15239 / `06621606…` | | ||
| 36 | + | ||
| 37 | +Two flags are load-bearing and both are documented in the gate's doc comment: | ||
| 38 | + | ||
| 39 | +- `rate=25` — testsrc2's pattern is time-parameterised, so `rate=1` is a | ||
| 40 | + different stream. | ||
| 41 | +- `--limit=4` — the sweep's frame count. At `--limit=6` the same recipe emits | ||
| 42 | + 7674 / 11465 / 19121 bytes, i.e. a *different* stream than the one measured. | ||
| 43 | + Measured, not assumed. | ||
| 44 | +- `--profile=1` is what makes the source 4:4:4 at all. | ||
| 45 | + | ||
| 46 | +### 2.1 The third cell is NOT a superres cell | ||
| 47 | + | ||
| 48 | +The sweep recorded it as "4:4:4 **superres** 256x128 (`--superres-mode=1`)" and | ||
| 49 | +`av1444rect` §8 corrected that. Measured here to settle it independently: | ||
| 50 | + | ||
| 51 | +| encode | bytes | sha256 | | ||
| 52 | +|---|---|---| | ||
| 53 | +| 256x128 without `--superres-mode=1` | 15239 | `881ab784…` at limit=6 / `06621606…` at limit=4 | | ||
| 54 | +| 256x128 **with** `--superres-mode=1` | 15239 | identical | | ||
| 55 | + | ||
| 56 | +The flag is a no-op on this aomenc build. The gate is therefore named | ||
| 57 | +`a_444_lossy_256x128_stream_decodes_pixel_exact` — for its geometry — and the | ||
| 58 | +doc comment says so explicitly, so the next lane does not re-derive a superres | ||
| 59 | +claim from the sweep's table. | ||
| 60 | + | ||
| 61 | +## 3. The three gates | ||
| 62 | + | ||
| 63 | +All three share two helpers in the same file: `encode_444_lossy_live` (ffmpeg | ||
| 64 | +y4m → live aomenc, `run_with_stdin` deadline, non-empty-OBU assert) and | ||
| 65 | +`gate_444_lossy_live_exact` (the body). Modelled on | ||
| 66 | +`a_444_lossy_rect4_inter_stream_decodes_pixel_exact` (stream.rs:7240), with | ||
| 67 | +three deliberate differences: | ||
| 68 | + | ||
| 69 | +1. **No pin.** The stream is encoded live against the oracle aomenc, because | ||
| 70 | + the claim is a property of the decoder at a geometry, not of a blob. The | ||
| 71 | + sweep's byte counts live in the doc comment as the recipe's provenance. | ||
| 72 | +2. **The pixel compare cannot be skipped.** The old gate guards it with | ||
| 73 | + `if aomdec_path().is_file()`; these three assert. If aomenc resolved but | ||
| 74 | + no aomdec sits beside it, the gate FAILS rather than reporting green for a | ||
| 75 | + decoder it never looked at (class `gate-blind-to-the-arm`). It still SKIPs | ||
| 76 | + when there is no oracle at all, which `have_aomenc()` turns into a hard | ||
| 77 | + failure under `EC_AV1_REQUIRE_AOMENC=1` — the crate's existing convention. | ||
| 78 | +3. **Per-cell geometry, asserted before the compare.** Frame count 4, and per | ||
| 79 | + frame `(f.width, f.height) == (W, H)` plus `f.u.len() == f.v.len() == | ||
| 80 | + f.y.len() == W*H`. At 4:4:4 a decoder keeping a subsampled extent would | ||
| 81 | + hand quarter-size planes to the byte compare; the gate says which invariant | ||
| 82 | + broke instead of letting the compare stand in for the shape claim. | ||
| 83 | + | ||
| 84 | +Non-vacuity, per cell: `decode::rect4_inter_own_chroma444_hits() > 0` after a | ||
| 85 | +reset — the 4:4:4-only own-chroma-extent route in `decode_inter_block`'s | ||
| 86 | +`around_c` that this class is about. A 4:2:0 stream of the same content reads | ||
| 87 | +0. Measured **13 / 12 / 24** own-extent gathers at 66x66 / 130x122 / 256x128. | ||
| 88 | + | ||
| 89 | +## 4. Green (this tree, oracle aomenc + aomdec present) | ||
| 90 | + | ||
| 91 | +``` | ||
| 92 | +$ ec_av1 a_444_lossy_odd_66x66_stream_decodes_pixel_exact --nocapture | ||
| 93 | +a_444_lossy_odd_66x66_stream_decodes_pixel_exact: 66x66 4:4:4 lossy, 4 decode-order frame(s) | ||
| 94 | + byte-exact vs aomdec (0 hidden), 13 own-extent 1:4 chroma gather(s) | ||
| 95 | +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 714 filtered out | ||
| 96 | + | ||
| 97 | +$ ec_av1 a_444_lossy_odd_130x122_stream_decodes_pixel_exact --nocapture | ||
| 98 | +a_444_lossy_odd_130x122_stream_decodes_pixel_exact: 130x122 4:4:4 lossy, 4 decode-order frame(s) | ||
| 99 | + byte-exact vs aomdec (0 hidden), 12 own-extent 1:4 chroma gather(s) | ||
| 100 | +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 714 filtered out | ||
| 101 | + | ||
| 102 | +$ ec_av1 a_444_lossy_256x128_stream_decodes_pixel_exact --nocapture | ||
| 103 | +a_444_lossy_256x128_stream_decodes_pixel_exact: 256x128 4:4:4 lossy, 4 decode-order frame(s) | ||
| 104 | + byte-exact vs aomdec (0 hidden), 24 own-extent 1:4 chroma gather(s) | ||
| 105 | +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 714 filtered out | ||
| 106 | +``` | ||
| 107 | + | ||
| 108 | +Untouched-and-still-green, same binary: | ||
| 109 | + | ||
| 110 | +``` | ||
| 111 | +$ ec_av1 a_444_lossy_rect4_inter --test-threads=1 → ok | ||
| 112 | +$ ec_av1 unrefreshed_primary_ref_slot --test-threads=1 → ok (the stream.rs source-scan guard) | ||
| 113 | +``` | ||
| 114 | + | ||
| 115 | +## 5. Red-before, measured (both mutations reverted, neither committed) | ||
| 116 | + | ||
| 117 | +### 5.1 `decode.rs` `around_c` own-extent arm → the 4:2:0 pair extent | ||
| 118 | + | ||
| 119 | +`Some(_) if ss_x(fctx) == 0 => { hit!(…); around }` replaced with the pair | ||
| 120 | +gather `neighbours.around_mi_rect(s.pair_mi, pw, ph)` at `(16,8)` HORZ / | ||
| 121 | +`(8,16)` VERT. The `hit!` stayed, so the reach assert still fires and the red | ||
| 122 | +lands on the pixel arm rather than the counter — the lesson from | ||
| 123 | +skill://ec-av1-pipeline-gate-counters. | ||
| 124 | + | ||
| 125 | +| gate | result | | ||
| 126 | +|---|---| | ||
| 127 | +| 66x66 | **green** — expected, see 5.3 | | ||
| 128 | +| 130x122 | **RED**: decode-order frame 3 of 4, byte 2208 (ours 134 vs oracle 170), **11521 bytes differ** | | ||
| 129 | +| 256x128 | **RED**: decode-order frame 2 of 4, byte 192 (ours 92 vs oracle 106), **25296 bytes differ** | | ||
| 130 | + | ||
| 131 | +The 130x122 number is the sweep's, to the byte: sweep §6.2 said "DIVERGENT | ||
| 132 | +from f3, 11521 samples, first (f3, s2208) = Y(128,16)". The 256x128 numbers are | ||
| 133 | +`av1444rect` §8's base row ("DIVERGENT f2 25296"). | ||
| 134 | + | ||
| 135 | +### 5.2 `ec-av1-syntax` `compute_image_size` — the mi-grid ceil floored | ||
| 136 | + | ||
| 137 | +`h.mi_cols = 2 * ((h.frame_width + 7) >> 3)` → | ||
| 138 | +`2 * (h.frame_width >> 3)` (and the row line likewise). | ||
| 139 | + | ||
| 140 | +| gate | result | | ||
| 141 | +|---|---| | ||
| 142 | +| 66x66 | **RED**: `restoration.rs:783` — "range end index 4098 out of range for slice of length 4096" | | ||
| 143 | +| 130x122 | **RED**: decode-order frame 0 of 4, byte 128 (ours 74 vs oracle 170), 22724 bytes differ | | ||
| 144 | +| 256x128 | **green**, correctly — 256x128 is a multiple of 8 in both axes, so the ceil and the floor agree and the cell is not supposed to see this mutation | | ||
| 145 | + | ||
| 146 | +### 5.3 What 66x66 is, stated honestly | ||
| 147 | + | ||
| 148 | +`odd444_66x66` is a **coverage pin, not a witness for the strip fix**. The | ||
| 149 | +sweep measured it EXACT 4/4 on the *pre-fix* base, so mutation 5.1 cannot | ||
| 150 | +make it red and no mutation of the strip route ever will. Its | ||
| 151 | +load-bearingness is mutation 5.2: it is the only gate here whose geometry is | ||
| 152 | +partial in **both** axes, and dropping the mode-info grid's ceil breaks it on | ||
| 153 | +the first decode. 130x122 and 256x128 are witnesses for the 4:4:4 lossy | ||
| 154 | +strip-own-extent class; 66x66 is the pin for the odd-in-both-axes 4:4:4 lossy | ||
| 155 | +walk. Both roles are load-bearing and neither is invented. | ||
| 156 | + | ||
| 157 | +## 6. Invariants held | ||
| 158 | + | ||
| 159 | +- `crates/ec-av1/src/decode.rs`: not edited in the committed tree. | ||
| 160 | +- Existing gates: not edited — the commit is 225 insertions, 0 deletions, one | ||
| 161 | + file. | ||
| 162 | +- Same test binary: `crates/ec-av1/src/stream.rs`, `pub(crate) mod tests`. | ||
| 163 | +- No new `#[ignore]`. | ||
| 164 | +- Commit message carries the mechanism and the measurements, no host paths. | ||
| 165 | + | ||
| 166 | +## 7. Not done, stated | ||
| 167 | + | ||
| 168 | +- The three gates encode on every run, so each costs one ffmpeg + one aomenc | ||
| 169 | + (~0.6 s measured, all three together). If a future lane finds that too | ||
| 170 | + expensive for a loop run, the pin migration is mechanical: the byte counts | ||
| 171 | + and sha256 prefixes are in §2. | ||
| 172 | +- Only 8-bit lossy cq-20 is covered. 4:4:4 lossy at 10/12 bits and the tile | ||
| 173 | + cells stay the sweep's open list; nothing here narrows that gap. | ||