forge
Explore
Log in

Don't you dare go Hollow

R3 bisect -- falsify deblock hypothesis, narrow BWDREF compound defect to compound_idx's decoded value

Browse files at this commit

210dfc85beda549f2c4ef572940c5cedf28d46cdAhmet Kaan GümüşParent: 70c2a11
  • fix
    • r3 bisect -- falsify deblock hypothesis, narrow BWDREF compound defect to compound_idx's decoded value
Show full message
fix(av1): r3 bisect -- falsify deblock hypothesis, narrow BWDREF compound defect to compound_idx's decoded value

Recalibrated the r2 pre-deblock frame-index gap (23 ours vs 24 aomdec
dumps): the keyframe never calls this crate's own r17_dump at all
(only decode_inter_frame_tile does) -- not a real alignment bug.
Content-hash-matched every pre-deblock dump against an instrumented
aomdec build: PRE-deblock already differs at decode-order frame 3
(fixtures/av1blend-r1-mismatch.obu, seed 45), falsifying the
deblock-parameterization hypothesis. decodemv's own EC_TRACE
(mode/mv/skip) matches this decoder's block loop exactly for every
block in that frame, and both compound inputs are independently
bit-exact pre- and post-deblock. Solving aomval = (key*w0+bwd*w1+8)>>4
against the ~20% of mismatching luma pixels picks out w0=9, w1=7 for
the majority with zero matches for the plain average this decoder
emits -- compound_idx is being decoded as 1 (simple average) when the
real bitstream encoded 0 (COMPOUND_DISTWTD, whose weights for this
frame's order-hint distances are exactly (9, 7)). CDF table, context
function, and read gate were all independently reverified correct
against libaom source; the wrong value is local to this one symbol's
decode, not a wider desync. Masks stay in place, comments updated
with the narrowed finding for the next round.
crates/ec-av1/src/decode.rsmodified+57 -3
@@ -4551,13 +4551,64 @@ fn decode_inter_block(
4551 // -- the pre-deblock `EC_AV1_PREFILT_DUMP` frame-index alignment4551 // -- the pre-deblock `EC_AV1_PREFILT_DUMP` frame-index alignment
4552 // between this crate and that aomdec build is NOT 1:1 on this4552 // between this crate and that aomdec build is NOT 1:1 on this
4553 // fixture (23 dumps here vs 24 there), so calibrate that first.4553 // fixture (23 dumps here vs 24 there), so calibrate that first.
4554+ // r3 (this round): pre-deblock buffers were bisected byte-for-byte
4555+ // against an instrumented aomdec build (EC_AV1_PREFILT_DUMP,
4556+ // frame-index alignment recalibrated via content-hash matching
4557+ // rather than the raw dump count -- the keyframe never calls this
4558+ // crate's own `r17_dump` at all, since only `decode_inter_frame_
4559+ // tile` does, which is the whole "23 vs 24" gap, not a real bug).
4560+ // Decode-order frame 3 (`fixtures/av1blend-r1-mismatch.obu`,
4561+ // seed 45) is still the first divergence: PRE-deblock differs
4562+ // from aomdec's own pre-deblock dump by up to 1, on ~20% of
4563+ // luma pixels, clustered where its two compound inputs' pixel
4564+ // values disagree by more than a couple of levels -- both
4565+ // inputs (the keyframe and decode-order frame 2's own picture)
4566+ // are independently proven bit-exact (pre- and post-deblock)
4567+ // against aomdec, and `decodemv`'s own EC_TRACE (mode/mv/skip)
4568+ // matches this decoder's block loop exactly for every block in
4569+ // this frame. Solving `aomval = (key*w0 + bwd*w1 + 8) >> 4` for
4570+ // every mismatching pixel against `key`/`bwd` (both known-exact)
4571+ // picks out `w0=9, w1=7` for the majority (525/846) with zero
4572+ // matches for the plain average this decoder actually emits or
4573+ // the reversed `w0=7, w1=9` -- i.e. `compound_idx` is being
4574+ // decoded as `1` (simple average, spec `COMPOUND_AVERAGE`) when
4575+ // the real bitstream encoded `0` (`COMPOUND_DISTWTD`,
4576+ // `dist_wtd_comp_weight_assign`'s own weights for this frame's
4577+ // order-hint distances 2/3 land on exactly `(9, 7)` -- this
4578+ // decoder's own `dist_wtd_comp_weight_assign` was independently
4579+ // re-verified against `QUANT_DIST_WEIGHT`/`QUANT_DIST_LOOKUP_TABLE`
4580+ // by hand for these distances and gives the same `(9, 7)`).
4581+ // `get_comp_index_context` was checked line-for-line against
4582+ // libaom's `pred_common.h` (the `fwd`/`bck` distance halves, the
4583+ // `above_mi`/`left_mi` `has_second_ref`/`ALTREF_FRAME` fallback,
4584+ // the `3 * offset` term) and matches; `Default_Compound_Idx_Cdf`
4585+ // (`cdf.rs`'s `COMPOUND_IDX`) matches `entropymode.c`'s
4586+ // `default_compound_idx_cdfs` value-for-value; the read is
4587+ // gated on `!skip_mode && enable_jnt_comp`, matching libaom's
4588+ // `has_second_ref(mbmi) && !mbmi->skip_mode` outer guard plus
4589+ // `order_hint_info.enable_dist_wtd_comp` inner guard. The
4590+ // remaining 321/846 mismatched pixels do NOT fit `(9, 7)`
4591+ // either -- some blocks in this frame plausibly decode a
4592+ // genuinely different (correct, context-dependent) compound_idx
4593+ // than block (0,0)'s own -- so this is not simply "always wrong
4594+ // the same way": table/context/gate are all individually
4595+ // verified correct, yet the decoded VALUE at this specific
4596+ // symbol is wrong at least once in this frame. Not isolated
4597+ // further within budget. Upgrade: instrument `dec.symbol`'s own
4598+ // range/bit state (`rng`/`tell`, matching aomdec's own EC_PART
4599+ // trace fields) immediately before and after the `compound_idx`
4600+ // read specifically, not just the surrounding mode/mv/skip
4601+ // trace which does match -- the desync (if any) is local to
4602+ // this one read, not a wider stream desync.
4554 return Err(unsupported(4603 return Err(unsupported(
4555 "a COMPOUND_REFERENCE block using the plain/distance-weighted \4604 "a COMPOUND_REFERENCE block using the plain/distance-weighted \
4556 average blend (comp_group_idx == 0) -- proven non-pixel-exact \4605 average blend (comp_group_idx == 0) -- proven non-pixel-exact \
4557- against a real aomenc stream (lane-av1blend r1/r2, see \4606+ against a real aomenc stream (lane-av1blend r1/r2/r3, see \
4558 av1blend-r1-mismatch.obu and the comment above: a per-block \4607 av1blend-r1-mismatch.obu and the comment above: a per-block \
4559 decode defect surfacing only on chained BWDREF compound, not \4608 decode defect surfacing only on chained BWDREF compound, not \
4560- an MC/blend arithmetic bug)",4609+ an MC/blend arithmetic bug -- r3 narrowed it to compound_idx's \
4610+ own decoded value, table/context/gate independently verified \
4611+ correct)",
4561 ));4612 ));
4562 #[allow(unreachable_code)]4613 #[allow(unreachable_code)]
4563 let (fwd_offset, bck_offset, compound_idx) = if !skip_mode && enable_jnt_comp {4614 let (fwd_offset, bck_offset, compound_idx) = if !skip_mode && enable_jnt_comp {
@@ -5411,10 +5462,13 @@ fn decode_inter_block8(
5411 // (r1: falsified as an MC/blend math bug, isolated to a DPB5462 // (r1: falsified as an MC/blend math bug, isolated to a DPB
5412 // slot/refresh_frame_flags issue around BWDREF_FRAME) -- see5463 // slot/refresh_frame_flags issue around BWDREF_FRAME) -- see
5413 // that comment.5464 // that comment.
5465+ // r3: same defect as the 16x16 leaf's own mask above -- see
5466+ // that comment (compound_idx's decoded value, not the blend
5467+ // math or reference-slot bookkeeping).
5414 return Err(unsupported(5468 return Err(unsupported(
5415 "a COMPOUND_REFERENCE 8x8 leaf using the plain/distance-weighted \5469 "a COMPOUND_REFERENCE 8x8 leaf using the plain/distance-weighted \
5416 average blend (comp_group_idx == 0) -- proven non-pixel-exact \5470 average blend (comp_group_idx == 0) -- proven non-pixel-exact \
5417- against a real aomenc stream (lane-av1blend r1, see \5471+ against a real aomenc stream (lane-av1blend r1/r3, see \
5418 av1blend-r1-mismatch.obu)",5472 av1blend-r1-mismatch.obu)",
5419 ));5473 ));
5420 #[allow(unreachable_code)]5474 #[allow(unreachable_code)]