ec-av1: lane-av1422sub8pix -- the sub-8 4:2:2 chroma pixel defect fixed at source: sub8_leaf_chroma422's CfL AC signal was sourced at the odd leaf's own luma x instead of the floored unit anchor, so every CFL unit of a split group averaged half its span from the RIGHT neighbour group (t422 frame-1 leaf (1,23): unit reconstructs chroma px 44..47 from luma 88..95, the px-anchored source averaged 92..99); and decode_inter_sub8_split4's 4:2:2 inter piece arm fed the left 2x4 half's prediction from the left piece's U reference plane for BOTH chroma planes (V cols 44..45 read U samples; U was exact, V wasn't) -- the loop now picks the left piece's matching plane per iteration. Both sites are ss (1,0)-only code; 4:2:0/4:4:4 byte-identical (lossless gates green). t422 ladder: frame 0 exact at prefilt/postdeb/postcdef, LUMA 0 diffs on every frame 1-15 at all three stages (the f15 postcdef Y=5059 CDEF knock-on is gone), chroma frame 1 U 4175->3837 V 4636->3879 with the named mi(0,22) sites pixel-exact; next residual site narrowed to the square-8x8 chroma class at U (32,87)/V (32,80), blocks mi(8,42)/mi(8,40)
Browse files at this commit6b538b4ac5e8536c16b5a9692f38e56df4089ce1Parent: bbcf2ac2 changed files +110 -7
- crates/ec-av1/src/decode.rs +27 -7
- lanes/av1422sub8pix.report.md +83 -0
crates/ec-av1/src/decode.rsmodified+27 -7
| @@ -20155,7 +20155,13 @@ fn sub8_leaf_chroma422( | ||
| 20155 | 20155 | Reach::of_rect(leaf_shape.0, leaf_shape.1, px, py, y.width, y.height, fctx) |
| 20156 | 20156 | }; |
| 20157 | 20157 | let chroma_around = neighbours.around_mi_422_chroma(ctx_mi, 8, 4); |
| 20158 | - let ac = alpha.map(|_| cfl_src_rect(px, py, 8, 4)); | |
| 20158 | + // lane-av1422sub8pix: the CfL AC signal spans the UNIT's luma footprint, | |
| 20159 | + // anchored at the same FLOORED luma x the write/prediction anchor below | |
| 20160 | + // uses -- `px` (the odd leaf's own luma x) steps half the span into the | |
| 20161 | + // RIGHT neighbour group (t422 frame-1 leaf (1,23): the unit reconstructs | |
| 20162 | + // chroma px 44..47 from luma 88..95, while a `px`-anchored source | |
| 20163 | + // averaged luma 92..99 and every CFL unit of the group mismatched). | |
| 20164 | + let ac = alpha.map(|_| cfl_src_rect((lmi.1 & !1) * MI, py, 8, 4)); | |
| 20159 | 20165 | let grids: (Grid, Grid) = if skip { |
| 20160 | 20166 | // A skipped chroma-reference leaf still predicts (the CfL contribution |
| 20161 | 20167 | // survives a skip); no coefficient symbol exists. |
| @@ -37051,7 +37057,9 @@ fn decode_inter_sub8_split4( | ||
| 37051 | 37057 | }); |
| 37052 | 37058 | let mut pred_u = refill(std::mem::take(&mut out[1]), B4 * B4); |
| 37053 | 37059 | let mut pred_v = refill(std::mem::take(&mut out[2]), B4 * B4); |
| 37054 | - for (plane, dst) in [(sref_u, &mut pred_u), (sref_v, &mut pred_v)] { | |
| 37060 | + for (pi, (plane, dst)) in | |
| 37061 | + [(sref_u, &mut pred_u), (sref_v, &mut pred_v)].into_iter().enumerate() | |
| 37062 | + { | |
| 37055 | 37063 | let mut buf = vec![0u16; B4 * B4]; |
| 37056 | 37064 | // Right 2x4 half: this piece's own ref/mv/filters. |
| 37057 | 37065 | let mut half = vec![0u16; 2 * 4]; |
| @@ -37083,12 +37091,24 @@ fn decode_inter_sub8_split4( | ||
| 37083 | 37091 | } |
| 37084 | 37092 | None => (pc_mv, pc_hf, pc_vf, (pc_ref_y, sref_u, sref_v), pc_scale), |
| 37085 | 37093 | }; |
| 37086 | - let (_, l_ref_u, _) = l_planes; | |
| 37094 | + // lane-av1422sub8pix: the left half predicts from the | |
| 37095 | + // LEFT piece's own plane of its reference -- U for the U | |
| 37096 | + // iteration, V for the V one. The old `l_ref_u` grab | |
| 37097 | + // fed the V plane's left half from the reference's U | |
| 37098 | + // plane (V cols 44..45 of the t422 frame-1 groups read | |
| 37099 | + // U samples; U was exact, V wasn't). | |
| 37100 | + let l_ref = if pi == 0 { | |
| 37101 | + let (_, u, _) = l_planes; | |
| 37102 | + u | |
| 37103 | + } else { | |
| 37104 | + let (_, _, v) = l_planes; | |
| 37105 | + v | |
| 37106 | + }; | |
| 37087 | 37107 | mc::predict_maybe_scaled( |
| 37088 | - &l_ref_u.data, | |
| 37089 | - l_ref_u.width, | |
| 37090 | - l_ref_u.true_width, | |
| 37091 | - l_ref_u.true_height, | |
| 37108 | + &l_ref.data, | |
| 37109 | + l_ref.width, | |
| 37110 | + l_ref.true_width, | |
| 37111 | + l_ref.true_height, | |
| 37092 | 37112 | mv_to_q4(unit_x, l_mv.1, ss_x(fctx)), |
| 37093 | 37113 | mv_to_q4(unit_y, l_mv.0, ss_y(fctx)), |
| 37094 | 37114 | l_scale, |
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. |