edith_codecs
Clone
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
lane-sb128c r5 -> r6 handoff
Worktree edith_codecs-sb128c, CARGO_TARGET_DIR=$HOME/.cache/cargo-target-sb128c.
Work stream: $HOME/.cache/sb128c-work/g-61-8-0.obu (arm 1) and a3.obu (arm 3,
copied out of the gate's pinned /tmp dir -- keep it, /tmp is reaped).
(1) The r4 residue: THREE root causes, all fixed, arms 1+2 GREEN
r4's "frame 5 pre-filter wrong, entropy in sync" premise was WRONG: the mode-value
ladder (EC_TRACE_MODE, values only -- our EC_MODE_VAL prints its rng at
libaom's EC_MODE_MV point, so RANGE is not comparable line-for-line) diverges at
mode-value line 43, mi(32,0), a 128x128 NEWMV block:
oracle EC_MODE_VAL mi_row=32 mi_col=0 mode=16 ref0=1 mv0=(63,0) stack=1
ours EC_MODE_VAL mi_row=32 mi_col=0 mode=16 ref0=1 mv0=(0,0) stack=2
a) mv stack: the top-right probe was never gated on has_top_right.
crates/ec-av1/src/mvstack.rs:882 (find_mv_stack) and :1680
(find_mv_stack_compound) called scan_top_right{,_compound} unconditionally.
libaom setup_ref_mv_list (mvref_common.c:497 + :546) computes
has_tr = has_top_right(cm, xd, mi_row, mi_col, AOMMAX(width,height)) and only
then scan_blk_mbmi(-1, xd->width). has_top_right returns 0 for bs > 16, so a
128x128 block has NO top-right candidate -- but the cell diagonally above-right of
mi(32,0) (= mi(31,32), in the previous SB row) IS populated, so our grid probe
invented (441,441) w=644 and the extra stack entry desynced the drl symbols.
The module's own mvstack::has_top_right port already existed and was correct; it
just was not wired into the mv-stack scan (only into the warp-sample gather).
b) motion_mode/obmc CDF row 4 for a 128x128 block.
decode.rs:17977 mapped square sizes with w == h => (w.trailing_zeros() - 3),
which sends 128 to row 4 -- our packed BLOCK_16X32 row. Wrong alphabet narrowing,
no wrong value (class wrong-alphabet-same-value). Added libaom
default_motion_mode_cdf / default_obmc_cdf rows 13/14/15 (BLOCK_64X128,
128X64, 128X128) as our packed indices 14/15/16 in cdf.rs (arrays 14 -> 17,
cdf_state.rs types too) and explicit (64,128)/(128,64)/(128,128) match arms
BEFORE the square arm.
c) A TX_64X64 luma unit of an INTRA-in-inter 128 block used the full 64x64 scan.
decode.rs:18995 passed default_scan(tx_px) and tx_side = tx_px; a TX_64X64
codes only its top-left 32x32 (spec 5.11.40). Panicked
transform.rs:828 assertion left==right: one coefficient per position, 1024 vs 4096
on gate arm 2. Now .min(32) on both, matching every other 64-capable site
(coeff_tx_side, default_scan(tx_px.min(32)) at :17429/:18494).
EVIDENCE: $HOME/.cache/sb128c-work/pf-{o,m}.f0..f8 | EC_AV1_PREFILT_DUMP on
aomdec oracle + decode_probe, g-61-8-0.obu | all 9 decode-order frames 0 bytes
differ (was 19550/14164/26667/26716 on f5..f8), mode-value ladder MODE_IDENTICAL.
Gate a_real_aomenc_inter_128x128_none_root_decodes_pixel_exact:
- arm 1 (yuv420p, tx_search=0, seed 61): 9/9 frames exact,
inter_sb128_none_hits=14 chroma_units=16 intra_128_in_inter=0 - arm 2 (yuv420p10le, tx_search=0, seed 61): 9/9 frames exact,
hits=29 chroma_units=28 intra_128_in_inter=1 - arm 3 (yuv420p, tx_search=1, seed 62): RED, 7 bytes, see below.
a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exactanda_real_aomenc_128x128_superblock_stream_decodes_pixel_exactstay green.
(2) EXACT NEXT STEP: arm 3, a phantom CHROMA deblock edge (4 px), stage-bisected
Stream $HOME/.cache/sb128c-work/a3.obu (909 B, 256x256 8-bit, 9 decode-order
frames). Mode ladder is IDENTICAL to the oracle -- no entropy defect.
Stage bisection (oracle rungs EC_AV1_PREFILT_DUMP / EC_AV1_POSTDEBLOCK_DUMP /
EC_AV1_FINAL_DUMP; NOTE our POSTDEBLOCK dump indexes 0,2,4,... so oracle fN
pairs with ours f2N, and on THIS stream it really is pre-CDEF):
pre-filter f0..f8 : 0 0 0 0 7 6 6 6 0 (f4+ is propagation)
post-deblock f3 : 4 px <-- the defect
final f3 : 7 px, f4..f7 6 px each
The 4 post-deblock pixels are V-plane only:
V(46,56) V(46,57) V(47,54) V(47,55), ours 170 vs oracle 167 -- two pairs
straddling a VERTICAL chroma edge at chroma x=56 (luma x=112), inside the
mi(0,0) side=128 is_inter=1 skip=0 block of decode-order frame 3.
Root cause (identified, NOT yet fixed): decode.rs:19303, the per-vartx-leaf
fill_lf_grid_rect loop in decode_inter_block, passes the LUMA leaf extent, and
fill_lf_grid_rect derives uv_tx_w/h from its own w_mi/h_mi (decode.rs:4211).
So a 16x16 luma leaf publishes a chroma TU extent of 8 and creates chroma edges
every 8 px -- e.g. at chroma 56. libaom takes a chroma plane's transform size from
av1_get_max_uv_txsize(mbmi->bsize, ...) (the BLOCK's, = TX_32X32 for a 128 root)
in set_one_param_for_line_chroma, never from the luma var-tx leaf. Fix shape:
leave the chroma half of the grid at the BLOCK's uv extent when writing per-leaf
(a leaf-only luma write, or an explicit uv re-publish after the loop, mirroring
r4's suppress_internal_lf_edges). Beware r4's trap: the block-level uv .min(32)
cap must stay (an INTRA 128 block's internal chroma edges ARE filtered).
Re-run the key-frame 128 sibling gate after touching this (class
fix-trades-sibling-gate).
(3) NOT STARTED
deferred: 128-level HORZ/VERT + AB partitions (key and inter) -- r5's budget went
to the three r4-residue root causes; unblocked by nothing. Refusal
refusal_inventory.rs:45 "a 128x128 superblock HORZ/VERT or AB partition (only
SPLIT and NONE are decoded at the 128 root)" is untouched. cdf::MOTION_MODE/
cdf::OBMC now already carry the BLOCK_64X128 / BLOCK_128X64 rows that work needs.
deferred: full suite -- not run this round (r4's was also incomplete); r6 must run
systemd-run --user --unit=sb128c-suite-$(date +%s) -p MemoryMax=10G --same-dir bash -lc '...'
per COMMON, log to $HOME/.cache/sb128c-suite-r6.log.
deferred: ReelC re-probe -- not re-run; r4 measured both extracts still stopping at
the 128 HORZ/VERT/AB refusal with EC_AV1_FINAL_DUMP count 1, byte-identical to
ffmpeg. Nothing in r5 touches that stop string.