Loading lib_dec/acelp_core_dec_fx.c +9 −9 Original line number Diff line number Diff line Loading @@ -432,7 +432,7 @@ ivas_error acelp_core_dec_fx( } /* update synthesis filter memories */ #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES ivas_synth_mem_updt2_fx( st_fx->L_frame, st_fx->last_L_frame, st_fx->old_exc_fx, st_fx->mem_syn_r, st_fx->mem_syn2_fx, NULL, dec ); #else synth_mem_updt2( st_fx->L_frame, st_fx->last_L_frame, st_fx->old_exc_fx, st_fx->mem_syn_r, st_fx->mem_syn2_fx, NULL, dec ); Loading Loading @@ -634,7 +634,7 @@ ivas_error acelp_core_dec_fx( /* decode CNG parameters */ IF( st_fx->cng_type == LP_CNG ) { #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES CNG_dec_ivas_fx( st_fx, st_fx->last_element_mode, Aq_fx, lsp_new_fx, lsf_new_fx, &allow_cn_step_fx, sid_bw, q_env ); #else CNG_dec_fx( st_fx, st_fx->last_element_mode, Aq_fx, lsp_new_fx, lsf_new_fx, &allow_cn_step_fx, sid_bw, q_env ); Loading Loading @@ -708,11 +708,11 @@ ivas_error acelp_core_dec_fx( } i = st_fx->Q_exc; move16(); #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES test(); IF( st_fx->hMusicPF && st_fx->hGSCDec ) { #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { // VE: TBV: 'st_fx->L_frame * HIBND_ACB_L_FAC' should be corrected Loading Loading @@ -1593,7 +1593,7 @@ ivas_error acelp_core_dec_fx( move32(); } /*Noise estimate*/ #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES IF( NE_16( st_fx->element_mode, IVAS_CPE_TD ) && !st_fx->cng_ism_flag ) #else IF( NE_16( st_fx->element_mode, IVAS_CPE_TD ) /* && !st->cng_ism_flag IVAS_CODE */ ) Loading @@ -1603,7 +1603,7 @@ ivas_error acelp_core_dec_fx( PMT( "Code for IVAS_CODE_CNG_FIX185_PLC_FADEOUT not done" ) ApplyFdCng_fx( syn, st_fx->Q_syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); #else #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES ApplyFdCng_ivas_fx( syn_fx, st_fx->Q_syn, NULL, 0, realBuffer, imagBuffer, NULL, st_fx, 0, ( st_fx->coder_type == AUDIO && !st_fx->GSC_noisy_speech ) ); #else ApplyFdCng_fx( syn_fx, st_fx->Q_syn, realBuffer, imagBuffer, NULL, st_fx, 0, ( EQ_16( st_fx->coder_type, AUDIO ) && st_fx->GSC_noisy_speech == 0 ) ); Loading Loading @@ -1792,7 +1792,7 @@ ivas_error acelp_core_dec_fx( st_fx->stab_fac_fx, &st_fx->stab_fac_smooth_fx, st_fx->coder_type, st_fx->Q_syn, bpf_error_signal ); } #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { /* analysis of the synthesis at internal sampling rate */ Loading Loading @@ -2033,7 +2033,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 ) ) ) ) ) { #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { 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, Loading @@ -2049,7 +2049,7 @@ ivas_error acelp_core_dec_fx( #endif } #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES ELSE { hf_synth_reset_fx( st_fx->hBWE_zero ); Loading lib_dec/acelp_core_dec_ivas_fx.c +567 −338 Original line number Diff line number Diff line Loading @@ -151,7 +151,6 @@ ivas_error acelp_core_dec_ivas_fx( error = IVAS_ERR_OK; move32(); test(); test(); test(); Loading Loading @@ -664,11 +663,21 @@ ivas_error acelp_core_dec_ivas_fx( test(); IF( EQ_32( st->core_brate, SID_2k40 ) && NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { FdCng_decodeSID_fx( st->hFdCngDec->hFdCngCom, st ); } ELSE #endif { Word16 old_NoiseEstExp = st->hFdCngDec->hFdCngCom->sidNoiseEstExp; move16(); FdCng_decodeSID_ivas_fx( st ); rescale_fdCngDec( st->hFdCngDec, sub( old_NoiseEstExp, st->hFdCngDec->hFdCngCom->sidNoiseEstExp ) ); Scale_sig( st->hFdCngDec->hFdCngCom->A_cng, M + 1, sub( norm_s( st->hFdCngDec->hFdCngCom->A_cng[0] ), Q2 ) ); // Qx } *sid_bw = 0; move16(); } Loading Loading @@ -720,7 +729,16 @@ ivas_error acelp_core_dec_ivas_fx( } } #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { generate_comfort_noise_dec_fx( NULL, NULL, NULL, st, &( st->Q_exc ), 2, -1 ); } ELSE #endif { generate_comfort_noise_dec_ivas_fx( NULL, NULL, NULL, st, &( st->Q_exc ), 1, nchan_out ); } FdCng_exc( st->hFdCngDec->hFdCngCom, &st->CNG_mode, st->L_frame, st->lsp_old_fx, st->first_CNG, st->lspCNG_fx, Aq_fx, lsp_new_fx, lsf_new_fx, exc_fx, exc2_fx, bwe_exc_fx ); Loading @@ -740,9 +758,20 @@ ivas_error acelp_core_dec_ivas_fx( test(); IF( st->hMusicPF && st->hGSCDec ) { #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { // VE: TBV: 'st_fx->L_frame * HIBND_ACB_L_FAC' should be corrected Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, exc_fx, bwe_exc_fx, st->hGSCDec->last_exc_dct_in_fx, st->L_frame, st->L_frame * HIBND_ACB_L_FAC, 0, &( st->Q_exc ), st->Q_subfr, NULL, 0, INACTIVE ); } ELSE #endif { Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, exc_fx, bwe_exc_fx, st->hGSCDec->last_exc_dct_in_fx, st->L_frame, imult1616( st->L_frame, HIBND_ACB_L_FAC ), 0, &( st->Q_exc ), st->Q_subfr, NULL, 0, INACTIVE ); } } IF( st->hPFstat != NULL ) { Rescale_mem( st->Q_exc, &st->prev_Q_syn, &st->Q_syn, st->mem_syn2_fx, st->mem_syn_clas_estim_fx, delta_mem_scale, Loading @@ -763,13 +792,25 @@ ivas_error acelp_core_dec_ivas_fx( /* Update music post processing values */ /* Filter energies update */ #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { FOR( i = 0; i < DCT_L_POST; i++ ) { st->hMusicPF->filt_lfE_fx[i] = round_fx( L_mac( ( 1228 << ( 16 ) ), 22938, st->hMusicPF->filt_lfE_fx[i] ) ); move16(); } } ELSE #endif { FOR( i = 0; i < DCT_L_POST; i++ ) { st->hMusicPF->filt_lfE_fx[i] = add( 9830, mult_r( 22937, st->hMusicPF->filt_lfE_fx[i] ) ); // Q15, 9830 =.3f in Q15, 22937=.7f in Q15 move16(); } } } /* synthesis at 12.8kHz sampling rate */ #ifndef FIX_1100_REMOVE_LPC_RESCALING Loading @@ -778,15 +819,28 @@ ivas_error acelp_core_dec_ivas_fx( move16(); syn_12k8_fx( st->L_frame, Aq_fx, exc2_fx, psyn_fx, st->mem_syn2_fx, 1, st->Q_exc, st->Q_syn ); syn_12k8_fx( st->L_frame, Aq_fx, exc3_fx, syn1_fx, st->mem_syn3_fx, 1, st->Q_exc, st->Q_syn ); /* reset the decoder */ CNG_reset_dec_fx( st, pitch_buf_fx, voice_factors_fx ); #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { /* update st_fx->mem_syn1 for ACELP core switching */ Copy( st->mem_syn3_fx, st->mem_syn1_fx, M ); } ELSE #endif { st->Q_syn_cng = st->Q_syn; move16(); st->Q_exc_cng = st->Q_exc; move16(); /* reset the decoder */ CNG_reset_dec_fx( st, pitch_buf_fx, voice_factors_fx ); /* update st->mem_syn1 for ACELP core switching */ Copy_Scale_sig( st->mem_syn3_fx, st->mem_syn1_fx, M, sub( -1, st->Q_syn ) ); // Q(-1) } /* update old synthesis for classification */ Copy( syn1_fx + st->L_frame - L_SYN_MEM_CLAS_ESTIM, st->mem_syn_clas_estim_fx, L_SYN_MEM_CLAS_ESTIM ); Loading Loading @@ -1157,13 +1211,30 @@ ivas_error acelp_core_dec_ivas_fx( Word16 qdct = 0; move16(); /* Extrapolation of the last future part, windowing and high resolution DCT transform */ #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { // VE: TBV: this is a bug in EVS - 'st->last_coder_type' should be replaced by 'st->core_brate' Prep_music_postP_fx( exc_buffer_fx, dct_buffer_fx, st->hMusicPF->filt_lfE_fx, st->last_coder_type, st->element_mode, pitch_buf_fx, st->hMusicPF->LDm_enh_lp_gbin_fx, st->Q_exc, &qdct ); } ELSE #endif { Prep_music_postP_fx( exc_buffer_fx, dct_buffer_fx, st->hMusicPF->filt_lfE_fx, st->last_core, st->element_mode, pitch_buf_fx, st->hMusicPF->LDm_enh_lp_gbin_fx, st->Q_exc, &qdct ); } /* LD music post-filter */ LD_music_post_filter_fx( st->hMusicPF, dct_buffer_fx, dct_buffer_fx, st->core_brate, &st->hMusicPF->Old_ener_Q, AUDIO, last_coder_type, qdct ); /* Inverse DCT transform, retrieval of the aligned excitation, re-synthesis */ #ifdef REMOVE_EVS_DUPLICATES IF( NE_16( st->element_mode, EVS_MONO ) ) // VE: TBC whether needed in IVAS #endif { Copy( st->mem_syn2_fx, mem_tmp_fx, M ); /*Q_syn*/ } Post_music_postP_fx( dct_buffer_fx, exc2_fx, st->mem_syn2_fx, st->mem_syn2_fx, Aq_fx, psyn_fx, &st->Q_exc, &st->prev_Q_syn, &st->Q_syn, st->mem_syn_clas_estim_fx, 0, &st->mem_deemph_fx, st->hBPF->pst_old_syn_fx, &st->hBPF->pst_mem_deemp_err_fx, &st->agc_mem_fx[1], st->hPFstat, temp_buf_fx, mem_tmp_fx ); Loading Loading @@ -1209,6 +1280,7 @@ ivas_error acelp_core_dec_ivas_fx( /*------------------------------------------------------------* * FEC - Estimate the classification information *------------------------------------------------------------*/ FEC_clas_estim_fx( st, st->Opt_AMR_WB, st->L_frame, &st->clas_dec, st->coder_type, pitch_buf_fx, psyn_fx, &st->lp_ener_FER_fx, &st->decision_hyst, NULL, NULL, NULL, NULL, 0, NULL, st->Q_syn, temp_buf_fx, Loading Loading @@ -1586,6 +1658,14 @@ ivas_error acelp_core_dec_ivas_fx( } ELSE IF( NE_16( st->element_mode, IVAS_CPE_DFT ) ) { #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { generate_masking_noise_fx( psyn_fx, st->Q_syn, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0 ); } ELSE #endif { IF( st->idchan == 0 ) { IF( NE_16( st->element_mode, last_element_mode ) ) Loading @@ -1602,6 +1682,7 @@ ivas_error acelp_core_dec_ivas_fx( } } } } ELSE IF( st->flag_cna && EQ_16( st->coder_type, AUDIO ) && ( ( st->last_core == ACELP_CORE && !( EQ_16( st->last_coder_type, AUDIO ) && !( st->element_mode > EVS_MONO && st->Last_GSC_noisy_speech_flag ) ) ) || EQ_16( st->last_core, TCX_20_CORE ) ) ) { test(); Loading Loading @@ -1685,6 +1766,114 @@ ivas_error acelp_core_dec_ivas_fx( * Bass post-filter *----------------------------------------------------------------*/ #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { CLDFB_SCALE_FACTOR scaleFactor; Word32 workBuffer[128 * 3]; /* check if the CLDFB works on the right sample rate */ IF( ( st->cldfbAna->usb * st->cldfbAna->no_col ) != st->L_frame ) { /* resample to ACELP internal sampling rate */ Word16 newCldfbBands = CLDFB_getNumChannels( L_mult0( st->L_frame, FRAMES_PER_SEC ) ); resampleCldfb( st->cldfbAna, newCldfbBands, st->L_frame, 0 ); resampleCldfb( st->cldfbBPF, newCldfbBands, st->L_frame, 0 ); IF( st->ini_frame > 0 ) { st->cldfbSyn->bandsToZero = sub( st->cldfbSyn->no_channels, st->cldfbAna->no_channels ); move16(); } } test(); IF( NE_16( st->L_frame, st->last_L_frame ) && NE_16( st->last_codec_mode, MODE2 ) ) { IF( EQ_16( st->L_frame, L_FRAME ) ) { retro_interp5_4_fx( st->hBPF->pst_old_syn_fx ); } ELSE IF( EQ_16( st->L_frame, L_FRAME16k ) ) { retro_interp4_5_fx( psyn_fx, st->hBPF->pst_old_syn_fx ); } } bass_psfilter_fx( st->hBPF, st->Opt_AMR_WB, psyn_fx, st->L_frame, pitch_buf_fx, st->bpf_off, st->stab_fac_fx, &st->stab_fac_smooth_fx, st->coder_type, st->Q_syn, bpf_error_signal_16fx ); /* analysis of the synthesis at internal sampling rate */ cldfbAnalysisFiltering( st->cldfbAna, realBuffer_fx, imagBuffer_fx, &scaleFactor, psyn_fx, negate( st->Q_syn ), CLDFB_NO_COL_MAX, workBuffer ); scaleFactor.hb_scale = scaleFactor.lb_scale; move16(); /* analysis and add the BPF error signal */ i = 0; move16(); if ( st->bpf_off == 0 ) { i = CLDFB_NO_COL_MAX; move16(); } addBassPostFilter_fx( bpf_error_signal_16fx, realBuffer_fx, imagBuffer_fx, st->cldfbBPF, workBuffer, negate( st->Q_syn ), i, st->cldfbAna->no_col, st->cldfbAna->no_channels, &scaleFactor ); /* set output mask for upsampling */ IF( EQ_16( st->bwidth, NB ) ) { /* set NB mask for upsampling */ st->cldfbSyn->bandsToZero = sub( st->cldfbSyn->no_channels, 10 ); move16(); } ELSE IF( NE_16( st->cldfbSyn->bandsToZero, sub( st->cldfbSyn->no_channels, st->cldfbAna->no_channels ) ) ) { /* in case of BW switching, re-init to default */ st->cldfbSyn->bandsToZero = sub( st->cldfbSyn->no_channels, st->cldfbAna->no_channels ); move16(); } /*WB/SWB-FD_CNG*/ scaleFactor.hb_scale = scaleFactor.lb_scale; move16(); test(); test(); test(); IF( ( ( st->core_brate == FRAME_NO_DATA ) || EQ_32( st->core_brate, SID_2k40 ) ) && ( EQ_16( st->cng_type, FD_CNG ) ) && ( LT_16( st->hFdCngDec->hFdCngCom->numCoreBands, st->cldfbSyn->no_channels ) ) ) { generate_comfort_noise_dec_hf_fx( realBuffer_fx, imagBuffer_fx, &scaleFactor.hb_scale, st ); st->cldfbSyn->bandsToZero = 0; move16(); IF( LT_16( st->hFdCngDec->hFdCngCom->regularStopBand, st->cldfbSyn->no_channels ) ) { st->cldfbSyn->bandsToZero = sub( st->cldfbSyn->no_channels, st->hFdCngDec->hFdCngCom->regularStopBand ); move16(); } st->cldfbSyn->lsb = st->cldfbAna->no_channels; move16(); } /* synthesis of the combined signal */ st->Q_syn2 = st->Q_syn; move16(); cldfbSynthesisFiltering( st->cldfbSyn, realBuffer_fx, imagBuffer_fx, &scaleFactor, synth_fx16, negate( st->Q_syn2 ), CLDFB_NO_COL_MAX, workBuffer ); /* Bring CLDFB output to Q0 */ Scale_sig( synth_fx16, output_frame, negate( st->Q_syn2 ) ); st->Q_syn2 = 0; move16(); /* save synthesis - needed in case of core switching */ Copy( synth_fx16, st->previoussynth_fx, output_frame ); } ELSE #endif { /* check if the CLDFB works on the right sample rate */ IF( NE_16( imult1616( st->cldfbAna->no_channels, st->cldfbAna->no_col ), st->L_frame ) ) { Loading Loading @@ -2111,6 +2300,8 @@ ivas_error acelp_core_dec_ivas_fx( st->Q_syn2 = 0; move16(); } /*-----------------------------------------------------------------* * Bandwidth extension 6kHz-7kHz *-----------------------------------------------------------------*/ Loading @@ -2126,6 +2317,15 @@ ivas_error acelp_core_dec_ivas_fx( IF( ( EQ_16( st->L_frame, L_FRAME ) && ( st->bwidth != NB ) && GE_16( output_frame, L_FRAME16k ) && ( EQ_16( st->extl, -1 ) || EQ_16( st->extl, SWB_CNG ) || ( EQ_16( st->extl, WB_BWE ) && st->extl_brate == 0 && NE_16( st->coder_type, AUDIO ) ) ) ) ) { #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { 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 ); } ELSE #endif { #ifdef MSAN_FIX Copy_Scale_sig_32_16( synth_fx, synth_fx16, output_frame, 0 ); // Q0 #else Loading @@ -2140,14 +2340,20 @@ ivas_error acelp_core_dec_ivas_fx( Copy_Scale_sig_16_32_DEPREC( synth_fx16, synth_fx, L_FRAME48k, 0 ); #endif } } ELSE { hf_synth_reset_fx( st->hBWE_zero ); #ifdef REMOVE_EVS_DUPLICATES2 IF( NE_16( st->element_mode, EVS_MONO ) ) // VE: TBV: tmp hack - it is a bug in EVS but conditon is here to keep EVS bit-exact #endif { #ifdef MSAN_FIX set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); #endif } } } /*-----------------------------------------------------------------* * Populate parameters for SWB TBE Loading Loading @@ -2180,6 +2386,15 @@ ivas_error acelp_core_dec_ivas_fx( test(); IF( !st->ppp_mode_dec && ( st->idchan == 0 || NE_16( st->element_mode, IVAS_CPE_TD ) || ( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) && st->tdm_LRTD_flag ) ) ) { #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { non_linearity_fx( bwe_exc_fx, bwe_exc_extended_fx, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale_fx, st->Q_exc, st->coder_type, voice_factors_fx, st->L_frame ); } ELSE #endif { #ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( st->hBWE_TD->old_bwe_exc_extended_fx, bwe_exc_extended_fx, NL_BUFF_OFFSET, ( sub( shl( st->Q_exc, 1 ), sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc #else Loading @@ -2188,6 +2403,7 @@ ivas_error acelp_core_dec_ivas_fx( non_linearity_ivas_fx( bwe_exc_fx, bwe_exc_extended_fx + NL_BUFF_OFFSET, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale_fx, st->Q_exc, st->coder_type, voice_factors_fx, st->L_frame ); Copy_Scale_sig_32_16( bwe_exc_extended_fx + L_FRAME32k, st->hBWE_TD->old_bwe_exc_extended_fx, NL_BUFF_OFFSET, negate( sub( shl( st->Q_exc, 1 ), sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc } } test(); if ( st->core_brate == FRAME_NO_DATA || EQ_32( st->core_brate, SID_2k40 ) ) { Loading @@ -2195,6 +2411,7 @@ ivas_error acelp_core_dec_ivas_fx( move32(); } } /*----------------------------------------------------------------------* * Updates *----------------------------------------------------------------------*/ Loading @@ -2205,10 +2422,19 @@ ivas_error acelp_core_dec_ivas_fx( IF( GT_32( st->core_brate, SID_2k40 ) && st->hTdCngDec != NULL && st->hFdCngDec != NULL ) { /* update CNG parameters in active frames */ #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { cng_params_upd_fx( lsp_new_fx, exc_fx, st->L_frame, &st->hTdCngDec->ho_circ_ptr, st->hTdCngDec->ho_ener_circ_fx, &st->hTdCngDec->ho_circ_size, st->hTdCngDec->ho_lsp_circ_fx, st->Q_exc, DEC, st->hTdCngDec->ho_env_circ_fx, NULL, NULL, NULL, NULL, st->last_active_brate ); } ELSE #endif { cng_params_upd_ivas_fx( lsp_new_fx, exc_fx, st->L_frame, &st->hTdCngDec->ho_circ_ptr, st->hTdCngDec->ho_ener_circ_fx, &st->hTdCngDec->ho_circ_size, st->hTdCngDec->ho_lsp_circ_fx, st->Q_exc, DEC, st->hTdCngDec->ho_env_circ_fx, NULL, NULL, NULL, NULL, st->last_active_brate, st->element_mode, st->hFdCngDec->hFdCngCom->CngBandwidth ); } /* Set 16k LSP flag for CNG buffer */ st->hTdCngDec->ho_16k_lsp[st->hTdCngDec->ho_circ_ptr] = 0; Loading @@ -2220,6 +2446,9 @@ ivas_error acelp_core_dec_ivas_fx( } } #ifdef REMOVE_EVS_DUPLICATES IF( NE_16( st->element_mode, EVS_MONO ) ) #endif { IF( save_hb_synth_fx16 ) { Loading lib_dec/amr_wb_dec_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -374,7 +374,7 @@ ivas_error amr_wb_dec_fx( IF( EQ_32( st_fx->core_brate, FRAME_NO_DATA ) || EQ_32( st_fx->core_brate, SID_1k75 ) ) { /* decode CNG parameters */ #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES CNG_dec_ivas_fx( st_fx, EVS_MONO, Aq_fx, lsp_new_fx, lsf_new_fx, &allow_cn_step, &sid_bw, q_env ); #else CNG_dec_fx( st_fx, EVS_MONO, Aq_fx, lsp_new_fx, lsf_new_fx, &allow_cn_step, &sid_bw, q_env ); Loading Loading @@ -800,7 +800,7 @@ ivas_error amr_wb_dec_fx( PMT( "Fixed point not done here " ) ApplyFdCng_fx( syn, NULL, NULL, NULL, st, 0, 0 ); #else #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES ApplyFdCng_ivas_fx( syn_fx, st_fx->Q_syn, NULL, 0, NULL, NULL, NULL, st_fx, 0, 0 ); #else ApplyFdCng_fx( syn_fx, st_fx->Q_syn, NULL, NULL, NULL, st_fx, 0, 0 ); Loading lib_dec/decision_matrix_dec_fx.c +15 −0 Original line number Diff line number Diff line Loading @@ -713,5 +713,20 @@ void decision_matrix_dec_fx( move16(); } #ifdef REMOVE_EVS_DUPLICATES2 /*-----------------------------------------------------------------* * set inactive coder_type flag in ACELP core *-----------------------------------------------------------------*/ st->inactive_coder_type_flag = 0; /* AVQ by default */ move16(); if ( LE_32( st->total_brate, MAX_GSC_INACTIVE_BRATE ) ) { st->inactive_coder_type_flag = 1; /* GSC */ move16(); } #endif return; } lib_dec/evs_dec_fx.c +5 −2 Original line number Diff line number Diff line Loading @@ -346,8 +346,11 @@ ivas_error evs_dec_fx( IF( EQ_16( st_fx->core, ACELP_CORE ) ) { /* ACELP core decoder */ #ifdef REMOVE_EVS_DUPLICATES2 IF( ( error = acelp_core_dec_ivas_fx( st_fx, NULL, synth_fx, NULL, bwe_exc_extended_fx, voice_factors_fx, old_syn_12k8_16k_fx, sharpFlag, pitch_buf_fx, &unbits, &sid_bw, NULL, NULL, NULL, 0, EVS_MONO, 0, 0, 1, NULL, 1 ) ) != IVAS_ERR_OK ) #else IF( ( error = acelp_core_dec_fx( st_fx, NULL, synth_fx, NULL, bwe_exc_extended_fx, voice_factors_fx, old_syn_12k8_16k_fx, sharpFlag, pitch_buf_fx, &unbits, &sid_bw, NULL, NULL, NULL, 0, EVS_MONO, 0, 0, 1, NULL, 1 ) ) != IVAS_ERR_OK ) #endif { return error; } Loading Loading @@ -1000,7 +1003,7 @@ ivas_error evs_dec_fx( #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT ApplyFdCng_fx( output, NULL, realBuffer, imagBuffer, st, concealWholeFrame, 0 ); #else #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES ApplyFdCng_ivas_fx( output_sp, 0, NULL, 0, realBuffer, imagBuffer, &st_fx->scaleFactor.hb_scale, st_fx, concealWholeFrame, 0 ); #else ApplyFdCng_fx( output_sp, 0, realBuffer, imagBuffer, &st_fx->scaleFactor.hb_scale, st_fx, concealWholeFrame, 0 ); Loading Loading
lib_dec/acelp_core_dec_fx.c +9 −9 Original line number Diff line number Diff line Loading @@ -432,7 +432,7 @@ ivas_error acelp_core_dec_fx( } /* update synthesis filter memories */ #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES ivas_synth_mem_updt2_fx( st_fx->L_frame, st_fx->last_L_frame, st_fx->old_exc_fx, st_fx->mem_syn_r, st_fx->mem_syn2_fx, NULL, dec ); #else synth_mem_updt2( st_fx->L_frame, st_fx->last_L_frame, st_fx->old_exc_fx, st_fx->mem_syn_r, st_fx->mem_syn2_fx, NULL, dec ); Loading Loading @@ -634,7 +634,7 @@ ivas_error acelp_core_dec_fx( /* decode CNG parameters */ IF( st_fx->cng_type == LP_CNG ) { #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES CNG_dec_ivas_fx( st_fx, st_fx->last_element_mode, Aq_fx, lsp_new_fx, lsf_new_fx, &allow_cn_step_fx, sid_bw, q_env ); #else CNG_dec_fx( st_fx, st_fx->last_element_mode, Aq_fx, lsp_new_fx, lsf_new_fx, &allow_cn_step_fx, sid_bw, q_env ); Loading Loading @@ -708,11 +708,11 @@ ivas_error acelp_core_dec_fx( } i = st_fx->Q_exc; move16(); #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES test(); IF( st_fx->hMusicPF && st_fx->hGSCDec ) { #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { // VE: TBV: 'st_fx->L_frame * HIBND_ACB_L_FAC' should be corrected Loading Loading @@ -1593,7 +1593,7 @@ ivas_error acelp_core_dec_fx( move32(); } /*Noise estimate*/ #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES IF( NE_16( st_fx->element_mode, IVAS_CPE_TD ) && !st_fx->cng_ism_flag ) #else IF( NE_16( st_fx->element_mode, IVAS_CPE_TD ) /* && !st->cng_ism_flag IVAS_CODE */ ) Loading @@ -1603,7 +1603,7 @@ ivas_error acelp_core_dec_fx( PMT( "Code for IVAS_CODE_CNG_FIX185_PLC_FADEOUT not done" ) ApplyFdCng_fx( syn, st_fx->Q_syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); #else #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES ApplyFdCng_ivas_fx( syn_fx, st_fx->Q_syn, NULL, 0, realBuffer, imagBuffer, NULL, st_fx, 0, ( st_fx->coder_type == AUDIO && !st_fx->GSC_noisy_speech ) ); #else ApplyFdCng_fx( syn_fx, st_fx->Q_syn, realBuffer, imagBuffer, NULL, st_fx, 0, ( EQ_16( st_fx->coder_type, AUDIO ) && st_fx->GSC_noisy_speech == 0 ) ); Loading Loading @@ -1792,7 +1792,7 @@ ivas_error acelp_core_dec_fx( st_fx->stab_fac_fx, &st_fx->stab_fac_smooth_fx, st_fx->coder_type, st_fx->Q_syn, bpf_error_signal ); } #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { /* analysis of the synthesis at internal sampling rate */ Loading Loading @@ -2033,7 +2033,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 ) ) ) ) ) { #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { 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, Loading @@ -2049,7 +2049,7 @@ ivas_error acelp_core_dec_fx( #endif } #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES ELSE { hf_synth_reset_fx( st_fx->hBWE_zero ); Loading
lib_dec/acelp_core_dec_ivas_fx.c +567 −338 Original line number Diff line number Diff line Loading @@ -151,7 +151,6 @@ ivas_error acelp_core_dec_ivas_fx( error = IVAS_ERR_OK; move32(); test(); test(); test(); Loading Loading @@ -664,11 +663,21 @@ ivas_error acelp_core_dec_ivas_fx( test(); IF( EQ_32( st->core_brate, SID_2k40 ) && NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { FdCng_decodeSID_fx( st->hFdCngDec->hFdCngCom, st ); } ELSE #endif { Word16 old_NoiseEstExp = st->hFdCngDec->hFdCngCom->sidNoiseEstExp; move16(); FdCng_decodeSID_ivas_fx( st ); rescale_fdCngDec( st->hFdCngDec, sub( old_NoiseEstExp, st->hFdCngDec->hFdCngCom->sidNoiseEstExp ) ); Scale_sig( st->hFdCngDec->hFdCngCom->A_cng, M + 1, sub( norm_s( st->hFdCngDec->hFdCngCom->A_cng[0] ), Q2 ) ); // Qx } *sid_bw = 0; move16(); } Loading Loading @@ -720,7 +729,16 @@ ivas_error acelp_core_dec_ivas_fx( } } #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { generate_comfort_noise_dec_fx( NULL, NULL, NULL, st, &( st->Q_exc ), 2, -1 ); } ELSE #endif { generate_comfort_noise_dec_ivas_fx( NULL, NULL, NULL, st, &( st->Q_exc ), 1, nchan_out ); } FdCng_exc( st->hFdCngDec->hFdCngCom, &st->CNG_mode, st->L_frame, st->lsp_old_fx, st->first_CNG, st->lspCNG_fx, Aq_fx, lsp_new_fx, lsf_new_fx, exc_fx, exc2_fx, bwe_exc_fx ); Loading @@ -740,9 +758,20 @@ ivas_error acelp_core_dec_ivas_fx( test(); IF( st->hMusicPF && st->hGSCDec ) { #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { // VE: TBV: 'st_fx->L_frame * HIBND_ACB_L_FAC' should be corrected Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, exc_fx, bwe_exc_fx, st->hGSCDec->last_exc_dct_in_fx, st->L_frame, st->L_frame * HIBND_ACB_L_FAC, 0, &( st->Q_exc ), st->Q_subfr, NULL, 0, INACTIVE ); } ELSE #endif { Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, exc_fx, bwe_exc_fx, st->hGSCDec->last_exc_dct_in_fx, st->L_frame, imult1616( st->L_frame, HIBND_ACB_L_FAC ), 0, &( st->Q_exc ), st->Q_subfr, NULL, 0, INACTIVE ); } } IF( st->hPFstat != NULL ) { Rescale_mem( st->Q_exc, &st->prev_Q_syn, &st->Q_syn, st->mem_syn2_fx, st->mem_syn_clas_estim_fx, delta_mem_scale, Loading @@ -763,13 +792,25 @@ ivas_error acelp_core_dec_ivas_fx( /* Update music post processing values */ /* Filter energies update */ #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { FOR( i = 0; i < DCT_L_POST; i++ ) { st->hMusicPF->filt_lfE_fx[i] = round_fx( L_mac( ( 1228 << ( 16 ) ), 22938, st->hMusicPF->filt_lfE_fx[i] ) ); move16(); } } ELSE #endif { FOR( i = 0; i < DCT_L_POST; i++ ) { st->hMusicPF->filt_lfE_fx[i] = add( 9830, mult_r( 22937, st->hMusicPF->filt_lfE_fx[i] ) ); // Q15, 9830 =.3f in Q15, 22937=.7f in Q15 move16(); } } } /* synthesis at 12.8kHz sampling rate */ #ifndef FIX_1100_REMOVE_LPC_RESCALING Loading @@ -778,15 +819,28 @@ ivas_error acelp_core_dec_ivas_fx( move16(); syn_12k8_fx( st->L_frame, Aq_fx, exc2_fx, psyn_fx, st->mem_syn2_fx, 1, st->Q_exc, st->Q_syn ); syn_12k8_fx( st->L_frame, Aq_fx, exc3_fx, syn1_fx, st->mem_syn3_fx, 1, st->Q_exc, st->Q_syn ); /* reset the decoder */ CNG_reset_dec_fx( st, pitch_buf_fx, voice_factors_fx ); #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { /* update st_fx->mem_syn1 for ACELP core switching */ Copy( st->mem_syn3_fx, st->mem_syn1_fx, M ); } ELSE #endif { st->Q_syn_cng = st->Q_syn; move16(); st->Q_exc_cng = st->Q_exc; move16(); /* reset the decoder */ CNG_reset_dec_fx( st, pitch_buf_fx, voice_factors_fx ); /* update st->mem_syn1 for ACELP core switching */ Copy_Scale_sig( st->mem_syn3_fx, st->mem_syn1_fx, M, sub( -1, st->Q_syn ) ); // Q(-1) } /* update old synthesis for classification */ Copy( syn1_fx + st->L_frame - L_SYN_MEM_CLAS_ESTIM, st->mem_syn_clas_estim_fx, L_SYN_MEM_CLAS_ESTIM ); Loading Loading @@ -1157,13 +1211,30 @@ ivas_error acelp_core_dec_ivas_fx( Word16 qdct = 0; move16(); /* Extrapolation of the last future part, windowing and high resolution DCT transform */ #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { // VE: TBV: this is a bug in EVS - 'st->last_coder_type' should be replaced by 'st->core_brate' Prep_music_postP_fx( exc_buffer_fx, dct_buffer_fx, st->hMusicPF->filt_lfE_fx, st->last_coder_type, st->element_mode, pitch_buf_fx, st->hMusicPF->LDm_enh_lp_gbin_fx, st->Q_exc, &qdct ); } ELSE #endif { Prep_music_postP_fx( exc_buffer_fx, dct_buffer_fx, st->hMusicPF->filt_lfE_fx, st->last_core, st->element_mode, pitch_buf_fx, st->hMusicPF->LDm_enh_lp_gbin_fx, st->Q_exc, &qdct ); } /* LD music post-filter */ LD_music_post_filter_fx( st->hMusicPF, dct_buffer_fx, dct_buffer_fx, st->core_brate, &st->hMusicPF->Old_ener_Q, AUDIO, last_coder_type, qdct ); /* Inverse DCT transform, retrieval of the aligned excitation, re-synthesis */ #ifdef REMOVE_EVS_DUPLICATES IF( NE_16( st->element_mode, EVS_MONO ) ) // VE: TBC whether needed in IVAS #endif { Copy( st->mem_syn2_fx, mem_tmp_fx, M ); /*Q_syn*/ } Post_music_postP_fx( dct_buffer_fx, exc2_fx, st->mem_syn2_fx, st->mem_syn2_fx, Aq_fx, psyn_fx, &st->Q_exc, &st->prev_Q_syn, &st->Q_syn, st->mem_syn_clas_estim_fx, 0, &st->mem_deemph_fx, st->hBPF->pst_old_syn_fx, &st->hBPF->pst_mem_deemp_err_fx, &st->agc_mem_fx[1], st->hPFstat, temp_buf_fx, mem_tmp_fx ); Loading Loading @@ -1209,6 +1280,7 @@ ivas_error acelp_core_dec_ivas_fx( /*------------------------------------------------------------* * FEC - Estimate the classification information *------------------------------------------------------------*/ FEC_clas_estim_fx( st, st->Opt_AMR_WB, st->L_frame, &st->clas_dec, st->coder_type, pitch_buf_fx, psyn_fx, &st->lp_ener_FER_fx, &st->decision_hyst, NULL, NULL, NULL, NULL, 0, NULL, st->Q_syn, temp_buf_fx, Loading Loading @@ -1586,6 +1658,14 @@ ivas_error acelp_core_dec_ivas_fx( } ELSE IF( NE_16( st->element_mode, IVAS_CPE_DFT ) ) { #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { generate_masking_noise_fx( psyn_fx, st->Q_syn, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0 ); } ELSE #endif { IF( st->idchan == 0 ) { IF( NE_16( st->element_mode, last_element_mode ) ) Loading @@ -1602,6 +1682,7 @@ ivas_error acelp_core_dec_ivas_fx( } } } } ELSE IF( st->flag_cna && EQ_16( st->coder_type, AUDIO ) && ( ( st->last_core == ACELP_CORE && !( EQ_16( st->last_coder_type, AUDIO ) && !( st->element_mode > EVS_MONO && st->Last_GSC_noisy_speech_flag ) ) ) || EQ_16( st->last_core, TCX_20_CORE ) ) ) { test(); Loading Loading @@ -1685,6 +1766,114 @@ ivas_error acelp_core_dec_ivas_fx( * Bass post-filter *----------------------------------------------------------------*/ #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { CLDFB_SCALE_FACTOR scaleFactor; Word32 workBuffer[128 * 3]; /* check if the CLDFB works on the right sample rate */ IF( ( st->cldfbAna->usb * st->cldfbAna->no_col ) != st->L_frame ) { /* resample to ACELP internal sampling rate */ Word16 newCldfbBands = CLDFB_getNumChannels( L_mult0( st->L_frame, FRAMES_PER_SEC ) ); resampleCldfb( st->cldfbAna, newCldfbBands, st->L_frame, 0 ); resampleCldfb( st->cldfbBPF, newCldfbBands, st->L_frame, 0 ); IF( st->ini_frame > 0 ) { st->cldfbSyn->bandsToZero = sub( st->cldfbSyn->no_channels, st->cldfbAna->no_channels ); move16(); } } test(); IF( NE_16( st->L_frame, st->last_L_frame ) && NE_16( st->last_codec_mode, MODE2 ) ) { IF( EQ_16( st->L_frame, L_FRAME ) ) { retro_interp5_4_fx( st->hBPF->pst_old_syn_fx ); } ELSE IF( EQ_16( st->L_frame, L_FRAME16k ) ) { retro_interp4_5_fx( psyn_fx, st->hBPF->pst_old_syn_fx ); } } bass_psfilter_fx( st->hBPF, st->Opt_AMR_WB, psyn_fx, st->L_frame, pitch_buf_fx, st->bpf_off, st->stab_fac_fx, &st->stab_fac_smooth_fx, st->coder_type, st->Q_syn, bpf_error_signal_16fx ); /* analysis of the synthesis at internal sampling rate */ cldfbAnalysisFiltering( st->cldfbAna, realBuffer_fx, imagBuffer_fx, &scaleFactor, psyn_fx, negate( st->Q_syn ), CLDFB_NO_COL_MAX, workBuffer ); scaleFactor.hb_scale = scaleFactor.lb_scale; move16(); /* analysis and add the BPF error signal */ i = 0; move16(); if ( st->bpf_off == 0 ) { i = CLDFB_NO_COL_MAX; move16(); } addBassPostFilter_fx( bpf_error_signal_16fx, realBuffer_fx, imagBuffer_fx, st->cldfbBPF, workBuffer, negate( st->Q_syn ), i, st->cldfbAna->no_col, st->cldfbAna->no_channels, &scaleFactor ); /* set output mask for upsampling */ IF( EQ_16( st->bwidth, NB ) ) { /* set NB mask for upsampling */ st->cldfbSyn->bandsToZero = sub( st->cldfbSyn->no_channels, 10 ); move16(); } ELSE IF( NE_16( st->cldfbSyn->bandsToZero, sub( st->cldfbSyn->no_channels, st->cldfbAna->no_channels ) ) ) { /* in case of BW switching, re-init to default */ st->cldfbSyn->bandsToZero = sub( st->cldfbSyn->no_channels, st->cldfbAna->no_channels ); move16(); } /*WB/SWB-FD_CNG*/ scaleFactor.hb_scale = scaleFactor.lb_scale; move16(); test(); test(); test(); IF( ( ( st->core_brate == FRAME_NO_DATA ) || EQ_32( st->core_brate, SID_2k40 ) ) && ( EQ_16( st->cng_type, FD_CNG ) ) && ( LT_16( st->hFdCngDec->hFdCngCom->numCoreBands, st->cldfbSyn->no_channels ) ) ) { generate_comfort_noise_dec_hf_fx( realBuffer_fx, imagBuffer_fx, &scaleFactor.hb_scale, st ); st->cldfbSyn->bandsToZero = 0; move16(); IF( LT_16( st->hFdCngDec->hFdCngCom->regularStopBand, st->cldfbSyn->no_channels ) ) { st->cldfbSyn->bandsToZero = sub( st->cldfbSyn->no_channels, st->hFdCngDec->hFdCngCom->regularStopBand ); move16(); } st->cldfbSyn->lsb = st->cldfbAna->no_channels; move16(); } /* synthesis of the combined signal */ st->Q_syn2 = st->Q_syn; move16(); cldfbSynthesisFiltering( st->cldfbSyn, realBuffer_fx, imagBuffer_fx, &scaleFactor, synth_fx16, negate( st->Q_syn2 ), CLDFB_NO_COL_MAX, workBuffer ); /* Bring CLDFB output to Q0 */ Scale_sig( synth_fx16, output_frame, negate( st->Q_syn2 ) ); st->Q_syn2 = 0; move16(); /* save synthesis - needed in case of core switching */ Copy( synth_fx16, st->previoussynth_fx, output_frame ); } ELSE #endif { /* check if the CLDFB works on the right sample rate */ IF( NE_16( imult1616( st->cldfbAna->no_channels, st->cldfbAna->no_col ), st->L_frame ) ) { Loading Loading @@ -2111,6 +2300,8 @@ ivas_error acelp_core_dec_ivas_fx( st->Q_syn2 = 0; move16(); } /*-----------------------------------------------------------------* * Bandwidth extension 6kHz-7kHz *-----------------------------------------------------------------*/ Loading @@ -2126,6 +2317,15 @@ ivas_error acelp_core_dec_ivas_fx( IF( ( EQ_16( st->L_frame, L_FRAME ) && ( st->bwidth != NB ) && GE_16( output_frame, L_FRAME16k ) && ( EQ_16( st->extl, -1 ) || EQ_16( st->extl, SWB_CNG ) || ( EQ_16( st->extl, WB_BWE ) && st->extl_brate == 0 && NE_16( st->coder_type, AUDIO ) ) ) ) ) { #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { 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 ); } ELSE #endif { #ifdef MSAN_FIX Copy_Scale_sig_32_16( synth_fx, synth_fx16, output_frame, 0 ); // Q0 #else Loading @@ -2140,14 +2340,20 @@ ivas_error acelp_core_dec_ivas_fx( Copy_Scale_sig_16_32_DEPREC( synth_fx16, synth_fx, L_FRAME48k, 0 ); #endif } } ELSE { hf_synth_reset_fx( st->hBWE_zero ); #ifdef REMOVE_EVS_DUPLICATES2 IF( NE_16( st->element_mode, EVS_MONO ) ) // VE: TBV: tmp hack - it is a bug in EVS but conditon is here to keep EVS bit-exact #endif { #ifdef MSAN_FIX set16_fx( st->hBWE_zero->mem_hp400_fx, 0, 6 ); #endif } } } /*-----------------------------------------------------------------* * Populate parameters for SWB TBE Loading Loading @@ -2180,6 +2386,15 @@ ivas_error acelp_core_dec_ivas_fx( test(); IF( !st->ppp_mode_dec && ( st->idchan == 0 || NE_16( st->element_mode, IVAS_CPE_TD ) || ( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) && st->tdm_LRTD_flag ) ) ) { #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { non_linearity_fx( bwe_exc_fx, bwe_exc_extended_fx, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale_fx, st->Q_exc, st->coder_type, voice_factors_fx, st->L_frame ); } ELSE #endif { #ifdef FIX_ISSUE_1237 Copy_Scale_sig_16_32_no_sat( st->hBWE_TD->old_bwe_exc_extended_fx, bwe_exc_extended_fx, NL_BUFF_OFFSET, ( sub( shl( st->Q_exc, 1 ), sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc #else Loading @@ -2188,6 +2403,7 @@ ivas_error acelp_core_dec_ivas_fx( non_linearity_ivas_fx( bwe_exc_fx, bwe_exc_extended_fx + NL_BUFF_OFFSET, L_FRAME32k, &st->hBWE_TD->bwe_non_lin_prev_scale_fx, st->Q_exc, st->coder_type, voice_factors_fx, st->L_frame ); Copy_Scale_sig_32_16( bwe_exc_extended_fx + L_FRAME32k, st->hBWE_TD->old_bwe_exc_extended_fx, NL_BUFF_OFFSET, negate( sub( shl( st->Q_exc, 1 ), sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc } } test(); if ( st->core_brate == FRAME_NO_DATA || EQ_32( st->core_brate, SID_2k40 ) ) { Loading @@ -2195,6 +2411,7 @@ ivas_error acelp_core_dec_ivas_fx( move32(); } } /*----------------------------------------------------------------------* * Updates *----------------------------------------------------------------------*/ Loading @@ -2205,10 +2422,19 @@ ivas_error acelp_core_dec_ivas_fx( IF( GT_32( st->core_brate, SID_2k40 ) && st->hTdCngDec != NULL && st->hFdCngDec != NULL ) { /* update CNG parameters in active frames */ #ifdef REMOVE_EVS_DUPLICATES IF( EQ_16( st->element_mode, EVS_MONO ) ) { cng_params_upd_fx( lsp_new_fx, exc_fx, st->L_frame, &st->hTdCngDec->ho_circ_ptr, st->hTdCngDec->ho_ener_circ_fx, &st->hTdCngDec->ho_circ_size, st->hTdCngDec->ho_lsp_circ_fx, st->Q_exc, DEC, st->hTdCngDec->ho_env_circ_fx, NULL, NULL, NULL, NULL, st->last_active_brate ); } ELSE #endif { cng_params_upd_ivas_fx( lsp_new_fx, exc_fx, st->L_frame, &st->hTdCngDec->ho_circ_ptr, st->hTdCngDec->ho_ener_circ_fx, &st->hTdCngDec->ho_circ_size, st->hTdCngDec->ho_lsp_circ_fx, st->Q_exc, DEC, st->hTdCngDec->ho_env_circ_fx, NULL, NULL, NULL, NULL, st->last_active_brate, st->element_mode, st->hFdCngDec->hFdCngCom->CngBandwidth ); } /* Set 16k LSP flag for CNG buffer */ st->hTdCngDec->ho_16k_lsp[st->hTdCngDec->ho_circ_ptr] = 0; Loading @@ -2220,6 +2446,9 @@ ivas_error acelp_core_dec_ivas_fx( } } #ifdef REMOVE_EVS_DUPLICATES IF( NE_16( st->element_mode, EVS_MONO ) ) #endif { IF( save_hb_synth_fx16 ) { Loading
lib_dec/amr_wb_dec_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -374,7 +374,7 @@ ivas_error amr_wb_dec_fx( IF( EQ_32( st_fx->core_brate, FRAME_NO_DATA ) || EQ_32( st_fx->core_brate, SID_1k75 ) ) { /* decode CNG parameters */ #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES CNG_dec_ivas_fx( st_fx, EVS_MONO, Aq_fx, lsp_new_fx, lsf_new_fx, &allow_cn_step, &sid_bw, q_env ); #else CNG_dec_fx( st_fx, EVS_MONO, Aq_fx, lsp_new_fx, lsf_new_fx, &allow_cn_step, &sid_bw, q_env ); Loading Loading @@ -800,7 +800,7 @@ ivas_error amr_wb_dec_fx( PMT( "Fixed point not done here " ) ApplyFdCng_fx( syn, NULL, NULL, NULL, st, 0, 0 ); #else #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES ApplyFdCng_ivas_fx( syn_fx, st_fx->Q_syn, NULL, 0, NULL, NULL, NULL, st_fx, 0, 0 ); #else ApplyFdCng_fx( syn_fx, st_fx->Q_syn, NULL, NULL, NULL, st_fx, 0, 0 ); Loading
lib_dec/decision_matrix_dec_fx.c +15 −0 Original line number Diff line number Diff line Loading @@ -713,5 +713,20 @@ void decision_matrix_dec_fx( move16(); } #ifdef REMOVE_EVS_DUPLICATES2 /*-----------------------------------------------------------------* * set inactive coder_type flag in ACELP core *-----------------------------------------------------------------*/ st->inactive_coder_type_flag = 0; /* AVQ by default */ move16(); if ( LE_32( st->total_brate, MAX_GSC_INACTIVE_BRATE ) ) { st->inactive_coder_type_flag = 1; /* GSC */ move16(); } #endif return; }
lib_dec/evs_dec_fx.c +5 −2 Original line number Diff line number Diff line Loading @@ -346,8 +346,11 @@ ivas_error evs_dec_fx( IF( EQ_16( st_fx->core, ACELP_CORE ) ) { /* ACELP core decoder */ #ifdef REMOVE_EVS_DUPLICATES2 IF( ( error = acelp_core_dec_ivas_fx( st_fx, NULL, synth_fx, NULL, bwe_exc_extended_fx, voice_factors_fx, old_syn_12k8_16k_fx, sharpFlag, pitch_buf_fx, &unbits, &sid_bw, NULL, NULL, NULL, 0, EVS_MONO, 0, 0, 1, NULL, 1 ) ) != IVAS_ERR_OK ) #else IF( ( error = acelp_core_dec_fx( st_fx, NULL, synth_fx, NULL, bwe_exc_extended_fx, voice_factors_fx, old_syn_12k8_16k_fx, sharpFlag, pitch_buf_fx, &unbits, &sid_bw, NULL, NULL, NULL, 0, EVS_MONO, 0, 0, 1, NULL, 1 ) ) != IVAS_ERR_OK ) #endif { return error; } Loading Loading @@ -1000,7 +1003,7 @@ ivas_error evs_dec_fx( #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT ApplyFdCng_fx( output, NULL, realBuffer, imagBuffer, st, concealWholeFrame, 0 ); #else #ifdef REMOVE_EVS_DUPLICATES2 #ifdef REMOVE_EVS_DUPLICATES ApplyFdCng_ivas_fx( output_sp, 0, NULL, 0, realBuffer, imagBuffer, &st_fx->scaleFactor.hb_scale, st_fx, concealWholeFrame, 0 ); #else ApplyFdCng_fx( output_sp, 0, realBuffer, imagBuffer, &st_fx->scaleFactor.hb_scale, st_fx, concealWholeFrame, 0 ); Loading