Gm_get_motion_vector block-centre -1 offset
Browse files at this commit75017f18331c5087edecb2a89dee3f3593b1c7adParent: b1aa80b- fix
- gm_get_motion_vector block-centre -1 offset
- root-cause seed-43 wedge mismatch to missing global-warp prediction path (not fixed)
2 changed files +27 -2
- crates/ec-av1/src/stream.rs +20 -0
- crates/ec-av1/src/warp.rs +7 -2
crates/ec-av1/src/stream.rsmodified+20 -0
| @@ -215,6 +215,26 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> { | ||
| 215 | 215 | // is not yet provably correct end to end; keeping the refusal |
| 216 | 216 | // until that seed is captured (EC_AV1_GATE_DUMP), self-pinned, and |
| 217 | 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 | 238 | if header.frame_type != FrameType::Key |
| 219 | 239 | && header.global_motion[..7] |
| 220 | 240 | .iter() |
crates/ec-av1/src/warp.rsmodified+7 -2
| @@ -104,8 +104,13 @@ pub fn gm_get_motion_vector( | ||
| 104 | 104 | params[1] >> GM_TRANS_ONLY_PREC_DIFF, |
| 105 | 105 | ), |
| 106 | 106 | WarpModel::Rotzoom | WarpModel::Affine => { |
| 107 | - let x = (mi_col * MI_SIZE as usize + (bw4 * MI_SIZE as usize) / 2) as i64; | |
| 108 | - let y = (mi_row * MI_SIZE as usize + (bh4 * MI_SIZE as usize) / 2) as i64; | |
| 107 | + // `block_center_x`/`block_center_y` (mv.h:183-191): `- 1`, not | |
| 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 | 114 | let xc = (params[2] as i64 - (1i64 << WARPEDMODEL_PREC_BITS)) * x |
| 110 | 115 | + params[3] as i64 * y |
| 111 | 116 | + params[0] as i64; |