From a4f44d74c30a6863c8690f34e3faf8c6ee1e4f18 Mon Sep 17 00:00:00 2001 From: Tommy Date: Thu, 23 Apr 2026 11:22:09 -0400 Subject: [PATCH 1/5] align float and fix conditions --- lib_com/options.h | 1 + lib_dec/FEC_scale_syn_fx.c | 4 ++++ lib_dec/core_switching_dec_fx.c | 4 ++++ lib_dec/dec_uv_fx.c | 9 ++++++--- lib_enc/ivas_stereo_td_analysis_fx.c | 4 ++++ lib_enc/ivas_stereo_td_enc_fx.c | 4 ++++ 6 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index ed11ab3cf..bff5cb465 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -132,6 +132,7 @@ #define FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC /* VA : Basop issue 2547: Align conditions in core sw dec */ #define FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC_EVS /* VA : Basop issue 2547: Align conditions in core sw dec, condition that could affect EVS as well, but adapted to keep EVS BE */ +#define FIX_2556_ALIGN_CONDITIONS /* VA: Fix different conditions that were not exact between float and fix, BE on self-test */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/FEC_scale_syn_fx.c b/lib_dec/FEC_scale_syn_fx.c index 32d7b569a..7bd4a6e14 100644 --- a/lib_dec/FEC_scale_syn_fx.c +++ b/lib_dec/FEC_scale_syn_fx.c @@ -265,7 +265,11 @@ void FEC_scale_syn_fx( ener_max = *lp_ener_FEC_max; /*Q0*/ move32(); test(); +#ifdef FIX_2556_ALIGN_CONDITIONS + if ( LE_16( clas, VOICED_TRANSITION ) || ( GE_16( clas, INACTIVE_CLAS ) ) ) +#else if ( EQ_16( clas, VOICED_TRANSITION ) || ( GE_16( clas, INACTIVE_CLAS ) ) ) +#endif { ener_max = *lp_ener_FEC_av; /*Q0*/ move32(); diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 347898801..a694ddd28 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1853,7 +1853,11 @@ ivas_error core_switching_pre_dec_fx( { hHQ_core->pastpre = sub( hHQ_core->pastpre, 1 ); move16(); +#ifdef FIX_2556_ALIGN_CONDITIONS + IF( hHQ_core->pastpre <= 0 ) +#else IF( hHQ_core->pastpre < 0 ) +#endif { reset_preecho_dec_fx( hHQ_core ); } diff --git a/lib_dec/dec_uv_fx.c b/lib_dec/dec_uv_fx.c index a2d59c08a..dfc63c8e0 100644 --- a/lib_dec/dec_uv_fx.c +++ b/lib_dec/dec_uv_fx.c @@ -182,9 +182,12 @@ void decod_unvoiced_fx( } voice_factors_fx[tmp_idx] = 0; move16(); - - interp_code_5over2_fx( &exc_fx[i_subfr_fx], &bwe_exc_fx[( ( i_subfr_fx * 2 * HIBND_ACB_L_FAC ) >> 1 )], L_SUBFR ); - +#ifdef FIX_2556_ALIGN_CONDITIONS + IF ( st_fx->hBWE_TD != NULL ) +#endif + { + interp_code_5over2_fx( &exc_fx[i_subfr_fx], &bwe_exc_fx[( ( i_subfr_fx * 2 * HIBND_ACB_L_FAC ) >> 1 )], L_SUBFR ); + } p_Aq_fx += ( M + 1 ); pt_pitch_fx++; st_fx->tilt_code_dec_fx[tmp_idx] = st_fx->tilt_code_fx; diff --git a/lib_enc/ivas_stereo_td_analysis_fx.c b/lib_enc/ivas_stereo_td_analysis_fx.c index 61aa03ab8..2d89485db 100644 --- a/lib_enc/ivas_stereo_td_analysis_fx.c +++ b/lib_enc/ivas_stereo_td_analysis_fx.c @@ -242,7 +242,11 @@ Word16 stereo_tdm_ener_analysis_fx( { test(); test(); +#ifdef FIX_2556_ALIGN_CONDITIONS + if ( ( EQ_16( hCPE->hStereoClassif->lrtd_mode, 1 ) || EQ_16( hCPE->hStereoTD->prev_fr_LRTD_TD_dec, 1 ) ) && ( LT_32( L_add( L_sub( hCPE->element_brate, 50 * FRAMES_PER_SEC ), L_add( hCPE->brate_surplus, hCPE->brate_surplus ) ), IVAS_BRATE_OMASA_STEREO_SW_THR ) ) ) +#else if ( ( EQ_16( hCPE->hStereoClassif->lrtd_mode, 1 ) || EQ_16( hCPE->hStereoTD->prev_fr_LRTD_TD_dec, 1 ) ) && ( LE_32( L_add( L_sub( hCPE->element_brate, 50 * FRAMES_PER_SEC ), L_add( hCPE->brate_surplus, hCPE->brate_surplus ) ), IVAS_BRATE_OMASA_STEREO_SW_THR ) ) ) +#endif { hStereoTD->prev_fr_LRTD_TD_dec = 0; move16(); diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index 0066efbe4..ac669a970 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -638,7 +638,11 @@ void tdm_configure_enc_fx( test(); IF( EQ_16( sts[0]->coder_type, GENERIC ) && EQ_16( loc_coder_tyape_raw0, UNVOICED ) ) { +#ifdef FIX_2556_ALIGN_CONDITIONS + if ( LE_32( sts[0]->total_brate, MAX_UNVOICED_BRATE ) ) +#else if ( LT_32( sts[0]->total_brate, MAX_UNVOICED_BRATE ) ) +#endif { sts[0]->coder_type = UNVOICED; move16(); -- GitLab From 2dbca67c6d3777b6afec37a2cd6817821bcf5a90 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 11 May 2026 09:05:04 -0400 Subject: [PATCH 2/5] editorial changes --- lib_com/options.h | 2 +- lib_dec/dec_uv_fx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index ac5124fb5..242a02acd 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -135,7 +135,7 @@ #define FIX_1559 /* Eri/FhG: fix for Issue 1559 in FD CNG with bitrate/bw switching */ #define NONBE_FIX_2575 /* Fhg: Fix issue 2575, precision loss in FD CNG */ -#define FIX_2556_ALIGN_CONDITIONS /* VA: Fix different conditions that were not exact between float and fix, BE on self-test */ +#define FIX_2556_ALIGN_CONDITIONS /* VA: Fix different conditions that were not exact between float and fix, BE on self-test */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/dec_uv_fx.c b/lib_dec/dec_uv_fx.c index dfc63c8e0..0123f07ed 100644 --- a/lib_dec/dec_uv_fx.c +++ b/lib_dec/dec_uv_fx.c @@ -183,7 +183,7 @@ void decod_unvoiced_fx( voice_factors_fx[tmp_idx] = 0; move16(); #ifdef FIX_2556_ALIGN_CONDITIONS - IF ( st_fx->hBWE_TD != NULL ) + IF( bwe_exc_fx != NULL ) #endif { interp_code_5over2_fx( &exc_fx[i_subfr_fx], &bwe_exc_fx[( ( i_subfr_fx * 2 * HIBND_ACB_L_FAC ) >> 1 )], L_SUBFR ); -- GitLab From c2c536669c1b70c43d7523859e9add33a76e54dd Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 11 May 2026 09:07:23 -0400 Subject: [PATCH 3/5] fix clang --- lib_dec/FEC_scale_syn_fx.c | 2 +- lib_dec/core_switching_dec_fx.c | 4 ++-- lib_dec/dec_uv_fx.c | 2 +- lib_enc/ivas_stereo_td_analysis_fx.c | 6 +++--- lib_enc/ivas_stereo_td_enc_fx.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_dec/FEC_scale_syn_fx.c b/lib_dec/FEC_scale_syn_fx.c index 7bd4a6e14..34c905110 100644 --- a/lib_dec/FEC_scale_syn_fx.c +++ b/lib_dec/FEC_scale_syn_fx.c @@ -269,7 +269,7 @@ void FEC_scale_syn_fx( if ( LE_16( clas, VOICED_TRANSITION ) || ( GE_16( clas, INACTIVE_CLAS ) ) ) #else if ( EQ_16( clas, VOICED_TRANSITION ) || ( GE_16( clas, INACTIVE_CLAS ) ) ) -#endif +#endif { ener_max = *lp_ener_FEC_av; /*Q0*/ move32(); diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index adeb77923..913611eae 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1840,9 +1840,9 @@ ivas_error core_switching_pre_dec_fx( move16(); #ifdef FIX_2556_ALIGN_CONDITIONS IF( hHQ_core->pastpre <= 0 ) -#else +#else IF( hHQ_core->pastpre < 0 ) -#endif +#endif { reset_preecho_dec_fx( hHQ_core ); } diff --git a/lib_dec/dec_uv_fx.c b/lib_dec/dec_uv_fx.c index 0123f07ed..29698d5e2 100644 --- a/lib_dec/dec_uv_fx.c +++ b/lib_dec/dec_uv_fx.c @@ -185,7 +185,7 @@ void decod_unvoiced_fx( #ifdef FIX_2556_ALIGN_CONDITIONS IF( bwe_exc_fx != NULL ) #endif - { + { interp_code_5over2_fx( &exc_fx[i_subfr_fx], &bwe_exc_fx[( ( i_subfr_fx * 2 * HIBND_ACB_L_FAC ) >> 1 )], L_SUBFR ); } p_Aq_fx += ( M + 1 ); diff --git a/lib_enc/ivas_stereo_td_analysis_fx.c b/lib_enc/ivas_stereo_td_analysis_fx.c index 2d89485db..97b1e62bf 100644 --- a/lib_enc/ivas_stereo_td_analysis_fx.c +++ b/lib_enc/ivas_stereo_td_analysis_fx.c @@ -242,11 +242,11 @@ Word16 stereo_tdm_ener_analysis_fx( { test(); test(); -#ifdef FIX_2556_ALIGN_CONDITIONS +#ifdef FIX_2556_ALIGN_CONDITIONS if ( ( EQ_16( hCPE->hStereoClassif->lrtd_mode, 1 ) || EQ_16( hCPE->hStereoTD->prev_fr_LRTD_TD_dec, 1 ) ) && ( LT_32( L_add( L_sub( hCPE->element_brate, 50 * FRAMES_PER_SEC ), L_add( hCPE->brate_surplus, hCPE->brate_surplus ) ), IVAS_BRATE_OMASA_STEREO_SW_THR ) ) ) -#else +#else if ( ( EQ_16( hCPE->hStereoClassif->lrtd_mode, 1 ) || EQ_16( hCPE->hStereoTD->prev_fr_LRTD_TD_dec, 1 ) ) && ( LE_32( L_add( L_sub( hCPE->element_brate, 50 * FRAMES_PER_SEC ), L_add( hCPE->brate_surplus, hCPE->brate_surplus ) ), IVAS_BRATE_OMASA_STEREO_SW_THR ) ) ) -#endif +#endif { hStereoTD->prev_fr_LRTD_TD_dec = 0; move16(); diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index df4551ab7..dd817a415 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -643,9 +643,9 @@ void tdm_configure_enc_fx( { #ifdef FIX_2556_ALIGN_CONDITIONS if ( LE_32( sts[0]->total_brate, MAX_UNVOICED_BRATE ) ) -#else +#else if ( LT_32( sts[0]->total_brate, MAX_UNVOICED_BRATE ) ) -#endif +#endif { sts[0]->coder_type = UNVOICED; move16(); -- GitLab From aee97ab3d1d656a11533aca3a810261e8d2bc0e0 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Mon, 11 May 2026 09:34:12 -0400 Subject: [PATCH 4/5] fixing EVS BE issue --- lib_dec/FEC_scale_syn_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/FEC_scale_syn_fx.c b/lib_dec/FEC_scale_syn_fx.c index 34c905110..fc9b1bc4b 100644 --- a/lib_dec/FEC_scale_syn_fx.c +++ b/lib_dec/FEC_scale_syn_fx.c @@ -266,7 +266,7 @@ void FEC_scale_syn_fx( move32(); test(); #ifdef FIX_2556_ALIGN_CONDITIONS - if ( LE_16( clas, VOICED_TRANSITION ) || ( GE_16( clas, INACTIVE_CLAS ) ) ) + if ( ( LE_16( clas, VOICED_TRANSITION ) && element_mode > EVS_MONO ) || EQ_16( clas, VOICED_TRANSITION ) || ( GE_16( clas, INACTIVE_CLAS ) ) ) #else if ( EQ_16( clas, VOICED_TRANSITION ) || ( GE_16( clas, INACTIVE_CLAS ) ) ) #endif -- GitLab From c727e2eba3f3c78851f4e17d1ab10c483e317cae Mon Sep 17 00:00:00 2001 From: Tommy Date: Mon, 11 May 2026 15:22:36 -0400 Subject: [PATCH 5/5] small improvment --- lib_dec/dec_uv_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/dec_uv_fx.c b/lib_dec/dec_uv_fx.c index 29698d5e2..3bdb5e106 100644 --- a/lib_dec/dec_uv_fx.c +++ b/lib_dec/dec_uv_fx.c @@ -183,7 +183,7 @@ void decod_unvoiced_fx( voice_factors_fx[tmp_idx] = 0; move16(); #ifdef FIX_2556_ALIGN_CONDITIONS - IF( bwe_exc_fx != NULL ) + IF( st_fx->hBWE_TD != NULL ) #endif { interp_code_5over2_fx( &exc_fx[i_subfr_fx], &bwe_exc_fx[( ( i_subfr_fx * 2 * HIBND_ACB_L_FAC ) >> 1 )], L_SUBFR ); -- GitLab