From 5dbbe90e2f8384b63cc4a800268a3c2bdd18971f Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 12 Jan 2026 15:05:18 -0500 Subject: [PATCH 01/10] fix for 2334, removing duplicated and buggy function --- lib_com/options.h | 2 +- lib_enc/ivas_cpe_enc_fx.c | 4 ++++ lib_enc/ivas_ism_enc_fx.c | 5 ++++- lib_enc/ivas_sce_enc_fx.c | 5 ++++- lib_enc/prot_fx_enc.h | 3 ++- lib_enc/sig_clas_fx.c | 7 +++++-- 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index a24403788..995c12a81 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -116,7 +116,6 @@ #define FIX_2290_COPY_OF_UNINIT_DATA /* VA: prevent the copy of un-initialized data */ #define CLEANUP_ACELP_ENC /* VA: basop issue 2304: Remove duplicated code in excitation encoding in the ACELP core */ #define CLEANUP_VBR_CAM_ENC /* VA: basop issue 2299: Remove unused core-encoder VBR and CAM code */ - /* #################### End BE switches ################################## */ /* #################### Start NON-BE switches ############################ */ @@ -133,6 +132,7 @@ #define FIX_2285_CODE_DECODER_INIT_BW /* VA: basop issue 2285: fix core-decoder initialization bandwidth */ #define FIX_2306_MISSING_UPDATE_LOWRATE_PITCH_GAIN /* Dolby: Fix missing update of low-rate pitch gain in the S/M classifier */ #define FIX_2297_SBA_SCALING_32KHZ /* VA: basop issue 2297: Fix scaling factor before the SBA decoder for output_Fs = 32 or 16 */ +#define FIX_2334_HARM_CODER_MODIF /* VA: basop issue 2334: remove a duplicated and wrong function, might affect some cases of VBR */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index a610d0dfc..c3c871844 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -1096,7 +1096,11 @@ ivas_error ivas_cpe_enc_fx( IF( ( NE_16( hCPE->element_mode, IVAS_CPE_DFT ) && NE_16( hCPE->element_mode, IVAS_CPE_TD ) ) || n == 0 ) /* modify coder_type of primary channel */ { /* limit coder_type depending on the bitrate */ +#ifndef FIX_2334_HARM_CODER_MODIF coder_type_modif_ivas_fx( sts[n], relE_fx[n] ); +#else + coder_type_modif_fx( sts[n], relE_fx[n] ); +#endif } } diff --git a/lib_enc/ivas_ism_enc_fx.c b/lib_enc/ivas_ism_enc_fx.c index ea509dd10..727a083f3 100644 --- a/lib_enc/ivas_ism_enc_fx.c +++ b/lib_enc/ivas_ism_enc_fx.c @@ -450,8 +450,11 @@ ivas_error ivas_ism_enc_fx( } /* modify the coder_type depending on the total_brate per channel */ +#ifndef FIX_2334_HARM_CODER_MODIF coder_type_modif_ivas_fx( st, relE_fx[sce_id][0] ); - +#else + coder_type_modif_fx( st, relE_fx[sce_id][0] ); +#endif /*----------------------------------------------------------------* * Encoder *----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index 2457fef6e..c991d4cf9 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -343,8 +343,11 @@ ivas_error ivas_sce_enc_fx( move16(); /* modify the coder_type depending on the total_brate per channel */ +#ifndef FIX_2334_HARM_CODER_MODIF coder_type_modif_ivas_fx( st, relE_fx[0] ); - +#else + coder_type_modif_fx( st, relE_fx[0] ); +#endif /*----------------------------------------------------------------* * Encoder *----------------------------------------------------------------*/ diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index e16ae844b..f734830b5 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -1194,11 +1194,12 @@ void coder_type_modif_fx( const Word16 relE /* i : frame relative E to the long term average */ ); +#ifndef FIX_2334_HARM_CODER_MODIF void coder_type_modif_ivas_fx( Encoder_State *st, /* i/o: encoder state structure */ const Word16 relE /* i : frame relative E to the long term average */ ); - +#endif void speech_music_clas_init_fx( SP_MUS_CLAS_HANDLE hSpMusClas /* i/o: speech/music classifier handle */ ); diff --git a/lib_enc/sig_clas_fx.c b/lib_enc/sig_clas_fx.c index 990fad0db..a162a3de4 100644 --- a/lib_enc/sig_clas_fx.c +++ b/lib_enc/sig_clas_fx.c @@ -545,7 +545,7 @@ void select_TC_fx( * * Coder type modification *-------------------------------------------------------------------*/ - +#ifndef FIX_2334_HARM_CODER_MODIF void coder_type_modif_fx( Encoder_State *st, /* i/o: encoder state structure */ const Word16 relE /* i : frame relative E to the long term average Q8*/ @@ -636,7 +636,7 @@ void coder_type_modif_fx( hSC_VBR->vbr_generic_ho = 0; move16(); } - } + } // <<-- that bracket was wrongly placed hSC_VBR->last_7k2_coder_type = st->coder_type; move16(); test(); @@ -687,6 +687,9 @@ void coder_type_modif_fx( return; } void coder_type_modif_ivas_fx( +#else +void coder_type_modif_fx( +#endif Encoder_State *st, /* i/o: encoder state structure */ const Word16 relE /* i : frame relative E to the long term average */ ) -- GitLab From 4509b8640b96eeaf6ded80efb7a6b4df6316c5f7 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 12 Jan 2026 15:15:07 -0500 Subject: [PATCH 02/10] fix for 2334, removing duplicated and buggy function --- lib_enc/sig_clas_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/sig_clas_fx.c b/lib_enc/sig_clas_fx.c index a162a3de4..209319738 100644 --- a/lib_enc/sig_clas_fx.c +++ b/lib_enc/sig_clas_fx.c @@ -636,7 +636,7 @@ void coder_type_modif_fx( hSC_VBR->vbr_generic_ho = 0; move16(); } - } // <<-- that bracket was wrongly placed + } // <<-- that bracket was wrongly placed hSC_VBR->last_7k2_coder_type = st->coder_type; move16(); test(); -- GitLab From 07d4a911a3bf56c2dbafa1875ce954e8d8c5819d Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 12 Jan 2026 15:41:34 -0500 Subject: [PATCH 03/10] supplementary fixes --- lib_enc/vad_fx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_enc/vad_fx.c b/lib_enc/vad_fx.c index 4335225ca..9604b6697 100644 --- a/lib_enc/vad_fx.c +++ b/lib_enc/vad_fx.c @@ -745,8 +745,11 @@ Word16 wb_vad_fx( st_fx->max_band = 19; move16(); } - +#ifdef FIX_2334_HARM_CODER_MODIF + IF( st_fx->Opt_SC_VBR ) /* this keep 26.444 BE */ +#else IF( 1 ) // st_fx->Opt_SC_VBR ) /* this keep 26.444 BE */ +#endif { last_7k2_coder_type = st_fx->hSC_VBR->last_7k2_coder_type; move16(); -- GitLab From 5f0e5d8ca422d33950ee38e19a51f8d75b880056 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 12 Jan 2026 15:57:40 -0500 Subject: [PATCH 04/10] supplementary fixes --- lib_enc/vad_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/vad_fx.c b/lib_enc/vad_fx.c index 9604b6697..619452c50 100644 --- a/lib_enc/vad_fx.c +++ b/lib_enc/vad_fx.c @@ -746,7 +746,7 @@ Word16 wb_vad_fx( move16(); } #ifdef FIX_2334_HARM_CODER_MODIF - IF( st_fx->Opt_SC_VBR ) /* this keep 26.444 BE */ + IF( st_fx->Opt_SC_VBR ) /* this keep 26.444 BE */ #else IF( 1 ) // st_fx->Opt_SC_VBR ) /* this keep 26.444 BE */ #endif -- GitLab From 86e58077827dcbf8a8ebc457d9df064ffc88d951 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 13 Jan 2026 13:50:10 -0500 Subject: [PATCH 05/10] fixes to make EVS BE --- lib_enc/sig_clas_fx.c | 19 ++++++++++++++++++- lib_enc/vad_fx.c | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib_enc/sig_clas_fx.c b/lib_enc/sig_clas_fx.c index 209319738..d62b35a3e 100644 --- a/lib_enc/sig_clas_fx.c +++ b/lib_enc/sig_clas_fx.c @@ -777,7 +777,9 @@ void coder_type_modif_fx( hSC_VBR->vbr_generic_ho = 0; move16(); } - +#ifdef FIX_2334_HARM_CODER_MODIF + IF( NE_16( st->element_mode, EVS_MONO ) ) + { hSC_VBR->last_7k2_coder_type = st->coder_type; move16(); test(); @@ -787,6 +789,21 @@ void coder_type_modif_fx( move16(); } } +#endif + } +#ifdef FIX_2334_HARM_CODER_MODIF + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + hSC_VBR->last_7k2_coder_type = st->coder_type; + move16(); + test(); + if ( st->localVAD == 0 && EQ_16( st->coder_type, UNVOICED ) ) + { + hSC_VBR->last_7k2_coder_type = GENERIC; + move16(); + } + } +#endif IF( st->element_mode == 0 ) { diff --git a/lib_enc/vad_fx.c b/lib_enc/vad_fx.c index 619452c50..dc2144f1e 100644 --- a/lib_enc/vad_fx.c +++ b/lib_enc/vad_fx.c @@ -746,7 +746,7 @@ Word16 wb_vad_fx( move16(); } #ifdef FIX_2334_HARM_CODER_MODIF - IF( st_fx->Opt_SC_VBR ) /* this keep 26.444 BE */ + IF( st_fx->Opt_SC_VBR || ( !st_fx->Opt_SC_VBR && st_fx->element_mode == EVS_MONO ) ) /* this keep 26.444 BE */ #else IF( 1 ) // st_fx->Opt_SC_VBR ) /* this keep 26.444 BE */ #endif -- GitLab From adaca3cdc36ce21302d2761bd74769a6730abadd Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 13 Jan 2026 13:53:07 -0500 Subject: [PATCH 06/10] fixes clang format --- lib_enc/sig_clas_fx.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib_enc/sig_clas_fx.c b/lib_enc/sig_clas_fx.c index d62b35a3e..d97cd8bc4 100644 --- a/lib_enc/sig_clas_fx.c +++ b/lib_enc/sig_clas_fx.c @@ -780,15 +780,15 @@ void coder_type_modif_fx( #ifdef FIX_2334_HARM_CODER_MODIF IF( NE_16( st->element_mode, EVS_MONO ) ) { - hSC_VBR->last_7k2_coder_type = st->coder_type; - move16(); - test(); - if ( st->localVAD == 0 && EQ_16( st->coder_type, UNVOICED ) ) - { - hSC_VBR->last_7k2_coder_type = GENERIC; + hSC_VBR->last_7k2_coder_type = st->coder_type; move16(); + test(); + if ( st->localVAD == 0 && EQ_16( st->coder_type, UNVOICED ) ) + { + hSC_VBR->last_7k2_coder_type = GENERIC; + move16(); + } } - } #endif } #ifdef FIX_2334_HARM_CODER_MODIF -- GitLab From 8e5ecba6e7e0778d7b1555668d6bf3e3201d3b31 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 14 Jan 2026 07:40:41 -0500 Subject: [PATCH 07/10] remove unneeded comment --- lib_enc/sig_clas_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/sig_clas_fx.c b/lib_enc/sig_clas_fx.c index d97cd8bc4..29d4f3bd3 100644 --- a/lib_enc/sig_clas_fx.c +++ b/lib_enc/sig_clas_fx.c @@ -636,7 +636,7 @@ void coder_type_modif_fx( hSC_VBR->vbr_generic_ho = 0; move16(); } - } // <<-- that bracket was wrongly placed + } hSC_VBR->last_7k2_coder_type = st->coder_type; move16(); test(); -- GitLab From 6c7cb79d8e07a5e79851bd11760477212e214aa1 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 14 Jan 2026 07:48:20 -0500 Subject: [PATCH 08/10] fix clang-format --- lib_enc/sig_clas_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/sig_clas_fx.c b/lib_enc/sig_clas_fx.c index 29d4f3bd3..b4d41c405 100644 --- a/lib_enc/sig_clas_fx.c +++ b/lib_enc/sig_clas_fx.c @@ -636,7 +636,7 @@ void coder_type_modif_fx( hSC_VBR->vbr_generic_ho = 0; move16(); } - } + } hSC_VBR->last_7k2_coder_type = st->coder_type; move16(); test(); -- GitLab From 85f8fc0d3dccdfd27b81edc4e97cbb31c47d41d2 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 15 Jan 2026 08:23:02 -0500 Subject: [PATCH 09/10] add missing switch --- 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 4a272cf24..bd6baedbc 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -123,8 +123,8 @@ #define CLEANUP_HQ_CORE /* VA: basop issue 2300: Remove unused code in core-coder: HQ core */ #define REMOVE_UNUSED_CODE_IVAS_DEC /* VA: remove unused code in ivas_jbm_dec_tc_fx() */ #define FIX_2294_CLANG_18_WARNINGS_ENC /* VA: Fix some encoder clang-18 warnings, desc. in 2294 */ -#define REMOVE_CAM_FROM_IVAS /* VA: basop issue 210: remove obsoelte CAM code from IVAS */ - +#define REMOVE_CAM_FROM_IVAS /* VA: basop issue 210: remove obsolete CAM code from IVAS */ +#define FIX_2334_HARM_CODER_MODIF /* VA: basop issue 2334 : harmonizing coder_modif_function */ /* #################### End BE switches ################################## */ /* #################### Start NON-BE switches ############################ */ -- GitLab From 6bb393949099b721944dbcea1219a02c54a6b963 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 20 Jan 2026 13:25:13 +0100 Subject: [PATCH 10/10] fix merge --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8390207a5..b1c205129 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -104,7 +104,6 @@ #define HARM_PREPROC /* VA: basop issue 2339: Remove duplicated code in the core-coder DTX */ #define HARM_NON_LINEARITY /* VA: basop issue 2345: Remove duplicated code in core-coder: non_linearity_fx() and LP CNG */ #define FIX_2344_ALIGN_PREPROC /* VA: basop issue 2344: Align pre_proc_ivas() between FLP and BASOP */ -#define REMOVE_CAM_FROM_IVAS /* VA: basop issue 210: remove obsolete CAM code from IVAS */ #define FIX_2334_HARM_CODER_MODIF /* VA: basop issue 2334 : harmonizing coder_modif_function */ /* #################### End BE switches ################################## */ -- GitLab