Loading lib_com/lsf_tools_fx.c +4 −1 Original line number Diff line number Diff line Loading @@ -2962,7 +2962,7 @@ void lsf_syn_mem_backup_fx( return; } #ifndef CLEANUP_VBR_CAM_ENC /*-------------------------------------------------------------------* * lsf_syn_mem_backup_fx() * Loading Loading @@ -3046,6 +3046,7 @@ void lsf_syn_mem_backup_ivas_fx( return; } #endif void lsf_update_memory( Word16 narrowband, /* i : narrowband flag */ Loading Loading @@ -3190,6 +3191,7 @@ void lsf_syn_mem_restore_fx( return; } #ifndef CLEANUP_VBR_CAM_ENC void lsf_syn_mem_restore_ivas_fx( Encoder_State *st_fx, /* o: state structure */ Word16 btilt_code_fx, /* i: Q15 */ Loading Loading @@ -3267,6 +3269,7 @@ void lsf_syn_mem_restore_ivas_fx( return; } #endif /* Returns: codebook index */ Word16 tcxlpc_get_cdk( Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,7 @@ #define FIX_1487_ACCESS_OF_UNINIT_VAL_FROM_ARR_ISM_DTX /* FhG/VA: init nb_bits_metadata to zero */ #define FIX_2290_COPY_OF_UNINIT_DATA /* VA: prevent the copy of un-initialized data */ #define CLEANUP_ACELP_ENC /* VA: basop issue 2304: Remove duplicated code in excitation encoding in the ACELP core */ #define CLEANUP_VBR_CAM_ENC /* VA: basop issue 2299: Remove unused core-encoder VBR and CAM code */ /* #################### End BE switches ################################## */ Loading lib_com/prot_fx.h +6 −3 Original line number Diff line number Diff line Loading @@ -927,6 +927,7 @@ void lsf_syn_mem_restore_fx( Word16 pstreaklen /* i:LSF quantizer */ ); #ifndef CLEANUP_VBR_CAM_ENC void lsf_syn_mem_restore_ivas_fx( Encoder_State *st_fx, /* o: state structure */ Word16 btilt_code_fx, /* i: Q15 */ Loading @@ -947,7 +948,7 @@ void lsf_syn_mem_restore_ivas_fx( Word16 streaklimit, /* i:LSF quantizer Q15 */ Word16 pstreaklen /* i:LSF quantizer */ ); #endif void lsf_update_memory( Word16 narrowband, /* i : narrowband flag */ const Word16 qisf[], /* i : quantized xSF coefficients */ Loading Loading @@ -3851,13 +3852,14 @@ void nelp_encoder_fx( Word16 *qIn1, Word16 reduce_gains ); #ifndef CLEANUP_VBR_CAM_ENC void nelp_encoder_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state */ Word16 *in_fx, /* i : residual signal */ Word16 *exc_fx, /* o : NELP quantized excitation signal */ Word16 *qIn1, Word16 reduce_gains ); #endif void swb_bwe_enc_lr_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 L_m_core[], /* i : lowband synthesis */ Loading Loading @@ -10680,6 +10682,7 @@ Word16 ari_decode_14bits_sign_ivas( Word16 *res, Tastat *s ); #ifndef CLEANUP_VBR_CAM_ENC void lsf_syn_mem_backup_ivas_fx( Encoder_State *st_fx, /* i: state structure */ Word16 *btilt_code_fx, /* i: tilt code Q15 */ Loading @@ -10699,7 +10702,7 @@ void lsf_syn_mem_backup_ivas_fx( Word16 *mem_w0_bck, /* o: memory of the weighting filter ( 15 - st_fx->hLPDmem->e_mem_syn ) */ Word16 *streaklimit, /* Q15 */ Word16 *pstreaklen ); #endif ivas_error config_acelp1_fx( const Word16 enc_dec, /* i : encoder/decoder flag */ const Word32 total_brate, /* i : total bitrate */ Loading lib_enc/acelp_core_enc_fx.c +55 −11 Original line number Diff line number Diff line Loading @@ -709,6 +709,7 @@ ivas_error acelp_core_enc_fx( return error; } /*-------------------------------------------------------------------* * acelp_core_enc_ivas_fx() * Loading Loading @@ -742,14 +743,20 @@ ivas_error acelp_core_enc_ivas_fx( Word32 int_fs; Word16 nb_bits; /* parameters handling */ #ifndef CLEANUP_VBR_CAM_ENC /* SC-VBR - back-up memories for LSF quantizer and synthesis filter */ Word16 pstreaklen; #endif Word16 sid_bw = -1; move16(); #ifndef CLEANUP_VBR_CAM_ENC Word16 next_force_sf_bck; #endif Word16 uc_two_stage_flag; Word16 position; #ifndef CLEANUP_VBR_CAM_ENC Word16 ppp_mode, nelp_mode; #endif Word16 tdm_lp_reuse_flag, tdm_low_rate_mode, tdm_Pitch_reuse_flag; /* bitstream */ Loading @@ -764,18 +771,22 @@ ivas_error acelp_core_enc_ivas_fx( Word16 tmp_noise_fx; /* NB post-filter long-term noise energy*/ Word16 old_bwe_exc_fx[( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2]; /* excitation buffer Q_new */ Word16 *bwe_exc_fx; /* excitation for SWB TBE Q_new */ #ifndef CLEANUP_VBR_CAM_ENC Word16 mem_MA_fx[M], mem_AR_fx[M], lsp_new_bck_fx[M], /*lsf_new_bck_fx[M],*/ lsp_mid_bck_fx[M], mem_syn_bck_fx[M]; Word32 Bin_E_fx[L_FFT], Bin_E_old_fx[L_FFT / 2]; Word16 clip_var_fx, mem_w0_bck_fx, streaklimit_fx; #endif set16_fx( old_bwe_exc_fx, 0, ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 ); set16_fx( old_exc_fx, 0, L_EXC ); set16_fx( Aq, 0, NB_SUBFR16k * ( M + 1 ) ); set16_fx( syn_fx, 0, L_FRAME16k ); #ifndef CLEANUP_VBR_CAM_ENC Word16 tilt_code_bck_fx; Word32 gc_threshold_bck_fx; Word16 clip_var_bck_fx[6]; #endif Word32 q_env_fx[NUM_ENV_CNG]; set32_fx( q_env_fx, 0, NUM_ENV_CNG ); set16_fx( exc2_fx, 0, L_FRAME16k ); Loading Loading @@ -898,6 +909,7 @@ ivas_error acelp_core_enc_ivas_fx( position = -1; move16(); #ifndef CLEANUP_VBR_CAM_ENC /* SC-VBR temporary variables */ pstreaklen = 0; move16(); Loading @@ -924,10 +936,10 @@ ivas_error acelp_core_enc_ivas_fx( } move16(); move16(); #endif test(); /* TD stereo */ IF( EQ_16( st->element_mode, IVAS_CPE_TD ) && EQ_16( st->idchan, 1 ) ) { tdm_lp_reuse_flag = hStereoTD->tdm_lp_reuse_flag; // Q0 Loading Loading @@ -1024,6 +1036,7 @@ ivas_error acelp_core_enc_ivas_fx( /*----------------------------------------------------------------* * Encoding of CNG frames *----------------------------------------------------------------*/ test(); IF( EQ_32( st->core_brate, SID_2k40 ) || st->core_brate == FRAME_NO_DATA ) { Loading Loading @@ -1115,11 +1128,13 @@ ivas_error acelp_core_enc_ivas_fx( move16(); st->hLPDmem->q_mem_syn = st->Q_syn; move16(); // Scaling Aq to Q12 /* Scaling Aq to Q12 */ FOR( Word16 k = 0; k < NB_SUBFR16k; k++ ) { Scale_sig( &Aq[( M + 1 ) * k], M + 1, sub( norm_s( Aq[( M + 1 ) * k] ), 2 ) ); } /* synthesis at 12.8kHz sampling rate */ syn_12k8_fx( st->L_frame, Aq, exc3_fx, syn1_fx, hLPDmem->mem_syn3, 1, sub( Q_new, 1 ), st->Q_syn ); Loading Loading @@ -1160,17 +1175,18 @@ ivas_error acelp_core_enc_ivas_fx( /*----------------------------------------------------------------* * Encoding of all other frames *----------------------------------------------------------------*/ ELSE { Word16 temp = getScaleFactor16( st->hGSCEnc->last_exc_dct_in_fx, L_FRAME16k ); Scale_sig( st->hGSCEnc->last_exc_dct_in_fx, L_FRAME16k, temp ); /* Q_last_exc_dct_in + temp */ st->hGSCEnc->Q_last_exc_dct_in = add( st->hGSCEnc->Q_last_exc_dct_in, temp ); move16(); /*-----------------------------------------------------------------* * Configure ACELP bit allocation *-----------------------------------------------------------------*/ Word16 temp = getScaleFactor16( st->hGSCEnc->last_exc_dct_in_fx, L_FRAME16k ); Scale_sig( st->hGSCEnc->last_exc_dct_in_fx, L_FRAME16k, temp ); /* Q_last_exc_dct_in + temp */ st->hGSCEnc->Q_last_exc_dct_in = add( st->hGSCEnc->Q_last_exc_dct_in, temp ); move16(); nb_bits = 0; move16(); st->acelp_cfg.FEC_mode = 0; Loading @@ -1178,11 +1194,15 @@ ivas_error acelp_core_enc_ivas_fx( uc_two_stage_flag = 0; move16(); #ifndef CLEANUP_VBR_CAM_ENC test(); IF( !nelp_mode && !ppp_mode ) { #endif config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); #ifndef CLEANUP_VBR_CAM_ENC } #endif /*-----------------------------------------------------------------* * After inactive period, use the most up-to-date ISPs Loading Loading @@ -1219,9 +1239,10 @@ ivas_error acelp_core_enc_ivas_fx( * A[z] calculation *-----------------------------------------------------------------*/ #ifndef CLEANUP_VBR_CAM_ENC /* SC-VBR & channel-aware mode - back-up memories for LSF quantizer and synthesis filter */ lsf_syn_mem_backup_ivas_fx( st, &tilt_code_bck_fx, &gc_threshold_bck_fx, clip_var_bck_fx, &next_force_sf_bck, lsp_new, lsp_mid, &clip_var_fx, mem_AR_fx, mem_MA_fx, lsp_new_bck_fx, lsp_mid_bck_fx, Bin_E_fx, Bin_E_old_fx, mem_syn_bck_fx, &mem_w0_bck_fx, &streaklimit_fx, &pstreaklen ); #endif IF( !tdm_lp_reuse_flag ) { lsf_enc_ivas_fx( st, lsf_new_fx, lsp_new, lsp_mid, Aq, tdm_low_rate_mode, st->GSC_IVAS_mode, tdm_lsfQ_PCh, Q_new ); Loading Loading @@ -1260,11 +1281,13 @@ ivas_error acelp_core_enc_ivas_fx( st->stab_fac_fx = lsf_stab_fx( lsf_new_fx, st->lsf_old_fx, 0, st->L_frame ); // Q15 move16(); } // Scaling Aq to Q12 /* Scaling Aq to Q12 */ FOR( Word16 k = 0; k < NB_SUBFR16k; k++ ) { Scale_sig( &Aq[( M + 1 ) * k], M + 1, sub( norm_s( Aq[( M + 1 ) * k] ), 2 ) ); } test(); IF( EQ_16( st->last_core, HQ_CORE ) && st->element_mode > EVS_MONO ) { Loading Loading @@ -1341,12 +1364,13 @@ ivas_error acelp_core_enc_ivas_fx( encod_gen_2sbfr_fx( st, inp, Aw, Aq, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, Q_new, 0 ); } } #ifndef CLEANUP_VBR_CAM_ENC ELSE IF( nelp_mode ) { /* SC-VBR - NELP frames */ encod_nelp_ivas_fx( st, inp, Aw, Aq, res_fx, syn_fx, &tmp_noise_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, Q_new, 0 ); } #endif ELSE IF( EQ_16( st->coder_type, UNVOICED ) ) { /* UNVOICED frames (Gauss. excitation) */ Loading @@ -1364,6 +1388,7 @@ ivas_error acelp_core_enc_ivas_fx( encod_tran_ivas_fx( st, inp, Aw, Aq, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, tc_subfr, position, unbits, 0, Q_new ); #endif } #ifndef CLEANUP_VBR_CAM_ENC ELSE IF( ppp_mode ) { /* SC-VBR - PPP frames */ Loading Loading @@ -1396,6 +1421,7 @@ ivas_error acelp_core_enc_ivas_fx( #endif } } #endif ELSE IF( EQ_16( st->coder_type, AUDIO ) || ( st->coder_type == INACTIVE && st->inactive_coder_type_flag ) ) { /* AUDIO and INACTIVE frames (coded by GSC technology) */ Loading @@ -1420,8 +1446,8 @@ ivas_error acelp_core_enc_ivas_fx( /* update old synthesis buffer - needed for ACELP internal sampling rate switching */ Copy( syn_fx + sub( st->L_frame, L_SYN_MEM ), hLPDmem->mem_syn_r, L_SYN_MEM ); // hLPDmem->q_mem_syn // st->Q_syn = Q_new - 1; Scale_sig( syn_fx, L_FRAME16k, sub( st->Q_syn, Q_new - 1 ) ); // Q_syn /* save and delay synthesis to be used by SWB BWE */ IF( st->hBWE_FD != NULL ) { Loading Loading @@ -1461,11 +1487,16 @@ ivas_error acelp_core_enc_ivas_fx( /*--------------------------------------------------------------------------------------* * Modify the excitation signal when the noise is stationary *--------------------------------------------------------------------------------------*/ test(); test(); test(); #ifdef CLEANUP_VBR_CAM_ENC IF( !( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) ) && !( EQ_16( st->element_mode, IVAS_SCE ) && tdm_low_rate_mode ) ) #else test(); IF( !( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) ) && NE_16( nelp_mode, 1 ) && !( EQ_16( st->element_mode, IVAS_SCE ) && tdm_low_rate_mode ) ) #endif { /* exc2 buffer is needed only for updating of Aq[] which is needed for core switching */ Copy( exc_fx, exc2_fx, st->L_frame ); // Q_new Loading Loading @@ -1496,9 +1527,11 @@ ivas_error acelp_core_enc_ivas_fx( } /* end of active inp coding */ /*-----------------------------------------------------------------* * Write ACELP unused bits *-----------------------------------------------------------------*/ test(); test(); IF( NE_32( st->core_brate, SID_2k40 ) && st->core_brate != FRAME_NO_DATA && NE_32( st->core_brate, PPP_NELP_2k80 ) ) Loading Loading @@ -1527,9 +1560,13 @@ ivas_error acelp_core_enc_ivas_fx( test(); test(); test(); #ifdef CLEANUP_VBR_CAM_ENC IF( ( ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, WB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && NE_16( st->last_extl, SWB_TBE ) && NE_16( st->last_extl, WB_TBE ) && NE_16( st->last_extl, FB_TBE ) ) || ( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) && !st->tdm_LRTD_flag ) ) #else test(); test(); IF( ( EQ_16( st->last_Opt_SC_VBR, 1 ) && st->Opt_SC_VBR == 0 ) || ( ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, WB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && NE_16( st->last_extl, SWB_TBE ) && NE_16( st->last_extl, WB_TBE ) && NE_16( st->last_extl, FB_TBE ) ) || ( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) && !st->tdm_LRTD_flag ) ) #endif { st->hBWE_TD->bwe_non_lin_prev_scale_fx = 0; move16(); Loading @@ -1540,8 +1577,12 @@ ivas_error acelp_core_enc_ivas_fx( test(); test(); test(); #ifdef CLEANUP_VBR_CAM_ENC IF( 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 ) ) #else test(); IF( !st->Opt_SC_VBR && ( 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 ) ) ) #endif { /* Apply a non linearity to the SHB excitation */ Copy_Scale_sig_16_32_no_sat( st->hBWE_TD->old_bwe_exc_extended_fx, bwe_exc_extended_fx, NL_BUFF_OFFSET, ( sub( shl( Q_new, 1 ), sub( st->hBWE_TD->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc Loading Loading @@ -1612,6 +1653,7 @@ ivas_error acelp_core_enc_ivas_fx( st->hTdCngEnc->ho_16k_lsp[st->hTdCngEnc->ho_circ_ptr] = 1; } move16(); /* efficient DTX hangover control */ IF( GT_16( st->hTdCngEnc->burst_ho_cnt, 1 ) ) { Loading @@ -1619,6 +1661,7 @@ ivas_error acelp_core_enc_ivas_fx( } } #ifndef CLEANUP_VBR_CAM_ENC /* SC-VBR update of average data rate */ IF( EQ_16( st->vad_flag, 1 ) ) { Loading @@ -1628,6 +1671,7 @@ ivas_error acelp_core_enc_ivas_fx( update_average_rate_fx( st->hSC_VBR, st->core_brate ); } } #endif pop_wmops(); return error; Loading lib_enc/cng_enc_fx.c +1 −0 Original line number Diff line number Diff line Loading @@ -1501,6 +1501,7 @@ void CNG_enc_ivas_fx( { lsf_enc_ivas_fx( st_fx, lsf_new, lsp_new, NULL, NULL, 0, 0, NULL, Q_new ); } /* Reset CNG history if CNG frame length is changed */ test(); test(); Loading Loading
lib_com/lsf_tools_fx.c +4 −1 Original line number Diff line number Diff line Loading @@ -2962,7 +2962,7 @@ void lsf_syn_mem_backup_fx( return; } #ifndef CLEANUP_VBR_CAM_ENC /*-------------------------------------------------------------------* * lsf_syn_mem_backup_fx() * Loading Loading @@ -3046,6 +3046,7 @@ void lsf_syn_mem_backup_ivas_fx( return; } #endif void lsf_update_memory( Word16 narrowband, /* i : narrowband flag */ Loading Loading @@ -3190,6 +3191,7 @@ void lsf_syn_mem_restore_fx( return; } #ifndef CLEANUP_VBR_CAM_ENC void lsf_syn_mem_restore_ivas_fx( Encoder_State *st_fx, /* o: state structure */ Word16 btilt_code_fx, /* i: Q15 */ Loading Loading @@ -3267,6 +3269,7 @@ void lsf_syn_mem_restore_ivas_fx( return; } #endif /* Returns: codebook index */ Word16 tcxlpc_get_cdk( Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,7 @@ #define FIX_1487_ACCESS_OF_UNINIT_VAL_FROM_ARR_ISM_DTX /* FhG/VA: init nb_bits_metadata to zero */ #define FIX_2290_COPY_OF_UNINIT_DATA /* VA: prevent the copy of un-initialized data */ #define CLEANUP_ACELP_ENC /* VA: basop issue 2304: Remove duplicated code in excitation encoding in the ACELP core */ #define CLEANUP_VBR_CAM_ENC /* VA: basop issue 2299: Remove unused core-encoder VBR and CAM code */ /* #################### End BE switches ################################## */ Loading
lib_com/prot_fx.h +6 −3 Original line number Diff line number Diff line Loading @@ -927,6 +927,7 @@ void lsf_syn_mem_restore_fx( Word16 pstreaklen /* i:LSF quantizer */ ); #ifndef CLEANUP_VBR_CAM_ENC void lsf_syn_mem_restore_ivas_fx( Encoder_State *st_fx, /* o: state structure */ Word16 btilt_code_fx, /* i: Q15 */ Loading @@ -947,7 +948,7 @@ void lsf_syn_mem_restore_ivas_fx( Word16 streaklimit, /* i:LSF quantizer Q15 */ Word16 pstreaklen /* i:LSF quantizer */ ); #endif void lsf_update_memory( Word16 narrowband, /* i : narrowband flag */ const Word16 qisf[], /* i : quantized xSF coefficients */ Loading Loading @@ -3851,13 +3852,14 @@ void nelp_encoder_fx( Word16 *qIn1, Word16 reduce_gains ); #ifndef CLEANUP_VBR_CAM_ENC void nelp_encoder_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state */ Word16 *in_fx, /* i : residual signal */ Word16 *exc_fx, /* o : NELP quantized excitation signal */ Word16 *qIn1, Word16 reduce_gains ); #endif void swb_bwe_enc_lr_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ const Word32 L_m_core[], /* i : lowband synthesis */ Loading Loading @@ -10680,6 +10682,7 @@ Word16 ari_decode_14bits_sign_ivas( Word16 *res, Tastat *s ); #ifndef CLEANUP_VBR_CAM_ENC void lsf_syn_mem_backup_ivas_fx( Encoder_State *st_fx, /* i: state structure */ Word16 *btilt_code_fx, /* i: tilt code Q15 */ Loading @@ -10699,7 +10702,7 @@ void lsf_syn_mem_backup_ivas_fx( Word16 *mem_w0_bck, /* o: memory of the weighting filter ( 15 - st_fx->hLPDmem->e_mem_syn ) */ Word16 *streaklimit, /* Q15 */ Word16 *pstreaklen ); #endif ivas_error config_acelp1_fx( const Word16 enc_dec, /* i : encoder/decoder flag */ const Word32 total_brate, /* i : total bitrate */ Loading
lib_enc/acelp_core_enc_fx.c +55 −11 Original line number Diff line number Diff line Loading @@ -709,6 +709,7 @@ ivas_error acelp_core_enc_fx( return error; } /*-------------------------------------------------------------------* * acelp_core_enc_ivas_fx() * Loading Loading @@ -742,14 +743,20 @@ ivas_error acelp_core_enc_ivas_fx( Word32 int_fs; Word16 nb_bits; /* parameters handling */ #ifndef CLEANUP_VBR_CAM_ENC /* SC-VBR - back-up memories for LSF quantizer and synthesis filter */ Word16 pstreaklen; #endif Word16 sid_bw = -1; move16(); #ifndef CLEANUP_VBR_CAM_ENC Word16 next_force_sf_bck; #endif Word16 uc_two_stage_flag; Word16 position; #ifndef CLEANUP_VBR_CAM_ENC Word16 ppp_mode, nelp_mode; #endif Word16 tdm_lp_reuse_flag, tdm_low_rate_mode, tdm_Pitch_reuse_flag; /* bitstream */ Loading @@ -764,18 +771,22 @@ ivas_error acelp_core_enc_ivas_fx( Word16 tmp_noise_fx; /* NB post-filter long-term noise energy*/ Word16 old_bwe_exc_fx[( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2]; /* excitation buffer Q_new */ Word16 *bwe_exc_fx; /* excitation for SWB TBE Q_new */ #ifndef CLEANUP_VBR_CAM_ENC Word16 mem_MA_fx[M], mem_AR_fx[M], lsp_new_bck_fx[M], /*lsf_new_bck_fx[M],*/ lsp_mid_bck_fx[M], mem_syn_bck_fx[M]; Word32 Bin_E_fx[L_FFT], Bin_E_old_fx[L_FFT / 2]; Word16 clip_var_fx, mem_w0_bck_fx, streaklimit_fx; #endif set16_fx( old_bwe_exc_fx, 0, ( PIT16k_MAX + ( L_FRAME16k + 1 ) + L_SUBFR16k ) * 2 ); set16_fx( old_exc_fx, 0, L_EXC ); set16_fx( Aq, 0, NB_SUBFR16k * ( M + 1 ) ); set16_fx( syn_fx, 0, L_FRAME16k ); #ifndef CLEANUP_VBR_CAM_ENC Word16 tilt_code_bck_fx; Word32 gc_threshold_bck_fx; Word16 clip_var_bck_fx[6]; #endif Word32 q_env_fx[NUM_ENV_CNG]; set32_fx( q_env_fx, 0, NUM_ENV_CNG ); set16_fx( exc2_fx, 0, L_FRAME16k ); Loading Loading @@ -898,6 +909,7 @@ ivas_error acelp_core_enc_ivas_fx( position = -1; move16(); #ifndef CLEANUP_VBR_CAM_ENC /* SC-VBR temporary variables */ pstreaklen = 0; move16(); Loading @@ -924,10 +936,10 @@ ivas_error acelp_core_enc_ivas_fx( } move16(); move16(); #endif test(); /* TD stereo */ IF( EQ_16( st->element_mode, IVAS_CPE_TD ) && EQ_16( st->idchan, 1 ) ) { tdm_lp_reuse_flag = hStereoTD->tdm_lp_reuse_flag; // Q0 Loading Loading @@ -1024,6 +1036,7 @@ ivas_error acelp_core_enc_ivas_fx( /*----------------------------------------------------------------* * Encoding of CNG frames *----------------------------------------------------------------*/ test(); IF( EQ_32( st->core_brate, SID_2k40 ) || st->core_brate == FRAME_NO_DATA ) { Loading Loading @@ -1115,11 +1128,13 @@ ivas_error acelp_core_enc_ivas_fx( move16(); st->hLPDmem->q_mem_syn = st->Q_syn; move16(); // Scaling Aq to Q12 /* Scaling Aq to Q12 */ FOR( Word16 k = 0; k < NB_SUBFR16k; k++ ) { Scale_sig( &Aq[( M + 1 ) * k], M + 1, sub( norm_s( Aq[( M + 1 ) * k] ), 2 ) ); } /* synthesis at 12.8kHz sampling rate */ syn_12k8_fx( st->L_frame, Aq, exc3_fx, syn1_fx, hLPDmem->mem_syn3, 1, sub( Q_new, 1 ), st->Q_syn ); Loading Loading @@ -1160,17 +1175,18 @@ ivas_error acelp_core_enc_ivas_fx( /*----------------------------------------------------------------* * Encoding of all other frames *----------------------------------------------------------------*/ ELSE { Word16 temp = getScaleFactor16( st->hGSCEnc->last_exc_dct_in_fx, L_FRAME16k ); Scale_sig( st->hGSCEnc->last_exc_dct_in_fx, L_FRAME16k, temp ); /* Q_last_exc_dct_in + temp */ st->hGSCEnc->Q_last_exc_dct_in = add( st->hGSCEnc->Q_last_exc_dct_in, temp ); move16(); /*-----------------------------------------------------------------* * Configure ACELP bit allocation *-----------------------------------------------------------------*/ Word16 temp = getScaleFactor16( st->hGSCEnc->last_exc_dct_in_fx, L_FRAME16k ); Scale_sig( st->hGSCEnc->last_exc_dct_in_fx, L_FRAME16k, temp ); /* Q_last_exc_dct_in + temp */ st->hGSCEnc->Q_last_exc_dct_in = add( st->hGSCEnc->Q_last_exc_dct_in, temp ); move16(); nb_bits = 0; move16(); st->acelp_cfg.FEC_mode = 0; Loading @@ -1178,11 +1194,15 @@ ivas_error acelp_core_enc_ivas_fx( uc_two_stage_flag = 0; move16(); #ifndef CLEANUP_VBR_CAM_ENC test(); IF( !nelp_mode && !ppp_mode ) { #endif config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); #ifndef CLEANUP_VBR_CAM_ENC } #endif /*-----------------------------------------------------------------* * After inactive period, use the most up-to-date ISPs Loading Loading @@ -1219,9 +1239,10 @@ ivas_error acelp_core_enc_ivas_fx( * A[z] calculation *-----------------------------------------------------------------*/ #ifndef CLEANUP_VBR_CAM_ENC /* SC-VBR & channel-aware mode - back-up memories for LSF quantizer and synthesis filter */ lsf_syn_mem_backup_ivas_fx( st, &tilt_code_bck_fx, &gc_threshold_bck_fx, clip_var_bck_fx, &next_force_sf_bck, lsp_new, lsp_mid, &clip_var_fx, mem_AR_fx, mem_MA_fx, lsp_new_bck_fx, lsp_mid_bck_fx, Bin_E_fx, Bin_E_old_fx, mem_syn_bck_fx, &mem_w0_bck_fx, &streaklimit_fx, &pstreaklen ); #endif IF( !tdm_lp_reuse_flag ) { lsf_enc_ivas_fx( st, lsf_new_fx, lsp_new, lsp_mid, Aq, tdm_low_rate_mode, st->GSC_IVAS_mode, tdm_lsfQ_PCh, Q_new ); Loading Loading @@ -1260,11 +1281,13 @@ ivas_error acelp_core_enc_ivas_fx( st->stab_fac_fx = lsf_stab_fx( lsf_new_fx, st->lsf_old_fx, 0, st->L_frame ); // Q15 move16(); } // Scaling Aq to Q12 /* Scaling Aq to Q12 */ FOR( Word16 k = 0; k < NB_SUBFR16k; k++ ) { Scale_sig( &Aq[( M + 1 ) * k], M + 1, sub( norm_s( Aq[( M + 1 ) * k] ), 2 ) ); } test(); IF( EQ_16( st->last_core, HQ_CORE ) && st->element_mode > EVS_MONO ) { Loading Loading @@ -1341,12 +1364,13 @@ ivas_error acelp_core_enc_ivas_fx( encod_gen_2sbfr_fx( st, inp, Aw, Aq, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, Q_new, 0 ); } } #ifndef CLEANUP_VBR_CAM_ENC ELSE IF( nelp_mode ) { /* SC-VBR - NELP frames */ encod_nelp_ivas_fx( st, inp, Aw, Aq, res_fx, syn_fx, &tmp_noise_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, Q_new, 0 ); } #endif ELSE IF( EQ_16( st->coder_type, UNVOICED ) ) { /* UNVOICED frames (Gauss. excitation) */ Loading @@ -1364,6 +1388,7 @@ ivas_error acelp_core_enc_ivas_fx( encod_tran_ivas_fx( st, inp, Aw, Aq, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, tc_subfr, position, unbits, 0, Q_new ); #endif } #ifndef CLEANUP_VBR_CAM_ENC ELSE IF( ppp_mode ) { /* SC-VBR - PPP frames */ Loading Loading @@ -1396,6 +1421,7 @@ ivas_error acelp_core_enc_ivas_fx( #endif } } #endif ELSE IF( EQ_16( st->coder_type, AUDIO ) || ( st->coder_type == INACTIVE && st->inactive_coder_type_flag ) ) { /* AUDIO and INACTIVE frames (coded by GSC technology) */ Loading @@ -1420,8 +1446,8 @@ ivas_error acelp_core_enc_ivas_fx( /* update old synthesis buffer - needed for ACELP internal sampling rate switching */ Copy( syn_fx + sub( st->L_frame, L_SYN_MEM ), hLPDmem->mem_syn_r, L_SYN_MEM ); // hLPDmem->q_mem_syn // st->Q_syn = Q_new - 1; Scale_sig( syn_fx, L_FRAME16k, sub( st->Q_syn, Q_new - 1 ) ); // Q_syn /* save and delay synthesis to be used by SWB BWE */ IF( st->hBWE_FD != NULL ) { Loading Loading @@ -1461,11 +1487,16 @@ ivas_error acelp_core_enc_ivas_fx( /*--------------------------------------------------------------------------------------* * Modify the excitation signal when the noise is stationary *--------------------------------------------------------------------------------------*/ test(); test(); test(); #ifdef CLEANUP_VBR_CAM_ENC IF( !( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) ) && !( EQ_16( st->element_mode, IVAS_SCE ) && tdm_low_rate_mode ) ) #else test(); IF( !( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) ) && NE_16( nelp_mode, 1 ) && !( EQ_16( st->element_mode, IVAS_SCE ) && tdm_low_rate_mode ) ) #endif { /* exc2 buffer is needed only for updating of Aq[] which is needed for core switching */ Copy( exc_fx, exc2_fx, st->L_frame ); // Q_new Loading Loading @@ -1496,9 +1527,11 @@ ivas_error acelp_core_enc_ivas_fx( } /* end of active inp coding */ /*-----------------------------------------------------------------* * Write ACELP unused bits *-----------------------------------------------------------------*/ test(); test(); IF( NE_32( st->core_brate, SID_2k40 ) && st->core_brate != FRAME_NO_DATA && NE_32( st->core_brate, PPP_NELP_2k80 ) ) Loading Loading @@ -1527,9 +1560,13 @@ ivas_error acelp_core_enc_ivas_fx( test(); test(); test(); #ifdef CLEANUP_VBR_CAM_ENC IF( ( ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, WB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && NE_16( st->last_extl, SWB_TBE ) && NE_16( st->last_extl, WB_TBE ) && NE_16( st->last_extl, FB_TBE ) ) || ( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) && !st->tdm_LRTD_flag ) ) #else test(); test(); IF( ( EQ_16( st->last_Opt_SC_VBR, 1 ) && st->Opt_SC_VBR == 0 ) || ( ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, WB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && NE_16( st->last_extl, SWB_TBE ) && NE_16( st->last_extl, WB_TBE ) && NE_16( st->last_extl, FB_TBE ) ) || ( EQ_16( st->idchan, 1 ) && EQ_16( st->element_mode, IVAS_CPE_TD ) && !st->tdm_LRTD_flag ) ) #endif { st->hBWE_TD->bwe_non_lin_prev_scale_fx = 0; move16(); Loading @@ -1540,8 +1577,12 @@ ivas_error acelp_core_enc_ivas_fx( test(); test(); test(); #ifdef CLEANUP_VBR_CAM_ENC IF( 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 ) ) #else test(); IF( !st->Opt_SC_VBR && ( 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 ) ) ) #endif { /* Apply a non linearity to the SHB excitation */ Copy_Scale_sig_16_32_no_sat( st->hBWE_TD->old_bwe_exc_extended_fx, bwe_exc_extended_fx, NL_BUFF_OFFSET, ( sub( shl( Q_new, 1 ), sub( st->hBWE_TD->prev_Q_bwe_exc, 16 ) ) ) ); // prev_Q_bwe_exc Loading Loading @@ -1612,6 +1653,7 @@ ivas_error acelp_core_enc_ivas_fx( st->hTdCngEnc->ho_16k_lsp[st->hTdCngEnc->ho_circ_ptr] = 1; } move16(); /* efficient DTX hangover control */ IF( GT_16( st->hTdCngEnc->burst_ho_cnt, 1 ) ) { Loading @@ -1619,6 +1661,7 @@ ivas_error acelp_core_enc_ivas_fx( } } #ifndef CLEANUP_VBR_CAM_ENC /* SC-VBR update of average data rate */ IF( EQ_16( st->vad_flag, 1 ) ) { Loading @@ -1628,6 +1671,7 @@ ivas_error acelp_core_enc_ivas_fx( update_average_rate_fx( st->hSC_VBR, st->core_brate ); } } #endif pop_wmops(); return error; Loading
lib_enc/cng_enc_fx.c +1 −0 Original line number Diff line number Diff line Loading @@ -1501,6 +1501,7 @@ void CNG_enc_ivas_fx( { lsf_enc_ivas_fx( st_fx, lsf_new, lsp_new, NULL, NULL, 0, 0, NULL, Q_new ); } /* Reset CNG history if CNG frame length is changed */ test(); test(); Loading