diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index c97fdce831893f05b9da001185d7b6cc6ca99bff..d621923ba4e9e15c20f1571b2ec24a0020946296 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -396,7 +396,7 @@ ivas_error acelp_core_enc_fx( #else config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, st_fx->inactive_coder_type_flag, - tc_subfr_fx, 0, &nb_bits, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_fr_cnt_fx, + tc_subfr_fx, 0, &nb_bits, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); #endif } @@ -469,7 +469,7 @@ ivas_error acelp_core_enc_fx( #else config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, tc_subfr_fx, 1, NULL, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, - tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_fr_cnt_fx, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); + tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); #endif } @@ -527,7 +527,7 @@ ivas_error acelp_core_enc_fx( #else config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, st_fx->inactive_coder_type_flag, tc_subfr_fx, 0, &nb_bits, unbits_fx, 0, &uc_two_stage_flag, 0, 0, - st_fx->idchan, st_fx->active_fr_cnt_fx, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); + st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode ); #endif /* redo LSF quantization */ diff --git a/lib_enc/acelp_core_switch_enc_fx.c b/lib_enc/acelp_core_switch_enc_fx.c index 2f2efef0fba2ef8f003b085baaa1f2b5d400756d..4de3ebe7d4237cca85038f9c330ded58dd254b7f 100644 --- a/lib_enc/acelp_core_switch_enc_fx.c +++ b/lib_enc/acelp_core_switch_enc_fx.c @@ -139,7 +139,7 @@ void acelp_core_switch_enc_fx( GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); #else config_acelp1_fx( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, - GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); + GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); #endif encod_gen_voic_core_switch_fx( st_fx, st_fx->last_L_frame, inp, Aq, A, T_op, exc, cbrate, shift, Q_new ); @@ -253,7 +253,7 @@ void acelp_core_switch_enc_ivas_fx( config_acelp1_fx( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); #else config_acelp1_fx( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, - GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); + GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); #endif encod_gen_voic_core_switch_ivas_fx( st_fx, st_fx->last_L_frame, inp, Aq, A, T_op, exc, cbrate, shift, Q_new ); diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 2f7870ab6e066e873ef432c68027ae6a763cffe3..b46e4cb71c2b47747dded35adb81931d514926ff 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -207,11 +207,6 @@ void init_coder_ace_plus_fx( move16(); st->tfa_flag = 0; move16(); - /* Initialize DTX */ - IF( st->ini_frame == 0 ) - { - vad_init_fx( &st->vad_st ); - } st->glr = 0; move16(); diff --git a/lib_enc/dtx_fx.c b/lib_enc/dtx_fx.c index 247dcbda36417b85610b2bf4a28fd99fe26c9ae8..442c548e9152804088fd2bdfcbed2ace7c3f6afc 100644 --- a/lib_enc/dtx_fx.c +++ b/lib_enc/dtx_fx.c @@ -656,7 +656,7 @@ void dtx_fx( /* Initialization */ IF( st_fx->ini_frame == 0 ) { - st_fx->active_fr_cnt_fx = CNG_TYPE_HO; + st_fx->active_cnt = CNG_TYPE_HO; move16(); st_fx->cng_type = FD_CNG; @@ -756,7 +756,7 @@ void dtx_fx( st_fx->fd_cng_reset_flag == 0 ) { /* reset counter */ - st_fx->active_fr_cnt_fx = 0; + st_fx->active_cnt = 0; move16(); IF( st_fx->Opt_AMR_WB ) @@ -878,7 +878,7 @@ void dtx_fx( move16(); /* reset the counter of CNG frames for averaging */ } test(); - IF( GE_16( st_fx->active_fr_cnt_fx, CNG_TYPE_HO ) && st_fx->Opt_AMR_WB == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) + IF( GE_16( st_fx->active_cnt, CNG_TYPE_HO ) && st_fx->Opt_AMR_WB == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) { IF( EQ_16( st_fx->element_mode, IVAS_SCE ) ) { @@ -911,8 +911,8 @@ void dtx_fx( st_fx->cng_type = LP_CNG; move16(); } - st_fx->active_fr_cnt_fx = add( st_fx->active_fr_cnt_fx, 1 ); - st_fx->active_fr_cnt_fx = s_min( st_fx->active_fr_cnt_fx, 200 ); + st_fx->active_cnt = add( st_fx->active_cnt, 1 ); + st_fx->active_cnt = s_min( st_fx->active_cnt, 200 ); } /*------------------------------------------------------------------------* diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 69cee425591e02ed5e9b17353c01c41b4c26def5..0ee479a7cf59f692fc95738e97befb45c88daecd 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -20,8 +20,11 @@ * * Initialization of state variables *-----------------------------------------------------------------------*/ + ivas_error init_encoder_fx( - Encoder_State *st_fx /* i/o: Encoder static variables structure */ + Encoder_State *st_fx, /* i/o: Encoder static variables structure */ + const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ + const int16_t interval_SID /* i : interval for SID update */ ) { Word16 i; @@ -350,35 +353,6 @@ ivas_error init_encoder_fx( } wb_vad_init_fx( st_fx->hVAD ); - st_fx->hVAD->prim_act_quick_fx = 0; - move16(); - st_fx->hVAD->prim_act_slow_fx = 0; - move16(); - st_fx->hVAD->prim_act_fx = 0; - move16(); - st_fx->hVAD->prim_act_quick_he_fx = 0; - move16(); - st_fx->hVAD->prim_act_slow_he_fx = 0; - move16(); - st_fx->hVAD->prim_act_he_fx = 0; - move16(); - st_fx->hVAD->hangover_terminate_flag = 0; - move16(); - - st_fx->hVAD->consec_inactive = 0; - move16(); - st_fx->hVAD->spectral_tilt_reset = 1; - move16(); - st_fx->hVAD->running_avg_fx = 0; - move16(); - st_fx->hVAD->ra_deltasum_fx = 0; - move16(); - st_fx->hVAD->trigger_SID = 0; - move16(); - st_fx->hVAD->L_snr_sum_vad_fx = 0; - move32(); - st_fx->hVAD->q_L_snr_sum_vad = Q31; - move16(); } ELSE { @@ -387,12 +361,22 @@ ivas_error init_encoder_fx( st_fx->Pos_relE_cnt = 5120; move16(); /*20.0f*/ - st_fx->nb_active_frames_HE_SAD_fx = 0; - move16(); - st_fx->lp_speech_fx = 11520; - move16(); /*Q8 (45.0) */ /* Initialize the long-term active speech level in dB */ - /* avoid uninitialized memory access */ + /* CLDFB-based VAD */ + IF( st_fx->element_mode == EVS_MONO ) + { + if ( ( st_fx->hVAD_CLDFB = (VAD_CLDFB_HANDLE) malloc( sizeof( T_CldfbVadState ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB VAD\n" ) ); + } + + vad_init_fx( st_fx->hVAD_CLDFB ); + } + ELSE + { + st_fx->hVAD_CLDFB = NULL; + } + /*-----------------------------------------------------------------* * Noise estimator @@ -492,7 +476,12 @@ ivas_error init_encoder_fx( st_fx->exc_pe_fx = 0; move16(); - /* CNG and DTX */ + /*-----------------------------------------------------------------* + * DTX + *-----------------------------------------------------------------*/ + + st_fx->lp_speech_fx = 11520; + move16(); /*Q8 (45.0) */ /* Initialize the long-term active speech level in dB */ st_fx->lp_noise_fx = 0; move16(); @@ -504,7 +493,7 @@ ivas_error init_encoder_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DTX variables\n" ) ); } - dtx_enc_init_fx( st_fx, st_fx->var_SID_rate_flag_fx, st_fx->interval_SID_fx ); + dtx_enc_init_fx( st_fx, var_SID_rate_flag, interval_SID ); } ELSE { @@ -518,8 +507,7 @@ ivas_error init_encoder_fx( { move16(); } - st_fx->active_fr_cnt_fx = 0; - move16(); + st_fx->cng_type = -1; move16(); @@ -1494,7 +1482,7 @@ ivas_error init_encoder_ivas_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VAD\n" ) ); } - wb_vad_init_ivas_fx( st->hVAD ); + wb_vad_init_fx( st->hVAD ); } ELSE { @@ -1506,8 +1494,11 @@ ivas_error init_encoder_ivas_fx( /* CLDFB-based VAD */ IF( st->element_mode == EVS_MONO ) { - /* This is done to as in EVS T_CldfbVadState structure is present in Encoder State */ - st->hVAD_CLDFB = &st->vad_st; + if ( ( st->hVAD_CLDFB = (VAD_CLDFB_HANDLE) malloc( sizeof( T_CldfbVadState ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB VAD\n" ) ); + } + vad_init_fx( st->hVAD_CLDFB ); } ELSE diff --git a/lib_enc/ivas_front_vad_fx.c b/lib_enc/ivas_front_vad_fx.c index 1f62b6854b01955de104e106528d5c713a61ec4a..ce09abdbc0e3806675880b57ba31e6820fdad1c9 100644 --- a/lib_enc/ivas_front_vad_fx.c +++ b/lib_enc/ivas_front_vad_fx.c @@ -385,7 +385,7 @@ ivas_error front_vad_create_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VAD\n" ) ); } - wb_vad_init_ivas_fx( hFrontVad->hVAD ); + wb_vad_init_fx( hFrontVad->hVAD ); hFrontVad->lp_speech_fx = 11520; // 45.0f in Q8 /* Initialize the long-term active speech level in dB */ move16(); diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index c74a1f5e16524f35e1874c9edec227df01519f39..873af3fa388977679d780fd44100bbd024f30255 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -561,70 +561,23 @@ ivas_error create_evs_sce_enc_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CoreCoder structure\n" ) ); } memset( st_fx, 0, sizeof( Encoder_State ) ); - st_fx->input_Fs = 16000; - move32(); - st_fx->total_brate = ACELP_12k65; - move32(); - st_fx->Opt_AMR_WB = 0; - move16(); - st_fx->Opt_RF_ON = 0; - move16(); - st_fx->rf_fec_offset = 0; - move16(); - st_fx->rf_fec_indicator = 1; - move16(); - st_fx->max_bwidth = SWB; - move16(); - st_fx->interval_SID_fx = FIXED_SID_RATE; - move16(); - st_fx->var_SID_rate_flag_fx = 1; - move16(); - st_fx->Opt_HE_SAD_ON_fx = 0; - move16(); - st_fx->Opt_SC_VBR = 0; - move16(); - st_fx->last_Opt_SC_VBR = 0; - move16(); + copy_encoder_config_fx( st_ivas, st_fx, 1 ); + st_fx->bitstreamformat = G192; move16(); - // copy_encoder_config_fx( st_ivas, st_fx, 1 ); - st_fx->max_bwidth = st_ivas->hEncoderConfig->max_bwidth; - move16(); - st_fx->Opt_DTX_ON = st_ivas->hEncoderConfig->Opt_DTX_ON; - move16(); - st_fx->var_SID_rate_flag_fx = st_ivas->hEncoderConfig->var_SID_rate_flag; - move16(); - st_fx->interval_SID_fx = st_ivas->hEncoderConfig->interval_SID; - move16(); - st_fx->Opt_RF_ON = st_ivas->hEncoderConfig->Opt_RF_ON; - move16(); - st_fx->rf_fec_indicator = st_ivas->hEncoderConfig->rf_fec_indicator; - move16(); - st_fx->rf_fec_offset = st_ivas->hEncoderConfig->rf_fec_offset; - move16(); - // st_fx->bitstreamformat = st->bitstreamformat; st_fx->total_brate = st_ivas->hEncoderConfig->ivas_total_brate; move32(); - st_fx->Opt_SC_VBR = st_ivas->hEncoderConfig->Opt_SC_VBR; - move16(); - st_fx->last_Opt_SC_VBR = st_ivas->hEncoderConfig->last_Opt_SC_VBR; - move16(); - st_fx->Opt_AMR_WB = st_ivas->hEncoderConfig->Opt_AMR_WB; - move16(); - st_fx->input_Fs = st_ivas->hEncoderConfig->input_Fs; - move32(); - st_fx->codec_mode = st_ivas->codec_mode; - move16(); - st_fx->last_codec_mode = st_ivas->last_codec_mode; - move16(); + st_fx->input_frame_fx = extract_l( Mult_32_16( st_fx->input_Fs, 0x0290 ) ); move16(); - IF( NE_32( ( error = init_encoder_fx( st_fx ) ), IVAS_ERR_OK ) ) + + IF( NE_32( ( error = init_encoder_fx( st_fx, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID ) ), IVAS_ERR_OK ) ) { return error; } + /*-----------------------------------------------------------------* * Bitstream *-----------------------------------------------------------------*/ @@ -645,6 +598,7 @@ ivas_error create_evs_sce_enc_fx( return error; } + /*------------------------------------------------------------------------- * destroy_sce_enc_fx() * diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index a54e56fb9a42651b8f8a61ea9c092cb971cd0b1d..6600faff383ecf0aa17d590fd3cdd4c3dfe686d4 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -85,7 +85,7 @@ static ivas_error allocate_CoreCoder_enc_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VAD\n" ) ); } - wb_vad_init_ivas_fx( st->hVAD ); + wb_vad_init_fx( st->hVAD ); } IF( st->hSpMusClas == NULL ) diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index 8a3cf1a00a7e52dc4847517e176f0fdeba6d5495..0dc722acdea50bd9290028a55aece27de21b10ef 100644 --- a/lib_enc/pre_proc_fx.c +++ b/lib_enc/pre_proc_fx.c @@ -270,7 +270,7 @@ void pre_proc_fx( st->vad_flag = wb_vad_fx( st, fr_bands, &noisy_speech_HO, &clean_speech_HO, &NB_speech_HO, &snr_sum_he, &localVAD_HE_SAD, &( st->flag_noisy_speech_snr ), *Q_new, hVAD, hNoiseEst, st->lp_speech_fx, st->lp_noise_fx ); - vad_flag_cldfb = vad_proc_fx( &( st->vad_st ), realBuffer, imagBuffer, cldfbScale->lb_scale, &cldfb_addition, + vad_flag_cldfb = vad_proc_fx( st->hVAD_CLDFB, realBuffer, imagBuffer, cldfbScale->lb_scale, &cldfb_addition, enerBuffer, enerBuffer_exp, st->cldfbAnaEnc->no_channels, st->vad_flag ); IF( LT_16( st->Pos_relE_cnt, 20 ) ) /* Ensure the level is high enough and cldfb decision is reliable */ diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 48af49619a2c184c9cda2c6239c3a7ac3824694b..a4c439c1d22bb79b0b1b55fbd2fb002aac1d6255 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -2603,11 +2603,14 @@ void IGFEncSetMode_fx( const Word16 rf_mode /* i : flag to signal the RF mode */ ); -Word16 vad_init_fx( VAD_CLDFB_HANDLE vad_state ); +Word16 vad_init_fx( + VAD_CLDFB_HANDLE hVAD_CLDFB /* i/o: CLDFB VAD state */ +); void init_PLC_enc_fx( PLC_ENC_EVS_HANDLE hPlcExt, Word32 sampleRate ); + void core_coder_reconfig_fx( Encoder_State *st, const Word32 last_total_brate ); @@ -4390,10 +4393,6 @@ void wb_vad_init_fx( VAD_HANDLE hVAD /* i/o: VAD data handle */ ); -void wb_vad_init_ivas_fx( - VAD_HANDLE hVAD /* i/o: VAD data handle */ -); - void noise_est_init_fx( NOISE_EST_HANDLE hNoiseEst /* i/o: Noise estimation handle */ ); @@ -4780,7 +4779,9 @@ void index_lvq_ivas_fx( const Word16 prediction_flag ); ivas_error init_encoder_fx( - Encoder_State *st_fx /* i/o: Encoder static variables structure */ + Encoder_State *st_fx, /* i/o: Encoder static variables structure */ + const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ + const int16_t interval_SID /* i : interval for SID update */ ); void copy_encoder_config_fx( diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 3839e3ec533848580e954a8e03fcfc1c79ea4dee..c1e2924b379a66006df1c58c9c771b6df58bd385 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -1324,7 +1324,6 @@ typedef struct enc_core_structure // Word16 Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ // Word16 Opt_DTX_ON_fx; /* flag indicating DTX operation */ // Word16 cng_type; /* flag indicating LP or CLDFB based SID/CNG */ - Word16 active_fr_cnt_fx; /* counter of active frames */ // Word16 Opt_SC_VBR_fx; /* flag indicating SC-VBR mode */ // Word16 last_Opt_SC_VBR_fx; /* flag indicating SC-VBR mode in the last frame */ @@ -1444,8 +1443,8 @@ typedef struct enc_core_structure Word32 diff_sm_fx; /* Q7 */ Word32 energy_sm_fx; /* Q7 */ + Word16 sharpFlag; - Word16 finalVAD; Word16 flag_noisy_speech_snr; /* encoder detector for noisy speech */ Word16 Pos_relE_cnt; /* Number of frames between relE */ @@ -1513,10 +1512,8 @@ typedef struct enc_core_structure VAD_HANDLE hVAD; VAD_CLDFB_HANDLE hVAD_CLDFB; - T_CldfbVadState vad_st; Word16 vad_flag; /* i : VAD flag */ - Word16 sharpFlag; Word16 localVAD; /* i : local VAD flag */ Word32 bckr_tilt_lt; /* Q16 */ @@ -1524,12 +1521,7 @@ typedef struct enc_core_structure Word16 lp_noise_fx; /* CNG and DTX - LP filtered total noise estimation Q24 */ Word32 lp_speech_32fx; /* Q24 */ Word32 lp_noise_32fx; /* CNG and DTX - LP filtered total noise estimation Q24 */ - Word16 Opt_HE_SAD_ON_fx; - Word16 nb_active_frames_HE_SAD_fx; - Word16 voicing_old_fx; - Word16 var_SID_rate_flag_fx; /* CNG and DTX - flag for variable SID rate */ - Word16 interval_SID_fx; - Word16 active_cnt; /* counter of active frames */ + Word16 active_cnt; /* counter of active frames */ TD_CNG_ENC_HANDLE hTdCngEnc; diff --git a/lib_enc/transition_enc_fx.c b/lib_enc/transition_enc_fx.c index 4553c5a27bd0e0b69d30d3cfb42c57e4a81ff9ae..76f1485b74225a303c0b5e903ad7abd4943ff5e3 100644 --- a/lib_enc/transition_enc_fx.c +++ b/lib_enc/transition_enc_fx.c @@ -217,7 +217,7 @@ void transition_enc_fx( #else config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, L_FRAME, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, TC_0_0, 3, NULL, unbits_ACELP, - st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); + st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); #endif } @@ -333,7 +333,7 @@ void transition_enc_fx( #else config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, *tc_subfr, 2, NULL, - unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); + unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); #endif } @@ -1045,7 +1045,7 @@ void transition_enc_ivas_fx( #else config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, L_FRAME, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, TC_0_0, 3, NULL, unbits_ACELP, - st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ + st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); #endif } @@ -1162,7 +1162,7 @@ void transition_enc_ivas_fx( #else config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, *tc_subfr, 2, NULL, - unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); + unbits_ACELP, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st_fx->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); #endif } diff --git a/lib_enc/vad_fx.c b/lib_enc/vad_fx.c index 955c7c74d05f54baa470d3801349327756f04514..9819285f04e02de2331452227f5c2b1a8d22b000 100644 --- a/lib_enc/vad_fx.c +++ b/lib_enc/vad_fx.c @@ -91,52 +91,13 @@ static Word16 vad_snr_log_fx( /* o: Q8 */ } -void wb_vad_init_fx( - VAD_HANDLE hVAD /* i/o: VAD data handle */ -) -{ - hVAD->hangover_cnt = 0; - move16(); /* Hangover counter initialized to 0 */ - hVAD->nb_active_frames = ACTIVE_FRAMES_FX; - move16(); /* The counter of SPEECH frames necessary to trigger HO */ - /* is set to max (-> start with hangover) */ - - hVAD->vad_flag_reg_H = L_deposit_l( 0 ); - move32(); - hVAD->vad_flag_reg_L = L_deposit_l( 0 ); - move32(); - hVAD->vad_prim_reg = L_deposit_l( 0 ); - move32(); - hVAD->vad_flag_cnt_50 = 0; - move16(); - hVAD->vad_prim_cnt_16 = 0; - move16(); - - hVAD->hangover_cnt_dtx = HANGOVER_LONG_FX; - move16(); /* hangover for DTX */ - hVAD->hangover_cnt_music = HANGOVER_LONG_MUSIC_FX; - move16(); /* hangover for MUSIC DTX */ - - hVAD->hangover_cnt_he = 0; - move16(); /* Hangover counter initialized to 0 */ - hVAD->nb_active_frames_he = ACTIVE_FRAMES_FX; - move16(); /* The counter of SPEECH frames necessary to trigger HO */ - hVAD->bcg_flux_fx = 1120; - move16(); /*70 in Q4 */ - hVAD->soft_hangover = 0; - move16(); - hVAD->voiced_burst = 0; - move16(); - hVAD->bcg_flux_init = 50; - move16(); - hVAD->nb_active_frames_he1 = ACTIVE_FRAMES_FX; - move16(); - hVAD->hangover_cnt_he1 = 0; - move16(); - return; -} +/*-----------------------------------------------------------------* + * wb_vad_init_fx() + * + * + *-----------------------------------------------------------------*/ -void wb_vad_init_ivas_fx( +void wb_vad_init_fx( VAD_HANDLE hVAD /* i/o: VAD data handle */ ) { diff --git a/lib_enc/vad_proc_fx.c b/lib_enc/vad_proc_fx.c index 2c9273ff54824969fec1d5297c9bf322fd20cee4..16247be44474036584edb5484e2e47a18279a037 100644 --- a/lib_enc/vad_proc_fx.c +++ b/lib_enc/vad_proc_fx.c @@ -15,6 +15,7 @@ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "basop_util.h" /* Function prototypes */ + /*-------------------------------------------------------------------* * vad_init_fx() *