From ae0445ad07d6c8195a4b76ae31f19820522a9dcb Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 13 Feb 2026 16:14:27 +0100 Subject: [PATCH 1/2] ALIGN_ACELP_CORE --- lib_com/options.h | 1 + lib_com/prot.h | 18 +++++++++++------- lib_enc/acelp_core_enc.c | 6 ++++++ lib_enc/amr_wb_enc.c | 4 ++++ lib_enc/cng_enc.c | 7 +++++-- lib_enc/evs_enc.c | 4 ++++ lib_enc/ivas_core_enc.c | 4 ++++ 7 files changed, 35 insertions(+), 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c289efb2a4..0bd76adc69 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -162,6 +162,7 @@ #define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */ #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 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 1c16749be8..26bb27ea88 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 ee8edfd8f1..1ff768fd6b 100644 --- a/lib_enc/acelp_core_enc.c +++ b/lib_enc/acelp_core_enc.c @@ -59,7 +59,9 @@ ivas_error acelp_core_enc( 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 03c7bfd309..7a505bfaf7 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 251a6595b9..f5a7ab2d89 100644 --- a/lib_enc/cng_enc.c +++ b/lib_enc/cng_enc.c @@ -72,7 +72,9 @@ 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 */ +#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 d0208373f4..f7bf386f33 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 049e35722a..abd0e6a174 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; } -- GitLab From f890e2ca4ba39ef7dc870b7629da9d465a58c9d7 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 13 Feb 2026 16:20:53 +0100 Subject: [PATCH 2/2] clang-format --- lib_enc/acelp_core_enc.c | 6 +++--- lib_enc/cng_enc.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib_enc/acelp_core_enc.c b/lib_enc/acelp_core_enc.c index 1ff768fd6b..e51121e933 100644 --- a/lib_enc/acelp_core_enc.c +++ b/lib_enc/acelp_core_enc.c @@ -57,10 +57,10 @@ *--------------------------------------------------------------------*/ ivas_error acelp_core_enc( - Encoder_State *st, /* i/o: encoder state structure */ - const float inp[], /* i : input signal of the current frame */ + 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*/ + 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*/ diff --git a/lib_enc/cng_enc.c b/lib_enc/cng_enc.c index f5a7ab2d89..3de8fa7869 100644 --- a/lib_enc/cng_enc.c +++ b/lib_enc/cng_enc.c @@ -69,11 +69,11 @@ 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 */ + 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 */ + 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 */ -- GitLab