diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters index b9769e3ec6a62093e8d490955823c8466cfc7b77..5dabcfd91f636419343a3356e641aea94fe0f528 100644 --- a/Workspace_msvc/lib_com.vcxproj.filters +++ b/Workspace_msvc/lib_com.vcxproj.filters @@ -619,7 +619,7 @@ common_h - common_all_c + common_h diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 9fe14b5bdf2bd06c018ddcee0caee93b4913d238..6fc453d09c722a1e5e7ecbf4e20d3480ac24d0a0 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -6649,12 +6649,7 @@ void hf_synth_fx( Word16 *synth, /* i : 12.8kHz synthesis signal Q_syn2*/ Word16 *synth16k, /* o : 16kHz synthesis signal Q_syn2*/ const Word16 Q_exc, /* i : excitation scaling */ - const Word16 Q_syn2, /* i : synthesis scaling */ - Word16 *delay_syn_hf, /*i/o: HF synthesis memory Q_syn2*/ - Word16 *memExp1, /* o : HF excitation exponent */ - Word16 *mem_hp_interp, /* i/o: interpol. memory Qx*/ - const Word16 extl, /* i : flag indicating BWE Q0*/ - const Word16 CNG_mode /* i : CNG_mode Q0*/ + const Word16 Q_syn2 /* i : synthesis scaling */ ); void hf_synth_amr_wb_init_fx( @@ -9626,13 +9621,6 @@ void set32_fx( const Word16 N /* i : Lenght of the vector */ ); -void delay_signal_fx( - Word32 x[], /* i/o: signal to be delayed */ - const Word16 len, /* i : length of the input signal */ - Word32 mem[], /* i/o: synchronization memory */ - const Word16 delay /* i : delay in samples */ -); - void delay_signal_q_adj_fx( Word32 x[], /* i/o: signal to be delayed */ const Word16 len, /* i : length of the input signal */ @@ -9770,20 +9758,24 @@ void addBassPostFilter_ivas_fx( Word32 **iAnalysis_fx, HANDLE_CLDFB_FILTER_BANK cldfb ); -Word32 ism_dequant_meta_fx( /* o : Q22*/ - const Word16 idx, /* i : quantizer index */ - const Word32 borders_fx[], /* i : level borders Q22*/ - const Word32 q_step_fx, /* i : quantization step Q22 */ - const Word32 q_step_border_fx, /* i : quantization step at the border Q22*/ - const Word16 cbsize /* i : codebook size */ +/* o : Q22*/ +Word32 ism_dequant_meta_fx( + const Word16 idx, /* i : quantizer index */ + const Word32 borders_fx[], /* i : level borders Q22*/ + const Word32 q_step_fx, /* i : quantization step Q22 */ + const Word32 q_step_border_fx, /* i : quantization step at the border Q22*/ + const Word16 cbsize /* i : codebook size */ ); void save_synthesis_hq_fec_fx( Decoder_State *st, /* i/o: decoder state structure */ + const Word16 synth_fx[], /* i : decoded synthesis (EVS) */ const Word32 output_fx[], /* i : decoded synthesis */ const Word16 output_frame, /* i : decoded synthesis */ + const Word16 Qpostd, /* i : Q value of delayed signal */ CPE_DEC_HANDLE hCPE /* i : CPE decoder structure */ ); + void calculate_nbits_meta_fx( const Word16 nchan_ism, Word32 q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], // Q30 @@ -10548,15 +10540,15 @@ void floating_point_add( const Word32 my, /* i: mantissa of the adder Q31 */ const Word16 ey /* i: exponent of the adder Q0 */ ); -/*delay_signal_fx is also present*/ -void delay_signal( + +void delay_signal_fx( Word16 x[], /* i/o: signal to be delayed */ const Word16 len, /* i : length of the input signal */ Word16 mem[], /* i/o: synchronization memory */ const Word16 delay /* i : delay in samples */ ); -void delay_signal32( +void delay_signal32_fx( Word32 x[], /* i/o: signal to be delayed */ const Word16 len, /* i : length of the input signal */ Word32 mem[], /* i/o: synchronization memory */ diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 1aa0bb84a3488db7f4a661d1dd07f311c445f437..fad2d64a8f4686f5b309cdaaa7dcc645ab028be8 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -4004,13 +4004,14 @@ void floating_point_add( move16(); return; } + /*-------------------------------------------------------------------* - * delay_signal() + * delay_signal_fx() * * Delay buffer by defined number of samples *-------------------------------------------------------------------*/ -void delay_signal( +void delay_signal_fx( Word16 x[], /* i/o: signal to be delayed */ const Word16 len, /* i : length of the input signal */ Word16 mem[], /* i/o: synchronization memory */ @@ -4027,14 +4028,13 @@ void delay_signal( return; } -void delay_signal_fx( +void delay_signal32_fx( Word32 x[], /* i/o: signal to be delayed */ const Word16 len, /* i : length of the input signal */ Word32 mem[], /* i/o: synchronization memory */ const Word16 delay /* i : delay in samples */ ) { - Word32 tmp_buffer[L_FRAME48k]; Copy32( mem, tmp_buffer, delay ); @@ -4044,6 +4044,7 @@ void delay_signal_fx( return; } + void delay_signal_q_adj_fx( Word32 x[], /* i/o: signal to be delayed */ const Word16 len, /* i : length of the input signal */ @@ -4136,30 +4137,6 @@ void v_shr_16( return; } -/*-------------------------------------------------------------------* - * delay_signal() - * - * Delay buffer by defined number of samples - *-------------------------------------------------------------------*/ - -void delay_signal32( - Word32 x[], /* i/o: signal to be delayed */ - const Word16 len, /* i : length of the input signal */ - Word32 mem[], /* i/o: synchronization memory */ - const Word16 delay /* i : delay in samples */ -) -{ - Word32 tmp_buffer[L_FRAME48k]; - - Copy32( mem, tmp_buffer, delay ); - Copy32( x + sub( len, delay ), mem, delay ); - Copy32( x, x + delay, sub( len, delay ) ); - Copy32( tmp_buffer, x, delay ); - - return; -} - - /*---------------------------------------------------------------------* * lin_interp_fx() * diff --git a/lib_dec/FEC_HQ_core_fx.c b/lib_dec/FEC_HQ_core_fx.c index 09bc652be8b7cfbb370f18938ca0ac32632bcb56..cc03dcf525f424e500118ee9f8d2362c74ebedd3 100644 --- a/lib_dec/FEC_HQ_core_fx.c +++ b/lib_dec/FEC_HQ_core_fx.c @@ -725,10 +725,9 @@ void HQ_FEC_Mem_update_fx( move32(); #endif move32(); // tmp_energy_fx -#ifdef ADD_IVAS_HQ_CODE_FEC + IF( EQ_16( output_frame, L_FRAME8k ) ) { -#endif IF( is_transient ) { @@ -759,226 +758,222 @@ void HQ_FEC_Mem_update_fx( } } } -#ifndef ADD_IVAS_HQ_CODE_FEC - IF( EQ_16( output_frame, L_FRAME8k ) ) - { -#endif - /* if LR MDCT core is used, recalculate norms from decoded MDCT spectrum (using code from hq_hr_enc_fx()) */ - test(); - IF( ( EQ_16( hqswb_clas, HQ_HVQ ) ) || ( EQ_16( hq_core_type, LOW_RATE_HQ_CORE ) ) ) - { - /* First group */ - logqnorm_fx( t_audio_q_fx, 12, ynrm, 32, WID_G1, (const Word16) EQ_16( hqswb_clas, HQ_HVQ ) ); - j = ynrm[0]; - move16(); - offset = WID_G1; - move16(); - FOR( i = 1; i < SFM_G1; i++ ) - { - logqnorm_fx( &t_audio_q_fx[offset], 12, &ynrm[i], 40, WID_G1, (const Word16) EQ_16( hqswb_clas, HQ_HVQ ) ); - offset = add( offset, WID_G1 ); - } + /* if LR MDCT core is used, recalculate norms from decoded MDCT spectrum (using code from hq_hr_enc_fx()) */ + test(); + IF( ( EQ_16( hqswb_clas, HQ_HVQ ) ) || ( EQ_16( hq_core_type, LOW_RATE_HQ_CORE ) ) ) + { + /* First group */ + logqnorm_fx( t_audio_q_fx, 12, ynrm, 32, WID_G1, (const Word16) EQ_16( hqswb_clas, HQ_HVQ ) ); + j = ynrm[0]; + move16(); + offset = WID_G1; + move16(); - /* Second group */ - FOR( i = SFM_G1; i < SFM_G1 + 2; i++ ) - { - logqnorm_fx( &t_audio_q_fx[offset], 12, &ynrm[i], 40, WID_G2, (const Word16) EQ_16( hqswb_clas, HQ_HVQ ) ); - offset = add( offset, WID_G2 ); - } + FOR( i = 1; i < SFM_G1; i++ ) + { + logqnorm_fx( &t_audio_q_fx[offset], 12, &ynrm[i], 40, WID_G1, (const Word16) EQ_16( hqswb_clas, HQ_HVQ ) ); + offset = add( offset, WID_G1 ); } - /* Memory update for the LGF log2 Norm */ - FOR( i = 0; i < nb_sfm; i++ ) + /* Second group */ + FOR( i = SFM_G1; i < SFM_G1 + 2; i++ ) { - normq_fx[i] = dicn_fx[ynrm[i]]; - move32(); + logqnorm_fx( &t_audio_q_fx[offset], 12, &ynrm[i], 40, WID_G2, (const Word16) EQ_16( hqswb_clas, HQ_HVQ ) ); + offset = add( offset, WID_G2 ); } - k = 0; - move16(); - FOR( i = 0; i < num_Sb; i++ ) - { - norm_values_fx = &hHQ_nbfec->ynrm_values_fx[i][0]; - Copy32( norm_values_fx, &norm_values_fx[1], MAX_PGF - 1 ); + } - L_tmp = L_deposit_l( 0 ); - FOR( j = 0; j < Num_bands_p[i]; j++ ) - { - L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/ - k = add( k, 1 ); - } - tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/ - norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ - move32(); - tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/ + /* Memory update for the LGF log2 Norm */ + FOR( i = 0; i < nb_sfm; i++ ) + { + normq_fx[i] = dicn_fx[ynrm[i]]; + move32(); + } + k = 0; + move16(); + FOR( i = 0; i < num_Sb; i++ ) + { + norm_values_fx = &hHQ_nbfec->ynrm_values_fx[i][0]; + Copy32( norm_values_fx, &norm_values_fx[1], MAX_PGF - 1 ); + + L_tmp = L_deposit_l( 0 ); + FOR( j = 0; j < Num_bands_p[i]; j++ ) + { + L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/ + k = add( k, 1 ); } - test(); - test(); - IF( ( c_switching_flag ) || ( ( st_fx->last_core == ACELP_CORE ) && ( EQ_16( st_fx->core, HQ_CORE ) ) ) ) + tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/ + norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/ + move32(); + tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/ + } + test(); + test(); + IF( ( c_switching_flag ) || ( ( st_fx->last_core == ACELP_CORE ) && ( EQ_16( st_fx->core, HQ_CORE ) ) ) ) + { + FOR( i = 0; i < MAX_SB_NB; i++ ) { - FOR( i = 0; i < MAX_SB_NB; i++ ) + FOR( j = 1; j < MAX_PGF; j++ ) { - FOR( j = 1; j < MAX_PGF; j++ ) - { - hHQ_nbfec->ynrm_values_fx[i][j] = hHQ_nbfec->ynrm_values_fx[i][0]; - move32(); - } + hHQ_nbfec->ynrm_values_fx[i][j] = hHQ_nbfec->ynrm_values_fx[i][0]; + move32(); } } - set16_fx( hHQ_nbfec->Norm_gain_fx, 32767, SFM_N_NB ); /*15*/ - /* st->energy_MA_Curr[1]=Energy of the current frame */ - tmp_fx = inv_tbl_fx[nb_sfm]; - move16(); /*15*/ - L_tmp = Mult_32_16( tmp_energy_fx, tmp_fx ); /*8 + 15 - 15*/ + } + set16_fx( hHQ_nbfec->Norm_gain_fx, 32767, SFM_N_NB ); /*15*/ + /* st->energy_MA_Curr[1]=Energy of the current frame */ + tmp_fx = inv_tbl_fx[nb_sfm]; + move16(); /*15*/ + L_tmp = Mult_32_16( tmp_energy_fx, tmp_fx ); /*8 + 15 - 15*/ - hHQ_nbfec->energy_MA_Curr_fx[1] = extract_h( L_shl_sat( L_tmp, 16 - 8 ) ); - move16(); - /* Moving Average */ - hHQ_nbfec->energy_MA_Curr_fx[0] = s_max( 1, add( mult_r( 26214, hHQ_nbfec->energy_MA_Curr_fx[0] ), mult_r( 6554, hHQ_nbfec->energy_MA_Curr_fx[1] ) ) ); - move16(); + hHQ_nbfec->energy_MA_Curr_fx[1] = extract_h( L_shl_sat( L_tmp, 16 - 8 ) ); + move16(); + /* Moving Average */ + hHQ_nbfec->energy_MA_Curr_fx[0] = s_max( 1, add( mult_r( 26214, hHQ_nbfec->energy_MA_Curr_fx[0] ), mult_r( 6554, hHQ_nbfec->energy_MA_Curr_fx[1] ) ) ); + move16(); + + /*st->diff_energy = (float)fabs((st->energy_MA_Curr[1] - st->energy_MA_Curr[0])/st->energy_MA_Curr[0]); */ + hHQ_nbfec->diff_energy_fx = abs_s( sub( hHQ_nbfec->energy_MA_Curr_fx[1], hHQ_nbfec->energy_MA_Curr_fx[0] ) ); + move16(); + exp1 = sub( norm_l( hHQ_nbfec->diff_energy_fx ), 1 ); + exp2 = norm_l( hHQ_nbfec->energy_MA_Curr_fx[0] ); + hHQ_nbfec->diff_energy_fx = div_s( extract_h( L_shl( hHQ_nbfec->diff_energy_fx, exp1 ) ), extract_h( L_shl( hHQ_nbfec->energy_MA_Curr_fx[0], exp2 ) ) ); + move16(); + exp = add( 15, sub( exp1, exp2 ) ); + hHQ_nbfec->diff_energy_fx = shl( hHQ_nbfec->diff_energy_fx, sub( 11, exp ) ); /*11*/ + move16(); - /*st->diff_energy = (float)fabs((st->energy_MA_Curr[1] - st->energy_MA_Curr[0])/st->energy_MA_Curr[0]); */ - hHQ_nbfec->diff_energy_fx = abs_s( sub( hHQ_nbfec->energy_MA_Curr_fx[1], hHQ_nbfec->energy_MA_Curr_fx[0] ) ); + /* Classify the stationary mode : 12% */ + IF( LT_16( hHQ_nbfec->diff_energy_fx, ED_THRES_12P_fx ) ) + { + stat_mode_curr = 1; move16(); - exp1 = sub( norm_l( hHQ_nbfec->diff_energy_fx ), 1 ); - exp2 = norm_l( hHQ_nbfec->energy_MA_Curr_fx[0] ); - hHQ_nbfec->diff_energy_fx = div_s( extract_h( L_shl( hHQ_nbfec->diff_energy_fx, exp1 ) ), extract_h( L_shl( hHQ_nbfec->energy_MA_Curr_fx[0], exp2 ) ) ); + } + ELSE + { + stat_mode_curr = 0; move16(); - exp = add( 15, sub( exp1, exp2 ) ); - hHQ_nbfec->diff_energy_fx = shl( hHQ_nbfec->diff_energy_fx, sub( 11, exp ) ); /*11*/ + } + + /* Apply Hysteresis to prevent frequent mode changing */ + if ( EQ_16( hHQ_nbfec->stat_mode_old, stat_mode_curr ) ) + { + hHQ_nbfec->stat_mode_out = stat_mode_curr; move16(); + } - /* Classify the stationary mode : 12% */ - IF( LT_16( hHQ_nbfec->diff_energy_fx, ED_THRES_12P_fx ) ) - { - stat_mode_curr = 1; - move16(); - } - ELSE - { - stat_mode_curr = 0; - move16(); - } + hHQ_nbfec->stat_mode_old = stat_mode_curr; + move16(); - /* Apply Hysteresis to prevent frequent mode changing */ - if ( EQ_16( hHQ_nbfec->stat_mode_old, stat_mode_curr ) ) + /* Find max. band index (Minimum value means maximum energy) */ + Min_ind = 0; + move16(); + Min_value = L_deposit_l( 100 ); + FOR( i = 0; i < num_Sb; i++ ) + { + IF( GT_32( Min_value, ynrm[i] ) ) { - hHQ_nbfec->stat_mode_out = stat_mode_curr; + Min_value = ynrm[i]; + move16(); + Min_ind = i; move16(); } + } - hHQ_nbfec->stat_mode_old = stat_mode_curr; - move16(); - - /* Find max. band index (Minimum value means maximum energy) */ - Min_ind = 0; - move16(); - Min_value = L_deposit_l( 100 ); - FOR( i = 0; i < num_Sb; i++ ) + /* Find max. coeff in band 0 */ + Max_ind = 0; + move16(); + IF( Min_ind == 0 ) + { + Max_coeff_fx = L_deposit_l( 0 ); + FOR( i = 0; i < 8; i++ ) { - IF( GT_32( Min_value, ynrm[i] ) ) + L_tmp = L_abs( t_audio_q_fx[i] ); + IF( LT_32( Max_coeff_fx, L_tmp ) ) { - Min_value = ynrm[i]; - move16(); - Min_ind = i; + Max_coeff_fx = L_add( L_tmp, 0 ); + Max_ind = i; move16(); } } + } - /* Find max. coeff in band 0 */ - Max_ind = 0; - move16(); - IF( Min_ind == 0 ) - { - Max_coeff_fx = L_deposit_l( 0 ); - FOR( i = 0; i < 8; i++ ) - { - L_tmp = L_abs( t_audio_q_fx[i] ); - IF( LT_32( Max_coeff_fx, L_tmp ) ) - { - Max_coeff_fx = L_add( L_tmp, 0 ); - Max_ind = i; - move16(); - } - } - } + /* Find energy difference from band 16 */ + k = 1; + move16(); - /* Find energy difference from band 16 */ - k = 1; + FOR( i = k; i < num_Sb; i++ ) + { + en_high_fx[i] = L_deposit_l( 0 ); move16(); - - FOR( i = k; i < num_Sb; i++ ) + FOR( j = 0; j < 2; j++ ) { - en_high_fx[i] = L_deposit_l( 0 ); - move16(); - FOR( j = 0; j < 2; j++ ) - { - /*en_high[i] += 0.5f*st->ynrm_values[i][j+1];*/ - en_high_fx[i] = L_add( en_high_fx[i], L_shr( hHQ_nbfec->ynrm_values_fx[i][j + 1], 1 ) ); /*Q12*/ - move32(); - } + /*en_high[i] += 0.5f*st->ynrm_values[i][j+1];*/ + en_high_fx[i] = L_add( en_high_fx[i], L_shr( hHQ_nbfec->ynrm_values_fx[i][j + 1], 1 ) ); /*Q12*/ + move32(); } + } - *mean_en_high_fx = 0; - move16(); - FOR( i = k; i < num_Sb; i++ ) - { - /* *mean_en_high += (float)(en_high[i]/st->ynrm_values[i][0]);*/ - exp1 = sub( norm_l( en_high_fx[i] ), 1 ); - exp2 = norm_l( hHQ_nbfec->ynrm_values_fx[i][0] ); - tmp_fx = div_s( extract_h( L_shl( en_high_fx[i], exp1 ) ), extract_h( L_shl( hHQ_nbfec->ynrm_values_fx[i][0], exp2 ) ) ); - exp = add( 15, sub( exp1, exp2 ) ); - *mean_en_high_fx = add_o( *mean_en_high_fx, shr_o( tmp_fx, sub( exp, 5 ), &Overflow ), &Overflow ); - move16(); - } - *mean_en_high_fx = mult( *mean_en_high_fx, inv_tbl_fx[sub( num_Sb, k )] ); + *mean_en_high_fx = 0; + move16(); + FOR( i = k; i < num_Sb; i++ ) + { + /* *mean_en_high += (float)(en_high[i]/st->ynrm_values[i][0]);*/ + exp1 = sub( norm_l( en_high_fx[i] ), 1 ); + exp2 = norm_l( hHQ_nbfec->ynrm_values_fx[i][0] ); + tmp_fx = div_s( extract_h( L_shl( en_high_fx[i], exp1 ) ), extract_h( L_shl( hHQ_nbfec->ynrm_values_fx[i][0], exp2 ) ) ); + exp = add( 15, sub( exp1, exp2 ) ); + *mean_en_high_fx = add_o( *mean_en_high_fx, shr_o( tmp_fx, sub( exp, 5 ), &Overflow ), &Overflow ); move16(); + } + *mean_en_high_fx = mult( *mean_en_high_fx, inv_tbl_fx[sub( num_Sb, k )] ); + move16(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + IF( ( LT_16( Min_ind, 5 ) ) && ( LT_16( abs_s( sub( Min_ind, hHQ_nbfec->old_Min_ind ) ), 2 ) ) && ( LT_16( hHQ_nbfec->diff_energy_fx, ED_THRES_90P_fx ) ) && ( !st_fx->bfi ) && ( !st_fx->prev_bfi ) && ( !st_fx->prev_old_bfi ) && ( !is_transient ) && ( !hHQ_core->old_is_transient[1] ) && EQ_16( hHQ_nbfec->prev_last_core, HQ_CORE ) && EQ_16( st_fx->last_core, HQ_CORE ) ) + { + hHQ_nbfec->phase_mat_flag = 1; + move16(); test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - IF( ( LT_16( Min_ind, 5 ) ) && ( LT_16( abs_s( sub( Min_ind, hHQ_nbfec->old_Min_ind ) ), 2 ) ) && ( LT_16( hHQ_nbfec->diff_energy_fx, ED_THRES_90P_fx ) ) && ( !st_fx->bfi ) && ( !st_fx->prev_bfi ) && ( !st_fx->prev_old_bfi ) && ( !is_transient ) && ( !hHQ_core->old_is_transient[1] ) && EQ_16( hHQ_nbfec->prev_last_core, HQ_CORE ) && EQ_16( st_fx->last_core, HQ_CORE ) ) - { - hHQ_nbfec->phase_mat_flag = 1; - move16(); - test(); - if ( Min_ind == 0 && ( LT_16( Max_ind, 3 ) ) ) - { - hHQ_nbfec->phase_mat_flag = 0; - move16(); - } - } - ELSE + if ( Min_ind == 0 && ( LT_16( Max_ind, 3 ) ) ) { hHQ_nbfec->phase_mat_flag = 0; move16(); } - - hHQ_nbfec->old_Min_ind = Min_ind; + } + ELSE + { + hHQ_nbfec->phase_mat_flag = 0; move16(); } + hHQ_nbfec->old_Min_ind = Min_ind; + move16(); + + FOR( i = 0; i < L_FRAME8k; i++ ) { hHQ_nbfec->old_coeffs_fx[i] = t_audio_q_fx[i]; move32(); } - - hHQ_core->old_is_transient[2] = hHQ_core->old_is_transient[1]; - move16(); - hHQ_core->old_is_transient[1] = hHQ_core->old_is_transient[0]; - move16(); - hHQ_core->old_is_transient[0] = is_transient; - move16(); -#ifdef ADD_IVAS_HQ_CODE_FEC } -#endif + + hHQ_core->old_is_transient[2] = hHQ_core->old_is_transient[1]; + move16(); + hHQ_core->old_is_transient[1] = hHQ_core->old_is_transient[0]; + move16(); + hHQ_core->old_is_transient[0] = is_transient; + move16(); + return; } @@ -1961,11 +1956,18 @@ static void Next_good_after_burst_erasures_fx( return; } +/*-------------------------------------------------------------------------- + * save_synthesis_hq_fec_fx() + * + * Save synthesis for HQ FEC + *-------------------------------------------------------------------------*/ void save_synthesis_hq_fec_fx( Decoder_State *st, /* i/o: decoder state structure */ + const Word16 synth_fx[], /* i : decoded synthesis (EVS) */ const Word32 output_fx[], /* i : decoded synthesis */ const Word16 output_frame, /* i : decoded synthesis */ + const Word16 Qpostd, /* i : Q value of delayed signal */ CPE_DEC_HANDLE hCPE /* i : CPE decoder structure */ ) { @@ -2004,138 +2006,55 @@ void save_synthesis_hq_fec_fx( test(); IF( ( EQ_16( st->codec_mode, MODE1 ) && st->hTcxDec != NULL ) && ( ( ( st->core == ACELP_CORE ) && !( EQ_16( st->bfi, 1 ) && EQ_16( st->con_tcx, 1 ) ) ) || EQ_16( st->core, HQ_CORE ) ) ) { - Copy( st->hTcxDec->synth_history_fx + output_frame, st->hTcxDec->synth_history_fx, add( sub( output_frame, post_hq_delay ), NS2SA_FX2( st->output_Fs, PH_ECU_MEM_NS ) ) ); - FOR( Word16 i = 0; i < output_frame; i++ ) - { - st->hTcxDec->old_synthFB_fx[( ( i + output_frame ) - post_hq_delay )] = extract_h( L_shl_sat( output_fx[i], 16 ) ); // Q16 - move16(); - } - IF( st->element_mode == EVS_MONO ) { + Copy( st->hTcxDec->synth_history_fx + output_frame, st->hTcxDec->synth_history_fx, add( sub( output_frame, post_hq_delay ), NS2SA_FX2( st->output_Fs, PH_ECU_MEM_NS ) ) ); /*hTcxDec->q_synth_history_fx*/ + Copy_Scale_sig( synth_fx, st->hTcxDec->old_synthFB_fx + sub( output_frame, post_hq_delay ), output_frame, negate( Qpostd ) ); /* output_sp not initialized yet */ /* reset the remaining buffer, which is read in TCX concealment the necessary samples to fill this buffer are not available for all cases, the impact on the output is limited */ - set16_fx( st->hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), post_hq_delay ), 0, post_hq_delay ); + IF( GE_16( output_frame, L_FRAME16k ) ) { - Copy( st->prev_synth_buffer_fx, st->hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_FX2( st->output_Fs, DELAY_BWE_TOTAL_NS ) ), NS2SA_FX2( st->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ) ); + Copy_Scale_sig( st->prev_synth_buffer_fx, st->hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_FX2( st->output_Fs, DELAY_BWE_TOTAL_NS ) ), NS2SA_FX2( st->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ), negate( st->Qprev_synth_buffer_fx ) ); /*Q0*/ } - ELSE + /* IVAS Floating point code has the commented-out else branch below, but it does not appear to be necessary. To be verified + else { - Copy( st->hHQ_core->old_out_fx + NS2SA_FX2( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB_fx + shl( output_frame, 1 ), NS2SA_FX2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); + mvr2r( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB + 2 * output_frame, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); } + */ IF( st->core != ACELP_CORE ) { IF( GE_16( output_frame, L_FRAME16k ) ) { - Copy( st->delay_buf_out_fx, st->hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_FX2( st->output_Fs, DELAY_CLDFB_NS ) ), NS2SA_FX2( st->output_Fs, DELAY_CLDFB_NS ) ); - Copy( st->hHQ_core->old_out_fx + NS2SA_FX2( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB_fx + shl( output_frame, 1 ), NS2SA_FX2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); + Copy_Scale_sig( st->delay_buf_out_fx, st->hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_FX2( st->output_Fs, DELAY_CLDFB_NS ) ), NS2SA_FX2( st->output_Fs, DELAY_CLDFB_NS ), negate( Qpostd ) ); /*Q0*/ + Copy_Scale_sig( st->hHQ_core->old_out_fx + NS2SA_FX2( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB_fx + shl( output_frame, 1 ), NS2SA_FX2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ), negate( st->hHQ_core->Q_old_wtda ) ); /*Q0*/ } ELSE { - Copy( st->delay_buf_out_fx, st->hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_FX2( st->output_Fs, DELAY_BWE_TOTAL_NS ) ), NS2SA_FX2( st->output_Fs, DELAY_CLDFB_NS ) ); - Copy( st->hHQ_core->old_out_fx + NS2SA_FX2( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_FX2( st->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ) ), NS2SA_FX2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); + + Copy_Scale_sig( st->delay_buf_out_fx, st->hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_FX2( st->output_Fs, DELAY_BWE_TOTAL_NS ) ), NS2SA_FX2( st->output_Fs, DELAY_CLDFB_NS ), negate( Qpostd ) ); /*Q0*/ + Copy_Scale_sig( st->hHQ_core->old_out_fx + NS2SA_FX2( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_FX2( st->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ) ), NS2SA_FX2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ), negate( st->hHQ_core->Q_old_wtda ) ); /*Q0*/ } } } ELSE { - IF( st->core != ACELP_CORE ) - { - Copy( st->delay_buf_out_fx, st->hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), post_hq_delay ), post_hq_delay ); - Copy( st->hHQ_core->old_out_fx + NS2SA_FX2( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB_fx + shl( output_frame, 1 ), NS2SA_FX2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); - } - } - } - return; -} - - -#ifdef ADD_IVAS_HQ_CODE_FEC -/*-------------------------------------------------------------------------- - * save_synthesis_hq_fec() - * - * Save synthesis for HQ FEC - *-------------------------------------------------------------------------*/ - -void save_synthesis_hq_fec( - Decoder_State *st, /* i/o: decoder state structure */ - const float *output, /* i : decoded synthesis */ - const int16_t output_frame, /* i : decoded synthesis */ - CPE_DEC_HANDLE hCPE /* i : CPE decoder structure */ -) -{ - int16_t post_hq_delay; - - switch ( st->element_mode ) - { - case EVS_MONO: - post_hq_delay = NS2SA( st->output_Fs, POST_HQ_DELAY_NS ); - break; - case IVAS_SCE: - post_hq_delay = NS2SA( st->output_Fs, DELAY_CLDFB_NS ); - break; - case IVAS_CPE_DFT: - if ( hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) - { - post_hq_delay = NS2SA( st->output_Fs, DELAY_CLDFB_NS ); - } - else - { - post_hq_delay = 0; - } - break; - default: - post_hq_delay = 0; - break; - } - - - if ( ( st->codec_mode == MODE1 && st->hTcxDec != NULL ) && ( ( st->core == ACELP_CORE && !( st->bfi == 1 && st->con_tcx == 1 ) ) || st->core == HQ_CORE ) ) - { - mvr2r( st->hTcxDec->synth_history + output_frame, st->hTcxDec->synth_history, output_frame - post_hq_delay + NS2SA( st->output_Fs, PH_ECU_MEM_NS ) ); - mvr2r( output, st->hTcxDec->old_synthFB + output_frame - post_hq_delay, output_frame ); - - if ( st->element_mode == EVS_MONO ) - { - /* reset the remaining buffer, which is read in TCX concealment the necessary samples to fill - this buffer are not available for all cases, the impact on the output is limited */ - set_f( st->hTcxDec->old_synthFB + 2 * output_frame - post_hq_delay, 0.f, post_hq_delay ); - if ( output_frame >= L_FRAME16k ) + Copy( st->hTcxDec->synth_history_fx + output_frame, st->hTcxDec->synth_history_fx, add( sub( output_frame, post_hq_delay ), NS2SA_FX2( st->output_Fs, PH_ECU_MEM_NS ) ) ); + FOR( Word16 i = 0; i < output_frame; i++ ) { - mvr2r( st->prev_synth_buffer, st->hTcxDec->old_synthFB + 2 * output_frame - NS2SA( st->output_Fs, DELAY_BWE_TOTAL_NS ), NS2SA( st->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ) ); - } - else - { - mvr2r( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB + 2 * output_frame, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); + st->hTcxDec->old_synthFB_fx[( ( i + output_frame ) - post_hq_delay )] = extract_h( L_shl_sat( output_fx[i], 16 ) ); // Q16 + move16(); } - if ( st->core != ACELP_CORE ) - { - if ( output_frame >= L_FRAME16k ) - { - mvr2r( st->delay_buf_out, st->hTcxDec->old_synthFB + 2 * output_frame - NS2SA( st->output_Fs, DELAY_CLDFB_NS ), NS2SA( st->output_Fs, DELAY_CLDFB_NS ) ); - mvr2r( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB + 2 * output_frame, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); - } - else - { - mvr2r( st->delay_buf_out, st->hTcxDec->old_synthFB + 2 * output_frame - NS2SA( st->output_Fs, DELAY_BWE_TOTAL_NS ), NS2SA( st->output_Fs, DELAY_CLDFB_NS ) ); - mvr2r( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB + 2 * output_frame - NS2SA( st->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ), NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); - } - } - } - else - { - if ( st->core != ACELP_CORE ) + IF( st->core != ACELP_CORE ) { - mvr2r( st->delay_buf_out, st->hTcxDec->old_synthFB + 2 * output_frame - post_hq_delay, post_hq_delay ); - mvr2r( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB + 2 * output_frame, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); + Copy( st->delay_buf_out_fx, st->hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), post_hq_delay ), post_hq_delay ); + Copy( st->hHQ_core->old_out_fx + NS2SA_FX2( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB_fx + shl( output_frame, 1 ), NS2SA_FX2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); } } } - return; } -#endif diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index c0ad52a480b9afacbd38829c530d103dded68f0c..0efc7e9a5316bab644ef252d6cf4f01d3e2c5118 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -1472,8 +1472,7 @@ ivas_error acelp_core_dec_fx( IF( ( EQ_16( st_fx->L_frame, L_FRAME ) && NE_16( st_fx->bwidth, NB ) && GE_16( output_frame, L_FRAME16k ) && ( EQ_16( st_fx->extl, -1 ) || EQ_16( st_fx->extl, SWB_CNG ) || ( EQ_16( st_fx->extl, WB_BWE ) && st_fx->extl_brate == 0 && NE_16( st_fx->coder_type, AUDIO ) ) ) ) ) { - hf_synth_fx( st_fx->hBWE_zero, st_fx->core_brate, output_frame, Aq_fx, exc2_fx, syn_fx, synth_out, st_fx->Q_exc, - st_fx->Q_syn2, st_fx->hBWE_zero->delay_syn_hf_fx, &st_fx->hBWE_zero->memExp1, st_fx->hBWE_zero->mem_hp_interp_fx, st_fx->extl, st_fx->CNG_mode ); + hf_synth_fx( st_fx->hBWE_zero, st_fx->core_brate, output_frame, Aq_fx, exc2_fx, syn_fx, synth_out, st_fx->Q_exc, st_fx->Q_syn2 ); } ELSE { diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 7826546236b7c3baffb643a9adb11e38181509d0..e9ef8883fda7cce403d9d5531f3839d20267208b 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -2161,9 +2161,7 @@ ivas_error acelp_core_dec_ivas_fx( #else Copy_Scale_sig_32_16( synth_fx, synth_fx16, L_FRAME48k, 0 ); #endif - hf_synth_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc2_fx, - psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2, st->hBWE_zero->delay_syn_hf_fx, &st->hBWE_zero->memExp1, - st->hBWE_zero->mem_hp_interp_fx, st->extl, st->CNG_mode ); + hf_synth_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc2_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2 ); #ifdef MSAN_FIX Copy_Scale_sig_16_32_DEPREC( synth_fx16, synth_fx, output_frame, 0 ); #else diff --git a/lib_dec/amr_wb_dec_fx.c b/lib_dec/amr_wb_dec_fx.c index d45655903fb6f8f427e3d28ea4f7e91cbd2be7a2..c3e5b689172466583edd3d5414e4d289a2e1f477 100644 --- a/lib_dec/amr_wb_dec_fx.c +++ b/lib_dec/amr_wb_dec_fx.c @@ -1062,7 +1062,7 @@ ivas_error amr_wb_dec_fx( { tmps = NS2SA_FX2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ); Scale_sig( st_fx->prev_synth_buffer_fx, tmps, sub( st_fx->Q_syn2, st_fx->Qprev_synth_buffer_fx ) ); - delay_signal( synth_out_fx, output_frame, st_fx->prev_synth_buffer_fx, tmps ); + delay_signal_fx( synth_out_fx, output_frame, st_fx->prev_synth_buffer_fx, tmps ); } IF( waveadj_rec ) diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 0f361e658628093c61be18cd92a839371e0d868b..34a07b702ed4fac1e33760d93dc53e3eeea5987c 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -978,10 +978,7 @@ ivas_error core_switching_post_dec_fx( Scale_sig( st_fx->delay_buf_out_fx, delay_comp, sub( Qtmp, hHQ_core->Q_old_postdec ) ); /* Qtmp */ hHQ_core->Q_old_postdec = Qtmp; move16(); - - Copy( synth, &synth[delay_comp], output_frame ); /* Qsynth */ - Copy( st_fx->delay_buf_out_fx, synth, delay_comp ); /* Q0 */ - Copy( &synth[output_frame], st_fx->delay_buf_out_fx, delay_comp ); /* Qsynth */ + delay_signal_fx( synth, output_frame, st_fx->delay_buf_out_fx, delay_comp ); /* Qsynth, Q0 */ test(); test(); @@ -1410,13 +1407,7 @@ ivas_error core_switching_post_dec_ivas_fx( Scale_sig( st_fx->delay_buf_out_fx, delay_comp, sub( Qtmp, hHQ_core->Q_old_postdec ) ); /* Qtmp */ hHQ_core->Q_old_postdec = Qtmp; move16(); - Word16 temp_buffer[L_FRAME48k]; - - Copy( st_fx->delay_buf_out_fx, temp_buffer, delay_comp ); /* Q0 */ - Copy( synth + sub( output_frame, delay_comp ), st_fx->delay_buf_out_fx, delay_comp ); /* Qsynth */ - move16(); - Copy( synth, synth + delay_comp, sub( output_frame, delay_comp ) ); /* Qsynth */ - Copy( temp_buffer, synth, delay_comp ); /* Q0 */ + delay_signal_fx( synth, output_frame, st_fx->delay_buf_out_fx, delay_comp ); /* Qsynth, Q0 */ test(); test(); diff --git a/lib_dec/evs_dec_fx.c b/lib_dec/evs_dec_fx.c index f20ff77f30367e0dc15e2f7936f0d46892a4a014..f46e2934021ea18795a2339d6315b4da968b9148 100644 --- a/lib_dec/evs_dec_fx.c +++ b/lib_dec/evs_dec_fx.c @@ -27,7 +27,6 @@ ivas_error evs_dec_fx( Word16 core_switching_flag; Word16 unbits; Word16 hq_core_type; - Word16 post_hq_delay; Word32 bwe_exc_extended_fx[L_FRAME32k + NL_BUFF_OFFSET]; Word16 voice_factors_fx[NB_SUBFR16k]; Word16 hb_synth_fx[L_FRAME48k]; @@ -36,7 +35,7 @@ ivas_error evs_dec_fx( Word16 exp, fra; Word16 tmp_buffer_fx[L_FRAME48k]; Word16 tmp16, tmp16_2; - Word16 synth_fx[L_FRAME48k + HQ_DELTA_MAX * HQ_DELAY_COMP]; + Word16 synth_fx[L_FRAME48k]; Word16 fb_exc_fx[L_FRAME16k]; Word16 pitch_buf_fx[NB_SUBFR16k] = { 0 }; Word16 Q_fb_exc; @@ -492,10 +491,7 @@ ivas_error evs_dec_fx( Scale_sig( st_fx->prev_synth_buffer_fx, tmps, sub( exp, st_fx->Qprev_synth_buffer_fx ) ); /*exp*/ st_fx->Qprev_synth_buffer_fx = exp; move16(); - Copy( synth_fx, tmp_buffer_fx, output_frame ); /*exp*/ - Copy( st_fx->prev_synth_buffer_fx, synth_fx, tmps ); /*st_fx->Qprev_synth_buffer_fx*/ - Copy( tmp_buffer_fx, synth_fx + tmps, output_frame - tmps ); /*exp*/ - Copy( tmp_buffer_fx + output_frame - tmps, st_fx->prev_synth_buffer_fx, tmps ); /*exp*/ + delay_signal_fx( synth_fx, output_frame, st_fx->prev_synth_buffer_fx, tmps ); /*exp, t_fx->Qprev_synth_buffer_fx*/ } ELSE { @@ -640,10 +636,7 @@ ivas_error evs_dec_fx( { Scale_sig( st_fx->hb_prev_synth_buffer_fx, tmps, tmp16 ); /*Q15 - hb_synth_fx_exp*/ } - Copy( hb_synth_fx, tmp_buffer_fx, output_frame ); /*Q15 - hb_synth_fx_exp*/ - Copy( st_fx->hb_prev_synth_buffer_fx, hb_synth_fx, tmps ); /*Q15 - hb_synth_fx_exp*/ - Copy( tmp_buffer_fx, hb_synth_fx + tmps, sub( output_frame, tmps ) ); /*Q15 - hb_synth_fx_exp*/ - Copy( tmp_buffer_fx + sub( output_frame, tmps ), st_fx->hb_prev_synth_buffer_fx, tmps ); /*Q15 - hb_synth_fx_exp*/ + delay_signal_fx( hb_synth_fx, output_frame, st_fx->hb_prev_synth_buffer_fx, tmps ); /*Q15 - hb_synth_fx_exp, Q15 - hb_synth_fx_exp*/ st_fx->old_bwe_delay = tmps; move16(); @@ -1203,10 +1196,9 @@ ivas_error evs_dec_fx( /* Delay compensation for TD-BWE*/ IF( GE_16( output_frame, L_FRAME16k ) ) { - Copy( output_sp, tmp_buffer_fx, output_frame ); /*timeIn_e*/ - Copy_Scale_sig( st_fx->prev_synth_buffer_fx, output_sp, delay_tdbwe, negate( timeIn_e ) ); /*st_fx->q_prev_synth_buffer_fx*/ - Copy( tmp_buffer_fx, output_sp + delay_tdbwe, sub( output_frame, delay_tdbwe ) ); /*timeIn_e*/ - Copy_Scale_sig( tmp_buffer_fx + sub( output_frame, delay_tdbwe ), st_fx->prev_synth_buffer_fx, delay_tdbwe, timeIn_e ); /*timeIn_e*/ + Scale_sig( st_fx->prev_synth_buffer_fx, delay_tdbwe, negate( timeIn_e ) ); + delay_signal_fx( output_sp, output_frame, st_fx->prev_synth_buffer_fx, delay_tdbwe ); /*timeIn_e, st_fx->q_prev_synth_buffer_fx*/ + Scale_sig( st_fx->prev_synth_buffer_fx, delay_tdbwe, timeIn_e ); } test(); @@ -1342,35 +1334,8 @@ ivas_error evs_dec_fx( * Save synthesis for HQ FEC *----------------------------------------------------------------*/ - post_hq_delay = NS2SA_FX2( st_fx->output_Fs, POST_HQ_DELAY_NS ); - IF( EQ_16( st_fx->codec_mode, MODE1 ) ) - { - - Copy( hTcxDec->synth_history_fx + output_frame, hTcxDec->synth_history_fx, add( sub( output_frame, post_hq_delay ), NS2SA_FX2( st_fx->output_Fs, PH_ECU_MEM_NS ) ) ); /*hTcxDec->q_synth_history_fx*/ - Copy_Scale_sig( synth_fx, hTcxDec->old_synthFB_fx + sub( output_frame, post_hq_delay ), output_frame, negate( Qpostd ) ); /* output_sp not initialized yet */ - /* reset the remaining buffer, which is read in TCX concealment the necessary samples to fill - this buffer are not available for all cases, the impact on the output is limited */ - set16_fx( hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), post_hq_delay ), 0, post_hq_delay ); - - IF( GE_16( output_frame, L_FRAME16k ) ) - { - Copy_Scale_sig( st_fx->prev_synth_buffer_fx, hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_FX2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS ) ), NS2SA_FX2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ), negate( st_fx->Qprev_synth_buffer_fx ) ); /*Q0*/ - } - IF( NE_16( st_fx->core, ACELP_CORE ) ) - { - IF( GE_16( output_frame, L_FRAME16k ) ) - { - Copy_Scale_sig( synth_fx + output_frame, hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_FX2( st_fx->output_Fs, DELAY_CLDFB_NS ) ), NS2SA_FX2( st_fx->output_Fs, DELAY_CLDFB_NS ), negate( Qpostd ) ); /*Q0*/ - Copy_Scale_sig( hHQ_core->old_out_fx + NS2SA_FX2( st_fx->output_Fs, N_ZERO_MDCT_NS ), hTcxDec->old_synthFB_fx + shl( output_frame, 1 ), NS2SA_FX2( st_fx->output_Fs, PH_ECU_LOOKAHEAD_NS ), negate( hHQ_core->Q_old_wtda ) ); /*Q0*/ - } - ELSE - { + save_synthesis_hq_fec_fx( st_fx, synth_fx, NULL, output_frame, Qpostd, NULL ); - Copy_Scale_sig( synth_fx + output_frame, hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_FX2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS ) ), NS2SA_FX2( st_fx->output_Fs, DELAY_CLDFB_NS ), negate( Qpostd ) ); /*Q0*/ - Copy_Scale_sig( hHQ_core->old_out_fx + NS2SA_FX2( st_fx->output_Fs, N_ZERO_MDCT_NS ), hTcxDec->old_synthFB_fx + sub( shl( output_frame, 1 ), NS2SA_FX2( st_fx->output_Fs, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS ) ), NS2SA_FX2( st_fx->output_Fs, PH_ECU_LOOKAHEAD_NS ), negate( hHQ_core->Q_old_wtda ) ); /*Q0*/ - } - } - } /*----------------------------------------------------------------* * HP filtering *----------------------------------------------------------------*/ diff --git a/lib_dec/hf_synth_fx.c b/lib_dec/hf_synth_fx.c index ee7a7eca61bb4ef92182e732a772ae6b5c787f0f..94c7d4c6282edf47fa8278add6362ece82625d00 100644 --- a/lib_dec/hf_synth_fx.c +++ b/lib_dec/hf_synth_fx.c @@ -20,7 +20,7 @@ *---------------------------------------------------------------------*/ static void filt_6k_7k_scale_fx( Word16 signal[], Word16 lg, Word16 mem[], Word16 fact, Word16 exp ); -static void hf_synthesis_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, const Word32 core_brate, const Word16 output_subfr, const Word16 Aq[], const Word16 exc[], const Word16 Q_exc, Word16 synth[], Word16 synth16k[], const Word16 Q_syn, Word16 *delay_syn_hf, Word16 *memExp1, Word16 *mem_hp_interp, const Word16 extl, const Word16 CNG_mode ); +static void hf_synthesis_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, const Word32 core_brate, const Word16 output_subfr, const Word16 Aq[], const Word16 exc[], const Word16 Q_exc, Word16 synth[], Word16 synth16k[], const Word16 Q_syn ); static void hf_synthesis_amr_wb_fx( const Word32 core_brate, const Word16 output_subfr, const Word16 Ap[], Word16 exc16k[], Word16 synth_out[], Word16 *mem_syn_hf, Word16 *delay_syn_hf, Word16 *mem_hp_interp, Word16 p_r, Word16 HF_corr_gain, Word16 til, Word16 voice_factors, const Word16 exc[], const Word16 Q_exc, const Word16 Q_out, Word16 qhf ); static void envelope_fx( AMRWB_IO_DEC_HANDLE hAmrwb_IO, const Word32 core_brate, const Word16 Aq[], Word16 Ap[], Word16 *r, Word16 tilt0, Word16 tilt, Word16 voice_factor ); static void AdaptiveStartBand_fx( Word16 *start_band, const Word32 rate, const Word16 *lsf, const Word16 voicing_fac, const Word16 clas, Word16 *voicing_flag, Word16 *start_band_old, Word32 *OptCrit_old ); @@ -86,12 +86,7 @@ void hf_synth_fx( Word16 *synth, /* i : 12.8kHz synthesis signal Q_syn2*/ Word16 *synth16k, /* o : 16kHz synthesis signal Q_syn2*/ const Word16 Q_exc, /* i : excitation scaling */ - const Word16 Q_syn2, /* i : synthesis scaling */ - Word16 *delay_syn_hf, /*i/o: HF synthesis memory Q_syn2*/ - Word16 *memExp1, /* o : HF excitation exponent */ - Word16 *mem_hp_interp, /* i/o: interpol. memory Qx*/ - const Word16 extl, /* i : flag indicating BWE Q0*/ - const Word16 CNG_mode /* i : CNG_mode Q0*/ + const Word16 Q_syn2 /* i : synthesis scaling */ ) { const Word16 *p_Aq; @@ -103,8 +98,7 @@ void hf_synth_fx( p_Aq = Aq; /* Q12 */ FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) { - hf_synthesis_fx( hBWE_zero, core_brate, output_subfr, p_Aq, &exc[i_subfr], Q_exc, &synth[i_subfr], &synth16k[imult3216( (Word32) i_subfr, output_subfr ) / L_SUBFR], - Q_syn2, delay_syn_hf, memExp1, mem_hp_interp, extl, CNG_mode ); + hf_synthesis_fx( hBWE_zero, core_brate, output_subfr, p_Aq, &exc[i_subfr], Q_exc, &synth[i_subfr], &synth16k[imult3216( (Word32) i_subfr, output_subfr ) / L_SUBFR], Q_syn2 ); p_Aq += ( M + 1 ); /* Q12 */ } @@ -132,27 +126,19 @@ static void hf_synthesis_fx( const Word16 Q_exc, /* i : excitation scaling */ Word16 synth[], /* i : 12.8kHz synthesis signal Q_syn*/ Word16 synth16k[], /* i/o: 16kHz synthesis signal Q_syn*/ - const Word16 Q_syn, /* i : synthesis scaling */ - Word16 *delay_syn_hf, /* i/o: HF synthesis memory Q_syn*/ - Word16 *memExp1, /* o : HF excitation scaling exponent */ - Word16 *mem_hp_interp, /* i/o: interpol. memory Qx*/ - const Word16 extl, /* i : flag indicating BWE Q0*/ - const Word16 CNG_mode /* i : CNG_mode Q0*/ + const Word16 Q_syn /* i : synthesis scaling */ ) { - Word16 i; + Word16 i, s; Word16 HF_syn[L_SUBFR16k], upsampled_HF_syn[L_FRAME48k / NB_SUBFR]; Word16 HF_exc[L_SUBFR16k]; - Word16 temp_buffer[NS2SA( 16000, DELAY_CLDFB_NS ) - L_FILT16k]; - Word16 tmp, ener, exp1, exp2, scale, delay; + Word16 tmp, ener, exp1, exp2, scale; Word32 L_tmp; Word16 Ap[M16k + 1]; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); #endif - (void) extl; - (void) CNG_mode; /*-----------------------------------------------------------------* * generate white noise vector @@ -188,8 +174,8 @@ static void hf_synthesis_fx( L_tmp = Isqrt_lc( L_tmp, &exp1 ); scale = round_fx( L_tmp ); /* Q18 when Q_exc=-1, HF_exc in Q-3 */ - exp2 = sub( *memExp1, exp1 ); - *memExp1 = exp1; + exp2 = sub( hBWE_zero->memExp1, exp1 ); + hBWE_zero->memExp1 = exp1; move16(); /*-----------------------------------------------------------------* @@ -279,41 +265,31 @@ static void hf_synthesis_fx( *-----------------------------------------------------------------*/ /* delay by 5 samples @16kHz to compensate CLDFB resampling delay (20samples) and HP filtering delay (roughly 15 samples) */ - delay = NS2SA_FX2( 16000, DELAY_CLDFB_NS ) - 15; - Copy( HF_syn + sub( L_SUBFR16k, delay ), temp_buffer, delay ); /* Q_syn+exp1 */ - Copy( HF_syn, HF_syn + delay, sub( L_SUBFR16k, delay ) ); /* Q_syn+exp1 */ - Copy( delay_syn_hf, HF_syn, delay ); /* Q_syn */ - Copy( temp_buffer, delay_syn_hf, delay ); /* Q_syn */ + delay_signal_fx( HF_syn, L_SUBFR16k, hBWE_zero->delay_syn_hf_fx, NS2SA_FX2( 16000, DELAY_CLDFB_NS ) - 15 ); /* interpolate the HF synthesis */ IF( EQ_16( output_subfr, L_SUBFR48k ) ) /* 48kHz sampled output */ { - { - Word16 s; - s = s_max( s_min( sub( s_min( Find_Max_Norm16( HF_syn, L_SUBFR16k ), Find_Max_Norm16( mem_hp_interp, INTERP_3_1_MEM_LEN - 3 ) ), 3 ), - sub( Find_Max_Norm16( mem_hp_interp + INTERP_3_1_MEM_LEN - 3, 3 ), 1 ) ), - 0 ); - Scale_sig( HF_syn, L_SUBFR16k, s ); /* Q_syn+exp1+s */ - Scale_sig( mem_hp_interp, INTERP_3_1_MEM_LEN, s ); /* Qx + s */ - interpolate_3_over_1_allpass_fx( HF_syn, L_SUBFR16k, upsampled_HF_syn, mem_hp_interp ); - Scale_sig( upsampled_HF_syn, 3 * L_SUBFR16k, -s ); /* Q_syn + exp1 + s */ - Scale_sig( mem_hp_interp, INTERP_3_1_MEM_LEN, -s ); /* Qx */ - Scale_sig( HF_syn, L_SUBFR16k, -s ); /* Q_syn+exp1 */ - } + s = s_max( s_min( sub( s_min( Find_Max_Norm16( HF_syn, L_SUBFR16k ), Find_Max_Norm16( hBWE_zero->mem_hp_interp_fx, INTERP_3_1_MEM_LEN - 3 ) ), 3 ), + sub( Find_Max_Norm16( hBWE_zero->mem_hp_interp_fx + INTERP_3_1_MEM_LEN - 3, 3 ), 1 ) ), + 0 ); + Scale_sig( HF_syn, L_SUBFR16k, s ); /* Q_syn+exp1+s */ + Scale_sig( hBWE_zero->mem_hp_interp_fx, INTERP_3_1_MEM_LEN, s ); /* Qx + s */ + interpolate_3_over_1_allpass_fx( HF_syn, L_SUBFR16k, upsampled_HF_syn, hBWE_zero->mem_hp_interp_fx ); + Scale_sig( upsampled_HF_syn, 3 * L_SUBFR16k, -s ); /* Q_syn + exp1 + s */ + Scale_sig( hBWE_zero->mem_hp_interp_fx, INTERP_3_1_MEM_LEN, -s ); /* Qx */ + Scale_sig( HF_syn, L_SUBFR16k, -s ); /* Q_syn+exp1 */ Scale_sig( upsampled_HF_syn, L_SUBFR48k, -1 ); } ELSE IF( EQ_16( output_subfr, L_SUBFR32k ) ) /* 32kHz sampled output */ { - { - Word16 s; - s = s_max( sub( s_min( Find_Max_Norm16( HF_syn, L_SUBFR16k ), Find_Max_Norm16( mem_hp_interp, 2 * ALLPASSSECTIONS_STEEP ) ), 2 ), 0 ); - Scale_sig( HF_syn, L_SUBFR16k, s ); /* Q_syn+exp1+s */ - Scale_sig( mem_hp_interp, 2 * ALLPASSSECTIONS_STEEP, s ); /* Qx + s */ - Interpolate_allpass_steep_fx( HF_syn, mem_hp_interp, L_SUBFR16k, upsampled_HF_syn ); - Scale_sig( upsampled_HF_syn, 2 * L_SUBFR16k, -s ); /* Q_syn + exp1 */ - Scale_sig( mem_hp_interp, 2 * ALLPASSSECTIONS_STEEP, -s ); /* Qx */ - Scale_sig( HF_syn, L_SUBFR16k, -s ); /* Q_syn+exp1 */ - } + s = s_max( sub( s_min( Find_Max_Norm16( HF_syn, L_SUBFR16k ), Find_Max_Norm16( hBWE_zero->mem_hp_interp_fx, 2 * ALLPASSSECTIONS_STEEP ) ), 2 ), 0 ); + Scale_sig( HF_syn, L_SUBFR16k, s ); /* Q_syn+exp1+s */ + Scale_sig( hBWE_zero->mem_hp_interp_fx, 2 * ALLPASSSECTIONS_STEEP, s ); /* Qx + s */ + Interpolate_allpass_steep_fx( HF_syn, hBWE_zero->mem_hp_interp_fx, L_SUBFR16k, upsampled_HF_syn ); + Scale_sig( upsampled_HF_syn, 2 * L_SUBFR16k, -s ); /* Q_syn + exp1 */ + Scale_sig( hBWE_zero->mem_hp_interp_fx, 2 * ALLPASSSECTIONS_STEEP, -s ); /* Qx */ + Scale_sig( HF_syn, L_SUBFR16k, -s ); /* Q_syn+exp1 */ } ELSE /* 16kHz sampled output */ { @@ -1150,7 +1126,8 @@ static void hf_synthesis_amr_wb_fx( * Synchronize LB and HB components (delay componsation) * Add synthesised high band to speech synthesis *-----------------------------------------------------------------*/ - delay_signal( HF_syn, L_SUBFR16k, delay_syn_hf, NS2SA( 16000, DELAY_CLDFB_NS ) ); + + delay_signal_fx( HF_syn, L_SUBFR16k, delay_syn_hf, NS2SA( 16000, DELAY_CLDFB_NS ) ); IF( EQ_16( output_subfr, L_SUBFR48k ) ) /* 48kHz sampled output */ { diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index 7b4e5f267f708713deb5f978ae2764fb9592097d..180e582f1b57f99a8de01946bc3dd14c35f9aa39 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -1448,7 +1448,7 @@ ivas_error ivas_core_dec_fx( Word32 hb_prev_synth_buffer_fx_32[111]; Copy_Scale_sig_16_32_DEPREC( st->hb_prev_synth_buffer_fx, hb_prev_synth_buffer_fx_32, 111, 11 ); // Q11 - delay_signal_fx( hb_synth_32_fx[n], output_frame, hb_prev_synth_buffer_fx_32, tmps ); + delay_signal32_fx( hb_synth_32_fx[n], output_frame, hb_prev_synth_buffer_fx_32, tmps ); Copy_Scale_sig_32_16( hb_prev_synth_buffer_fx_32, st->hb_prev_synth_buffer_fx, 111, -( 11 ) ); // Q0 } ELSE @@ -1665,7 +1665,7 @@ ivas_error ivas_core_dec_fx( move16(); } /* Save synthesis for HQ FEC */ - save_synthesis_hq_fec_fx( st, output_fx_loc, output_frame, hCPE ); + save_synthesis_hq_fec_fx( st, NULL, output_fx_loc, output_frame, 0, hCPE ); /* Updates */ diff --git a/lib_dec/ivas_ism_renderer_fx.c b/lib_dec/ivas_ism_renderer_fx.c index 7cd93affaa9481b56da4c7b740a05713ac40b192..cd54add9b4ec36f47d9cde5629c1cba3fa1f4546 100644 --- a/lib_dec/ivas_ism_renderer_fx.c +++ b/lib_dec/ivas_ism_renderer_fx.c @@ -564,7 +564,7 @@ void ivas_omasa_separate_object_render_jbm_fx( Word16 tcBufferSize; tcBufferSize = i_mult( hSpatParamRendCom->num_slots, hSpatParamRendCom->slot_size ); - delay_signal_fx( input_fx[obj], tcBufferSize, st_ivas->hMasaIsmData->delayBuffer_fx[obj], st_ivas->hMasaIsmData->delayBuffer_size ); + delay_signal32_fx( input_fx[obj], tcBufferSize, st_ivas->hMasaIsmData->delayBuffer_fx[obj], st_ivas->hMasaIsmData->delayBuffer_size ); } offsetSamples = 0; move16(); diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 210425b88d79bebeea0c5672d959ebd27069b739..672c7d95c6067b741331b79f245cd8b60d5f4327 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -1361,7 +1361,7 @@ ivas_error ivas_jbm_dec_tc_fx( ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && st_ivas->hOutSetup.num_lfe == 0 ) { /* Delay the separated channel to sync with the DirAC rendering */ - delay_signal_fx( p_output_fx[n], output_frame, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size ); + delay_signal32_fx( p_output_fx[n], output_frame, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_fx, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size ); } } ELSE @@ -1709,7 +1709,7 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx( { FOR( n = 0; n < st_ivas->nchan_ism; n++ ) { - delay_signal_fx( st_ivas->hTcBuffer->tc_fx[n], st_ivas->hTcBuffer->n_samples_available, st_ivas->hSbaIsmData->delayBuffer_fx[n], st_ivas->hSbaIsmData->delayBuffer_size ); + delay_signal32_fx( st_ivas->hTcBuffer->tc_fx[n], st_ivas->hTcBuffer->n_samples_available, st_ivas->hSbaIsmData->delayBuffer_fx[n], st_ivas->hSbaIsmData->delayBuffer_size ); } } diff --git a/lib_dec/ivas_lfe_dec_fx.c b/lib_dec/ivas_lfe_dec_fx.c index 672d3fbe67ca2a80b1518e99a30d2e3bca85c9a4..d73030d56af4fa7ac8ba9213c879092c6bdc7ec4 100644 --- a/lib_dec/ivas_lfe_dec_fx.c +++ b/lib_dec/ivas_lfe_dec_fx.c @@ -392,7 +392,7 @@ void ivas_lfe_dec_fx( /* add delay to make overall max(block_offset, 11.5) */ IF( hLFE->lfe_addl_delay > 0 ) { - delay_signal_fx( output_lfe_ch, output_frame, hLFE->lfe_delay_buf_fx, hLFE->lfe_addl_delay ); + delay_signal32_fx( output_lfe_ch, output_frame, hLFE->lfe_delay_buf_fx, hLFE->lfe_addl_delay ); } return; diff --git a/lib_dec/ivas_mc_paramupmix_dec_fx.c b/lib_dec/ivas_mc_paramupmix_dec_fx.c index 3c2ba7587da63f9b264b2c884b19bf6c197f26d5..8e1ecaa99fba6d3095b481b90466ce2bb71a6972 100644 --- a/lib_dec/ivas_mc_paramupmix_dec_fx.c +++ b/lib_dec/ivas_mc_paramupmix_dec_fx.c @@ -499,7 +499,7 @@ static void paramupmix_td_decorr_process_jbm_fx( FOR( k = 0; k < MC_PARAMUPMIX_COMBINATIONS; k++ ) { Copy32( pcm_in[k], pp_out_pcm[k], output_frame ); - delay_signal_fx( pp_out_pcm[k], output_frame, hTdDecorr[k]->look_ahead_buf, offset ); + delay_signal32_fx( pp_out_pcm[k], output_frame, hTdDecorr[k]->look_ahead_buf, offset ); /* In ducking gains */ IF( hTdDecorr[k]->ducking_flag ) diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 884a44c9e4531f7f88836719208446c779da68e4..810cec295b3c0175bc3ad60869d2cde3c2922456 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -465,7 +465,7 @@ ivas_error ivas_mct_dec_fx( sts[n]->q_prev_synth_buffer_fx = 0; move16(); - save_synthesis_hq_fec_fx( sts[n], output_fx_, output_frame, hCPE ); + save_synthesis_hq_fec_fx( sts[n], NULL, output_fx_, output_frame, 0, hCPE ); /* CoreCoder common updates */ ivas_updt_dec_common_fx( hCPE->hCoreCoder[n], NORMAL_HQ_CORE, -1, output_fx[( cpe_id * CPE_CHANNELS ) + n], 11 ); diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index afa604684e249e2dd6461c646ccf19c3b6a85645..3698f822bf2cd91a2af48a1eea036c4213d89295 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -777,7 +777,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm_fx( tc_local_fx[n] = st_ivas->hTcBuffer->tc_fx[n + 2]; // Q11 v_multc_fixed_16( tc_local_fx[n], gain_fx, tc_local_fx[n], tcBufferSize ); - delay_signal_fx( tc_local_fx[n], tcBufferSize, st_ivas->hMasaIsmData->delayBuffer_fx[n], st_ivas->hMasaIsmData->delayBuffer_size ); + delay_signal32_fx( tc_local_fx[n], tcBufferSize, st_ivas->hMasaIsmData->delayBuffer_fx[n], st_ivas->hMasaIsmData->delayBuffer_size ); } } diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index 12549f49df29761496430c1f1416ec92f1023225..26dc691910c4c6c70d63c6e36c222b62852e9997 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -318,13 +318,13 @@ ivas_error ivas_sce_dec_fx( * LB synthesis synchronization between IVAS formats *----------------------------------------------------------------*/ - delay_signal_fx( output[0], output_frame, st->prev_synth_buffer32_fx, NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS ) ); + delay_signal32_fx( output[0], output_frame, st->prev_synth_buffer32_fx, NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS ) ); /*----------------------------------------------------------------* * HB synthesis synchronization between IVAS formats *----------------------------------------------------------------*/ - delay_signal_fx( outputHB[0], output_frame, hSCE->prev_hb_synth_fx, NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) ); + delay_signal32_fx( outputHB[0], output_frame, hSCE->prev_hb_synth_fx, NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ) ); /*----------------------------------------------------------------* * output LB and HB mix diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index c70e606ac7c54298dc672c03b3e7b91dedadc02b..f2ab7dd76d02e972d11b675a8939d6075ba1b9ae 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -1263,7 +1263,7 @@ void synchro_synthesis_fx( { /* delay CLDFB-based mono output (<= 24.4 kbps) to be aligned with DFT-based mono output (32 kbps), needed to avoid discontinuities with TCX-LTP. */ Copy32( sts[0]->prev_synth_buffer32_fx + delay_comp_DFT, hCPE->hCoreCoder[0]->hTcxDec->FBTCXdelayBuf_32, delay_diff ); /* Q11 */ - delay_signal_fx( output_fx[0], output_frame, hCPE->hCoreCoder[0]->hTcxDec->FBTCXdelayBuf_32, delay_diff ); + delay_signal32_fx( output_fx[0], output_frame, hCPE->hCoreCoder[0]->hTcxDec->FBTCXdelayBuf_32, delay_diff ); } IF( NE_16( hCPE->element_mode, IVAS_CPE_MDCT ) ) @@ -1280,7 +1280,7 @@ void synchro_synthesis_fx( } ELSE { - delay_signal_fx( output_fx[n], output_frame, sts[n]->prev_synth_buffer32_fx, delay_comp_DFT ); + delay_signal32_fx( output_fx[n], output_frame, sts[n]->prev_synth_buffer32_fx, delay_comp_DFT ); } } if ( sba_dirac_stereo_flag ) @@ -1601,15 +1601,15 @@ void synchro_synthesis_fx( IF( EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) ) { Copy32( sts[n]->prev_synth_buffer32_fx + delay_comp_DFT, hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32, delay_diff ); /* Q11 */ - delay_signal_fx( output_fx[n], output_frame, hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32, delay_diff ); /* Q11 */ + delay_signal32_fx( output_fx[n], output_frame, hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32, delay_diff ); /* Q11 */ ivas_post_proc_fx( NULL, hCPE, n, output_fx[n], output_fx, output_frame, 0, output_fx_q ); - delay_signal_fx( output_fx[n], output_frame, sts[n]->prev_synth_buffer32_fx, delay_comp_DFT ); + delay_signal32_fx( output_fx[n], output_frame, sts[n]->prev_synth_buffer32_fx, delay_comp_DFT ); Copy32( hCPE->hCoreCoder[n]->hTcxDec->FBTCXdelayBuf_32, sts[n]->prev_synth_buffer32_fx + delay_comp_DFT, delay_diff ); /* Q11 */ } ELSE { - delay_signal_fx( output_fx[n], output_frame, sts[n]->prev_synth_buffer32_fx, delay_comp_TD ); + delay_signal32_fx( output_fx[n], output_frame, sts[n]->prev_synth_buffer32_fx, delay_comp_TD ); } } diff --git a/lib_enc/ivas_front_vad_fx.c b/lib_enc/ivas_front_vad_fx.c index 8b76b37a44dc1d3a1ddf0fa7b98ece00ddc1172c..baaf33027887415484ee3bb500f5e475a8b29f64 100644 --- a/lib_enc/ivas_front_vad_fx.c +++ b/lib_enc/ivas_front_vad_fx.c @@ -557,7 +557,7 @@ ivas_error front_vad_spar_fx( st->input_fx = input_fx; Copy_Scale_sig32_16( omni_in, st->input_fx, input_frame, Q16 - Q11 ); /* Q16 */ - delay_signal( st->input_fx, input_frame, hFrontVad->delay_buf_fx, hFrontVad->delay_samples ); + delay_signal_fx( st->input_fx, input_frame, hFrontVad->delay_buf_fx, hFrontVad->delay_samples ); /* Scaling only if the omni_in buffer contains non-zero values */ maximum_abs_16_fx( st->input_fx, input_frame, &tmp ); diff --git a/lib_enc/ivas_osba_enc_fx.c b/lib_enc/ivas_osba_enc_fx.c index 2a6944c502fd97256ec50250b6c774159c9694fc..0ca93e1a1dc16bab0cd8bf2b00d17d1674e9580c 100644 --- a/lib_enc/ivas_osba_enc_fx.c +++ b/lib_enc/ivas_osba_enc_fx.c @@ -446,7 +446,7 @@ void ivas_osba_enc_fx( /* delay ISM input channels to match the SBA encoder delay */ FOR( n = 0; n < nchan_ism; n++ ) { - delay_signal_fx( data_in_fx[n], input_frame, hOSba->input_data_mem_fx[n], delay_s ); + delay_signal32_fx( data_in_fx[n], input_frame, hOSba->input_data_mem_fx[n], delay_s ); azimuth_fx = extract_l( L_shr( L_add( hIsmMeta[n]->azimuth_fx, 2097152 /*0.5.Q22*/ ), Q22 ) ); // Q0 elevation_fx = extract_l( L_shr( L_add( hIsmMeta[n]->elevation_fx, 2097152 /*0.5.Q22*/ ), Q22 ) ); // Q0 diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 40ed0ad5821c47ee37abd53ccd6e3110dd392578..9e990769cbc63fd6ff3af5a6877b1fec26cc70a5 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -3725,7 +3725,7 @@ void ivas_lfe_synth_with_filters_fx( /* Delay the separated channel to sync the LFE synthesis with the DirAC rendering */ delay = hMasaLfeSynth->delayBuffer_syncDirAC_size; move16(); - delay_signal_fx( data_fx[separateChannelIndex], output_frame, hMasaLfeSynth->delayBuffer_syncDirAC_fx, delay ); /*q11*/ + delay_signal32_fx( data_fx[separateChannelIndex], output_frame, hMasaLfeSynth->delayBuffer_syncDirAC_fx, delay ); /*q11*/ /* Filterbank for dividing the separated channel to LFE frequencies and higher frequencies */ lowpassCoef_fx_exp = 15; @@ -3884,7 +3884,7 @@ void ivas_lfe_synth_with_filters_fx( /* Delay the separated channel to match the delay of the lowpass filter */ delay = hMasaLfeSynth->delayBuffer_syncLp_size; move16(); - delay_signal_fx( data_fx[separateChannelIndex], output_frame, hMasaLfeSynth->delayBuffer_syncLp_fx, delay ); /*q11*/ + delay_signal32_fx( data_fx[separateChannelIndex], output_frame, hMasaLfeSynth->delayBuffer_syncLp_fx, delay ); /*q11*/ return; } diff --git a/lib_rend/ivas_td_decorr_fx.c b/lib_rend/ivas_td_decorr_fx.c index 0fc5c21df20da26189622ceae216a4902803ce39..bcbb3ad7253cabfff53fde6e70f834dd4d9e7e1e 100644 --- a/lib_rend/ivas_td_decorr_fx.c +++ b/lib_rend/ivas_td_decorr_fx.c @@ -485,7 +485,7 @@ void ivas_td_decorr_process_fx( /* Look-ahead delay */ Copy32( pcm_in[0], ppOut_pcm[0], output_frame ); - delay_signal_fx( ppOut_pcm[0], output_frame, hTdDecorr->look_ahead_buf, hTdDecorr->offset ); + delay_signal32_fx( ppOut_pcm[0], output_frame, hTdDecorr->look_ahead_buf, hTdDecorr->offset ); /* In ducking gains */ IF( hTdDecorr->ducking_flag )