Commit 1f3443a6 authored by vaillancour's avatar vaillancour
Browse files

adding basop sat for signal with extreme saturation

parent 90b2a27a
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -257,7 +257,11 @@ void enhancer_fx(
        L_tmp = L_deposit_h(code[L_SUBFR - 1]);/*Q28 */
        L_tmp = L_msu(L_tmp, code[L_SUBFR - 2], tmp);/*Q28 */
        L_tmp = L_shl(L_mult(gain_code_hi, extract_h(L_tmp)), sc);
#ifdef BASOP_NOGLOB
        pt_exc2[L_SUBFR - 1] = msu_r_sat( L_tmp, -32768, pt_exc2[L_SUBFR - 1] );
#else
        pt_exc2[L_SUBFR - 1] = msu_r( L_tmp, -32768, pt_exc2[L_SUBFR - 1] );
#endif
        move16();/* in Q_exc */
        test();
        test();
@@ -553,7 +557,11 @@ static void phase_dispersion_fx(
    prev_gain_pit[0] = gain_pit;
    move16();

#ifdef BASOP_NOGLOB
    IF( GT_32( L_sub_sat( gain_code, *prev_gain_code ), L_shl_sat( *prev_gain_code, 1 ) ) )
#else
    IF( GT_32( L_sub( gain_code, *prev_gain_code ), L_shl( *prev_gain_code, 1 ) ) )
#endif
    {
        state = s_min(add(state, 1), 2);
    }
+5 −1
Original line number Diff line number Diff line
@@ -1071,7 +1071,11 @@ static void fft5_shift4_16fx(
    move16();
    T3 = zRe[i4];
    move16();
#ifdef BASOP_NOGLOB
    T4 = add_sat( T2, T3 );
#else
    T4 = add( T2, T3 );
#endif
    T5 = zRe[i2];
    move16();
    T6 = zRe[i3];
+20 −4
Original line number Diff line number Diff line
@@ -88,7 +88,11 @@ void hq_swb_harmonic_calc_norm_envelop_fx(
		FOR(n_lag = 0; n_lag < n_lag_now; n_lag++)
		{
			L_tmp = L_abs(L_SWB_signal[n_lag]);
#ifdef BASOP_NOGLOB
            L_envelope[env_index] = L_add_sat( L_envelope[env_index], L_tmp );
#else
            L_envelope[env_index] = L_add( L_envelope[env_index], L_tmp );
#endif
			move32();
		}
		env_index = add(env_index, 1);
@@ -105,7 +109,11 @@ void hq_swb_harmonic_calc_norm_envelop_fx(
		FOR(n_lag = 0; n_lag < n_lag_now; n_lag++)
		{
			L_tmp = L_abs(L_SWB_signal[add(n_freq, n_lag)]);
#ifdef BASOP_NOGLOB
            L_envelope[env_index] = L_add_sat( L_envelope[env_index], L_tmp );
#else
            L_envelope[env_index] = L_add( L_envelope[env_index], L_tmp );
#endif
			move32();
		}
		env_index = add(env_index, 1);
@@ -122,7 +130,11 @@ void hq_swb_harmonic_calc_norm_envelop_fx(
		FOR(n_lag = 0; n_lag < n_lag_now; n_lag++)
		{
			L_tmp = L_abs(L_SWB_signal[add(n_freq, n_lag)]);
#ifdef BASOP_NOGLOB
	        L_envelope[env_index] = L_add_sat( L_envelope[env_index], L_tmp );
#else
		    L_envelope[env_index] = L_add( L_envelope[env_index], L_tmp );
#endif
			move32();
		}
		env_index = add(env_index, 1);
@@ -2353,7 +2365,11 @@ void hq_wb_nf_bwe_fx(
					/* smooth the noise magnitudes between inter-frame */
					test();
					test();
#ifdef BASOP_NOGLOB
                    IF( GT_32( prev_avrg_norm_fx, L_shr( avrg_norm_fx, 1 ) ) && LT_32( prev_avrg_norm_fx, L_shl_sat( avrg_norm_fx, 1 ) ) && prev_is_transient == 0 )
#else
                    IF( GT_32( prev_avrg_norm_fx, L_shr( avrg_norm_fx, 1 ) ) && LT_32( prev_avrg_norm_fx, L_shl( avrg_norm_fx, 1 ) ) && prev_is_transient == 0 )
#endif
					{
						exp1 = norm_l(prev_env_fx[sfm]);
						L_tmp1 = L_shl(prev_env_fx[sfm], exp1);/* prev_env_Q[sfm] +exp1 */
+5 −1
Original line number Diff line number Diff line
@@ -1706,7 +1706,11 @@ void SWB_BWE_decoding_fx(
					/*20480 = 5 in Q12 */
					FOR(tmp3 = 20480; tmp3 > 4096; tmp3 -= 2048)
					{
#ifdef BASOP_NOGLOB
                        *pit1 = round_fx_sat( L_shl_sat( L_mult( *pit1, tmp3 ), 3 ) ); /*Q_syn */
#else
                        *pit1 = round_fx( L_shl( L_mult( *pit1, tmp3 ), 3 ) ); /*Q_syn */
#endif
						pit1--;
					}
				}
+20 −5
Original line number Diff line number Diff line
@@ -2955,23 +2955,38 @@ void ScaleShapedWB_fx(
    {
        /* mod_syn in (16+Q_bwe_exc), frame_gain in Q18 */
        L_tmp = Mult_32_32( mod_syn[i], frame_gain ); /* L_tmp in (Q_bwe_exc+3) */
#ifdef BASOP_NOGLOB
        synSHB[i] = round_fx_sat( L_shl_sat( Mult_32_16( L_tmp, win[i] ), shift ) ); /* Qx */
        synSHB[i] = add_sat( synSHB[i], overlap[i] );
        move16();                                                             /* Qx */
        synSHB[i + l_shb_lahead] = round_fx_sat( L_shl_sat( L_tmp, shift ) ); /* Qx */
#else
        synSHB[i] = round_fx( L_shl( Mult_32_16( L_tmp, win[i] ), shift ) ); /* Qx */
        synSHB[i] = add( synSHB[i], overlap[i] );
        move16();                                                     /* Qx */
        synSHB[i + l_shb_lahead] = round_fx( L_shl( L_tmp, shift ) ); /* Qx */
#endif
    }

    FOR ( ; i < l_frame; i++ )
    {
        L_tmp = Mult_32_32( mod_syn[i], frame_gain); /* L_tmp in (Q_bwe_exc+3) */
#ifdef BASOP_NOGLOB
        synSHB[i] = round_fx_sat( L_shl_sat( L_tmp, shift ) ); /* Qx; */
#else
        synSHB[i] = round_fx( L_shl( L_tmp, shift ) ); /* Qx; */
#endif
    }

    l_frame_tmp = add(l_frame, l_shb_lahead);
    FOR ( ; i < l_frame_tmp; i++ )
    {
        L_tmp = Mult_32_32( mod_syn[i], frame_gain ); /* (Q_bwe_exc+3) */
#ifdef BASOP_NOGLOB
        overlap[i - l_frame] = round_fx_sat( L_shl_sat( Mult_32_16( L_tmp, win[l_frame + l_shb_lahead - 1 - i] ), shift ) ); /* Qx */
#else
        overlap[i - l_frame] = round_fx( L_shl( Mult_32_16( L_tmp, win[l_frame + l_shb_lahead - 1 - i] ), shift ) ); /* Qx */
#endif
    }

    return;
Loading