Commit edbaf72d authored by vaillancour's avatar vaillancour
Browse files

Fix some overflow with that command line : 24400 16 stv16n2.INP

parent 7dc79a0e
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -364,11 +364,16 @@ static Word32 ISqrt32_common(Word32 m,
                             Word16 e)
{
    Word16 m16, index, frac;

#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
#endif
    assert(m >= 0x40000000);

#ifdef BASOP_NOGLOB
    m16 = round_fx_o(m, &Overflow);
#else
    m16 = round_fx(m);

#endif
    /* get table index (upper 6 bits minus 32) */
    /* index = (m16 >> 25) - 32; */
    index = mac_r(-32768 - (32 << 16), m16, 1 << 6);
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ void tcq_core_LR_dec_fx(
#else /* BASOP_NOGLOB */
    if (Overflow == 1)
    {
        Overflow = 0; /* set overflow flag to zero before entering TCQ finctions without any message */
        Overflow = 0; /* set overflow flag to zero before entering TCQ functions without any message */
    }
#endif /* BASOP_NOGLOB */

+1 −1
Original line number Diff line number Diff line
@@ -470,7 +470,7 @@ static Word16 qlsf_Mode_Select_fx(
        pred_pow2[i] = shl(pred1[i], cs);
        move16();
#ifdef BASOP_NOGLOB
        En = L_mac(En, mult(pred_pow2[i], shl_o(w[i],2, &Overflow) ), pred_pow2[i]); /* 2.56*2.56 at Q-4 */
        En = L_mac_o(En, mult(pred_pow2[i], shl_o(w[i],2, &Overflow) ), pred_pow2[i], &Overflow); /* 2.56*2.56 at Q-4 */
#else /* BASOP_NOGLOB */
        En = L_mac(En, mult(pred_pow2[i], shl(w[i],2) ), pred_pow2[i]); /* 2.56*2.56 at Q-4 */
#endif /* BASOP_NOGLOB */
+7 −3
Original line number Diff line number Diff line
@@ -53,7 +53,9 @@ Word16 signal_clas_fx( /* o : classification for current frames
    Word16 i, clas, pc, zc, lo, lo2, hi, hi2, exp_ee, frac_ee;
    Word16 tmp16, tmpS;
    const Word16* pt1;

#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
#endif
    /*----------------------------------------------------------------*
     * Calculate average voicing
     * Calculate average spectral tilt
@@ -146,9 +148,11 @@ Word16 signal_clas_fx( /* o : classification for current frames
    Ltmp = L_mac(Ltmp, zcn, 10923);
    Ltmp = L_mac(Ltmp, relEn, 10923);
    Ltmp = L_mac(Ltmp, pcn, 10923);

#ifdef BASOP_NOGLOB
    fmerit1 = round_fx_o(L_shl_o(Ltmp, 16 - 10 - 1, &Overflow), &Overflow);  /* fmerit1 ->Q15 */
#else
    fmerit1 = round_fx(L_shl(Ltmp, 16 - 10 - 1));  /* fmerit1 ->Q15 */

#endif
    /*-----------------------------------------------------------------*
     * FEC classification
     *-----------------------------------------------------------------*/
+4 −0
Original line number Diff line number Diff line
@@ -644,7 +644,11 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decision flag (1-music, 0-speech
        ELSE
        {
            exp1 = norm_l(L_add(dPS[i],336));
#ifdef BASOP_NOGLOB
            tmp1 = round_fx_o(L_shl_o(L_add(dPS[i],336),exp1, &Overflow), &Overflow);
#else
            tmp1 = round_fx(L_shl(L_add(dPS[i],336),exp1));
#endif
            exp1 = sub(30,exp1);

            exp2 = norm_l(mx);