From bb7690c1d4c2efcad7fe61a32ddca7236b3da5b3 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 1 Apr 2026 12:29:18 +0200 Subject: [PATCH 1/4] checkin configureFdCngDec_fx harmonized --- lib_com/ivas_prot_fx.h | 2 ++ lib_com/options.h | 1 + lib_com/prot_fx.h | 12 ++++++++ lib_dec/core_switching_dec_fx.c | 4 +++ lib_dec/fd_cng_dec_fx.c | 37 +++++++++++++++++++----- lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 11 +++++++ lib_dec/ivas_stereo_switching_dec_fx.c | 5 +++- 7 files changed, 63 insertions(+), 9 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index f9dd86e4c..d11748117 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1616,6 +1616,7 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( const Word16 nchan_in /* i : number of input channels */ ); +#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC void configureFdCngDec_ivas_fx( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bwidth, @@ -1624,6 +1625,7 @@ void configureFdCngDec_ivas_fx( const Word16 last_L_frame, const Word16 element_mode ); +#endif void synchonize_channels_mdct_sid_fx( Decoder_State *sts[CPE_CHANNELS], /* i/o: decoder state structure */ diff --git a/lib_com/options.h b/lib_com/options.h index 7976d55ed..13e7b27f7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -90,6 +90,7 @@ #define FIX_2479_HARM_PITCH_GAIN /* FhG: basop issue 2479: Harmonize tcx_ltp_pitch_search_*(), tcx_ltp_find_gain_*fx() */ #define HARMONIZE_2481_EXTEND_SHRINK /* FhG: basop issue 2481: Harmonize extend_frm_*fx() and shrink_frm_*fx() */ #define FIX_FLOAT_ISSUE_1546_DEAD_CODE /* FhG: remove dead code reported in the issue*/ +#define HARMONIZE_2499_CONFIGUREFDCNGDEC /* FhG: basop issue 2499: harmonoize configureFdCngDec */ /* #################### End BE switches ################################## */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 346bedd07..c53efb651 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -6547,6 +6547,7 @@ void initFdCngDec_fx( void deleteFdCngDec_fx( HANDLE_FD_CNG_DEC *hFdCngDec ); +#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC /* Configure CLDFB-CNG */ void configureFdCngDec_fx( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the CLDFB-based CNG process */ @@ -6555,6 +6556,15 @@ void configureFdCngDec_fx( Word16 L_frame, const Word16 Last_L_frame, const Word16 element_mode ); +#else +void configureFdCngDec_fx( + HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ + const Word16 bwidth, + const Word32 total_brate, + const Word16 L_frame, + const Word16 last_L_frame, + const Word16 element_mode ); +#endif Word16 ApplyFdCng_fx( Word16 *timeDomainInput, /* i : pointer to time domain input */ @@ -8543,6 +8553,7 @@ void v_mult16_fx( const Word16 N /* i : Vector length */ ); +#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC void configureFdCngDec_fx( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bwidth, @@ -8550,6 +8561,7 @@ void configureFdCngDec_fx( const Word16 L_frame, const Word16 last_L_frame, const Word16 element_mode ); +#endif Word32 sum2_f_16_fx( const Word16 *vec, /* i : input vector */ diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index b4f34830d..595956916 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1893,7 +1893,11 @@ ivas_error core_switching_pre_dec_fx( } ELSE { +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC + configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); +#else configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); +#endif } } ELSE diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 901d2c5cb..509538bac 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -199,6 +199,7 @@ void initFdCngDec_fx( return; } +#ifndef HARMONIZE_2499_CONFIGUREFDCNGDEC /* configureFdCngDec_fx @@ -424,6 +425,7 @@ void configureFdCngDec_fx( hsCom->frameSize = shr( hsCom->fftlen, 1 ); move16(); } +#endif /* @@ -4097,7 +4099,11 @@ void generate_masking_noise_mdct_ivas_fx( * * Initialize an instance of type FD_CNG *-------------------------------------------------------------------*/ +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC +void configureFdCngDec_fx( +#else void configureFdCngDec_ivas_fx( +#endif HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bwidth, /*Q0*/ const Word32 total_brate, /*Q0*/ @@ -4282,24 +4288,39 @@ void configureFdCngDec_ivas_fx( hFdCngDec->nFFTpart_shaping = hFdCngDec->npart_shaping; /*Q0*/ move16(); - BASOP_getTables( &hsCom->olapWinAna, NULL, NULL, shr( hsCom->fftlen, 1 ) ); - BASOP_getTables( &hsCom->olapWinSyn, NULL, NULL, shr( hsCom->fftlen, 2 ) ); +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC + IF( element_mode > EVS_MONO ) + { + BASOP_getTables( &hsCom->olapWinAna, NULL, NULL, shr( hsCom->fftlen, 1 ) ); + BASOP_getTables( &hsCom->olapWinSyn, NULL, NULL, shr( hsCom->fftlen, 2 ) ); + } +#endif SWITCH( hsCom->fftlen ) { case 512: - hsCom->olapWinAna_fx = olapWinAna512_fx; /*Q30*/ - hsCom->fftSineTab_fx = NULL; - hsCom->olapWinSyn_fx = olapWinSyn256_fx; /*Q15*/ +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC + IF( element_mode > EVS_MONO ) + { + hsCom->olapWinAna_fx = olapWinAna512_fx; /*Q30*/ + hsCom->fftSineTab_fx = NULL; + hsCom->olapWinSyn_fx = olapWinSyn256_fx; /*Q15*/ + } +#endif hsCom->fftlenShift = 8; move16(); hsCom->fftlenFac = 32767 /*1.0 Q15*/; move16(); BREAK; case 640: - hsCom->olapWinAna_fx = olapWinAna640_fx; /*Q30*/ - hsCom->fftSineTab_fx = fftSineTab640_fx; /*Q15*/ - hsCom->olapWinSyn_fx = olapWinSyn320_fx; /*Q15*/ +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC + IF( element_mode > EVS_MONO ) + { + hsCom->olapWinAna_fx = olapWinAna640_fx; /*Q30*/ + hsCom->fftSineTab_fx = fftSineTab640_fx; /*Q15*/ + hsCom->olapWinSyn_fx = olapWinSyn320_fx; /*Q15*/ + } +#endif hsCom->fftlenShift = 9; move16(); hsCom->fftlenFac = 20480 /*0.625 Q15*/; diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index 654f2bd13..29df46c61 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -37,6 +37,9 @@ #include "prot_fx.h" #include "wmc_auto.h" #include "ivas_prot_fx.h" +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC +#include "prot_fx.h" +#endif /*-------------------------------------------------------------------* @@ -641,14 +644,22 @@ void synchonize_channels_mdct_sid_fx( test(); IF( EQ_16( sts[0]->first_CNG, 1 ) && EQ_16( sts[1]->first_CNG, 0 ) ) { +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC + configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); +#else configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); +#endif } } IF( sts[0]->first_CNG == 0 ) { /* configure CNG after reading first side info from SID to get correct values for L_frame and bwidth if first SID is also first valid frame */ +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC + configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); +#else configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); +#endif } } diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index 63e9e792e..679d43f40 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -650,8 +650,11 @@ ivas_error stereo_memory_dec_fx( } initFdCngDec_fx( st, st->cldfbSyn->scale ); - +#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC + configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); +#else configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); +#endif } /* allocate stereo CNG structure */ -- GitLab From 9b3184efdbac1efb522f7e59ee5c9a8446e04a22 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Wed, 1 Apr 2026 12:42:05 +0200 Subject: [PATCH 2/4] clang format patch --- lib_dec/fd_cng_dec_fx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 509538bac..2c5f96dba 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -4314,12 +4314,12 @@ void configureFdCngDec_ivas_fx( BREAK; case 640: #ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC - IF( element_mode > EVS_MONO ) - { - hsCom->olapWinAna_fx = olapWinAna640_fx; /*Q30*/ - hsCom->fftSineTab_fx = fftSineTab640_fx; /*Q15*/ - hsCom->olapWinSyn_fx = olapWinSyn320_fx; /*Q15*/ - } + IF( element_mode > EVS_MONO ) + { + hsCom->olapWinAna_fx = olapWinAna640_fx; /*Q30*/ + hsCom->fftSineTab_fx = fftSineTab640_fx; /*Q15*/ + hsCom->olapWinSyn_fx = olapWinSyn320_fx; /*Q15*/ + } #endif hsCom->fftlenShift = 9; move16(); -- GitLab From f7a25ea8f4494b9945036d2ab9a9319f7bfcd2d8 Mon Sep 17 00:00:00 2001 From: Fabian Bauer Date: Thu, 2 Apr 2026 08:41:03 +0000 Subject: [PATCH 3/4] use basop comparators for enums/defines --- lib_dec/fd_cng_dec_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 2c5f96dba..84d0ddbe9 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -4289,7 +4289,7 @@ void configureFdCngDec_ivas_fx( move16(); #ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC - IF( element_mode > EVS_MONO ) + IF( GT_16( element_mode, EVS_MONO ) ) { BASOP_getTables( &hsCom->olapWinAna, NULL, NULL, shr( hsCom->fftlen, 1 ) ); BASOP_getTables( &hsCom->olapWinSyn, NULL, NULL, shr( hsCom->fftlen, 2 ) ); @@ -4300,7 +4300,7 @@ void configureFdCngDec_ivas_fx( { case 512: #ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC - IF( element_mode > EVS_MONO ) + IF( GT_16( element_mode, EVS_MONO ) ) { hsCom->olapWinAna_fx = olapWinAna512_fx; /*Q30*/ hsCom->fftSineTab_fx = NULL; @@ -4314,7 +4314,7 @@ void configureFdCngDec_ivas_fx( BREAK; case 640: #ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC - IF( element_mode > EVS_MONO ) + IF( GT_16( element_mode, EVS_MONO ) ) { hsCom->olapWinAna_fx = olapWinAna640_fx; /*Q30*/ hsCom->fftSineTab_fx = fftSineTab640_fx; /*Q15*/ -- GitLab From ea9255c293577c347164d2fb04ac854c8a03abe6 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 13 Apr 2026 16:21:44 +0200 Subject: [PATCH 4/4] smaller improvements --- lib_dec/fd_cng_dec_fx.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 3c369aba2..920275acf 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -4337,16 +4337,13 @@ void configureFdCngDec_ivas_fx( ELSE IF( EQ_32( hsCom->CngBitrate, -1 ) ) { /* set minimum active CBR bitrate IF CngBitrate is uninitialized */ - IF( element_mode > EVS_MONO ) + hsCom->CngBitrate = ACELP_7k20; + move32(); + if ( GT_16( element_mode, EVS_MONO ) ) { hsCom->CngBitrate = IVAS_13k2; move32(); } - ELSE - { - hsCom->CngBitrate = ACELP_7k20; - move32(); - } } /* FD-CNG config for MDCT-Stereo is always the same (since for > 48 kbps only) */ @@ -4495,14 +4492,6 @@ void configureFdCngDec_ivas_fx( hFdCngDec->nFFTpart_shaping = hFdCngDec->npart_shaping; /*Q0*/ move16(); -#ifdef HARMONIZE_2499_CONFIGUREFDCNGDEC - IF( GT_16( element_mode, EVS_MONO ) ) - { - BASOP_getTables( &hsCom->olapWinAna, NULL, NULL, shr( hsCom->fftlen, 1 ) ); - BASOP_getTables( &hsCom->olapWinSyn, NULL, NULL, shr( hsCom->fftlen, 2 ) ); - } -#endif - SWITCH( hsCom->fftlen ) { case 512: @@ -4537,6 +4526,7 @@ void configureFdCngDec_ivas_fx( assert( !"Unsupported FFT length for FD-based CNG" ); BREAK; } + BASOP_getTables( &hsCom->olapWinAna, NULL, NULL, shr( hsCom->fftlen, 1 ) ); BASOP_getTables( &hsCom->olapWinSyn, NULL, NULL, shr( hsCom->fftlen, 2 ) ); hsCom->frameSize = shr( hsCom->fftlen, 1 ); -- GitLab