diff --git a/lib_com/options.h b/lib_com/options.h index cca18ed73ff896e4602bed7c31175616c92b247c..124f75a425c55f7a272b211beabcf6663937f639 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,6 +163,7 @@ #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 FIX_FLOAT_1522_LTV_MSAN_QMETADATA_ENC_EC3 /* Nokia: float issue 1522: fix uninit MSAN in EC3 of qmetadata encoding */ #define FIX_FLOAT_1526_DIRAC_MEM_LEAK /* FhG: potential memory leak in DirAC handles in case of format switching */ +#define ALIGN_ACELP_CORE /* VA: align ACELP core functions with BASOP */ /* #################### End BE switches ################################## */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 1c16749be86e90e739dcc7e50d5373395ad55b5d..26bb27ea88212ef232ce373be898a3cf98025ef2 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -2334,9 +2334,11 @@ void MDCT_classifier_reset( ); ivas_error acelp_core_enc( - Encoder_State *st, /* i/o: encoder state structure */ - const float inp[], /* i : input signal of the current frame */ - const float ener, /* i : residual energy from Levinson-Durbin */ + Encoder_State *st, /* i/o: encoder state structure */ + const float inp[], /* i : input signal of the current frame */ +#ifndef ALIGN_ACELP_CORE + const float ener, /* i : residual energy from Levinson-Durbin */ +#endif float A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes */ float Aw[NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquant. for subframes */ const float epsP[M + 1], /* i : LP prediction errors */ @@ -3026,10 +3028,12 @@ void analy_sp( ); void CNG_enc( - Encoder_State *st, /* i/o: State structure */ - float Aq[], /* o : LP coefficients */ - const float *speech, /* i : pointer to current frame input speech buffer */ - float enr, /* i : frame energy output from Levinson recursion */ + Encoder_State *st, /* i/o: State structure */ + float Aq[], /* o : LP coefficients */ + const float *speech, /* i : pointer to current frame input speech buffer */ +#ifndef ALIGN_ACELP_CORE + float enr, /* i : frame energy output from Levinson recursion */ +#endif const float *lsp_mid, /* i : mid frame LSPs */ float *lsp_new, /* i/o: current frame LSPs */ float *lsf_new, /* i/o: current frame LSFs */ diff --git a/lib_enc/acelp_core_enc.c b/lib_enc/acelp_core_enc.c index ee8edfd8f160eeef880856d50ad8ea0fd369b63d..e51121e93392a3664007e6e3f38f7c217c7cbd43 100644 --- a/lib_enc/acelp_core_enc.c +++ b/lib_enc/acelp_core_enc.c @@ -57,9 +57,11 @@ *--------------------------------------------------------------------*/ ivas_error acelp_core_enc( - Encoder_State *st, /* i/o: encoder state structure */ - const float inp[], /* i : input signal of the current frame */ - const float ener, /* i : residual energy from Levinson-Durbin*/ + Encoder_State *st, /* i/o: encoder state structure */ + const float inp[], /* i : input signal of the current frame */ +#ifndef ALIGN_ACELP_CORE + const float ener, /* i : residual energy from Levinson-Durbin*/ +#endif float A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes*/ float Aw[NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquant. for subframes*/ const float epsP[M + 1], /* i : LP prediction errors */ @@ -294,7 +296,11 @@ ivas_error acelp_core_enc( cng_params_postupd( st->hTdCngEnc->ho_circ_ptr, &st->hTdCngEnc->cng_buf_cnt, st->hTdCngEnc->cng_exc2_buf, st->hTdCngEnc->cng_brate_buf, st->hTdCngEnc->ho_env_circ, st->element_mode, st->hFdCngEnc->hFdCngCom->CngBandwidth ); /* encode CNG parameters */ +#ifdef ALIGN_ACELP_CORE + CNG_enc( st, Aq, inp, lsp_mid, lsp_new, lsf_new, &allow_cn_step, q_env, &sid_bw ); +#else CNG_enc( st, Aq, inp, ener, lsp_mid, lsp_new, lsf_new, &allow_cn_step, q_env, &sid_bw ); +#endif /* comfort noise generation */ CNG_exc( st->core_brate, st->L_frame, &st->hTdCngEnc->Enew, &st->hTdCngEnc->cng_seed, exc, exc2, &st->hTdCngEnc->lp_ener, st->last_core_brate, &st->hDtxEnc->first_CNG, &st->hTdCngEnc->cng_ener_seed, bwe_exc, allow_cn_step, &st->hTdCngEnc->last_allow_cn_step, st->hTdCngEnc->num_ho, q_env, st->hTdCngEnc->lp_env, st->hTdCngEnc->old_env, st->hTdCngEnc->exc_mem, st->hTdCngEnc->exc_mem1, &sid_bw, &st->hTdCngEnc->cng_ener_seed1, exc3, st->Opt_AMR_WB, EVS_MONO ); diff --git a/lib_enc/amr_wb_enc.c b/lib_enc/amr_wb_enc.c index 03c7bfd30919eb8fa5c0fd165440940dc2dd33c9..7a505bfaf7ac7d36a4d4cd0482469c409d0e97c7 100644 --- a/lib_enc/amr_wb_enc.c +++ b/lib_enc/amr_wb_enc.c @@ -410,7 +410,11 @@ void amr_wb_enc( if ( st->core_brate == SID_1k75 || st->core_brate == FRAME_NO_DATA ) { /* encode CNG parameters */ +#ifdef ALIGN_ACELP_CORE + CNG_enc( st, Aq, inp, isp_new, isp_new, isf_new, &allow_cn_step, q_env, &sid_bw ); +#else CNG_enc( st, Aq, inp, ener, isp_new, isp_new, isf_new, &allow_cn_step, q_env, &sid_bw ); +#endif /* comfort noise generation */ CNG_exc( st->core_brate, L_FRAME, &st->hTdCngEnc->Enew, &st->hTdCngEnc->cng_seed, exc, exc2, &st->hTdCngEnc->lp_ener, st->last_core_brate, &st->hDtxEnc->first_CNG, &st->hTdCngEnc->cng_ener_seed, dummy_buf, allow_cn_step, &st->hTdCngEnc->last_allow_cn_step, st->hTdCngEnc->num_ho, q_env, st->hTdCngEnc->lp_env, st->hTdCngEnc->old_env, st->hTdCngEnc->exc_mem, st->hTdCngEnc->exc_mem1, &sid_bw, &st->hTdCngEnc->cng_ener_seed1, exc3, st->Opt_AMR_WB, EVS_MONO ); diff --git a/lib_enc/cng_enc.c b/lib_enc/cng_enc.c index 251a6595b97f1a91cac4a971ee0767833525ada0..3de8fa7869e799745ee4a76a287413db69444bea 100644 --- a/lib_enc/cng_enc.c +++ b/lib_enc/cng_enc.c @@ -69,10 +69,12 @@ static void shb_CNG_encod( Encoder_State *st, const int16_t update ); *---------------------------------------------------------------------*/ void CNG_enc( - Encoder_State *st, /* i/o: State structure */ - float Aq[], /* o : LP coefficients */ - const float *speech, /* i : pointer to current frame input speech buffer */ - float enr, /* i : residual energy from Levinson-Durbin */ + Encoder_State *st, /* i/o: State structure */ + float Aq[], /* o : LP coefficients */ + const float *speech, /* i : pointer to current frame input speech buffer */ +#ifndef ALIGN_ACELP_CORE + float enr, /* i : residual energy from Levinson-Durbin */ +#endif const float *lsp_mid, /* i : mid frame LSPs */ float *lsp_new, /* i/o: current frame ISPs */ float *lsf_new, /* i/o: current frame ISFs */ @@ -111,10 +113,11 @@ void CNG_enc( float res1[L_FRAME16k]; float tmp_env[HO_HIST_SIZE * NUM_ENV_CNG]; int16_t force_cn_step = 0; - float st_lp_sp_enr; - float lp_ener_thr_scale; +#ifdef ALIGN_ACELP_CORE + float enr; +#endif BSTR_ENC_HANDLE hBstr = st->hBstr; TD_CNG_ENC_HANDLE hTdCngEnc = st->hTdCngEnc; diff --git a/lib_enc/evs_enc.c b/lib_enc/evs_enc.c index d0208373f449803fa78e4509b77891627485ab03..f7bf386f336f622802f8267b90ba4a79a0bfffa9 100644 --- a/lib_enc/evs_enc.c +++ b/lib_enc/evs_enc.c @@ -242,7 +242,11 @@ ivas_error evs_enc( if ( st->core == ACELP_CORE ) { +#ifdef ALIGN_ACELP_CORE + if ( ( error = acelp_core_enc( st, inp, A, Aw, epsP, lsp_new, lsp_mid, vad_hover_flag, attack_flag, bwe_exc_extended, voice_factors, old_syn_12k8_16k, pitch_buf, &unbits, NULL, NULL ) ) != IVAS_ERR_OK ) +#else if ( ( error = acelp_core_enc( st, inp, ener, A, Aw, epsP, lsp_new, lsp_mid, vad_hover_flag, attack_flag, bwe_exc_extended, voice_factors, old_syn_12k8_16k, pitch_buf, &unbits, NULL, NULL ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index 049e35722a2cc3539adc36ceaaff6959cd7c1e07..abd0e6a1746c5d10cce14476128885ea9a2b4eb7 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -239,7 +239,11 @@ ivas_error ivas_core_enc( if ( st->core == ACELP_CORE ) { /* ACELP core encoder */ +#ifdef ALIGN_ACELP_CORE + if ( ( error = acelp_core_enc( st, inp[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], vad_hover_flag[0], attack_flag[n], bwe_exc_extended[n], voice_factors[n], old_syn_12k8_16k[n], pitch_buf[n], &unbits[n], hStereoTD, tdm_lsfQ_PCh ) ) != IVAS_ERR_OK ) +#else if ( ( error = acelp_core_enc( st, inp[n], ener[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], vad_hover_flag[0], attack_flag[n], bwe_exc_extended[n], voice_factors[n], old_syn_12k8_16k[n], pitch_buf[n], &unbits[n], hStereoTD, tdm_lsfQ_PCh ) ) != IVAS_ERR_OK ) +#endif { return error; }