opus-pure 0.2.2

Pure-Rust Opus audio codec (RFC 6716) with Ogg encapsulation (RFC 7845)
Documentation
use crate::silk::define::MAX_LPC_ORDER;
use crate::silk::macros::*;

pub fn silk_interpolate(x0: &[i16], x1: &[i16], ifact_q2: i32, d: usize) -> [i16; MAX_LPC_ORDER] {
    debug_assert!((0..=4).contains(&ifact_q2));
    let mut xi = [0i16; MAX_LPC_ORDER];
    for i in 0..d {
        xi[i] = silk_add_rshift(
            x0[i] as i32,
            silk_smulbb(x1[i] as i32 - x0[i] as i32, ifact_q2),
            2,
        ) as i16;
    }
    xi
}

fn silk_add_rshift(a: i32, b: i32, shift: i32) -> i32 {
    a + (b >> shift)
}