forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

av1422j.report.md5.6 KiBHistoryRawDownload

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_block skip arms, single-ref (33803..) and compound (32325..): both chroma pushes forward (write_chroma_w, write_chroma_h) at stride chroma_side with ZERO_RESIDUAL[..chroma_side * chroma_side] — healed by the one-line fix (chroma_side >= both write dims now). The paired Grid::Zero(chroma_side * chroma_side) bookkeeping matches the slices.
  • Luma skip arms (ZERO_RESIDUAL[..side * side], stride side, 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_rect4 skip 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 chroma push_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)

  1. 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 a chroma_side-SQUARE unit (32x32 after the fix) with the caller's 4:2:0 scan_chroma (TX_16X16) on the 32x32 inter block at px=0 py=0. Fix: both chroma arms route non-square chroma rects through read_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_txsize of BLOCK_16X32), exactly rect_inter_chroma_set's (16,32) row. 4:2:0/4:4:4 squares keep the square arm (their chroma rect IS chroma_side-square).
  2. Next stop: rect_inter_chroma_set refused (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 exact get_txsize_entropy_ctx tables the square arms use; unreachable before this lane.
  3. Next stop: rect_scan refused squares for the same units; added (w, h) if w == h => default_scan(w) (decode.rs:22485).
  4. 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 square chroma_side shapes. 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.rs only (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_name 1/1; a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_whose_tx_split_decodes_ pixel_exact 2/2 (both bit depths) under EC_AV1_REQUIRE_AOMENC=1 — a real 420 decode gate over the shared decode_inter_block path, 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.