Commit 2fa81b87 authored by vaillancour's avatar vaillancour
Browse files

Add comment -> Critical Overflow, to easy the location of the overflow that...

Add comment -> Critical Overflow, to easy the location of the overflow that really need to be taken care of (where saturation would not be a good idea)
parent 027bb68b
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -843,7 +843,7 @@ Word16 E_LPC_f_lsp_pol_get(const Word16 lsp[], Word32 f[], const Word16 n, cons
    Overflow = 0;
    move16();
    plsp = lsp;
#ifdef BASOP_NOGLOB
#ifdef BASOP_NOGLOB   /* Critical Overflow and all those below*/
    f[0] = L_shl_o(1, sub(31, Q_out), &Overflow);
#else
    f[0] = L_shl(1, sub(31, Q_out));
@@ -854,10 +854,11 @@ Word16 E_LPC_f_lsp_pol_get(const Word16 lsp[], Word32 f[], const Word16 n, cons
    move16();
#ifdef BASOP_NOGLOB
    m2 = shl_o(-2, sub(15, Q_out), &Overflow);
    f[1] = L_mult_o(b, m2, &Overflow);
#else
    m2 = shl(-2, sub(15, Q_out));
#endif
    f[1] = L_mult(b, m2);
#endif
    move32();

    FOR (i = 2; i <= n; i++)
@@ -866,8 +867,11 @@ Word16 E_LPC_f_lsp_pol_get(const Word16 lsp[], Word32 f[], const Word16 n, cons
        /*b = 2.0f * *plsp;*/
        move16();
        b = *plsp;
#ifdef BASOP_NOGLOB
        b32 = L_mult_o(b, m2, &Overflow);
#else
        b32 = L_mult(b, m2);

#endif
        /*f[i] = -b*f[i-1] + 2.0f*f[i-2];*/
        move32();
#ifdef BASOP_NOGLOB
+1 −1
Original line number Diff line number Diff line
@@ -546,7 +546,7 @@ Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 */
    /* Divide Frame Length by 32 */
    FOR (j = shr(N, 5); j > 0; j--)
    {
#ifdef BASOP_NOGLOB
#ifdef BASOP_NOGLOB            /* Critical Overflow and all those below*/
        tmp1 = mult_ro(*ptr++, 8192, &Overflow); /* Divide by 4 */
#else
        tmp1 = mult_r(*ptr++, 8192); /* Divide by 4 */
+2 −2
Original line number Diff line number Diff line
@@ -2196,7 +2196,7 @@ Word32 Calc_Energy_Autoscaled(/* o: Result (Energy) */
    FOR (i = 0; i < j; i++)
    {
        /* divide by 2 so energy will be divided by 4 */
#ifdef BASOP_NOGLOB
#ifdef BASOP_NOGLOB     /* Critical Overflow and all those below*/
        temp = mult_ro(*signal++, 16384, &Overflow);
        L_Energy = L_mac0_o(L_Energy, temp, temp, &Overflow);
#else
@@ -2815,7 +2815,7 @@ Word16 dot_prod_satcontr(const Word16 *x, const Word16 *y, Word16 qx, Word16 qy,
    {
        Overflow = 0;
        move16();
#ifdef BASOP_NOGLOB
#ifdef BASOP_NOGLOB              /* Critical Overflow and all those below*/
        L_tmp = L_shl_o(1, s_max(sub(add(add(qx, qy), 7), shift), 0), &Overflow);
#else /* BASOP_NOGLOB */
        L_tmp = L_shl(1, s_max(sub(add(add(qx, qy), 7), shift), 0));
+2 −2
Original line number Diff line number Diff line
@@ -558,7 +558,7 @@ static Word16 dotprod_satcont(const Word16 *x, const Word16 *y, Word16 qx, Word1
        move16();
        FOR ( i = 0; i < len; i += delta )
        {                   
#ifdef BASOP_NOGLOB
#ifdef BASOP_NOGLOB     /* Critical Overflow*/
            L_tmp = L_mac0_o(L_tmp, tmp_tabx[i], tmp_taby[i], &Overflow); /*Q(qx+qy-shift) */
#else /* BASOP_NOGLOB */
            L_tmp = L_mac0(L_tmp, tmp_tabx[i], tmp_taby[i]); /*Q(qx+qy-shift) */
+6 −2
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ void HBAutocorrelation(
    FOR (i = 0; i < len; i+=1)
    {
        /* Test Addition */
#ifdef BASOP_NOGLOB
#ifdef BASOP_NOGLOB      /* Critical Overflow, all operations below needs to check for Overflow if we want to ensure bit exactness */
        L_mac0_o(L_sum, y[i], y[i], &Overflow);
#else /* BASOP_NOGLOB */
        L_mac0(L_sum, y[i], y[i]);
@@ -68,7 +68,7 @@ void HBAutocorrelation(
            move16();
            L_tmp = L_msu0( 0, y[i], y[i] );
            L_tmp = L_shr( L_tmp, 1 );
#ifdef BASOP_NOGLOB  /* Only the sub can overflow is the current L_sum is negative and already close to MIN */
#ifdef BASOP_NOGLOB  /* Only the sub can overflow if the current L_sum is negative and already close to MIN */
            L_sum = L_add( L_shr( L_sub_o( L_sum, 1, &Overflow ), 1 ), 1 );
#else
            L_sum = L_add( L_shr( L_sub( L_sum, 1 ), 1 ), 1 );
@@ -110,7 +110,11 @@ void HBAutocorrelation(
            BREAK;
        }
        /* Perform Addition */
#ifdef BASOP_NOGLOB      /* Critical Overflow */
        L_sum = L_mac0_o( L_sum, y[i], y[i], &Overflow );
#else
        L_sum = L_mac0( L_sum, y[i], y[i] );
#endif
    }

    /* scale signal to avoid overflow in autocorrelation */
Loading