Commit 0d78f2ba authored by vaillancour's avatar vaillancour
Browse files

adding basop sat for signal with extreme saturation

parent a5f8e292
Loading
Loading
Loading
Loading
+33 −6
Original line number Diff line number Diff line
@@ -442,7 +442,11 @@ void calc_norm_envelop_lf_fx(
		tmp = add(lookback, n_freq);
		FOR(n_lag = 0; n_lag < tmp; n_lag++)
		{
#ifdef BASOP_NOGLOB
            L_tmp = L_add_sat( L_tmp, L_abs( SWB_signal[n_lag] ) );
#else
            L_tmp = L_add( L_tmp, L_abs( SWB_signal[n_lag] ) );
#endif
		}
		envelope[env_index] = L_tmp;
		move32();
@@ -455,7 +459,11 @@ void calc_norm_envelop_lf_fx(
		Word32 L_tmp = L_deposit_l(1);
		FOR(n_lag = 0; n_lag < n_lag_now; n_lag++)
		{
#ifdef BASOP_NOGLOB
			L_tmp = L_add_sat(L_tmp, L_abs(SWB_signal[add(sub(n_freq, lookback), n_lag)]));
#else
			L_tmp = L_add(L_tmp, L_abs(SWB_signal[add(sub(n_freq, lookback), n_lag)]));
#endif
		}

		envelope[env_index] = L_tmp;
@@ -1570,8 +1578,11 @@ void SWB_BWE_decoding_fx(
		exp = norm_s(SWB_FENV);
		tmp = div_s(shl(1,sub(14,exp)),SWB_FENV); /*Q(29-exp) */
		L_tmp = Mult_32_16(L_energy,tmp); /*Q(1+29-exp+1)->Q(15-exp) */
#ifdef BASOP_NOGLOB
        Energy_16 = round_fx_sat( L_shl_sat( L_tmp, add( exp, 4 ) ) ); /*Q3 */
#else
        Energy_16 = round_fx( L_shl( L_tmp, add( exp, 4 ) ) ); /*Q3 */

#endif
		IF(NE_16(last_extl, SWB_BWE) && NE_16(last_extl,FB_BWE))
		{
			IF(Energy_16 < shr(EnergyL_16, 4) && EQ_16(extl, FB_BWE))
@@ -1937,7 +1948,11 @@ void SWB_BWE_decoding_fx(
				}
			}

#ifdef BASOP_NOGLOB
			IF(GT_16(*prev_Energy,add_sat(Energy_16,shr(Energy_16,2))) && Energy_16 > 0)
#else
			IF(GT_16(*prev_Energy,add(Energy_16,shr(Energy_16,2))) && Energy_16 > 0)
#endif
			{
				weight = shr(div_s(Energy_16,*prev_Energy),1); /*Q15 */
			}
@@ -2004,7 +2019,11 @@ void SWB_BWE_decoding_fx(
					L_tmp1 = Mult_32_16(SWB_signal_32[n_freq], factor);
					SWB_signal_32[n_freq] = L_shl(L_tmp1, tmp - 1);
					move32(); /*15+Qsyn */
#ifdef BASOP_NOGLOB
                    factor = add_sat( factor, factor1 ); /*Q1 */
#else
                    factor = add( factor, factor1 ); /*Q1 */
#endif
				}
			}
			L_tmp = L_mult(weight, prev_SWB_fenv[13]); /*Q17 */
@@ -2213,7 +2232,11 @@ void time_reduce_pre_echo_fx(
		L_tmp = L_deposit_l(0);
		FOR(j = 0; j < L; j++)
		{
#ifdef BASOP_NOGLOB
			L_tmp = L_mac0_sat( L_tmp, synth[Len + j], synth[Len + j] ); /*2*Q_syn */
#else
			L_tmp = L_mac0( L_tmp, synth[Len + j], synth[Len + j] ); /*2*Q_syn */
#endif
		}
		energyL[i] = Mult_32_16(L_shr(L_tmp, sub(14, exp_L)), inv_L);
		move32(); /*Q(2*Q_syn +29-exp_L-15 - (14-exp_L) ) -> Q(2*Q_syn) */
@@ -2628,7 +2651,11 @@ void hq_generic_decoding_fx(
		tmp = div_s(16384, frac);/*15 + 14 - (cs+exp-16) */
		exp = sub(add(cs, exp), 30);
		L_tmp = Isqrt_lc(L_deposit_h(tmp), &exp);/*Q31 - exp */
#ifdef BASOP_NOGLOB
        fenvL_fx = round_fx_sat( L_shl_sat( L_tmp, sub( exp, 14 ) ) ); /*Q1 */
#else
        fenvL_fx = round_fx( L_shl( L_tmp, sub( exp, 14 ) ) ); /*Q1 */
#endif
	}

	calc_normal_length_fx_32(HQ_CORE, coeff_out1_fx, HQ_GEN_SWB, -1, &L_swb_norm, prev_L_swb_norm);
+9 −3
Original line number Diff line number Diff line
@@ -857,9 +857,15 @@ void core_switching_OLA_fx(
        temp_len = i_mult2(shr(R2_16,2), delta);
        FOR( i=0 ; i<temp_len; i+=2 )
        {
#ifdef BASOP_NOGLOB
            *pt = shl_sat( mult_r_sat( *pt, *pt5 ), 1 );
            move16(); /*      // Q14* Q15 + shl  ==> Q15 */
            *pt2 = shl_sat( mult_r_sat( *pt2, *pt4 ), 1 );
#else
            *pt = shl( mult_r( *pt, *pt5 ), 1 );
            move16(); /*      // Q14* Q15 + shl  ==> Q15 */
            *pt2 = shl( mult_r( *pt2, *pt4 ), 1 );
#endif
            move16();/*/= win[(3*L_FRAME16k/2-1-i/2)*decimate+decay-L_FRAME48k*14/20]; */
            pt+=2;
            pt2+=2;
+5 −1
Original line number Diff line number Diff line
@@ -469,7 +469,11 @@ void decoder_acelp(
                    Ltmp2 = L_shl(Ltmp2, add(5,st->Q_exc));
                    Ltmp = L_add(Ltmp, Ltmp2);
                    BASOP_SATURATE_WARNING_OFF_EVS
#ifdef BASOP_NOGLOB
                    Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here */
#else
                    Ltmp = L_shl( Ltmp, 1 ); /* saturation can occur here */
#endif 
                    BASOP_SATURATE_WARNING_ON_EVS
                    exc[i + i_subfr] = round_fx(Ltmp);
                }
+10 −2
Original line number Diff line number Diff line
@@ -1307,7 +1307,11 @@ ivas_error evs_dec_fx(

                FOR (i = 0; i < tmps; i++)
                {
#ifdef BASOP_NOGLOB
                    output_sp[i + tmps] = msu_r_sat( L_mult_sat( shr( pcmbufFB[i], timeIn_e ), alpha ), output_sp[i + tmps], add( alpha, -32768 ) );
#else
                    output_sp[i + tmps] = msu_r( L_mult( shr( pcmbufFB[i], timeIn_e ), alpha ), output_sp[i + tmps], add( alpha, -32768 ) );
#endif
                    move16();
                    alpha = add(alpha, step);
                }
@@ -1345,7 +1349,11 @@ ivas_error evs_dec_fx(

            FOR (i = delta; i < tmps; i++)
            {
#ifdef BASOP_NOGLOB
                output_sp[i] = msu_r_sat( L_mult( output_sp[i], alpha ), shr( hTcxDec->FBTCXdelayBuf[i], timeIn_e ), add( alpha, -32768 ) );
#else
                output_sp[i] = msu_r( L_mult( output_sp[i], alpha ), shr( hTcxDec->FBTCXdelayBuf[i], timeIn_e ), add( alpha, -32768 ) );
#endif
                move16();
#ifdef BASOP_NOGLOB
                alpha = add_sat(alpha, step);
+5 −1
Original line number Diff line number Diff line
@@ -870,7 +870,11 @@ Word16 swb_bwe_gain_deq_fx( /* o : BWE class */
            /* output of Pow2() will be: */
            /* 16384 < Pow2() <= 32767 */
            exp = sub(exp, 13);
#ifdef BASOP_NOGLOB
            SWB_fenv[n_band] = shl_sat( tmp, add( exp, 1 ) );
#else
            SWB_fenv[n_band] = shl( tmp, add( exp, 1 ) );
#endif
            move16();/*Q1 */
        }

Loading