Loading lib_dec/acelp_core_dec_fx.c +124 −5 Original line number Diff line number Diff line Loading @@ -661,7 +661,7 @@ ivas_error acelp_core_dec_fx( test(); IF( EQ_32( st_fx->core_brate, SID_2k40 ) && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) { FdCng_decodeSID_fx( st_fx->hFdCngDec->hFdCngCom, st_fx ); FdCng_decodeSID_fx( st_fx->hFdCngDec->hFdCngCom, st_fx ); // VE: 2 variants needed *sid_bw = 0; move16(); } Loading Loading @@ -691,8 +691,7 @@ ivas_error acelp_core_dec_fx( } } #endif //generate_comfort_noise_dec_ivas_fx( NULL, NULL, NULL, st_fx, &( st_fx->Q_exc ), 1, nchan_out ); generate_comfort_noise_dec_fx( NULL, NULL, NULL, st_fx, &( st_fx->Q_exc ), 2, -1 ); generate_comfort_noise_dec_fx( NULL, NULL, NULL, st_fx, &( st_fx->Q_exc ), 2, -1 ); // VE: 2 variants needed FdCng_exc( st_fx->hFdCngDec->hFdCngCom, &st_fx->CNG_mode, st_fx->L_frame, st_fx->lsp_old_fx, st_fx->first_CNG, st_fx->lspCNG_fx, Aq_fx, lsp_new_fx, lsf_new_fx, exc_fx, exc2_fx, bwe_exc_fx ); Loading @@ -709,10 +708,29 @@ ivas_error acelp_core_dec_fx( } i = st_fx->Q_exc; move16(); #ifdef REMOVE_EVS_DUPLICATES2 test(); IF( st_fx->hMusicPF && st_fx->hGSCDec ) { Rescale_exc( st_fx->hMusicPF->dct_post_old_exc_fx, exc_fx, bwe_exc_fx, st_fx->hGSCDec->last_exc_dct_in_fx, st_fx->L_frame, imult1616( st_fx->L_frame, HIBND_ACB_L_FAC ), 0, &( st_fx->Q_exc ), st_fx->Q_subfr, NULL, 0, INACTIVE ); } IF( st_fx->hPFstat != NULL ) { Rescale_mem( st_fx->Q_exc, &st_fx->prev_Q_syn, &st_fx->Q_syn, st_fx->mem_syn2_fx, st_fx->mem_syn_clas_estim_fx, delta_mem_scale, &st_fx->mem_deemph_fx, st_fx->hBPF->pst_old_syn_fx, &st_fx->hBPF->pst_mem_deemp_err_fx, &st_fx->agc_mem_fx[1], st_fx->hPFstat, 0, 0, NULL ); } ELSE { Rescale_mem( st_fx->Q_exc, &st_fx->prev_Q_syn, &st_fx->Q_syn, st_fx->mem_syn2_fx, st_fx->mem_syn_clas_estim_fx, delta_mem_scale, &st_fx->mem_deemph_fx, NULL, NULL, &st_fx->agc_mem_fx[1], NULL, 0, 0, NULL ); } #else Rescale_exc( hMusicPF->dct_post_old_exc_fx, exc_fx, bwe_exc_fx, st_fx->hGSCDec->last_exc_dct_in_fx, st_fx->L_frame, st_fx->L_frame * HIBND_ACB_L_FAC, 0, &( st_fx->Q_exc ), st_fx->Q_subfr, NULL, 0, INACTIVE ); Rescale_mem( st_fx->Q_exc, &st_fx->prev_Q_syn, &st_fx->Q_syn, st_fx->mem_syn2_fx, st_fx->mem_syn_clas_estim_fx, delta_mem_scale, &st_fx->mem_deemph_fx, hBPF->pst_old_syn_fx, &hBPF->pst_mem_deemp_err_fx, &st_fx->agc_mem_fx[1], st_fx->hPFstat, 0, 0, NULL ); #endif Copy_Scale_sig( exc2_fx, exc2_fx, st_fx->L_frame, sub( st_fx->Q_exc, i ) ); // Q_exc /* update past excitation signals for LD music post-filter */ Loading @@ -725,7 +743,7 @@ ivas_error acelp_core_dec_fx( FOR( i = 0; i < DCT_L_POST; i++ ) { /*st_fx->filt_lfE_fx[i] = 0.3f + 0.7f * st_fx->filt_lfE_fx[i];*/ hMusicPF->filt_lfE_fx[i] = round_fx( L_mac( ( 1228 << ( 16 ) ), 22938, hMusicPF->filt_lfE_fx[i] ) ); hMusicPF->filt_lfE_fx[i] = round_fx( L_mac( ( 1228 << ( 16 ) ), 22938, hMusicPF->filt_lfE_fx[i] ) ); // VE: 2 variants needed move16(); } } Loading Loading @@ -1574,8 +1592,11 @@ 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 //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 ) ); #ifdef REMOVE_EVS_DUPLICATES2 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 ) ); #endif #endif } /* CNA: Generate additional comfort noise to mask potential coding artefacts */ Loading Loading @@ -1759,6 +1780,82 @@ ivas_error acelp_core_dec_fx( bass_psfilter_fx( st_fx->hBPF, st_fx->Opt_AMR_WB, syn_fx, st_fx->L_frame, pitch_buf_fx, st_fx->bpf_off, 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 IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { /* analysis of the synthesis at internal sampling rate */ cldfbAnalysisFiltering( st_fx->cldfbAna, realBuffer, imagBuffer, &scaleFactor, syn_fx, negate( st_fx->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_fx->bpf_off == 0 ) { i = CLDFB_NO_COL_MAX; move16(); } addBassPostFilter_fx( bpf_error_signal, realBuffer, imagBuffer, st_fx->cldfbBPF, workBuffer, negate( st_fx->Q_syn ), i, st_fx->cldfbAna->no_col, st_fx->cldfbAna->no_channels, &scaleFactor ); /* set output mask for upsampling */ IF( EQ_16( st_fx->bwidth, NB ) ) { /* set NB mask for upsampling */ st_fx->cldfbSyn->bandsToZero = sub( st_fx->cldfbSyn->no_channels, 10 ); move16(); } ELSE IF( NE_16( st_fx->cldfbSyn->bandsToZero, sub( st_fx->cldfbSyn->no_channels, st_fx->cldfbAna->no_channels ) ) ) { /* in case of BW switching, re-init to default */ st_fx->cldfbSyn->bandsToZero = sub( st_fx->cldfbSyn->no_channels, st_fx->cldfbAna->no_channels ); move16(); } /*WB/SWB-FD_CNG*/ scaleFactor.hb_scale = scaleFactor.lb_scale; move16(); test(); IF( !st_fx->cng_sba_flag || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) { test(); test(); test(); IF( ( ( st_fx->core_brate == FRAME_NO_DATA ) || EQ_32( st_fx->core_brate, SID_2k40 ) ) && ( EQ_16( st_fx->cng_type, FD_CNG ) ) && ( LT_16( st_fx->hFdCngDec->hFdCngCom->numCoreBands, st_fx->cldfbSyn->no_channels ) ) ) { generate_comfort_noise_dec_hf_fx( realBuffer, imagBuffer, &scaleFactor.hb_scale, st_fx ); st_fx->cldfbSyn->bandsToZero = 0; move16(); IF( LT_16( st_fx->hFdCngDec->hFdCngCom->regularStopBand, st_fx->cldfbSyn->no_channels ) ) { st_fx->cldfbSyn->bandsToZero = sub( st_fx->cldfbSyn->no_channels, st_fx->hFdCngDec->hFdCngCom->regularStopBand ); move16(); } st_fx->cldfbSyn->lsb = st_fx->cldfbAna->no_channels; move16(); } } /* synthesis of the combined signal */ st_fx->Q_syn2 = st_fx->Q_syn; move16(); cldfbSynthesisFiltering( st_fx->cldfbSyn, realBuffer, imagBuffer, &scaleFactor, synth_out, negate( st_fx->Q_syn2 ), CLDFB_NO_COL_MAX, workBuffer ); /* Bring CLDFB output to Q0 */ Scale_sig( synth_out, output_frame, negate( st_fx->Q_syn2 ) ); st_fx->Q_syn2 = 0; move16(); /* save synthesis - needed in case of core switching */ Copy( synth_out, st_fx->previoussynth_fx, output_frame ); } #else test(); IF( NE_16( st_fx->element_mode, IVAS_CPE_DFT ) || use_cldfb_for_dft ) { Loading Loading @@ -1881,6 +1978,7 @@ ivas_error acelp_core_dec_fx( /* save synthesis - needed in case of core switching */ Copy( synth_out, st_fx->previoussynth_fx, output_frame ); } #endif #ifdef IVAS_CODE ELSE { Loading Loading @@ -1924,6 +2022,9 @@ 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 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, 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 ); } Loading @@ -1931,6 +2032,24 @@ ivas_error acelp_core_dec_fx( { hf_synth_reset_fx( st_fx->hBWE_zero ); } #else 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 ); #endif } #ifdef REMOVE_EVS_DUPLICATES2 ELSE { hf_synth_reset_fx( st_fx->hBWE_zero ); #ifdef MSAN_FIX IF( NE_16( st_fx->element_mode, EVS_MONO ) ) // TBV: tmp hack - it is a bug in EVS but conditon is here to keep EVS bit-exact { set16_fx( st_fx->hBWE_zero->mem_hp400_fx, 0, 6 ); } #endif } #endif } /*-----------------------------------------------------------------* Loading lib_dec/fd_cng_dec_fx.c +40 −5 Original line number Diff line number Diff line Loading @@ -957,7 +957,6 @@ Word16 ApplyFdCng_fx( { #ifdef REMOVE_EVS_DUPLICATES2 scalebands_fx( hFdCngDec->msNoiseEst, hFdCngDec->part_shaping, hFdCngDec->nFFTpart_shaping, hFdCngDec->midband_shaping, hFdCngDec->nFFTpart_shaping, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ), hFdCngDec->bandNoiseShape, 1 ); #else scalebands( hFdCngDec->msNoiseEst, hFdCngDec->part_shaping, hFdCngDec->nFFTpart_shaping, hFdCngDec->midband_shaping, hFdCngDec->nFFTpart_shaping, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ), hFdCngDec->bandNoiseShape, 1 ); #endif Loading Loading @@ -1279,7 +1278,16 @@ Word16 ApplyFdCng_ivas_fx( ( !st->BER_detect ) ) { /* Perform noise estimation at the decoder */ #ifdef REMOVE_EVS_DUPLICATES2 IF( EQ_16( st->element_mode, EVS_MONO ) ) { perform_noise_estimation_dec_fx( timeDomainInput, Q, hFdCngDec ); } ELSE #endif { perform_noise_estimation_dec_ivas_fx( timeDomainInput, Q, powerSpectrum, Q_power_spectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); } /* Update the shaping parameters */ test(); Loading Loading @@ -1522,9 +1530,18 @@ Word16 ApplyFdCng_ivas_fx( IF( hFdCngCom->active_frame_counter > 0 ) { /* Perform noise estimation in active frames in the decoder for downward updates */ #ifdef REMOVE_EVS_DUPLICATES2 IF( EQ_16( st->element_mode, EVS_MONO ) ) { perform_noise_estimation_dec_fx( timeDomainInput, Q, hFdCngDec ); } ELSE #endif { perform_noise_estimation_dec_ivas_fx( timeDomainInput, Q, powerSpectrum, Q_power_spectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); } } } test(); IF( EQ_16( concealWholeFrame, 1 ) && EQ_16( st->nbLostCmpt, 1 ) ) Loading Loading @@ -1580,7 +1597,16 @@ Word16 ApplyFdCng_ivas_fx( IF( st != NULL && EQ_16( st->cng_type, LP_CNG ) ) { /* Perform noise estimation on inactive phase at the decoder */ #ifdef REMOVE_EVS_DUPLICATES2 IF( EQ_16( st->element_mode, EVS_MONO ) ) { perform_noise_estimation_dec_fx( timeDomainInput, Q, hFdCngDec ); } ELSE #endif { perform_noise_estimation_dec_ivas_fx( timeDomainInput, Q, powerSpectrum, Q_power_spectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); } /* Update the shaping parameters */ Loading Loading @@ -1833,8 +1859,17 @@ Word16 ApplyFdCng_ivas_fx( IF( EQ_16( st->codec_mode, MODE2 ) ) { /* Generate comfort noise during SID or zero frames */ #ifdef REMOVE_EVS_DUPLICATES2 IF( EQ_16( st->element_mode, EVS_MONO ) ) { generate_comfort_noise_dec_fx( cldfbBufferReal, cldfbBufferImag, cldfbBufferScale, st, &( st->Q_exc ), 2, -1 ); } ELSE #endif { generate_comfort_noise_dec_ivas_fx( cldfbBufferReal, cldfbBufferImag, cldfbBufferScale, st, &( st->Q_exc ), 2, -1 ); } } BREAK; Loading Loading
lib_dec/acelp_core_dec_fx.c +124 −5 Original line number Diff line number Diff line Loading @@ -661,7 +661,7 @@ ivas_error acelp_core_dec_fx( test(); IF( EQ_32( st_fx->core_brate, SID_2k40 ) && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) { FdCng_decodeSID_fx( st_fx->hFdCngDec->hFdCngCom, st_fx ); FdCng_decodeSID_fx( st_fx->hFdCngDec->hFdCngCom, st_fx ); // VE: 2 variants needed *sid_bw = 0; move16(); } Loading Loading @@ -691,8 +691,7 @@ ivas_error acelp_core_dec_fx( } } #endif //generate_comfort_noise_dec_ivas_fx( NULL, NULL, NULL, st_fx, &( st_fx->Q_exc ), 1, nchan_out ); generate_comfort_noise_dec_fx( NULL, NULL, NULL, st_fx, &( st_fx->Q_exc ), 2, -1 ); generate_comfort_noise_dec_fx( NULL, NULL, NULL, st_fx, &( st_fx->Q_exc ), 2, -1 ); // VE: 2 variants needed FdCng_exc( st_fx->hFdCngDec->hFdCngCom, &st_fx->CNG_mode, st_fx->L_frame, st_fx->lsp_old_fx, st_fx->first_CNG, st_fx->lspCNG_fx, Aq_fx, lsp_new_fx, lsf_new_fx, exc_fx, exc2_fx, bwe_exc_fx ); Loading @@ -709,10 +708,29 @@ ivas_error acelp_core_dec_fx( } i = st_fx->Q_exc; move16(); #ifdef REMOVE_EVS_DUPLICATES2 test(); IF( st_fx->hMusicPF && st_fx->hGSCDec ) { Rescale_exc( st_fx->hMusicPF->dct_post_old_exc_fx, exc_fx, bwe_exc_fx, st_fx->hGSCDec->last_exc_dct_in_fx, st_fx->L_frame, imult1616( st_fx->L_frame, HIBND_ACB_L_FAC ), 0, &( st_fx->Q_exc ), st_fx->Q_subfr, NULL, 0, INACTIVE ); } IF( st_fx->hPFstat != NULL ) { Rescale_mem( st_fx->Q_exc, &st_fx->prev_Q_syn, &st_fx->Q_syn, st_fx->mem_syn2_fx, st_fx->mem_syn_clas_estim_fx, delta_mem_scale, &st_fx->mem_deemph_fx, st_fx->hBPF->pst_old_syn_fx, &st_fx->hBPF->pst_mem_deemp_err_fx, &st_fx->agc_mem_fx[1], st_fx->hPFstat, 0, 0, NULL ); } ELSE { Rescale_mem( st_fx->Q_exc, &st_fx->prev_Q_syn, &st_fx->Q_syn, st_fx->mem_syn2_fx, st_fx->mem_syn_clas_estim_fx, delta_mem_scale, &st_fx->mem_deemph_fx, NULL, NULL, &st_fx->agc_mem_fx[1], NULL, 0, 0, NULL ); } #else Rescale_exc( hMusicPF->dct_post_old_exc_fx, exc_fx, bwe_exc_fx, st_fx->hGSCDec->last_exc_dct_in_fx, st_fx->L_frame, st_fx->L_frame * HIBND_ACB_L_FAC, 0, &( st_fx->Q_exc ), st_fx->Q_subfr, NULL, 0, INACTIVE ); Rescale_mem( st_fx->Q_exc, &st_fx->prev_Q_syn, &st_fx->Q_syn, st_fx->mem_syn2_fx, st_fx->mem_syn_clas_estim_fx, delta_mem_scale, &st_fx->mem_deemph_fx, hBPF->pst_old_syn_fx, &hBPF->pst_mem_deemp_err_fx, &st_fx->agc_mem_fx[1], st_fx->hPFstat, 0, 0, NULL ); #endif Copy_Scale_sig( exc2_fx, exc2_fx, st_fx->L_frame, sub( st_fx->Q_exc, i ) ); // Q_exc /* update past excitation signals for LD music post-filter */ Loading @@ -725,7 +743,7 @@ ivas_error acelp_core_dec_fx( FOR( i = 0; i < DCT_L_POST; i++ ) { /*st_fx->filt_lfE_fx[i] = 0.3f + 0.7f * st_fx->filt_lfE_fx[i];*/ hMusicPF->filt_lfE_fx[i] = round_fx( L_mac( ( 1228 << ( 16 ) ), 22938, hMusicPF->filt_lfE_fx[i] ) ); hMusicPF->filt_lfE_fx[i] = round_fx( L_mac( ( 1228 << ( 16 ) ), 22938, hMusicPF->filt_lfE_fx[i] ) ); // VE: 2 variants needed move16(); } } Loading Loading @@ -1574,8 +1592,11 @@ 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 //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 ) ); #ifdef REMOVE_EVS_DUPLICATES2 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 ) ); #endif #endif } /* CNA: Generate additional comfort noise to mask potential coding artefacts */ Loading Loading @@ -1759,6 +1780,82 @@ ivas_error acelp_core_dec_fx( bass_psfilter_fx( st_fx->hBPF, st_fx->Opt_AMR_WB, syn_fx, st_fx->L_frame, pitch_buf_fx, st_fx->bpf_off, 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 IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { /* analysis of the synthesis at internal sampling rate */ cldfbAnalysisFiltering( st_fx->cldfbAna, realBuffer, imagBuffer, &scaleFactor, syn_fx, negate( st_fx->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_fx->bpf_off == 0 ) { i = CLDFB_NO_COL_MAX; move16(); } addBassPostFilter_fx( bpf_error_signal, realBuffer, imagBuffer, st_fx->cldfbBPF, workBuffer, negate( st_fx->Q_syn ), i, st_fx->cldfbAna->no_col, st_fx->cldfbAna->no_channels, &scaleFactor ); /* set output mask for upsampling */ IF( EQ_16( st_fx->bwidth, NB ) ) { /* set NB mask for upsampling */ st_fx->cldfbSyn->bandsToZero = sub( st_fx->cldfbSyn->no_channels, 10 ); move16(); } ELSE IF( NE_16( st_fx->cldfbSyn->bandsToZero, sub( st_fx->cldfbSyn->no_channels, st_fx->cldfbAna->no_channels ) ) ) { /* in case of BW switching, re-init to default */ st_fx->cldfbSyn->bandsToZero = sub( st_fx->cldfbSyn->no_channels, st_fx->cldfbAna->no_channels ); move16(); } /*WB/SWB-FD_CNG*/ scaleFactor.hb_scale = scaleFactor.lb_scale; move16(); test(); IF( !st_fx->cng_sba_flag || EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) { test(); test(); test(); IF( ( ( st_fx->core_brate == FRAME_NO_DATA ) || EQ_32( st_fx->core_brate, SID_2k40 ) ) && ( EQ_16( st_fx->cng_type, FD_CNG ) ) && ( LT_16( st_fx->hFdCngDec->hFdCngCom->numCoreBands, st_fx->cldfbSyn->no_channels ) ) ) { generate_comfort_noise_dec_hf_fx( realBuffer, imagBuffer, &scaleFactor.hb_scale, st_fx ); st_fx->cldfbSyn->bandsToZero = 0; move16(); IF( LT_16( st_fx->hFdCngDec->hFdCngCom->regularStopBand, st_fx->cldfbSyn->no_channels ) ) { st_fx->cldfbSyn->bandsToZero = sub( st_fx->cldfbSyn->no_channels, st_fx->hFdCngDec->hFdCngCom->regularStopBand ); move16(); } st_fx->cldfbSyn->lsb = st_fx->cldfbAna->no_channels; move16(); } } /* synthesis of the combined signal */ st_fx->Q_syn2 = st_fx->Q_syn; move16(); cldfbSynthesisFiltering( st_fx->cldfbSyn, realBuffer, imagBuffer, &scaleFactor, synth_out, negate( st_fx->Q_syn2 ), CLDFB_NO_COL_MAX, workBuffer ); /* Bring CLDFB output to Q0 */ Scale_sig( synth_out, output_frame, negate( st_fx->Q_syn2 ) ); st_fx->Q_syn2 = 0; move16(); /* save synthesis - needed in case of core switching */ Copy( synth_out, st_fx->previoussynth_fx, output_frame ); } #else test(); IF( NE_16( st_fx->element_mode, IVAS_CPE_DFT ) || use_cldfb_for_dft ) { Loading Loading @@ -1881,6 +1978,7 @@ ivas_error acelp_core_dec_fx( /* save synthesis - needed in case of core switching */ Copy( synth_out, st_fx->previoussynth_fx, output_frame ); } #endif #ifdef IVAS_CODE ELSE { Loading Loading @@ -1924,6 +2022,9 @@ 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 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, 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 ); } Loading @@ -1931,6 +2032,24 @@ ivas_error acelp_core_dec_fx( { hf_synth_reset_fx( st_fx->hBWE_zero ); } #else 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 ); #endif } #ifdef REMOVE_EVS_DUPLICATES2 ELSE { hf_synth_reset_fx( st_fx->hBWE_zero ); #ifdef MSAN_FIX IF( NE_16( st_fx->element_mode, EVS_MONO ) ) // TBV: tmp hack - it is a bug in EVS but conditon is here to keep EVS bit-exact { set16_fx( st_fx->hBWE_zero->mem_hp400_fx, 0, 6 ); } #endif } #endif } /*-----------------------------------------------------------------* Loading
lib_dec/fd_cng_dec_fx.c +40 −5 Original line number Diff line number Diff line Loading @@ -957,7 +957,6 @@ Word16 ApplyFdCng_fx( { #ifdef REMOVE_EVS_DUPLICATES2 scalebands_fx( hFdCngDec->msNoiseEst, hFdCngDec->part_shaping, hFdCngDec->nFFTpart_shaping, hFdCngDec->midband_shaping, hFdCngDec->nFFTpart_shaping, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ), hFdCngDec->bandNoiseShape, 1 ); #else scalebands( hFdCngDec->msNoiseEst, hFdCngDec->part_shaping, hFdCngDec->nFFTpart_shaping, hFdCngDec->midband_shaping, hFdCngDec->nFFTpart_shaping, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ), hFdCngDec->bandNoiseShape, 1 ); #endif Loading Loading @@ -1279,7 +1278,16 @@ Word16 ApplyFdCng_ivas_fx( ( !st->BER_detect ) ) { /* Perform noise estimation at the decoder */ #ifdef REMOVE_EVS_DUPLICATES2 IF( EQ_16( st->element_mode, EVS_MONO ) ) { perform_noise_estimation_dec_fx( timeDomainInput, Q, hFdCngDec ); } ELSE #endif { perform_noise_estimation_dec_ivas_fx( timeDomainInput, Q, powerSpectrum, Q_power_spectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); } /* Update the shaping parameters */ test(); Loading Loading @@ -1522,9 +1530,18 @@ Word16 ApplyFdCng_ivas_fx( IF( hFdCngCom->active_frame_counter > 0 ) { /* Perform noise estimation in active frames in the decoder for downward updates */ #ifdef REMOVE_EVS_DUPLICATES2 IF( EQ_16( st->element_mode, EVS_MONO ) ) { perform_noise_estimation_dec_fx( timeDomainInput, Q, hFdCngDec ); } ELSE #endif { perform_noise_estimation_dec_ivas_fx( timeDomainInput, Q, powerSpectrum, Q_power_spectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); } } } test(); IF( EQ_16( concealWholeFrame, 1 ) && EQ_16( st->nbLostCmpt, 1 ) ) Loading Loading @@ -1580,7 +1597,16 @@ Word16 ApplyFdCng_ivas_fx( IF( st != NULL && EQ_16( st->cng_type, LP_CNG ) ) { /* Perform noise estimation on inactive phase at the decoder */ #ifdef REMOVE_EVS_DUPLICATES2 IF( EQ_16( st->element_mode, EVS_MONO ) ) { perform_noise_estimation_dec_fx( timeDomainInput, Q, hFdCngDec ); } ELSE #endif { perform_noise_estimation_dec_ivas_fx( timeDomainInput, Q, powerSpectrum, Q_power_spectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); } /* Update the shaping parameters */ Loading Loading @@ -1833,8 +1859,17 @@ Word16 ApplyFdCng_ivas_fx( IF( EQ_16( st->codec_mode, MODE2 ) ) { /* Generate comfort noise during SID or zero frames */ #ifdef REMOVE_EVS_DUPLICATES2 IF( EQ_16( st->element_mode, EVS_MONO ) ) { generate_comfort_noise_dec_fx( cldfbBufferReal, cldfbBufferImag, cldfbBufferScale, st, &( st->Q_exc ), 2, -1 ); } ELSE #endif { generate_comfort_noise_dec_ivas_fx( cldfbBufferReal, cldfbBufferImag, cldfbBufferScale, st, &( st->Q_exc ), 2, -1 ); } } BREAK; Loading