Commit 07cad1dd authored by vaillancour's avatar vaillancour
Browse files

Correction on compl saturations for 26.444

parent a17e842a
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -546,9 +546,15 @@ void CNG_exc_fx(
            {
                L_tmp = L_mult0(*pt_fft_io, *pt_fft_io);
                pt_fft_io++;
#ifdef BASOP_NOGLOB
                L_tmp = L_mac0_sat( L_tmp, *pt_fft_io, *pt_fft_io ); /* 2*(Q_exc) */
                pt_fft_io++;
                L_tmp2 = L_add_sat(L_tmp2, L_shr(L_tmp, 7)); /* 2*(Q_exc)+1, divide by L_frame done here */
#else
                L_tmp = L_mac0( L_tmp, *pt_fft_io, *pt_fft_io ); /* 2*(Q_exc) */
                pt_fft_io++;
                L_tmp2 = L_add(L_tmp2, L_shr(L_tmp, 7)); /* 2*(Q_exc)+1, divide by L_frame done here */
#endif
            }
        }
        ELSE /* L_FRAME16k */
+5 −1
Original line number Diff line number Diff line
@@ -277,7 +277,11 @@ void enhancer_fx(
                FOR (i = 0; i < L_SUBFR; i++)
                {
                    /* excp[i] += pt_exc2[i] */
#ifdef BASOP_NOGLOB
                    excp[i] = add_sat( excp[i], pt_exc2[i] );
#else
                    excp[i] = add( excp[i], pt_exc2[i] );
#endif
                    move16();
                }
                agc2_fx(pt_exc2, excp, L_SUBFR);
+31 −27
Original line number Diff line number Diff line
@@ -245,7 +245,11 @@ if (EQ_16(s_and(exp, 1), 1))
    }
    exp = shr(exp, 1);

#ifdef BASOP_NOGLOB                                     /* Critical Overflow */
    env_delta = round_fx_sat( L_shl_sat( L_tmp, sub( 26, exp ) ) ); /* Q10 */
#else
    env_delta = round_fx( L_shl( L_tmp, sub( 26, exp ) ) ); /* Q10 */
#endif

    L_tmp = L_mult0(26214, env_delta); /* 26214 is 0.1 in Q18. Q28 */
    L_tmp = L_mac(L_tmp, 29491, *mem_env_delta);   /* 29491 is 0.9 in Q15. Q28 */
