opus-rs 0.1.5

pure Rust implementation of Opus codec
Documentation
use crate::silk::macros::*;

const SIGM_LUT_SLOPE_Q10: [i32; 6] = [237, 153, 73, 30, 12, 7];
const SIGM_LUT_POS_Q15: [i32; 6] = [16384, 23955, 28861, 31213, 32178, 32548];
const SIGM_LUT_NEG_Q15: [i32; 6] = [16384, 8812, 3906, 1554, 589, 219];

pub fn silk_sigm_q15(in_q5: i32) -> i32 {
    let ind: usize;

    if in_q5 < 0 {
        /* Negative input */
        let in_q5_abs = -in_q5;
        if in_q5_abs >= 6 * 32 {
            0
        } else {
            /* Linear interpolation of look up table */
            ind = silk_rshift(in_q5_abs, 5) as usize;
            SIGM_LUT_NEG_Q15[ind] - silk_smulbb(SIGM_LUT_SLOPE_Q10[ind], in_q5_abs & 0x1F)
        }
    } else {
        /* Positive input */
        if in_q5 >= 6 * 32 {
            32767
        } else {
            /* Linear interpolation of look up table */
            ind = silk_rshift(in_q5, 5) as usize;
            SIGM_LUT_POS_Q15[ind] + silk_smulbb(SIGM_LUT_SLOPE_Q10[ind], in_q5 & 0x1F)
        }
    }
}