forge
Explore
Log in

Don't you dare go Hollow

lane-av1422warp: correct the chroma-reference comment and report; no behaviour change

Browse files at this commit

10647bf6530252e04fc4afa98795787237df1c57Ahmet Kaan GümüşParent: 2459fe8
Comment-only. The decode paths are byte-identical to a9611ea2; re-verified
after the edit: the 4:2:0 control a420.obu is still byte-exact against
aomdec --rawvideo and 444_sb128rect_lr_witness.obu is still byte-identical
to the pre-lane build.

Two false statements are corrected, in decode.rs's
smooth_uv_neighbour_unsnapped comment and in the lane report.

1. The left-reference derivation. The comment claimed
`base_mi[ss_y*mi_stride - 1]` is a COLUMN offset of -1 whose row delta is 0
"at every subsampling, since the row term is at most `stride - 1`
elements". That is arithmetically wrong: at `ss_y == 1` the offset is a
FULL row down less one element, so the row delta is 1 and the column
delta -1. The comment also contradicted itself -- one line said "ss_y ROWS
down", the next claimed row delta 0. The block now states the two
offsets as plain (row, column) deltas and drops the bogus arithmetic.

2. "only 4:2:2 takes the new column" was wrong. The above column term is
`+ss_x`, so it moves the read at 4:2:0 and 4:4:0 as well (both have
`ss_x == 1`); only 4:4:4 (`ss_x == 0`) leaves it alone. What the
measurement actually showed is that the resulting boolean was unchanged
on the 4:2:0 control -- not that the shift is the identity there. The
comment and the report now say that.

