1. Full Range (⁨1m20s⁩)
Docs

/Users/oravid/workspace/rav1d/src/refmvs.rs

TotalSelf
len * 2,
cand_b,
r#ref,
gmv,
have_newmv_match,
have_refmv_match,
);
y += len;
if y >= h4 {
return 1;
}
cand_b = *r.index(b[y as usize] + bx4 as usize);
cand_bh4 = cand_b.bs.dimensions()[1] as i32;
assert!(cand_bh4 < bh4);
len = cmp::max(step, cand_bh4);
}
}

#[inline]
fn mv_projection(mv: Mv, num: i32, den: i32) -> Mv {
static div_mult: [u16; 32] = [
0, 16384, 8192, 5461, 4096, 3276, 2730, 2340, 2048, 1820, 1638, 1489, 1365, 1260, 1170,
1092, 1024, 963, 910, 862, 819, 780, 744, 712, 682, 655, 630, 606, 585, 564, 546, 528,
];
assert!(den > 0 && den < 32);
assert!(num > -32 && num < 32);
let frac = num * div_mult[den as usize] as i32;
let y = mv.y as i32 * frac;
let x = mv.x as i32 * frac;
// Round and clip according to AV1 spec section 7.9.3
let max = (1 << 14) - 1;
return Mv {
y: iclip(y + 8192 + (y >> 31) >> 14, -max, max) as i16,
x: iclip(x + 8192 + (x >> 31) >> 14, -max, max) as i16,
};
}

fn add_temporal_candidate(
rf: &RefMvsFrame,
mvstack: &mut [RefMvsCandidate],
cnt: &mut usize,
rb: RefMvsTemporalBlock,
r#ref: RefMvsRefPair,
globalmv: Option<(&mut i32, &[Mv; 2])>,
frame_hdr: &Rav1dFrameHeader,
) {
if rb.mv.is_invalid() {
return;
}

let mut mv = mv_projection(
rb.mv,
rf.pocdiff[r#ref.r#ref[0] as usize - 1] as i32,
rb.r#ref as i32,
);
fix_mv_precision(frame_hdr, &mut mv);

let last = *cnt;
if r#ref.r#ref[1] == -1 {
if let Some((globalmv_ctx, gmv)) = globalmv {
*globalmv_ctx = ((mv.x - gmv[0].x).abs() | (mv.y - gmv[0].y).abs() >= 16) as i32;
}

for cand in &mut mvstack[..last] {
if cand.mv.mv[0] == mv {
cand.weight += 2;
return;
}
}
if last < 8 {
let cand = &mut mvstack[last];
cand.mv.mv[0] = mv;
cand.weight = 2;
*cnt = last + 1;
}
} else {
let mut mvp = RefMvsMvPair {
mv: [
mv,
mv_projection(
rb.mv,
rf.pocdiff[r#ref.r#ref[1] as usize - 1] as i32,
rb.r#ref as i32,
),
],
};
fix_mv_precision(frame_hdr, &mut mvp.mv[1]);

for cand in &mut mvstack[..last] {
if cand.mv == mvp {
cand.weight += 2;
return;
}
}
if last < 8 {
let cand = &mut mvstack[last];
cand.mv = mvp;
cand.weight = 2;
*cnt = last + 1;
}
};
}

fn add_compound_extended_candidate(
same: &mut [RefMvsCandidate],
same_count: &mut [usize; 4],
cand_b: RefMvsBlock,
sign0: u8,
sign1: u8,
r#ref: RefMvsRefPair,
sign_bias: &[u8; 7],
) {
let (same, diff) = same.split_at_mut(2);
let (same_count, diff_count) = same_count.split_at_mut(2);

for n in 0..2 {
let cand_ref = cand_b.r#ref.r#ref[n];

add_temporal_candidate

TotalSelf
stp x29, x30, [sp, #-0x10]!
mov x29, sp
ubfx x10, x3, #0x10, #0x18
and w8, w3, #0xffff
cmp w8, #0x8, lsl #12
b.ne $+0x18
and w8, w10, #0xffff
cmp w8, #0x8, lsl #12
b.ne $+0xc
ldp x29, x30, [sp], #0x10
ret
sxtb x8, w4
sub x8, x8, #0x1
cmp x8, #0x7
b.hs $+0x6a0
sbfx x11, x3, #0x20, #0x8
sub w9, w11, #0x1
cmp w9, #0x1f
b.hs $+0x658
add x9, x0, #0xda
ldrsb w8, [x9, x8]
add w12, w8, #0x1f
cmp w12, #0x3f
b.hs $+0x62c
fmov s0, w3
mov v0.s[1], w10
adrp x10, $+0xf0000
add x10, x10, #0xbe2
ldrh w10, [x10, w11, uxtw #1]
mul w8, w10, w8
shl v0.2s, v0.2s, #0x10
sshr v1.2s, v0.2s, #0x10
dup v0.2s, w8
mul v0.2s, v0.2s, v1.2s
ssra v0.2s, v0.2s, #0x1f
movi v2.2s, #0x20, lsl #8
add v0.2s, v0.2s, v2.2s
sshr v0.2s, v0.2s, #0xe
movi v2.2s, #0x3f, msl #8
smin v0.2s, v0.2s, v2.2s
mov w8, #0xffffc001
dup v2.2s, w8
smax v0.2s, v0.2s, v2.2s
ldrb w11, [x7, #0xf9]
tbz w11, #0x0, $+0x28
movi d2, #0xf0f
and v2.8b, v0.8b, v2.8b
usra v0.2s, v2.2s, #0xf
movi v2.2s, #0x3
add v0.2s, v0.2s, v2.2s
mov w8, #0xfff8
dup v2.2s, w8
and v0.8b, v0.8b, v2.8b
b $+0x24
ldrb w8, [x7, #0x18a]
tbnz w8, #0x0, $+0x1c
movi d2, #0xf0f
and v2.8b, v0.8b, v2.8b
usra v0.2s, v2.2s, #0xf
mov w8, #0xfffe
dup v2.2s, w8
and v0.8b, v0.8b, v2.8b
ubfx w8, w4, #0x8, #0x8
ldr x0, [x2]
cmp w8, #0xff
b.eq $+0x80
lsr w8, w4, #0x8
sxtb x8, w8
sub x8, x8, #0x1
cmp x8, #0x7
b.hs $+0x5d4
ldrsb w8, [x9, x8]
add w9, w8, #0x1f
cmp w9, #0x3f
b.hs $+0x560
mul w8, w8, w10
dup v2.2s, w8
mul v1.2s, v2.2s, v1.2s
ssra v1.2s, v1.2s, #0x1f
movi v2.2s, #0x20, lsl #8
add v1.2s, v1.2s, v2.2s
sshr v1.2s, v1.2s, #0xe
movi v2.2s, #0x3f, msl #8
smin v1.2s, v1.2s, v2.2s
mov w8, #0xffffc001
dup v2.2s, w8
smax v1.2s, v1.2s, v2.2s
tbz w11, #0x0, $+0xb0
movi d2, #0xf0f
and v2.8b, v1.8b, v2.8b
usra v1.2s, v2.2s, #0xf
movi v2.2s, #0x3
add v1.2s, v1.2s, v2.2s
mov w8, #0xfff8
dup v2.2s, w8
and v1.8b, v1.8b, v2.8b
b $+0xac
cbz x5, $+0x3c
ld1 {v1.h}[0], [x6]
add x8, x6, #0x2
ld1 {v1.h}[2], [x8]
sub v1.2s, v0.2s, v1.2s
Drop a saved profile here