forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to lanes/av1422stripwrite.report.mdClear filter

2026-09-26

ec-av1: fix the transposed 4:2:0 odd-dimension figures in the gap noteAhmet Kaan Gümüş · 49b9fe2
ec-av1: fix the transposed 4:2:0 odd-dimension figures in the gap note

Second re-review pass, doc and report only, no behaviour change.

The previous commit reported the under-declaration count as 12160 of the
16256 pairs with w >= 2 (and a phantom 12288 of 16384). The figures are
transposed: running every 4:2:0 count over the 1..=128 square through the
shipping helper, 12160 of the **16384** pairs under-declare, 12033 of them
with w >= 2, and 127 in the w == 1 column (at 1x1 the 4:4:4 arm catches
the count and (1, 1) is exact). The phantom 12288 is deleted.

Also stated explicitly: under-declaration at h == 1 is zero over the whole
square -- there the 4:2:0 count equals the 4:2:2 count, routes into the
4:2:2 arm, and lands on the correct (round_ss(w, 1), 1). h == 1 belongs
to the parent-difference sentence alone, not to the under-declaration one.

And the code doc's absolute "byte-identical to what the two-way test
produced" is softened to "is what the two-way test produced" with the
h == 1 exception carried alongside, so it no longer contradicts the
report in the same commit.

`cargo check -p ec-av1 --all-targets`: 0 warnings, 0 errors.
ec-av1: correct the ref_chroma_shape doc's 4:2:0 claimsAhmet Kaan Gümüş · ce4a898
ec-av1: correct the ref_chroma_shape doc's 4:2:0 claims

Re-review found two false claims in the doc comment (and the matching
report bullet):

1. "zero 4:2:0 shapes differ" was wrong as an argument. The floor arm is
   byte-identical to the parent -- that is the real and sufficient point --
   but it does differ from the *true* 4:2:0 shape (the producer's
   `round_ss` ceil crops) on every odd dimension. Now stated as: the floor
   under-declares in 12160 of the 16256 grid pairs with w >= 2 (12288 of
   all 16384 including the w == 1 column), and at h == 1 -- the 127 pairs
   with w >= 2 -- it differs from the parent only by correcting it, since
   the parent claimed zero rows for a plane holding round_ss(w, 1) samples.

2. The w == 1 "the counts genuinely coincide, so no length test can
   separate them" claim was false: a 4:2:0 count at w == 1, h >= 2
   collides with neither the 4:4:4 nor the 4:2:2 count (measured: zero
   collisions). The length test does route it into the 4:2:0 arm; the floor
   fallback simply cannot express `(1, round_ss(h, 1))`. Reworded as an
   open 4:2:0 odd-dimension gap: pre-existing, parent-identical, and not
   taken here because a ceil fallback would depart from the parent on every
   odd-dimension 4:2:0 shape with no in-tree coverage to justify it.

No behaviour change. `cargo check -p ec-av1 --all-targets`: 0 warnings,
0 errors.
ec-av1: 422 reference chroma shape read off the sample count (ceil)Ahmet Kaan Gümüş · 9b02987
ec-av1: 422 reference chroma shape read off the sample count (ceil)

Review findings closed:

1. The first cut inferred a 4:2:2 reference's half width with a bare
   `width / 2`, but the producer stores chroma through `round_ss`
   (decode.rs:25806) and `round_ss(dim, 1) == (dim + 1) >> 1` is a CEIL.
   The floor test passed every even-width case -- the pinned fixture's
   256-wide frame included -- and dropped every odd-width 4:2:2 reference
   into the 4:2:0 arm, i.e. the same defect one dimension over.
   `ref_chroma_shape` now tests `round_ss(width, 1) * height`. The 4:2:0
   arm stays at the old `(width / 2, height / 2)` verbatim.

