chroma halvings r5: rebased on 3b691e13; item (3) already fixed by C1, item (2) confirmed still deferred
Browse files at this commit26946b299c91729cd69a9cdb935976b7d0ea1709Parent: d9e67452 changed files +125 -2
crates/ec-av1/src/decode.rsmodified+27 -2
| @@ -9274,9 +9274,18 @@ impl Neighbours { | |||
| 9274 | /// differ from each other in not one sample. The gate for this value is | 9274 | /// differ from each other in not one sample. The gate for this value is |
| 9275 | /// therefore a source scan, not a pixel gate -- | 9275 | /// therefore a source scan, not a pixel gate -- |
| 9276 | /// `refusal_inventory::the_skipped_128_root_chroma_suppression_publishes_the_blocks_own_per_axis_chroma_extent`. | 9276 | /// `refusal_inventory::the_skipped_128_root_chroma_suppression_publishes_the_blocks_own_per_axis_chroma_extent`. |
| 9277 | - fn suppress_internal_lf_edges(&mut self, at_mi: (usize, usize), w_mi: usize, h_mi: usize, fctx: &FrameCtx) { | 9277 | + fn suppress_internal_lf_edges( |
| 9278 | + &mut self, | ||
| 9279 | + at_mi: (usize, usize), | ||
| 9280 | + w_mi: usize, | ||
| 9281 | + h_mi: usize, | ||
| 9282 | + fctx: &FrameCtx, | ||
| 9283 | + ) { | ||
| 9278 | let (mi_r, mi_c) = at_mi; | 9284 | let (mi_r, mi_c) = at_mi; |
| 9279 | - let (uv_w, uv_h) = (((w_mi * MI) >> ss_x(fctx)).max(4) as u8, ((h_mi * MI) >> ss_y(fctx)).max(4) as u8); | 9285 | + let (uv_w, uv_h) = ( |
| 9286 | + ((w_mi * MI) >> ss_x(fctx)).max(4) as u8, | ||
| 9287 | + ((h_mi * MI) >> ss_y(fctx)).max(4) as u8, | ||
| 9288 | + ); | ||
| 9280 | for rr in 0..h_mi { | 9289 | for rr in 0..h_mi { |
| 9281 | let start = (mi_r + rr) * self.skip_grid_cols_mi + mi_c; | 9290 | let start = (mi_r + rr) * self.skip_grid_cols_mi + mi_c; |
| 9282 | fill_span(&mut self.uv_tx_grid, start, w_mi, uv_w); | 9291 | fill_span(&mut self.uv_tx_grid, start, w_mi, uv_w); |
| @@ -16829,6 +16838,22 @@ fn decode_intrabc_owned_rect( | |||
| 16829 | ) -> Result<()> { | 16838 | ) -> Result<()> { |
| 16830 | let _ = base_q_idx; | 16839 | let _ = base_q_idx; |
| 16831 | let (px, py) = (mi_c * MI, mi_r * MI); | 16840 | let (px, py) = (mi_c * MI, mi_r * MI); |
| 16841 | + // lane-av1chromahalvings r5: libaom-WRONG at 4:4:4 -- `av1_get_max_uv_txsize` | ||
| 16842 | + // is `ss_size_lookup[bsize]` and `get_vartx_max_txsize` (blockd.h:1447) reads | ||
| 16843 | + // that plane block as `max_txsize_rect_lookup[plane_bsize]`, so chroma extent | ||
| 16844 | + // == luma extent at ss (0,0) -- and the chroma MV origins below are the | ||
| 16845 | + // prediction half of the same defect. MEASURED on the 4:4:4 LOSSY witness | ||
| 16846 | + // fixtures/r512.obu, chroma-only, luma byte-exact on both inter frames. | ||
| 16847 | + // BLOCKED, not missing: with the ss-derived extent the decode REFUSES -- | ||
| 16848 | + // "a rectangular inter chroma transform unit whose shape has no coefficient | ||
| 16849 | + // table set here" -- because a 4:4:4 32x64 chroma plane block needs a | ||
| 16850 | + // `TxbSet` this crate lacks. The fix is a new coefficient set, not a swap. | ||
| 16851 | + // Left as the halving deliberately: turning a decoding stream into a | ||
| 16852 | + // refusal is a behaviour change with its own decision. See | ||
| 16853 | + // lanes/av1chromahalvings.report.md r5. | ||
| 16854 | + if crate::envflags::env_flag!("EC_HALVSWEEP") { | ||
| 16855 | + eprintln!("EC_HALV ibc_owned mi=({mi_r},{mi_c}) bw={bw} bh={bh} skip={skip}"); | ||
| 16856 | + } | ||
| 16832 | let (cw, ch) = (bw / 2, bh / 2); | 16857 | let (cw, ch) = (bw / 2, bh / 2); |
| 16833 | let side = bw.max(bh); | 16858 | let side = bw.max(bh); |
| 16834 | let cside = cw.max(ch); | 16859 | let cside = cw.max(ch); |
lanes/av1chromahalvings.report.mdadded+98 -0
| @@ -0,0 +1,98 @@ | |||
| 1 | + | ||
| 2 | +--- | ||
| 3 | + | ||
| 4 | +# r5 — rebased onto `3b691e13`. Item (3) is ALREADY DONE by another lane; item (2) confirmed still deferred; item (1) NOT STARTED. | ||
| 5 | + | ||
| 6 | +## r5.0 Two of my three chartered items changed status on the rebase, and both changes are retractions in my favour | ||
| 7 | + | ||
| 8 | +**Item (3), `suppress_internal_lf_edges` (`16758`) — ALREADY FIXED, by Agent09-4's C1.** | ||
| 9 | +On `3b691e13` the function now reads: | ||
| 10 | + | ||
| 11 | +```rust | ||
| 12 | +fn suppress_internal_lf_edges(&mut self, at_mi: (usize, usize), w_mi: usize, h_mi: usize, fctx: &FrameCtx) { | ||
| 13 | + let (uv_w, uv_h) = (((w_mi * MI) >> ss_x(fctx)).max(4) as u8, ((h_mi * MI) >> ss_y(fctx)).max(4) as u8); | ||
| 14 | +``` | ||
| 15 | + | ||
| 16 | +`fctx` threaded in and the halving replaced by `>> ss_*` — exactly the fix I | ||
| 17 | +chartered, landed by another lane. **My r1/r2 report's claim that this site is | ||
| 18 | +"format-blind today, a structural constraint" is obsolete**: it was true of | ||
| 19 | +`f33b9d41` and is false of current main. Retracted. | ||
| 20 | + | ||
| 21 | +**Item (2), `cfl_ac_q3_at` — still format-blind, re-measured on the rebased tree.** | ||
| 22 | +The signature on `3b691e13` is still `fn cfl_ac_q3_at(px, py, bw, bh, sample: | ||
| 23 | +impl Fn(usize, usize) -> i32) -> Vec<i32>` with `let (cw, ch) = (bw / 2, bh / 2);` | ||
| 24 | +immediately after. No `fctx`, so the subsampling does not exist inside the | ||
| 25 | +function and cannot be derived there. **It stays deferred, and now with a | ||
| 26 | +measured reason rather than an assumption**: the structural constraint is real | ||
| 27 | +and unchanged, and the witness is real (188 rung hits on the 4:4:4 set), so | ||
| 28 | +what is missing is only the threading through the CfL call tree plus a | ||
| 29 | +CfL-specific pixel gate. Line numbers post-rebase: definition at `19950`, | ||
| 30 | +halving at `19957`. | ||
| 31 | + | ||
| 32 | +## r5.1 The `decode_intra_sub8_leaf` 4:2:2 gap (recorded, not implemented) | ||
| 33 | + | ||
| 34 | +`decode_intra_sub8_leaf` at `decode.rs:45340` (body `45340..46168`) takes | ||
| 35 | +`has_chroma: bool` and branches its chroma handling on that alone. The one | ||
| 36 | +chroma comment inside it reads: | ||
| 37 | + | ||
| 38 | +> `lane-av1llintercdf). At 4:2:0 a sub-8 shape's chroma block is ...` | ||
| 39 | + | ||
| 40 | +There is **no `chroma_444` branch and no `chroma_422` branch** — the sub-8 leaf | ||
| 41 | +has a single chroma path, so at 4:4:4 it computes whatever the 4:2:0 geometry | ||
| 42 | +gives it, and 4:2:2 has no path at all (it is refused by name at the sequence | ||
| 43 | +header, so that is safe, but the shape is not modelled). | ||
| 44 | + | ||
| 45 | +**Caller set** (two call sites, both passing `has_chroma`): `decode.rs:44470` | ||
| 46 | +and `decode.rs:46356`. | ||
| 47 | + | ||
| 48 | +**Why it is a named gap and not a fix:** the 4:2:2 lift needs this shape, but | ||
| 49 | +implementing it is a second `TxbSet` family plus a sub-8 chroma geometry | ||
| 50 | +decision, and this lane has no 4:2:2 witness (the decoder refuses 4:2:2 by | ||
| 51 | +name at the sequence header, so nothing in the pin set exercises it). Recorded | ||
| 52 | +for whoever does the lift; not implemented here. | ||
| 53 | + | ||
| 54 | +## r5.2 Item (1) — the TxbSet — NOT STARTED, and I am not going to fake it | ||
| 55 | + | ||
| 56 | +I rebased, re-measured both other items, and recorded the sub-8 gap. I did | ||
| 57 | +**not** add `ChromaRect32x64`/`ChromaRect64x32`, and I did **not** land the | ||
| 58 | +ss-derived extent. My budget ran out mid-lane and the honest state is: | ||
| 59 | + | ||
| 60 | +- witness `fixtures/r512.obu`: COMMITTED on this branch; | ||
| 61 | +- red-before: MEASURED (r4.2) and quoted in r5.4; | ||
| 62 | +- blocker: NAMED, and the refusal string is exact; | ||
| 63 | +- fix: NOT DONE. | ||
| 64 | + | ||
| 65 | +The remaining work is a real piece of engineering, not a swap: a CDF set per | ||
| 66 | +shape, its `rect_scan`, and the rect forms of `base_ctx_rect`/`br_ctx_rect`, | ||
| 67 | +following `lane-inter4`'s precedent for the rect inter sets. Shipping a | ||
| 68 | +partial version — a set that decodes but whose contexts I have not verified | ||
| 69 | +against the oracle — would put a silent wrongness into the tree, which is the | ||
| 70 | +one outcome this whole lane has been removing. | ||
| 71 | + | ||
| 72 | +**Unblock, unchanged and still ordered:** (1) `ChromaRect32x64` and | ||
| 73 | +`ChromaRect64x32`; (2) then the extent + the eight chroma MV origin pairs, with | ||
| 74 | +r4.2 as the red-before, and the 4:2:0 and 4:4:4-lossless arms re-measured | ||
| 75 | +byte-identical (arithmetic-first: at `ss = 1`, `>> 1` IS `/ 2`). | ||
| 76 | + | ||
| 77 | +## r5.3 The stale-binary tell, written down as instructed | ||
| 78 | + | ||
| 79 | +**A green gate result alongside a target that does not compile is a stale | ||
| 80 | +binary, and `git checkout <branch> -- <file>` is what produces it.** It bit me | ||
| 81 | +twice in one turn: a `git checkout main -- stream.rs` pulled a newer | ||
| 82 | +`stream.rs` (referencing `intra_128_in_inter_mu_chroma_hits`, absent from my | ||
| 83 | +base's `decode.rs`) into a branch based on an older commit; the test target | ||
| 84 | +stopped compiling; and the gates kept reporting green from the old binary. The | ||
| 85 | +only reason I caught it was that a `--no-run` build printed errors while the | ||
| 86 | +gate run said `ok`. **Treat any `--no-run` error that coincides with green | ||
| 87 | +gates as invalidating every gate result in that turn, and re-measure.** | ||
| 88 | + | ||
| 89 | +## r5.4 The red-before, quoted verbatim (the chroma-only signature is the evidence) | ||
| 90 | + | ||
| 91 | +```text | ||
| 92 | +frame 0 (key) Y=166229 wrong from 65728 U=155383 from 32848 V=153498 from 32848 total 475110 | ||
| 93 | +frame 1 (inter) Y=EXACT U=74708 from 49282 V=73501 from 49280 total 148209 | ||
| 94 | +frame 2 (inter) Y=EXACT U=9216 from 114880 V=8192 from 229760 total 17408 | ||
| 95 | +``` | ||
| 96 | + | ||
| 97 | +Luma byte-exact on both inter frames while chroma is wrong is what identifies | ||
| 98 | +this as the chroma-plane sizing defect and not a block-geometry one. | ||