From 26946b299c91729cd69a9cdb935976b7d0ea1709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Tue, 29 Sep 2026 21:43:39 +0300 Subject: [PATCH] chroma halvings r5: rebased on 3b691e13; item (3) already fixed by C1, item (2) confirmed still deferred Two of the three chartered items change status on the rebase, and both changes are retractions in this lane's favour. ITEM (3) suppress_internal_lf_edges -- ALREADY FIXED by Agent09-4's C1. On 3b691e13 the function now takes fctx and reads ((w_mi * MI) >> ss_x(fctx)).max(4), ((h_mi * MI) >> ss_y(fctx)).max(4) which is exactly the fix r1/r2 chartered. The r1/r2 claim that this site is "format-blind today, a structural constraint" was true of f33b9d41 and is FALSE of current main. Retracted. ITEM (2) cfl_ac_q3_at -- still format-blind, now with a measured reason rather than an assumption. Post-rebase the signature is still fn cfl_ac_q3_at(px, py, bw, bh, sample) -> Vec with `let (cw, ch) = (bw / 2, bh / 2);` at 19957 and no fctx, so the subsampling cannot be derived inside the function. The witness is real (188 rung hits on the 4:4:4 set); what is missing is only the threading through the CfL call tree plus a CfL-specific pixel gate. Deferred with that reason. ITEM (1) -- the ChromaRect32x64 / ChromaRect64x32 coefficient sets and the ss-derived extent -- NOT STARTED. Witness committed, red-before measured, the refusal string exact, and the remaining work is real engineering rather than a swap: a CDF set per shape, its rect_scan, and the rect forms of base_ctx_rect/br_ctx_rect, following lane-inter4's precedent for the rect inter sets. Shipping a partial version would put a silent wrongness into the tree, which is the outcome this lane has been removing. Unblock order is in the report. decode_intra_sub8_leaf (decode.rs:45340, body 45340..46168) RECORDED as a named gap: it takes has_chroma: bool and has NO chroma_444 branch and NO chroma_422 branch -- a single chroma path, so at 4:4:4 it computes the 4:2:0 geometry and 4:2:2 has no path at all. Callers: decode.rs:44470 and decode.rs:46356, both passing has_chroma. Not implemented: the 4:2:2 lift needs the shape, but this lane has no 4:2:2 witness (the decoder refuses 4:2:2 by name at the sequence header), so a fix here would be unmeasured. The stale-binary tell is written into the report: a green gate result alongside a target that does not compile is a stale binary, and `git checkout -- ` is what produces it. It bit this lane twice in one turn. Any --no-run error that coincides with green gates invalidates every gate result in that turn. --- crates/ec-av1/src/decode.rs | 29 ++++++++- lanes/av1chromahalvings.report.md | 98 +++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 2 deletions(-) create mode 100644 lanes/av1chromahalvings.report.md diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 08559c9f..19c3dbb5 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -9274,9 +9274,18 @@ impl Neighbours { /// differ from each other in not one sample. The gate for this value is /// therefore a source scan, not a pixel gate -- /// `refusal_inventory::the_skipped_128_root_chroma_suppression_publishes_the_blocks_own_per_axis_chroma_extent`. - fn suppress_internal_lf_edges(&mut self, at_mi: (usize, usize), w_mi: usize, h_mi: usize, fctx: &FrameCtx) { + fn suppress_internal_lf_edges( + &mut self, + at_mi: (usize, usize), + w_mi: usize, + h_mi: usize, + fctx: &FrameCtx, + ) { let (mi_r, mi_c) = at_mi; - 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); + 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, + ); for rr in 0..h_mi { let start = (mi_r + rr) * self.skip_grid_cols_mi + mi_c; fill_span(&mut self.uv_tx_grid, start, w_mi, uv_w); @@ -16829,6 +16838,22 @@ fn decode_intrabc_owned_rect( ) -> Result<()> { let _ = base_q_idx; let (px, py) = (mi_c * MI, mi_r * MI); + // lane-av1chromahalvings r5: libaom-WRONG at 4:4:4 -- `av1_get_max_uv_txsize` + // is `ss_size_lookup[bsize]` and `get_vartx_max_txsize` (blockd.h:1447) reads + // that plane block as `max_txsize_rect_lookup[plane_bsize]`, so chroma extent + // == luma extent at ss (0,0) -- and the chroma MV origins below are the + // prediction half of the same defect. MEASURED on the 4:4:4 LOSSY witness + // fixtures/r512.obu, chroma-only, luma byte-exact on both inter frames. + // BLOCKED, not missing: with the ss-derived extent the decode REFUSES -- + // "a rectangular inter chroma transform unit whose shape has no coefficient + // table set here" -- because a 4:4:4 32x64 chroma plane block needs a + // `TxbSet` this crate lacks. The fix is a new coefficient set, not a swap. + // Left as the halving deliberately: turning a decoding stream into a + // refusal is a behaviour change with its own decision. See + // lanes/av1chromahalvings.report.md r5. + if crate::envflags::env_flag!("EC_HALVSWEEP") { + eprintln!("EC_HALV ibc_owned mi=({mi_r},{mi_c}) bw={bw} bh={bh} skip={skip}"); + } let (cw, ch) = (bw / 2, bh / 2); let side = bw.max(bh); let cside = cw.max(ch); diff --git a/lanes/av1chromahalvings.report.md b/lanes/av1chromahalvings.report.md new file mode 100644 index 00000000..e78fa38a --- /dev/null +++ b/lanes/av1chromahalvings.report.md @@ -0,0 +1,98 @@ + +--- + +# r5 — rebased onto `3b691e13`. Item (3) is ALREADY DONE by another lane; item (2) confirmed still deferred; item (1) NOT STARTED. + +## r5.0 Two of my three chartered items changed status on the rebase, and both changes are retractions in my favour + +**Item (3), `suppress_internal_lf_edges` (`16758`) — ALREADY FIXED, by Agent09-4's C1.** +On `3b691e13` the function now reads: + +```rust +fn suppress_internal_lf_edges(&mut self, at_mi: (usize, usize), w_mi: usize, h_mi: usize, fctx: &FrameCtx) { + 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); +``` + +`fctx` threaded in and the halving replaced by `>> ss_*` — exactly the fix I +chartered, landed by another lane. **My r1/r2 report's claim that this site is +"format-blind today, a structural constraint" is obsolete**: it was true of +`f33b9d41` and is false of current main. Retracted. + +**Item (2), `cfl_ac_q3_at` — still format-blind, re-measured on the rebased tree.** +The signature on `3b691e13` is still `fn cfl_ac_q3_at(px, py, bw, bh, sample: +impl Fn(usize, usize) -> i32) -> Vec` with `let (cw, ch) = (bw / 2, bh / 2);` +immediately after. No `fctx`, so the subsampling does not exist inside the +function and cannot be derived there. **It stays deferred, and now with a +measured reason rather than an assumption**: the structural constraint is real +and unchanged, and the witness is real (188 rung hits on the 4:4:4 set), so +what is missing is only the threading through the CfL call tree plus a +CfL-specific pixel gate. Line numbers post-rebase: definition at `19950`, +halving at `19957`. + +## r5.1 The `decode_intra_sub8_leaf` 4:2:2 gap (recorded, not implemented) + +`decode_intra_sub8_leaf` at `decode.rs:45340` (body `45340..46168`) takes +`has_chroma: bool` and branches its chroma handling on that alone. The one +chroma comment inside it reads: + +> `lane-av1llintercdf). At 4:2:0 a sub-8 shape's chroma block is ...` + +There is **no `chroma_444` branch and no `chroma_422` branch** — the sub-8 leaf +has a single chroma path, so at 4:4:4 it computes whatever the 4:2:0 geometry +gives it, and 4:2:2 has no path at all (it is refused by name at the sequence +header, so that is safe, but the shape is not modelled). + +**Caller set** (two call sites, both passing `has_chroma`): `decode.rs:44470` +and `decode.rs:46356`. + +**Why it is a named gap and not a fix:** the 4:2:2 lift needs this shape, but +implementing it is a second `TxbSet` family plus a sub-8 chroma geometry +decision, and this lane has no 4:2:2 witness (the decoder refuses 4:2:2 by +name at the sequence header, so nothing in the pin set exercises it). Recorded +for whoever does the lift; not implemented here. + +## r5.2 Item (1) — the TxbSet — NOT STARTED, and I am not going to fake it + +I rebased, re-measured both other items, and recorded the sub-8 gap. I did +**not** add `ChromaRect32x64`/`ChromaRect64x32`, and I did **not** land the +ss-derived extent. My budget ran out mid-lane and the honest state is: + +- witness `fixtures/r512.obu`: COMMITTED on this branch; +- red-before: MEASURED (r4.2) and quoted in r5.4; +- blocker: NAMED, and the refusal string is exact; +- fix: NOT DONE. + +The remaining work is a real piece of engineering, not a swap: a CDF set per +shape, its `rect_scan`, and the rect forms of `base_ctx_rect`/`br_ctx_rect`, +following `lane-inter4`'s precedent for the rect inter sets. Shipping a +partial version — a set that decodes but whose contexts I have not verified +against the oracle — would put a silent wrongness into the tree, which is the +one outcome this whole lane has been removing. + +**Unblock, unchanged and still ordered:** (1) `ChromaRect32x64` and +`ChromaRect64x32`; (2) then the extent + the eight chroma MV origin pairs, with +r4.2 as the red-before, and the 4:2:0 and 4:4:4-lossless arms re-measured +byte-identical (arithmetic-first: at `ss = 1`, `>> 1` IS `/ 2`). + +## r5.3 The stale-binary tell, written down as instructed + +**A green gate result alongside a target that does not compile is a stale +binary, and `git checkout -- ` is what produces it.** It bit me +twice in one turn: a `git checkout main -- stream.rs` pulled a newer +`stream.rs` (referencing `intra_128_in_inter_mu_chroma_hits`, absent from my +base's `decode.rs`) into a branch based on an older commit; the test target +stopped compiling; and the gates kept reporting green from the old binary. The +only reason I caught it was that a `--no-run` build printed errors while the +gate run said `ok`. **Treat any `--no-run` error that coincides with green +gates as invalidating every gate result in that turn, and re-measure.** + +## r5.4 The red-before, quoted verbatim (the chroma-only signature is the evidence) + +```text +frame 0 (key) Y=166229 wrong from 65728 U=155383 from 32848 V=153498 from 32848 total 475110 +frame 1 (inter) Y=EXACT U=74708 from 49282 V=73501 from 49280 total 148209 +frame 2 (inter) Y=EXACT U=9216 from 114880 V=8192 from 229760 total 17408 +``` + +Luma byte-exact on both inter frames while chroma is wrong is what identifies +this as the chroma-plane sizing defect and not a block-geometry one.