Both now also carry the consequence as a NAMED UNRESOLVED discrepancy
rather than a settled one: the left read's `+ss_y` row term is NOT
shipped, because no committed fixture presents a 1-mi-tall left
neighbour (an 8x4 leaf's left block) at 4:2:0/4:4:0 and so nothing in
the tree can witness the correct term today. Unblock is one such stream.

History note: the a9611ea2 commit message overreaches. It asserts the
shipped form "is libaom's own at every subsampling" and that the left read
"never moved" -- both follow from the wrong arithmetic corrected here.
Left unamended per history hygiene; this commit supersedes it.
crates/ec-av1/src/decode.rsmodified+26 -24
@@ -9003,31 +9003,33 @@ impl Neighbours {
90039003 .filter(|&m| m != u8::MAX)
90049004 .map(usize::from)
90059005 };
9006- // libaom's two chroma-reference mi, per the shift the caller applies.
9007- // 4:2:2 ONLY. `ss_y == 0` makes the above reference's row term
9008- // `snapped_r - 1` (what this always read) and the left reference's
9009- // row term `snapped_r` (unchanged); `ss_x == 1` moves the above
9010- // reference one mi column right. At 4:2:0 both shifts are the
9011- // identity on the values this already read (measured: the 4:2:0
9012- // control stream is byte-exact with them folded in), and at 4:4:4
9013- // `ss_x == 0` does the same -- so only 4:2:2 takes the new column.
9014- // `set_mi_row_col` (libaom `av1_common_int.h:1395-1412`), with `mi_r`/
9015- // `mi_c` already de-offset by the caller's `(mi_row & ss_y)` /
9016- // `(mi_col & ss_x)` snap, i.e. already libaom's `base_mi`:
9017- // chroma_above_mi = base_mi[-stride + ss_x]
9018- // chroma_left_mi = base_mi[ss_y*stride - 1]
9019- // The second offset is `ss_y` ROWS down and one COLUMN left; at every
9020- // subsampling `ss_y*stride - 1` lands on `base_mi`'s OWN row (the row
9021- // term is at most `stride - 1` elements, so its row delta is 0), so
9022- // the left read is `(mi_r, mi_c - 1)` -- unchanged. The first offset
9023- // is one row up and `ss_x` columns right, and the `ss_x` COLUMN was
9024- // what this dropped: one chroma column spans two luma mi columns, so
9025- // the chroma edge reaches into the right-hand luma block and that is
9026- // where its reference lives.
9006+ // libaom's two chroma-reference mi, from `set_mi_row_col`
9007+ // (`av1_common_int.h:1400-1401`), with `mi_r`/`mi_c` already
9008+ // de-offset by the caller's `(mi_row & ss_y)` / `(mi_col & ss_x)`
9009+ // snap -- i.e. already libaom's `base_mi`:
90279010 //
9028- // Measured: the column term is right at EVERY subsampling -- the
9029- // 4:2:0 control is byte-exact with it folded in, and 4:4:4 is
9030- // untouched because `ss_x == 0` there.
9011+ // chroma_above_mi = base_mi[-mi_stride + ss_x] row -1, col +ss_x
9012+ // chroma_left_mi = base_mi[ss_y*mi_stride - 1] row +ss_y, col -1
9013+ //
9014+ // SHIPPED: the above COLUMN. It is `+ss_x` wherever `ss_x == 1` --
9015+ // 4:2:0, 4:2:2 AND 4:4:0 all carry that column shift, and only 4:4:4
9016+ // (`ss_x == 0`) leaves the read where it was. Measured: folding it in
9017+ // leaves the 4:2:0 control byte-identical to `aomdec --rawvideo`; the
9018+ // boolean it feeds is simply not exercised differently by that stream
9019+ // at its blocks. One chroma column spans two luma mi columns, so the
9020+ // chroma edge reaches into the right-hand luma block, and that is where
9021+ // its reference lives.
9022+ //
9023+ // NOT SHIPPED -- KNOWN UNRESOLVED: the left read's `+ss_y` ROW term.
9024+ // libaom puts the left reference one mi row DOWN at 4:2:0 and 4:4:0
9025+ // (`ss_y == 1`) and on its own row at 4:2:2 (`ss_y == 0`); this reads
9026+ // its own row at every subsampling. An earlier attempt applied the
9027+ // `ss_y` term to the WRONG read (the above) and regressed the
9028+ // byte-exact 4:2:0 control, which is what exposed the crossing. No
9029+ // committed fixture presents a 1-mi-tall left neighbour (an 8x4 leaf's
9030+ // left block) at 4:2:0/4:4:0, so nothing here can witness the correct
9031+ // term today -- treat this as a named open discrepancy, not a settled
9032+ // one. Unblock: one such stream.
90319033 let above_mi = (mi_r.saturating_sub(1), mi_c + ss_x);
90329034 let left_mi = (mi_r, mi_c.saturating_sub(1));
90339035 let above = match self.uv_mode_col.get(above_mi.1) {
lanes/av1422warp.report.mdmodified+34 -13
@@ -58,25 +58,35 @@ with `chroma_stride`, and the two are equal at 4:2:0 and 4:4:4.
5858
5959 Site: `Neighbours::smooth_uv_neighbour_unsnapped` read the above chroma neighbour
6060 at `(mi_r - 1, mi_c)` and the left at `(mi_r, mi_c - 1)`. libaom's
61-`set_mi_row_col` (`av1_common_int.h:1395-1412`) puts them at
62-`base_mi[-stride + ss_x]` and `base_mi[ss_y*stride - 1]`, where `base_mi` is the
63-block's own mi already de-offset by `(mi_row & ss_y)` / `(mi_col & ss_x)` — which
64-is exactly the snap the caller applies. So above is `(mi_r - 1, mi_c + ss_x)` and
65-left is `(mi_r, mi_c - 1)`: **`ss_y*stride - 1` is a COLUMN offset of -1** (its
66-row delta is 0 at every subsampling, since the row term is at most `stride - 1`
67-elements). Only the above COLUMN gains `ss_x`. One chroma column spans two luma mi
68-columns, so the chroma edge reaches into the right-hand luma block — that is
69-where its reference lives.
61+`set_mi_row_col` (`av1_common_int.h:1400-1401`) puts them at
62+`base_mi[-mi_stride + ss_x]` and `base_mi[ss_y*mi_stride - 1]`, where `base_mi`
63+is the block's own mi already de-offset by `(mi_row & ss_y)` / `(mi_col & ss_x)` —
64+which is exactly the snap the caller applies. Read as (row, column) deltas that
65+is `above = (-1, +ss_x)` and `left = (+ss_y, -1)`.
66+
67+**Shipped: the above column.** It carries `+ss_x` wherever `ss_x == 1` — 4:2:0,
68+4:2:2 **and 4:4:0** all carry that column shift; only 4:4:4 (`ss_x == 0`) leaves
69+the read where it was. Measured: folding it in leaves the 4:2:0 control
70+byte-identical to `aomdec --rawvideo`. The honest statement of what that
71+measurement shows is that the boolean the column feeds came out the same on the
72+control's blocks — not that the shift is the identity there.
73+
74+**Not shipped, and KNOWN UNRESOLVED: the left row term `+ss_y`.** libaom puts the
75+left reference one mi row DOWN at 4:2:0 and 4:4:0 (`ss_y == 1`) and on its own
76+row at 4:2:2 (`ss_y == 0`); this reads its own row at every subsampling. No
77+committed fixture presents a 1-mi-tall left neighbour (an 8x4 leaf's left block)
78+at 4:2:0/4:4:0, so nothing in the tree can witness the correct term today. This
79+is a named open discrepancy, not a settled one.
7080
7181 ### How the split was chosen, and why 4:2:0 stays exact
7282
7383 An earlier attempt applied libaom's formula to BOTH reads (`above` row
7484 `mi_r + ss_y - 1`, `left` row `mi_r + ss_y - 1`). That improved 4:2:2 (56142 →
7585 53395) but regressed the byte-exact 4:2:0 control, and gating only the column
76-shift to 4:2:2 still regressed it — the row term, not the column term, was the
77-wrong part. Doing the offset arithmetic settled it: `ss_y*stride - 1` elements
78-from `base_mi` has row delta 0 for `ss_y ∈ {0,1}`, so the left read never moved.
79-The shipped form is libaom's own at every subsampling.
86+shift to 4:2:2 still regressed it — the `ss_y` term had been applied to the
87+WRONG read (the above), and that crossing is what the regression exposed. The
88+column term on its own is the part that measures clean; the row term is the part
89+that is still open, and shipping it is deferred to a lane that can witness it.
8090
8191 **Identity, measured three ways:**
8292
@@ -160,6 +170,17 @@ does open the OBMC-chroma and chroma-edge-filter defects, which no prior 4:2:2
160170 fixture reached — that is real coverage progress, and it is not the same thing as
161171 the bar.
162172
173+## Known unresolved
174+
175+- **Left chroma reference row term (`+ss_y`, libaom `av1_common_int.h:1400-1401`)
176+ is NOT shipped.** `smooth_uv_neighbour_unsnapped` reads the left neighbour on
177+ its own mi row at every subsampling; libaom reads it one row down at 4:2:0 and
178+ 4:4:0. Unblock: a stream with a 1-mi-tall left neighbour (an 8x4 leaf's left
179+ block) at 4:2:0/4:4:0 — no committed fixture has one, which is why the
180+ current read is byte-exact on the control and why the correct term cannot be
181+ witnessed today. The above column term (`+ss_x`) IS shipped, at every
182+ subsampling where `ss_x == 1`.
183+
163184 ## State
164185
165186 Two commits on `lane-av1422warp`, no push. Worktree clean; the