Commit 92b403d4 authored by vaillancour's avatar vaillancour
Browse files

more saturation fixes

parent c52c6f41
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -2568,9 +2568,15 @@ void DTFS_to_erb_fx(

            tmp = div_s(fracb,fraca);
            exp = sub(expb,expa);
#ifdef BASOP_NOGLOB
            L_tmp = L_shl_sat( tmp, add( exp, 14 ) );

            out_fx[i] = round_fx_sat(L_tmp);
#else
            L_tmp = L_shl( tmp, add( exp, 14 ) );

            out_fx[i] = round_fx(L_tmp);
#endif
        }
    }
    return;
+6 −1
Original line number Diff line number Diff line
@@ -62,8 +62,13 @@ void est_energy_fx(
    FOR(i = 2; i < BandNum; i++)
    {
        Ltmp32 = L_shr(sb_power[i],shr_tmp);
#ifdef BASOP_NOGLOB
        frame_energy2 = L_add_sat( frame_energy2, Ltmp32 );
        if(i > 6)  HB_Power = L_add_sat(HB_Power, Ltmp32 );
#else
        frame_energy2 = L_add( frame_energy2, Ltmp32 );
        if(i > 6)  HB_Power = L_add(HB_Power, Ltmp32 );
#endif
    }
    frame_energy2 = L_sub(frame_energy2, Ltmp32 );

+6 −1
Original line number Diff line number Diff line
@@ -169,8 +169,13 @@ void pitch_ol2_fx(
        R2 = L_mult(wsp_fr_fx[0], wsp_fr_fx[0]);
        FOR (j = 1; j < L_SUBFR; j++)
        {
#ifdef BASOP_NOGLOB
            R1 = L_mac_sat( R1, pt_wsp_fx[j], pt_wsp_fx[j] );
            R2 = L_mac_sat(R2, wsp_fr_fx[j], wsp_fr_fx[j]);
#else
            R1 = L_mac( R1, pt_wsp_fx[j], pt_wsp_fx[j] );
            R2 = L_mac(R2, wsp_fr_fx[j], wsp_fr_fx[j]);
#endif
        }

        /* *voicing_fr = cor_max * inv_sqrt(enr_wsp * enr_old) */
+15 −3
Original line number Diff line number Diff line
@@ -934,7 +934,11 @@ static void freq_weights_fx(
    {
        exp = norm_s(tmp);
        tmp = div_s(shl(1,sub(14,exp)), tmp); /*(21-exp) */
#ifdef BASOP_NOGLOB
        tmp = shl_sat( tmp, sub( exp, 6 ) ); /*Q15 */
#else
        tmp = shl( tmp, sub( exp, 6 ) ); /*Q15 */
#endif
    }
    ELSE
    {
@@ -1633,7 +1637,11 @@ static void calculate_Tonality_fx(
    l_shift = norm_s(max);
    FOR( n_coeff=0; n_coeff<length; n_coeff++ )
    {
#ifdef BASOP_NOGLOB
        gen_spec[n_coeff] = shl_sat( gen_spec[n_coeff], l_shift );
#else
        gen_spec[n_coeff] = shl( gen_spec[n_coeff], l_shift );
#endif
        move16();
        test();
        if(gen_spec[n_coeff] == 0)
@@ -2048,7 +2056,11 @@ static Word16 SWB_BWE_encoding_fx(
            L_SWB_tenv = L_deposit_l(0);
            FOR(i = 0; i < L_SUBFR16k; i++)
            {
#ifdef BASOP_NOGLOB
                L_SWB_tenv = L_add_sat( L_SWB_tenv, L_mult0( insig_hp_fx[i + tmp], insig_hp_fx[i + tmp] ) ); /*2*Q_shb */
#else
                L_SWB_tenv = L_add( L_SWB_tenv, L_mult0( insig_hp_fx[i + tmp], insig_hp_fx[i + tmp] ) ); /*2*Q_shb */
#endif
            }

            tmp = i_mult2(n_band, L);