Commit 05d75723 authored by vaillancour's avatar vaillancour
Browse files

Fix more overflows with that command line : 24400 16 stv16c.INP

parent a764500d
Loading
Loading
Loading
Loading
+29 −3
Original line number Diff line number Diff line
@@ -339,7 +339,9 @@ void Copy_Scale_sig_16_32(
{
    Word16 i;
    Word16 tmp;

#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
#endif

    IF (exp0 == 0)
    {
@@ -354,7 +356,11 @@ void Copy_Scale_sig_16_32(
        /*Should not happen */
        FOR (i = 0; i < lg; i++)
        {
#ifdef BASOP_NOGLOB
            y[i] = L_deposit_l(shl_o(x[i], exp0, &Overflow));
#else
            y[i] = L_deposit_l(shl(x[i], exp0));
#endif
        }
        return;
    }
@@ -374,20 +380,30 @@ void Copy_Scale_sig_32_16(
{
    Word16 i;
    Word16 tmp;

#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
#endif
    tmp = add(16,exp0);
    IF(tmp != 0)
    {
        FOR (i = 0; i < lg; i++)
        {
#ifdef BASOP_NOGLOB
            y[i] = round_fx_o(L_shl_o(x[i], tmp, &Overflow), &Overflow);
#else
            y[i] = round_fx(L_shl(x[i], tmp));
#endif
        }
    }
    ELSE
    {
        FOR (i = 0; i < lg; i++)
        {
#ifdef BASOP_NOGLOB
            y[i] = round_fx_o(x[i], &Overflow);
#else
            y[i] = round_fx(x[i]);
#endif
        }
    }
}
@@ -404,10 +420,16 @@ void Scale_sig32(
)
{
    Word16 i;

#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
#endif
    FOR (i = 0; i < lg; i++)
    {
#ifdef BASOP_NOGLOB
        x[i] = L_shl_o(x[i], exp0, &Overflow);
#else
        x[i] = L_shl(x[i], exp0);
#endif
        move32(); /* saturation can occur here */
    }
}
@@ -470,9 +492,13 @@ void Scale_sig(
    }
    IF (exp0 < 0)
    {
#ifdef BASOP_NOGLOB
        tmp = shl_o(-32768, exp0, &Overflow); /* we use negative to correctly represent 1.0 */
#else
        BASOP_SATURATE_WARNING_OFF
        tmp = shl(-32768, exp0); /* we use negative to correctly represent 1.0 */
        BASOP_SATURATE_WARNING_ON
#endif
        FOR (i = 0; i < lg; i++)
        {
            x[i] = msu_r(0, x[i], tmp);
+2 −1
Original line number Diff line number Diff line
@@ -154,10 +154,11 @@ void find_tilt_fx(
                }
#ifdef BASOP_NOGLOB
                f1 = add_o(f1,f0, &Overflow);
                f2 = add_o(f2, f0, &Overflow);
#else /* BASOP_NOGLOB */
                f1 = add(f1,f0);
#endif /* BASOP_NOGLOB */
                f2 = add(f2, f0);
#endif /* BASOP_NOGLOB */
            }
            /*lp_E = lp_E / (float)cnt - lp_bckr;*/
            e_tmp = sub(norm_l(lp_E), 1);
+9 −1
Original line number Diff line number Diff line
@@ -1462,10 +1462,18 @@ static Word32 vq_lvq_lsf_enc(
#endif /* BASOP_NOGLOB */
            move16();
        }
#ifdef BASOP_NOGLOB
        L_tmp = L_mult(mult(diff[0], shl_o(w[0],1, &Overflow) ), diff[0]); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */
#else
        L_tmp = L_mult(mult(diff[0], shl(w[0],1) ), diff[0]); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */
#endif
        FOR (j=1; j<M; j++)
        {
#ifdef BASOP_NOGLOB
            L_tmp = L_mac(L_tmp,mult(diff[j],shl_o(w[j],1, &Overflow) ), diff[j]); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */
#else
            L_tmp = L_mac(L_tmp,mult(diff[j],shl(w[j],1) ), diff[j]); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */
#endif
        }
        e[i] = L_tmp;
        move32();
@@ -2322,7 +2330,7 @@ Word32 qlsf_ARSN_tcvq_Enc_16k_fx (
        yy_fx[i] = shl(yy_fx[i], cs);
        move16();
#ifdef BASOP_NOGLOB
        temp_l = L_mac(temp_l, mult(yy_fx[i], shl_o(w_fx[i],2, &Overflow) ), yy_fx[i]);
        temp_l = L_mac_o(temp_l, mult(yy_fx[i], shl_o(w_fx[i],2, &Overflow) ), yy_fx[i], &Overflow);
#else /* BASOP_NOGLOB */
        temp_l = L_mac(temp_l, mult(yy_fx[i], shl(w_fx[i],2) ), yy_fx[i]);
#endif /* BASOP_NOGLOB */
+4 −1
Original line number Diff line number Diff line
@@ -733,8 +733,11 @@ void pitch_ol_fx(

            enr1_exp = 0;
            move16();
#ifdef BASOP_NOGLOB
            enr1 = add_o(extract_h(dotp_fx( pt2, pt2, len[j], &enr1_exp)), 1, &Overflow);
#else
            enr1 = add(extract_h(dotp_fx( pt2, pt2, len[j], &enr1_exp)), 1);

#endif
            enr2 = L_mult(enr0[j], enr1);
            enr2_exp = norm_l(enr2);
            enr2 = L_shl(enr2, enr2_exp);
+13 −0
Original line number Diff line number Diff line
@@ -74,8 +74,13 @@ void pitch_ol2_fx(
    pt_cor_fx = cor_fx;
    FOR ( t=t_min; t<=t_max; t++ )
    {
#ifdef BASOP_NOGLOB
        t0 = L_shl_o(*pt_cor_32++, exp3, &Overflow);
        *pt_cor_fx++ = round_fx_o(t0, &Overflow);
#else
        t0 = L_shl(*pt_cor_32++, exp3);
        *pt_cor_fx++ = round_fx(t0);
#endif
    }

    pt_cor_fx = cor_fx + L_INTERPOL1;
@@ -186,7 +191,11 @@ void pitch_ol2_fx(

        R1 = Isqrt_lc(R1, &exp_R1);

#ifdef BASOP_NOGLOB
        R1 = L_mult(R0, round_fx_o(R1, &Overflow));
#else
        R1 = L_mult(R0, round_fx(R1));
#endif
        exp_R0 = sub(31, exp_R0);
        exp_R0 = sub(add(exp_R0, exp_R1),exp3);

@@ -314,7 +323,11 @@ void StableHighPitchDetect_fx(
    }
    ELSE
    {
#ifdef BASOP_NOGLOB
        diff16 = round_fx_o(L_shl_o(diff , 25, &Overflow), &Overflow);
#else
        diff16 = round_fx(L_shl(diff , 25));
#endif
    }
    test();
    test();
Loading