Commit 31b5cf9a authored by vaillancour's avatar vaillancour
Browse files

Merge branch 'basop_noglob' into configurable-overflow-64bits-and-saturation

Modified the merge to follow new BASOP_NOGLOB_DECLARE_LOCAL declaration
parents 0976c152 7e58d509
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -185,7 +185,7 @@ Word32 pow_10(Word32 x , Word16 *Q)
  FOR(i =1 ;i <= n ;i++)
  {
	  Overflow = 0;   move16();
#ifdef BASOP_NOGLOB
#ifdef BASOP_NOGLOB   /* Critical Overflow */
	  L_tmp = L_shl_o(L_tmp,i, &Overflow);
#else
	  L_tmp = L_shl(L_tmp,i);
+4 −0
Original line number Diff line number Diff line
@@ -236,7 +236,11 @@ void CNG_exc_fx(
        {
            /* exc2[i] *= enr */
            L_tmp = L_mult(exc2[i_subfr+i], tmp); /* Q-4 * Q_exc+19 -> Q_exc +16 */
#ifdef BASOP_NOGLOB
            exc2[i_subfr+i] = round_fx_o(L_shl_o(L_tmp, exp, &Overflow), &Overflow);
#else
            exc2[i_subfr+i] = round_fx(L_shl(L_tmp, exp));
#endif
        }
    }
    IF ( NE_16(Opt_AMR_WB,1))
+5 −0
Original line number Diff line number Diff line
@@ -130,8 +130,13 @@ void E_UTIL_deemph2(Word16 shift, Word16 *x, const Word16 mu, const Word16 L, Wo
        shift = shr(-32768, shift);
        FOR (i = 0; i < L; i++)
        {
#ifdef BASOP_NOGLOB
            L_tmp = L_msu_o(Mpy_32_16_1(L_tmp, mu), x[i],shift, &Overflow);
            x[i] = round_fx_o(L_tmp, &Overflow);
#else
            L_tmp = L_msu(Mpy_32_16_1(L_tmp, mu), x[i],shift);
            x[i] = round_fx(L_tmp);
#endif
        }

    }
+46 −2
Original line number Diff line number Diff line
@@ -11,16 +11,26 @@
 *
 * Find Energy of the 1/A(z) impulse response
 *-------------------------------------------------------------------*/
#ifdef BASOP_NOGLOB
Word16 Enr_1_Az_fx_o(       /* o  : impulse response energy      Q3  */
    const Word16 Aq[],      /* i  : LP filter coefs              Qx based on the fact that Aq[0] == 1.0 */
    const Word16 len,       /* i  : impulse response length      Q0  */
    Flag* Overflow_out      /* o :  propagating the Overflow flag to upper level */
)
#else
Word16 Enr_1_Az_fx(         /* o  : impulse response energy      Q3  */
    const Word16 Aq[],      /* i  : LP filter coefs              Qx based on the fact that Aq[0] == 1.0 */
    const Word16 len        /* i  : impulse response length      Q0  */
)
#endif
{
    Word16 h1[2*L_SUBFR];
    Word16 *y;
    Word16 i, j, a0, q;
    Word32 L_tmp, L_tmp2;

#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
    /* Find the impulse response */

    q = sub( 3, norm_s(Aq[0]) );
@@ -50,12 +60,22 @@ Word16 Enr_1_Az_fx( /* o : impulse response energy Q3 */
        L_tmp = L_msu(0, Aq[1], y[-1]);
        FOR (j = 2; j <= i; j++)
        {
#ifdef BASOP_NOGLOB
            L_tmp = L_msu_o(L_tmp, Aq[j], y[-j], &Overflow);
#else
            L_tmp = L_msu(L_tmp, Aq[j], y[-j]);
#endif
        }

#ifdef BASOP_NOGLOB
        L_tmp = L_shl_o(L_tmp, q, &Overflow);
        *y = round_fx_o(L_tmp, &Overflow);
        L_tmp2 = L_mac_o(L_tmp2, *y, *y, &Overflow);
#else
        L_tmp = L_shl(L_tmp, q);
        *y = round_fx(L_tmp);
        L_tmp2 = L_mac(L_tmp2, *y, *y);
#endif
        y++;
    }
    /* Normal Filtering */
@@ -64,14 +84,38 @@ Word16 Enr_1_Az_fx( /* o : impulse response energy Q3 */
        L_tmp = L_msu(0, Aq[1], y[-1]);
        FOR (j = 2; j <= M; j++)
        {
#ifdef BASOP_NOGLOB
            L_tmp = L_msu_o(L_tmp, Aq[j], y[-j], &Overflow);
#else
            L_tmp = L_msu(L_tmp, Aq[j], y[-j]);
#endif
        }

#ifdef BASOP_NOGLOB
        L_tmp = L_shl_o(L_tmp, q, &Overflow);
        *y = round_fx_o(L_tmp, &Overflow);
        L_tmp2 = L_mac_o(L_tmp2, *y, *y, &Overflow);
#else
        L_tmp = L_shl(L_tmp, q);
        *y = round_fx(L_tmp);
        L_tmp2 = L_mac(L_tmp2, *y, *y);
#endif
        y++;
    }

    *Overflow_out = Overflow;
#ifdef BASOP_NOGLOB
    return round_fx_o(L_tmp2, Overflow_out); /* Q19 to Q3 */
#else
    return round_fx(L_tmp2); /* Q19 to Q3 */
#endif
}
#ifdef BASOP_NOGLOB
Word16 Enr_1_Az_fx(         /* o  : impulse response energy      Q3  */
    const Word16 Aq[],      /* i  : LP filter coefs              Qx based on the fact that Aq[0] == 1.0 */
    const Word16 len        /* i  : impulse response length      Q0  */
)
{
    Flag Overflow = 0;
    return Enr_1_Az_fx_o(Aq, len, &Overflow);
}
#endif
+2 −2
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ Word16 env_stability_fx( /* in Q15 */
            mem_norm[i] = ynrm[i];      move16();
        }
        Overflow = 0;   move16();
#ifdef BASOP_NOGLOB
#ifdef BASOP_NOGLOB  /* Critical Overflow */
        env_delta = shl_o(*mem_env_delta, 1, &Overflow);
#else
        env_delta = shl(*mem_env_delta, 1);
@@ -89,7 +89,7 @@ Word16 env_stability_fx( /* in Q15 */
        *mem_env_delta = round_fx(L_tmp);   /* Q12 */
        Overflow = 0;
        move16();
#ifdef BASOP_NOGLOB
#ifdef BASOP_NOGLOB  /* Critical Overflow */
        env_delta = round_fx_o(L_shl_o(L_tmp, 1, &Overflow), &Overflow);   /* Q13 */
#else
        env_delta = round_fx(L_shl(L_tmp, 1));   /* Q13 */
Loading