Commit d4181fcd authored by sagnowski's avatar sagnowski
Browse files

Replace overflowing basops, pt 5

parent cfd033c9
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -194,6 +194,9 @@ void tcx_arith_scale_envelope(
    Word16 statesi, bits;
    Word32 mean, a, s, L_tmp;
    Word16 mean_e, tmp, tmp2;
#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
#endif /* BASOP_NOGLOB */



@@ -401,7 +404,11 @@ void tcx_arith_scale_envelope(
    *s_env_e = sub(add(15, iscale_e), tmp);
    move16();
    BASOP_SATURATE_WARNING_OFF;
#ifdef BASOP_NOGLOB
    a = L_shl_o(1265000, sub(15, *s_env_e), &Overflow);
#else /* BASOP_NOGLOB */
    a = L_shl(1265000, sub(15, *s_env_e));
#endif /* BASOP_NOGLOB */
    BASOP_SATURATE_WARNING_ON;

    FOR (k = 0; k < L_frame; k++)
+6 −0
Original line number Diff line number Diff line
@@ -1365,13 +1365,19 @@ Word32 norm_llQ31( /* o : normalized result Q31 */
    Word32 L_tmp;

#ifdef BASOP_NOGLOB
    Flag Overflow;
    Flag Carry;
#endif /* BASOP_NOGLOB */

    /* Move MSBit of L_sum into L_c */
    Carry = 0;
#ifdef BASOP_NOGLOB
    L_tmp = L_add_co(L_sum, L_sum, &Carry, &Overflow);    /* L_tmp = L_sum << 1         */
    L_c = L_add_co(L_c,L_c, &Carry, &Overflow);
#else /* BASOP_NOGLOB */
    L_tmp = L_add_c(L_sum, L_sum);    /* L_tmp = L_sum << 1         */
    L_c = L_add_c(L_c,L_c);
#endif /* BASOP_NOGLOB */
    L_add(0,0);
    test();
    IF ((L_c != (Word32) 0L) && (L_c != (Word32) 0xFFFFFFFFL))
+15 −0
Original line number Diff line number Diff line
@@ -399,9 +399,17 @@ void CNG_exc_fx(
            L_tmp = Isqrt_lc(L_tmp, &exp); /*Q(31-exp)*/

            L_tmp2 = Mult_32_16(L_tmp,*ptR);/*Q(16-exp)*/
#ifdef BASOP_NOGLOB
            *ptR = extract_h(L_shl_o(L_tmp2,add(exp,Q_exc), &Overflow)); /*Q_exc*/
#else /* BASOP_NOGLOB */
            *ptR = extract_h(L_shl(L_tmp2,add(exp,Q_exc))); /*Q_exc*/
#endif /* BASOP_NOGLOB */
            L_tmp2 = Mult_32_16(L_tmp,*ptI);/*Q(16-exp)*/
#ifdef BASOP_NOGLOB
            *ptI = extract_h(L_shl_o(L_tmp2,add(exp,Q_exc), &Overflow)); /*Q_exc*/
#else /* BASOP_NOGLOB */
            *ptI = extract_h(L_shl(L_tmp2,add(exp,Q_exc))); /*Q_exc*/
#endif /* BASOP_NOGLOB */

            ptR++;
            ptI--;
@@ -762,6 +770,9 @@ void cng_params_upd_fx(
    Word16 tmp;
    Word16 temp_lo_fx, temp_hi_fx;
    Word16 exp_pow;
#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
#endif /* BASOP_NOGLOB */


    /* update the pointer to circular buffer of old LSP vectors */
@@ -816,7 +827,11 @@ void cng_params_upd_fx(
            L_ener = L_add(L_ener, L_shr( Mult_32_16(L_tmp,26214 /* 256/320, Q15 */), 7)); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */
        }
    }
#ifdef BASOP_NOGLOB
    L_ener = L_shr_o(L_ener, sub(shl(add(Q_exc,scale),1),5), &Overflow); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */
#else /* BASOP_NOGLOB */
    L_ener = L_shr(L_ener, sub(shl(add(Q_exc,scale),1),5)); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */
#endif /* BASOP_NOGLOB */

    /* update the circular buffer of old energies */
    ho_ener_circ[*ho_circ_ptr] = L_ener;
+8 −0
Original line number Diff line number Diff line
@@ -35,6 +35,9 @@ void deemph_fx(
{
    Word16 i;
    Word32 L_tmp;
#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
#endif /* BASOP_NOGLOB */

    L_tmp = L_deposit_h(signal[0]);
    L_tmp = L_mac(L_tmp, *mem, mu);
@@ -43,8 +46,13 @@ void deemph_fx(
    FOR (i = 1; i < L; i++)
    {
        L_tmp = L_deposit_h(signal[i]);
#ifdef BASOP_NOGLOB
        L_tmp = L_mac_o(L_tmp, signal[i - 1], mu, &Overflow);
        signal[i] = round_fx_o(L_tmp, &Overflow);
#else /* BASOP_NOGLOB */
        L_tmp = L_mac(L_tmp, signal[i - 1], mu);
        signal[i] = round_fx(L_tmp);
#endif /* BASOP_NOGLOB */
    }

    *mem = signal[L - 1];
+11 −0
Original line number Diff line number Diff line
@@ -254,6 +254,9 @@ void edct_16fx(
#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING
    MY_UNUSED_Word(element_mode)
#endif
#ifdef BASOP_NOGLOB
    Flag Overflow = 0;
#endif /* BASOP_NOGLOB */
    /*COMPLETE: some eDCT sub function are missing */

    IF (EQ_16(length,L_FRAME32k))
@@ -357,11 +360,19 @@ void edct_16fx(

        L_tmp = L_mult(re[i],edct_table[i]);/*Q(Qx+Q_edct+16) */
        Lacc = L_mac(L_tmp,im[i],*pt);/*Q(Qx+Q_edct+16) */
#ifdef BASOP_NOGLOB
        y[i2] = round_fx_o(L_shr_o(Lacc,Q_edct, &Overflow), &Overflow); /* Q(Qx) */
#else /* BASOP_NOGLOB */
        y[i2] = round_fx(L_shr(Lacc,Q_edct)); /* Q(Qx) */
#endif /* BASOP_NOGLOB */

        L_tmp = L_mult(re[i],edct_table[length/2-1-i]);/*Q(Qx+Q_edct+16) */
        Lacc = L_msu(L_tmp,im[i],edct_table[i]);/*Q(Qx+Q_edct+16) */
#ifdef BASOP_NOGLOB
        *py = round_fx_o(L_shr_o(Lacc,Q_edct, &Overflow), &Overflow); /* Q(Qx) */
#else /* BASOP_NOGLOB */
        *py = round_fx(L_shr(Lacc,Q_edct)); /* Q(Qx) */
#endif /* BASOP_NOGLOB */

        py -= 2;
        pt--;
Loading