diff --git a/lib_com/modif_fs.c b/lib_com/modif_fs.c index 59753930adc67cba595b24c6cee8f74703d9f961..a05f396019c596dda82251850cbecd5bff1c5422 100644 --- a/lib_com/modif_fs.c +++ b/lib_com/modif_fs.c @@ -1032,6 +1032,66 @@ void interpolate_3_over_1_allpass( } +void interpolate_3_over_1_allpass_32( + const Word32 *input, /* i : input signal */ + const Word16 len, /* i : number of input samples */ + Word32 *out, /* o : output signal */ + Word32 *mem /* i/o: memory */ +) +{ + Word16 i; + Word32 Vu[2], Vm[2], Vl[2]; /* Outputs of three cascaded allpass stages (upper, middle, and lower) */ + Word32 *out1; + Word32 mem_temp; + const Word16 *filt_coeff = allpass_poles_3_ov_2; + + out1 = &out[0]; + + FOR( i = 0; i < len; i++ ) + { + /* Upper branch */ + Vu[0] = L_add_sat( mem[0], Mpy_32_16_1( L_sub( input[i], mem[1] ), filt_coeff[0] ) ); + Vu[1] = L_add_sat( mem[1], Mpy_32_16_1( L_sub( Vu[0], mem[2] ), filt_coeff[1] ) ); + mem[3] = L_add_sat( mem[2], Mpy_32_16_1( L_sub( Vu[1], mem[3] ), filt_coeff[2] ) ); + + mem[1] = Vu[0]; + mem[2] = Vu[1]; + *out1++ = mem[3]; + + /* Middle branch */ + Vm[0] = L_add_sat( mem[0], Mpy_32_16_1( L_sub( input[i], mem[4] ), filt_coeff[3] ) ); + Vm[1] = L_add_sat( mem[4], Mpy_32_16_1( L_sub( Vm[0], mem[5] ), filt_coeff[4] ) ); + mem[6] = L_add_sat( mem[5], Mpy_32_16_1( L_sub( Vm[1], mem[6] ), filt_coeff[5] ) ); + + mem[4] = Vm[0]; + mem[5] = Vm[1]; + *out1++ = mem[6]; + + /* Lower branch */ + Vl[0] = L_add_sat( mem[0], Mpy_32_16_1( L_sub( input[i], mem[7] ), filt_coeff[6] ) ); + Vl[1] = L_add_sat( mem[7], Mpy_32_16_1( L_sub( Vl[0], mem[8] ), filt_coeff[7] ) ); + mem[9] = L_add_sat( mem[8], Mpy_32_16_1( L_sub( Vl[1], mem[9] ), filt_coeff[8] ) ); + + mem[0] = input[i]; + mem[7] = Vl[0]; + mem[8] = Vl[1]; + *out1++ = mem[9]; + } + + /*LPF*/ + FOR( i = 0; i < len * 3; i++ ) + { + mem_temp = out[i]; + out[i] = L_sub_sat( Mpy_32_16_1( L_add_sat( mem[12], mem[11] ), 18768 ), Mpy_32_16_1( L_add_sat( mem_temp, mem[10] ), 2424 ) ); + mem[10] = mem[11]; + mem[11] = mem[12]; + mem[12] = mem_temp; + } + + return; +} + + /*-------------------------------------------------------------------* * retro_interp4_5() * diff --git a/lib_com/prot.h b/lib_com/prot.h index 7b534da85fb1ffd0a4e82ac36eca77c096b2c950..683a2b07d65407c25b967076c4728e6655763192 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -2642,7 +2642,15 @@ void flip_and_downmix_generic( float mem3_ext[2 * HILBERT_ORDER2], /* i/o: memory */ int16_t *phase_state /* i/o: Phase state in case frequency isn't multiple of 50 Hz */ ); - +void flip_and_downmix_generic_fx_32( + Word32 input[], /* i : input spectrum Qx*/ + Word32 output[], /* o : output spectrum Qx*/ + const Word16 length, /* i : length of spectra */ + Word32 mem1_ext[HILBERT_ORDER1], /* i/o: memory Qx*/ + Word32 mem2_ext[2 * HILBERT_ORDER2], /* i/o: memory Qx*/ + Word32 mem3_ext[2 * HILBERT_ORDER2], /* i/o: memory Qx*/ + Word16* phase_state /* i/o: Phase state in case frequency isn't multiple of 50 Hz */ +); void non_linearity( const float input[], /* i : input signal */ float output[], /* i : output signal */ @@ -2731,12 +2739,29 @@ void GenTransition( const int32_t total_brate /* i : total bitrate */ ); + +void GenTransition_fixed( + TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ + Word32 *outputHB_fx, /* o : synthesized HB transitions signal */ + const int32_t output_Fs, /* i : output sampling rate */ + const int16_t element_mode, /* i : element mode */ + const int16_t L_frame, /* i : ACELP frame length */ + const int16_t rf_flag, /* i : RF flag */ + const int32_t total_brate /* i : total bitrate */ +); + void GenTransition_WB( TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ float *outputHB, /* o : synthesized HB transitions signal */ const int32_t output_Fs /* i : output sampling rate */ ); +void GenTransition_WB_fixed( + TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ + Word32 *outputHB_fx, /* o : synthesized HB transitions signal */ + const int32_t output_Fs /* i : output sampling rate */ +); + void td_bwe_dec_init( TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ const int16_t extl, /* i : BWE extension layer */ diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index 0e3d94e8be6be2b8c99cf2679f06719787b153f1..10afe3df1db8871a078f0f057877a731f294a87a 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -8723,6 +8723,12 @@ void interpolate_3_over_2_allpass_32( Word32 *mem /* i/o: memory */ ); +void interpolate_3_over_1_allpass_32( + const Word32 *input, /* i : input signal */ + const int16_t len, /* i : number of input samples */ + Word32 *out, /* o : output signal */ + Word32 *mem /* i/o: memory */ +); void Decimate_allpass_steep_fx32( const Word32 *in, /* i : input array of size N */ Word32 *mem, /* i/o: memory */ diff --git a/lib_com/swb_tbe_com.c b/lib_com/swb_tbe_com.c index 19c1943986ec2ed08392b2e084348615bc9dea3a..e42141e001c53f532465788b254912806c1fd81a 100644 --- a/lib_com/swb_tbe_com.c +++ b/lib_com/swb_tbe_com.c @@ -308,7 +308,7 @@ void flip_and_downmix_generic_fx_32( tmpi2_I, /* o: Imag. component of HB */ length, /* i: length of the spectra */ 1); /* i: HB transform stage */ - + Copy32(tmp + length, mem1_ext, HILBERT_ORDER1); Copy32( mem2_ext+HILBERT_ORDER2, tmp_R, HILBERT_ORDER2 ); Copy32( mem3_ext+HILBERT_ORDER2, tmp_I, HILBERT_ORDER2 ); diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 29ef301bcef38ce32f31fbef9a368c47ba15cde5..eea3629d363f492626f56dabc998a382401d97bb 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -851,14 +851,110 @@ ivas_error ivas_core_dec( if ( st->last_core == ACELP_CORE && ( st->core == TCX_20_CORE || st->core == TCX_10_CORE || st->core == HQ_CORE ) && st->hBWE_TD != NULL ) { + //Delete from here + Word32 hb_synth_fx[CPE_CHANNELS][L_FRAME48k]; + FOR( int ch_ind = 0; ch_ind < n_channels; ch_ind++ ) + { + FOR( int ind = 0; ind < L_FRAME48k; ind++ ) + { + hb_synth_fx[ch_ind][ind] = (Word32) ( hb_synth[ch_ind][ind] * ( 1 << 11 ) ); + } + } + if ( st->hBWE_TD != NULL ) + { + for ( int i = 0; i < L_SHB_LAHEAD; i++ ) + { + st->hBWE_TD->syn_overlap_fx_32[i] = st->hBWE_TD->syn_overlap[i] * ( 1 << 11 ); + } + for ( int i = 0; i < INTERP_3_2_MEM_LEN; i++ ) + { + st->hBWE_TD->int_3_over_2_tbemem_dec_fx_32[i] = st->hBWE_TD->int_3_over_2_tbemem_dec[i] * ( 1 << 11 ); + } + for ( int i = 0; i < HILBERT_MEM_SIZE; i++ ) + { + st->hBWE_TD->genSHBsynth_Hilbert_Mem_fx[i] = st->hBWE_TD->genSHBsynth_Hilbert_Mem[i] * ( 1 << 11 ); + } + for ( int i = 0; i < 2 * ALLPASSSECTIONS_STEEP; i++ ) + { + st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32[i] = st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local[i] * ( 1 << 11 ); + } + for ( int i = 0; i < L_SHB_TRANSITION_LENGTH; i++ ) + { + st->hBWE_TD->old_tbe_synth_fx_32[i] = st->hBWE_TD->old_tbe_synth[i] * ( 1 << 11 ); + } + for ( int i = 0; i < 2 * ALLPASSSECTIONS_STEEP + 1; i++ ) + { + st->hBWE_TD->mem_resamp_HB_32k_fx_32[i] = st->hBWE_TD->mem_resamp_HB_32k[i] * ( 1 << 11 ); + } + for ( int i = 0; i < 2 * ALLPASSSECTIONS_STEEP; i++ ) + { + st->hBWE_TD->state_lsyn_filt_dwn_shb_fx_32[i] = st->hBWE_TD->state_lsyn_filt_dwn_shb[i] * ( 1 << 11 ); + st->hBWE_TD->state_lsyn_filt_shb_fx_32[i] = st->hBWE_TD->state_lsyn_filt_shb[i] * ( 1 << 11 ); + } + for ( int i = 0; i < INTERP_3_1_MEM_LEN; i++ ) + { + st->hBWE_TD->mem_resamp_HB_fx_32[i] = st->hBWE_TD->mem_resamp_HB[i] * ( 1 << 11 ); + } + } + //Delete till here + + if ( ( st->bwidth == SWB || st->bwidth == FB ) && ( st->last_extl == SWB_TBE || st->last_extl == FB_TBE ) ) { - GenTransition( st->hBWE_TD, hb_synth[n], output_Fs, st->element_mode, st->L_frame, st->rf_flag, st->total_brate ); + GenTransition_fixed( st->hBWE_TD, &hb_synth_fx[n], output_Fs, st->element_mode, st->L_frame, st->rf_flag, st->total_brate ); } else if ( st->bwidth == WB && st->last_extl == WB_TBE ) { - GenTransition_WB( st->hBWE_TD, hb_synth[n], output_Fs ); + GenTransition_WB_fixed( st->hBWE_TD, &hb_synth_fx[n], output_Fs ); + + move16(); + } + + // Delete from here + FOR( int ch_ind = 0; ch_ind < n_channels; ch_ind++ ) + { + FOR( int ind = 0; ind < L_FRAME48k; ind++ ) + { + hb_synth[ch_ind][ind] = ( (float) hb_synth_fx[ch_ind][ind] / ( 1 << 11 ) ); + } + } + if ( st->hBWE_TD != NULL ) + { + for ( int i = 0; i < L_SHB_LAHEAD; i++ ) + { + st->hBWE_TD->syn_overlap[i] = (float) st->hBWE_TD->syn_overlap_fx_32[i] / ( 1 << 11 ); + } + for ( int i = 0; i < INTERP_3_2_MEM_LEN; i++ ) + { + st->hBWE_TD->int_3_over_2_tbemem_dec[i] = (float) st->hBWE_TD->int_3_over_2_tbemem_dec_fx_32[i] / ( 1 << 11 ); + } + for ( int i = 0; i < HILBERT_MEM_SIZE; i++ ) + { + st->hBWE_TD->genSHBsynth_Hilbert_Mem[i] = (float) st->hBWE_TD->genSHBsynth_Hilbert_Mem_fx[i] / ( 1 << 11 ); + } + for ( int i = 0; i < 2 * ALLPASSSECTIONS_STEEP; i++ ) + { + st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local[i] = (float) st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32[i] / ( 1 << 11 ); + } + for ( int i = 0; i < L_SHB_TRANSITION_LENGTH; i++ ) + { + st->hBWE_TD->old_tbe_synth[i] = (float) st->hBWE_TD->old_tbe_synth_fx_32[i] / ( 1 << 11 ); + } + for ( int i = 0; i < 2 * ALLPASSSECTIONS_STEEP + 1; i++ ) + { + st->hBWE_TD->mem_resamp_HB_32k[i] = (float) st->hBWE_TD->mem_resamp_HB_32k_fx_32[i] / ( 1 << 11 ); + } + for ( int i = 0; i < 2 * ALLPASSSECTIONS_STEEP + 1; i++ ) + { + st->hBWE_TD->state_lsyn_filt_dwn_shb[i] = (float) st->hBWE_TD->state_lsyn_filt_dwn_shb_fx_32[i] / ( 1 << 11 ); + st->hBWE_TD->state_lsyn_filt_shb[i] = (float) st->hBWE_TD->state_lsyn_filt_shb_fx_32[i] / ( 1 << 11 ); + } + for ( int i = 0; i < INTERP_3_1_MEM_LEN; i++ ) + { + st->hBWE_TD->mem_resamp_HB[i] = (float) st->hBWE_TD->mem_resamp_HB_fx_32[i] / ( 1 << 11 ); + } } + // Delete till here } /*---------------------------------------------------------------------* diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index b9dd78613f1e926ff85ee9a6fbe379806f9b8aee..2220763db516ce5d3f0d29e59cc3064ce65db6c7 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1337,6 +1337,7 @@ typedef struct td_bwe_dec_structure float syn_overlap[L_SHB_LAHEAD]; /* overlap buffer used to Adjust SHB Frame Gain*/ Word16 syn_overlap_fx[L_SHB_LAHEAD]; /* overlap buffer used to Adjust SHB Frame Gain*/ + Word32 syn_overlap_fx_32[L_SHB_LAHEAD]; /* overlap buffer used to Adjust SHB Frame Gain*/ /* previous frame parameters for frame error concealment */ float lsp_prevfrm[LPC_SHB_ORDER]; @@ -1353,6 +1354,7 @@ typedef struct td_bwe_dec_structure float old_bwe_exc[PIT16k_MAX * 2]; /* old excitation */ Word16 old_bwe_exc_fx[PIT16k_MAX * 2]; /*Q_exc*/ + Word32 old_bwe_exc_fx_32[PIT16k_MAX * 2]; /*Q_exc*/ int16_t bwe_seed[2]; Word16 bwe_seed_fx[2]; /*Q0*/ @@ -1379,18 +1381,23 @@ typedef struct td_bwe_dec_structure float genSHBsynth_state_lsyn_filt_shb_local[2 * ALLPASSSECTIONS_STEEP]; Word16 genSHBsynth_state_lsyn_filt_shb_local_fx[2 * ALLPASSSECTIONS_STEEP]; + Word32 genSHBsynth_state_lsyn_filt_shb_local_fx_32[2 * ALLPASSSECTIONS_STEEP]; float state_lsyn_filt_shb[2 * ALLPASSSECTIONS_STEEP]; Word16 state_lsyn_filt_shb_fx[2 * ALLPASSSECTIONS_STEEP]; + Word32 state_lsyn_filt_shb_fx_32[2 * ALLPASSSECTIONS_STEEP]; float state_lsyn_filt_dwn_shb[2 * ALLPASSSECTIONS_STEEP]; Word16 state_lsyn_filt_dwn_shb_fx[2 * ALLPASSSECTIONS_STEEP]; + Word32 state_lsyn_filt_dwn_shb_fx_32[2 * ALLPASSSECTIONS_STEEP]; float mem_resamp_HB[INTERP_3_1_MEM_LEN]; Word16 mem_resamp_HB_fx[INTERP_3_1_MEM_LEN]; + Word32 mem_resamp_HB_fx_32[INTERP_3_1_MEM_LEN]; float mem_resamp_HB_32k[2 * ALLPASSSECTIONS_STEEP + 1]; Word16 mem_resamp_HB_32k_fx[2 * ALLPASSSECTIONS_STEEP + 1]; + Word32 mem_resamp_HB_32k_fx_32[2 * ALLPASSSECTIONS_STEEP + 1]; Word16 state_32and48k_WB_upsample_fx[2 * ALLPASSSECTIONS_STEEP]; /* !!! this memory in FLP is called mem_resamp_HB */ @@ -1512,9 +1519,11 @@ typedef struct td_bwe_dec_structure float old_tbe_synth[L_SHB_TRANSITION_LENGTH]; Word16 old_tbe_synth_fx[L_SHB_TRANSITION_LENGTH]; + Word32 old_tbe_synth_fx_32[L_SHB_TRANSITION_LENGTH]; float int_3_over_2_tbemem_dec[INTERP_3_2_MEM_LEN]; Word16 int_3_over_2_tbemem_dec_fx[INTERP_3_2_MEM_LEN]; + Word32 int_3_over_2_tbemem_dec_fx_32[INTERP_3_2_MEM_LEN]; float old_hb_synth[L_FRAME48k]; Word16 old_hb_synth_fx[L_FRAME48k]; diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index 72dbade576659f5af2259fa32e55ad4ae0879183..8664d2c01972156d2d840234d54cd4407efd022a 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -39,6 +39,8 @@ #include #include "cnst.h" #include "prot.h" +#include "prot_fx1.h" +#include "prot_fx2.h" #include "rom_com.h" #include "rom_dec.h" #include "wmc_auto.h" @@ -2182,7 +2184,64 @@ void GenTransition( return; } +#ifdef IVAS_FLOAT_FIXED +void GenTransition_fixed( + TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ + Word32 *outputHB_fx, /* o : synthesized HB transitions signal */ + const Word32 output_Fs, /* i : output sampling rate */ + const Word16 element_mode, /* i : element mode */ + const Word16 L_frame, /* i : ACELP frame length */ + const Word16 rf_flag, /* i : RF flag */ + const Word32 total_brate /* i : total bitrate */ +) +{ + Word16 i, length; + + Word32 syn_overlap_32k_fx[2 * SHB_OVERLAP_LEN]; + + /* set targeted length of transition signal */ + length = 2 * NS2SA( output_Fs, DELAY_BWE_TOTAL_NS ); + + /* upsample overlap snippet */ + Interpolate_allpass_steep_32( hBWE_TD->syn_overlap_fx_32, hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, SHB_OVERLAP_LEN, syn_overlap_32k_fx ); + + /* perFORm spectral flip and downmix with overlap snippet to match HB synth */ + IF( ( element_mode == EVS_MONO && ( rf_flag || total_brate == ACELP_9k60 ) ) || ( element_mode > EVS_MONO && L_frame == L_FRAME ) ) + { + flip_and_downmix_generic_fx_32( syn_overlap_32k_fx, syn_overlap_32k_fx, 2 * SHB_OVERLAP_LEN, hBWE_TD->genSHBsynth_Hilbert_Mem_fx, hBWE_TD->genSHBsynth_Hilbert_Mem_fx + HILBERT_ORDER1, hBWE_TD->genSHBsynth_Hilbert_Mem_fx + ( HILBERT_ORDER1 + 2 * HILBERT_ORDER2 ), &( hBWE_TD->syn_dm_phase ) ); + } + ELSE + { + FOR( i = 0; i < 2 * SHB_OVERLAP_LEN; i++ ) + { + syn_overlap_32k_fx[i] = ( ( i % 2 ) == 0 ) ? ( -syn_overlap_32k_fx[i] ) : ( syn_overlap_32k_fx[i] ); + } + } + /* cross fade of overlap snippet and mirrored HB synth from previous frame */ + FOR( i = 0; i < 2 * L_SHB_LAHEAD; i++ ) + { + outputHB_fx[i] = L_add_sat( Mpy_32_16_1( hBWE_TD->old_tbe_synth_fx_32[L_SHB_TRANSITION_LENGTH - 1 - i], window_shb_32k_fx[i] ), Mpy_32_16_1( syn_overlap_32k_fx[i], window_shb_32k_fx[2 * L_SHB_LAHEAD - 1 - i] ) ); + } + + /* fill transition signal with mirrored HB synth from previous frame to fully fill delay alignment buffer gap */ + FOR( ; i < length; i++ ) + { + outputHB_fx[i] = hBWE_TD->old_tbe_synth_fx[L_SHB_TRANSITION_LENGTH - 1 - i]; + } + + IF( output_Fs == 48000 ) + { + interpolate_3_over_2_allpass_32( outputHB_fx, length, outputHB_fx, hBWE_TD->int_3_over_2_tbemem_dec_fx_32 ); + } + ELSE IF( output_Fs == 16000 ) + { + Decimate_allpass_steep_fx32( outputHB_fx, hBWE_TD->mem_resamp_HB_32k_fx_32, L_FRAME32k, outputHB_fx ); + } + + return; +} +#endif /*---------------------------------------------------------------------* * GenTransition_WB() * @@ -2240,8 +2299,60 @@ void GenTransition_WB( return; } +#ifdef IVAS_FLOAT_FIXED +void GenTransition_WB_fixed( + TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */ + Word32 *outputHB_fx, /* o : synthesized HB transitions signal */ + const Word32 output_Fs /* i : output sampling rate */ +) +{ + Word16 i, length; + Word32 speech_buf_16k1_fx[SHB_OVERLAP_LEN], speech_buf_16k2_fx[2 * SHB_OVERLAP_LEN]; + Word32 upsampled_synth_fx[L_FRAME48k]; + + /* set targeted length of transition signal */ + length = 2 * NS2SA( output_Fs, DELAY_BWE_TOTAL_NS ); + + /* upsample overlap snippet */ + Interpolate_allpass_steep_32( hBWE_TD->syn_overlap_fx_32, hBWE_TD->state_lsyn_filt_shb_fx_32, SHB_OVERLAP_LEN / 2, speech_buf_16k1_fx ); + Interpolate_allpass_steep_32( speech_buf_16k1_fx, hBWE_TD->state_lsyn_filt_dwn_shb_fx_32, SHB_OVERLAP_LEN, speech_buf_16k2_fx ); + /* perform spectral flip and downmix with overlap snippet to match HB synth */ + FOR( i = 0; i < SHB_OVERLAP_LEN; i++ ) + { + speech_buf_16k2_fx[i] = ( ( i % 2 ) == 0 ) ? ( -speech_buf_16k2_fx[i] ) : ( speech_buf_16k2_fx[i] ); + } + + /* cross fade of overlap snippet and mirrored HB synth from previous frame */ + FOR( i = 0; i < L_SHB_LAHEAD; i++ ) + { + outputHB_fx[i] = L_add( Mpy_32_16_1( hBWE_TD->old_tbe_synth_fx_32[L_SHB_TRANSITION_LENGTH - 1 - i], window_shb_fx[i] ), Mpy_32_16_1( speech_buf_16k2_fx[i], window_shb_fx[L_SHB_LAHEAD - 1 - i] ) ); + outputHB_fx[i] = Mpy_32_16_1( outputHB_fx[i], 21299 ); + } + /* fill transition signal with mirrored HB synth from previous frame to fully fill delay alignment buffer gap */ + FOR( ; i < length; i++ ) + { + outputHB_fx[i] = hBWE_TD->old_tbe_synth_fx_32[L_SHB_TRANSITION_LENGTH - 1 - i]; + outputHB_fx[i] = Mpy_32_16_1( outputHB_fx[i], 21299 ); + } + + /* upsampling if necessary */ + IF( output_Fs == 32000 ) + { + Interpolate_allpass_steep_32( outputHB_fx, hBWE_TD->mem_resamp_HB_fx_32, L_FRAME16k, upsampled_synth_fx ); + Copy32( upsampled_synth_fx, outputHB_fx, L_FRAME32k ); + } + ELSE IF( output_Fs == 48000 ) + { + interpolate_3_over_1_allpass_32( outputHB_fx, L_FRAME16k, upsampled_synth_fx, hBWE_TD->mem_resamp_HB_fx_32 ); + Copy32( upsampled_synth_fx, outputHB_fx, L_FRAME48k ); + } + + return; +} + +#endif /*---------------------------------------------------------------------* * void TBEreset_dec() * @@ -2314,6 +2425,7 @@ void td_bwe_dec_init( /* init. SHB buffers */; set_f( hBWE_TD->old_bwe_exc, 0.0f, ( PIT16k_MAX * 2 ) ); + set32_fx( hBWE_TD->old_bwe_exc_fx_32, 0, ( PIT16k_MAX * 2 ) ); hBWE_TD->bwe_seed[0] = 23; /* 1; */ hBWE_TD->bwe_seed[1] = 59; /* 10000; */ set_f( hBWE_TD->old_bwe_exc_extended, 0.0f, NL_BUFF_OFFSET ); @@ -2339,7 +2451,9 @@ void td_bwe_dec_init( } set_f( hBWE_TD->mem_resamp_HB, 0, INTERP_3_1_MEM_LEN ); + set32_fx( hBWE_TD->mem_resamp_HB_fx_32, 0, INTERP_3_1_MEM_LEN ); set_f( hBWE_TD->mem_resamp_HB_32k, 0, 2 * ALLPASSSECTIONS_STEEP + 1 ); + set32_fx( hBWE_TD->mem_resamp_HB_32k_fx_32, 0, 2 * ALLPASSSECTIONS_STEEP + 1 ); hBWE_TD->tilt_mem = 0.0f; set_f( hBWE_TD->prev_lsf_diff, 0.5f, LPC_SHB_ORDER - 2 ); @@ -2372,4 +2486,4 @@ void td_bwe_dec_init( hBWE_TD->prev_ener = 0.0f; return; -} +} \ No newline at end of file