edith_codecs
Clone
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
lane-av1-422j — inter chroma skip residual sized from the write rect; frame 1 decodes past the VERT_B skip strip; refusal stays
Outcome
The frame-1 panic at decode.rs:29094:39 (range end index 68 out of range for slice of length 64) is fixed by sizing decode_inter_block's chroma
square from the write rect instead of the block side, and the same-shape sweep
found exactly one more instance of the class, sharing the same fix. The
16-frame stream is NOT pixel-exact — the frontier moved to the intra-in-inter
chroma read, a different machinery — so the 4:2:2 header refusal STAYS
(byte-identical, unconditional; the local EC_AV1_ALLOW_422_PROBE bypass was
reverted before commit).
Root cause and fix
decode_inter_block computed chroma_side = side >> ss_x(fctx) (old
decode.rs:31227). Every consumer indexes the chroma prediction/residual
buffers row * chroma_side + col over the WRITE rect
(write_chroma_w x write_chroma_h), and at ss (1,0) that rect is
side/2 x side: frame 1's skipped 16-level VERT_B strip at mi(4,0)
(8x16 luma, tell 542) has a 4x16 chroma rect, so a side >> ss_x = 8 square
is shorter than row * 8 + 4 on rows >= 8 — the all-zero-residual copy read
prediction[64..68] out of the 64-sample buffer (reconstruct_mc_rect's
residual.is_empty() branch, decode.rs:29094). Fixture
/tmp/t422.obu sha256
d3fa4beeb1309033e4a03f5ae5c431c8fa8386ba1ada088684710423c7938129
reproduced it before the change and passes the block after it.
Fix: let chroma_side = (side >> ss_x(fctx)).max(side >> ss_y(fctx));
(decode.rs:31237) — the enclosing square of the chroma rect. Bit-identical at
4:2:0 (side/2) and 4:4:4 (side); only 4:2:2 changes shape.
Same-shape sweep (ZERO_RESIDUAL slices vs forwarded w/h)
decode_inter_blockskip arms, single-ref (33803..) and compound (32325..): both chroma pushes forward(write_chroma_w, write_chroma_h)at stridechroma_sidewithZERO_RESIDUAL[..chroma_side * chroma_side]— healed by the one-line fix (chroma_side >= both write dims now). The pairedGrid::Zero(chroma_side * chroma_side)bookkeeping matches the slices.- Luma skip arms (
ZERO_RESIDUAL[..side * side], strideside, rect(write_w, write_h)with w,h <= side): max index(write_h-1)*side + write_w <= side*side— provably safe, untouched. - Other inter-path slices audited against their forwarded dims:
decode_block_rect4skip arm (side * bh/cside * ch— stride*rows sizing, safe),decode_intrabc_rect(11682/12024, square >= rect, safe), 14205 (side * bh, safe), 37037/37187 (4:4:4-only, SIDE^2 >= rect, safe), 37338 sub8 tail (square push, safe).decode_inter_block8's chromapush_mc(square) always fits its own square slice — no panic class there; its 4:2:2 8x8-leaf chroma is a latent half-write shape, NOT this class, and was left for its owning lane.
Frontier re-measure (EC_AV1_ALLOW_422_PROBE=1, local only)
- After the sizing fix the skip strip passes and the next stop was
transform.rs:1150(one coefficient per position, 256 vs 1024): the square non-skip chroma arm read achroma_side-SQUARE unit (32x32 after the fix) with the caller's 4:2:0scan_chroma(TX_16X16) on the 32x32 inter block at px=0 py=0. Fix: both chroma arms route non-square chroma rects throughread_inter_rect_chroma(rect_tu || (write_chroma_w, write_chroma_h) != (chroma_side, chroma_side), decode.rs:32712/34222) — a 32x32 block codes ONE TX_16X32 chroma unit (av1_get_max_uv_txsizeof BLOCK_16X32), exactlyrect_inter_chroma_set's (16,32) row. 4:2:0/4:4:4 squares keep the square arm (their chroma rect ISchroma_side-square). - Next stop:
rect_inter_chroma_setrefused (8,8) — a 4:2:2 HORZ_B 16x8 strip's chroma plane block is 8x8 SQUARE and the rect reader now takes it. Added the square rows (16,16)->Chroma16, (8,8)->Chroma8, (4,4)->Chroma4 (decode.rs:22420) — the exactget_txsize_entropy_ctxtables the square arms use; unreachable before this lane. - Next stop:
rect_scanrefused squares for the same units; added(w, h) if w == h => default_scan(w)(decode.rs:22485). - Current named stop: an INTRA 16x16 block inside frame 1 (px=192 py=96)
panics in the intra-in-inter branch's chroma
read_plane(exec_intra->reconstruct, index len 128 idx 128, decode.rs:3845) — the intra chroma reader still predicts/reconstructs at squarechroma_sideshapes. That is intra prediction machinery, not the ZERO_RESIDUAL slice class, and reworking it means inventing chroma shapes beyond this lane's mandate; left as the named stop for the owning lane.
4:2:2 chroma counters PROVE chroma units ran on the probe path:
chroma422_square: 24, chroma422_rect: 96, chroma422_sub8: 26 — but the
stream is not pixel-exact, so the delete condition (pixel-exact + counter) is
unmet and the refusal stays.
State
- Source change:
crates/ec-av1/src/decode.rsonly (chroma_side sizing, two rect-routing conditions, square set/scan rows).git diff= 42 insertions, 3 deletions. The stream.rs probe bypass is REVERTED; default refusal re-verified firing:REFUSED: unsupported: AV1 decode_stream (a chroma format of 4:2:2 ...). - 420 gates green (target dir
$HOME/.cache/cargo-target-av1422j):a_non_420_subsampled_sequence_header_is_refused_by_name1/1;a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_whose_tx_split_decodes_ pixel_exact2/2 (both bit depths) underEC_AV1_REQUIRE_AOMENC=1— a real 420 decode gate over the shareddecode_inter_blockpath, confirming the changes are bit-neutral at 4:2:0.cargo check -p ec-av1: 0 warnings. - No push. Probe traces left at /tmp/t422_probe.txt/.err.