diff --git a/lib_com/bits_alloc.c b/lib_com/bits_alloc.c index 7f7e34b3f510d1ad02a8f6f34642ce3e9bb25093..718b8a240e01a3216d67581a6d3a9e2dc56910c1 100644 --- a/lib_com/bits_alloc.c +++ b/lib_com/bits_alloc.c @@ -552,10 +552,12 @@ ivas_error config_acelp1( const int16_t tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */ const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag */ const int16_t idchan, /* i : stereo channel ID */ - const int16_t active_cnt, /* i : Active frame counter */ - const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ - const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ +#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + const int16_t active_cnt, /* i : Active frame counter */ +#endif + const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/ + const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ ) { int16_t i, bits, nb_subfr; @@ -770,7 +772,11 @@ ivas_error config_acelp1( bits -= acelp_cfg->mid_lsf_bits; } +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + else if ( tdm_lp_reuse_flag == 1 && idchan == 1 ) +#else else if ( tdm_lp_reuse_flag == 1 && idchan == 1 && active_cnt != 1 ) +#endif { bits -= TDM_IC_LSF_PRED_BITS; } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index ab768eb1e0ab7b55b8446b3eef1b22afbe806775..0a804a5815e6021210c8a6cd709609450bee7ed0 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -2122,7 +2122,9 @@ void td_stereo_param_updt( const float lsp_old_PCh[], /* i : primary channel old LSPs */ const float lsf_old_PCh[], /* i : primary channel old LSFs */ const float pitch_buf_PCh[], /* i : primary channel pitch buffer */ +#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC float tdm_lspQ_PCh[], /* o : Q LSPs for primary channel */ +#endif float tdm_lsfQ_PCh[], /* o : Q LSFs for primary channel */ float tdm_Pri_pitch_buf[], /* o : pitch values for primary channel */ const int16_t flag_ACELP16k, /* i : ACELP@16kHz flag */ diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index c96ff4db3067200d2dbcf630e8a3a161452bc754..65f3f4d0991b4c8177f338be50c0d48744b38526 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -440,10 +440,12 @@ void tdm_bit_alloc( *-------------------------------------------------------------------*/ void td_stereo_param_updt( - const float lsp_old_PCh[], /* i : primary channel old LSPs */ - const float lsf_old_PCh[], /* i : primary channel old LSFs */ - const float pitch_buf_PCh[], /* i : primary channel pitch buffer */ - float tdm_lspQ_PCh[], /* o : Q LSPs for primary channel */ + const float lsp_old_PCh[], /* i : primary channel old LSPs */ + const float lsf_old_PCh[], /* i : primary channel old LSFs */ + const float pitch_buf_PCh[], /* i : primary channel pitch buffer */ +#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + float tdm_lspQ_PCh[], /* o : Q LSPs for primary channel */ +#endif float tdm_lsfQ_PCh[], /* o : Q LSFs for primary channel */ float tdm_Pri_pitch_buf[], /* o : pitch values for primary channel */ const int16_t flag_ACELP16k, /* i : ACELP@16kHz flag */ @@ -456,14 +458,17 @@ void td_stereo_param_updt( if ( tdm_use_IAWB_Ave_lpc == 1 ) { mvr2r( IAWB_Ave, tdm_lsfQ_PCh, M ); +#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC if ( tdm_lspQ_PCh != NULL ) { lsf2lsp( tdm_lsfQ_PCh, tdm_lspQ_PCh, M, INT_FS_12k8 ); } +#endif } else if ( flag_ACELP16k == 1 ) { +#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC if ( tdm_lspQ_PCh != NULL ) { mvr2r( lsp_old_PCh, tdm_lspQ_PCh, M ); @@ -472,18 +477,23 @@ void td_stereo_param_updt( } else { +#endif float lsp_temp[M]; mvr2r( lsp_old_PCh, lsp_temp, M ); lsp_convert_poly( lsp_temp, L_FRAME, 0 ); lsp2lsf( lsp_temp, tdm_lsfQ_PCh, M, INT_FS_12k8 ); +#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC } +#endif } else { +#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC if ( tdm_lspQ_PCh != NULL ) { mvr2r( lsp_old_PCh, tdm_lspQ_PCh, M ); } +#endif mvr2r( lsf_old_PCh, tdm_lsfQ_PCh, M ); } diff --git a/lib_com/options.h b/lib_com/options.h index a768aa7deb8ec7d9161338e826e3f218b155a471..a127724dc21ab21ec0b38863c7b3290e18798f31 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -177,6 +177,7 @@ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define NONBE_FIX_1326_MASA_EXTREND_CUSTOMLS_OUT /* FhG: Fix crash for external renderer MASA to custom LS rendering, number of output channels not set correctly */ +#define NONBE_1325_TD_STEREO_QUANT_LSF_SEC /* Nokia: issue 1325: fix for usage of active_cnt variable in TD stereo LSFQ */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 18b6c30c5c8e96896c5cdd24b425549b85eb75e0..fe842760096ea095e82d3c4d582df4b6f26d28b7 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -4551,15 +4551,17 @@ ivas_error acelp_core_dec( int16_t *unbits, /* o : number of unused bits */ int16_t *sid_bw, /* o : 0-NB/WB, 1-SWB SID */ STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */ - const float tdm_lspQ_PCh[M], /* i : Q LSPs for primary channel */ - const float tdm_lsfQ_PCh[M], /* i : Q LSFs for primary channel */ - const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ - const int16_t last_element_mode, /* i : last element mode */ - const int32_t last_element_brate, /* i : last element bitrate */ - const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ - const int16_t nchan_out, /* i : number of output channels */ - STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ - const int16_t read_sid_info /* i : read SID info flag */ +#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + const float tdm_lspQ_PCh[M], /* i : Q LSPs for primary channel */ +#endif + const float tdm_lsfQ_PCh[M], /* i : Q LSFs for primary channel */ + const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ + const int16_t last_element_mode, /* i : last element mode */ + const int32_t last_element_brate, /* i : last element bitrate */ + const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ + const int16_t nchan_out, /* i : number of output channels */ + STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ + const int16_t read_sid_info /* i : read SID info flag */ ); void bass_psfilter_init( @@ -9113,10 +9115,12 @@ ivas_error config_acelp1( const int16_t tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel*/ const int16_t tdm_low_rate_mode, /* i : secondary channel low rate mode flag*/ const int16_t idchan, /* i : channel id */ - const int16_t active_cnt, /* i : Active frame counter */ - const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ - const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ - const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ +#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + const int16_t active_cnt, /* i : Active frame counter */ +#endif + const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ + const int16_t tdm_LRTD_flag, /* i : LRTD stereo mode flag */ + const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ ); /*! r: ACELP16k flag */ diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index 46a3ec30142fe5b653d1fdd4109129df8df1c79f..a5f6b0d7849a09e4e83be7f77549db9fbc1d057d 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -67,15 +67,17 @@ ivas_error acelp_core_dec( int16_t *unbits, /* o : number of unused bits */ int16_t *sid_bw, /* o : 0-NB/WB, 1-SWB SID */ STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */ - const float tdm_lspQ_PCh[M], /* i : Q LSPs for primary channel */ - const float tdm_lsfQ_PCh[M], /* i : Q LSFs for primary channel */ - const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ - const int16_t last_element_mode, /* i : last element mode */ - const int32_t last_element_brate, /* i : last element bitrate */ - const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ - const int16_t nchan_out, /* i : number of output channels */ - STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ - const int16_t read_sid_info /* i : read SID info flag */ +#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + const float tdm_lspQ_PCh[M], /* i : Q LSPs for primary channel */ +#endif + const float tdm_lsfQ_PCh[M], /* i : Q LSFs for primary channel */ + const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ + const int16_t last_element_mode, /* i : last element mode */ + const int32_t last_element_brate, /* i : last element bitrate */ + const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ + const int16_t nchan_out, /* i : number of output channels */ + STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ + const int16_t read_sid_info /* i : read SID info flag */ ) { float old_exc[L_EXC_DEC], *exc; /* excitation signal buffer */ @@ -613,11 +615,19 @@ ivas_error acelp_core_dec( nb_bits = -1; } +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, st->inactive_coder_type_flag, tc_subfr_tmp, 1, &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 ); +#else config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, st->inactive_coder_type_flag, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); +#endif if ( st->coder_type == TRANSITION && tc_subfr < L_SUBFR && st->L_frame == L_FRAME ) { +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, TRANSITION, -1, tc_subfr, 2, &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 ); +#else config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, TRANSITION, -1, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); +#endif } } @@ -654,20 +664,22 @@ ivas_error acelp_core_dec( else { const float *pt_interp_2; - +#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC if ( st->active_cnt != 1 ) { +#endif int16_t beta_index; beta_index = get_next_indice( st, TDM_IC_LSF_PRED_BITS ); tdm_SCh_lsf_reuse( DEC, st->element_brate, lsf_new, lsp_new, tdm_lsfQ_PCh, NULL, &beta_index ); +#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC } else { mvr2r( tdm_lspQ_PCh, lsp_new, M ); mvr2r( tdm_lsfQ_PCh, lsf_new, M ); } - +#endif if ( st->rate_switching_reset ) { /* extrapolation in case of unstable LSF convert */ diff --git a/lib_dec/acelp_core_switch_dec.c b/lib_dec/acelp_core_switch_dec.c index cedc755794b31f49007bbf96e6b590901b2b811c..762de6e65eca6182b99ba19b33a6eb2c02c8cab5 100644 --- a/lib_dec/acelp_core_switch_dec.c +++ b/lib_dec/acelp_core_switch_dec.c @@ -158,7 +158,11 @@ ivas_error acelp_core_switch_dec( * Excitation decoding *----------------------------------------------------------------*/ +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + config_acelp1( DEC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, GENERIC, st->inactive_coder_type_flag, -1, -1, &decode_bwe /* dummy */, &i, st->element_mode, &i /*dummy*/, 0, 0, st->idchan, 0, 0, 0 /*st->GSC_IVAS_mode*/ ); +#else config_acelp1( DEC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, GENERIC, st->inactive_coder_type_flag, -1, -1, &decode_bwe /* dummy */, &i, st->element_mode, &i /*dummy*/, 0, 0, st->idchan, st->active_cnt, 0, 0, 0 /*st->GSC_IVAS_mode*/ ); +#endif decod_gen_voic_core_switch( st, L_frame_for_cs, 0, Aq, exc, cbrate ); diff --git a/lib_dec/evs_dec.c b/lib_dec/evs_dec.c index c5bbddd0606e6859fa229a291c38db4fd2a67cb3..a1b790df81c9ca6399c8221f92e68e9b3759eadf 100644 --- a/lib_dec/evs_dec.c +++ b/lib_dec/evs_dec.c @@ -259,7 +259,11 @@ ivas_error evs_dec( if ( st->core == ACELP_CORE ) { /* ACELP core decoder */ +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + if ( ( error = acelp_core_dec( st, NULL, synth, NULL, bwe_exc_extended, voice_factors, old_syn_12k8_16k, sharpFlag, pitch_buf, &unbits, &sid_bw, NULL, NULL, 0, EVS_MONO, 0, 0, 1, NULL, 1 ) ) != IVAS_ERR_OK ) +#else if ( ( error = acelp_core_dec( st, NULL, synth, NULL, bwe_exc_extended, voice_factors, old_syn_12k8_16k, sharpFlag, pitch_buf, &unbits, &sid_bw, NULL, NULL, NULL, 0, EVS_MONO, 0, 0, 1, NULL, 1 ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/gs_dec.c b/lib_dec/gs_dec.c index a04a8c6837f196f0d06fea3cb2bf330b8904361f..2902b4daba537a1cfe983aae52a537f8587c2e63 100644 --- a/lib_dec/gs_dec.c +++ b/lib_dec/gs_dec.c @@ -111,7 +111,11 @@ void decod_audio( } /* set bit-allocation */ +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, st->inactive_coder_type_flag, -1, 1, &nb_bits, NULL, st->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); +#else config_acelp1( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, st->inactive_coder_type_flag, -1, 1, &nb_bits, NULL, st->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); +#endif /*---------------------------------------------------------------* * Decode energy dynamics diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 1a37f7e02ce893548d60c2b050c6decddd9616c3..9451b41653cf36913f87a1f7ec15594fdb2f3e11 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -294,7 +294,11 @@ ivas_error init_decoder( st->last_active_brate = ACELP_7k20; st->last_CNG_L_frame = L_FRAME; +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + st->active_cnt = CNG_TYPE_HO; +#else st->active_cnt = 20; +#endif if ( idchan == 0 && ( st->element_mode == EVS_MONO || st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) ) { diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 7b6e5770e1a7b4a25c501d9b85e41228d8d46705..f460c574cf49ab89538c2d2a2651836195255213 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -89,7 +89,11 @@ ivas_error ivas_core_dec( int16_t unbits[CPE_CHANNELS]; int16_t sid_bw[CPE_CHANNELS]; FRAME_MODE frameMode[CPE_CHANNELS]; +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + float tdm_lsfQ_PCh[M]; +#else float tdm_lspQ_PCh[M], tdm_lsfQ_PCh[M]; +#endif int16_t tdm_LRTD_flag; int32_t element_brate, output_Fs; int32_t last_element_brate; @@ -356,7 +360,11 @@ ivas_error ivas_core_dec( if ( st->core == ACELP_CORE ) { /* ACELP core decoder */ - if ( ( error = acelp_core_dec( st, output[n], synth[n], save_hb_synth, bwe_exc_extended[n], voice_factors[n], old_syn_12k8_16k[n], sharpFlag[n], pitch_buf[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh, tdm_lsfQ_PCh, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hStereoCng, read_sid_info ) ) != IVAS_ERR_OK ) + if ( ( error = acelp_core_dec( st, output[n], synth[n], save_hb_synth, bwe_exc_extended[n], voice_factors[n], old_syn_12k8_16k[n], sharpFlag[n], pitch_buf[n], &unbits[n], &sid_bw[n], hStereoTD, +#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + tdm_lspQ_PCh, +#endif + tdm_lsfQ_PCh, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hStereoCng, read_sid_info ) ) != IVAS_ERR_OK ) { return error; } @@ -380,7 +388,11 @@ ivas_error ivas_core_dec( if ( st->element_mode == IVAS_CPE_TD && n == 0 ) { +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + td_stereo_param_updt( st->lsp_old, st->lsf_old, st->old_pitch_buf + st->nb_subfr, tdm_lsfQ_PCh, hStereoTD->tdm_Pri_pitch_buf, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc ); +#else td_stereo_param_updt( st->lsp_old, st->lsf_old, st->old_pitch_buf + st->nb_subfr, tdm_lspQ_PCh, tdm_lsfQ_PCh, hStereoTD->tdm_Pri_pitch_buf, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc ); +#endif } } /* n_channels loop */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index e9d9a62384da447235c60aed2466f969b69fc2a7..344b1f4357579421f02ec765d99553cc85e8282a 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -394,13 +394,23 @@ ivas_error ivas_cpe_dec( if ( sts[1] != NULL ) { sts[1]->active_cnt = 0; +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + if ( sts[1]->ini_frame == 0 ) + { + sts[1]->active_cnt = CNG_TYPE_HO; + } +#endif } } else { sts[n]->VAD = 1; sts[n]->active_cnt++; +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + sts[n]->active_cnt = min( sts[n]->active_cnt, 200 ); +#else sts[n]->active_cnt = min( sts[n]->active_cnt, 100 ); +#endif } /* set CNA flag */ diff --git a/lib_enc/acelp_core_enc.c b/lib_enc/acelp_core_enc.c index cf43042ce0088936e8529e9e0857e51eef3d49f9..e0e7b1be037e1adcb409cd14714fbccfb8bae881 100644 --- a/lib_enc/acelp_core_enc.c +++ b/lib_enc/acelp_core_enc.c @@ -375,7 +375,11 @@ ivas_error acelp_core_enc( if ( !nelp_mode && !ppp_mode ) { +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + config_acelp1( 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 ); +#else config_acelp1( 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, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); +#endif } /*-----------------------------------------------------------------* @@ -416,21 +420,21 @@ ivas_error acelp_core_enc( else { const float *pt_interp_2; - +#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC if ( st->active_cnt != 1 ) { +#endif int16_t beta_index; float lsf_wgts[M]; /* intra_frame prediction for the LSFs */ lsp2lsf( lsp_new, lsf_new, M, 12800 ); - Unified_weighting( &st->Bin_E[L_FFT / 2], lsf_new, lsf_wgts, st->bwidth == NB, st->coder_type == UNVOICED, st->sr_core, M ); - tdm_SCh_lsf_reuse( ENC, st->element_brate, lsf_new, lsp_new, tdm_lsfQ_PCh, lsf_wgts, &beta_index ); - push_indice( hBstr, IND_IC_LSF_PRED, beta_index, TDM_IC_LSF_PRED_BITS ); +#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC } +#endif pt_interp_2 = interpol_frac_12k8; if ( tdm_low_rate_mode == 1 && st->coder_type > UNVOICED ) @@ -495,7 +499,11 @@ ivas_error acelp_core_enc( { tc_classif_enc( st->L_frame, &tc_subfr, &position, attack_flag, st->pitch[0], res ); +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 1, NULL, 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 ); +#else config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 1, NULL, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); +#endif } /*---------------------------------------------------------------* @@ -553,7 +561,11 @@ ivas_error acelp_core_enc( lsf_syn_mem_restore( st, tilt_code_bck, gc_threshold_bck, clip_var_bck, next_force_sf_bck, lsp_new, lsp_mid, clip_var, mem_AR, mem_MA, lsp_new_bck, lsp_mid_bck, Bin_E, Bin_E_old, mem_syn_bck, mem_w0_bck, streaklimit, pstreaklen ); /* Configure ACELP bit allocation */ +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); +#else config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); +#endif /* redo LSF quantization */ lsf_enc( st, lsf_new, lsp_new, lsp_mid, Aq, tdm_low_rate_mode, 0, NULL ); diff --git a/lib_enc/acelp_core_switch_enc.c b/lib_enc/acelp_core_switch_enc.c index b169adc8fb11f9f39e5a74217385f73831f2a6f2..ce178ac43e38db4a82ad2e0e3b8cd99a3f5cb763 100644 --- a/lib_enc/acelp_core_switch_enc.c +++ b/lib_enc/acelp_core_switch_enc.c @@ -153,7 +153,11 @@ void acelp_core_switch_enc( * Excitation encoding *----------------------------------------------------------------*/ +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + config_acelp1( ENC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, GENERIC, st->inactive_coder_type_flag, -1, -1, &j, &i, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); +#else config_acelp1( ENC, st->total_brate, cbrate, st->core, -1, -1, st->last_L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, GENERIC, st->inactive_coder_type_flag, -1, -1, &j, &i, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ ); +#endif encod_gen_voic_core_switch( st, st->last_L_frame, inp, Aq, A, T_op, st->voicing, exc, cbrate ); diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 53669f7b65db36fa94ab15c1422cc01c82da9132..afc9b7ca28ed4b4e8bb2b6dca55669e45c49cb1d 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -266,7 +266,11 @@ ivas_error ivas_core_enc( if ( st->element_mode == IVAS_CPE_TD && n == 0 ) { +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + td_stereo_param_updt( st->lsp_old, st->lsf_old, pitch_buf[0], tdm_lsfQ_PCh, hStereoTD->tdm_Pri_pitch_buf, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc ); +#else td_stereo_param_updt( st->lsp_old, st->lsf_old, pitch_buf[0], NULL, tdm_lsfQ_PCh, hStereoTD->tdm_Pri_pitch_buf, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc ); +#endif } } diff --git a/lib_enc/transition_enc.c b/lib_enc/transition_enc.c index 016f5ba0fa970a193b91f59be5016f43b16dd019..804e9c0a48eb61f019d52b7dd268e8fd2da92403 100644 --- a/lib_enc/transition_enc.c +++ b/lib_enc/transition_enc.c @@ -178,7 +178,11 @@ void transition_enc( if ( *tc_subfr == TC_0_0 ) { /* this is called only to compute unused bits */ +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, L_FRAME, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, TC_0_0, 3, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); +#else config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, L_FRAME, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, TC_0_0, 3, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); +#endif } *clip_gain = gp_clip( st->element_mode, st->core_brate, st->voicing, i_subfr, TRANSITION, xn, gp_cl ); @@ -274,7 +278,11 @@ void transition_enc( if ( i_subfr - *tc_subfr <= L_SUBFR ) { +#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC + config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, *tc_subfr, 2, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); +#else config_acelp1( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, *tc_subfr, 2, NULL, unbits_ACELP, st->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st->idchan, st->active_cnt, 0 /*tdm_Pitch_reuse_flag*/, st->tdm_LRTD_flag, 0 /*GSC_IVAS_mode*/ ); +#endif } /*-----------------------------------------------------------------*