Commit 4a81ef79 authored by vaillancour's avatar vaillancour
Browse files

Fixes IO conditions

parent ee02964b
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -671,7 +671,11 @@ static void agc2_fx(
    FOR (i = 1; i < l_trm; i++)
    {
        temp = shr(sig_out[i], 2);
#ifdef BASOP_NOGLOB
        s = L_mac0_sat(s, temp, temp);
#else
        s = L_mac0(s, temp, temp);
#endif
    }
    IF (s != 0)
    {
@@ -684,7 +688,11 @@ static void agc2_fx(
        FOR (i = 1; i < l_trm; i++)
        {
            temp = shr(sig_in[i], 2);
#ifdef BASOP_NOGLOB
            s = L_mac0_sat(s, temp, temp);
#else
            s = L_mac0(s, temp, temp);
#endif
        }

        g0 = 0;
@@ -692,7 +700,11 @@ static void agc2_fx(
        IF (s != 0)
        {
            i = norm_l(s);
#ifdef BASOP_NOGLOB
            gain_in = round_fx_sat(L_shl_sat(s, i));
#else
            gain_in = round_fx(L_shl(s, i));
#endif
            exp = sub(exp, i);

            /*---------------------------------------------------*
@@ -702,13 +714,21 @@ static void agc2_fx(
            s = L_shr(s, exp);   /* add exponent */

            s = Isqrt(s);
#ifdef BASOP_NOGLOB
            g0 = round_fx_sat(L_shl_sat(s, 9));
#else
            g0 = round_fx(L_shl(s, 9));
#endif
        }

        /* sig_out(n) = gain(n) sig_out(n) */
        FOR (i = 0; i < l_trm; i++)
        {
#ifdef BASOP_NOGLOB
            sig_out[i] = round_fx_sat(L_shl_sat(L_mac(-8192, sig_out[i], g0), 2));
#else
            sig_out[i] = round_fx(L_shl(L_mac(-8192, sig_out[i], g0), 2));
#endif
        }
    }
}
+4 −1
Original line number Diff line number Diff line
@@ -614,8 +614,11 @@ void hvq_bwe_fine_fx(
        /*SWB_signal[i] = SWB_signal[i] / envelope[i]; */

        shift = norm_l(L_envelope[i]);
#ifdef BASOP_NOGLOB
        tmp = round_fx_sat(L_shl_sat(L_envelope[i], shift));                /* 12+s-16=Q(-4+s) */
#else
        tmp = round_fx(L_shl(L_envelope[i], shift));                /* 12+s-16=Q(-4+s) */

#endif
        /* Avoid division by zero */
        if (tmp == 0)
        {
+4 −0
Original line number Diff line number Diff line
@@ -575,7 +575,11 @@ void decoder_acelp(
    /* impulse response level = gain introduced by synthesis+deemphasis */
    Ltmp = Dot_productSq16HQ( 0, h1, L_SUBFR, &st->last_gain_syn_deemph_e);
    st->last_gain_syn_deemph_e= add(st->last_gain_syn_deemph_e,10/*scaling of h1[0] and E_UTIL_synthesis * 2*/);
#ifdef BASOP_NOGLOB
    st->last_gain_syn_deemph = round_fx_sat(Sqrt32(Ltmp,&st->last_gain_syn_deemph_e));
#else
    st->last_gain_syn_deemph = round_fx(Sqrt32(Ltmp,&st->last_gain_syn_deemph_e));
#endif

    /* Do the classification */
    {
+7 −7
Original line number Diff line number Diff line
@@ -1310,9 +1310,6 @@ static void envelope_fx(
    Word16 *pt1;
    const Word16 *pt2, *pt3;
    Word16 Aq[M+1];
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif


    /* Aq has dynamic scaling
@@ -1378,7 +1375,7 @@ static void envelope_fx(
    FOR ( i = 0; i <= M; i++ )
    {
#ifdef BASOP_NOGLOB
        L_tmp = L_mac_o(L_tmp, *pt2++, *pt3++, &Overflow);
        L_tmp = L_mac_sat(L_tmp, *pt2++, *pt3++);
#else
        L_tmp = L_mac(L_tmp, *pt2++, *pt3++);
#endif
@@ -1449,7 +1446,7 @@ static void envelope_fx(
        L_tmp = L_mult(As[1], tmp); /*Q(42-q1) */
        q1 = sub(q1, 14);
#ifdef BASOP_NOGLOB
        k1 = round_fx_o(L_shl_o(L_tmp, q1, &Overflow), &Overflow); /*Q12 */
        k1 = round_fx_sat(L_shl_sat(L_tmp, q1)); /*Q12 */
#else
        k1 = round_fx(L_shl(L_tmp, q1)); /*Q12 */
#endif
@@ -1530,7 +1527,7 @@ static void envelope_fx(
        IF ( GT_16(rr, (hAmrwb_IO->prev_r_fx)))
        {
#ifdef BASOP_NOGLOB
            rr = shr(add_o(rr, (hAmrwb_IO->prev_r_fx), &Overflow), 1);
            rr = shr(add_sat(rr, (hAmrwb_IO->prev_r_fx)), 1);
#else
            rr = shr(add(rr, (hAmrwb_IO->prev_r_fx)), 1);
#endif
@@ -1593,8 +1590,11 @@ static void envelope_fx(
    tmp = div_s(shl(1, sub(14, q1)), pp); /*Q(29-q1-10) */
    L_tmp = L_mult(rr, tmp);/*Q(30-q1-10+10) */

#ifdef BASOP_NOGLOB
    *sub_gain = s_min(20480,round_fx_sat(L_shl_sat(L_tmp, sub(q1, 2)))); /*Q12 */
#else
    *sub_gain = s_min(20480,round_fx(L_shl(L_tmp, sub(q1, 2)))); /*Q12 */

#endif
    return;

}