Loading Workspace_msvc/lib_com.vcxproj.filters +1 −1 Original line number Diff line number Diff line Loading @@ -619,7 +619,7 @@ <Filter>common_h</Filter> </ClInclude> <ClInclude Include="..\lib_com\prot_fx.h"> <Filter>common_all_c</Filter> <Filter>common_h</Filter> </ClInclude> </ItemGroup> <ItemGroup> Loading lib_com/prot_fx.h +14 −22 Original line number Diff line number Diff line Loading @@ -6645,12 +6645,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( Loading Loading @@ -9622,13 +9617,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 */ Loading Loading @@ -9766,7 +9754,8 @@ void addBassPostFilter_ivas_fx( Word32 **iAnalysis_fx, HANDLE_CLDFB_FILTER_BANK cldfb ); Word32 ism_dequant_meta_fx( /* o : Q22*/ /* 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 */ Loading @@ -9776,10 +9765,13 @@ Word32 ism_dequant_meta_fx( /* o : Q22*/ 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 Loading Loading @@ -10544,15 +10536,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 */ lib_com/tools_fx.c +5 −28 Original line number Diff line number Diff line Loading @@ -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 */ Loading @@ -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 ); Loading @@ -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 */ Loading Loading @@ -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() * Loading lib_dec/FEC_HQ_core_fx.c +194 −275 Original line number Diff line number Diff line Loading @@ -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 ) { Loading Loading @@ -759,10 +758,7 @@ 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 ) ) ) Loading Loading @@ -962,13 +958,14 @@ void HQ_FEC_Mem_update_fx( 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(); Loading @@ -976,9 +973,7 @@ void HQ_FEC_Mem_update_fx( move16(); hHQ_core->old_is_transient[0] = is_transient; move16(); #ifdef ADD_IVAS_HQ_CODE_FEC } #endif return; } Loading Loading @@ -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 */ ) { Loading Loading @@ -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 ) ); } 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_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 { 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 ); 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 { 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 ) ELSE { 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 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->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 lib_dec/acelp_core_dec_fx.c +1 −2 Original line number Diff line number Diff line Loading @@ -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 { Loading Loading
Workspace_msvc/lib_com.vcxproj.filters +1 −1 Original line number Diff line number Diff line Loading @@ -619,7 +619,7 @@ <Filter>common_h</Filter> </ClInclude> <ClInclude Include="..\lib_com\prot_fx.h"> <Filter>common_all_c</Filter> <Filter>common_h</Filter> </ClInclude> </ItemGroup> <ItemGroup> Loading
lib_com/prot_fx.h +14 −22 Original line number Diff line number Diff line Loading @@ -6645,12 +6645,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( Loading Loading @@ -9622,13 +9617,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 */ Loading Loading @@ -9766,7 +9754,8 @@ void addBassPostFilter_ivas_fx( Word32 **iAnalysis_fx, HANDLE_CLDFB_FILTER_BANK cldfb ); Word32 ism_dequant_meta_fx( /* o : Q22*/ /* 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 */ Loading @@ -9776,10 +9765,13 @@ Word32 ism_dequant_meta_fx( /* o : Q22*/ 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 Loading Loading @@ -10544,15 +10536,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 */
lib_com/tools_fx.c +5 −28 Original line number Diff line number Diff line Loading @@ -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 */ Loading @@ -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 ); Loading @@ -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 */ Loading Loading @@ -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() * Loading
lib_dec/FEC_HQ_core_fx.c +194 −275 Original line number Diff line number Diff line Loading @@ -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 ) { Loading Loading @@ -759,10 +758,7 @@ 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 ) ) ) Loading Loading @@ -962,13 +958,14 @@ void HQ_FEC_Mem_update_fx( 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(); Loading @@ -976,9 +973,7 @@ void HQ_FEC_Mem_update_fx( move16(); hHQ_core->old_is_transient[0] = is_transient; move16(); #ifdef ADD_IVAS_HQ_CODE_FEC } #endif return; } Loading Loading @@ -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 */ ) { Loading Loading @@ -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 ) ); } 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_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 { 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 ); 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 { 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 ) ELSE { 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 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->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
lib_dec/acelp_core_dec_fx.c +1 −2 Original line number Diff line number Diff line Loading @@ -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 { Loading