edith_codecs
Clone
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
lane-t900 r12 handoff -- the chroma edge-filter type read a one-slot-per-column uv_mode map; a sub-8x8 pair overwrote its own neighbour row
Tip: a75db293 on lane-t900 (base: main 2b65cb8e, fast-forwarded in before any edit).
Target A -- 4K 10 s head, decode frame 161: ROOT CAUSE FOUND AND FIXED
Stage split first (r11 method rule), BEFORE reading any prediction code:
EC_AV1_PREFILT_DUMP16 on both decoders over a 250-OBU / 168-decode-frame cut of the
10 s head (~/.cache/t900-tmp/reelb250.obu) -- the mismatch is already in RECONSTRUCTION
(pre-filter), frames 161 and 162 only, and it is CHROMA ONLY, luma bit-exact:
f161 U 37 px, V 22 px, deltas -3..+3, in three anti-diagonal triangles at
chroma (856,160), (1080,252), (1088,696)
Block: chroma (856,160) = luma mi(80,429), a 4x8 luma leaf (PARTITION_VERT of an 8x8),
i.e. the CHROMA-REFERENCE half of a sub-8x8 pair. EC_PRED on both decoders
(ours needs EC_PICT under EC_PRED, added this round, decode.rs:29684 -- the second
of the two EC_PICT sites is the inter-frame one):
aomdec EC_PRED mi_row=80 mi_col=429 plane=1 txw=4 txh=4 mode=3 p_angle=45
have_top=1 have_left=1 n_top=4 n_left=4 n_tr=4 n_bl=-1 bsize=3 part=2 ft=1
EC_PREDOUT sum=8355 row0=514,521,523,523
ours OUR_PRED x=856 y=160 side=4 mode=3 ad=0 ft=0 sum=8358 row0=[514,524,522,523]
One field: ft (intra_edge_filter_type) 1 vs 0. Same mode, same angle, same edges.
Root cause (decode.rs Neighbours::smooth_uv_neighbour_unsnapped): libaom reads the
chroma neighbours straight off the mi grid (chroma_above_mbmi = base_mi[-stride],
set_mi_row_col), where every mi cell a block covers holds that block's uv_mode.
Ours kept only ONE slot per mi column (uv_mode_col[col] = (last_row, uv_mode)), so
inside a sub-8x8 pair the pair's own FIRST half (mi(80,428), non-chroma-ref, stamps
DC_PRED over mi rows 80..81) overwrote column 428 before the pair's chroma-ref half
(mi(80,429), which snaps its neighbour read to base column 428) read it. The mi-exact
match row == mi_r - 1 then failed and the coarse SUB-grid band answered DC instead of
the SMOOTH_PRED chroma block really sitting at mi(79,428) -- ft 1 -> 0, which flips
av1_use_intra_edge_upsample/filter strength on the chroma edge.
Fix: uv_mode_grid, a full mi-granular uv_mode grid (superblock-padded stride
uv_grid_cols, u8::MAX = unwritten) written by record_uv_mode_mi over every cell a
block covers and read first by smooth_uv_neighbour_unsnapped; the two old maps stay as
the fallback for unwritten cells, so no existing path changes answer unless the grid
knows better. Availability stays tile-relative (mi_r > tile_row0_mi /
mi_c > tile_col0_mi, untouched); the grid is per-frame (Neighbours::new).
New counter ec_av1::decode::uv_mode_grid_override_hits().
Measured (cmp.sh = EC_AV1_FINAL_DUMP both decoders, byte compare per decode frame):
| stream | before r12 | after r12 |
|---|---|---|
4K 10 s head, 168-frame cut reelb250.obu |
2 differ (f161 60 B, f162 72 B) | 0 of 168 |
4K 10 s head, full ~/.cache/hg-0-10s.obu (241 f) |
66 differ, first 161, worst 199 B | 0 of 241 |
| 1080p @5400 cut (275 f) | 134 differ, first 61, f113 1942 B, worst 2410 B | 5 differ, first 61, worst 3 B (f63) |
| 1080p @900 cut (267 f) | 36 differ, first 41, worst 13 B | 36 / 41 / 13 (unchanged) |
Target B -- 1080p @5400 f113 (1942 B, chroma-only intra in an inter frame): FIXED BY A
Same root cause, same fix: f113 is byte-exact now, and the cut went 134 -> 5 differing frames, worst 2410 B -> 3 B. The r11 charter premise (CfL / chroma DC ctx / the r8 DC_PRED stamp being wrong on the chroma side) was NOT the defect -- the stamp is right (an inter neighbour must read as not-smooth for chroma); what was wrong is WHICH cell the read landed on. Residue on that cut: 5 frames, 1-3 B each (f61, f63, f136, f174, f236) -- same 1-3 B shape as target C, unmeasured this round.
Target C -- 1-3 B bottom-edge residue on the @900 cut: UNTOUCHED, premise narrowed
36 frames, first 41, worst 13 B; unchanged by A. Not started this round beyond reading the reference-clamp path on both sides:
- ours
mc::sampleclamps every tap totrue_width/true_height, whichdecode.rs:16238sets to the MI-ALIGNED size (mi_cols*4,mi_rows*4), halved for chroma; - libaom clamps via
extend_mc_border->build_mc_border(..., pre_buf->width, pre_buf->height)andsetup_pred_planefills those from the CROP dims (uv_crop_width/height). For 1920x792: MiRows 198 -> aligned 792 == crop 792, chroma 396 == 396, so aligned-vs-crop CANNOT be the explanation on this stream (r11 said the same; now read off both sources). Next step is the tap-row rung as chartered:EC_MC_CALLalready exists on our side (mc.rs:380, prints x_q4/y_q4/xfrac/yfrac/tw/th/stride); add the matching rung indec_calc_subpel_params/update_extend_mc_border_params(decodeframe.c:484-560) printingblock.x0/x1/y0/y1,frame_width/heightand whether the border-extension path was TAKEN -- note that path is skipped entirely when the MV is whole-pel and both frame dims are multiples of 8, so libaom then reads the ref buffer's own extended border rows rather than a clamped copy. Frame 41, chroma (353,395), skip 32x32 mi(192,176) mv0=(-4,14).
Method notes for the successor
- Our
EC_PICT idx=Nmarker is printed at the END of frame N's decode, so a frame's trace lines are the ones BEFORE its marker, not after (an r11/r12 off-by-one that silently reads the next frame). EC_PICTnow also prints underEC_PRED(both sites).- aomdec has no frame marker; align its
EC_PREDlines by grepping a small mi window in both decoders and matching the sequences 1:1 -- an UNMATCHED extra line on our side is itself the finding. - Dumps:
~/.cache/t900-tmp/pf_r12_161/(prefilter, 168 f),d_r12_reelb10/,d_r12_cut_900/,d_r12_cut_5400/.
Owed (not done at the turn cap)
- Witness gate: no gate asserts
uv_mode_grid_override_hits() > 0yet. Check the existing 128sb/gm_small_side/frame_edge_mv_clamping fixtures for a hit first (decode_probedoes not print the new counter yet), else pin the smallest prefix of the 4K head that fires it (the defect frame is 161, so a ~250-OBU cut). - Full
cargo test -p ec-av1 --libsuite run (charter said no suite this round). - 1080p head 0-10 s re-probe (was 78 differing, first 86).