+49 −11
Original line number Diff line number Diff line
@@ -416,6 +416,26 @@ void r_fft_fx_lc(
        FOR (i = 2; i <= SIZE2; i += 2)
        {
            Ltmp1_imag = L_mult(temp[i+1], 16384);
#ifdef BASOP_NOGLOB
            Ltmp1_imag = L_msu_sat( Ltmp1_imag, *ptrDn, 16384 );
            tmp2_real = add_sat( temp[i + 1], *ptrDn-- );

            Ltmp1_real = L_mult(temp[i], 16384);
            Ltmp1_real = L_mac_sat( Ltmp1_real, *ptrDn, 16384 );
            tmp2_imag = sub(*ptrDn--, temp[i]);


            *ptRealUp++ = msu_r_sat( L_mac_sat( Ltmp1_real, tmp2_real, phs_tbl[i] ), tmp2_imag, phs_tbl[i + 1] );
            move16();
            *ptImaDn-- = mac_r_sat( L_mac_sat( Ltmp1_imag, tmp2_imag, phs_tbl[i] ), tmp2_real, phs_tbl[i + 1] );
            move16();
            Ltmp1 = L_mac_sat( L_negate( Ltmp1_imag ), tmp2_real, *phstbl_ptrDn );
            Ltmp1_real = L_mac_sat( Ltmp1_real, tmp2_imag, *phstbl_ptrDn-- );
            *ptImaUp++ = msu_r_sat( Ltmp1, tmp2_imag, *phstbl_ptrDn );
            move16();
            *ptRealDn-- = mac_r_sat( Ltmp1_real, tmp2_real, *phstbl_ptrDn-- );
            move16();
#else
            Ltmp1_imag = L_msu( Ltmp1_imag, *ptrDn, 16384 );
            tmp2_real = add( temp[i + 1], *ptrDn-- );

@@ -434,6 +454,7 @@ void r_fft_fx_lc(
            move16();
            *ptRealDn-- = mac_r(Ltmp1_real, tmp2_real, *phstbl_ptrDn--);
            move16();
#endif
        }
    }
    ELSE /* The ifFT part */
@@ -461,14 +482,30 @@ void r_fft_fx_lc(
        /* Now, handle the remaining positive frequencies */
        FOR (i = 2; i <= SIZE2; i += 2)
        {
#ifdef BASOP_NOGLOB
            Ltmp1_imag = L_mult( *ptImaDn, 16384 );
            Ltmp1_imag = L_msu_sat( Ltmp1_imag, *ptImaUp, 16384 );
            tmp2_real = add_sat( *ptImaDn--, *ptImaUp++ );
            Ltmp1_real = L_mult( *ptRealUp, 16384 );
            Ltmp1_real = L_mac_sat( Ltmp1_real, *ptRealDn, 16384 );
            tmp2_imag = sub_sat( *ptRealUp++, *ptRealDn-- );
            temp[i] = mac_r_sat( L_msu_sat( Ltmp1_real, tmp2_real, phs_tbl[i] ), tmp2_imag, phs_tbl[i + 1] );
            move16();
            temp[i + 1] = mac_r_sat( L_mac_sat( Ltmp1_imag, tmp2_imag, phs_tbl[i] ), tmp2_real, phs_tbl[i + 1] );
            move16();
            Ltmp1 = L_mac_sat( L_negate( Ltmp1_imag ), tmp2_real, *phstbl_ptrDn );
            Ltmp1_real = L_msu_sat( Ltmp1_real, tmp2_imag, *phstbl_ptrDn-- );
            *ptrDn-- = msu_r_sat( Ltmp1, tmp2_imag, *phstbl_ptrDn );
            move16();
            *ptrDn-- = msu_r_sat( Ltmp1_real, tmp2_real, *phstbl_ptrDn-- );
            move16();
#else
            Ltmp1_imag = L_mult( *ptImaDn, 16384 );
            Ltmp1_imag = L_msu( Ltmp1_imag, *ptImaUp, 16384 );
            tmp2_real = add( *ptImaDn--, *ptImaUp++ );
            Ltmp1_real = L_mult( *ptRealUp, 16384 );
            Ltmp1_real = L_mac( Ltmp1_real, *ptRealDn, 16384 );
            tmp2_imag = sub( *ptRealUp++, *ptRealDn-- );


            temp[i] = mac_r( L_msu( Ltmp1_real, tmp2_real, phs_tbl[i] ), tmp2_imag, phs_tbl[i + 1] );
            move16();
            temp[i+1] = mac_r(L_mac(Ltmp1_imag, tmp2_imag, phs_tbl[i]), tmp2_real, phs_tbl[i+1]);
@@ -479,6 +516,7 @@ void r_fft_fx_lc(
            move16();
            *ptrDn-- = msu_r(Ltmp1_real, tmp2_real, *phstbl_ptrDn--);
            move16();
#endif
        }

        /* Perform the complex ifFT */
+15 −3
Original line number Diff line number Diff line
@@ -650,7 +650,11 @@ void FEC_exc_estim_fx(
            /* non-causal ringing of the FIR filter */
            /**pt_exc++ *= (gain_inov * gain);*/
            L_tmp = L_mult(tmp, *pt_exc);              /* Q_exc+18 * Q-3 -> Q_exc+16 */
#ifdef BASOP_NOGLOB
            *pt_exc++ = round_fx_sat( L_shl_sat( L_tmp, exp ) );
#else
            *pt_exc++ = round_fx( L_shl( L_tmp, exp ) );
#endif
        }

        FOR( i=0; i< L_frame; i++ )
@@ -658,7 +662,11 @@ void FEC_exc_estim_fx(
            /* the inner part of the FIR filter */
            /* *pt_exc++ *= (gain_inov * gain); */
            L_tmp = L_mult(tmp, *pt_exc);
#ifdef BASOP_NOGLOB
            *pt_exc++ = round_fx_sat( L_shl_sat( L_tmp, exp ) );
#else
            *pt_exc++ = round_fx( L_shl( L_tmp, exp ) );
#endif
            /* gain -= step; */
            L_tmp2 = L_sub(L_tmp2, L_step);
            tmp = round_fx(L_tmp2);
@@ -669,7 +677,11 @@ void FEC_exc_estim_fx(
        {
            /* *pt_exc++ *= (gain_inov * gain) */
            L_tmp = L_mult(tmp, *pt_exc);
#ifdef BASOP_NOGLOB
            *pt_exc++ = round_fx_sat( L_shl_sat( L_tmp, exp ) );
#else
            *pt_exc++ = round_fx( L_shl( L_tmp, exp ) );
#endif
        }
    }

Loading