Commit 847d2581 authored by vaillancour's avatar vaillancour
Browse files

Fixes for lastest non be condition in WB

parent 1f9a081a
Loading
Loading
Loading
Loading
+16 −15
Original line number Diff line number Diff line
@@ -65,9 +65,6 @@ void CNG_exc_fx(
    Word16 exp_pow;
    Word32 L_tmp2;
    Word16 *pt_fft_io;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif

    /*------------------------------------------------------------------*
     * Initializations
@@ -237,7 +234,7 @@ void CNG_exc_fx(
            /* exc2[i] *= enr */
            L_tmp = L_mult(exc2[i_subfr+i], tmp); /* Q-4 * Q_exc+19 -> Q_exc +16 */
#ifdef BASOP_NOGLOB
            exc2[i_subfr+i] = round_fx_o(L_shl_o(L_tmp, exp, &Overflow), &Overflow);
            exc2[i_subfr+i] = round_fx_sat(L_shl_sat(L_tmp, exp));
#else
            exc2[i_subfr+i] = round_fx(L_shl(L_tmp, exp));
#endif
@@ -319,7 +316,7 @@ void CNG_exc_fx(
            /* env[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */
            L_tmp = L_mult0(*ptR,*ptR);/* 2*Q_exc */
#ifdef BASOP_NOGLOB
            L_tmp = L_mac0_o(L_tmp,*ptI,*ptI, &Overflow);/* 2*Q_exc */
            L_tmp = L_mac0_sat(L_tmp,*ptI,*ptI);/* 2*Q_exc */
#else
            L_tmp = L_mac0(L_tmp,*ptI,*ptI);/* 2*Q_exc */
#endif
@@ -408,16 +405,16 @@ void CNG_exc_fx(

            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_sat(L_tmp2,add(exp,Q_exc))); /*Q_exc*/
#else 
            *ptR = extract_h(L_shl(L_tmp2,add(exp,Q_exc))); /*Q_exc*/
#endif /* BASOP_NOGLOB */
#endif
            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_sat(L_tmp2,add(exp,Q_exc))); /*Q_exc*/
#else 
            *ptI = extract_h(L_shl(L_tmp2,add(exp,Q_exc))); /*Q_exc*/
#endif /* BASOP_NOGLOB */
#endif

            ptR++;
            ptI--;
@@ -496,10 +493,10 @@ void CNG_exc_fx(
            IF( NE_32(last_core_brate,SID_2k40)&&NE_32(last_core_brate,SID_1k75)&&NE_32(last_core_brate,FRAME_NO_DATA)&&EQ_32(core_brate,SID_2k40))
            {
#ifdef BASOP_NOGLOB
                IF ( GT_32(L_tmp,L_shl_o(1,sub(31,exp), &Overflow)))
#else /* BASOP_NOGLOB */
                IF ( GT_32(L_tmp,L_shl_sat(1,sub(31,exp))))
#else 
                IF ( GT_32(L_tmp,L_shl(1,sub(31,exp))))
#endif /* BASOP_NOGLOB */
#endif
                {
                    L_tmp = L_shl(1,sub(31,exp));
                }
@@ -518,7 +515,11 @@ void CNG_exc_fx(
        {
            /* fft_io[i] = 0.75f*fft_io[i] + exc2[i];*/
            tmp = mult(fft_io[i],24576);
#ifdef BASOP_NOGLOB
            fft_io[i] = add_sat(tmp,exc2[i]);
#else
            fft_io[i] = add(tmp,exc2[i]);
#endif
            move16();/*Q_exc*/
        }

@@ -576,7 +577,7 @@ void CNG_exc_fx(
        L_tmp = Isqrt_lc(L_tmp, &exp); /*Q(31-exp)*/

#ifdef BASOP_NOGLOB
        ftmp = extract_h(L_shl_o(L_tmp,exp, &Overflow));/* Q15 */
        ftmp = extract_h(L_shl_sat(L_tmp,exp));/* Q15 */
#else /* BASOP_NOGLOB */
        ftmp = extract_h(L_shl(L_tmp,exp));/* Q15 */
#endif /* BASOP_NOGLOB */
+4 −0
Original line number Diff line number Diff line
@@ -210,7 +210,11 @@ Word16 WB_BWE_gain_pred_fx(
            exp = norm_s(WB_fenv[0]);
            tmp = div_s(shl(1,sub(14,exp)), WB_fenv[0]); /*Q(29-exp-3) */
            L_tmp = L_mult(enerL_40, tmp); /*Q(30-exp) */
#ifdef BASOP_NOGLOB
            tmp = round_fx_sat(L_shl_sat(L_tmp, sub(exp,2))); /*Q12 */
#else
            tmp = round_fx(L_shl(L_tmp, sub(exp,2))); /*Q12 */
#endif
            tmp = s_min(tmp, 16384);
            L_tmp = L_shr( L_mult0(tmp, WB_fenv[0]), 12);/*Q15 */
            WB_fenv[0] = extract_l(L_tmp);/*Q3 */
+6 −1
Original line number Diff line number Diff line
@@ -196,10 +196,11 @@ void E_UTIL_synthesis(const Word16 shift, const Word16 a[], const Word16 x[], Wo
    L_tmp = syn_kern(L_mult(a0, *x++), a, mem);
#ifdef BASOP_NOGLOB
    L_tmp = L_shl_o(L_tmp, q, &Overflow);
    *y++ = round_fx_o(L_tmp, &Overflow);
#else
    L_tmp = L_shl(L_tmp, q);
#endif
    *y++ = round_fx(L_tmp);
#endif

    /* Filtering from Input + Mix of Memory & Output Signal Past */
    FOR (i = 1; i < m; i++)
@@ -208,7 +209,11 @@ void E_UTIL_synthesis(const Word16 shift, const Word16 a[], const Word16 x[], Wo
        /* Process Output Signal Past */
        FOR (j = 1; j <= i; j++)
        {
#ifdef BASOP_NOGLOB
            L_tmp = L_msu_o(L_tmp, a[j], y[-j], &Overflow);
#else
            L_tmp = L_msu(L_tmp, a[j], y[-j]);
#endif
        }
        /* Process Memory */
        FOR (; j <= m; j++)
+22 −19
Original line number Diff line number Diff line
@@ -108,11 +108,6 @@ void bass_psfilter_fx(
    Word16 Q_syn2x;
    Word16 subfr_len;
    Word16 nbpsf_pit_max;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif



    Track_on = 0;
    move16();
@@ -343,13 +338,13 @@ void bass_psfilter_fx(
            Ltmp = L_abs(Lcorr);
            exp = norm_l(Ltmp);
#ifdef BASOP_NOGLOB
            tmp = round_fx_o(L_shl_o(Ltmp, exp, &Overflow), &Overflow);
            tmp = round_fx_sat(L_shl_sat(Ltmp, exp));
#else
            tmp = round_fx(L_shl(Ltmp, exp));
#endif
            exp2 = norm_l(Lener);
#ifdef BASOP_NOGLOB
            tmp2 = round_fx_o(L_shl(Lener, exp2), &Overflow);
            tmp2 = round_fx_sat(L_shl(Lener, exp2));
#else
            tmp2 = round_fx(L_shl(Lener, exp2));
#endif
@@ -389,13 +384,13 @@ void bass_psfilter_fx(
            tmp2 = add(tmp2, Q_syn2x);
            tmp2 = s_max(0, s_min(30, tmp2));
#ifdef BASOP_NOGLOB
            Lener = L_add_o(Lener, Pow2(tmp2, exp2), &Overflow);
            Lener = L_add_sat(Lener, Pow2(tmp2, exp2));
#else
            Lener = L_add(Lener, Pow2(tmp2, exp2));
#endif
            exp2 = norm_l(Lener);
#ifdef BASOP_NOGLOB
            tmp2 = round_fx_o(L_shl(Lener, exp2), &Overflow);
            tmp2 = round_fx_sat(L_shl(Lener, exp2));
#else
            tmp2 = round_fx(L_shl(Lener, exp2));
#endif
@@ -406,7 +401,7 @@ void bass_psfilter_fx(
            exp2 = sub(exp, exp2); /* exponent num - exponent denom */
            /* alpha = corr / ener */
#ifdef BASOP_NOGLOB
            alpha = shr_o(div_s(round_fx(L_shl(Ltmp, exp)), tmp2), exp2, &Overflow); /*Q15 */
            alpha = shr_sat(div_s(round_fx(L_shl(Ltmp, exp)), tmp2), exp2); /*Q15 */
#else
            alpha = shr(div_s(round_fx(L_shl(Ltmp, exp)), tmp2), exp2); /*Q15 */
#endif
@@ -457,7 +452,7 @@ void bass_psfilter_fx(
                /*syn2_fx[i] = alpha*(syn_fx[i]-syn2_fx[i]); */
                tmp = sub(syn_fx[i],syn2_fx[i]);
#ifdef BASOP_NOGLOB
                syn2_fx[i] = mult_o(alpha, shl_o(tmp, 1, &Overflow), &Overflow);
                syn2_fx[i] = mult_sat(alpha, shl_sat(tmp, 1));
#else
                syn2_fx[i] = mult(alpha,shl(tmp,1));
#endif
@@ -474,7 +469,7 @@ void bass_psfilter_fx(
            FOR (i=0; i< subfr_len; i++)
            {
#ifdef BASOP_NOGLOB
                Lener = L_mac0_o(Lener, err[i], err[i], &Overflow);
                Lener = L_mac0_sat(Lener, err[i], err[i]);
#else
                Lener = L_mac0(Lener, err[i], err[i]);
#endif
@@ -490,7 +485,7 @@ void bass_psfilter_fx(
                {
                    Lener0 = L_mult0(sigPtr[i], sigPtr[i]);
#ifdef BASOP_NOGLOB
                    Lener = L_add(Lener, L_shr(L_mac0_o(Lener0, err[i], err[i], &Overflow), 5));
                    Lener = L_add(Lener, L_shr(L_mac0_sat(Lener0, err[i], err[i]), 5));
#else
                    Lener = L_add(Lener, L_shr(L_mac0(Lener0, err[i], err[i]), 5));
#endif
@@ -548,11 +543,19 @@ void bass_psfilter_fx(
            {
                Lcorr0 = L_mult0( syn_fx[j], syn2_fx[j]);
                Lener0 = L_mult0(syn2_fx[j], syn2_fx[j]);
#ifdef BASOP_NOGLOB
                Lcorr0 = L_mac0_sat(Lcorr0,  sigPtr[j], sigPtr1[j]);
                Lener0 = L_mac0_sat(Lener0, sigPtr1[j], sigPtr1[j]);

                Lcorr = L_add_sat(Lcorr, L_shr(Lcorr0, 4));
                Lener = L_add_sat(Lener, L_shr(Lener0, 4));
#else
                Lcorr0 = L_mac0(Lcorr0,  sigPtr[j], sigPtr1[j]);
                Lener0 = L_mac0(Lener0, sigPtr1[j], sigPtr1[j]);

                Lcorr = L_add(Lcorr, L_shr(Lcorr0, 4));
                Lener = L_add(Lener, L_shr(Lener0, 4));
#endif
                /* this loop is not efficient but it provide a
                respectable precision while avoiding overflow. */
            }
@@ -565,9 +568,9 @@ void bass_psfilter_fx(
            Ltmp = L_abs(Lcorr);
            exp = norm_l(Ltmp);
#ifdef BASOP_NOGLOB
            tmp = round_fx_o(L_shl_o(Ltmp, exp, &Overflow), &Overflow);
            tmp = round_fx_sat(L_shl_sat(Ltmp, exp));
            exp2 = norm_l(Lener);
            tmp2 = round_fx_o(L_shl_o(Lener, exp2, &Overflow), &Overflow);
            tmp2 = round_fx_sat(L_shl_sat(Lener, exp2));
#else
            tmp = round_fx(L_shl(Ltmp, exp));
            exp2 = norm_l(Lener);
@@ -609,13 +612,13 @@ void bass_psfilter_fx(
            tmp2 = add(tmp2, Q_syn2x);
            tmp2 = s_max(0, s_min(30, tmp2));
#ifdef BASOP_NOGLOB
            Lener = L_add_o(Lener, Pow2(tmp2, exp2), &Overflow);
            Lener = L_add_sat(Lener, Pow2(tmp2, exp2));
#else
            Lener = L_add(Lener, Pow2(tmp2, exp2));
#endif
            exp2 = norm_l(Lener);
#ifdef BASOP_NOGLOB
            tmp2 = round_fx_o(L_shl(Lener, exp2), &Overflow);
            tmp2 = round_fx_sat(L_shl(Lener, exp2));
#else
            tmp2 = round_fx(L_shl(Lener, exp2));
#endif
@@ -651,7 +654,7 @@ void bass_psfilter_fx(
            FOR (i=0; i<subfr_len; i++)
            {
#ifdef BASOP_NOGLOB
                Lener = L_mac0_o(Lener, err[i], err[i], &Overflow);
                Lener = L_mac0_sat(Lener, err[i], err[i]);
#else
                Lener = L_mac0(Lener, err[i], err[i]);
#endif
@@ -667,7 +670,7 @@ void bass_psfilter_fx(
                {
                    Lener0 = L_mult0(sigPtr[i], sigPtr[i]);
#ifdef BASOP_NOGLOB
                    Lener = L_add_o(Lener, L_shr(L_mac0_o(Lener0, err[i], err[i], &Overflow), 5), &Overflow);
                    Lener = L_add_sat(Lener, L_shr(L_mac0_sat(Lener0, err[i], err[i]), 5));
#else
                    Lener = L_add(Lener, L_shr(L_mac0(Lener0, err[i], err[i]), 5));
#endif
+4 −0
Original line number Diff line number Diff line
@@ -257,7 +257,11 @@ Word16 getLevelSynDeemph( /*10Q5*/
    move16();
    *Exp = sub(10,s16); /*Set exponent in order to transform returnvalue to Q15*/

#ifdef BASOP_NOGLOB
    return round_fx_sat(levelSynDeemph); /*Q15*/
#else
    return round_fx(levelSynDeemph); /*Q15*/
#endif
}

/* BASOP version: up to date with rev 7422 */
Loading