From fe9bb515d0f11a9b99b5a9af5b1f2570c060a4ac Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 12 Mar 2026 12:25:07 +0100 Subject: [PATCH 1/7] harmonized generate_comfort_noise_enc_fx and generate_comfort_noise_enc_ivas_fx --- lib_com/options.h | 1 + lib_enc/acelp_core_enc_fx.c | 9 ++++++++- lib_enc/enc_acelp_tcx_main_fx.c | 4 ++++ lib_enc/fd_cng_enc_fx.c | 26 +++++++++++++++++++++----- lib_enc/prot_fx_enc.h | 11 +++++++++++ 5 files changed, 45 insertions(+), 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 0457cfa56..dc5ef8323 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -97,6 +97,7 @@ #define FIX_FLOAT_1536_INIT_NO_PARAM_LPC /* FhG: make sure no_param_lpc is initialized in core_encode_twodiv() */ #define FIX_BASOP_2871_INIT_Q_SYN_FACTOR /* FhG: make sure, st_fx->Q_syn_factor gets initialized during decoder startup */ #define FIX_BASOP_2470_POWER_SPEC_E_INIT /* FhG: make sure powerSpec_e is always initialized in core_signal_analysis_high_bitrate_fx() */ +#define FIX_2455_HARMONIZE_generate_comfort_noise_enc /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */ /* #################### End BE switches ################################## */ diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index 2df22bdc8..45c285ead 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -366,8 +366,11 @@ ivas_error acelp_core_enc_fx( st->hDtxEnc->last_CNG_L_frame = st->L_frame; move16(); } - +#ifdef FIX_2455_HARMONIZE_generate_comfort_noise_enc + generate_comfort_noise_enc_fx( st, Q_new, 1, st->element_mode ); +#else generate_comfort_noise_enc_fx( st, Q_new, 1 ); +#endif FdCng_exc( st->hFdCngEnc->hFdCngCom, &st->hDtxEnc->CNG_mode, st->L_frame, st->lsp_old_fx, st->hDtxEnc->first_CNG, st->hDtxEnc->lspCNG_fx, Aq, lsp_new, lsf_new_fx, exc_fx, exc2_fx, bwe_exc_fx ); @@ -423,7 +426,11 @@ ivas_error acelp_core_enc_fx( st->hFdCngEnc->hFdCngCom->cngNoiseLevelExp = sub( st->hFdCngEnc->hFdCngCom->cngNoiseLevelExp, Q_cngNoise ); move16(); +#ifdef FIX_2455_HARMONIZE_generate_comfort_noise_enc + generate_comfort_noise_enc_fx( st, Q_new, 1, st->element_mode ); +#else generate_comfort_noise_enc_ivas_fx( st, Q_new, 1 ); +#endif st->hTcxEnc->q_Txnq = Q_new; move16(); diff --git a/lib_enc/enc_acelp_tcx_main_fx.c b/lib_enc/enc_acelp_tcx_main_fx.c index 44108f56c..7814aadba 100644 --- a/lib_enc/enc_acelp_tcx_main_fx.c +++ b/lib_enc/enc_acelp_tcx_main_fx.c @@ -92,7 +92,11 @@ void enc_acelp_tcx_main_fx( } /* Generate Comfort Noise */ +#ifdef FIX_2455_HARMONIZE_generate_comfort_noise_enc + generate_comfort_noise_enc_fx( st, *Q_new, 1, EVS_MONO ); +#else generate_comfort_noise_enc_fx( st, *Q_new, 1 ); +#endif /* Update Core Encoder */ core_encode_update_cng_fx( st, st->hFdCngEnc->hFdCngCom->timeDomainBuffer, st->hFdCngEnc->hFdCngCom->A_cng, Aw, *Q_new, *shift ); diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index f3ece9b26..9c178b22c 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -1268,7 +1268,7 @@ void FdCng_encodeSID_fx( return; } - +#ifndef FIX_2455_HARMONIZE_generate_comfort_noise_enc void generate_comfort_noise_enc_fx( Encoder_State *stcod, Word16 Q_new, @@ -1651,12 +1651,20 @@ void generate_comfort_noise_enc_fx( return; } +#endif - +#ifdef FIX_2455_HARMONIZE_generate_comfort_noise_enc +void generate_comfort_noise_enc_fx( + Encoder_State *stcod, + Word16 Q_new, + Word16 gen_exc, + int element_mode ) +#else void generate_comfort_noise_enc_ivas_fx( Encoder_State *stcod, Word16 Q_new, Word16 gen_exc ) +#endif { Word16 i, s, sn, cnt; Word16 startBand2; @@ -1779,9 +1787,17 @@ void generate_comfort_noise_enc_ivas_fx( } /* Perform STFT synthesis */ - SynthesisSTFT_enc_ivas_fx( fftBuffer, fftBufferExp, timeDomainOutput, st->olapBufferSynth, st->olapWinSyn, - tcx_transition, st, gen_exc, &Q_new, -1, -1 ); - IF( hTdCngEnc != NULL ) + IF( element_mode == EVS_MONO ) + { + SynthesisSTFT( fftBuffer, fftBufferExp, timeDomainOutput, st->olapBufferSynth, st->olapWinSyn, + tcx_transition, st, gen_exc, &Q_new, -1, -1 ); + } + ELSE + { + SynthesisSTFT_enc_ivas_fx( fftBuffer, fftBufferExp, timeDomainOutput, st->olapBufferSynth, st->olapWinSyn, + tcx_transition, st, gen_exc, &Q_new, -1, -1 ); + } + IF( ( ( hTdCngEnc != NULL ) && ( element_mode != EVS_MONO ) ) || ( element_mode == EVS_MONO ) ) { Word32 Lener, att; Word16 exp; diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 8fde36034..4123fb025 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -1586,11 +1586,20 @@ void FdCng_encodeSID_fx( Word16 preemph_fac /* i : preemphase factor */ ); +#ifdef FIX_2455_HARMONIZE_generate_comfort_noise_enc +/* Generate the comfort noise based on the target noise level */ +void generate_comfort_noise_enc_fx( + Encoder_State *stcod, + Word16 Q_new, + Word16 gen_exc, + int element_mode ); +#else /* Generate the comfort noise based on the target noise level */ void generate_comfort_noise_enc_fx( Encoder_State *stcod, Word16 Q_new, Word16 gen_exc ); +#endif Word16 cng_energy_fx( const Word16 element_mode, /* i : element mode Q0*/ @@ -4185,10 +4194,12 @@ Word16 cng_energy_ivas_fx( const Word16 Q_new /* i : Input scaling */ ); +#ifndef FIX_2455_HARMONIZE_generate_comfort_noise_enc void generate_comfort_noise_enc_ivas_fx( Encoder_State *stcod, Word16 Q_new, Word16 gen_exc ); +#endif void SynthesisSTFT_enc_ivas_fx( Word32 *fftBuffer, /* i : pointer to FFT bins */ -- GitLab From e6ff8e288421a0cf4276c1c0efb9906ef7e60e3c Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 12 Mar 2026 11:27:20 +0000 Subject: [PATCH 2/7] wrapped all changes in macro --- lib_enc/fd_cng_enc_fx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index 9c178b22c..b29a282ca 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -1787,6 +1787,7 @@ void generate_comfort_noise_enc_ivas_fx( } /* Perform STFT synthesis */ +#ifdef FIX_2455_HARMONIZE_generate_comfort_noise_enc IF( element_mode == EVS_MONO ) { SynthesisSTFT( fftBuffer, fftBufferExp, timeDomainOutput, st->olapBufferSynth, st->olapWinSyn, @@ -1798,6 +1799,11 @@ void generate_comfort_noise_enc_ivas_fx( tcx_transition, st, gen_exc, &Q_new, -1, -1 ); } IF( ( ( hTdCngEnc != NULL ) && ( element_mode != EVS_MONO ) ) || ( element_mode == EVS_MONO ) ) +#else + SynthesisSTFT_enc_ivas_fx( fftBuffer, fftBufferExp, timeDomainOutput, st->olapBufferSynth, st->olapWinSyn, + tcx_transition, st, gen_exc, &Q_new, -1, -1 ); + IF( hTdCngEnc != NULL ) +#endif { Word32 Lener, att; Word16 exp; -- GitLab From 6108f3018fd75f3bd5d8170826a546d4af6e427e Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Mon, 16 Mar 2026 09:05:31 +0100 Subject: [PATCH 3/7] deactivate to test --- 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 dc5ef8323..f20d766f6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -97,7 +97,7 @@ #define FIX_FLOAT_1536_INIT_NO_PARAM_LPC /* FhG: make sure no_param_lpc is initialized in core_encode_twodiv() */ #define FIX_BASOP_2871_INIT_Q_SYN_FACTOR /* FhG: make sure, st_fx->Q_syn_factor gets initialized during decoder startup */ #define FIX_BASOP_2470_POWER_SPEC_E_INIT /* FhG: make sure powerSpec_e is always initialized in core_signal_analysis_high_bitrate_fx() */ -#define FIX_2455_HARMONIZE_generate_comfort_noise_enc /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */ +//#define FIX_2455_HARMONIZE_generate_comfort_noise_enc /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */ /* #################### End BE switches ################################## */ -- GitLab From 21b5be36c82aaad7c478b6ffe29b6b4c6c1d4b6f Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Mon, 16 Mar 2026 09:31:38 +0100 Subject: [PATCH 4/7] add macro FIX_2455_HARMONIZE_configureFdCngEnc - inactive --- lib_com/options.h | 3 ++- lib_com/prot_fx.h | 2 ++ lib_enc/fd_cng_enc_fx.c | 28 +++++++++++++++++++++++++- lib_enc/init_enc_fx.c | 5 ++++- lib_enc/ivas_core_enc_fx.c | 11 ++++++++++ lib_enc/ivas_core_pre_proc_front_fx.c | 5 ++++- lib_enc/ivas_core_pre_proc_fx.c | 4 ++++ lib_enc/ivas_stereo_switching_enc_fx.c | 4 ++++ lib_enc/pre_proc_fx.c | 4 ++++ 9 files changed, 62 insertions(+), 4 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 352aa0737..274c01e64 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -95,7 +95,8 @@ #define FIX_1525_UNINIT_FORMAT_SWITCHING_DEC /* VA: float issue 1525: fix reading of uninitialized memory in format switching at the decoder */ #define HARMONIZE_2446_CON_TCX_FX /* FhG: basop issue: 2446 harmonization of function con_tcx_fx() */ #define FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC /* Nokia: Fix to convert non-converted binary operations */ -//#define FIX_2455_HARMONIZE_generate_comfort_noise_enc /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */ +//#define FIX_2455_HARMONIZE_generate_comfort_noise_enc /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */ +//#define FIX_2455_HARMONIZE_configureFdCngEnc /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */ /* #################### End BE switches ################################## */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index a40fba659..d6b662f0d 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -10049,11 +10049,13 @@ void core_coder_mode_switch_ivas_fx( const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ); +#ifndef FIX_2455_HARMONIZE_configureFdCngEnc void configureFdCngEnc_ivas_fx( HANDLE_FD_CNG_ENC hFdCngEnc, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bwidth, /* Q0 */ const Word32 total_brate /* Q0 */ ); +#endif void SetModeIndex_ivas_fx( Encoder_State *st, /* i : Encoder state */ diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index b29a282ca..3b0372dd3 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -159,11 +159,20 @@ void initFdCngEnc_fx( * Configure FD_CNG * ************************************/ +#ifdef FIX_2455_HARMONIZE_configureFdCngEnc +void configureFdCngEnc_fx( + HANDLE_FD_CNG_ENC hsEnc, /* i/o: Contains the variables related to the FD-based CNG process */ + const Word16 bandwidth, /* i : bandwidth Q0*/ + const Word32 bitrate, /* Q0 */ + const Word16 element_mode +) +#else void configureFdCngEnc_fx( HANDLE_FD_CNG_ENC hsEnc, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bandwidth, /* i : bandwidth Q0*/ const Word32 bitrate /* Q0 */ ) +#endif { HANDLE_FD_CNG_COM hsCom = hsEnc->hFdCngCom; Word16 psizeDec[NPART]; @@ -265,12 +274,28 @@ void configureFdCngEnc_fx( SWITCH( hsCom->fftlen ) { case 512: +#ifdef FIX_2455_HARMONIZE_configureFdCngEnc + if ( GT_16( element_mode, 0 ) ) + { + hsCom->fftSineTab_fx = NULL; + hsCom->olapWinAna_fx = olapWinAna512_fx; /* Q30 */ + hsCom->olapWinSyn_fx = olapWinSyn256_fx; /* Q15 */ + } +#endif hsCom->fftlenShift = 8; move16(); hsCom->fftlenFac = 32767 /*1.0 Q15*/; move16(); BREAK; case 640: +#ifdef FIX_2455_HARMONIZE_configureFdCngEnc + if ( GT_16( element_mode, 0 ) ) + { + hsCom->fftSineTab_fx = fftSineTab640_fx; /* Q15 */ + hsCom->olapWinAna_fx = olapWinAna640_fx; /* Q30 */ + hsCom->olapWinSyn_fx = olapWinSyn320_fx; /* Q15 */ + } +#endif hsCom->fftlenShift = 9; move16(); hsCom->fftlenFac = 20480 /*0.625 Q15*/; @@ -288,6 +313,7 @@ void configureFdCngEnc_fx( return; } +#ifndef FIX_2455_HARMONIZE_configureFdCngEnc void configureFdCngEnc_ivas_fx( HANDLE_FD_CNG_ENC hFdCngEnc, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bwidth, /* Q0 */ @@ -422,7 +448,7 @@ void configureFdCngEnc_ivas_fx( return; } - +#endif /*FIX_2455_HARMONIZE_configureFdCngEnc*/ /************************************** * Delete the instance of type FD_CNG * diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index f042b4a10..2e96187c8 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1177,8 +1177,11 @@ ivas_error init_encoder_fx( total_brate = st->total_brate; move32(); } - +#ifdef FIX_2455_HARMONIZE_configureFdCngEnc + configureFdCngEnc_fx( st->hFdCngEnc, st->bwidth, total_brate, st->element_mode ); +#else configureFdCngEnc_fx( st->hFdCngEnc, st->bwidth, total_brate ); +#endif } } ELSE diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index 21a9da678..2308d8d65 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -567,6 +567,16 @@ ivas_error ivas_core_enc_fx( test(); IF( ( NE_16( st->hFdCngEnc->hFdCngCom->frameSize, st->L_frame ) ) || ( NE_16( st->hFdCngEnc->hFdCngCom->CngBandwidth, st->bwidth ) ) ) { +#ifdef FIX_2455_HARMONIZE_configureFdCngEnc + IF( EQ_16( st->L_frame, L_FRAME16k ) ) + { + configureFdCngEnc_fx( st->hFdCngEnc, s_max( st->bwidth, WB ), ACELP_16k40, st->element_mode ); + } + ELSE + { + configureFdCngEnc_fx( st->hFdCngEnc, s_max( st->bwidth, WB ), ACELP_9k60, st->element_mode ); + } +#else IF( EQ_16( st->L_frame, L_FRAME16k ) ) { configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->bwidth, WB ), ACELP_16k40 ); @@ -575,6 +585,7 @@ ivas_error ivas_core_enc_fx( { configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->bwidth, WB ), ACELP_9k60 ); } +#endif } } diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index cfcf16338..7148c83cd 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -930,8 +930,11 @@ void pre_proc_front_ivas_fx( { total_brate = imult3216( FRAMES_PER_SEC, st->bits_frame_nominal ); /* Q0 */ } - +#ifdef FIX_2455_HARMONIZE_configureFdCngEnc + configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->input_bwidth, WB ), total_brate, element_mode ); +#else configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->input_bwidth, WB ), total_brate ); +#endif IF( hCPE != NULL ) { diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index fce2b3e92..de8970d09 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -178,7 +178,11 @@ void pre_proc_ivas_fx( test(); IF( st->hFdCngEnc != NULL && NE_16( st->element_mode, IVAS_CPE_MDCT ) && ( ( NE_16( st->hFdCngEnc->hFdCngCom->frameSize, st->L_frame ) ) || ( NE_16( st->hFdCngEnc->hFdCngCom->CngBandwidth, st->input_bwidth ) ) ) ) { +#ifdef FIX_2455_HARMONIZE_configureFdCngEnc + configureFdCngEnc_fx( st->hFdCngEnc, s_max( st->input_bwidth, WB ), total_brate_tmp, st->element_mode ); +#else configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->input_bwidth, WB ), total_brate_tmp ); +#endif } if ( st->ini_frame == 0 ) diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 573edd197..7ab3c8fbb 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -608,7 +608,11 @@ ivas_error stereo_memory_enc_fx( } initFdCngEnc_fx( st->hFdCngEnc, st->input_Fs, st->cldfbAnaEnc->scale ); +#ifdef FIX_2455_HARMONIZE_configureFdCngEnc + configureFdCngEnc_fx( st->hFdCngEnc, st->bwidth, st->rf_mode && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, hCPE->element_mode ); +#else configureFdCngEnc_ivas_fx( st->hFdCngEnc, st->bwidth, st->rf_mode && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate ); +#endif } } } diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index 1ffbd2561..0f0cbddff 100644 --- a/lib_enc/pre_proc_fx.c +++ b/lib_enc/pre_proc_fx.c @@ -346,7 +346,11 @@ void pre_proc_fx( L_tmp = ACELP_9k60; move32(); } +#ifdef FIX_2455_HARMONIZE_configureFdCngEnc + configureFdCngEnc_fx( st->hFdCngEnc, st->bwidth, L_tmp, 0 /*EVS_MONO*/ ); +#else configureFdCngEnc_fx( st->hFdCngEnc, st->bwidth, L_tmp ); +#endif } test(); -- GitLab From f0ca88ce1f015145d09ed13e10c42d8b80b52c80 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Mon, 16 Mar 2026 09:33:45 +0100 Subject: [PATCH 5/7] format --- lib_enc/fd_cng_enc_fx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index 3b0372dd3..5dd43542d 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -164,8 +164,7 @@ void configureFdCngEnc_fx( HANDLE_FD_CNG_ENC hsEnc, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bandwidth, /* i : bandwidth Q0*/ const Word32 bitrate, /* Q0 */ - const Word16 element_mode -) + const Word16 element_mode ) #else void configureFdCngEnc_fx( HANDLE_FD_CNG_ENC hsEnc, /* i/o: Contains the variables related to the FD-based CNG process */ -- GitLab From b0b8261bd5bdfe30aaaf33b17e9d77c45afcc610 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Mon, 16 Mar 2026 11:12:14 +0100 Subject: [PATCH 6/7] activate both macros --- lib_com/options.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 274c01e64..e29be858f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -95,8 +95,8 @@ #define FIX_1525_UNINIT_FORMAT_SWITCHING_DEC /* VA: float issue 1525: fix reading of uninitialized memory in format switching at the decoder */ #define HARMONIZE_2446_CON_TCX_FX /* FhG: basop issue: 2446 harmonization of function con_tcx_fx() */ #define FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC /* Nokia: Fix to convert non-converted binary operations */ -//#define FIX_2455_HARMONIZE_generate_comfort_noise_enc /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */ -//#define FIX_2455_HARMONIZE_configureFdCngEnc /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */ +#define FIX_2455_HARMONIZE_generate_comfort_noise_enc /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */ +#define FIX_2455_HARMONIZE_configureFdCngEnc /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */ /* #################### End BE switches ################################## */ -- GitLab From f6078db0d38e6b05202b9d16c1d681aec9707a53 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 16 Mar 2026 13:40:57 +0100 Subject: [PATCH 7/7] some smaller issues --- lib_enc/fd_cng_enc_fx.c | 19 ++++++++++--------- lib_enc/ivas_core_pre_proc_front_fx.c | 2 +- lib_enc/prot_fx_enc.h | 11 ++++++++++- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index 5dd43542d..5ee420fa5 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -161,10 +161,11 @@ void initFdCngEnc_fx( #ifdef FIX_2455_HARMONIZE_configureFdCngEnc void configureFdCngEnc_fx( - HANDLE_FD_CNG_ENC hsEnc, /* i/o: Contains the variables related to the FD-based CNG process */ - const Word16 bandwidth, /* i : bandwidth Q0*/ - const Word32 bitrate, /* Q0 */ - const Word16 element_mode ) + HANDLE_FD_CNG_ENC hsEnc, /* i/o: Contains the variables related to the FD-based CNG process */ + const Word16 bandwidth, /* i : bandwidth Q0 */ + const Word32 bitrate, /* i : bitrate Q0 */ + const Word16 element_mode /* i : element mode Q0 */ +) #else void configureFdCngEnc_fx( HANDLE_FD_CNG_ENC hsEnc, /* i/o: Contains the variables related to the FD-based CNG process */ @@ -274,7 +275,7 @@ void configureFdCngEnc_fx( { case 512: #ifdef FIX_2455_HARMONIZE_configureFdCngEnc - if ( GT_16( element_mode, 0 ) ) + if ( GT_16( element_mode, EVS_MONO ) ) { hsCom->fftSineTab_fx = NULL; hsCom->olapWinAna_fx = olapWinAna512_fx; /* Q30 */ @@ -288,7 +289,7 @@ void configureFdCngEnc_fx( BREAK; case 640: #ifdef FIX_2455_HARMONIZE_configureFdCngEnc - if ( GT_16( element_mode, 0 ) ) + if ( GT_16( element_mode, EVS_MONO ) ) { hsCom->fftSineTab_fx = fftSineTab640_fx; /* Q15 */ hsCom->olapWinAna_fx = olapWinAna640_fx; /* Q30 */ @@ -1683,7 +1684,7 @@ void generate_comfort_noise_enc_fx( Encoder_State *stcod, Word16 Q_new, Word16 gen_exc, - int element_mode ) + Word16 element_mode ) #else void generate_comfort_noise_enc_ivas_fx( Encoder_State *stcod, @@ -1813,7 +1814,7 @@ void generate_comfort_noise_enc_ivas_fx( /* Perform STFT synthesis */ #ifdef FIX_2455_HARMONIZE_generate_comfort_noise_enc - IF( element_mode == EVS_MONO ) + IF( EQ_16( element_mode, EVS_MONO ) ) { SynthesisSTFT( fftBuffer, fftBufferExp, timeDomainOutput, st->olapBufferSynth, st->olapWinSyn, tcx_transition, st, gen_exc, &Q_new, -1, -1 ); @@ -1823,7 +1824,7 @@ void generate_comfort_noise_enc_ivas_fx( SynthesisSTFT_enc_ivas_fx( fftBuffer, fftBufferExp, timeDomainOutput, st->olapBufferSynth, st->olapWinSyn, tcx_transition, st, gen_exc, &Q_new, -1, -1 ); } - IF( ( ( hTdCngEnc != NULL ) && ( element_mode != EVS_MONO ) ) || ( element_mode == EVS_MONO ) ) + IF( ( ( hTdCngEnc != NULL ) && ( NE_16( element_mode, EVS_MONO ) ) ) || EQ_16( element_mode, EVS_MONO ) ) #else SynthesisSTFT_enc_ivas_fx( fftBuffer, fftBufferExp, timeDomainOutput, st->olapBufferSynth, st->olapWinSyn, tcx_transition, st, gen_exc, &Q_new, -1, -1 ); diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 7148c83cd..0afc640bf 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -931,7 +931,7 @@ void pre_proc_front_ivas_fx( total_brate = imult3216( FRAMES_PER_SEC, st->bits_frame_nominal ); /* Q0 */ } #ifdef FIX_2455_HARMONIZE_configureFdCngEnc - configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->input_bwidth, WB ), total_brate, element_mode ); + configureFdCngEnc_fx( st->hFdCngEnc, s_max( st->input_bwidth, WB ), total_brate, element_mode ); #else configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->input_bwidth, WB ), total_brate ); #endif diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index c2f1d9fb0..2b644e164 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -1538,7 +1538,7 @@ void generate_comfort_noise_enc_fx( Encoder_State *stcod, Word16 Q_new, Word16 gen_exc, - int element_mode ); + Word16 element_mode ); #else /* Generate the comfort noise based on the target noise level */ void generate_comfort_noise_enc_fx( @@ -1651,11 +1651,20 @@ void initFdCngEnc_fx( const Word32 input_Fs, /* Q0 */ const Word16 scale ); +#ifdef FIX_2455_HARMONIZE_configureFdCngEnc +void configureFdCngEnc_fx( + HANDLE_FD_CNG_ENC hsEnc, /* i/o: Contains the variables related to the FD-based CNG process */ + const Word16 bandwidth, /* i : bandwidth Q0 */ + const Word32 bitrate, /* i : bitrate Q0 */ + const Word16 element_mode /* i : element mode Q0 */ +); +#else void configureFdCngEnc_fx( HANDLE_FD_CNG_ENC hs, /* i/o: Contains the variables related to the CLDFB-based CNG process */ const Word16 bandwidth, /* i : bandwidth Q0*/ const Word32 bitrate /* Q0 */ ); +#endif /* Perform noise estimation */ void perform_noise_estimation_enc_fx( -- GitLab