Commit 957ebf50 authored by vaillancour's avatar vaillancour
Browse files

adding basop sat for signal with extreme saturation

parent 8ac987e3
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -207,8 +207,13 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
            sigPtr = signal_fx+lg+mem_len+i;
            move16();  /*+i*/
            L_tmp = syn_kern_16(0, A_fx, sigPtr);
#ifdef BASOP_NOGLOB
            L_tmp = L_shl_sat( L_tmp, 3 );
            *sigPtr = round_fx_sat(L_tmp);  /* AZ ringing padding */
#else
            L_tmp = L_shl( L_tmp, 3 );
            *sigPtr = round_fx(L_tmp);  /* AZ ringing padding */
#endif
        }
        mem_preemph_fx = signal_fx[mem_len+lg-LEN_WIN_SSS - 1];
        move16();
@@ -232,8 +237,11 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */

    FOR(i=0; i<lg_out; i++)
    {
#ifdef BASOP_NOGLOB
        sigOut_fx[i] = round_fx_sat( Interpol_lc_fx( sigIn_ptr, cfg_ptr_fx->filter_fx, frac, fac_num, filt_len_tmp ) );
#else
        sigOut_fx[i] = round_fx( Interpol_lc_fx( sigIn_ptr, cfg_ptr_fx->filter_fx, frac, fac_num, filt_len_tmp ) );

#endif
        frac = add(frac,fracstep);

        j = sub(fac_num, frac);
+6 −2
Original line number Diff line number Diff line
@@ -75,9 +75,13 @@ static void hp_filter_fx(
#else /* BASOP_NOGLOB */
	L_tmp = L_mult(sub(x[0], *oldx), 24465);/*Q_new+16 */
#endif /* BASOP_NOGLOB */
#ifdef BASOP_NOGLOB
    L_tmp = L_mac_sat( L_tmp, *oldy, 16158 ); /*Q_new+16 */
	y[0] = round_fx_sat(L_tmp);/*Q_new */
#else
    L_tmp = L_mac( L_tmp, *oldy, 16158 ); /*Q_new+16 */
	y[0] = round_fx(L_tmp);/*Q_new */

#endif
	FOR(i = 1; i < L; i++)
	{
		/*y[i] = 0.4931f*y[i-1] + 0.7466f*(x[i] - x[i-1]); */
+5 −2
Original line number Diff line number Diff line
@@ -71,8 +71,11 @@ static Word16 find_ener_decrease_fx( /* o : maximum energy ratio Q10
    }


#ifdef BASOP_NOGLOB
    minEnr = L_add_sat( minEnr, 100000 );
#else
    minEnr = L_add( minEnr, 100000 );

#endif
    exp0 = norm_l(minEnr);
    wtmp0 = extract_h(L_shl(minEnr, exp0));
    exp1 = sub(norm_l(maxEnr),1);
+27 −6
Original line number Diff line number Diff line
@@ -349,7 +349,11 @@ void hq_lr_enc_fx(
        frac1 = L_Extract_lc(L_tmp, &exp); /* Extract exponent of L_tmp */
        L_tmp =  Pow2(30, frac1);
        exp = sub(exp, 30);
#ifdef BASOP_NOGLOB
        Ep_fx[i] = L_shl_sat( L_tmp, s_max( sub( exp, 6 ), -31 ) ); /* Q -6 */
#else
        Ep_fx[i] = L_shl( L_tmp, s_max( sub( exp, 6 ), -31 ) ); /* Q -6 */
#endif
    }

    FOR( i = 0; i < bands_fx; i++ )
@@ -416,13 +420,22 @@ void hq_lr_enc_fx(
        {
            IF( GE_16(i,lowband))
            {
#ifdef BASOP_NOGLOB
                Ep_vari_fx = L_add_sat( Ep_vari_fx, L_abs( L_sub( Ep_tmp_fx[i], Ep_tmp_fx[sub( i, 1 )] ) ) ); /*Q15 */
                Ep_avrg_fx = L_add_sat( Ep_avrg_fx, Ep_tmp_fx[i] );                                       /*Q15 */
#else
                Ep_vari_fx = L_add( Ep_vari_fx, L_abs( L_sub( Ep_tmp_fx[i], Ep_tmp_fx[sub( i, 1 )] ) ) ); /*Q15 */
                Ep_avrg_fx = L_add( Ep_avrg_fx, Ep_tmp_fx[i] );                                           /*Q15 */
#endif

            }
            ELSE
            {
#ifdef BASOP_NOGLOB
                Ep_avrgL_fx = L_add_sat( Ep_avrgL_fx, Ep_tmp_fx[i] ); /*Q15 */
#else
                Ep_avrgL_fx = L_add( Ep_avrgL_fx, Ep_tmp_fx[i] ); /*Q15 */
#endif
                IF(GT_32(Ep_tmp_fx[i],Ep_peak_fx))
                {
                    Ep_peak_fx = L_add(Ep_tmp_fx[i], 0); /*Q15 */
@@ -596,11 +609,19 @@ void hq_lr_enc_fx(
        {
            IF(GE_16(i,lowband))
            {
#ifdef BASOP_NOGLOB
                Ep_avrg_fx = L_add_sat( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */
#else
                Ep_avrg_fx = L_add( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */
#endif
            }
            ELSE
            {
#ifdef BASOP_NOGLOB
                Ep_avrgL_fx = L_add_sat( Ep_avrgL_fx, L_shr( Ep_tmp_fx[i], 1 ) ); /*Q12 */
#else
                Ep_avrgL_fx = L_add( Ep_avrgL_fx, L_shr( Ep_tmp_fx[i], 1 ) ); /*Q12 */
#endif
                IF(GT_32(Ep_tmp_fx[i],Ep_peak_fx))
                {
                    Ep_peak_fx = L_add(Ep_tmp_fx[i], 0); /*Q13 */
+5 −1
Original line number Diff line number Diff line
@@ -179,7 +179,11 @@ void Preemph_scaled(
        L_tmp = L_msu(L_tmp, new_speech[i - 1], mu);
#endif /* BASOP_NOGLOB */
        L_tmp = L_shl(L_tmp, *Q_new);
#ifdef BASOP_NOGLOB
        new_speech[i] = round_fx_sat( L_tmp );
#else
        new_speech[i] = round_fx( L_tmp );
#endif
    }

    L_tmp = L_mult(new_speech[0], QVal);
Loading