Commit b8f8d05b authored by norvell's avatar norvell
Browse files

Fix a few overflows

parent 081bf758
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -371,7 +371,11 @@ void hq2_noise_inject_fx(
                        ELSE IF(count[sub(k,1)] == 0 && tmp4 > 0)
                        {
                            L_tmp = L_mult(env_fx2[sub(k,1)],tmp); /* Q(1+Q_speech+1 = Q_speech+2) */
#ifdef BASOP_NOGLOB
                            fac_fx = extract_h(L_shl_o(L_tmp, sub(26, Q_speech), &Overflow));/*Q12 */
#else
                            fac_fx = extract_h(L_shl(L_tmp,sub(26,Q_speech)));/*Q12 */
#endif
                        }
                    }

+4 −0
Original line number Diff line number Diff line
@@ -432,7 +432,11 @@ void window_ola_fx(
            temp_len = sub(shr(L,1), n);
            FOR (i = 0; i < temp_len; i++)
            {
#ifdef BASOP_NOGLOB
                *p1++ = round_fx_o(L_add_o(L_shl(Mult_32_16(*pa++, *p3), 1), L_deposit_h(*p4++), &Overflow), &Overflow);  /* (( Qin + Q15 -15)+1  + ( Qin - 15 + 16))-1 */
#else
                *p1++=round_fx(L_add(L_shl(Mult_32_16(*pa++,*p3),1),L_deposit_h(*p4++)));  /* (( Qin + Q15 -15)+1  + ( Qin - 15 + 16))-1 */
#endif
                p3-=decimate;
                /*paout[i] = ImdctOut[L/2 + i] * win_right[(2*L-i)*decimate-1-decay-windecay48]+OldauOut[i];*/
            }
+8 −0
Original line number Diff line number Diff line
@@ -704,6 +704,10 @@ static Word16 find_best_delay_fx(
    Word32 min_sq_cross_fx, min_corr_fx;
    Word32 accA_fx, accB_fx;
    Word32 Rxy_fx[MAXDELAY_FEC], Ryy_fx[MAXDELAY_FEC];
#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
#endif


    d1 = mind1;
    move16();
@@ -767,7 +771,11 @@ static Word16 find_best_delay_fx(
        L_tmp1 = L_shl(min_sq_cross_fx, exp1);
        L_tmp2 = L_shl(min_corr_fx, exp2);
        tmp = div_s(extract_h(L_tmp1), extract_h(L_tmp2));/*15 + exp1 - exp2 */
#ifdef BASOP_NOGLOB
        tmp = shl_o(tmp, sub(exp2, add(exp1, 1)), &Overflow);/*14 */
#else
        tmp = shl(tmp, sub(exp2, add(exp1, 1)));/*14 */
#endif
    }

    *false_flag = 0;
+8 −0
Original line number Diff line number Diff line
@@ -613,6 +613,10 @@ static void decod_gen_voic_core_switch_fx(
    Word16 *pt1;
    GSC_DEC_HANDLE hGSCDec;
    hGSCDec = st_fx->hGSCDec;
#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
#endif



    /*----------------------------------------------------------------------*
@@ -697,7 +701,11 @@ static void decod_gen_voic_core_switch_fx(
    IF( st_fx->prev_bfi_fx )
    {
        /*gain_code = min(gain_code, 0.5f*gain_code+0.5f*st->lp_gainc);*/
#ifdef BASOP_NOGLOB
        gain_code16 = s_min(gain_code16, mac_r(L_mult(16384, gain_code16), shl_o(16384 >> 3, st_fx->Q_exc, &Overflow), st_fx->lp_gainc_fx)); /* st_fx->lp_gainc_fx in Q3 >>3 to bring it to Q0 as gain_code16 */
#else
        gain_code16 = s_min(gain_code16, mac_r(L_mult(16384,gain_code16),shl(16384>>3, st_fx->Q_exc), st_fx->lp_gainc_fx)); /* st_fx->lp_gainc_fx in Q3 >>3 to bring it to Q0 as gain_code16 */
#endif
    }

    FOR (i = 0; i < L_SUBFR; i++)
+9 −0
Original line number Diff line number Diff line
@@ -26,6 +26,11 @@ static Word16 tcx_arith_decode(
    Word16 exp_k;
    Word16 tmp;
    Word32 L_tmp, Q;
#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
    Flag Carry = 0;
#endif


    bp = ari_start_decoding_14bits_prm(prm, 0, &as);

@@ -53,7 +58,11 @@ static Word16 tcx_arith_decode(
        {
            bp = ari_decode_14bits_sign(prm, bp, target_bits, &s, &as);

#ifdef BASOP_NOGLOB
            L_tmp = L_macNs_co(L_tmp, q, k, &Carry, &Overflow);
#else
            L_tmp = L_macNs(L_tmp, q, k);
#endif

            Q = L_mult(q, -(1<<(30 - SPEC_EXP_DEC)));
            if (s == 0) Q = L_mult(q, 1 << (30 - SPEC_EXP_DEC));
Loading