Commit 90b2a27a authored by vaillancour's avatar vaillancour
Browse files

adding basop sat for signal with extreme saturation

parent 0d78f2ba
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -452,10 +452,11 @@ void bass_psfilter_fx(
            FOR (i=0; i< subfr_len; i++)
            {
                /*syn2_fx[i] = alpha*(syn_fx[i]-syn2_fx[i]); */
                tmp = sub(syn_fx[i],syn2_fx[i]);
#ifdef BASOP_NOGLOB
                tmp = sub_sat( syn_fx[i], syn2_fx[i] );
                syn2_fx[i] = mult_sat( alpha, shl_sat( tmp, 1 ) );
#else
                tmp = sub( syn_fx[i], syn2_fx[i] );
                syn2_fx[i] = mult( alpha, shl( tmp, 1 ) );
#endif
                move16();/*Q_syn2 */
+5 −1
Original line number Diff line number Diff line
@@ -304,7 +304,11 @@ static void gain_dec_gacelp_uv(

    *past_gcode = L_shl(L_tmp1, sub(exp_L_tmp1, 15)); /* Q16 */              move32();

#ifdef BASOP_NOGLOB
    *gain_code = L_shl_sat( Mpy_32_16_1( *past_gcode, *gain_inov ), 3 );
#else
    *gain_code = L_shl( Mpy_32_16_1( *past_gcode, *gain_inov ), 3 );
#endif
    move32();


+5 −1
Original line number Diff line number Diff line
@@ -2211,7 +2211,11 @@ void IMDCT(Word32 *x, Word16 x_e,
                    {
                        FOR (i = add(i, tmp1); i < L_frame; i++)
                        {
#ifdef BASOP_NOGLOB
                            xn_buf[i] = shl_sat( xn_buf[i], TCX_IMDCT_HEADROOM );
#else
                            xn_buf[i] = shl( xn_buf[i], TCX_IMDCT_HEADROOM );
#endif
                            move16();
                        }
                    }
+10 −2
Original line number Diff line number Diff line
@@ -54,10 +54,18 @@ static Word16 GetMinimumPosition(
        FOR (i = 0; i < cnt; i++)
        {
            tmp16 = shr(x[i],tmp_e);
#ifdef BASOP_NOGLOB
            energy = L_msu_sat( energy_old, tmp16, tmp16 );
#else
            energy = L_msu( energy_old, tmp16, tmp16 );
#endif
            tmp16 = shr(x[i+filterLength],tmp_e);
            BASOP_SATURATE_WARNING_OFF_EVS /*Saturation will be handled*/
#ifdef BASOP_NOGLOB
            energy = L_mac_sat( energy, tmp16, tmp16 );
#else
            energy = L_mac( energy, tmp16, tmp16 );
#endif
            BASOP_SATURATE_WARNING_ON_EVS

            /*if (energy == MAXVAL_WORD32)*/
+8 −0
Original line number Diff line number Diff line
@@ -3222,7 +3222,11 @@ void swb_tbe_dec_fx(
        tmp = div_s( 16384, tmp );
        L_tmp = L_deposit_h( tmp );
        L_tmp = Isqrt_lc( L_tmp, &exp );
#ifdef BASOP_NOGLOB
        st_fx->prev_ener_shb_fx = round_fx_sat( L_shl_sat( L_tmp, sub( exp, 14 ) ) ); /* Q1 */
#else
        st_fx->prev_ener_shb_fx = round_fx( L_shl( L_tmp, sub( exp, 14 ) ) ); /* Q1 */
#endif
    }
    /* st->prev_SWB_fenv[i] = sqrt(curr_frame_pow/L_FRAME16k); */
    L_tmp = Mult_32_16( curr_frame_pow, 26214 ); /* curr_frame_pow_exp+8; 26214=(1/L_FRAME16k) in Q23 */
@@ -3236,7 +3240,11 @@ void swb_tbe_dec_fx(
        tmp = div_s( 16384, tmp );
        L_tmp = L_deposit_h( tmp );
        L_tmp = Isqrt_lc( L_tmp, &exp );
#ifdef BASOP_NOGLOB
        tmp = round_fx_sat( L_shl_sat( L_tmp, sub( exp, 14 ) ) ); /* Q1 */
#else
        tmp = round_fx( L_shl( L_tmp, sub( exp, 14 ) ) ); /* Q1 */
#endif
    }
    set16_fx(st_fx->prev_SWB_fenv_fx, tmp, SWB_FENV); /* Q1 */