From 249fe901e512587f19ef72bc1f005ae81bd074e4 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 30 Apr 2026 14:24:06 +0200 Subject: [PATCH 01/23] add macro and code for HARMONIZE_2567_init_acelp --- lib_com/options.h | 1 + lib_enc/core_enc_init_fx.c | 112 +++++++++++++++++++++++++++++++------ 2 files changed, 96 insertions(+), 17 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6579999f2..92ab2ee71 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -104,6 +104,7 @@ #define HARMONIZE_2537_SetTCXModeInfo /* FhG: Harmonize SetTCXModeInfo - IVAS_VERSION OBVIOUSLY NOT FITTING FOR EVS - pipes not green */ #define HARMONIZE_2537_GetTCXMaxenergyChange /* FhG: Harmonize GetTCXMaxenergyChange */ #define HARMONIZE_2508_InitTransientDetection /* FhG: harmonize GetAttackForTCXDecision derivates for evs/ivas */ +#define HARMONIZE_2567_init_acelp /* FhG: harmonize init_acelp derivates for evs/ivas */ #define FIX_BASOP_2555_FRAMELEN_CALC /* FhG: BASOP issue 2555: Simplify (sub-)framelength calculation in ivas_mdct_core_tns_ns_fx() */ #define FIX_BASOP_2095_REMOVE_TABLES_PT01 /* FhG: BASOP issue 2095: remove unused tables, part 01 */ #define FIX_2346_DUPLICATED_IGF_FUNCTIONS_2 /* FhG: part 2 of basop issue 2346: Review potentially duplicated IGF functions */ diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index d79a2a3c9..495a5e72a 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -21,14 +21,20 @@ static void init_tcx_fx( Encoder_State *st, Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag ); static void init_core_sig_ana_fx( Encoder_State *st ); +#ifdef HARMONIZE_2567_init_acelp +static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift, const Word32 last_total_brate ); +#else static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift ); +#endif static void init_modes_fx( Encoder_State *st, const Word32 Last_total_brate ); static void init_sig_buffers_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr ); static void init_tcx_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag ); static void init_core_sig_ana_ivas_fx( Encoder_State *st ); static void init_modes_ivas_fx( Encoder_State *st, const Word32 last_total_brate ); static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr, const Word32 last_total_brate ); +#ifndef HARMONIZE_2567_init_acelp static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 shift, const Word32 last_total_brate ); +#endif /*-----------------------------------------------------------------------* * init_coder_ace_plus_fx() @@ -174,7 +180,11 @@ void init_coder_ace_plus_fx( init_sig_buffers_fx( st, L_frame_old, L_subfr ); /* Initialize ACELP */ - init_acelp_fx( st, L_frame_old, shift ); +#ifdef HARMONIZE_2567_init_acelp + init_acelp_fx( st, L_frame_old, shift, 0 ); +#else + init_acelp_fx( st, L_frame_old, shift); +#endif if ( st->ini_frame == 0 ) { @@ -585,6 +595,7 @@ static void init_core_sig_ana_fx( Encoder_State *st ) return; } +#ifndef HARMONIZE_2567_init_acelp static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift ) { Word16 mem_syn_r_size_old; @@ -829,6 +840,7 @@ static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 s return; } +#endif static void init_modes_fx( Encoder_State *st, @@ -1085,7 +1097,11 @@ void init_coder_ace_plus_ivas_fx( /* Initialize ACELP */ +#ifdef HARMONIZE_2567_init_acelp + init_acelp_fx( st, L_frame_old, 0, last_total_brate ); +#else init_acelp_ivas_fx( st, L_frame_old, 0, last_total_brate ); +#endif if ( st->ini_frame == 0 ) { @@ -1538,7 +1554,11 @@ static void init_core_sig_ana_ivas_fx( Encoder_State *st ) * * *-----------------------------------------------------------------------*/ +#ifdef HARMONIZE_2567_init_acelp +static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift, const Word32 last_total_brate ) +#else static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 shift, const Word32 last_total_brate ) +#endif { Word16 mem_syn_r_size_old; Word16 mem_syn_r_size_new; @@ -1565,10 +1585,17 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh { set16_fx( hLPDmem->syn, 0, 1 + M ); set16_fx( hLPDmem->mem_syn_r, 0, L_SYN_MEM ); - hLPDmem->q_lpd_syn = Q15; - hLPDmem->q_mem_syn = Q15; - move16(); - move16(); +#ifdef HARMONIZE_2567_init_acelp + IF( GT_16( st->element_mode, EVS_MONO ) ) + { +#endif + hLPDmem->q_lpd_syn = Q15; + hLPDmem->q_mem_syn = Q15; + move16(); + move16(); +#ifdef HARMONIZE_2567_init_acelp + } +#endif } IF( st->hTcxEnc != NULL ) @@ -1598,10 +1625,12 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh { Copy( hLPDmem->mem_syn1_fx, hLPDmem->mem_syn2, M ); set16_fx( hLPDmem->syn, 0, M ); +#ifndef HARMONIZE_2567_init_acelp hLPDmem->q_lpd_syn = Q15; hLPDmem->q_mem_syn = Q15; move16(); move16(); +#endif } IF( st->hTcxEnc != NULL ) { @@ -1634,23 +1663,50 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh move16(); set16_fx( hLPDmem->old_exc, 0, L_EXC_MEM ); set16_fx( hLPDmem->syn, 0, 1 + M ); - hLPDmem->q_lpd_syn = Q15; - move16(); - hLPDmem->q_lpd_old_exc = Q15; - move16(); +#ifdef HARMONIZE_2567_init_acelp + IF( GT_16( st->element_mode, EVS_MONO ) ) + { +#endif + hLPDmem->q_lpd_syn = Q15; + move16(); + hLPDmem->q_lpd_old_exc = Q15; + move16(); +#ifdef HARMONIZE_2567_init_acelp + } +#endif hLPDmem->mem_w0 = 0; move16(); set16_fx( hLPDmem->mem_syn, 0, M ); set16_fx( hLPDmem->mem_syn2, 0, M ); - hLPDmem->q_mem_syn = Q15; - move16(); +#ifdef HARMONIZE_2567_init_acelp + IF( GT_16( st->element_mode, EVS_MONO ) ) + { +#endif + hLPDmem->q_mem_syn = Q15; + move16(); +#ifdef HARMONIZE_2567_init_acelp + } +#endif } /* unquantized LPC*/ test(); test(); test(); +#ifdef HARMONIZE_2567_init_acelp + Word16 condition; + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + condition = !( ( EQ_32( st->total_brate, ACELP_16k40 ) || EQ_32( st->total_brate, ACELP_24k40 ) ) && ( EQ_32( st->total_brate, st->last_total_brate ) ) && ( EQ_16( st->last_bwidth, st->bwidth ) ) ); + } + ELSE + { + condition = !( ( GE_32( st->total_brate, ACELP_16k40 ) && LE_32( st->total_brate, ACELP_24k40 ) ) && ( EQ_32( st->total_brate, last_total_brate ) ) && ( EQ_16( st->last_bwidth, st->bwidth ) ) ); + } + IF( condition ) +#else IF( !( ( GE_32( st->total_brate, ACELP_16k40 ) && LE_32( st->total_brate, ACELP_24k40 ) ) && ( EQ_32( st->total_brate, last_total_brate ) ) && ( EQ_16( st->last_bwidth, st->bwidth ) ) ) ) +#endif { Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); /*lsp old @12.8kHz*/ IF( EQ_16( st->L_frame, L_FRAME16k ) ) @@ -1741,8 +1797,15 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh move16(); set16_fx( hLPDmem->old_exc, 0, L_EXC_MEM ); move16(); - hLPDmem->q_lpd_old_exc = Q15; - move16(); +#ifdef HARMONIZE_2567_init_acelp + IF( GT_16( st->element_mode, EVS_MONO ) ) + { +#endif + hLPDmem->q_lpd_old_exc = Q15; + move16(); +#ifdef HARMONIZE_2567_init_acelp + } +#endif /*Resamp others memories*/ /*Size of LPC syn memory*/ /* 1.25/20.0 = 1.0/16.0 -> shift 4 to the right. */ @@ -1830,19 +1893,34 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh { st->mem_bpf_fx.lp_error_ener = L_deposit_l( 0 ); move32(); - st->pst_lp_ener_fx = 0; - move16(); +#ifdef HARMONIZE_2567_init_acelp + if ( GT_16( st->element_mode, EVS_MONO ) ) + { +#endif + st->pst_lp_ener_fx = 0; + move16(); +#ifdef HARMONIZE_2567_init_acelp + } +#endif IF( EQ_16( st->last_codec_mode, MODE1 ) ) { st->mem_bpf_fx.lp_error = 0; move32(); - st->pst_mem_deemp_err_fx = 0; - move16(); +#ifdef HARMONIZE_2567_init_acelp + if ( GT_16( st->element_mode, EVS_MONO ) ) + { +#endif + st->pst_mem_deemp_err_fx = 0; + move16(); +#ifdef HARMONIZE_2567_init_acelp + } +#endif } } return; } + /*-----------------------------------------------------------------------* * init_modes() * -- GitLab From 2b38d32d3ce0bb326dbc83eecb7dcfa203a9415a Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 30 Apr 2026 14:35:29 +0200 Subject: [PATCH 02/23] clang patch --- lib_enc/core_enc_init_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 495a5e72a..bde571607 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -183,7 +183,7 @@ void init_coder_ace_plus_fx( #ifdef HARMONIZE_2567_init_acelp init_acelp_fx( st, L_frame_old, shift, 0 ); #else - init_acelp_fx( st, L_frame_old, shift); + init_acelp_fx( st, L_frame_old, shift ); #endif if ( st->ini_frame == 0 ) -- GitLab From f400fce33cd6dde5ca0d4cad3c397e40060a770d Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Mon, 4 May 2026 09:13:28 +0200 Subject: [PATCH 03/23] fix prototype --- lib_enc/core_enc_init_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 0fed59dbf..8a87d03b1 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -1102,7 +1102,7 @@ void init_coder_ace_plus_ivas_fx( /* Initialize ACELP */ #ifdef HARMONIZE_2567_init_acelp #ifdef NONBE_FIX_ISSUE_2518 - init_acelp_fx(st, L_frame_old, last_total_brate); + init_acelp_fx(st, L_frame_old, 0, last_total_brate); #else init_acelp_fx(st, L_frame_old, 0, last_total_brate); #endif @@ -1567,7 +1567,7 @@ static void init_core_sig_ana_ivas_fx( Encoder_State *st ) *-----------------------------------------------------------------------*/ #ifdef NONBE_FIX_ISSUE_2518 #ifdef HARMONIZE_2567_init_acelp -static void init_acelp_fx(Encoder_State* st, Word16 L_frame_old, const Word32 last_total_brate) +static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift, const Word32 last_total_brate ) #else static void init_acelp_ivas_fx(Encoder_State* st, Word16 L_frame_old, const Word32 last_total_brate) #endif -- GitLab From d2ef2bedb8ff3fdc1035e69100d8d09f364095f4 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Mon, 4 May 2026 09:48:03 +0200 Subject: [PATCH 04/23] clang format patch --- lib_enc/core_enc_init_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 8a87d03b1..2e37f7e4b 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -1102,9 +1102,9 @@ void init_coder_ace_plus_ivas_fx( /* Initialize ACELP */ #ifdef HARMONIZE_2567_init_acelp #ifdef NONBE_FIX_ISSUE_2518 - init_acelp_fx(st, L_frame_old, 0, last_total_brate); + init_acelp_fx( st, L_frame_old, 0, last_total_brate ); #else - init_acelp_fx(st, L_frame_old, 0, last_total_brate); + init_acelp_fx( st, L_frame_old, 0, last_total_brate ); #endif #else #ifdef NONBE_FIX_ISSUE_2518 @@ -1569,7 +1569,7 @@ static void init_core_sig_ana_ivas_fx( Encoder_State *st ) #ifdef HARMONIZE_2567_init_acelp static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift, const Word32 last_total_brate ) #else -static void init_acelp_ivas_fx(Encoder_State* st, Word16 L_frame_old, const Word32 last_total_brate) +static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Word32 last_total_brate ) #endif #else #ifdef HARMONIZE_2567_init_acelp -- GitLab From 754f5b9c5b9771eeef064fa44ed4524588d52de0 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Mon, 4 May 2026 09:55:10 +0200 Subject: [PATCH 05/23] fix unused variable --- lib_enc/core_enc_init_fx.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 2e37f7e4b..6b2e42a96 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -1797,8 +1797,21 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh Copy( hLPDmem->mem_syn2, tmp_buf + 1, M ); deemph_fx( tmp_buf + 1, st->preemph_fac, M, &tmp ); #ifdef NONBE_FIX_ISSUE_2518 +#ifdef HARMONIZE_2567_init_acelp + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 1 ); + hLPDmem->mem_w0 = sub_sat( shr_sat( st->wspeech_enc[-1], shift ), tmp ); + } + ELSE + { + Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 0 ); + hLPDmem->mem_w0 = sub_sat( shl_sat( st->wspeech_enc[-1], sub( hLPDmem->q_mem_syn, sub( Q15, st->exp_buf_wspeech_enc ) ) ), tmp ); + } +#else Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 0 ); hLPDmem->mem_w0 = sub_sat( shl_sat( st->wspeech_enc[-1], sub( hLPDmem->q_mem_syn, sub( Q15, st->exp_buf_wspeech_enc ) ) ), tmp ); +#endif #else Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 1 ); hLPDmem->mem_w0 = sub_sat( shr_sat( st->wspeech_enc[-1], shift ), tmp ); -- GitLab From 57956b34f0c52a02e788e292e0e3e825250eab2a Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Mon, 4 May 2026 11:04:25 +0200 Subject: [PATCH 06/23] added macro and code HARMONIZE_2567_init_tcx_cfg --- lib_com/core_com_config_fx.c | 22 +++++++++++++++++++ lib_com/options.h | 1 + lib_com/prot_fx.h | 41 +++++++++++++++++++++++------------- lib_enc/core_enc_init_fx.c | 7 +++++- 4 files changed, 55 insertions(+), 16 deletions(-) diff --git a/lib_com/core_com_config_fx.c b/lib_com/core_com_config_fx.c index e2f617a62..068048fb1 100644 --- a/lib_com/core_com_config_fx.c +++ b/lib_com/core_com_config_fx.c @@ -825,7 +825,11 @@ Word16 getTcxLpcShapedAri( * Initialization of TCX *-----------------------------------------------------------------------*/ +#ifdef HARMONIZE_2567_init_tcx_cfg +void init_tcx_cfg_fx( +#else void init_tcx_cfg_ivas_fx( +#endif TCX_CONFIG_HANDLE hTcxCfg, const Word32 total_brate, /*Q0*/ const Word32 sr_core, /*Q0*/ @@ -841,7 +845,12 @@ void init_tcx_cfg_ivas_fx( const Word16 infoIGFStopFreq, /*Q0*/ const Word16 element_mode, /*Q0*/ const Word16 ini_frame, /*Q0*/ +#ifdef HARMONIZE_2567_init_tcx_cfg + const Word16 MCT_flag, /*Q0*/ + const Word16 fscaleFB /*Q0*/ ) +#else const Word16 MCT_flag /*Q0*/ ) +#endif { Word16 i; Word16 mdctWindowLength; @@ -859,7 +868,18 @@ void init_tcx_cfg_ivas_fx( hTcxCfg->tcx_mdct_window_length_old = hTcxCfg->tcx_mdct_window_length; /*Q0*/ move16(); mdctWindowLength = getMdctWindowLength_fx( fscale ); /*Q0*/ +#ifdef HARMONIZE_2567_init_tcx_cfg + IF( EQ_16( element_mode, EVS_MONO ) ) + { + mdctWindowLengthFB = getMdctWindowLength_fx( fscaleFB ); /*Q0*/ + } + ELSE + { + mdctWindowLengthFB = (Word16) ( mdctWindowLength * input_Fs / sr_core ); + } +#else mdctWindowLengthFB = (Word16) ( mdctWindowLength * input_Fs / sr_core ); +#endif init_tcx_window_cfg_fx( hTcxCfg, sr_core, input_Fs, L_frame, L_frameTCX, mdctWindowLength, mdctWindowLengthFB, element_mode ); /* SQ deadzone & memory quantization*/ @@ -1080,6 +1100,7 @@ void init_tcx_window_cfg_fx( return; } +#ifndef HARMONIZE_2567_init_tcx_cfg void init_tcx_cfg_fx( TCX_CONFIG_HANDLE hTcxCfg, const Word32 total_brate, /*Q0*/ @@ -1227,3 +1248,4 @@ void init_tcx_cfg_fx( return; } +#endif diff --git a/lib_com/options.h b/lib_com/options.h index f99515126..4c0c75392 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -106,6 +106,7 @@ #define HARMONIZE_2539_cng_energy /* FhG: basop issue 2539: harmonize cng_energy with its ivas derivate */ #define FIX_1585_ASAN_FORMAT_SW_ALT /* VA: float issue 1585: alternative fix memory leaks with format switching */ #define HARMONIZE_2567_init_acelp /* FhG: harmonize init_acelp derivates for evs/ivas */ +#define HARMONIZE_2567_init_tcx_cfg /* FhG: harmonize init_tcx_cfg derivates for evs/ivas */ /* #################### End BE switches ################################## */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 7d541d076..5613bac53 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -5758,6 +5758,7 @@ void init_tcx_window_cfg_fx( const Word16 element_mode /* i : mode of CPE/SCE */ ); +#ifndef HARMONIZE_2567_init_tcx_cfg void init_tcx_cfg_fx( TCX_CONFIG_HANDLE hTcxCfg, const Word32 total_brate, @@ -5776,6 +5777,7 @@ void init_tcx_cfg_fx( const Word16 ini_frame, const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */, const Word16 fscaleFB ); +#endif void syn_output_fx( const Word16 codec_mode, /* i : MODE1 or MODE2 */ @@ -9610,23 +9612,32 @@ void SetModeIndex_ivas_fx( const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) Q0*/ ); +#ifdef HARMONIZE_2567_init_tcx_cfg +void init_tcx_cfg_fx( +#else void init_tcx_cfg_ivas_fx( +#endif TCX_CONFIG_HANDLE hTcxCfg, - const Word32 total_brate, - const Word32 sr_core, - const Word32 input_Fs, - const Word16 L_frame, - const Word16 bwidth, - const Word16 L_frameTCX, - const Word16 fscale, - const Word16 preemph_fac, - const Word16 tcxonly, - const Word16 rf_mode, - const Word16 igf, - const Word16 infoIGFStopFreq, - const Word16 element_mode, - const Word16 ini_frame, - const Word16 MCT_flag ); + const Word32 total_brate, /*Q0*/ + const Word32 sr_core, /*Q0*/ + const Word32 input_Fs, /*Q0*/ + const Word16 L_frame, /*Q0*/ + const Word16 bwidth, /*Q0*/ + const Word16 L_frameTCX, /*Q0*/ + const Word16 fscale, /*Q0*/ + const Word16 preemph_fac, /*Q15*/ + const Word16 tcxonly, /*Q0*/ + const Word16 rf_mode, /*Q0*/ + const Word16 igf, /*Q0*/ + const Word16 infoIGFStopFreq, /*Q0*/ + const Word16 element_mode, /*Q0*/ + const Word16 ini_frame, /*Q0*/ +#ifdef HARMONIZE_2567_init_tcx_cfg + const Word16 MCT_flag, /*Q0*/ + const Word16 fscaleFB /*Q0*/ ); +#else + const Word16 MCT_flag /*Q0*/ ); +#endif Word16 msvq_stage1_dct_search_fx( const Word32 *u_fx, /* i : target exp : u_e */ diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 6b2e42a96..2e5b28abd 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -1230,10 +1230,15 @@ static void init_tcx_ivas_fx( st->hTcxEnc->spectrum_e[0] = st->hTcxEnc->spectrum_e[1] = 0; move16(); move16(); - +#ifdef HARMONIZE_2567_init_tcx_cfg + init_tcx_cfg_fx( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, + st->fscale, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, + st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag, 0 ); +#else init_tcx_cfg_ivas_fx( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, st->fscale, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag ); +#endif /* Init TCX target bits correction factor */ hTcxEnc->tcx_target_bits_fac = 0x4000; /*1.0f in 1Q14*/ -- GitLab From ed470042e76285ed0189498f7a1779c396422660 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Mon, 4 May 2026 11:38:47 +0200 Subject: [PATCH 07/23] clang patch --- lib_enc/core_enc_init_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 2e5b28abd..e8a53c598 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -1232,8 +1232,8 @@ static void init_tcx_ivas_fx( move16(); #ifdef HARMONIZE_2567_init_tcx_cfg init_tcx_cfg_fx( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, - st->fscale, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, - st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag, 0 ); + st->fscale, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, + st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag, 0 ); #else init_tcx_cfg_ivas_fx( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, st->fscale, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, -- GitLab From 49bc936ec2c3aaf411c03070bbd1a3a3fe5ca6e4 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Mon, 4 May 2026 12:25:59 +0200 Subject: [PATCH 08/23] added macro and code HARMONIZE_2567_init_tcx --- lib_com/options.h | 2 +- lib_enc/core_enc_init_fx.c | 181 +++++++++++++++++++++++++++++++------ 2 files changed, 154 insertions(+), 29 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 4c0c75392..9c167a7f4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -107,7 +107,7 @@ #define FIX_1585_ASAN_FORMAT_SW_ALT /* VA: float issue 1585: alternative fix memory leaks with format switching */ #define HARMONIZE_2567_init_acelp /* FhG: harmonize init_acelp derivates for evs/ivas */ #define HARMONIZE_2567_init_tcx_cfg /* FhG: harmonize init_tcx_cfg derivates for evs/ivas */ - +#define HARMONIZE_2567_init_tcx /* FhG: harmonize init_tcx derivates for evs/ivas */ /* #################### End BE switches ################################## */ /* #################### Start NON-BE switches ############################ */ diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index e8a53c598..50bb4a1c4 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -19,7 +19,9 @@ * Local functions *-----------------------------------------------------------------------*/ +#ifndef HARMONIZE_2567_init_tcx static void init_tcx_fx( Encoder_State *st, Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag ); +#endif static void init_core_sig_ana_fx( Encoder_State *st ); #ifdef HARMONIZE_2567_init_acelp static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift, const Word32 last_total_brate ); @@ -28,7 +30,11 @@ static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 s #endif static void init_modes_fx( Encoder_State *st, const Word32 Last_total_brate ); static void init_sig_buffers_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr ); +#ifdef HARMONIZE_2567_init_tcx +static void init_tcx_fx( Encoder_State *st, const Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag ); +#else static void init_tcx_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag ); +#endif static void init_core_sig_ana_ivas_fx( Encoder_State *st ); static void init_modes_ivas_fx( Encoder_State *st, const Word32 last_total_brate ); static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr, const Word32 last_total_brate ); @@ -288,6 +294,7 @@ void init_coder_ace_plus_fx( return; } +#ifndef HARMONIZE_2567_init_tcx static void init_tcx_fx( Encoder_State *st, Word16 L_frame_old, @@ -447,6 +454,7 @@ static void init_tcx_fx( hTcxEnc->tcx_lpc_shaped_ari = getTcxLpcShapedAri( st->total_brate, st->rf_mode, st->element_mode ); move16(); } +#endif void init_sig_buffers_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr ) { @@ -1093,7 +1101,11 @@ void init_coder_ace_plus_ivas_fx( /* Initialize TCX */ IF( hTcxEnc != NULL ) { +#ifdef HARMONIZE_2567_init_tcx + init_tcx_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); +#else init_tcx_ivas_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); +#endif } /* Initialize Signal Buffers */ @@ -1215,7 +1227,11 @@ void init_coder_ace_plus_ivas_fx( *-----------------------------------------------------------------------*/ +#ifdef HARMONIZE_2567_init_tcx +static void init_tcx_fx( +#else static void init_tcx_ivas_fx( +#endif Encoder_State *st, const Word16 L_frame_old, const Word32 total_brate, @@ -1223,22 +1239,56 @@ static void init_tcx_ivas_fx( const Word16 MCT_flag ) { TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; +#ifdef HARMONIZE_2567_init_tcx + Word16 i; + Word16 fscaleFB; - /* Share the memories for 2xTCX10/4xTCX5 and for TCX20 */ - hTcxEnc->spectrum_fx[0] = hTcxEnc->spectrum_long_fx; - hTcxEnc->spectrum_fx[1] = hTcxEnc->spectrum_long_fx + N_TCX10_MAX; - st->hTcxEnc->spectrum_e[0] = st->hTcxEnc->spectrum_e[1] = 0; - move16(); - move16(); + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + fscaleFB = div_l( L_shl( st->input_Fs, LD_FSCALE_DENOM + 1 ), 12800 ); + + init_TCX_config( st->hTcxCfg, st->L_frame, st->fscale, hTcxEnc->L_frameTCX, fscaleFB ); + + st->hTcxCfg->tcx_mdct_window_length_old = st->hTcxCfg->tcx_mdct_window_length; + move16(); + + /* TCX Offset */ + st->hTcxCfg->tcx_offset = shr( st->hTcxCfg->tcx_mdct_window_delay, 1 ); + move16(); + st->hTcxCfg->tcx_offsetFB = shr( st->hTcxCfg->tcx_mdct_window_delayFB, 1 ); + move16(); + + /*<0 rectangular transition with optimized window size = L_frame+L_frame/4*/ + st->hTcxCfg->lfacNext = sub( st->hTcxCfg->tcx_offset, shr( st->L_frame, 2 ) ); + move16(); + st->hTcxCfg->lfacNextFB = sub( st->hTcxCfg->tcx_offsetFB, shr( hTcxEnc->L_frameTCX, 2 ) ); + move16(); + IF( st->ini_frame == 0 ) + { + st->hTcxCfg->tcx_curr_overlap_mode = st->hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW; + move16(); + move16(); + } + } + ELSE +#endif + { + /* Share the memories for 2xTCX10/4xTCX5 and for TCX20 */ + hTcxEnc->spectrum_fx[0] = hTcxEnc->spectrum_long_fx; + hTcxEnc->spectrum_fx[1] = hTcxEnc->spectrum_long_fx + N_TCX10_MAX; + st->hTcxEnc->spectrum_e[0] = st->hTcxEnc->spectrum_e[1] = 0; + move16(); + move16(); #ifdef HARMONIZE_2567_init_tcx_cfg - init_tcx_cfg_fx( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, - st->fscale, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, - st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag, 0 ); + init_tcx_cfg_fx( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, + st->fscale, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, + st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag, 0 ); #else - init_tcx_cfg_ivas_fx( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, - st->fscale, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, - st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag ); + init_tcx_cfg_ivas_fx( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, + st->fscale, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, + st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag ); #endif + } /* Init TCX target bits correction factor */ hTcxEnc->tcx_target_bits_fac = 0x4000; /*1.0f in 1Q14*/ @@ -1249,9 +1299,59 @@ static void init_tcx_ivas_fx( move16(); hTcxEnc->noiseLevelMemory_cnt = 0; move16(); +#ifdef HARMONIZE_2567_init_tcx + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + /*SQ deadzone & memory quantization*/ + + /*0.375f: deadzone of 1.25->rounding=1-1.25/2 (No deadzone=0.5)*/ + st->hTcxCfg->sq_rounding = 12288 /*0.375f Q15*/; + move16(); + + FOR( i = 0; i < L_FRAME_PLUS; i++ ) + { + hTcxEnc->memQuantZeros[i] = 0; + move16(); + } + + /* TCX rate loop */ + st->hTcxCfg->tcxRateLoopOpt = 0; + move16(); + + if ( st->tcxonly != 0 ) + { + st->hTcxCfg->tcxRateLoopOpt = 2; + move16(); + } + + /* TCX bandwidth */ + move16(); + st->hTcxCfg->bandwidth = getTcxBandwidth( st->bwidth ); + + + /* set number of coded lines */ + st->hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( st->bwidth ); + + /* TNS in TCX */ + move16(); + move16(); + st->hTcxCfg->fIsTNSAllowed = (Word8) getTnsAllowed( st->total_brate, st->igf, st->element_mode ); + + st->hTcxCfg->pCurrentTnsConfig = NULL; - set16_fx( hTcxEnc->ltpGainMemory_fx, 0, N_LTP_GAIN_MEMS ); - set8_fx( hTcxEnc->memQuantZeros, 0, L_FRAME_PLUS ); + IF( st->hTcxCfg->fIsTNSAllowed != 0 ) + { + InitTnsConfigs_fx( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->total_brate, st->element_mode, 0 /*is_mct*/ ); + } + } + ELSE + { +#endif + set16_fx( hTcxEnc->ltpGainMemory_fx, 0, N_LTP_GAIN_MEMS ); + set8_fx( hTcxEnc->memQuantZeros, 0, L_FRAME_PLUS ); +#ifdef HARMONIZE_2567_init_tcx + } +#endif /* TCX-LTP */ hTcxEnc->tcxltp = getTcxLtp( st->sr_core ); @@ -1267,21 +1367,28 @@ static void init_tcx_ivas_fx( hTcxEnc->tcxltp_pitch_fr_past = 0; hTcxEnc->tcxltp_gain_past = 0; hTcxEnc->tcxltp_norm_corr_past = 0; - hTcxEnc->tcxltp_norm_corr_mem = 0; - hTcxEnc->kernel_switch_corr_past = 0; - hTcxEnc->kernel_symmetry_past = 0; /* MDCT_IV & 1 */ - hTcxEnc->enc_ste_pre_corr_past = 0; - hTcxEnc->tfm_mem_fx = 1610612736; /* 0.75 in Q31 */ - hTcxEnc->tcxltp_on_mem = 0; - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); move16(); +#ifdef HARMONIZE_2567_init_tcx + IF( GT_16( st->element_mode, EVS_MONO ) ) + { +#endif + hTcxEnc->tcxltp_norm_corr_mem = 0; + hTcxEnc->kernel_switch_corr_past = 0; + hTcxEnc->kernel_symmetry_past = 0; /* MDCT_IV & 1 */ + hTcxEnc->enc_ste_pre_corr_past = 0; + hTcxEnc->tfm_mem_fx = 1610612736; /* 0.75 in Q31 */ + hTcxEnc->tcxltp_on_mem = 0; + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); +#ifdef HARMONIZE_2567_init_tcx + } +#endif move16(); } ELSE IF( NE_16( st->L_frame, L_frame_old ) && !( ( GE_32( total_brate, ACELP_16k40 ) && LE_32( total_brate, ACELP_24k40 ) ) && @@ -1320,6 +1427,24 @@ static void init_tcx_ivas_fx( move16(); } +#ifdef HARMONIZE_2567_init_tcx + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + /* Residual Coding*/ + st->hTcxCfg->resq = getResq( st->total_brate ); + move16(); + + test(); + if ( st->hTcxCfg->resq != 0 && st->tcxonly == 0 ) + { + st->hTcxCfg->tcxRateLoopOpt = 1; + move16(); + } + + st->hTcxCfg->ctx_hm = getCtxHm( st->element_mode, st->total_brate, st->rf_mode ); + move16(); + } +#endif hTcxEnc->tcx_lpc_shaped_ari = getTcxLpcShapedAri( st->total_brate, st->rf_mode, st->element_mode ); move16(); -- GitLab From 9eacdeb32bddc676a9ffda9636aa9a1111fd5411 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 May 2026 11:36:54 +0200 Subject: [PATCH 09/23] add code and macro for HARMONIZE_2567_init_coder_ace_plus --- lib_com/options.h | 1 + lib_com/prot_fx.h | 11 ++- lib_enc/core_enc_init_fx.c | 173 +++++++++++++++++++++++++++++++---- lib_enc/core_enc_switch_fx.c | 10 ++ lib_enc/init_enc_fx.c | 9 ++ lib_enc/prot_fx_enc.h | 2 + 6 files changed, 186 insertions(+), 20 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9c167a7f4..3a7c8dece 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -108,6 +108,7 @@ #define HARMONIZE_2567_init_acelp /* FhG: harmonize init_acelp derivates for evs/ivas */ #define HARMONIZE_2567_init_tcx_cfg /* FhG: harmonize init_tcx_cfg derivates for evs/ivas */ #define HARMONIZE_2567_init_tcx /* FhG: harmonize init_tcx derivates for evs/ivas */ +#define HARMONIZE_2567_init_coder_ace_plus /* FhG: harmonize init_coder_ace_plus derivates for evs/ivas */ /* #################### End BE switches ################################## */ /* #################### Start NON-BE switches ############################ */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 5613bac53..6bc257e83 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -9587,11 +9587,20 @@ void writeTCXparam_fx( const Word16 target_bitsTCX10[2], const Word16 pre_past_flag ); +#ifdef HARMONIZE_2567_init_coder_ace_plus +void init_coder_ace_plus_fx( + Encoder_State *st, /* i : Encoder state */ + const Word32 last_total_brate, /* i : last total bitrate */ + const Word32 igf_brate, /* i : IGF configuration bitrate */ + const Word16 shift, + const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ +#else void init_coder_ace_plus_ivas_fx( Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate */ - const Word32 igf_brate, /* i : IGF configuration bitrate */ + const Word32 igf_brate, /* i : IGF configuration bitrate */ const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ +#endif ); void core_coder_reconfig_ivas_fx( diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 50bb4a1c4..97de78c8d 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -46,6 +46,7 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh #endif #endif +#ifndef HARMONIZE_2567_init_coder_ace_plus /*-----------------------------------------------------------------------* * init_coder_ace_plus_fx() * @@ -293,6 +294,7 @@ void init_coder_ace_plus_fx( return; } +#endif #ifndef HARMONIZE_2567_init_tcx static void init_tcx_fx( @@ -948,12 +950,22 @@ static void init_modes_fx( * * Initialization of state variables *-----------------------------------------------------------------------*/ +#ifdef HARMONIZE_2567_init_coder_ace_plus +void init_coder_ace_plus_fx( + Encoder_State *st, /* i : Encoder state */ + const Word32 last_total_brate, /* i : last total bitrate */ + const Word32 igf_brate, /* i : IGF configuration bitrate */ + const Word16 shift, + const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ +#else void init_coder_ace_plus_ivas_fx( Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate */ const Word32 igf_brate, /* i : IGF configuration bitrate */ const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ +#endif ) + { TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; Word16 L_frame_old; /*keep old frame size for switching */ @@ -1010,7 +1022,11 @@ void init_coder_ace_plus_ivas_fx( test(); test(); test(); +#ifdef HARMONIZE_2567_init_coder_ace_plus + IF( ( st->element_mode == EVS_MONO && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, ACELP_32k ) ) ) +#else IF( ( st->element_mode == EVS_MONO && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, ACELP_32k ) ) || ( st->element_mode > EVS_MONO && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, MAX_ACELP_BRATE ) ) ) +#endif { st->nb_subfr = NB_SUBFR16k; move16(); @@ -1032,8 +1048,20 @@ void init_coder_ace_plus_ivas_fx( { st->acelpFramesCount = 0; move16(); - st->prevTempFlatness_32fx = ONE_IN_Q21 /*1.0f Q21*/; - move32(); +#ifdef HARMONIZE_2567_init_coder_ace_plus + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + st->energyCoreLookahead_Fx = 0; + move16(); + } + ELSE + { +#endif + st->prevTempFlatness_32fx = ONE_IN_Q21 /*1.0f Q21*/; + move32(); +#ifdef HARMONIZE_2567_init_coder_ace_plus + } +#endif } /* Initialize TBE */ @@ -1051,6 +1079,14 @@ void init_coder_ace_plus_ivas_fx( move32(); st->currEnergyHF_e_fx = 0; move16(); + +#ifdef HARMONIZE_2567_init_coder_ace_plus + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + st->energyCoreLookahead_Fx = 0; + move16(); + } +#endif test(); /* Initialize LPC analysis/quantization */ IF( LE_32( st->sr_core, INT_FS_16k ) && st->tcxonly == 0 ) @@ -1084,19 +1120,43 @@ void init_coder_ace_plus_ivas_fx( test(); IF( st->igf && st->hIGFEnc != NULL ) { +#ifdef HARMONIZE_2567_init_coder_ace_plus + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + IGFEncSetMode_fx( st->hIGFEnc, st->total_brate, st->bwidth, st->element_mode, st->rf_mode ); + } + ELSE + { + IGFEncSetMode_fx( st->hIGFEnc, igf_brate, st->bwidth, st->element_mode, st->rf_mode ); + } +#else IGFEncSetMode_fx( st->hIGFEnc, igf_brate, st->bwidth, st->element_mode, st->rf_mode ); +#endif } ELSE IF( st->hIGFEnc != NULL ) { st->hIGFEnc->infoTotalBitsWritten = 0; move16(); - st->hIGFEnc->infoTotalBitsPerFrameWritten = 0; - move16(); +#ifdef HARMONIZE_2567_init_coder_ace_plus + if ( ( GT_16( st->element_mode, EVS_MONO ) ) || ( EQ_16( st->element_mode, EVS_MONO ) && EQ_16( MCT_flag, -10 ) ) ) + { +#endif + st->hIGFEnc->infoTotalBitsPerFrameWritten = 0; + move16(); +#ifdef HARMONIZE_2567_init_coder_ace_plus + } +#endif } - /* Initialize Core Signal Analysis Module */ - init_core_sig_ana_ivas_fx( st ); - +#ifdef HARMONIZE_2567_init_coder_ace_plus + IF( GT_16( st->element_mode, EVS_MONO ) ) + { +#endif + /* Initialize Core Signal Analysis Module */ + init_core_sig_ana_ivas_fx( st ); +#ifdef HARMONIZE_2567_init_coder_ace_plus + } +#endif /* Initialize TCX */ IF( hTcxEnc != NULL ) @@ -1104,34 +1164,72 @@ void init_coder_ace_plus_ivas_fx( #ifdef HARMONIZE_2567_init_tcx init_tcx_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); #else +#ifdef HARMONIZE_2567_init_coder_ace_plus + IF( GT_16( st->element_mode, EVS_MONO ) ) + { init_tcx_ivas_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); + } + ELSE + { + init_tcx_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); + } +#else + init_tcx_ivas_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); +#endif + #endif } +#ifdef HARMONIZE_2567_init_coder_ace_plus + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + /* Initialize Core Signal Analysis Module */ + init_core_sig_ana_fx( st ); + } +#endif + /* Initialize Signal Buffers */ - init_sig_buffers_ivas_fx( st, L_frame_old, L_subfr, last_total_brate ); +#ifdef HARMONIZE_2567_init_coder_ace_plus + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + init_sig_buffers_fx( st, L_frame_old, L_subfr ); + } + ELSE + { + init_sig_buffers_ivas_fx( st, L_frame_old, L_subfr, last_total_brate ); + } +#else +init_sig_buffers_ivas_fx( st, L_frame_old, L_subfr, last_total_brate ); +#endif /* Initialize ACELP */ -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_coder_ace_plus + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + init_acelp_fx( st, L_frame_old, shift, 0 ); + } + ELSE + { #ifdef NONBE_FIX_ISSUE_2518 - init_acelp_fx( st, L_frame_old, 0, last_total_brate ); + init_acelp_fx( st, L_frame_old, 0, last_total_brate ); #else - init_acelp_fx( st, L_frame_old, 0, last_total_brate ); + init_acelp_fx( st, L_frame_old, 0, last_total_brate ); #endif + } #else #ifdef NONBE_FIX_ISSUE_2518 - init_acelp_ivas_fx( st, L_frame_old, last_total_brate ); +init_acelp_fx( st, L_frame_old, 0, last_total_brate ); #else - init_acelp_ivas_fx( st, L_frame_old, 0, last_total_brate ); +init_acelp_fx( st, L_frame_old, 0, last_total_brate ); #endif #endif + if ( st->ini_frame == 0 ) { st->tec_tfa = 0; move16(); } - IF( st->hTECEnc != NULL ) { resetTecEnc_Fx( st->hTECEnc, st->tec_tfa ); @@ -1150,7 +1248,6 @@ void init_coder_ace_plus_ivas_fx( st->tec_tfa = 0; move16(); } - st->tec_flag = 0; move16(); st->tfa_flag = 0; @@ -1159,7 +1256,13 @@ void init_coder_ace_plus_ivas_fx( test(); test(); test(); - IF( ( EQ_32( st->total_brate, ACELP_9k60 ) || EQ_32( st->total_brate, ACELP_16k40 ) || EQ_32( st->total_brate, ACELP_24k40 ) ) && st->element_mode == EVS_MONO ) +#ifdef HARMONIZE_2567_init_coder_ace_plus + test(); + if ( EQ_16( st->element_mode, EVS_MONO ) && ( EQ_32( st->total_brate, ACELP_9k60 ) || EQ_32( st->total_brate, ACELP_16k40 ) || + EQ_32( st->total_brate, ACELP_24k40 ) || EQ_32( st->total_brate, ACELP_32k ) ) ) +#else +IF( ( EQ_32( st->total_brate, ACELP_9k60 ) || EQ_32( st->total_brate, ACELP_16k40 ) || EQ_32( st->total_brate, ACELP_24k40 ) ) && st->element_mode == EVS_MONO ) +#endif { st->glr = 1; move16(); @@ -1174,11 +1277,43 @@ void init_coder_ace_plus_ivas_fx( move16(); /* Initialize ACELP/TCX Modes */ - init_modes_ivas_fx( st, last_total_brate ); +#ifdef HARMONIZE_2567_init_coder_ace_plus + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + init_modes_fx( st, last_total_brate ); + } + ELSE + { + init_modes_ivas_fx( st, last_total_brate ); + } +#else +init_modes_ivas_fx( st, last_total_brate ); +#endif /* Adaptive BPF */ - set32_fx( st->mem_bpf_fx1, 0, 2 * L_FILT16k ); - set32_fx( st->mem_error_bpf_fx, 0, 2 * L_FILT16k ); +#ifdef HARMONIZE_2567_init_coder_ace_plus + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + set16_fx( st->mem_bpf_fx.noise_buf, 0, 2 * L_FILT16k ); + set16_fx( st->mem_bpf_fx.error_buf, 0, L_FILT16k ); + set16_fx( st->bpf_gainT, 0, NB_SUBFR16k ); + + set16_fx( st->bpf_T, PIT_MIN_12k8, NB_SUBFR16k ); + + st->mem_bpf_fx.lp_error = 0; + move16(); + st->mem_bpf_fx.noise_shift_old = 0; + move16(); + } + ELSE + { + set32_fx( st->mem_bpf_fx1, 0, 2 * L_FILT16k ); + set32_fx( st->mem_error_bpf_fx, 0, 2 * L_FILT16k ); + } +#else +set32_fx( st->mem_bpf_fx1, 0, 2 * L_FILT16k ); +set32_fx( st->mem_error_bpf_fx, 0, 2 * L_FILT16k ); +#endif IF( st->ini_frame == 0 ) { diff --git a/lib_enc/core_enc_switch_fx.c b/lib_enc/core_enc_switch_fx.c index 3bea33c12..19e73c55c 100644 --- a/lib_enc/core_enc_switch_fx.c +++ b/lib_enc/core_enc_switch_fx.c @@ -157,7 +157,11 @@ void core_coder_mode_switch_fx( { st->igf = getIgfPresent_fx( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); move16(); +#ifdef HARMONIZE_2567_init_coder_ace_plus + init_coder_ace_plus_fx( st, last_total_bitrate, 0, shift, MCT_flag ); +#else init_coder_ace_plus_fx( st, last_total_bitrate, shift, MCT_flag ); +#endif } test(); @@ -396,7 +400,13 @@ void core_coder_mode_switch_ivas_fx( st->exp_old_inp_12k8 = sub( st->exp_old_inp_12k8, shift ); move16(); #endif + +#ifdef HARMONIZE_2567_init_coder_ace_plus + init_coder_ace_plus_fx( st, last_total_brate, st->total_brate, 0, MCT_flag ); +#else init_coder_ace_plus_ivas_fx( st, last_total_brate, st->total_brate, MCT_flag ); +#endif + #ifndef NONBE_FIX_ISSUE_2518 if ( st->hLPDmem != NULL ) { diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 52fb9b625..158775005 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1134,7 +1134,11 @@ ivas_error init_encoder_fx( IF( st->element_mode == EVS_MONO ) { +#ifdef HARMONIZE_2567_init_coder_ace_plus + init_coder_ace_plus_fx( st, st->last_total_brate, 0, 0, -10 /*hack*/ ); +#else init_coder_ace_plus_fx( st, st->last_total_brate, 0, -10 /*hack*/ ); +#endif } ELSE { @@ -1148,7 +1152,12 @@ ivas_error init_encoder_fx( st->exp_old_inp_12k8 = sub( st->exp_old_inp_12k8, shift ); move16(); + +#ifdef HARMONIZE_2567_init_coder_ace_plus + init_coder_ace_plus_fx( st, st->last_total_brate, igf_brate, 0, 0 ); +#else init_coder_ace_plus_ivas_fx( st, st->last_total_brate, igf_brate, 0 ); +#endif } #ifndef NONBE_FIX_ISSUE_2518 diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 046f15211..c446e457a 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -2342,12 +2342,14 @@ void tcx_ltp_encode_ivas_fx( const Word16 disable_ltp, const Word16 element_mode ); +#ifndef HARMONIZE_2567_init_coder_ace_plus void init_coder_ace_plus_fx( Encoder_State *st, const Word32 last_total_brate, /* i : last total bitrate */ const Word16 shift, const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); +#endif void enc_prm_rf_fx( Encoder_State *st, -- GitLab From 83cc66bae2b5989bccae98e547409b6737ea5046 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 May 2026 14:19:53 +0200 Subject: [PATCH 10/23] clang format patch --- lib_enc/core_enc_init_fx.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 97de78c8d..0e35421d8 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -1165,16 +1165,16 @@ void init_coder_ace_plus_ivas_fx( init_tcx_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); #else #ifdef HARMONIZE_2567_init_coder_ace_plus - IF( GT_16( st->element_mode, EVS_MONO ) ) - { - init_tcx_ivas_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); - } - ELSE - { - init_tcx_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); - } + IF( GT_16( st->element_mode, EVS_MONO ) ) + { + init_tcx_ivas_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); + } + ELSE + { + init_tcx_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); + } #else - init_tcx_ivas_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); + init_tcx_ivas_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); #endif #endif @@ -1199,7 +1199,7 @@ void init_coder_ace_plus_ivas_fx( init_sig_buffers_ivas_fx( st, L_frame_old, L_subfr, last_total_brate ); } #else -init_sig_buffers_ivas_fx( st, L_frame_old, L_subfr, last_total_brate ); + init_sig_buffers_ivas_fx( st, L_frame_old, L_subfr, last_total_brate ); #endif /* Initialize ACELP */ @@ -1218,9 +1218,9 @@ init_sig_buffers_ivas_fx( st, L_frame_old, L_subfr, last_total_brate ); } #else #ifdef NONBE_FIX_ISSUE_2518 -init_acelp_fx( st, L_frame_old, 0, last_total_brate ); + init_acelp_fx( st, L_frame_old, 0, last_total_brate ); #else -init_acelp_fx( st, L_frame_old, 0, last_total_brate ); + init_acelp_fx( st, L_frame_old, 0, last_total_brate ); #endif #endif @@ -1261,7 +1261,7 @@ init_acelp_fx( st, L_frame_old, 0, last_total_brate ); if ( EQ_16( st->element_mode, EVS_MONO ) && ( EQ_32( st->total_brate, ACELP_9k60 ) || EQ_32( st->total_brate, ACELP_16k40 ) || EQ_32( st->total_brate, ACELP_24k40 ) || EQ_32( st->total_brate, ACELP_32k ) ) ) #else -IF( ( EQ_32( st->total_brate, ACELP_9k60 ) || EQ_32( st->total_brate, ACELP_16k40 ) || EQ_32( st->total_brate, ACELP_24k40 ) ) && st->element_mode == EVS_MONO ) + IF( ( EQ_32( st->total_brate, ACELP_9k60 ) || EQ_32( st->total_brate, ACELP_16k40 ) || EQ_32( st->total_brate, ACELP_24k40 ) ) && st->element_mode == EVS_MONO ) #endif { st->glr = 1; @@ -1287,7 +1287,7 @@ IF( ( EQ_32( st->total_brate, ACELP_9k60 ) || EQ_32( st->total_brate, ACELP_16k4 init_modes_ivas_fx( st, last_total_brate ); } #else -init_modes_ivas_fx( st, last_total_brate ); + init_modes_ivas_fx( st, last_total_brate ); #endif /* Adaptive BPF */ @@ -1311,8 +1311,8 @@ init_modes_ivas_fx( st, last_total_brate ); set32_fx( st->mem_error_bpf_fx, 0, 2 * L_FILT16k ); } #else -set32_fx( st->mem_bpf_fx1, 0, 2 * L_FILT16k ); -set32_fx( st->mem_error_bpf_fx, 0, 2 * L_FILT16k ); + set32_fx( st->mem_bpf_fx1, 0, 2 * L_FILT16k ); + set32_fx( st->mem_error_bpf_fx, 0, 2 * L_FILT16k ); #endif IF( st->ini_frame == 0 ) -- GitLab From 7b894f1b1fbefefd91a8b249d5b5022676137c1a Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 May 2026 15:06:49 +0200 Subject: [PATCH 11/23] add macro HARMONIZE_2567_init_core_sig_ana --- lib_com/options.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_com/options.h b/lib_com/options.h index 0b41fc8ce..6d2eee4a1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -111,6 +111,7 @@ #define HARMONIZE_2567_init_tcx_cfg /* FhG: harmonize init_tcx_cfg derivates for evs/ivas */ #define HARMONIZE_2567_init_tcx /* FhG: harmonize init_tcx derivates for evs/ivas */ #define HARMONIZE_2567_init_coder_ace_plus /* FhG: harmonize init_coder_ace_plus derivates for evs/ivas */ +#define HARMONIZE_2567_init_core_sig_ana /* FhG: harmonize init_core_sig_ana derivates for evs/ivas */ /* #################### End BE switches ################################## */ /* #################### Start NON-BE switches ############################ */ -- GitLab From 6b12afe3258b3d6595ea0f0b9d01491588ca5495 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 May 2026 15:32:03 +0200 Subject: [PATCH 12/23] deactivate HARMONIZE_2567_init_coder_ace_plus and insert assert to catch false element_modes --- lib_com/options.h | 2 +- lib_enc/core_enc_switch_fx.c | 2 ++ lib_enc/init_enc_fx.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6d2eee4a1..29ab3d472 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -110,7 +110,7 @@ #define HARMONIZE_2567_init_acelp /* FhG: harmonize init_acelp derivates for evs/ivas */ #define HARMONIZE_2567_init_tcx_cfg /* FhG: harmonize init_tcx_cfg derivates for evs/ivas */ #define HARMONIZE_2567_init_tcx /* FhG: harmonize init_tcx derivates for evs/ivas */ -#define HARMONIZE_2567_init_coder_ace_plus /* FhG: harmonize init_coder_ace_plus derivates for evs/ivas */ +//#define HARMONIZE_2567_init_coder_ace_plus /* FhG: harmonize init_coder_ace_plus derivates for evs/ivas */ #define HARMONIZE_2567_init_core_sig_ana /* FhG: harmonize init_core_sig_ana derivates for evs/ivas */ /* #################### End BE switches ################################## */ diff --git a/lib_enc/core_enc_switch_fx.c b/lib_enc/core_enc_switch_fx.c index 19e73c55c..0f8bff45e 100644 --- a/lib_enc/core_enc_switch_fx.c +++ b/lib_enc/core_enc_switch_fx.c @@ -158,6 +158,7 @@ void core_coder_mode_switch_fx( st->igf = getIgfPresent_fx( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); move16(); #ifdef HARMONIZE_2567_init_coder_ace_plus + assert( st->element_mode == EVS_MONO ); init_coder_ace_plus_fx( st, last_total_bitrate, 0, shift, MCT_flag ); #else init_coder_ace_plus_fx( st, last_total_bitrate, shift, MCT_flag ); @@ -402,6 +403,7 @@ void core_coder_mode_switch_ivas_fx( #endif #ifdef HARMONIZE_2567_init_coder_ace_plus + assert( st->element_mode != EVS_MONO ); init_coder_ace_plus_fx( st, last_total_brate, st->total_brate, 0, MCT_flag ); #else init_coder_ace_plus_ivas_fx( st, last_total_brate, st->total_brate, MCT_flag ); diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 158775005..d1b3a7645 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1135,6 +1135,7 @@ ivas_error init_encoder_fx( IF( st->element_mode == EVS_MONO ) { #ifdef HARMONIZE_2567_init_coder_ace_plus + assert( st->element_mode == EVS_MONO ); init_coder_ace_plus_fx( st, st->last_total_brate, 0, 0, -10 /*hack*/ ); #else init_coder_ace_plus_fx( st, st->last_total_brate, 0, -10 /*hack*/ ); @@ -1154,6 +1155,7 @@ ivas_error init_encoder_fx( #ifdef HARMONIZE_2567_init_coder_ace_plus + assert( st->element_mode != EVS_MONO ); init_coder_ace_plus_fx( st, st->last_total_brate, igf_brate, 0, 0 ); #else init_coder_ace_plus_ivas_fx( st, st->last_total_brate, igf_brate, 0 ); -- GitLab From cd9aa3c42795bbc091c997b0f9aa5fa588da93cc Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 May 2026 16:14:15 +0200 Subject: [PATCH 13/23] re-activate HARMONIZE_2567_init_coder_ace_plus and checkin a fix --- lib_com/options.h | 2 +- lib_enc/core_enc_init_fx.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 29ab3d472..6d2eee4a1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -110,7 +110,7 @@ #define HARMONIZE_2567_init_acelp /* FhG: harmonize init_acelp derivates for evs/ivas */ #define HARMONIZE_2567_init_tcx_cfg /* FhG: harmonize init_tcx_cfg derivates for evs/ivas */ #define HARMONIZE_2567_init_tcx /* FhG: harmonize init_tcx derivates for evs/ivas */ -//#define HARMONIZE_2567_init_coder_ace_plus /* FhG: harmonize init_coder_ace_plus derivates for evs/ivas */ +#define HARMONIZE_2567_init_coder_ace_plus /* FhG: harmonize init_coder_ace_plus derivates for evs/ivas */ #define HARMONIZE_2567_init_core_sig_ana /* FhG: harmonize init_core_sig_ana derivates for evs/ivas */ /* #################### End BE switches ################################## */ diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 0e35421d8..2cd39e8f7 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -1005,8 +1005,11 @@ void init_coder_ace_plus_ivas_fx( { hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) ); move16(); - +#ifdef HARMONIZE_2567_init_coder_ace_plus + IF( st->ini_frame == 0 && GT_16( st->element_mode, EVS_MONO ) ) +#else IF( st->ini_frame == 0 ) +#endif { set16_fx( hTcxEnc->Txnq, 0, L_FRAME32k / 2 + 64 ); hTcxEnc->acelp_zir = hTcxEnc->Txnq + L_FRAME / 2; @@ -1025,7 +1028,7 @@ void init_coder_ace_plus_ivas_fx( #ifdef HARMONIZE_2567_init_coder_ace_plus IF( ( st->element_mode == EVS_MONO && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, ACELP_32k ) ) ) #else - IF( ( st->element_mode == EVS_MONO && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, ACELP_32k ) ) || ( st->element_mode > EVS_MONO && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, MAX_ACELP_BRATE ) ) ) + IF( ( EQ_16( st->element_mode, EVS_MONO ) && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, ACELP_32k ) ) || ( GT_16( st->element_mode, EVS_MONO ) && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, MAX_ACELP_BRATE ) ) ) #endif { st->nb_subfr = NB_SUBFR16k; @@ -1051,7 +1054,7 @@ void init_coder_ace_plus_ivas_fx( #ifdef HARMONIZE_2567_init_coder_ace_plus IF( EQ_16( st->element_mode, EVS_MONO ) ) { - st->energyCoreLookahead_Fx = 0; + st->prevTempFlatness_fx = 128 /*1.0f Q7*/; move16(); } ELSE -- GitLab From 430a265eba5a5caebbf0559b89774f44f2fe0917 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Tue, 5 May 2026 16:37:11 +0200 Subject: [PATCH 14/23] more fix --- lib_enc/core_enc_init_fx.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 2cd39e8f7..1bd052c4c 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -1151,23 +1151,17 @@ void init_coder_ace_plus_ivas_fx( #endif } -#ifdef HARMONIZE_2567_init_coder_ace_plus - IF( GT_16( st->element_mode, EVS_MONO ) ) - { -#endif - /* Initialize Core Signal Analysis Module */ - init_core_sig_ana_ivas_fx( st ); -#ifdef HARMONIZE_2567_init_coder_ace_plus - } +#ifndef HARMONIZE_2567_init_coder_ace_plus + /* Initialize Core Signal Analysis Module */ + init_core_sig_ana_ivas_fx( st ); #endif /* Initialize TCX */ IF( hTcxEnc != NULL ) { -#ifdef HARMONIZE_2567_init_tcx +#ifdef HARMONIZE_2567_init_coder_ace_plus init_tcx_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); #else -#ifdef HARMONIZE_2567_init_coder_ace_plus IF( GT_16( st->element_mode, EVS_MONO ) ) { init_tcx_ivas_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); @@ -1176,19 +1170,18 @@ void init_coder_ace_plus_ivas_fx( { init_tcx_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); } -#else - init_tcx_ivas_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); -#endif - #endif } - #ifdef HARMONIZE_2567_init_coder_ace_plus IF( EQ_16( st->element_mode, EVS_MONO ) ) { /* Initialize Core Signal Analysis Module */ init_core_sig_ana_fx( st ); } + ELSE + { + init_core_sig_ana_ivas_fx( st ); + } #endif /* Initialize Signal Buffers */ @@ -1205,6 +1198,7 @@ void init_coder_ace_plus_ivas_fx( init_sig_buffers_ivas_fx( st, L_frame_old, L_subfr, last_total_brate ); #endif + /* Initialize ACELP */ #ifdef HARMONIZE_2567_init_coder_ace_plus IF( EQ_16( st->element_mode, EVS_MONO ) ) -- GitLab From 0400fc0f901a2e6286272c7fd1cc86818626b6fc Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 May 2026 07:54:03 +0200 Subject: [PATCH 15/23] fix condition, cleanup for easier review --- lib_enc/core_enc_init_fx.c | 46 ++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 1bd052c4c..1ea2409f0 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -965,7 +965,6 @@ void init_coder_ace_plus_ivas_fx( const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ #endif ) - { TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; Word16 L_frame_old; /*keep old frame size for switching */ @@ -1006,7 +1005,7 @@ void init_coder_ace_plus_ivas_fx( hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) ); move16(); #ifdef HARMONIZE_2567_init_coder_ace_plus - IF( st->ini_frame == 0 && GT_16( st->element_mode, EVS_MONO ) ) + IF( ( st->ini_frame == 0 ) && GT_16( st->element_mode, EVS_MONO ) ) #else IF( st->ini_frame == 0 ) #endif @@ -1026,7 +1025,7 @@ void init_coder_ace_plus_ivas_fx( test(); test(); #ifdef HARMONIZE_2567_init_coder_ace_plus - IF( ( st->element_mode == EVS_MONO && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, ACELP_32k ) ) ) + IF( ( ( st->element_mode == EVS_MONO ) && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, ACELP_32k ) ) || ( GT_16( st->element_mode, EVS_MONO ) && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, MAX_ACELP_BRATE ) ) ) #else IF( ( EQ_16( st->element_mode, EVS_MONO ) && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, ACELP_32k ) ) || ( GT_16( st->element_mode, EVS_MONO ) && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, MAX_ACELP_BRATE ) ) ) #endif @@ -1192,46 +1191,54 @@ void init_coder_ace_plus_ivas_fx( } ELSE { +#endif init_sig_buffers_ivas_fx( st, L_frame_old, L_subfr, last_total_brate ); +#ifdef HARMONIZE_2567_init_coder_ace_plus } -#else - init_sig_buffers_ivas_fx( st, L_frame_old, L_subfr, last_total_brate ); -#endif + 'ENDIF /* Initialize ACELP */ #ifdef HARMONIZE_2567_init_coder_ace_plus - IF( EQ_16( st->element_mode, EVS_MONO ) ) + IF( EQ_16( st->element_mode, EVS_MONO ) ) { init_acelp_fx( st, L_frame_old, shift, 0 ); } ELSE { +#endif #ifdef NONBE_FIX_ISSUE_2518 init_acelp_fx( st, L_frame_old, 0, last_total_brate ); #else init_acelp_fx( st, L_frame_old, 0, last_total_brate ); #endif +#ifdef HARMONIZE_2567_init_coder_ace_plus } -#else -#ifdef NONBE_FIX_ISSUE_2518 - init_acelp_fx( st, L_frame_old, 0, last_total_brate ); -#else - init_acelp_fx( st, L_frame_old, 0, last_total_brate ); -#endif #endif - if ( st->ini_frame == 0 ) { st->tec_tfa = 0; move16(); } + IF( st->hTECEnc != NULL ) { resetTecEnc_Fx( st->hTECEnc, st->tec_tfa ); } +#ifdef HARMONIZE_2567_init_coder_ace_plus + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + if ( st->hTECEnc == NULL ) + { + resetTecEnc_Fx( st->hTECEnc, 0 ); + } + st->tec_tfa = 0; + move16(); + } +#endif + test(); test(); test(); @@ -1245,6 +1252,7 @@ void init_coder_ace_plus_ivas_fx( st->tec_tfa = 0; move16(); } + st->tec_flag = 0; move16(); st->tfa_flag = 0; @@ -1281,12 +1289,13 @@ void init_coder_ace_plus_ivas_fx( } ELSE { +#endif init_modes_ivas_fx( st, last_total_brate ); +#ifdef HARMONIZE_2567_init_coder_ace_plus } -#else - init_modes_ivas_fx( st, last_total_brate ); #endif + /* Adaptive BPF */ #ifdef HARMONIZE_2567_init_coder_ace_plus IF( EQ_16( st->element_mode, EVS_MONO ) ) @@ -1304,12 +1313,11 @@ void init_coder_ace_plus_ivas_fx( } ELSE { +#endif set32_fx( st->mem_bpf_fx1, 0, 2 * L_FILT16k ); set32_fx( st->mem_error_bpf_fx, 0, 2 * L_FILT16k ); +#ifdef HARMONIZE_2567_init_coder_ace_plus } -#else - set32_fx( st->mem_bpf_fx1, 0, 2 * L_FILT16k ); - set32_fx( st->mem_error_bpf_fx, 0, 2 * L_FILT16k ); #endif IF( st->ini_frame == 0 ) -- GitLab From 26f67c053b8f0117c3e4bc42297d1b5f7b9b32ca Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 May 2026 08:11:25 +0200 Subject: [PATCH 16/23] fix build-warnings/errors --- lib_enc/core_enc_init_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 1ea2409f0..71b748c37 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -1195,7 +1195,7 @@ void init_coder_ace_plus_ivas_fx( init_sig_buffers_ivas_fx( st, L_frame_old, L_subfr, last_total_brate ); #ifdef HARMONIZE_2567_init_coder_ace_plus } - 'ENDIF +#endif /* Initialize ACELP */ -- GitLab From e5a4c56dd75a868db18017d2fe870ef95571d001 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 May 2026 08:25:05 +0200 Subject: [PATCH 17/23] clang format patch --- lib_enc/core_enc_init_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 71b748c37..ebb465e34 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -1200,7 +1200,7 @@ void init_coder_ace_plus_ivas_fx( /* Initialize ACELP */ #ifdef HARMONIZE_2567_init_coder_ace_plus - IF( EQ_16( st->element_mode, EVS_MONO ) ) + IF( EQ_16( st->element_mode, EVS_MONO ) ) { init_acelp_fx( st, L_frame_old, shift, 0 ); } @@ -1210,7 +1210,7 @@ void init_coder_ace_plus_ivas_fx( #ifdef NONBE_FIX_ISSUE_2518 init_acelp_fx( st, L_frame_old, 0, last_total_brate ); #else - init_acelp_fx( st, L_frame_old, 0, last_total_brate ); + init_acelp_fx( st, L_frame_old, 0, last_total_brate ); #endif #ifdef HARMONIZE_2567_init_coder_ace_plus } -- GitLab From cca0308ed56e85a2b9df2b98e295917a79cdddf6 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 May 2026 09:10:10 +0200 Subject: [PATCH 18/23] move init_core_sig_ana_ivas_fx within harmonized init_coder_ace_plus_fx --- lib_enc/core_enc_init_fx.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index ebb465e34..c299aed56 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -1150,9 +1150,20 @@ void init_coder_ace_plus_ivas_fx( #endif } -#ifndef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_coder_ace_plus + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + /* Initialize Core Signal Analysis Module */ + init_core_sig_ana_fx( st ); + } + ELSE + { + init_core_sig_ana_ivas_fx( st ); + } +#else /* Initialize Core Signal Analysis Module */ init_core_sig_ana_ivas_fx( st ); + #endif /* Initialize TCX */ @@ -1171,17 +1182,6 @@ void init_coder_ace_plus_ivas_fx( } #endif } -#ifdef HARMONIZE_2567_init_coder_ace_plus - IF( EQ_16( st->element_mode, EVS_MONO ) ) - { - /* Initialize Core Signal Analysis Module */ - init_core_sig_ana_fx( st ); - } - ELSE - { - init_core_sig_ana_ivas_fx( st ); - } -#endif /* Initialize Signal Buffers */ #ifdef HARMONIZE_2567_init_coder_ace_plus -- GitLab From dea8263e19bdc36c21acd24172644b8c2a41069a Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 May 2026 09:57:48 +0200 Subject: [PATCH 19/23] addd macros and code for HARMONIZE_2567_init_modes and HARMONIZE_2567_init_core_sig_ana --- lib_com/options.h | 2 + lib_enc/core_enc_init_fx.c | 89 +++++++++++++++++++++++++++++++++++++- 2 files changed, 90 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6d2eee4a1..4bfeb91f1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -112,6 +112,8 @@ #define HARMONIZE_2567_init_tcx /* FhG: harmonize init_tcx derivates for evs/ivas */ #define HARMONIZE_2567_init_coder_ace_plus /* FhG: harmonize init_coder_ace_plus derivates for evs/ivas */ #define HARMONIZE_2567_init_core_sig_ana /* FhG: harmonize init_core_sig_ana derivates for evs/ivas */ +#define HARMONIZE_2567_init_modes /* FhG: harmonize init_modes derivates for evs/ivas */ + /* #################### End BE switches ################################## */ /* #################### Start NON-BE switches ############################ */ diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index c299aed56..a49fb69f2 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -28,15 +28,23 @@ static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 s #else static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift ); #endif +#ifndef HARMONIZE_2567_init_modes static void init_modes_fx( Encoder_State *st, const Word32 Last_total_brate ); +#endif static void init_sig_buffers_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr ); #ifdef HARMONIZE_2567_init_tcx static void init_tcx_fx( Encoder_State *st, const Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag ); #else static void init_tcx_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag ); #endif +#ifndef HARMONIZE_2567_init_core_sig_ana static void init_core_sig_ana_ivas_fx( Encoder_State *st ); +#endif +#ifdef HARMONIZE_2567_init_modes +static void init_modes_fx( Encoder_State *st, const Word32 last_total_brate ); +#else static void init_modes_ivas_fx( Encoder_State *st, const Word32 last_total_brate ); +#endif static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr, const Word32 last_total_brate ); #ifndef HARMONIZE_2567_init_acelp #ifdef NONBE_FIX_ISSUE_2518 @@ -558,6 +566,7 @@ void init_sig_buffers_fx( Encoder_State *st, const Word16 L_frame_old, const Wor return; } +#ifndef HARMONIZE_2567_init_core_sig_ana static void init_core_sig_ana_fx( Encoder_State *st ) { @@ -608,6 +617,7 @@ static void init_core_sig_ana_fx( Encoder_State *st ) return; } +#endif #ifndef HARMONIZE_2567_init_acelp static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift ) @@ -856,6 +866,7 @@ static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 s } #endif +#ifndef HARMONIZE_2567_init_modes static void init_modes_fx( Encoder_State *st, const Word32 last_total_brate ) @@ -944,6 +955,7 @@ static void init_modes_fx( return; } +#endif /*-----------------------------------------------------------------------* * init_coder_ace_plus() @@ -1150,6 +1162,10 @@ void init_coder_ace_plus_ivas_fx( #endif } +#ifdef HARMONIZE_2567_init_core_sig_ana + /* Initialize Core Signal Analysis Module */ + init_core_sig_ana_fx( st ); +#else #ifdef HARMONIZE_2567_init_coder_ace_plus IF( EQ_16( st->element_mode, EVS_MONO ) ) { @@ -1165,6 +1181,7 @@ void init_coder_ace_plus_ivas_fx( init_core_sig_ana_ivas_fx( st ); #endif +#endif /*HARMONIZE_2567_init_core_sig_ana*/ /* Initialize TCX */ IF( hTcxEnc != NULL ) @@ -1282,6 +1299,9 @@ void init_coder_ace_plus_ivas_fx( move16(); /* Initialize ACELP/TCX Modes */ +#ifdef HARMONIZE_2567_init_modes + init_modes_fx( st, last_total_brate ); +#else #ifdef HARMONIZE_2567_init_coder_ace_plus IF( EQ_16( st->element_mode, EVS_MONO ) ) { @@ -1294,6 +1314,7 @@ void init_coder_ace_plus_ivas_fx( #ifdef HARMONIZE_2567_init_coder_ace_plus } #endif +#endif /*HARMONIZE_2567_init_modes*/ /* Adaptive BPF */ @@ -1783,7 +1804,11 @@ static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_ol * * *-----------------------------------------------------------------------*/ +#ifdef HARMONIZE_2567_init_core_sig_ana +static void init_core_sig_ana_fx( Encoder_State *st ) +#else static void init_core_sig_ana_ivas_fx( Encoder_State *st ) +#endif { /* Pre-emphasis factor and memory */ @@ -1800,6 +1825,13 @@ static void init_core_sig_ana_ivas_fx( Encoder_State *st ) st->preemph_fac = PREEMPH_FAC_16k; /*WB*/ move16(); } +#ifdef HARMONIZE_2567_init_core_sig_ana + if ( EQ_16( st->element_mode, EVS_MONO ) ) + { + st->hTcxCfg->preemph_fac = st->preemph_fac; + move16(); + } +#endif st->gamma = GAMMA1; move16(); @@ -1830,6 +1862,7 @@ static void init_core_sig_ana_ivas_fx( Encoder_State *st ) return; } + /*-----------------------------------------------------------------------* * init_acelp() * @@ -2234,7 +2267,11 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh * *-----------------------------------------------------------------------*/ +#ifdef HARMONIZE_2567_init_modes +static void init_modes_fx( +#else static void init_modes_ivas_fx( +#endif Encoder_State *st, const Word32 last_total_brate ) { @@ -2282,6 +2319,13 @@ static void init_modes_ivas_fx( /* st->bits_frame_nominal = extract_h(L_add(L_mult(div_l(L_mult(shl(st->L_frame,2),st->bitrate),st->fscale),328),16056)); */ /* st->bits_frame_nominal = (int)( (float)st->L_frame/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate/100.0f + 0.49f ); */ +#ifdef HARMONIZE_2567_init_modes + if ( EQ_16( st->element_mode, EVS_MONO ) ) + { + assert( FSCALE_DENOM == 512 ); + assert( st->fscale == 2 * st->L_frame ); /* this assumption is true if operated in 20ms frames with FSCALE_DENOM == 512, which is the current default */ + } +#endif tmp32 = L_shl( st->total_brate, 1 ); /* (float)st->L_frame/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate */ st->bits_frame_nominal = extract_l( L_shr( Mpy_32_16_1( tmp32, 20972 ), 6 ) ); /* 20972 = 0.01 * 64 * 32768 */ move16(); @@ -2299,6 +2343,30 @@ static void init_modes_ivas_fx( { FOR( n = 0; n < FRAME_SIZE_NB; n++ ) { +#ifdef HARMONIZE_2567_init_modes + test(); + test(); + IF( EQ_16( st->element_mode, EVS_MONO ) && EQ_16( FrameSizeConfig[n].frame_bits, st->bits_frame_nominal ) ) + { + st->frame_size_index = n; + move16(); + st->bits_frame = FrameSizeConfig[n].frame_bits; + move16(); + st->bits_frame_core = FrameSizeConfig[n].frame_net_bits; + move16(); + BREAK; + } + ELSE IF( GT_16( st->element_mode, EVS_MONO ) && ( ( LE_16( FrameSizeConfig[n].frame_bits, st->bits_frame_nominal ) ) ) ) + { + st->frame_size_index = n; + move16(); + st->bits_frame = st->bits_frame_nominal; + move16(); + st->bits_frame_core = sub( sub( sub( st->bits_frame_nominal, FrameSizeConfig[n].transmission_bits ), FrameSizeConfig[n].bandwidth_bits ), FrameSizeConfig[n].reserved_bits ); + move16(); + BREAK; + } +#else IF( LT_32( n, FRAME_SIZE_NB - 1 ) ) { test(); @@ -2326,11 +2394,30 @@ static void init_modes_ivas_fx( BREAK; } } +#endif } +#ifdef HARMONIZE_2567_init_modes + test(); + if ( EQ_16( (Word16) n, FRAME_SIZE_NB ) && ( EQ_16( st->element_mode, EVS_MONO ) ) ) + { + assert( !"Bitrate not supported: not part of EVS" ); + } +#endif } /* Reconfigure core */ - core_coder_reconfig_ivas_fx( st, last_total_brate ); +#ifdef HARMONIZE_2567_init_modes + if ( EQ_16( st->element_mode, EVS_MONO ) ) + { + core_coder_reconfig_fx( st, last_total_brate ); + } + ELSE + { +#endif + core_coder_reconfig_ivas_fx( st, last_total_brate ); +#ifdef HARMONIZE_2567_init_modes + } +#endif return; -- GitLab From 0ed47e21b97a6372b30341890c843371b59cc833 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 May 2026 10:20:32 +0200 Subject: [PATCH 20/23] deactivate HARMONIZE_2567_init_modes --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 4bfeb91f1..91b56fea6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -112,7 +112,7 @@ #define HARMONIZE_2567_init_tcx /* FhG: harmonize init_tcx derivates for evs/ivas */ #define HARMONIZE_2567_init_coder_ace_plus /* FhG: harmonize init_coder_ace_plus derivates for evs/ivas */ #define HARMONIZE_2567_init_core_sig_ana /* FhG: harmonize init_core_sig_ana derivates for evs/ivas */ -#define HARMONIZE_2567_init_modes /* FhG: harmonize init_modes derivates for evs/ivas */ +//#define HARMONIZE_2567_init_modes /* FhG: harmonize init_modes derivates for evs/ivas */ /* #################### End BE switches ################################## */ -- GitLab From e4b18b4b6be3db18b982613be05ea891f85b9c12 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 6 May 2026 11:01:32 +0200 Subject: [PATCH 21/23] activate HARMONIZE_2567_init_modes and fix conditions --- lib_enc/core_enc_init_fx.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index a49fb69f2..09bd27d9f 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -2344,6 +2344,12 @@ static void init_modes_ivas_fx( FOR( n = 0; n < FRAME_SIZE_NB; n++ ) { #ifdef HARMONIZE_2567_init_modes + Word16 bits_frame_tmp, bits_frame_core_tmp; + test(); + test(); + test(); + test(); + test(); test(); test(); IF( EQ_16( st->element_mode, EVS_MONO ) && EQ_16( FrameSizeConfig[n].frame_bits, st->bits_frame_nominal ) ) @@ -2356,7 +2362,13 @@ static void init_modes_ivas_fx( move16(); BREAK; } - ELSE IF( GT_16( st->element_mode, EVS_MONO ) && ( ( LE_16( FrameSizeConfig[n].frame_bits, st->bits_frame_nominal ) ) ) ) + ELSE IF( GT_16( st->element_mode, EVS_MONO ) && ( ( + ( LT_32( n, FRAME_SIZE_NB - 1 ) ) && + ( LE_32( FrameSizeConfig[n].frame_bits, st->bits_frame_nominal ) && GT_32( FrameSizeConfig[n + 1].frame_bits, st->bits_frame_nominal ) ) ) || + ( !( LT_32( n, FRAME_SIZE_NB - 1 ) ) && + ( LE_32( FrameSizeConfig[n].frame_bits, st->bits_frame_nominal ) ) ) + + ) ) { st->frame_size_index = n; move16(); -- GitLab From 8d7d2d73991688be059dec1646ab83647a3e1ee0 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 May 2026 15:00:50 +0200 Subject: [PATCH 22/23] harmonize different macros --- lib_com/core_com_config_fx.c | 8 +- lib_com/options.h | 7 +- lib_com/prot_fx.h | 8 +- lib_enc/core_enc_init_fx.c | 171 +++++++++++++++-------------------- lib_enc/core_enc_switch_fx.c | 4 +- lib_enc/init_enc_fx.c | 4 +- lib_enc/prot_fx_enc.h | 2 +- 7 files changed, 85 insertions(+), 119 deletions(-) diff --git a/lib_com/core_com_config_fx.c b/lib_com/core_com_config_fx.c index 068048fb1..969dbfea6 100644 --- a/lib_com/core_com_config_fx.c +++ b/lib_com/core_com_config_fx.c @@ -825,7 +825,7 @@ Word16 getTcxLpcShapedAri( * Initialization of TCX *-----------------------------------------------------------------------*/ -#ifdef HARMONIZE_2567_init_tcx_cfg +#ifdef HARMONIZE_2567_init_functions void init_tcx_cfg_fx( #else void init_tcx_cfg_ivas_fx( @@ -845,7 +845,7 @@ void init_tcx_cfg_ivas_fx( const Word16 infoIGFStopFreq, /*Q0*/ const Word16 element_mode, /*Q0*/ const Word16 ini_frame, /*Q0*/ -#ifdef HARMONIZE_2567_init_tcx_cfg +#ifdef HARMONIZE_2567_init_functions const Word16 MCT_flag, /*Q0*/ const Word16 fscaleFB /*Q0*/ ) #else @@ -868,7 +868,7 @@ void init_tcx_cfg_ivas_fx( hTcxCfg->tcx_mdct_window_length_old = hTcxCfg->tcx_mdct_window_length; /*Q0*/ move16(); mdctWindowLength = getMdctWindowLength_fx( fscale ); /*Q0*/ -#ifdef HARMONIZE_2567_init_tcx_cfg +#ifdef HARMONIZE_2567_init_functions IF( EQ_16( element_mode, EVS_MONO ) ) { mdctWindowLengthFB = getMdctWindowLength_fx( fscaleFB ); /*Q0*/ @@ -1100,7 +1100,7 @@ void init_tcx_window_cfg_fx( return; } -#ifndef HARMONIZE_2567_init_tcx_cfg +#ifndef HARMONIZE_2567_init_functions void init_tcx_cfg_fx( TCX_CONFIG_HANDLE hTcxCfg, const Word32 total_brate, /*Q0*/ diff --git a/lib_com/options.h b/lib_com/options.h index 91b56fea6..d30bf0ea2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -107,12 +107,7 @@ #define FIX_1585_ASAN_FORMAT_SW_ALT /* VA: float issue 1585: alternative fix memory leaks with format switching */ #define FIX_BASOP_2573_RF_MODE_UPDATE /* FhG: BASOP issue 2573: remove duplicated update of rf_mode parameters from evs_enc_fx(); was already done in updt_enc_common_fx() */ -#define HARMONIZE_2567_init_acelp /* FhG: harmonize init_acelp derivates for evs/ivas */ -#define HARMONIZE_2567_init_tcx_cfg /* FhG: harmonize init_tcx_cfg derivates for evs/ivas */ -#define HARMONIZE_2567_init_tcx /* FhG: harmonize init_tcx derivates for evs/ivas */ -#define HARMONIZE_2567_init_coder_ace_plus /* FhG: harmonize init_coder_ace_plus derivates for evs/ivas */ -#define HARMONIZE_2567_init_core_sig_ana /* FhG: harmonize init_core_sig_ana derivates for evs/ivas */ -//#define HARMONIZE_2567_init_modes /* FhG: harmonize init_modes derivates for evs/ivas */ +#define HARMONIZE_2567_init_functions /* FhG: harmonize derivates for evs/ivas regarding functions init_acelp*(),init_tcx_cfg*(), init_tcx*(), init_coder_ace_plus*(), init_core_sig_ana*() and init_modes*() */ /* #################### End BE switches ################################## */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 6bc257e83..cb2aa343a 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -5758,7 +5758,7 @@ void init_tcx_window_cfg_fx( const Word16 element_mode /* i : mode of CPE/SCE */ ); -#ifndef HARMONIZE_2567_init_tcx_cfg +#ifndef HARMONIZE_2567_init_functions void init_tcx_cfg_fx( TCX_CONFIG_HANDLE hTcxCfg, const Word32 total_brate, @@ -9587,7 +9587,7 @@ void writeTCXparam_fx( const Word16 target_bitsTCX10[2], const Word16 pre_past_flag ); -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions void init_coder_ace_plus_fx( Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate */ @@ -9621,7 +9621,7 @@ void SetModeIndex_ivas_fx( const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) Q0*/ ); -#ifdef HARMONIZE_2567_init_tcx_cfg +#ifdef HARMONIZE_2567_init_functions void init_tcx_cfg_fx( #else void init_tcx_cfg_ivas_fx( @@ -9641,7 +9641,7 @@ void init_tcx_cfg_ivas_fx( const Word16 infoIGFStopFreq, /*Q0*/ const Word16 element_mode, /*Q0*/ const Word16 ini_frame, /*Q0*/ -#ifdef HARMONIZE_2567_init_tcx_cfg +#ifdef HARMONIZE_2567_init_functions const Word16 MCT_flag, /*Q0*/ const Word16 fscaleFB /*Q0*/ ); #else diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 09bd27d9f..3d600a7d4 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -19,34 +19,34 @@ * Local functions *-----------------------------------------------------------------------*/ -#ifndef HARMONIZE_2567_init_tcx +#ifndef HARMONIZE_2567_init_functions static void init_tcx_fx( Encoder_State *st, Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag ); #endif static void init_core_sig_ana_fx( Encoder_State *st ); -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift, const Word32 last_total_brate ); #else static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift ); #endif -#ifndef HARMONIZE_2567_init_modes +#ifndef HARMONIZE_2567_init_functions static void init_modes_fx( Encoder_State *st, const Word32 Last_total_brate ); #endif static void init_sig_buffers_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr ); -#ifdef HARMONIZE_2567_init_tcx +#ifdef HARMONIZE_2567_init_functions static void init_tcx_fx( Encoder_State *st, const Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag ); #else static void init_tcx_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag ); #endif -#ifndef HARMONIZE_2567_init_core_sig_ana +#ifndef HARMONIZE_2567_init_functions static void init_core_sig_ana_ivas_fx( Encoder_State *st ); #endif -#ifdef HARMONIZE_2567_init_modes +#ifdef HARMONIZE_2567_init_functions static void init_modes_fx( Encoder_State *st, const Word32 last_total_brate ); #else static void init_modes_ivas_fx( Encoder_State *st, const Word32 last_total_brate ); #endif static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr, const Word32 last_total_brate ); -#ifndef HARMONIZE_2567_init_acelp +#ifndef HARMONIZE_2567_init_functions #ifdef NONBE_FIX_ISSUE_2518 static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Word32 last_total_brate ); #else @@ -54,7 +54,7 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh #endif #endif -#ifndef HARMONIZE_2567_init_coder_ace_plus +#ifndef HARMONIZE_2567_init_functions /*-----------------------------------------------------------------------* * init_coder_ace_plus_fx() * @@ -199,11 +199,7 @@ void init_coder_ace_plus_fx( init_sig_buffers_fx( st, L_frame_old, L_subfr ); /* Initialize ACELP */ -#ifdef HARMONIZE_2567_init_acelp - init_acelp_fx( st, L_frame_old, shift, 0 ); -#else init_acelp_fx( st, L_frame_old, shift ); -#endif if ( st->ini_frame == 0 ) { @@ -304,7 +300,7 @@ void init_coder_ace_plus_fx( } #endif -#ifndef HARMONIZE_2567_init_tcx +#ifndef HARMONIZE_2567_init_functions static void init_tcx_fx( Encoder_State *st, Word16 L_frame_old, @@ -566,7 +562,7 @@ void init_sig_buffers_fx( Encoder_State *st, const Word16 L_frame_old, const Wor return; } -#ifndef HARMONIZE_2567_init_core_sig_ana +#ifndef HARMONIZE_2567_init_functions static void init_core_sig_ana_fx( Encoder_State *st ) { @@ -619,7 +615,7 @@ static void init_core_sig_ana_fx( Encoder_State *st ) } #endif -#ifndef HARMONIZE_2567_init_acelp +#ifndef HARMONIZE_2567_init_functions static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift ) { Word16 mem_syn_r_size_old; @@ -866,7 +862,7 @@ static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 s } #endif -#ifndef HARMONIZE_2567_init_modes +#ifndef HARMONIZE_2567_init_functions static void init_modes_fx( Encoder_State *st, const Word32 last_total_brate ) @@ -962,7 +958,7 @@ static void init_modes_fx( * * Initialization of state variables *-----------------------------------------------------------------------*/ -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions void init_coder_ace_plus_fx( Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate */ @@ -1016,7 +1012,7 @@ void init_coder_ace_plus_ivas_fx( { hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) ); move16(); -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions IF( ( st->ini_frame == 0 ) && GT_16( st->element_mode, EVS_MONO ) ) #else IF( st->ini_frame == 0 ) @@ -1036,7 +1032,7 @@ void init_coder_ace_plus_ivas_fx( test(); test(); test(); -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions IF( ( ( st->element_mode == EVS_MONO ) && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, ACELP_32k ) ) || ( GT_16( st->element_mode, EVS_MONO ) && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, MAX_ACELP_BRATE ) ) ) #else IF( ( EQ_16( st->element_mode, EVS_MONO ) && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, ACELP_32k ) ) || ( GT_16( st->element_mode, EVS_MONO ) && EQ_32( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, MAX_ACELP_BRATE ) ) ) @@ -1062,7 +1058,7 @@ void init_coder_ace_plus_ivas_fx( { st->acelpFramesCount = 0; move16(); -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions IF( EQ_16( st->element_mode, EVS_MONO ) ) { st->prevTempFlatness_fx = 128 /*1.0f Q7*/; @@ -1073,7 +1069,7 @@ void init_coder_ace_plus_ivas_fx( #endif st->prevTempFlatness_32fx = ONE_IN_Q21 /*1.0f Q21*/; move32(); -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions } #endif } @@ -1094,7 +1090,7 @@ void init_coder_ace_plus_ivas_fx( st->currEnergyHF_e_fx = 0; move16(); -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions IF( EQ_16( st->element_mode, EVS_MONO ) ) { st->energyCoreLookahead_Fx = 0; @@ -1134,7 +1130,7 @@ void init_coder_ace_plus_ivas_fx( test(); IF( st->igf && st->hIGFEnc != NULL ) { -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions IF( EQ_16( st->element_mode, EVS_MONO ) ) { IGFEncSetMode_fx( st->hIGFEnc, st->total_brate, st->bwidth, st->element_mode, st->rf_mode ); @@ -1151,42 +1147,29 @@ void init_coder_ace_plus_ivas_fx( { st->hIGFEnc->infoTotalBitsWritten = 0; move16(); -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions if ( ( GT_16( st->element_mode, EVS_MONO ) ) || ( EQ_16( st->element_mode, EVS_MONO ) && EQ_16( MCT_flag, -10 ) ) ) { #endif st->hIGFEnc->infoTotalBitsPerFrameWritten = 0; move16(); -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions } #endif } -#ifdef HARMONIZE_2567_init_core_sig_ana +#ifdef HARMONIZE_2567_init_functions /* Initialize Core Signal Analysis Module */ init_core_sig_ana_fx( st ); -#else -#ifdef HARMONIZE_2567_init_coder_ace_plus - IF( EQ_16( st->element_mode, EVS_MONO ) ) - { - /* Initialize Core Signal Analysis Module */ - init_core_sig_ana_fx( st ); - } - ELSE - { - init_core_sig_ana_ivas_fx( st ); - } #else /* Initialize Core Signal Analysis Module */ init_core_sig_ana_ivas_fx( st ); - -#endif -#endif /*HARMONIZE_2567_init_core_sig_ana*/ +#endif /*HARMONIZE_2567_init_functions*/ /* Initialize TCX */ IF( hTcxEnc != NULL ) { -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions init_tcx_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); #else IF( GT_16( st->element_mode, EVS_MONO ) ) @@ -1201,7 +1184,7 @@ void init_coder_ace_plus_ivas_fx( } /* Initialize Signal Buffers */ -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions IF( EQ_16( st->element_mode, EVS_MONO ) ) { init_sig_buffers_fx( st, L_frame_old, L_subfr ); @@ -1210,13 +1193,13 @@ void init_coder_ace_plus_ivas_fx( { #endif init_sig_buffers_ivas_fx( st, L_frame_old, L_subfr, last_total_brate ); -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions } #endif /* Initialize ACELP */ -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions IF( EQ_16( st->element_mode, EVS_MONO ) ) { init_acelp_fx( st, L_frame_old, shift, 0 ); @@ -1226,12 +1209,11 @@ void init_coder_ace_plus_ivas_fx( #endif #ifdef NONBE_FIX_ISSUE_2518 init_acelp_fx( st, L_frame_old, 0, last_total_brate ); + } #else init_acelp_fx( st, L_frame_old, 0, last_total_brate ); #endif -#ifdef HARMONIZE_2567_init_coder_ace_plus - } -#endif + if ( st->ini_frame == 0 ) { @@ -1244,7 +1226,7 @@ void init_coder_ace_plus_ivas_fx( resetTecEnc_Fx( st->hTECEnc, st->tec_tfa ); } -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions IF( EQ_16( st->element_mode, EVS_MONO ) ) { if ( st->hTECEnc == NULL ) @@ -1278,7 +1260,7 @@ void init_coder_ace_plus_ivas_fx( test(); test(); test(); -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions test(); if ( EQ_16( st->element_mode, EVS_MONO ) && ( EQ_32( st->total_brate, ACELP_9k60 ) || EQ_32( st->total_brate, ACELP_16k40 ) || EQ_32( st->total_brate, ACELP_24k40 ) || EQ_32( st->total_brate, ACELP_32k ) ) ) @@ -1299,26 +1281,15 @@ void init_coder_ace_plus_ivas_fx( move16(); /* Initialize ACELP/TCX Modes */ -#ifdef HARMONIZE_2567_init_modes +#ifdef HARMONIZE_2567_init_functions init_modes_fx( st, last_total_brate ); #else -#ifdef HARMONIZE_2567_init_coder_ace_plus - IF( EQ_16( st->element_mode, EVS_MONO ) ) - { - init_modes_fx( st, last_total_brate ); - } - ELSE - { -#endif - init_modes_ivas_fx( st, last_total_brate ); -#ifdef HARMONIZE_2567_init_coder_ace_plus - } -#endif -#endif /*HARMONIZE_2567_init_modes*/ + init_modes_ivas_fx( st, last_total_brate ); +#endif /*HARMONIZE_2567_init_functions*/ /* Adaptive BPF */ -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions IF( EQ_16( st->element_mode, EVS_MONO ) ) { set16_fx( st->mem_bpf_fx.noise_buf, 0, 2 * L_FILT16k ); @@ -1337,7 +1308,7 @@ void init_coder_ace_plus_ivas_fx( #endif set32_fx( st->mem_bpf_fx1, 0, 2 * L_FILT16k ); set32_fx( st->mem_error_bpf_fx, 0, 2 * L_FILT16k ); -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions } #endif @@ -1388,7 +1359,7 @@ void init_coder_ace_plus_ivas_fx( *-----------------------------------------------------------------------*/ -#ifdef HARMONIZE_2567_init_tcx +#ifdef HARMONIZE_2567_init_functions static void init_tcx_fx( #else static void init_tcx_ivas_fx( @@ -1400,7 +1371,7 @@ static void init_tcx_ivas_fx( const Word16 MCT_flag ) { TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; -#ifdef HARMONIZE_2567_init_tcx +#ifdef HARMONIZE_2567_init_functions Word16 i; Word16 fscaleFB; @@ -1440,7 +1411,7 @@ static void init_tcx_ivas_fx( st->hTcxEnc->spectrum_e[0] = st->hTcxEnc->spectrum_e[1] = 0; move16(); move16(); -#ifdef HARMONIZE_2567_init_tcx_cfg +#ifdef HARMONIZE_2567_init_functions init_tcx_cfg_fx( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, st->fscale, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag, 0 ); @@ -1460,7 +1431,7 @@ static void init_tcx_ivas_fx( move16(); hTcxEnc->noiseLevelMemory_cnt = 0; move16(); -#ifdef HARMONIZE_2567_init_tcx +#ifdef HARMONIZE_2567_init_functions IF( EQ_16( st->element_mode, EVS_MONO ) ) { /*SQ deadzone & memory quantization*/ @@ -1510,7 +1481,7 @@ static void init_tcx_ivas_fx( #endif set16_fx( hTcxEnc->ltpGainMemory_fx, 0, N_LTP_GAIN_MEMS ); set8_fx( hTcxEnc->memQuantZeros, 0, L_FRAME_PLUS ); -#ifdef HARMONIZE_2567_init_tcx +#ifdef HARMONIZE_2567_init_functions } #endif @@ -1529,7 +1500,7 @@ static void init_tcx_ivas_fx( hTcxEnc->tcxltp_gain_past = 0; hTcxEnc->tcxltp_norm_corr_past = 0; move16(); -#ifdef HARMONIZE_2567_init_tcx +#ifdef HARMONIZE_2567_init_functions IF( GT_16( st->element_mode, EVS_MONO ) ) { #endif @@ -1547,7 +1518,7 @@ static void init_tcx_ivas_fx( move16(); move16(); move16(); -#ifdef HARMONIZE_2567_init_tcx +#ifdef HARMONIZE_2567_init_functions } #endif move16(); @@ -1588,7 +1559,7 @@ static void init_tcx_ivas_fx( move16(); } -#ifdef HARMONIZE_2567_init_tcx +#ifdef HARMONIZE_2567_init_functions IF( EQ_16( st->element_mode, EVS_MONO ) ) { /* Residual Coding*/ @@ -1804,7 +1775,7 @@ static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_ol * * *-----------------------------------------------------------------------*/ -#ifdef HARMONIZE_2567_init_core_sig_ana +#ifdef HARMONIZE_2567_init_functions static void init_core_sig_ana_fx( Encoder_State *st ) #else static void init_core_sig_ana_ivas_fx( Encoder_State *st ) @@ -1825,7 +1796,7 @@ static void init_core_sig_ana_ivas_fx( Encoder_State *st ) st->preemph_fac = PREEMPH_FAC_16k; /*WB*/ move16(); } -#ifdef HARMONIZE_2567_init_core_sig_ana +#ifdef HARMONIZE_2567_init_functions if ( EQ_16( st->element_mode, EVS_MONO ) ) { st->hTcxCfg->preemph_fac = st->preemph_fac; @@ -1869,13 +1840,13 @@ static void init_core_sig_ana_ivas_fx( Encoder_State *st ) * *-----------------------------------------------------------------------*/ #ifdef NONBE_FIX_ISSUE_2518 -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift, const Word32 last_total_brate ) #else static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Word32 last_total_brate ) #endif #else -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift, const Word32 last_total_brate ) #else static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 shift, const Word32 last_total_brate ) @@ -1907,7 +1878,7 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh { set16_fx( hLPDmem->syn, 0, 1 + M ); set16_fx( hLPDmem->mem_syn_r, 0, L_SYN_MEM ); -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions IF( GT_16( st->element_mode, EVS_MONO ) ) { #endif @@ -1915,7 +1886,7 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh hLPDmem->q_mem_syn = Q15; move16(); move16(); -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions } #endif } @@ -1947,7 +1918,7 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh { Copy( hLPDmem->mem_syn1_fx, hLPDmem->mem_syn2, M ); set16_fx( hLPDmem->syn, 0, M ); -#ifndef HARMONIZE_2567_init_acelp +#ifndef HARMONIZE_2567_init_functions hLPDmem->q_lpd_syn = Q15; hLPDmem->q_mem_syn = Q15; move16(); @@ -1985,7 +1956,7 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh move16(); set16_fx( hLPDmem->old_exc, 0, L_EXC_MEM ); set16_fx( hLPDmem->syn, 0, 1 + M ); -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions IF( GT_16( st->element_mode, EVS_MONO ) ) { #endif @@ -1993,20 +1964,20 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh move16(); hLPDmem->q_lpd_old_exc = Q15; move16(); -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions } #endif hLPDmem->mem_w0 = 0; move16(); set16_fx( hLPDmem->mem_syn, 0, M ); set16_fx( hLPDmem->mem_syn2, 0, M ); -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions IF( GT_16( st->element_mode, EVS_MONO ) ) { #endif hLPDmem->q_mem_syn = Q15; move16(); -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions } #endif } @@ -2015,7 +1986,7 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh test(); test(); test(); -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions Word16 condition; IF( EQ_16( st->element_mode, EVS_MONO ) ) { @@ -2100,7 +2071,7 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh Copy( hLPDmem->mem_syn2, tmp_buf + 1, M ); deemph_fx( tmp_buf + 1, st->preemph_fac, M, &tmp ); #ifdef NONBE_FIX_ISSUE_2518 -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions IF( EQ_16( st->element_mode, EVS_MONO ) ) { Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 1 ); @@ -2114,11 +2085,11 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh #else Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 0 ); hLPDmem->mem_w0 = sub_sat( shl_sat( st->wspeech_enc[-1], sub( hLPDmem->q_mem_syn, sub( Q15, st->exp_buf_wspeech_enc ) ) ), tmp ); -#endif +#endif /*HARMONIZE_2567_init_functions*/ #else Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 1 ); hLPDmem->mem_w0 = sub_sat( shr_sat( st->wspeech_enc[-1], shift ), tmp ); -#endif +#endif /*NONBE_FIX_ISSUE_2518*/ move16(); } } @@ -2137,13 +2108,13 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh move16(); set16_fx( hLPDmem->old_exc, 0, L_EXC_MEM ); move16(); -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions IF( GT_16( st->element_mode, EVS_MONO ) ) { #endif hLPDmem->q_lpd_old_exc = Q15; move16(); -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions } #endif /*Resamp others memories*/ @@ -2233,26 +2204,26 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh { st->mem_bpf_fx.lp_error_ener = L_deposit_l( 0 ); move32(); -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions if ( GT_16( st->element_mode, EVS_MONO ) ) { #endif st->pst_lp_ener_fx = 0; move16(); -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions } #endif IF( EQ_16( st->last_codec_mode, MODE1 ) ) { st->mem_bpf_fx.lp_error = 0; move32(); -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions if ( GT_16( st->element_mode, EVS_MONO ) ) { #endif st->pst_mem_deemp_err_fx = 0; move16(); -#ifdef HARMONIZE_2567_init_acelp +#ifdef HARMONIZE_2567_init_functions } #endif } @@ -2267,7 +2238,7 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, Word16 sh * *-----------------------------------------------------------------------*/ -#ifdef HARMONIZE_2567_init_modes +#ifdef HARMONIZE_2567_init_functions static void init_modes_fx( #else static void init_modes_ivas_fx( @@ -2319,7 +2290,7 @@ static void init_modes_ivas_fx( /* st->bits_frame_nominal = extract_h(L_add(L_mult(div_l(L_mult(shl(st->L_frame,2),st->bitrate),st->fscale),328),16056)); */ /* st->bits_frame_nominal = (int)( (float)st->L_frame/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate/100.0f + 0.49f ); */ -#ifdef HARMONIZE_2567_init_modes +#ifdef HARMONIZE_2567_init_functions if ( EQ_16( st->element_mode, EVS_MONO ) ) { assert( FSCALE_DENOM == 512 ); @@ -2343,7 +2314,7 @@ static void init_modes_ivas_fx( { FOR( n = 0; n < FRAME_SIZE_NB; n++ ) { -#ifdef HARMONIZE_2567_init_modes +#ifdef HARMONIZE_2567_init_functions Word16 bits_frame_tmp, bits_frame_core_tmp; test(); test(); @@ -2408,7 +2379,7 @@ static void init_modes_ivas_fx( } #endif } -#ifdef HARMONIZE_2567_init_modes +#ifdef HARMONIZE_2567_init_functions test(); if ( EQ_16( (Word16) n, FRAME_SIZE_NB ) && ( EQ_16( st->element_mode, EVS_MONO ) ) ) { @@ -2418,7 +2389,7 @@ static void init_modes_ivas_fx( } /* Reconfigure core */ -#ifdef HARMONIZE_2567_init_modes +#ifdef HARMONIZE_2567_init_functions if ( EQ_16( st->element_mode, EVS_MONO ) ) { core_coder_reconfig_fx( st, last_total_brate ); @@ -2427,7 +2398,7 @@ static void init_modes_ivas_fx( { #endif core_coder_reconfig_ivas_fx( st, last_total_brate ); -#ifdef HARMONIZE_2567_init_modes +#ifdef HARMONIZE_2567_init_functions } #endif diff --git a/lib_enc/core_enc_switch_fx.c b/lib_enc/core_enc_switch_fx.c index 0f8bff45e..b67a20d22 100644 --- a/lib_enc/core_enc_switch_fx.c +++ b/lib_enc/core_enc_switch_fx.c @@ -157,7 +157,7 @@ void core_coder_mode_switch_fx( { st->igf = getIgfPresent_fx( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); move16(); -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions assert( st->element_mode == EVS_MONO ); init_coder_ace_plus_fx( st, last_total_bitrate, 0, shift, MCT_flag ); #else @@ -402,7 +402,7 @@ void core_coder_mode_switch_ivas_fx( move16(); #endif -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions assert( st->element_mode != EVS_MONO ); init_coder_ace_plus_fx( st, last_total_brate, st->total_brate, 0, MCT_flag ); #else diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index d1b3a7645..6b3770893 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1134,7 +1134,7 @@ ivas_error init_encoder_fx( IF( st->element_mode == EVS_MONO ) { -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions assert( st->element_mode == EVS_MONO ); init_coder_ace_plus_fx( st, st->last_total_brate, 0, 0, -10 /*hack*/ ); #else @@ -1154,7 +1154,7 @@ ivas_error init_encoder_fx( move16(); -#ifdef HARMONIZE_2567_init_coder_ace_plus +#ifdef HARMONIZE_2567_init_functions assert( st->element_mode != EVS_MONO ); init_coder_ace_plus_fx( st, st->last_total_brate, igf_brate, 0, 0 ); #else diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index c446e457a..13dad77c0 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -2342,7 +2342,7 @@ void tcx_ltp_encode_ivas_fx( const Word16 disable_ltp, const Word16 element_mode ); -#ifndef HARMONIZE_2567_init_coder_ace_plus +#ifndef HARMONIZE_2567_init_functions void init_coder_ace_plus_fx( Encoder_State *st, const Word32 last_total_brate, /* i : last total bitrate */ -- GitLab From 6cf71c9bb372590ec9efce31e0a4b300d6d6f43a Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 7 May 2026 15:21:18 +0200 Subject: [PATCH 23/23] fix warning unused variable --- lib_enc/core_enc_init_fx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 3d600a7d4..88270349a 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -2315,7 +2315,6 @@ static void init_modes_ivas_fx( FOR( n = 0; n < FRAME_SIZE_NB; n++ ) { #ifdef HARMONIZE_2567_init_functions - Word16 bits_frame_tmp, bits_frame_core_tmp; test(); test(); test(); -- GitLab