Loading lib_com/prot_fx.h +11 −0 Original line number Diff line number Diff line Loading @@ -2860,6 +2860,17 @@ void PostShortTerm_fx( const Word16 formant_fac_fx /* i : Strength of post-filter*/ ); void PostShortTerm_ivas_fx( Word16 *sig_in, /* i : i signal (pointer to current subframe */ Word16 *lpccoeff, /* i : LPC coefficients for current subframe */ Word16 *sig_out, /* o : postfiltered output */ Word16 *mem_stp, /* i/o: postfilter memory*/ Word16 *ptr_mem_stp, /* i/o: pointer to postfilter memory*/ Word16 *ptr_gain_prec, /* i/o: for gain adjustment*/ Word16 *mem_zero, /* i/o: null memory to compute h_st*/ const Word16 formant_fac_fx /* i : Strength of post-filter*/ ); void flip_spectrum_and_decimby4_fx( const Word16 i[], /* i : i spectrum */ Word16 output[], /* o : output spectrum */ Loading lib_com/swb_tbe_com_fx.c +100 −0 Original line number Diff line number Diff line Loading @@ -826,6 +826,46 @@ static void Calc_st_filt_tbe( Word16 h[LONG_H_ST]; Word16 g0, temp; Word16 i; temp = sub( 2, norm_s( apond2[0] ) ); /* compute i.r. of composed filter apond2 / apond1 */ Syn_filt_s( temp, apond1, LPC_SHB_ORDER, apond2, h, LONG_H_ST, mem_zero, 0 ); /* compute 1st parcor */ Calc_rc0_h( h, parcor0 ); /* compute g0 */ L_g0 = L_mult0( 1, abs_s( h[0] ) ); FOR( i = 1; i < LONG_H_ST; i++ ) { L_g0 = L_mac0( L_g0, 1, abs_s( h[i] ) ); } g0 = extract_h( L_shl( L_g0, 14 ) ); /* Scale signal i of 1/A(gamma1) */ IF( GT_16( g0, 1024 ) ) { temp = div_s( 1024, g0 ); /* temp = 2**15 / gain0 */ FOR( i = 0; i < L_SUBFR16k; i++ ) { sig_ltp_ptr[i] = mult_r( sig_ltp_ptr[i], temp ); move16(); } } } static void Calc_st_filt_tbe_ivas_fx( Word16 *apond2, /* i : coefficients of numerator */ Word16 *apond1, /* i : coefficients of denominator */ Word16 *parcor0, /* o : 1st parcor calcul. on composed filter */ Word16 *sig_ltp_ptr, /* i/o: i of 1/A(gamma1) : scaled by 1/g0 */ Word16 *mem_zero /* i : All zero memory */ ) { Word32 L_g0; Word16 h[LONG_H_ST]; Word16 g0, temp; Word16 i; temp = sub( 2, norm_s( apond2[0] ) ); Loading Loading @@ -1074,6 +1114,66 @@ void PostShortTerm_fx( /* o: parcor0 in Q15 */ /* i/o: sig_ltp_fx in Q_bwe_exc */ /* 1/A(gamma1) filtering, mem_stp is updated */ Syn_filt_s( 0, apond1_fx, LPC_SHB_ORDER, sig_ltp_fx + 1, sig_ltp_fx + 1, L_SUBFR16k, mem_stp, 1 ); /* (1 + mu z-1) tilt filtering */ filt_mu_fx( sig_ltp_fx, sig_out, parcor0_fx, L_SUBFR16k ); /* o: sig_out in Q_bwe_exc */ /* gain control */ scale_st_swb( sig_in, sig_out, ptr_gain_prec, L_SUBFR16k ); return; } void PostShortTerm_ivas_fx( Word16 *sig_in, /* i : input signal (pointer to current subframe */ Word16 *lpccoeff, /* i : LPC coefficients for current subframe */ Word16 *sig_out, /* o : postfiltered output */ Word16 *mem_stp, /* i/o: postfilter memory*/ Word16 *ptr_mem_stp, /* i/o: pointer to postfilter memory*/ Word16 *ptr_gain_prec, /* i/o: for gain adjustment*/ Word16 *mem_zero, /* i/o: null memory to compute h_st*/ const Word16 formant_fac_fx /* i : Strength of post-filter*/ ) { Word16 apond1_fx[LPC_SHB_ORDER + 1]; /* denominator coeff.*/ Word16 apond2_fx[LONG_H_ST]; /* numerator coeff. */ Word16 sig_ltp_fx[L_SUBFR16k + 1]; /* residual signal */ /*Word16 lpccoeff_fx[LPC_SHB_ORDER+1];//Q12 */ Word16 g1_fx, g2_fx, parcor0_fx; /*Q15 */ Word16 tmp; parcor0_fx = 0; move16(); set16_fx( apond1_fx, 0, LPC_SHB_ORDER + 1 ); set16_fx( apond2_fx, 0, LONG_H_ST ); set16_fx( sig_ltp_fx, 0, L_SUBFR16k + 1 ); /* Obtain post-filter weights */ tmp = extract_h( L_mult( GAMMA_SHARP_FX, formant_fac_fx ) ); /*Q15 */ g1_fx = add( GAMMA0_FX, tmp ); /*Q15 */ g2_fx = sub( GAMMA0_FX, tmp ); /*Q15 */ /* Compute weighted LPC coefficients */ weight_a_fx( lpccoeff, apond1_fx, g1_fx, LPC_SHB_ORDER ); weight_a_fx( lpccoeff, apond2_fx, g2_fx, LPC_SHB_ORDER ); /* o: apond1_fx, apond2_fx in Q12 */ /* Compute A(gamma2) residual */ Residu3_10_fx( apond2_fx, sig_in, sig_ltp_fx + 1, L_SUBFR16k, 0 ); /* o: sig_ltp_fx in Q_bwe_exc */ /* Save last output of 1/A(gamma1) */ sig_ltp_fx[0] = *ptr_mem_stp; move16(); /* Control short term pst filter gain and compute parcor0 */ Calc_st_filt_tbe_ivas_fx( apond2_fx, apond1_fx, &parcor0_fx, sig_ltp_fx + 1, mem_zero ); /* o: parcor0 in Q15 */ /* i/o: sig_ltp_fx in Q_bwe_exc */ /* 1/A(gamma1) filtering, mem_stp is updated */ syn_filt_fx( 0, apond1_fx, LPC_SHB_ORDER, sig_ltp_fx + 1, sig_ltp_fx + 1, L_SUBFR16k, mem_stp, 1 ); Loading lib_dec/swb_tbe_dec.c +2 −2 Original line number Diff line number Diff line Loading @@ -1824,7 +1824,7 @@ void ivas_swb_tbe_dec_fx( FOR( i = 0; i < L_FRAME16k; i += L_SUBFR16k ) { /* TD BWE post-processing */ PostShortTerm_fx( &shaped_shb_excitation_fx[L_SHB_LAHEAD + i], lpc_shb_fx, &shaped_shb_excitationTemp_fx[i], hBWE_TD->mem_stp_swb_fx, PostShortTerm_ivas_fx( &shaped_shb_excitation_fx[L_SHB_LAHEAD + i], lpc_shb_fx, &shaped_shb_excitationTemp_fx[i], hBWE_TD->mem_stp_swb_fx, hBWE_TD->ptr_mem_stp_swb_fx, &( hBWE_TD->gain_prec_swb_fx ), hBWE_TD->mem_zero_swb_fx, formant_fac_fx ); } Loading lib_enc/swb_tbe_enc_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -3707,7 +3707,7 @@ void swb_tbe_enc_ivas_fx( FOR( i = 0; i < L_FRAME16k; i += L_SUBFR16k ) { PostShortTerm_fx( &shaped_shb_excitation_fx[L_SHB_LAHEAD + i], lpc_shb_fx, &shaped_shb_excitationTemp_fx[i], hBWE_TD->mem_stp_swb_fx, PostShortTerm_ivas_fx( &shaped_shb_excitation_fx[L_SHB_LAHEAD + i], lpc_shb_fx, &shaped_shb_excitationTemp_fx[i], hBWE_TD->mem_stp_swb_fx, hBWE_TD->ptr_mem_stp_swb_fx, &( hBWE_TD->gain_prec_swb_fx ), hBWE_TD->mem_zero_swb_fx, formant_fac_fx ); /* i: shaped_shb_excitation_fx in Q_bwe_exc */ /* i: lpc_shb_fx in Q12 */ Loading Loading
lib_com/prot_fx.h +11 −0 Original line number Diff line number Diff line Loading @@ -2860,6 +2860,17 @@ void PostShortTerm_fx( const Word16 formant_fac_fx /* i : Strength of post-filter*/ ); void PostShortTerm_ivas_fx( Word16 *sig_in, /* i : i signal (pointer to current subframe */ Word16 *lpccoeff, /* i : LPC coefficients for current subframe */ Word16 *sig_out, /* o : postfiltered output */ Word16 *mem_stp, /* i/o: postfilter memory*/ Word16 *ptr_mem_stp, /* i/o: pointer to postfilter memory*/ Word16 *ptr_gain_prec, /* i/o: for gain adjustment*/ Word16 *mem_zero, /* i/o: null memory to compute h_st*/ const Word16 formant_fac_fx /* i : Strength of post-filter*/ ); void flip_spectrum_and_decimby4_fx( const Word16 i[], /* i : i spectrum */ Word16 output[], /* o : output spectrum */ Loading
lib_com/swb_tbe_com_fx.c +100 −0 Original line number Diff line number Diff line Loading @@ -826,6 +826,46 @@ static void Calc_st_filt_tbe( Word16 h[LONG_H_ST]; Word16 g0, temp; Word16 i; temp = sub( 2, norm_s( apond2[0] ) ); /* compute i.r. of composed filter apond2 / apond1 */ Syn_filt_s( temp, apond1, LPC_SHB_ORDER, apond2, h, LONG_H_ST, mem_zero, 0 ); /* compute 1st parcor */ Calc_rc0_h( h, parcor0 ); /* compute g0 */ L_g0 = L_mult0( 1, abs_s( h[0] ) ); FOR( i = 1; i < LONG_H_ST; i++ ) { L_g0 = L_mac0( L_g0, 1, abs_s( h[i] ) ); } g0 = extract_h( L_shl( L_g0, 14 ) ); /* Scale signal i of 1/A(gamma1) */ IF( GT_16( g0, 1024 ) ) { temp = div_s( 1024, g0 ); /* temp = 2**15 / gain0 */ FOR( i = 0; i < L_SUBFR16k; i++ ) { sig_ltp_ptr[i] = mult_r( sig_ltp_ptr[i], temp ); move16(); } } } static void Calc_st_filt_tbe_ivas_fx( Word16 *apond2, /* i : coefficients of numerator */ Word16 *apond1, /* i : coefficients of denominator */ Word16 *parcor0, /* o : 1st parcor calcul. on composed filter */ Word16 *sig_ltp_ptr, /* i/o: i of 1/A(gamma1) : scaled by 1/g0 */ Word16 *mem_zero /* i : All zero memory */ ) { Word32 L_g0; Word16 h[LONG_H_ST]; Word16 g0, temp; Word16 i; temp = sub( 2, norm_s( apond2[0] ) ); Loading Loading @@ -1074,6 +1114,66 @@ void PostShortTerm_fx( /* o: parcor0 in Q15 */ /* i/o: sig_ltp_fx in Q_bwe_exc */ /* 1/A(gamma1) filtering, mem_stp is updated */ Syn_filt_s( 0, apond1_fx, LPC_SHB_ORDER, sig_ltp_fx + 1, sig_ltp_fx + 1, L_SUBFR16k, mem_stp, 1 ); /* (1 + mu z-1) tilt filtering */ filt_mu_fx( sig_ltp_fx, sig_out, parcor0_fx, L_SUBFR16k ); /* o: sig_out in Q_bwe_exc */ /* gain control */ scale_st_swb( sig_in, sig_out, ptr_gain_prec, L_SUBFR16k ); return; } void PostShortTerm_ivas_fx( Word16 *sig_in, /* i : input signal (pointer to current subframe */ Word16 *lpccoeff, /* i : LPC coefficients for current subframe */ Word16 *sig_out, /* o : postfiltered output */ Word16 *mem_stp, /* i/o: postfilter memory*/ Word16 *ptr_mem_stp, /* i/o: pointer to postfilter memory*/ Word16 *ptr_gain_prec, /* i/o: for gain adjustment*/ Word16 *mem_zero, /* i/o: null memory to compute h_st*/ const Word16 formant_fac_fx /* i : Strength of post-filter*/ ) { Word16 apond1_fx[LPC_SHB_ORDER + 1]; /* denominator coeff.*/ Word16 apond2_fx[LONG_H_ST]; /* numerator coeff. */ Word16 sig_ltp_fx[L_SUBFR16k + 1]; /* residual signal */ /*Word16 lpccoeff_fx[LPC_SHB_ORDER+1];//Q12 */ Word16 g1_fx, g2_fx, parcor0_fx; /*Q15 */ Word16 tmp; parcor0_fx = 0; move16(); set16_fx( apond1_fx, 0, LPC_SHB_ORDER + 1 ); set16_fx( apond2_fx, 0, LONG_H_ST ); set16_fx( sig_ltp_fx, 0, L_SUBFR16k + 1 ); /* Obtain post-filter weights */ tmp = extract_h( L_mult( GAMMA_SHARP_FX, formant_fac_fx ) ); /*Q15 */ g1_fx = add( GAMMA0_FX, tmp ); /*Q15 */ g2_fx = sub( GAMMA0_FX, tmp ); /*Q15 */ /* Compute weighted LPC coefficients */ weight_a_fx( lpccoeff, apond1_fx, g1_fx, LPC_SHB_ORDER ); weight_a_fx( lpccoeff, apond2_fx, g2_fx, LPC_SHB_ORDER ); /* o: apond1_fx, apond2_fx in Q12 */ /* Compute A(gamma2) residual */ Residu3_10_fx( apond2_fx, sig_in, sig_ltp_fx + 1, L_SUBFR16k, 0 ); /* o: sig_ltp_fx in Q_bwe_exc */ /* Save last output of 1/A(gamma1) */ sig_ltp_fx[0] = *ptr_mem_stp; move16(); /* Control short term pst filter gain and compute parcor0 */ Calc_st_filt_tbe_ivas_fx( apond2_fx, apond1_fx, &parcor0_fx, sig_ltp_fx + 1, mem_zero ); /* o: parcor0 in Q15 */ /* i/o: sig_ltp_fx in Q_bwe_exc */ /* 1/A(gamma1) filtering, mem_stp is updated */ syn_filt_fx( 0, apond1_fx, LPC_SHB_ORDER, sig_ltp_fx + 1, sig_ltp_fx + 1, L_SUBFR16k, mem_stp, 1 ); Loading
lib_dec/swb_tbe_dec.c +2 −2 Original line number Diff line number Diff line Loading @@ -1824,7 +1824,7 @@ void ivas_swb_tbe_dec_fx( FOR( i = 0; i < L_FRAME16k; i += L_SUBFR16k ) { /* TD BWE post-processing */ PostShortTerm_fx( &shaped_shb_excitation_fx[L_SHB_LAHEAD + i], lpc_shb_fx, &shaped_shb_excitationTemp_fx[i], hBWE_TD->mem_stp_swb_fx, PostShortTerm_ivas_fx( &shaped_shb_excitation_fx[L_SHB_LAHEAD + i], lpc_shb_fx, &shaped_shb_excitationTemp_fx[i], hBWE_TD->mem_stp_swb_fx, hBWE_TD->ptr_mem_stp_swb_fx, &( hBWE_TD->gain_prec_swb_fx ), hBWE_TD->mem_zero_swb_fx, formant_fac_fx ); } Loading
lib_enc/swb_tbe_enc_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -3707,7 +3707,7 @@ void swb_tbe_enc_ivas_fx( FOR( i = 0; i < L_FRAME16k; i += L_SUBFR16k ) { PostShortTerm_fx( &shaped_shb_excitation_fx[L_SHB_LAHEAD + i], lpc_shb_fx, &shaped_shb_excitationTemp_fx[i], hBWE_TD->mem_stp_swb_fx, PostShortTerm_ivas_fx( &shaped_shb_excitation_fx[L_SHB_LAHEAD + i], lpc_shb_fx, &shaped_shb_excitationTemp_fx[i], hBWE_TD->mem_stp_swb_fx, hBWE_TD->ptr_mem_stp_swb_fx, &( hBWE_TD->gain_prec_swb_fx ), hBWE_TD->mem_zero_swb_fx, formant_fac_fx ); /* i: shaped_shb_excitation_fx in Q_bwe_exc */ /* i: lpc_shb_fx in Q12 */ Loading