The parsed-header table, the exact verdicts, and the formatsweep correction to propose
Browse files at this commit5af8d8d82ca8c861da5b1d123d4622cf75773628Parent: a6c679e- docs
- the parsed-header table, the exact verdicts, and the formatsweep correction to propose
1 changed file +233 -0
- lanes/av1superhbd.report.md +233 -0
lanes/av1superhbd.report.mdadded+233 -0
| @@ -0,0 +1,233 @@ | |||
| 1 | +# lane-av1superhbd — 4:4:4 SUPERRES at 10-bit and 12-bit | ||
| 2 | + | ||
| 3 | +**Verdict: EXACT at both depths. Five gates added, all green, all mutation-proved red-before.** | ||
| 4 | + | ||
| 5 | +Branch `lane-av1superhbd` (base `a21f3680`); the gate+fixture commit is the | ||
| 6 | +parent of this report's commit. | ||
| 7 | +Oracle: libaom `v3.13.3-7-g9bb526a` (`~/.cache/aom-oracle/build/aomdec`). | ||
| 8 | + | ||
| 9 | +--- | ||
| 10 | + | ||
| 11 | +## 1. Parsed headers — read from each stream's OWN sequence/frame header | ||
| 12 | + | ||
| 13 | +Every number below comes from `ec_av1_syntax`'s `Av1Parser` walking the pinned | ||
| 14 | +bytes, never from the encoder flags. A stream that parses `use_superres=false` | ||
| 15 | +was discarded, not pinned. | ||
| 16 | + | ||
| 17 | +### Accepted (all five) | ||
| 18 | + | ||
| 19 | +| stream | bytes | sha256 | SEQ `bit_depth` | SEQ `ss` | SEQ `enable_superres` | per-frame `use_superres` | per-frame `superres_denom` | per-frame `upscaled_width` | per-frame coded `frame_width x frame_height` | | ||
| 20 | +|---|---|---|---|---|---|---|---|---|---| | ||
| 21 | +| `444_lossy_superres_256x128_d12_10bit.obu` | 15803 | `95b49d7aa81843399ee3aa64bdadfec8f4037bcc3f861923c9b2da3bc868b223` | 10 | (0,0) | true | true x4 | 12, 12, 12, 12 | 256, 256, 256, 256 | 171x128 x4 | | ||
| 22 | +| `444_lossy_superres_mode2_256x128_10bit.obu` | 17776 | `699398aba58fb53b80e05d3d214eb746a3c91945e01da6b47488513f20b55668` | 10 | (0,0) | true | true x4 | 11, 14, 15, 9 | 256, 256, 256, 256 | 186x128, 146x128, 137x128, 228x128 | | ||
| 23 | +| `444_lossy_superres_256x128_d12_12bit.obu` | 11023 | `973bf374c0185c4e6301509ce834cef01318e6cdb9488fd258118d7ec89bdd04` | 12 | (0,0) | true | true x4 | 12, 12, 12, 12 | 256, 256, 256, 256 | 171x128 x4 | | ||
| 24 | +| `444_lossy_superres_256x128_d9_12bit.obu` | 13015 | `898c775108495b998cb5ec9b08e194d4656ed0140aa8e7e7236892d468bbad99` | 12 | (0,0) | true | true x4 | 9, 9, 9, 9 | 256, 256, 256, 256 | 228x128 x4 | | ||
| 25 | +| `444_lossy_superres_mode2_256x128_12bit.obu` | 14656 | `18aa8b3124ab10672f22577a8eea81e44141a3d0bb506104aee2f950254a2e9f` | 12 | (0,0) | true | true x4 | 11, 14, 15, 9 | 256, 256, 256, 256 | 186x128, 146x128, 137x128, 228x128 | | ||
| 26 | + | ||
| 27 | +Scaled-size arithmetic re-derived per frame and held on all 20 frame headers: | ||
| 28 | +`(upscaled_width*8 + denom/2)/denom == frame_width` — | ||
| 29 | +`(256*8+6)/12 = 171`, `(256*8+1)/9 = 228`, `(256*8+5)/11 = 186`, | ||
| 30 | +`(256*8+7)/14 = 146`, `(256*8+7)/15 = 137`. | ||
| 31 | + | ||
| 32 | +### Discarded | ||
| 33 | + | ||
| 34 | +Nothing was discarded for `use_superres=false` — every stream above was built | ||
| 35 | +with an explicit `--superres-denominator` / `--superres-kf-denominator` pair, so | ||
| 36 | +the libaom no-op (denominator flag absent -> denom 8, nothing scaled) could not | ||
| 37 | +occur. The two mode-2 arms carry denominators 11/14/15/9, three of which no | ||
| 38 | +command-line flag ever named, which is itself the proof that the headers are | ||
| 39 | +what the gates read. | ||
| 40 | + | ||
| 41 | +--- | ||
| 42 | + | ||
| 43 | +## 2. Verdicts — exactness against the instrumented oracle | ||
| 44 | + | ||
| 45 | +Frame counts and per-frame byte lengths are asserted by | ||
| 46 | +`decode_all_frames_vs_oracle` BEFORE the pixel compare; it writes | ||
| 47 | +`EC_AV1_FINAL_DUMP` frames on both sides and compares them byte-for-byte in | ||
| 48 | +DECODE order, so a frame-length mismatch is a hard failure, not a short compare. | ||
| 49 | + | ||
| 50 | +| gate | frames compared | hidden | divergent | `superres_hits` delta | `predict_scaled_hits` delta | | ||
| 51 | +|---|---|---|---|---|---| | ||
| 52 | +| `a_444_lossy_superres_10bit_d12_stream_decodes_pixel_exact` | 4/4 | 0 | **0** | 4 | 2097 | | ||
| 53 | +| `a_444_lossy_superres_10bit_mode2_random_denom_stream_decodes_pixel_exact` | 4/4 | 0 | **0** | 4 | 2181 | | ||
| 54 | +| `a_444_lossy_superres_12bit_d12_stream_decodes_pixel_exact` | 4/4 | 0 | **0** | 4 | 1311 | | ||
| 55 | +| `a_444_lossy_superres_12bit_d9_stream_decodes_pixel_exact` | 4/4 | 0 | **0** | 4 | 1956 | | ||
| 56 | +| `a_444_lossy_superres_12bit_mode2_random_denom_stream_decodes_pixel_exact` | 4/4 | 0 | **0** | 4 | 1737 | | ||
| 57 | + | ||
| 58 | +`test result: ok. 5 passed; 0 failed; 0 ignored` (712 filtered out). | ||
| 59 | + | ||
| 60 | +--- | ||
| 61 | + | ||
| 62 | +## 3. Gates | ||
| 63 | + | ||
| 64 | +`crates/ec-av1/src/stream.rs`, one shared body `a_444_hbd_superres_arm` plus | ||
| 65 | +five `#[test]` arms. Every arm asserts: | ||
| 66 | + | ||
| 67 | +- the pinned bytes (length + FNV-1a), read at full decode order; | ||
| 68 | +- `ss (0,0)` from the sequence header, and **`bit_depth` equal to the depth the | ||
| 69 | + gate names** — the high-bit-depth claim is otherwise unprovable, because a | ||
| 70 | + mistyped `--bit-depth` still yields a decodable scaled 4:4:4 stream, just at | ||
| 71 | + a different cell (the same phantom-cell trap as the `use_superres=false` | ||
| 72 | + case lane-av1444edge r3 recorded); | ||
| 73 | +- `enable_superres` on the sequence header and `use_superres` on every parsed | ||
| 74 | + frame header; | ||
| 75 | +- the per-frame PARSED `superres_denom` against a `(denominator, coded width)` | ||
| 76 | + table in decode order, the upscaled size, and the coded size; | ||
| 77 | +- `FrameWidth == (UpscaledWidth*8 + denom/2)/denom` re-derived from that frame's | ||
| 78 | + own parsed denominator — not a literal comparison alone, so a re-pinned | ||
| 79 | + fixture cannot satisfy the numbers while the scaled-size arithmetic moves | ||
| 80 | + under them; | ||
| 81 | +- `superres_hits` and `predict_scaled_hits` as **DELTAS** (both are | ||
| 82 | + process-wide counters with no reset, so absolute values would pass on residue | ||
| 83 | + from another stream); | ||
| 84 | +- every returned frame at the UPSCALED size with full-resolution 4:4:4 chroma | ||
| 85 | + plane lengths, and every sample bounded by `(1 << bit_depth) - 1` — a decoder | ||
| 86 | + that produced 8-bit values padded into a `u16` plane would satisfy every | ||
| 87 | + geometry assert and only be caught here; | ||
| 88 | +- all decode-order frames byte-exact against the instrumented `aomdec`. | ||
| 89 | + | ||
| 90 | +The two mode-2 arms add the **distinct-denominator assert** the charter asked | ||
| 91 | +for: `distinct.len() >= 3` across the parsed denominators, and at least one | ||
| 92 | +denominator not in `{9, 12, 16}`. So neither arm can silently stop being a | ||
| 93 | +scaled, multi-ratio cell — a libaom that collapsed mode 2 onto one denominator, | ||
| 94 | +or started honouring `--superres-denominator` under mode 2, turns the arm red | ||
| 95 | +instead of quietly re-pinning it into a different claim. | ||
| 96 | + | ||
| 97 | +### Red-before (both mutations on the committed tree, then reverted) | ||
| 98 | + | ||
| 99 | +| mutation | site | result | | ||
| 100 | +|---|---|---| | ||
| 101 | +| tap alignment in the upscale filter: `let idx = base + int_pel + k as i64 + 1;` | `superres.rs:141` (`upscale_row`) | **5/5 RED at pixel level.** e.g. 10-bit d12: `decode-order frame 0 of 4 differs from the oracle at byte 0 (ours 40 vs 38), 54916 bytes differ`; 10-bit mode-2: `byte 0 (ours 41 vs 40), 53206 bytes differ` | | ||
| 102 | +| counter: `note_upscaled_picture` body emptied (`hit!(SUPERRES_HITS)` removed) | `superres.rs:188` | **5/5 RED** on the non-vacuity assert: `zero superres_hits -- the upscaler never ran (class gate-blind-to-feature)` | | ||
| 103 | + | ||
| 104 | +Both reverted; `git status --porcelain` clean; the five gates re-run green on | ||
| 105 | +the committed tree afterwards. | ||
| 106 | + | ||
| 107 | +--- | ||
| 108 | + | ||
| 109 | +## 4. Recipes | ||
| 110 | + | ||
| 111 | +`-strict -1` is load-bearing on the y4m pipe: without it ffmpeg refuses to | ||
| 112 | +write `yuv444p10le` / `yuv444p12le` at all (zero bytes out). | ||
| 113 | + | ||
| 114 | +10-bit (`testsrc2`, both arms): | ||
| 115 | + | ||
| 116 | +```text | ||
| 117 | +ffmpeg -f lavfi -i "testsrc2=size=256x128:rate=25" -frames:v 4 \ | ||
| 118 | + -pix_fmt yuv444p10le -strict -1 -f yuv4mpegpipe - | \ | ||
| 119 | +aomenc --codec=av1 --profile=1 --bit-depth=10 --input-bit-depth=10 \ | ||
| 120 | + --passes=1 --end-usage=q --cq-level=20 --cpu-used=2 --threads=1 \ | ||
| 121 | + --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 --limit=4 \ | ||
| 122 | + --superres-mode=1 --superres-denominator=12 \ | ||
| 123 | + --superres-kf-denominator=12 --obu -o - - | ||
| 124 | +``` | ||
| 125 | + | ||
| 126 | +Swap the last three lines for `--superres-mode=2 --obu -o - -` for the mode-2 arm. | ||
| 127 | + | ||
| 128 | +12-bit (`mandelbrot`, see §5): | ||
| 129 | + | ||
| 130 | +```text | ||
| 131 | +ffmpeg -f lavfi -i "mandelbrot=size=256x128:rate=25" -frames:v 4 \ | ||
| 132 | + -pix_fmt yuv444p12le -strict -1 -f yuv4mpegpipe - | \ | ||
| 133 | +aomenc --codec=av1 --profile=1 --bit-depth=12 --input-bit-depth=12 \ | ||
| 134 | + --passes=1 --end-usage=q --cq-level=20 --cpu-used=2 --threads=1 \ | ||
| 135 | + --row-mt=0 --lag-in-frames=0 --kf-max-dist=100 --limit=4 \ | ||
| 136 | + --superres-mode=1 --superres-denominator=<9|12> \ | ||
| 137 | + --superres-kf-denominator=<9|12> --obu -o - - | ||
| 138 | +``` | ||
| 139 | + | ||
| 140 | +Byte-reproducible: two independent encodes of the 12-bit den=12 recipe produced | ||
| 141 | +the same 11023 bytes, sha256 `973bf374…`. | ||
| 142 | + | ||
| 143 | +--- | ||
| 144 | + | ||
| 145 | +## 5. The 12-bit source: `mandelbrot`, not `testsrc2` | ||
| 146 | + | ||
| 147 | +`testsrc2` at 12 bits parses `allow_screen_content_tools = true` on every | ||
| 148 | +frame, which the crate refuses by name | ||
| 149 | +(`a 12-bit frame with screen content tools (allow_screen_content_tools=1: …)`) | ||
| 150 | +— palette and intrabc have no 12-bit witness. The identical recipe at **10 bits** | ||
| 151 | +does not trip it, so the flag set is not the variable; the source content is. | ||
| 152 | + | ||
| 153 | +Flag-combination attempt table, all read from the pinned-then-parsed headers | ||
| 154 | +(same geometry, same 12-bit depth, `--superres-mode=1 --superres-denominator=12`): | ||
| 155 | + | ||
| 156 | +| attempt | `allow_screen_content_tools` (parsed) | our decoder | | ||
| 157 | +|---|---|---| | ||
| 158 | +| `testsrc2` yuv444p12le, base flags | true | REFUSED by name | | ||
| 159 | +| + `--enable-palette=0 --enable-intrabc=0` | true | REFUSED by name | | ||
| 160 | +| + `--tune-content=film` | true | REFUSED by name | | ||
| 161 | +| + both, `--tune-content=film` | true | REFUSED by name | | ||
| 162 | +| `--cpu-used=8` | true | REFUSED by name | | ||
| 163 | +| `--cq-level=40` | true | REFUSED by name | | ||
| 164 | +| `testsrc` yuv444p12le | true | REFUSED by name | | ||
| 165 | +| `mandelbrot` yuv444p12le | **false** | **decodes, 4 frames 256x128** | | ||
| 166 | +| `nullsrc` yuv444p12le (135-byte stream) | false | decodes — but vacuous, no content | | ||
| 167 | + | ||
| 168 | +Root cause in the oracle source, so the next lane does not re-derive it: | ||
| 169 | +`av1_set_screen_content_options` (`av1/encoder/encoder.c:2427`) defers to | ||
| 170 | +`encoder_utils.c:1153`, which keys the decision on the **first pass's | ||
| 171 | +palette-pixel ratio**, not on `--enable-palette` / `--enable-intrabc` / | ||
| 172 | +`--tune-content`. A photographic source keeps the ratio below threshold. | ||
| 173 | +Recorded in the gate doc comment as well. | ||
| 174 | + | ||
| 175 | +--- | ||
| 176 | + | ||
| 177 | +## 6. Correction to `lanes/av1formatsweep.report.md` | ||
| 178 | + | ||
| 179 | +The not-measured list is closed for this cell. Proposed replacement text only — | ||
| 180 | +this lane does not edit that file (another lane corrected parts of it today and | ||
| 181 | +the merge must apply cleanly). | ||
| 182 | + | ||
| 183 | +**Line 83** (the 4:4:4 matrix row) — current: | ||
| 184 | + | ||
| 185 | +```markdown | ||
| 186 | +| superres | – | – | – | | ||
| 187 | +``` | ||
| 188 | + | ||
| 189 | +proposed: | ||
| 190 | + | ||
| 191 | +```markdown | ||
| 192 | +| superres | Y (5 gates, `444_lossy_superres_*` pins) | **Y (gates, this lane)** | **Y (gates, this lane)** | | ||
| 193 | +``` | ||
| 194 | + | ||
| 195 | +**Line 493** (§6.5 "Still not measured after this round") — current fragment: | ||
| 196 | + | ||
| 197 | +```markdown | ||
| 198 | +Still not measured after this round: 4:4:4 at 10/12 bits with **tile rows | ||
| 199 | +actually enabled** (needs a >= 256-high geometry — trap 2); 4:4:4 superres at | ||
| 200 | +10/12 bits; 4:4:4 odd dims at 10/12 bits and at dimensions other than 66x66 / | ||
| 201 | +``` | ||
| 202 | + | ||
| 203 | +proposed: | ||
| 204 | + | ||
| 205 | +```markdown | ||
| 206 | +Still not measured after this round: 4:4:4 at 10/12 bits with **tile rows | ||
| 207 | +actually enabled** (needs a >= 256-high geometry — trap 2); 4:4:4 odd dims at 10/12 bits and at dimensions other than 66x66 / | ||
| 208 | +``` | ||
| 209 | + | ||
| 210 | +**Line 438** (§6.2 table) — the `sr444` DIVERGENT row predates lane-av1444edge | ||
| 211 | +r3, which showed that stream passes `--superres-mode=1` with no denominator and | ||
| 212 | +therefore parses `use_superres=false denom=8` on all four frames: it was never a | ||
| 213 | +scaled cell. The 8-bit 4:4:4 superres coverage is `lane-av1superpin`'s | ||
| 214 | +(`444_lossy_superres_256x128_d12.obu`, `_d9`, `_mode2`). I did not touch this | ||
| 215 | +row — that correction belongs to the lane that made the measurement, and it is | ||
| 216 | +already landed on `lane-av1superpin` (`9646f74d` "correct the published cells | ||
| 217 | +the superres no-op got wrong"). Flagged here only so the merge does not | ||
| 218 | +reintroduce the stale `D` next to the new `Y`s. | ||
| 219 | + | ||
| 220 | +--- | ||
| 221 | + | ||
| 222 | +## 7. What is NOT claimed | ||
| 223 | + | ||
| 224 | +- Only 4:4:4 (`ss 0,0`) at 10 and 12 bits, 256x128 upscaled geometry, lossy | ||
| 225 | + cq-20 cpu-used-2, and denominators 9/11/12/14/15. Not claimed: 4:2:0 HBD | ||
| 226 | + superres (the sweep's `sr420_12` already covers 4:2:0 12-bit), lossless HBD | ||
| 227 | + superres, tile-geometry interaction, or any other source. | ||
| 228 | +- The 12-bit arms run on `mandelbrot` content only. `testsrc2`-class content at | ||
| 229 | + 12 bits is still refused by the screen-content gate — that refusal is | ||
| 230 | + unchanged and this lane did not touch it. | ||
| 231 | +- Frame counts are 4 per stream, all shown, zero hidden; these are | ||
| 232 | + `--lag-in-frames=0 --auto-alt-ref` default single-layer streams, so the | ||
| 233 | + hidden-frame arm of the oracle compare is exercised but has nothing to find. | ||