2. No gate covered that arithmetic. Two unit tests added:
   `a_reference_chroma_sample_count_routes_back_to_its_own_format` drives
   all three formats off the producer's own `round_ss` crops over odd AND
   even widths and heights, and
   `a_422_reference_claims_the_full_chroma_height` pins the t422 shape
   (256x144 luma -> 128x144 chroma, not the 72 rows the bug claimed).
   Mutation proof: with `half_w` back at `width / 2` the first test fails
   ("4:2:2 reference of 3x2 (chroma 4 samples) must route back to its own
   shape") and passes again on the restored ceil form.

3. The doc comment still described the counts with floor halvings; it now
   states the `round_ss` crops, the odd-width failure mode, and the
   measured ambiguity bound: brute-forced over every w,h in 1..=128 the
   three counts route correctly for every w >= 2 && h >= 2, and every
   misread is confined to w == 1 / h == 1 where the counts genuinely
   coincide and no length test could separate them.

Evidence: 16-frame t422 ladder re-run on this tree -- 0 diffs on every
plane of every frame 0..15 at prefilt, post-deblock and post-CDEF (48
stage-frame-plane groups) and the final post-loop-restoration dump
byte-identical for all 16 frames. Identity gates (own target dir):
17 passed, 0 failed, 3 ignored, 665 filtered out.

Untouched: the 4:2:2 header refusal in stream.rs (byte-identical,
unconditional; the local probe bypass was applied and reverted), the
group-tail chroma SKIP arm, and every temporary debug rung.
ec-av1: lane-av1422stripwrite -- the 4:2:2 residual was not the rect-strip chroma write/anchor: a stored reference's chroma plane was SHAPED from a two-way subsampling guess (luma-sized = 4:4:4, else a quarter = 4:2:0) that folds 4:2:2 into 4:2:0, so every 4:2:2 reference claimed h/2 rows while holding h; every chroma MC sourcing a row at or past the frame's midpoint was then clamped against true_heightAhmet Kaan Gümüş · 35d5774
ec-av1: lane-av1422stripwrite -- the 4:2:2 residual was not the rect-strip chroma write/anchor: a stored reference's chroma plane was SHAPED from a two-way subsampling guess (luma-sized = 4:4:4, else a quarter = 4:2:0) that folds 4:2:2 into 4:2:0, so every 4:2:2 reference claimed h/2 rows while holding h; every chroma MC sourcing a row at or past the frame's midpoint was then clamped against true_height

The parent lane's named site (frame-1 prefilt chroma first diff U/V at
(88,104)) measured as two BLOCK_8X4 inter strips at luma (88,208) and
(88,216) -- the top strips of the 8x8 groups at mi (11,26) and (11,27),
each its own chroma TX_4x4 at chroma (88,104) / (88,108)
(is_chroma_reference at ss (1,0): libaom's mi_size_wide[BLOCK_8X4] is 2 in
4x4-mi units, so the !(bw & 1) column clause holds for both). Not a strip
pair: the strips below (luma rows 92..95) are intra.

The write rect, the anchor, the mv, the filters, the scale and the
reference CONTENTS were all already correct: our raw pre-MC reference
sample dump at the unit was byte-identical to the oracle's src0
([202 204 204 167 / 185 190 190 165 / ...]). What was wrong was the MC's
output: our reference plane reported true_height 72 on a 144-tall frame,
so rows >= 72 clamped and the 4x4 unit came out as 206 204 202 200 on
every row. The parent read this as a write/anchor defect; the anchor was
right and the declared plane shape, one layer up, was not.

Fix: ref_chroma_shape() reads the chroma format off the stored plane's
own sample count, which is exact and unambiguous for all three formats
(w*h = 4:4:4, (w/2)*h = 4:2:2, (w/2)*(h/2) = 4:2:0). Both call sites in
RefPix::planes use it, and Picture's u/v doc now states the real contract
(half width, the frame's own chroma height). 4:2:0 and 4:4:4 take the SAME
branch as the old two-way test, so they are value-identical.

The pinned 16-frame t422 4:2:2 stream is now byte-exact: 0 diffs on every
plane of every frame 0..15 at prefilt, post-deblock and post-CDEF (48
stage-frame groups) and a byte-identical final post-loop-restoration dump
for all 16. Before: frame 1 Y 0 / U 2231 (first (88,104) 206 vs 202) /
V 2197. The 4:2:2 header refusal stays unconditional and byte-identical;
the local EC_AV1_ALLOW_422_PROBE bypass used for the probe runs is
reverted. cargo check -p ec-av1 --all-targets: 0 warnings, 0 errors.