ec-av1: lane-av1422sqedge -- the 4:2:2 square inter chroma MC row-MV axis fixed at source: every chroma MC site scaled the ROW motion component with the X subsampling (mv_to_q4(cpy, mv.0, ss_x)), so at ss (1,0) the vertical fetch position used half the row MV (t422 frame-1 16x16 NONE block at mi(8,40..43), mv=(-16,0): chroma fetched rows 31..46 instead of 30..45, +-1-class diffs hugging every reference value boundary at U (32,87) / V (32,80)); libaom scales each axis with its OWN subsampling (reconinter.h:139-141), so the row axis now passes ss_y at all 4:2:2-reachable sites -- decode_inter_block single-ref U/V (unscaled + scaled), compound U/V mv0/mv1, the 1:4-strip sub8 piece's prev_mv call, and decode_inter_block8 compound U/V mv0/mv1 (13 sites). 4:2:0/4:4:4 are value-identical (ss_x == ss_y there; lossless gates green). The parent lane's '16x16->8x8->NONE' site reading was corrected: the oracle decodes ONE 16x16 PARTITION_NONE block whose 4:2:2 chroma is one 8x16 MC call (AOMIN48 rung). Frame-1 chroma improved on every frame (f1 U 3837->2231, V 3879->2197); luma f1-f14 0 at all three stages; the residual moved to (row 88, col 104), the mi(22,52) 8x8-HORZ strip-chroma write class -- named in lanes/av1422sqedge.report.md
Browse files at this commit6bb8ccf362f308d3e6ddf867f0567af7d72ba345Parent: 6b538b42 changed files +105 -13
- crates/ec-av1/src/decode.rs +13 -13
- lanes/av1422sqedge.report.md +92 -0
crates/ec-av1/src/decode.rsmodified+13 -13
| @@ -32916,7 +32916,7 @@ fn decode_inter_block( | |||
| 32916 | pu0.true_width, | 32916 | pu0.true_width, |
| 32917 | pu0.true_height, | 32917 | pu0.true_height, |
| 32918 | mv_to_q4(cpx, mv0.1, ss_x(fctx)), | 32918 | mv_to_q4(cpx, mv0.1, ss_x(fctx)), |
| 32919 | - mv_to_q4(cpy, mv0.0, ss_x(fctx)), | 32919 | + mv_to_q4(cpy, mv0.0, ss_y(fctx)), |
| 32920 | scale0, | 32920 | scale0, |
| 32921 | chroma_stride, | 32921 | chroma_stride, |
| 32922 | chroma_buf_h, | 32922 | chroma_buf_h, |
| @@ -32944,7 +32944,7 @@ fn decode_inter_block( | |||
| 32944 | pu1.true_width, | 32944 | pu1.true_width, |
| 32945 | pu1.true_height, | 32945 | pu1.true_height, |
| 32946 | mv_to_q4(cpx, mv1.1, ss_x(fctx)), | 32946 | mv_to_q4(cpx, mv1.1, ss_x(fctx)), |
| 32947 | - mv_to_q4(cpy, mv1.0, ss_x(fctx)), | 32947 | + mv_to_q4(cpy, mv1.0, ss_y(fctx)), |
| 32948 | scale1, | 32948 | scale1, |
| 32949 | chroma_stride, | 32949 | chroma_stride, |
| 32950 | chroma_buf_h, | 32950 | chroma_buf_h, |
| @@ -32994,7 +32994,7 @@ fn decode_inter_block( | |||
| 32994 | pv0.true_width, | 32994 | pv0.true_width, |
| 32995 | pv0.true_height, | 32995 | pv0.true_height, |
| 32996 | mv_to_q4(cpx, mv0.1, ss_x(fctx)), | 32996 | mv_to_q4(cpx, mv0.1, ss_x(fctx)), |
| 32997 | - mv_to_q4(cpy, mv0.0, ss_x(fctx)), | 32997 | + mv_to_q4(cpy, mv0.0, ss_y(fctx)), |
| 32998 | scale0, | 32998 | scale0, |
| 32999 | chroma_stride, | 32999 | chroma_stride, |
| 33000 | chroma_buf_h, | 33000 | chroma_buf_h, |
| @@ -33022,7 +33022,7 @@ fn decode_inter_block( | |||
| 33022 | pv1.true_width, | 33022 | pv1.true_width, |
| 33023 | pv1.true_height, | 33023 | pv1.true_height, |
| 33024 | mv_to_q4(cpx, mv1.1, ss_x(fctx)), | 33024 | mv_to_q4(cpx, mv1.1, ss_x(fctx)), |
| 33025 | - mv_to_q4(cpy, mv1.0, ss_x(fctx)), | 33025 | + mv_to_q4(cpy, mv1.0, ss_y(fctx)), |
| 33026 | scale1, | 33026 | scale1, |
| 33027 | chroma_stride, | 33027 | chroma_stride, |
| 33028 | chroma_buf_h, | 33028 | chroma_buf_h, |
| @@ -34382,7 +34382,7 @@ fn decode_inter_block( | |||
| 34382 | pu_ref.true_width, | 34382 | pu_ref.true_width, |
| 34383 | pu_ref.true_height, | 34383 | pu_ref.true_height, |
| 34384 | mv_to_q4(cpx, mv.1, ss_x(fctx)), | 34384 | mv_to_q4(cpx, mv.1, ss_x(fctx)), |
| 34385 | - mv_to_q4(cpy, mv.0, ss_x(fctx)), | 34385 | + mv_to_q4(cpy, mv.0, ss_y(fctx)), |
| 34386 | chroma_stride, | 34386 | chroma_stride, |
| 34387 | chroma_buf_h, | 34387 | chroma_buf_h, |
| 34388 | write_chroma_w, | 34388 | write_chroma_w, |
| @@ -34397,7 +34397,7 @@ fn decode_inter_block( | |||
| 34397 | pv_ref.true_width, | 34397 | pv_ref.true_width, |
| 34398 | pv_ref.true_height, | 34398 | pv_ref.true_height, |
| 34399 | mv_to_q4(cpx, mv.1, ss_x(fctx)), | 34399 | mv_to_q4(cpx, mv.1, ss_x(fctx)), |
| 34400 | - mv_to_q4(cpy, mv.0, ss_x(fctx)), | 34400 | + mv_to_q4(cpy, mv.0, ss_y(fctx)), |
| 34401 | chroma_stride, | 34401 | chroma_stride, |
| 34402 | chroma_buf_h, | 34402 | chroma_buf_h, |
| 34403 | write_chroma_w, | 34403 | write_chroma_w, |
| @@ -34429,7 +34429,7 @@ fn decode_inter_block( | |||
| 34429 | pu_ref.true_width, | 34429 | pu_ref.true_width, |
| 34430 | pu_ref.true_height, | 34430 | pu_ref.true_height, |
| 34431 | mv_to_q4(cpx, mv.1, ss_x(fctx)), | 34431 | mv_to_q4(cpx, mv.1, ss_x(fctx)), |
| 34432 | - mv_to_q4(cpy, mv.0, ss_x(fctx)), | 34432 | + mv_to_q4(cpy, mv.0, ss_y(fctx)), |
| 34433 | luma_scale, | 34433 | luma_scale, |
| 34434 | chroma_stride, | 34434 | chroma_stride, |
| 34435 | chroma_buf_h, | 34435 | chroma_buf_h, |
| @@ -34445,7 +34445,7 @@ fn decode_inter_block( | |||
| 34445 | pv_ref.true_width, | 34445 | pv_ref.true_width, |
| 34446 | pv_ref.true_height, | 34446 | pv_ref.true_height, |
| 34447 | mv_to_q4(cpx, mv.1, ss_x(fctx)), | 34447 | mv_to_q4(cpx, mv.1, ss_x(fctx)), |
| 34448 | - mv_to_q4(cpy, mv.0, ss_x(fctx)), | 34448 | + mv_to_q4(cpy, mv.0, ss_y(fctx)), |
| 34449 | luma_scale, | 34449 | luma_scale, |
| 34450 | chroma_stride, | 34450 | chroma_stride, |
| 34451 | chroma_buf_h, | 34451 | chroma_buf_h, |
| @@ -34540,7 +34540,7 @@ fn decode_inter_block( | |||
| 34540 | src.true_width, | 34540 | src.true_width, |
| 34541 | src.true_height, | 34541 | src.true_height, |
| 34542 | mv_to_q4(cpx, prev_mv.1, ss_x(fctx)), | 34542 | mv_to_q4(cpx, prev_mv.1, ss_x(fctx)), |
| 34543 | - mv_to_q4(cpy, prev_mv.0, ss_x(fctx)), | 34543 | + mv_to_q4(cpy, prev_mv.0, ss_y(fctx)), |
| 34544 | prev_scale, | 34544 | prev_scale, |
| 34545 | piece_w, | 34545 | piece_w, |
| 34546 | piece_h, | 34546 | piece_h, |
| @@ -39570,7 +39570,7 @@ fn decode_inter_block8( | |||
| 39570 | pu0.true_width, | 39570 | pu0.true_width, |
| 39571 | pu0.true_height, | 39571 | pu0.true_height, |
| 39572 | mv_to_q4(cpx, mv0.1, ss_x(fctx)), | 39572 | mv_to_q4(cpx, mv0.1, ss_x(fctx)), |
| 39573 | - mv_to_q4(cpy, mv0.0, ss_x(fctx)), | 39573 | + mv_to_q4(cpy, mv0.0, ss_y(fctx)), |
| 39574 | scale0, | 39574 | scale0, |
| 39575 | chroma_w, | 39575 | chroma_w, |
| 39576 | chroma_h, | 39576 | chroma_h, |
| @@ -39585,7 +39585,7 @@ fn decode_inter_block8( | |||
| 39585 | pu1.true_width, | 39585 | pu1.true_width, |
| 39586 | pu1.true_height, | 39586 | pu1.true_height, |
| 39587 | mv_to_q4(cpx, mv1.1, ss_x(fctx)), | 39587 | mv_to_q4(cpx, mv1.1, ss_x(fctx)), |
| 39588 | - mv_to_q4(cpy, mv1.0, ss_x(fctx)), | 39588 | + mv_to_q4(cpy, mv1.0, ss_y(fctx)), |
| 39589 | scale1, | 39589 | scale1, |
| 39590 | chroma_w, | 39590 | chroma_w, |
| 39591 | chroma_h, | 39591 | chroma_h, |
| @@ -39617,7 +39617,7 @@ ss_y(fctx), | |||
| 39617 | pv0.true_width, | 39617 | pv0.true_width, |
| 39618 | pv0.true_height, | 39618 | pv0.true_height, |
| 39619 | mv_to_q4(cpx, mv0.1, ss_x(fctx)), | 39619 | mv_to_q4(cpx, mv0.1, ss_x(fctx)), |
| 39620 | - mv_to_q4(cpy, mv0.0, ss_x(fctx)), | 39620 | + mv_to_q4(cpy, mv0.0, ss_y(fctx)), |
| 39621 | scale0, | 39621 | scale0, |
| 39622 | chroma_w, | 39622 | chroma_w, |
| 39623 | chroma_h, | 39623 | chroma_h, |
| @@ -39632,7 +39632,7 @@ ss_y(fctx), | |||
| 39632 | pv1.true_width, | 39632 | pv1.true_width, |
| 39633 | pv1.true_height, | 39633 | pv1.true_height, |
| 39634 | mv_to_q4(cpx, mv1.1, ss_x(fctx)), | 39634 | mv_to_q4(cpx, mv1.1, ss_x(fctx)), |
| 39635 | - mv_to_q4(cpy, mv1.0, ss_x(fctx)), | 39635 | + mv_to_q4(cpy, mv1.0, ss_y(fctx)), |
| 39636 | scale1, | 39636 | scale1, |
| 39637 | chroma_w, | 39637 | chroma_w, |
| 39638 | chroma_h, | 39638 | 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). | ||