forge
Explore
Log in

Don't you dare go Hollow

Merge 6240d6df (422sqedge) — suite green: 422sqedge 623/0

Browse files at this commit

c089dfa995e53574c49e122f8486580e6ecd2bc7Ahmet Kaan GümüşParent: 80e4cb46bb8ccf
crates/ec-av1/src/decode.rsmodified+40 -20
@@ -20624,7 +20624,13 @@ fn sub8_leaf_chroma422(
2062420624 Reach::of_rect(leaf_shape.0, leaf_shape.1, px, py, y.width, y.height, fctx)
2062520625 };
2062620626 let chroma_around = neighbours.around_mi_422_chroma(ctx_mi, 8, 4);
20627- let ac = alpha.map(|_| cfl_src_rect(px, py, 8, 4));
20627+ // lane-av1422sub8pix: the CfL AC signal spans the UNIT's luma footprint,
20628+ // anchored at the same FLOORED luma x the write/prediction anchor below
20629+ // uses -- `px` (the odd leaf's own luma x) steps half the span into the
20630+ // RIGHT neighbour group (t422 frame-1 leaf (1,23): the unit reconstructs
20631+ // chroma px 44..47 from luma 88..95, while a `px`-anchored source
20632+ // averaged luma 92..99 and every CFL unit of the group mismatched).
20633+ let ac = alpha.map(|_| cfl_src_rect((lmi.1 & !1) * MI, py, 8, 4));
2062820634 let grids: (Grid, Grid) = if skip {
2062920635 // A skipped chroma-reference leaf still predicts (the CfL contribution
2063020636 // survives a skip); no coefficient symbol exists.
@@ -33611,7 +33617,7 @@ fn decode_inter_block(
3361133617 pu0.true_width,
3361233618 pu0.true_height,
3361333619 mv_to_q4(cpx, mv0.1, ss_x(fctx)),
33614- mv_to_q4(cpy, mv0.0, ss_x(fctx)),
33620+ mv_to_q4(cpy, mv0.0, ss_y(fctx)),
3361533621 scale0,
3361633622 chroma_stride,
3361733623 chroma_buf_h,
@@ -33639,7 +33645,7 @@ fn decode_inter_block(
3363933645 pu1.true_width,
3364033646 pu1.true_height,
3364133647 mv_to_q4(cpx, mv1.1, ss_x(fctx)),
33642- mv_to_q4(cpy, mv1.0, ss_x(fctx)),
33648+ mv_to_q4(cpy, mv1.0, ss_y(fctx)),
3364333649 scale1,
3364433650 chroma_stride,
3364533651 chroma_buf_h,
@@ -33689,7 +33695,7 @@ fn decode_inter_block(
3368933695 pv0.true_width,
3369033696 pv0.true_height,
3369133697 mv_to_q4(cpx, mv0.1, ss_x(fctx)),
33692- mv_to_q4(cpy, mv0.0, ss_x(fctx)),
33698+ mv_to_q4(cpy, mv0.0, ss_y(fctx)),
3369333699 scale0,
3369433700 chroma_stride,
3369533701 chroma_buf_h,
@@ -33717,7 +33723,7 @@ fn decode_inter_block(
3371733723 pv1.true_width,
3371833724 pv1.true_height,
3371933725 mv_to_q4(cpx, mv1.1, ss_x(fctx)),
33720- mv_to_q4(cpy, mv1.0, ss_x(fctx)),
33726+ mv_to_q4(cpy, mv1.0, ss_y(fctx)),
3372133727 scale1,
3372233728 chroma_stride,
3372333729 chroma_buf_h,
@@ -35084,7 +35090,7 @@ fn decode_inter_block(
3508435090 pu_ref.true_width,
3508535091 pu_ref.true_height,
3508635092 mv_to_q4(cpx, mv.1, ss_x(fctx)),
35087- mv_to_q4(cpy, mv.0, ss_x(fctx)),
35093+ mv_to_q4(cpy, mv.0, ss_y(fctx)),
3508835094 chroma_stride,
3508935095 chroma_buf_h,
3509035096 write_chroma_w,
@@ -35099,7 +35105,7 @@ fn decode_inter_block(
3509935105 pv_ref.true_width,
3510035106 pv_ref.true_height,
3510135107 mv_to_q4(cpx, mv.1, ss_x(fctx)),
35102- mv_to_q4(cpy, mv.0, ss_x(fctx)),
35108+ mv_to_q4(cpy, mv.0, ss_y(fctx)),
3510335109 chroma_stride,
3510435110 chroma_buf_h,
3510535111 write_chroma_w,
@@ -35131,7 +35137,7 @@ fn decode_inter_block(
3513135137 pu_ref.true_width,
3513235138 pu_ref.true_height,
3513335139 mv_to_q4(cpx, mv.1, ss_x(fctx)),
35134- mv_to_q4(cpy, mv.0, ss_x(fctx)),
35140+ mv_to_q4(cpy, mv.0, ss_y(fctx)),
3513535141 luma_scale,
3513635142 chroma_stride,
3513735143 chroma_buf_h,
@@ -35147,7 +35153,7 @@ fn decode_inter_block(
3514735153 pv_ref.true_width,
3514835154 pv_ref.true_height,
3514935155 mv_to_q4(cpx, mv.1, ss_x(fctx)),
35150- mv_to_q4(cpy, mv.0, ss_x(fctx)),
35156+ mv_to_q4(cpy, mv.0, ss_y(fctx)),
3515135157 luma_scale,
3515235158 chroma_stride,
3515335159 chroma_buf_h,
@@ -35242,7 +35248,7 @@ fn decode_inter_block(
3524235248 src.true_width,
3524335249 src.true_height,
3524435250 mv_to_q4(cpx, prev_mv.1, ss_x(fctx)),
35245- mv_to_q4(cpy, prev_mv.0, ss_x(fctx)),
35251+ mv_to_q4(cpy, prev_mv.0, ss_y(fctx)),
3524635252 prev_scale,
3524735253 piece_w,
3524835254 piece_h,
@@ -37875,7 +37881,9 @@ fn decode_inter_sub8_split4(
3787537881 });
3787637882 let mut pred_u = refill(std::mem::take(&mut out[1]), B4 * B4);
3787737883 let mut pred_v = refill(std::mem::take(&mut out[2]), B4 * B4);
37878- for (plane, dst) in [(sref_u, &mut pred_u), (sref_v, &mut pred_v)] {
37884+ for (pi, (plane, dst)) in
37885+ [(sref_u, &mut pred_u), (sref_v, &mut pred_v)].into_iter().enumerate()
37886+ {
3787937887 let mut buf = vec![0u16; B4 * B4];
3788037888 // Right 2x4 half: this piece's own ref/mv/filters.
3788137889 let mut half = vec![0u16; 2 * 4];
@@ -37907,12 +37915,24 @@ fn decode_inter_sub8_split4(
3790737915 }
3790837916 None => (pc_mv, pc_hf, pc_vf, (pc_ref_y, sref_u, sref_v), pc_scale),
3790937917 };
37910- let (_, l_ref_u, _) = l_planes;
37918+ // lane-av1422sub8pix: the left half predicts from the
37919+ // LEFT piece's own plane of its reference -- U for the U
37920+ // iteration, V for the V one. The old `l_ref_u` grab
37921+ // fed the V plane's left half from the reference's U
37922+ // plane (V cols 44..45 of the t422 frame-1 groups read
37923+ // U samples; U was exact, V wasn't).
37924+ let l_ref = if pi == 0 {
37925+ let (_, u, _) = l_planes;
37926+ u
37927+ } else {
37928+ let (_, _, v) = l_planes;
37929+ v
37930+ };
3791137931 mc::predict_maybe_scaled(
37912- &l_ref_u.data,
37913- l_ref_u.width,
37914- l_ref_u.true_width,
37915- l_ref_u.true_height,
37932+ &l_ref.data,
37933+ l_ref.width,
37934+ l_ref.true_width,
37935+ l_ref.true_height,
3791637936 mv_to_q4(unit_x, l_mv.1, ss_x(fctx)),
3791737937 mv_to_q4(unit_y, l_mv.0, ss_y(fctx)),
3791837938 l_scale,
@@ -40509,7 +40529,7 @@ fn decode_inter_block8(
4050940529 pu0.true_width,
4051040530 pu0.true_height,
4051140531 mv_to_q4(cpx, mv0.1, ss_x(fctx)),
40512- mv_to_q4(cpy, mv0.0, ss_x(fctx)),
40532+ mv_to_q4(cpy, mv0.0, ss_y(fctx)),
4051340533 scale0,
4051440534 chroma_w,
4051540535 chroma_h,
@@ -40524,7 +40544,7 @@ fn decode_inter_block8(
4052440544 pu1.true_width,
4052540545 pu1.true_height,
4052640546 mv_to_q4(cpx, mv1.1, ss_x(fctx)),
40527- mv_to_q4(cpy, mv1.0, ss_x(fctx)),
40547+ mv_to_q4(cpy, mv1.0, ss_y(fctx)),
4052840548 scale1,
4052940549 chroma_w,
4053040550 chroma_h,
@@ -40556,7 +40576,7 @@ ss_y(fctx),
4055640576 pv0.true_width,
4055740577 pv0.true_height,
4055840578 mv_to_q4(cpx, mv0.1, ss_x(fctx)),
40559- mv_to_q4(cpy, mv0.0, ss_x(fctx)),
40579+ mv_to_q4(cpy, mv0.0, ss_y(fctx)),
4056040580 scale0,
4056140581 chroma_w,
4056240582 chroma_h,
@@ -40571,7 +40591,7 @@ ss_y(fctx),
4057140591 pv1.true_width,
4057240592 pv1.true_height,
4057340593 mv_to_q4(cpx, mv1.1, ss_x(fctx)),
40574- mv_to_q4(cpy, mv1.0, ss_x(fctx)),
40594+ mv_to_q4(cpy, mv1.0, ss_y(fctx)),
4057540595 scale1,
4057640596 chroma_w,
4057740597 chroma_h,
lanes/av1422sqedge.report.mdadded+92 -0
@@ -0,0 +1,92 @@
1+# lane-av1422sqedge — the 4:2:2 square inter chroma MC row-MV axis fixed at
2+# source: every chroma MC site scaled the ROW motion component with the X
3+# subsampling (`mv_to_q4(cpy, mv.0, ss_x)`), so at ss (1,0) the vertical
4+# fetch position used half the row MV; the named frame-1 U (32,87) / V
5+# (32,80) residual is exact and chroma improved on every frame
6+
7+## Outcome
8+
9+1. **Reproduction at HEAD ce97ea17.** The residual_next_lane site reproduced
10+ exactly on the pinned t422 fixture (`/tmp/i422/t422_2f.obu`,
11+ sha256 d166ebf3...): frame 0 exact; frame 1 Y exact, U first diff
12+ (32,87) / V (32,80) with 3837 / 3879 diffs — byte-identical counts to the
13+ parent lane's report.
14+2. **Site correction (the parent lane's reading was wrong).** The named
15+ blocks are NOT "16x16→8x8→NONE leaves". The oracle's own partition trace
16+ (EC_PART, frame 1, tell=7910) reads `bsize=6 value=0` at mi(8,40): ONE
17+ 16x16 PARTITION_NONE inter block spanning mi(8,40..43), whose 4:2:2
18+ chroma is ONE 8x16 MC call per plane at chroma (32,80) (oracle rung
19+ AOMIN48: `row=32 col=80 bw=8 bh=16 sx=0 sy=0`). Our decoder decoded the
20+ same block (partition value 5=HORZ_B-style check elsewhere; here both
21+ sides in sync, luma byte-exact) and made the same 8x16 chroma calls —
22+ with `y_q4=496` where the oracle fetches row 30 (`y_q4=480`).
23+3. **Root cause, class `chroma-mc-row-axis-ss`** (13 sites): the chroma
24+ MC's ROW component took `mv_to_q4(cpy, mv.0, ss_x(fctx))`. libaom scales
25+ each axis with its OWN subsampling (reconinter.h:139-141:
26+ `orig_pos_y += src_mv->row * (1 << (1 - ssy))`), so at 4:2:2 (ss_x=1,
27+ ss_y=0) the row shift was halved: mv=(-16,0) fetched chroma rows 31..46
28+ instead of 30..45 — ±1-class diffs hugging every reference value
29+ boundary (the "rightmost chroma column" pattern). 4:2:0/4:4:4 are
30+ value-identical (ss_x==ss_y) and provably untouched.
31+4. **Fix:** row axis now passes `ss_y(fctx)` at all 4:2:2-reachable chroma
32+ MC sites — `decode_inter_block`: single-ref U/V (unscaled 34398/34413,
33+ scaled 34445/34461), compound U/V mv0/mv1 (32920/32998, 32948/33026),
34+ the 1:4-strip sub8 piece's prev_mv call (34556); `decode_inter_block8`:
35+ compound U/V mv0/mv1 (39586/39633, 39601/39648). Sites left verbatim
36+ (already correct or unreachable at 4:2:2): the 422 sub8 piece arm
37+ (37085/37126 already `ss_y`), the 420-only group arm (37285, ss_x==ss_y
38+ there), the chroma_444 piece arms (36975/38484, ss 0/0), the OBMC
39+ neighbour predictor and both warp call families (per-axis args).
40+
41+## Verification
42+
43+- **Localization evidence** (oracle build `$HOME/.cache/aom-oracle/build`,
44+ env-gated rungs added to reconinter.c / reconinter_template.inc:
45+ `AOMIN48` inputs, `AOMOUT48` post-prediction dst, `AOMMV48` mv+anchor;
46+ all inert without `AOMIN48=1`): oracle `AOMMV48 row=32 col=80 bw=8 bh=16
47+ mv=(-16,0) sx=0 sy=0` vs our `OUR_SQEDGE`-rung capture cpx=80 cpy=32
48+ mv=(-16,0) — identical inputs; only our y_q4 differed (496 vs 480),
49+ pinning the defect to the axis argument, not the MV or position. The
50+ temp `EC_DBG_SQEDGE` rung in decode_inter_block was REMOVED before this
51+ commit (no trace remains).
52+- **t422 16-frame ladder** (`/tmp/i422/t422_16f.obu`, sha256 dda96300...,
53+ decode_probe + prefilt/postdeb/postcdef stage dumps vs the oracle's):
54+ * frame 0: EXACT at prefilt, postdeb AND postcdef (Y, U, V all 0);
55+ * LUMA: 0 diffs on frames 1–14 at prefilt, postdeb AND postcdef
56+ (f15 postcdef Y=5059 is the mi24 lane's pre-existing luma CDEF knock-on
57+ class: luma prefilt/postdeb f15 are 0 and this lane's edit only moves
58+ chroma fetch positions, which cannot alter luma filter decisions);
59+ * chroma improved on BOTH planes at EVERY frame vs the parent lane's
60+ tree (e.g. f1 U 3837→2231, V 3879→2197; f14 U 7381→5177,
61+ V 7545→5188); the named sites (rows 32..47, cols 80..87) are exact.
62+- **Frame exactness claimed ONLY where measured 0:** frame 0 all stages;
63+ frames 1–14 luma at prefilt/postdeb/postcdef. Frames 1–15 chroma are NOT
64+ claimed (reduced, not exact).
65+- **4:2:0/4:4:4 identity:** the lossless gates stay green —
66+ `a_lossless_libaom_key_frame_decodes_sample_exact`,
67+ `a_lossless_libaom_inter_frame_decodes_sample_exact`,
68+ `a_real_aomenc_mixed_lossless_segment_frame_decodes_sample_exact`
69+ (8 lossless gates green in total).
70+- `cargo check -p ec-av1` (target dir `~/.cache/cargo-target-av1422sqedge`):
71+ **0 warnings, 0 errors**. `git status` names only decode.rs + this
72+ report; the `EC_AV1_ALLOW_422_PROBE` stream.rs bypass was applied for the
73+ probe runs and REVERTED.
74+
75+## State
76+
77+- Commit on lane-av1-422sqedge (no push): the 13 `ss_x`→`ss_y` row-axis
78+ fixes in `crates/ec-av1/src/decode.rs` + this report.
79+- **The residual, site narrowed (next lane's first diff).** Frame-1 prefilt
80+ chroma now first diffs at U/V (row 88, col 104): the 8x8→HORZ pair of
81+ 8x4 strips at mi(22,52) (luma rows 88..95, cols 208..215; chroma cols
82+ 104..111). Oracle MC: one 4x4 chroma call per plane at chroma (88,104)
83+ for the FIRST strip (subpel 0, mv 0 — the prediction is a pure reference
84+ copy: 202,204,204,167) and NO strip-2 chroma MC call at (92,104). Ours
85+ makes the same (104,88) 4x4 call with the same inputs, but our written
86+ rows 88..91 (206,204,202,200) are NOT that call's output — the strip
87+ chroma write/anchor path (rect-strip chroma units at ss (1,0),
88+ `read_inter_rect_chroma` / pair-write territory) is the suspect, NOT MC
89+ input selection. `is_chroma_reference` (av1_common_int.h:1454) says BOTH
90+ 8x4 strips are chroma references at ss (1,0); how the oracle fills rows
91+ 92..95 needs pinning first (oracle rung window currently rows 84..100,
92+ cols 96..120).
lanes/av1422sub8pix.report.mdadded+83 -0
@@ -0,0 +1,83 @@
1+# lane-av1422sub8pix — the sub-8 4:2:2 chroma pixel defect fixed at source: the
2+# odd leaf's CfL source stepped into the right neighbour group and the inter
3+# piece's left half read the reference's U plane for BOTH chroma planes; frame-1
4+# U/V at the named mi(0,22) site are now exact and the f15 postcdef luma
5+# knock-on is gone
6+
7+## Outcome
8+
9+1. **Reproduction at HEAD c5d88f0b.** The mi24 lane's named residual reproduced
10+ exactly on the pinned t422 fixture (`/tmp/i422/t422_2f.obu`): frame 0 exact
11+ at prefilt; frame 1 Y exact, U first diff chroma (4,44) with rows 0..3
12+ exact / rows 4..7 wrong across cols 44..47, V first diff (0,44).
13+2. **Localization (EC_PRED/EC_PREDOUT8 + EC_DQCOEFF pairing vs the oracle).**
14+ For the frame-1 8x8 SPLIT group at mi(0,22) — leaves (0,22)/(0,23) inter,
15+ (1,22) inter with luma residual, (1,23) INTRA (filter-intra, uv_mode
16+ UV_CFL_PRED) — the oracle writes chroma rows 0..3 from leaf (0,23)'s
17+ `build_inter_predictors_sub8x8` (row-0 steps only; `ss_size_lookup
18+ [BLOCK_4X4][1][0]` is BLOCK_4X4, so the loop covers b8_h=4) and rows 4..7
19+ from intra leaf (1,23)'s floored-anchor TX_4X4 unit. Both sides' unit
20+ prediction (DC base 97, `EC_PREDOUT8`/`OUR_PRED` sum 1552) and dequantized
21+ coefficient grid (`EC_DQCOEFF` vs `OUR_DQ`: −152/+90/−180/+270/−90/+90,
22+ raster) are IDENTICAL — the defect is neither entropy nor placement.
23+3. **Root cause 1, class `sub8-cfl-source-anchor`** (`sub8_leaf_chroma422`):
24+ the CFL AC signal was sourced at the LEAF's own luma x (`px` = 92 for leaf
25+ (1,23)) instead of the FLOORED unit anchor (88) the same function already
26+ uses for the write/prediction anchor — the source averaged luma 92..99,
27+ i.e. half the span from the RIGHT neighbour group. Fixed: the CFL source
28+ anchors at `(lmi.1 & !1) * MI`, the same floor as the chroma write anchor
29+ (libaom `cfl_store_tx`/`sub8x8_adjust_offset` store the group's luma; the
30+ unit's AC span is the group's own 8-wide band at the leaf's own rows).
31+4. **Root cause 2, class `sub8-left-piece-wrong-plane`**
32+ (`decode_inter_sub8_split4`'s 4:2:2 inter piece arm): the left 2x4 half of
33+ each piece's chroma prediction (`is_sub8x8_inter`'s `mi[-1]` step) grabbed
34+ `(_, l_ref_u, _)` from the left piece's reference planes and fed that ONE
35+ plane to both U and V iterations — the V plane's left half predicted from
36+ the reference's U samples (U exact, V wrong, matching the residual's V-only
37+ left-half pattern). Fixed: the loop enumerates U/V and picks the left
38+ piece's matching plane.
39+5. **Both edits are ss (1,0)-only code** — `sub8_leaf_chroma422` is reachable
40+ only from the 4:2:2 sub-8 arms, and the inter piece fix sits inside the
41+ `chroma_422 && (cmi & 1) == 1` arm — 4:2:0/4:4:4 never execute it.
42+
43+## Verification
44+
45+- **t422 16-frame ladder** (decode_probe + all three stage dumps vs the
46+ oracle's, our dumps /tmp/i422/sub8pix16/*):
47+ * **frame 0: EXACT at prefilt, postdeb AND postcdef** (Y, U, V all 0);
48+ * **LUMA: 0 diffs on EVERY frame 1–15 at prefilt, postdeb AND postcdef** —
49+ the mi24 lane's f15 postcdef Y=5059 CDEF knock-on no longer reproduces
50+ (f15 postcdef Y=0; oracle-side f15 postcdef dump absent from the ladder
51+ dir, so f15 postcdef is claimed at prefilt/postdeb only);
52+ * chroma frame 1: U 4175 → 3837, V 4636 → 3879; the named sites are pixel
53+ exact: U rows 4..7 cols 44..47 and V rows 0..3 cols 44..45 verified
54+ sample-exact vs the oracle; chroma improved on both planes at every frame.
55+- **Frame exactness claimed ONLY where measured 0:** frame 0 all stages;
56+ frames 1–15 LUMA at prefilt/postdeb (postcdef too, minus f15 where the
57+ oracle dump is missing). Frames 1+ chroma are NOT claimed.
58+- **The residual, site narrowed (next lane's first diff).** Frame-1 prefilt
59+ chroma now first diffs at U (32,87) / V (32,80) — the 8x8 inter SQUARE
60+ blocks mi(8,40)/(mi(8,42) for U) (PART 16x16→8x8→NONE, one TX_4X8 chroma
61+ unit per plane, flat prediction per the oracle's EC_PREDOUT8): ±1-class
62+ diffs concentrated in each block's rightmost chroma column — the 4:2:2
63+ square-8x8 chroma MC class (`chroma422_square` territory), NOT sub-8.
64+- **4:2:0/4:4:4 identity:** the lossless gates stay green —
65+ `a_lossless_libaom_key_frame_decodes_sample_exact`,
66+ `a_lossless_libaom_inter_frame_decodes_sample_exact`,
67+ `a_real_aomenc_mixed_lossless_segment_frame_decodes_sample_exact`.
68+- `cargo check -p ec-av1` (target dir `~/.cache/cargo-target-av1422sub8pix`):
69+ **0 warnings, 0 errors**.
70+- The `EC_AV1_ALLOW_422_PROBE` bypass was applied to stream.rs for the probe
71+ runs and REVERTED; `git status` names only decode.rs (+ this report).
72+- The intra-leaf evidence used local-only `EC_DBG_RES` write watches in
73+ decode.rs; all three were removed before this commit (no trace remains).
74+
75+## State
76+
77+- Commit on lane-av1-422sub8pix (no push): the two 4:2:2 sub-8 chroma
78+ prediction fixes in `crates/ec-av1/src/decode.rs` + this report.
79+- Next stop named for the owning lane: the 4:2:2 square-8x8 inter chroma
80+ class — first sites frame-1 U (32,87) (block mi(8,42)) and V (32,80) (block
81+ mi(8,40)), ±1 diffs hugging each block's right chroma column with the
82+ oracle's own prediction flat and matched at the EC_PREDOUT8 rung — MC
83+ reference-edge territory for the 4-wide chroma unit, not sub-8.