forge
Explore
Log in

Don't you dare go Hollow

Gm_get_motion_vector block-centre -1 offset

Browse files at this commit

75017f18331c5087edecb2a89dee3f3593b1c7adAhmet Kaan GümüşParent: b1aa80b
  • fix
    • gm_get_motion_vector block-centre -1 offset
    • root-cause seed-43 wedge mismatch to missing global-warp prediction path (not fixed)
Show full message
fix(av1): gm_get_motion_vector block-centre -1 offset; root-cause seed-43 wedge mismatch to missing global-warp prediction path (not fixed)

Root-caused lane-gm r2's interintra-wedge gate mismatch (seed 43, frame 1
luma) via a pinned/self-decoded-twice reproduction and a msac range-ladder
comparison against a patched aomdec: entropy is in sync at the divergent
block (rng=38664 both sides), and this decoder's gm_get_motion_vector
computes the spec-correct mv once block_center_x/y's missing "- 1" is
fixed (found by diffing against the real oracle's mv.h). The remaining
gap is real but unfixed this round: libaom predicts every
is_global_mv_block (ROTZOOM/AFFINE GLOBALMV, >=8x8) with the full
per-pixel affine global-motion warp (reconinter.c's allow_warp /
global_warp_allowed), independent of motion_mode; this decoder only
builds a warp prediction for local WARPED_CAUSAL and falls back to
translational MC for every other GLOBALMV block. Whole-frame
global_motion != IDENTITY refusal in stream.rs stays in place.
crates/ec-av1/src/stream.rsmodified+20 -0
@@ -215,6 +215,26 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
215 // is not yet provably correct end to end; keeping the refusal215 // is not yet provably correct end to end; keeping the refusal
216 // until that seed is captured (EC_AV1_GATE_DUMP), self-pinned, and216 // until that seed is captured (EC_AV1_GATE_DUMP), self-pinned, and
217 // root-caused rather than shipping a wrong decode.217 // root-caused rather than shipping a wrong decode.
218+ //
219+ // lane-gm r3 ROOT CAUSE (pinned, range-ladder-confirmed, still not
220+ // fixed): the mismatch is NOT an mv/mvstack/entropy bug -- msac
221+ // RANGE at the first divergent block (mi=(8,0), frame 1) matches
222+ // aomdec's own `EC_PART` trace bit-for-bit (rng=38664 both sides),
223+ // and this decoder's own `gm_get_motion_vector` for that block
224+ // (ROTZOOM, seed 43's own header) computes the spec-correct
225+ // mv=(-8,8) (hand-verified against mv.h's `block_center_x`/`_y`,
226+ // which found and fixed a real `- 1` omission in `warp.rs` --
227+ // harmless for THIS block's rounding but a genuine spec bug fixed
228+ // regardless). The actual gap: `reconinter.c`'s `allow_warp` has a
229+ // `global_warp_allowed` branch (`warp_types.global_warp_allowed =
230+ // is_global_mv_block(...)`, `reconinter_enc.c:281`) that predicts
231+ // an `is_global_mv_block` block (ROTZOOM/AFFINE GLOBALMV, >=8x8)
232+ // with the FULL per-pixel affine global-motion warp, independent
233+ // of `motion_mode` -- this decoder only ever builds a warp
234+ // prediction for local `WARPED_CAUSAL` motion mode and falls back
235+ // to plain translational MC with the block-centre mv for every
236+ // other GLOBALMV block, which is only a centre-point approximation
237+ // of the true per-pixel warp. That is the entire remaining gap.
218 if header.frame_type != FrameType::Key238 if header.frame_type != FrameType::Key
219 && header.global_motion[..7]239 && header.global_motion[..7]
220 .iter()240 .iter()
crates/ec-av1/src/warp.rsmodified+7 -2
@@ -104,8 +104,13 @@ pub fn gm_get_motion_vector(
104 params[1] >> GM_TRANS_ONLY_PREC_DIFF,104 params[1] >> GM_TRANS_ONLY_PREC_DIFF,
105 ),105 ),
106 WarpModel::Rotzoom | WarpModel::Affine => {106 WarpModel::Rotzoom | WarpModel::Affine => {
107- let x = (mi_col * MI_SIZE as usize + (bw4 * MI_SIZE as usize) / 2) as i64;107+ // `block_center_x`/`block_center_y` (mv.h:183-191): `- 1`, not
108- let y = (mi_row * MI_SIZE as usize + (bh4 * MI_SIZE as usize) / 2) as i64;108+ // just the halved block size -- lane-gm r3's root cause, missing
109+ // here made every ROTZOOM/AFFINE GLOBALMV prediction off by a
110+ // sub-pel fraction (small luma delta growing across P-frames as
111+ // it propagates through the reference chain).
112+ let x = (mi_col * MI_SIZE as usize + (bw4 * MI_SIZE as usize) / 2) as i64 - 1;
113+ let y = (mi_row * MI_SIZE as usize + (bh4 * MI_SIZE as usize) / 2) as i64 - 1;
109 let xc = (params[2] as i64 - (1i64 << WARPEDMODEL_PREC_BITS)) * x114 let xc = (params[2] as i64 - (1i64 << WARPEDMODEL_PREC_BITS)) * x
110 + params[3] as i64 * y115 + params[3] as i64 * y
111 + params[0] as i64;116 + params[0] as i64;