From fc156be682c840d9b3afd44e40d7c68bb3f2633e Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 16 Feb 2026 10:42:19 +0100 Subject: [PATCH 01/44] issue: 2446 changes regarding possible previous harmonization efforts --- lib_com/options.h | 2 +- lib_dec/ivas_tcx_core_dec_fx.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6f0d8e55e..663c0a0a8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,7 +92,7 @@ #define HARM_FD_BWE /* VA: harmonize core-coder FD BWE function duplications */ #define FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT /* FhG: basop issue 2411: harmonize TNSAnalysis*_fx(), DetectTnsFilt*_fx()*/ #define HARMONIZE_READ_DECODE_TNS /* FhG basop 2389: Harm between two pairs of functions. */ - +#define HARMONIZE_2446_CON_TCX_FX /* FhG: basop issue 2446 harmonization of functions con_tcx_fx() and con_tcx_ivas_fx()*/ /* #################### End BE switches ################################## */ /* #################### Start NON-BE switches ############################ */ diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index 4a57618e5..20abacdce 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -488,7 +488,13 @@ void stereo_tcx_core_dec_fx( } /* PLC: [TCX: TD PLC] */ - con_tcx_fx( st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */ ); +#ifndef HARMONIZE_2446_CON_TCX_FX + con_tcx_fx(st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */); +#else + con_tcx_ivas_fx(st, &synthFB_fx[0] , -1.f, NULL, 0, NULL ); +#endif // !HARMONIZE_2446_CON_TCX_FX + + test(); IF( ( EQ_16( st->nbLostCmpt, 1 ) ) || hTcxDec->tcxConceal_recalc_exc ) { -- GitLab From 85f781927e81d88e9b92c48892a84a5f8274780f Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 16 Feb 2026 10:46:30 +0100 Subject: [PATCH 02/44] issue: 2446 Clang formatting --- lib_dec/ivas_tcx_core_dec_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index 20abacdce..2b82c9aed 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -489,12 +489,12 @@ void stereo_tcx_core_dec_fx( /* PLC: [TCX: TD PLC] */ #ifndef HARMONIZE_2446_CON_TCX_FX - con_tcx_fx(st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */); + con_tcx_fx( st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */ ); #else - con_tcx_ivas_fx(st, &synthFB_fx[0] , -1.f, NULL, 0, NULL ); + con_tcx_ivas_fx( st, &synthFB_fx[0], -1.f, NULL, 0, NULL ); #endif // !HARMONIZE_2446_CON_TCX_FX - + test(); IF( ( EQ_16( st->nbLostCmpt, 1 ) ) || hTcxDec->tcxConceal_recalc_exc ) { -- GitLab From ae14de2a12eb7b0953c6951611a5ac987db01c62 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 16 Feb 2026 11:01:39 +0100 Subject: [PATCH 03/44] issue: 2446 replacing floating point value with the equivalent fixed point --- lib_dec/ivas_tcx_core_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index 2b82c9aed..9bb686342 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -491,7 +491,7 @@ void stereo_tcx_core_dec_fx( #ifndef HARMONIZE_2446_CON_TCX_FX con_tcx_fx( st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */ ); #else - con_tcx_ivas_fx( st, &synthFB_fx[0], -1.f, NULL, 0, NULL ); + con_tcx_ivas_fx( st, &synthFB_fx[0], -16384, NULL, 0, NULL ); #endif // !HARMONIZE_2446_CON_TCX_FX -- GitLab From 98177ffbda1ce7aac06448f40eb03e8bf821a9d2 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Wed, 18 Feb 2026 15:49:03 +0100 Subject: [PATCH 04/44] issue: 2446 reverting some previous changes - going through all the function with various points changed - checking to see if the IVAS function runs the same in currently implemented instances. --- lib_dec/er_dec_tcx_fx.c | 219 +++++++++++++++++++++++++++++---- lib_dec/ivas_tcx_core_dec_fx.c | 6 - 2 files changed, 193 insertions(+), 32 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 9c73fcdf6..ca553f263 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1048,8 +1048,19 @@ void con_tcx_ivas_fx( /* apply pre-emphasis to the signal */ mem = shl( synth[( -( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + M + M ) - 1 )], st->Q_syn_factor ); move16(); - Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 ); +#ifndef HARMONIZE_2446_CON_TCX_FX + Q_exc = E_UTIL_f_preemph3_ivas_fx(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), st->preemph_fac, add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl(M, 1)), &mem, 1); +#else + IF(NE_16(st->element_mode, EVS_MONO)) { + Q_exc = E_UTIL_f_preemph3_ivas_fx(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), st->preemph_fac, add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl(M, 1)), &mem, 1); + } + ELSE{ + Q_exc = E_UTIL_f_preemph3(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), st->preemph_fac, add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl(M, 1)), &mem, 1); + } +#endif // !HARMONIZE_2446_CON_TCX_FX + + scale_sig( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ st->Mode2_lp_gainc = L_deposit_l( 0 ); @@ -1074,8 +1085,19 @@ void con_tcx_ivas_fx( lag_wind( r_h, r_l, M, st->output_Fs, LAGW_STRONG ); /* Levinson Durbin */ - E_LPC_lev_dur_ivas_fx( r_h, r_l, A_local, NULL, M, NULL ); +#ifndef HARMONIZE_2446_CON_TCX_FX + E_LPC_lev_dur_ivas_fx(r_h, r_l, A_local, NULL, M, NULL); +#else + IF(NE_16(st->element_mode, EVS_MONO)) { + E_LPC_lev_dur_ivas_fx(r_h, r_l, A_local, NULL, M, NULL); + } + ELSE{ + E_LPC_lev_dur_fx(r_h, r_l, A_local, NULL, M, NULL); + } +#endif // !HARMONIZE_2446_CON_TCX_FX + + /* copy for multiple frame loss */ Copy( A_local, st->old_Aq_12_8_fx, M + 1 ); /*Q14*/ @@ -1096,14 +1118,31 @@ void con_tcx_ivas_fx( /* apply pre-emphasis to the signal */ mem = shl( synth[( -L_frame - 1 )], st->Q_syn_factor ); /*hTcxDec->Q_synth_factor_old*/ move16(); - Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-L_frame] ), st->preemph_fac, L_frame, &mem, 1 ); - scale_sig( &synth[-L_frame], L_frame, negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ +#ifndef HARMONIZE_2446_CON_TCX_FX + Q_exc = E_UTIL_f_preemph3_ivas_fx(&(synth[-L_frame]), st->preemph_fac, L_frame, &mem, 1); + scale_sig(&synth[-L_frame], L_frame, negate(st->Q_syn_factor)); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ + +#else + IF(NE_16(st->element_mode, EVS_MONO)) { + Q_exc = E_UTIL_f_preemph3_ivas_fx(&(synth[-L_frame]), st->preemph_fac, L_frame, &mem, 1); + scale_sig(&synth[-L_frame], L_frame, negate(st->Q_syn_factor)); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ + } + ELSE{ + Q_exc = E_UTIL_f_preemph3(&(synth[-L_frame]), st->preemph_fac, L_frame, &mem, 1); + Scale_sig(&synth[-L_frame], L_frame, negate(st->Q_syn_factor)); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ + } +#endif // !HARMONIZE_2446_CON_TCX_FX Copy( st->old_Aq_12_8_fx, A_local, M + 1 ); /*Q14*/ offset = shr( L_frame, 1 ); IF( GE_16( st->last_good, UNVOICED_TRANSITION ) ) - { - tmp16 = s_max( Tc - shr( L_frame, 1 ), 0 ); + { +#ifndef HARMONIZE_2446_CON_TCX_FX + tmp16 = s_max(Tc - shr(L_frame, 1), 0); +#else + tmp16 = s_max(sub(Tc, shr(L_frame, 1)), 0); +#endif // !HARMONIZE_2446_CON_TCX_FX + Copy_Scale_sig( hTcxDec->old_excFB_fx, &( exc[-tmp16] ), add( offset, tmp16 ), sub( Q_exc, st->Q_exc ) ); /*Q_exc*/ } ELSE @@ -1391,8 +1430,11 @@ void con_tcx_ivas_fx( /*-----------------------------------------------------------------* * Construct the random part of excitation *-----------------------------------------------------------------*/ - - IF( NE_16( coh, -16384 ) ) +#ifndef HARMONIZE_2446_CON_TCX_FX + IF(NE_16(coh, -16384)) +#else + IF(NE_16(coh, -16384) && NE_16(st->element_mode,EVS_MONO )) +#endif // !HARMONIZE_2446_CON_TCX_FX { Word16 tmpSeed1; Word16 alpha_coh; @@ -1514,8 +1556,12 @@ void con_tcx_ivas_fx( L_tmp2 = 0; move32(); FOR( j = 11; j > 0; j-- ) - { - L_tmp2 = L_mac( L_tmp2, noise[( i + ( L_FIR_FER2 - j ) )], hp_filt[sub( L_FIR_FER2, j )] ); + { +#ifndef HARMONIZE_2446_CON_TCX_FX + L_tmp2 = L_mac(L_tmp2, noise[(i + (L_FIR_FER2 - j))], hp_filt[sub(L_FIR_FER2, j)]); +#else + L_tmp2 = L_mac(L_tmp2, noise[add(i , (sub(L_FIR_FER2, j)))], hp_filt[sub(L_FIR_FER2, j)]); +#endif // !HARMONIZE_2446_CON_TCX_FX } L_tmp2 = Mpy_32_16_1( L_tmp2, st->cummulative_damping /*Q15*/ ); /*Q0, noise_e*/ noise[i] = mac_r( L_tmp2, gain_tmp, noise[i] ); /*Q15, noise_e*/ @@ -1572,7 +1618,16 @@ void con_tcx_ivas_fx( { gain32 = Mpy_32_16_1( gain32, 22938 /*0.7f Q15*/ ); /*Q16*/ } - L_tmp = L_shl( gain32, 1 ); /*Q16*/ +#ifndef HARMONIZE_2446_CON_TCX_FX + L_tmp = L_shl(gain32, 1); /*Q16*/ +#else + IF( NE_16(st->element_mode, EVS_MONO) ) { + L_tmp = L_shl(gain32, 1); /*Q16*/ + } + ELSE{ + L_tmp = L_shl_sat(gain32, 1); /*Q16*/ + } +#endif // !HARMONIZE_2446_CON_TCX_FX IF( GT_32( L_shl( L_deposit_h( gainCNG ), sub( gainCNG_e, 31 - 16 ) /*Q16*/ ), L_tmp ) ) { @@ -1598,23 +1653,59 @@ void con_tcx_ivas_fx( step32 = Mpy_32_16_1( L_tmp /*Q16,-tmp_e*/, getInvFrameLen( L_frame ) /*W16Q21*/ ); /*Q22,-tmp_e*/ step32 = L_shl( step32, sub( 25 - 22, tmp_e ) ); /*Q25*/ - pt_exc = noise + shr( L_FIR_FER2, 1 ); +#ifndef HARMONIZE_2446_CON_TCX_FX + pt_exc = noise + shr(L_FIR_FER2, 1); +#else + pt_exc = noise + L_FIR_FER2 / 2 ; +#endif // !HARMONIZE_2446_CON_TCX_FX /*gain_inov = 1.0f / (float)sqrt( dot_product( pt_exc, pt_exc, L_frame ) / L_frame + 0.01f );*/ /* normalize energy */ L_tmp = Dot_productSq16HQ( 0, pt_exc /*Q0,15+1*/, L_frame, &tmp_e ) /*Q31,tmp_e+16+16*/; - tmp_e = sub( add( tmp_e, shl( noise_e, 1 ) ), 1 ); // actual multiplier! +#ifndef HARMONIZE_2446_CON_TCX_FX + tmp_e = sub(add(tmp_e, shl(noise_e, 1)), 1); // actual multiplier! +#else + IF(NE_16(st->element_mode, EVS_MONO)) { + tmp_e = sub(add(tmp_e, shl(noise_e, 1)), 1); // actual multiplier! + } +#endif // !HARMONIZE_2446_CON_TCX_FX + L_tmp = Mpy_32_16_1( L_tmp, getInvFrameLen( L_frame ) /*W16Q21*/ ) /*W32Q37,tmp_e+16+16*/ /*Q5,tmp_e*/; - tmp_e = add( tmp_e, 31 - 6 ); /*-->Q31*/ +#ifndef HARMONIZE_2446_CON_TCX_FX + tmp_e = add(tmp_e, 31 - 6); /*-->Q31*/ gain_inov = 0; move16(); gain_inov_e = 0; move16(); - IF( NE_32( L_tmp, 0 ) ) + IF(NE_32(L_tmp, 0)) { - gain_inov = round_fx( ISqrt32( L_tmp, &tmp_e ) ); /*Q15,tmp_e*/ + gain_inov = round_fx(ISqrt32(L_tmp, &tmp_e)); /*Q15,tmp_e*/ gain_inov_e = tmp_e; move16(); } +#else + IF(NE_16(st->element_mode, EVS_MONO)){ + tmp_e = add(tmp_e, 31 - 6); /*-->Q31*/ + gain_inov = 0; + move16(); + gain_inov_e = 0; + move16(); + IF(NE_32(L_tmp, 0)) + { + gain_inov = round_fx(ISqrt32(L_tmp, &tmp_e)); /*Q15,tmp_e*/ + gain_inov_e = tmp_e; + move16(); + } + } + ELSE{ + tmp_e = add(tmp_e, 31 - 5); /*-->Q31*/ + gain_inov = round_fx(ISqrt32(L_tmp, &tmp_e)); /*Q15,tmp_e*/ + gain_inov_e = tmp_e; + move16(); + } + +#endif // !HARMONIZE_2446_CON_TCX_FX + + test(); test(); IF( EQ_16( st->last_good, UNVOICED_CLAS ) && NE_16( st->core_ext_mode, UNVOICED ) ) @@ -1713,10 +1804,10 @@ void con_tcx_ivas_fx( syn = buf + M; /*Q_syn*/ Copy( synth - M, buf, M ); /*Q_syn*/ - scf = norm_s( tmp_deemph ); - new_Q = sub( Q_exc, 4 ); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow - new_Q = s_max( new_Q, -1 ); - new_Q = s_min( new_Q, scf ); + scf = norm_s(tmp_deemph); + new_Q = sub(Q_exc, 4); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow + new_Q = s_max(new_Q, -1); + new_Q = s_min(new_Q, scf); tmp16 = s_min( new_Q, st->prev_Q_syn ); st->prev_Q_syn = new_Q; @@ -1737,7 +1828,11 @@ void con_tcx_ivas_fx( /*buf[OLD_EXC_SIZE_DEC;3/2 L_frame] Q1: exc*/ /*buf[0;M] Q0: mem_syn*/ +#ifndef HARMONIZE_2446_CON_TCX_FX IF( A_cng != NULL ) +#else + IF((A_cng != NULL) && NE_32(st->element_mode, EVS_MONO )) +#endif // !HARMONIZE_2446_CON_TCX_FX { Word16 alpha_delayed; @@ -1797,6 +1892,12 @@ void con_tcx_ivas_fx( /* Deemphasis and output synth and ZIR */ deemph_fx( syn, st->preemph_fac, add( L_frame, shr( L_frame, 1 ) ), &tmp_deemph ); +#ifdef HARMONIZE_2446_CON_TCX_FX + IF(EQ_32(st->element_mode, EVS_MONO)) { + bufferCopyFx(syn + sub(L_frame, M + 1), st->syn, 1 + M, Q_syn, 0, 0, 0); /*Q_syn*/ + } +#endif // HARMONIZE_2446_CON_TCX_FX + lerp( syn + sub( L_frame, shr( L_frame, 1 ) ), hTcxDec->old_syn_Overl, shr( st->L_frame, 1 ), shr( L_frame, 1 ) ); hTcxDec->Q_old_syn_Overl = Q_syn; move16(); @@ -1818,8 +1919,9 @@ void con_tcx_ivas_fx( hHQ_core->Q_old_wtda = Q_syn; move16(); - scf = add( getScaleFactor16( syn, L_frame ), Q_syn ); - IF( LT_16( scf, 0 ) ) // Only avoid left shift in bufferCopyFX when overflow could occur +#ifndef HARMONIZE_2446_CON_TCX_FX + scf = add(getScaleFactor16(syn, L_frame), Q_syn); + IF(LT_16(scf, 0)) // Only avoid left shift in bufferCopyFX when overflow could occur { st->Q_syn_factor = scf; } @@ -1828,12 +1930,43 @@ void con_tcx_ivas_fx( st->Q_syn_factor = 0; move16(); } - bufferCopyFx( syn, synth, L_frame, Q_syn, st->Q_syn_factor, 0, 0 ); + bufferCopyFx(syn, synth, L_frame, Q_syn, st->Q_syn_factor, 0, 0); - bufferCopyFx( syn + sub( L_frame, M + 1 ), st->syn, 1 + M, Q_syn, st->Q_syn_factor, 0, 0 ); + bufferCopyFx(syn + sub(L_frame, M + 1), st->syn, 1 + M, Q_syn, st->Q_syn_factor, 0, 0); - Copy_Scale_sig( syn + L_frame, hTcxDec->syn_OverlFB, shr( L_frame, 1 ), sub( st->Q_syn_factor, Q_syn ) ); + Copy_Scale_sig(syn + L_frame, hTcxDec->syn_OverlFB, shr(L_frame, 1), sub(st->Q_syn_factor, Q_syn)); hTcxDec->Q_syn_OverlFB = st->Q_syn_factor; +#else + IF(NE_16(st->element_mode, EVS_MONO)) { + scf = add(getScaleFactor16(syn, L_frame), Q_syn); + IF(LT_16(scf, 0)) // Only avoid left shift in bufferCopyFX when overflow could occur + { + st->Q_syn_factor = scf; + } + ELSE + { + st->Q_syn_factor = 0; + move16(); + } + bufferCopyFx(syn, synth, L_frame, Q_syn, st->Q_syn_factor, 0, 0); + + bufferCopyFx(syn + sub(L_frame, M + 1), st->syn, 1 + M, Q_syn, st->Q_syn_factor, 0, 0); + + Copy_Scale_sig(syn + L_frame, hTcxDec->syn_OverlFB, shr(L_frame, 1), sub(st->Q_syn_factor, Q_syn)); + hTcxDec->Q_syn_OverlFB = st->Q_syn_factor; + } + ELSE{ + /* As long as there is no synth scaling factor introduced, which + is given to the outside, there might occur overflows here */ + BASOP_SATURATE_WARNING_OFF_EVS + bufferCopyFx(syn, synth, L_frame, Q_syn, 0, 0, 0); /*Q_syn*/ + BASOP_SATURATE_WARNING_ON_EVS + + Copy_Scale_sig(syn + L_frame, hTcxDec->syn_OverlFB, shr(L_frame, 1), sub(0, Q_syn)); /*Q0*/ + hTcxDec->Q_syn_OverlFB = 0; + move16(); + } +#endif // !HARMONIZE_2446_CON_TCX_FX /* copy total excitation exc2 as 16kHz for acelp mode1 decoding */ IF( st->hWIDec != NULL ) @@ -1848,8 +1981,22 @@ void con_tcx_ivas_fx( move16(); /* create aliasing and windowing need for transition to TCX10/5 */ - Copy( syn + L_frame, hTcxDec->syn_Overl_TDACFB, shr( L_frame, 1 ) ); +#ifndef HARMONIZE_2446_CON_TCX_FX + Copy(syn + L_frame, hTcxDec->syn_Overl_TDACFB, shr(L_frame, 1)); hTcxDec->Q_syn_Overl_TDACFB = Q_syn; + +#else + IF(NE_16(st->element_mode, EVS_MONO)) { + Copy(syn + L_frame, hTcxDec->syn_Overl_TDACFB, shr(L_frame, 1)); + hTcxDec->Q_syn_Overl_TDACFB = Q_syn; + } + ELSE{ + bufferCopyFx(syn + L_frame, hTcxDec->syn_Overl_TDACFB, shr(L_frame, 1), Q_syn, 0, -1, 0); + hTcxDec->Q_syn_Overl_TDACFB = add(st->Q_syn, sub(st->Q_syn, -1)); + } +#endif // HARMONIZE_2446_CON_TCX_FX + + move16(); FOR( i = 0; i < W12; i++ ) @@ -1894,7 +2041,18 @@ void con_tcx_ivas_fx( move16(); /* update memory for low band */ +#ifndef HARMONIZE_2446_CON_TCX_FX st->Q_syn = Q_syn; +#else + IF(NE_16(st->element_mode, EVS_MONO)) { + st->Q_syn = Q_syn; + } + ELSE{ + Scale_sig(hTcxDec->old_syn_Overl, shr(st->L_frame, 1), sub(-1, Q_syn)); /*Q_syn*/ + hTcxDec->Q_old_syn_Overl = -1; + } +#endif // !HARMONIZE_2446_CON_TCX_FX + move16(); lerp( hTcxDec->syn_OverlFB, hTcxDec->syn_Overl, shr( st->L_frame, 1 ), shr( L_frame, 1 ) ); hTcxDec->Q_syn_Overl = hTcxDec->Q_syn_OverlFB; @@ -1903,9 +2061,18 @@ void con_tcx_ivas_fx( hTcxDec->Q_syn_Overl_TDAC = hTcxDec->Q_syn_Overl_TDACFB; move16(); lerp( st->hHQ_core->old_out_fx, st->hHQ_core->old_out_LB_fx, st->L_frame, L_frame ); +#ifndef HARMONIZE_2446_CON_TCX_FX st->hHQ_core->Q_old_wtda_LB = Q_syn; // st->hHQ_core->Q_old_wtda +#else + IF(EQ_16(st->element_mode, EVS_MONO)) { + st->hHQ_core->Q_old_wtda_LB = Q_syn; // st->hHQ_core->Q_old_wtda + } +#endif // !HARMONIZE_2446_CON_TCX_FX + st->old_enr_LP = Enr_1_Az_fx( A_local, L_SUBFR ); /*Q3*/ move16(); return; } + + diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index 9bb686342..4a57618e5 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -488,13 +488,7 @@ void stereo_tcx_core_dec_fx( } /* PLC: [TCX: TD PLC] */ -#ifndef HARMONIZE_2446_CON_TCX_FX con_tcx_fx( st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */ ); -#else - con_tcx_ivas_fx( st, &synthFB_fx[0], -16384, NULL, 0, NULL ); -#endif // !HARMONIZE_2446_CON_TCX_FX - - test(); IF( ( EQ_16( st->nbLostCmpt, 1 ) ) || hTcxDec->tcxConceal_recalc_exc ) { -- GitLab From de956b75aa118b8b49178d237570ffea8186e132 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Wed, 18 Feb 2026 16:06:08 +0100 Subject: [PATCH 05/44] issue: 2446 Clang formatting patch --- lib_dec/er_dec_tcx_fx.c | 191 ++++++++++++++++++++++------------------ 1 file changed, 104 insertions(+), 87 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index ca553f263..3f386914a 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1049,18 +1049,20 @@ void con_tcx_ivas_fx( mem = shl( synth[( -( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + M + M ) - 1 )], st->Q_syn_factor ); move16(); #ifndef HARMONIZE_2446_CON_TCX_FX - Q_exc = E_UTIL_f_preemph3_ivas_fx(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), st->preemph_fac, add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl(M, 1)), &mem, 1); + Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 ); #else - IF(NE_16(st->element_mode, EVS_MONO)) { - Q_exc = E_UTIL_f_preemph3_ivas_fx(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), st->preemph_fac, add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl(M, 1)), &mem, 1); + IF( NE_16( st->element_mode, EVS_MONO ) ) + { + Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 ); } - ELSE{ - Q_exc = E_UTIL_f_preemph3(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), st->preemph_fac, add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl(M, 1)), &mem, 1); + ELSE + { + Q_exc = E_UTIL_f_preemph3( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 ); } #endif // !HARMONIZE_2446_CON_TCX_FX - + scale_sig( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ st->Mode2_lp_gainc = L_deposit_l( 0 ); @@ -1086,18 +1088,20 @@ void con_tcx_ivas_fx( /* Levinson Durbin */ #ifndef HARMONIZE_2446_CON_TCX_FX - E_LPC_lev_dur_ivas_fx(r_h, r_l, A_local, NULL, M, NULL); + E_LPC_lev_dur_ivas_fx( r_h, r_l, A_local, NULL, M, NULL ); #else - IF(NE_16(st->element_mode, EVS_MONO)) { - E_LPC_lev_dur_ivas_fx(r_h, r_l, A_local, NULL, M, NULL); + IF( NE_16( st->element_mode, EVS_MONO ) ) + { + E_LPC_lev_dur_ivas_fx( r_h, r_l, A_local, NULL, M, NULL ); } - ELSE{ - E_LPC_lev_dur_fx(r_h, r_l, A_local, NULL, M, NULL); + ELSE + { + E_LPC_lev_dur_fx( r_h, r_l, A_local, NULL, M, NULL ); } #endif // !HARMONIZE_2446_CON_TCX_FX - + /* copy for multiple frame loss */ Copy( A_local, st->old_Aq_12_8_fx, M + 1 ); /*Q14*/ @@ -1119,28 +1123,30 @@ void con_tcx_ivas_fx( mem = shl( synth[( -L_frame - 1 )], st->Q_syn_factor ); /*hTcxDec->Q_synth_factor_old*/ move16(); #ifndef HARMONIZE_2446_CON_TCX_FX - Q_exc = E_UTIL_f_preemph3_ivas_fx(&(synth[-L_frame]), st->preemph_fac, L_frame, &mem, 1); - scale_sig(&synth[-L_frame], L_frame, negate(st->Q_syn_factor)); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ + Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-L_frame] ), st->preemph_fac, L_frame, &mem, 1 ); + scale_sig( &synth[-L_frame], L_frame, negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ #else - IF(NE_16(st->element_mode, EVS_MONO)) { - Q_exc = E_UTIL_f_preemph3_ivas_fx(&(synth[-L_frame]), st->preemph_fac, L_frame, &mem, 1); - scale_sig(&synth[-L_frame], L_frame, negate(st->Q_syn_factor)); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ + IF( NE_16( st->element_mode, EVS_MONO ) ) + { + Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-L_frame] ), st->preemph_fac, L_frame, &mem, 1 ); + scale_sig( &synth[-L_frame], L_frame, negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ } - ELSE{ - Q_exc = E_UTIL_f_preemph3(&(synth[-L_frame]), st->preemph_fac, L_frame, &mem, 1); - Scale_sig(&synth[-L_frame], L_frame, negate(st->Q_syn_factor)); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ + ELSE + { + Q_exc = E_UTIL_f_preemph3( &( synth[-L_frame] ), st->preemph_fac, L_frame, &mem, 1 ); + Scale_sig( &synth[-L_frame], L_frame, negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ } -#endif // !HARMONIZE_2446_CON_TCX_FX - Copy( st->old_Aq_12_8_fx, A_local, M + 1 ); /*Q14*/ +#endif // !HARMONIZE_2446_CON_TCX_FX + Copy( st->old_Aq_12_8_fx, A_local, M + 1 ); /*Q14*/ offset = shr( L_frame, 1 ); IF( GE_16( st->last_good, UNVOICED_TRANSITION ) ) - { + { #ifndef HARMONIZE_2446_CON_TCX_FX - tmp16 = s_max(Tc - shr(L_frame, 1), 0); + tmp16 = s_max( Tc - shr( L_frame, 1 ), 0 ); #else - tmp16 = s_max(sub(Tc, shr(L_frame, 1)), 0); + tmp16 = s_max( sub( Tc, shr( L_frame, 1 ) ), 0 ); #endif // !HARMONIZE_2446_CON_TCX_FX Copy_Scale_sig( hTcxDec->old_excFB_fx, &( exc[-tmp16] ), add( offset, tmp16 ), sub( Q_exc, st->Q_exc ) ); /*Q_exc*/ @@ -1431,9 +1437,9 @@ void con_tcx_ivas_fx( * Construct the random part of excitation *-----------------------------------------------------------------*/ #ifndef HARMONIZE_2446_CON_TCX_FX - IF(NE_16(coh, -16384)) + IF( NE_16( coh, -16384 ) ) #else - IF(NE_16(coh, -16384) && NE_16(st->element_mode,EVS_MONO )) + IF( NE_16( coh, -16384 ) && NE_16( st->element_mode, EVS_MONO ) ) #endif // !HARMONIZE_2446_CON_TCX_FX { Word16 tmpSeed1; @@ -1556,11 +1562,11 @@ void con_tcx_ivas_fx( L_tmp2 = 0; move32(); FOR( j = 11; j > 0; j-- ) - { + { #ifndef HARMONIZE_2446_CON_TCX_FX - L_tmp2 = L_mac(L_tmp2, noise[(i + (L_FIR_FER2 - j))], hp_filt[sub(L_FIR_FER2, j)]); + L_tmp2 = L_mac( L_tmp2, noise[( i + ( L_FIR_FER2 - j ) )], hp_filt[sub( L_FIR_FER2, j )] ); #else - L_tmp2 = L_mac(L_tmp2, noise[add(i , (sub(L_FIR_FER2, j)))], hp_filt[sub(L_FIR_FER2, j)]); + L_tmp2 = L_mac( L_tmp2, noise[add( i, ( sub( L_FIR_FER2, j ) ) )], hp_filt[sub( L_FIR_FER2, j )] ); #endif // !HARMONIZE_2446_CON_TCX_FX } L_tmp2 = Mpy_32_16_1( L_tmp2, st->cummulative_damping /*Q15*/ ); /*Q0, noise_e*/ @@ -1619,13 +1625,15 @@ void con_tcx_ivas_fx( gain32 = Mpy_32_16_1( gain32, 22938 /*0.7f Q15*/ ); /*Q16*/ } #ifndef HARMONIZE_2446_CON_TCX_FX - L_tmp = L_shl(gain32, 1); /*Q16*/ + L_tmp = L_shl( gain32, 1 ); /*Q16*/ #else - IF( NE_16(st->element_mode, EVS_MONO) ) { - L_tmp = L_shl(gain32, 1); /*Q16*/ + IF( NE_16( st->element_mode, EVS_MONO ) ) + { + L_tmp = L_shl( gain32, 1 ); /*Q16*/ } - ELSE{ - L_tmp = L_shl_sat(gain32, 1); /*Q16*/ + ELSE + { + L_tmp = L_shl_sat( gain32, 1 ); /*Q16*/ } #endif // !HARMONIZE_2446_CON_TCX_FX @@ -1654,58 +1662,61 @@ void con_tcx_ivas_fx( step32 = L_shl( step32, sub( 25 - 22, tmp_e ) ); /*Q25*/ #ifndef HARMONIZE_2446_CON_TCX_FX - pt_exc = noise + shr(L_FIR_FER2, 1); + pt_exc = noise + shr( L_FIR_FER2, 1 ); #else - pt_exc = noise + L_FIR_FER2 / 2 ; + pt_exc = noise + L_FIR_FER2 / 2; #endif // !HARMONIZE_2446_CON_TCX_FX /*gain_inov = 1.0f / (float)sqrt( dot_product( pt_exc, pt_exc, L_frame ) / L_frame + 0.01f );*/ /* normalize energy */ L_tmp = Dot_productSq16HQ( 0, pt_exc /*Q0,15+1*/, L_frame, &tmp_e ) /*Q31,tmp_e+16+16*/; #ifndef HARMONIZE_2446_CON_TCX_FX - tmp_e = sub(add(tmp_e, shl(noise_e, 1)), 1); // actual multiplier! + tmp_e = sub( add( tmp_e, shl( noise_e, 1 ) ), 1 ); // actual multiplier! #else - IF(NE_16(st->element_mode, EVS_MONO)) { - tmp_e = sub(add(tmp_e, shl(noise_e, 1)), 1); // actual multiplier! + IF( NE_16( st->element_mode, EVS_MONO ) ) + { + tmp_e = sub( add( tmp_e, shl( noise_e, 1 ) ), 1 ); // actual multiplier! } #endif // !HARMONIZE_2446_CON_TCX_FX L_tmp = Mpy_32_16_1( L_tmp, getInvFrameLen( L_frame ) /*W16Q21*/ ) /*W32Q37,tmp_e+16+16*/ /*Q5,tmp_e*/; #ifndef HARMONIZE_2446_CON_TCX_FX - tmp_e = add(tmp_e, 31 - 6); /*-->Q31*/ + tmp_e = add( tmp_e, 31 - 6 ); /*-->Q31*/ gain_inov = 0; move16(); gain_inov_e = 0; move16(); - IF(NE_32(L_tmp, 0)) + IF( NE_32( L_tmp, 0 ) ) { - gain_inov = round_fx(ISqrt32(L_tmp, &tmp_e)); /*Q15,tmp_e*/ + gain_inov = round_fx( ISqrt32( L_tmp, &tmp_e ) ); /*Q15,tmp_e*/ gain_inov_e = tmp_e; move16(); } #else - IF(NE_16(st->element_mode, EVS_MONO)){ - tmp_e = add(tmp_e, 31 - 6); /*-->Q31*/ + IF( NE_16( st->element_mode, EVS_MONO ) ) + { + tmp_e = add( tmp_e, 31 - 6 ); /*-->Q31*/ gain_inov = 0; move16(); gain_inov_e = 0; move16(); - IF(NE_32(L_tmp, 0)) + IF( NE_32( L_tmp, 0 ) ) { - gain_inov = round_fx(ISqrt32(L_tmp, &tmp_e)); /*Q15,tmp_e*/ + gain_inov = round_fx( ISqrt32( L_tmp, &tmp_e ) ); /*Q15,tmp_e*/ gain_inov_e = tmp_e; move16(); } } - ELSE{ - tmp_e = add(tmp_e, 31 - 5); /*-->Q31*/ - gain_inov = round_fx(ISqrt32(L_tmp, &tmp_e)); /*Q15,tmp_e*/ + ELSE + { + tmp_e = add( tmp_e, 31 - 5 ); /*-->Q31*/ + gain_inov = round_fx( ISqrt32( L_tmp, &tmp_e ) ); /*Q15,tmp_e*/ gain_inov_e = tmp_e; move16(); } #endif // !HARMONIZE_2446_CON_TCX_FX - + test(); test(); IF( EQ_16( st->last_good, UNVOICED_CLAS ) && NE_16( st->core_ext_mode, UNVOICED ) ) @@ -1804,10 +1815,10 @@ void con_tcx_ivas_fx( syn = buf + M; /*Q_syn*/ Copy( synth - M, buf, M ); /*Q_syn*/ - scf = norm_s(tmp_deemph); - new_Q = sub(Q_exc, 4); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow - new_Q = s_max(new_Q, -1); - new_Q = s_min(new_Q, scf); + scf = norm_s( tmp_deemph ); + new_Q = sub( Q_exc, 4 ); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow + new_Q = s_max( new_Q, -1 ); + new_Q = s_min( new_Q, scf ); tmp16 = s_min( new_Q, st->prev_Q_syn ); st->prev_Q_syn = new_Q; @@ -1831,7 +1842,7 @@ void con_tcx_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX IF( A_cng != NULL ) #else - IF((A_cng != NULL) && NE_32(st->element_mode, EVS_MONO )) + IF( ( A_cng != NULL ) && NE_32( st->element_mode, EVS_MONO ) ) #endif // !HARMONIZE_2446_CON_TCX_FX { Word16 alpha_delayed; @@ -1893,8 +1904,9 @@ void con_tcx_ivas_fx( deemph_fx( syn, st->preemph_fac, add( L_frame, shr( L_frame, 1 ) ), &tmp_deemph ); #ifdef HARMONIZE_2446_CON_TCX_FX - IF(EQ_32(st->element_mode, EVS_MONO)) { - bufferCopyFx(syn + sub(L_frame, M + 1), st->syn, 1 + M, Q_syn, 0, 0, 0); /*Q_syn*/ + IF( EQ_32( st->element_mode, EVS_MONO ) ) + { + bufferCopyFx( syn + sub( L_frame, M + 1 ), st->syn, 1 + M, Q_syn, 0, 0, 0 ); /*Q_syn*/ } #endif // HARMONIZE_2446_CON_TCX_FX @@ -1920,8 +1932,8 @@ void con_tcx_ivas_fx( move16(); #ifndef HARMONIZE_2446_CON_TCX_FX - scf = add(getScaleFactor16(syn, L_frame), Q_syn); - IF(LT_16(scf, 0)) // Only avoid left shift in bufferCopyFX when overflow could occur + scf = add( getScaleFactor16( syn, L_frame ), Q_syn ); + IF( LT_16( scf, 0 ) ) // Only avoid left shift in bufferCopyFX when overflow could occur { st->Q_syn_factor = scf; } @@ -1930,16 +1942,17 @@ void con_tcx_ivas_fx( st->Q_syn_factor = 0; move16(); } - bufferCopyFx(syn, synth, L_frame, Q_syn, st->Q_syn_factor, 0, 0); + bufferCopyFx( syn, synth, L_frame, Q_syn, st->Q_syn_factor, 0, 0 ); - bufferCopyFx(syn + sub(L_frame, M + 1), st->syn, 1 + M, Q_syn, st->Q_syn_factor, 0, 0); + bufferCopyFx( syn + sub( L_frame, M + 1 ), st->syn, 1 + M, Q_syn, st->Q_syn_factor, 0, 0 ); - Copy_Scale_sig(syn + L_frame, hTcxDec->syn_OverlFB, shr(L_frame, 1), sub(st->Q_syn_factor, Q_syn)); + Copy_Scale_sig( syn + L_frame, hTcxDec->syn_OverlFB, shr( L_frame, 1 ), sub( st->Q_syn_factor, Q_syn ) ); hTcxDec->Q_syn_OverlFB = st->Q_syn_factor; #else - IF(NE_16(st->element_mode, EVS_MONO)) { - scf = add(getScaleFactor16(syn, L_frame), Q_syn); - IF(LT_16(scf, 0)) // Only avoid left shift in bufferCopyFX when overflow could occur + IF( NE_16( st->element_mode, EVS_MONO ) ) + { + scf = add( getScaleFactor16( syn, L_frame ), Q_syn ); + IF( LT_16( scf, 0 ) ) // Only avoid left shift in bufferCopyFX when overflow could occur { st->Q_syn_factor = scf; } @@ -1948,21 +1961,22 @@ void con_tcx_ivas_fx( st->Q_syn_factor = 0; move16(); } - bufferCopyFx(syn, synth, L_frame, Q_syn, st->Q_syn_factor, 0, 0); + bufferCopyFx( syn, synth, L_frame, Q_syn, st->Q_syn_factor, 0, 0 ); - bufferCopyFx(syn + sub(L_frame, M + 1), st->syn, 1 + M, Q_syn, st->Q_syn_factor, 0, 0); + bufferCopyFx( syn + sub( L_frame, M + 1 ), st->syn, 1 + M, Q_syn, st->Q_syn_factor, 0, 0 ); - Copy_Scale_sig(syn + L_frame, hTcxDec->syn_OverlFB, shr(L_frame, 1), sub(st->Q_syn_factor, Q_syn)); + Copy_Scale_sig( syn + L_frame, hTcxDec->syn_OverlFB, shr( L_frame, 1 ), sub( st->Q_syn_factor, Q_syn ) ); hTcxDec->Q_syn_OverlFB = st->Q_syn_factor; } - ELSE{ + ELSE + { /* As long as there is no synth scaling factor introduced, which is given to the outside, there might occur overflows here */ BASOP_SATURATE_WARNING_OFF_EVS - bufferCopyFx(syn, synth, L_frame, Q_syn, 0, 0, 0); /*Q_syn*/ + bufferCopyFx( syn, synth, L_frame, Q_syn, 0, 0, 0 ); /*Q_syn*/ BASOP_SATURATE_WARNING_ON_EVS - Copy_Scale_sig(syn + L_frame, hTcxDec->syn_OverlFB, shr(L_frame, 1), sub(0, Q_syn)); /*Q0*/ + Copy_Scale_sig( syn + L_frame, hTcxDec->syn_OverlFB, shr( L_frame, 1 ), sub( 0, Q_syn ) ); /*Q0*/ hTcxDec->Q_syn_OverlFB = 0; move16(); } @@ -1982,21 +1996,23 @@ void con_tcx_ivas_fx( /* create aliasing and windowing need for transition to TCX10/5 */ #ifndef HARMONIZE_2446_CON_TCX_FX - Copy(syn + L_frame, hTcxDec->syn_Overl_TDACFB, shr(L_frame, 1)); + Copy( syn + L_frame, hTcxDec->syn_Overl_TDACFB, shr( L_frame, 1 ) ); hTcxDec->Q_syn_Overl_TDACFB = Q_syn; #else - IF(NE_16(st->element_mode, EVS_MONO)) { - Copy(syn + L_frame, hTcxDec->syn_Overl_TDACFB, shr(L_frame, 1)); + IF( NE_16( st->element_mode, EVS_MONO ) ) + { + Copy( syn + L_frame, hTcxDec->syn_Overl_TDACFB, shr( L_frame, 1 ) ); hTcxDec->Q_syn_Overl_TDACFB = Q_syn; } - ELSE{ - bufferCopyFx(syn + L_frame, hTcxDec->syn_Overl_TDACFB, shr(L_frame, 1), Q_syn, 0, -1, 0); - hTcxDec->Q_syn_Overl_TDACFB = add(st->Q_syn, sub(st->Q_syn, -1)); + ELSE + { + bufferCopyFx( syn + L_frame, hTcxDec->syn_Overl_TDACFB, shr( L_frame, 1 ), Q_syn, 0, -1, 0 ); + hTcxDec->Q_syn_Overl_TDACFB = add( st->Q_syn, sub( st->Q_syn, -1 ) ); } #endif // HARMONIZE_2446_CON_TCX_FX - + move16(); FOR( i = 0; i < W12; i++ ) @@ -2044,11 +2060,13 @@ void con_tcx_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX st->Q_syn = Q_syn; #else - IF(NE_16(st->element_mode, EVS_MONO)) { + IF( NE_16( st->element_mode, EVS_MONO ) ) + { st->Q_syn = Q_syn; } - ELSE{ - Scale_sig(hTcxDec->old_syn_Overl, shr(st->L_frame, 1), sub(-1, Q_syn)); /*Q_syn*/ + ELSE + { + Scale_sig( hTcxDec->old_syn_Overl, shr( st->L_frame, 1 ), sub( -1, Q_syn ) ); /*Q_syn*/ hTcxDec->Q_old_syn_Overl = -1; } #endif // !HARMONIZE_2446_CON_TCX_FX @@ -2062,10 +2080,11 @@ void con_tcx_ivas_fx( move16(); lerp( st->hHQ_core->old_out_fx, st->hHQ_core->old_out_LB_fx, st->L_frame, L_frame ); #ifndef HARMONIZE_2446_CON_TCX_FX - st->hHQ_core->Q_old_wtda_LB = Q_syn; // st->hHQ_core->Q_old_wtda + st->hHQ_core->Q_old_wtda_LB = Q_syn; // st->hHQ_core->Q_old_wtda #else - IF(EQ_16(st->element_mode, EVS_MONO)) { - st->hHQ_core->Q_old_wtda_LB = Q_syn; // st->hHQ_core->Q_old_wtda + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + st->hHQ_core->Q_old_wtda_LB = Q_syn; // st->hHQ_core->Q_old_wtda } #endif // !HARMONIZE_2446_CON_TCX_FX @@ -2074,5 +2093,3 @@ void con_tcx_ivas_fx( return; } - - -- GitLab From d0c00f4872826c5e2445093a408cff47bf276cea Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 19 Feb 2026 14:08:20 +0100 Subject: [PATCH 06/44] issue: 2446 Reverting switch definition --- 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 3c3b8d0c3..085927b02 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -95,7 +95,7 @@ #define HARM_2336_DOTP /* VA: basop 2336; Harmonisation of some dot_product function + some BE optimisation */ #define FIX_2431_AVOID_CALLOC /* VA: basp issue 2431: avoid use of calloc() */ #define FIX_2424_REMOVE_GAUSS_L2_ENC /* VA: basop issue 2424: Remove duplicated code in gauss_L2_ivas_fx() */ -#define HARMONIZE_2446_CON_TCX_FX +//#define HARMONIZE_2446_CON_TCX_FX /* #################### End BE switches ################################## */ /* #################### Start NON-BE switches ############################ */ -- GitLab From b6a11448c04617f0461c2d72873176fd4a3ab867 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 19 Feb 2026 14:49:29 +0100 Subject: [PATCH 07/44] issue: 2446 re-activating switch and changing one tipo from EQ to NE --- lib_dec/er_dec_tcx_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 3f386914a..8cd5ab261 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -2082,7 +2082,7 @@ void con_tcx_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX st->hHQ_core->Q_old_wtda_LB = Q_syn; // st->hHQ_core->Q_old_wtda #else - IF( EQ_16( st->element_mode, EVS_MONO ) ) + IF( NE_16( st->element_mode, EVS_MONO ) ) { st->hHQ_core->Q_old_wtda_LB = Q_syn; // st->hHQ_core->Q_old_wtda } -- GitLab From a6b3dd8c63cb5faaf48f3cb022235148e59a0f1b Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 19 Feb 2026 14:49:44 +0100 Subject: [PATCH 08/44] issue: 2446 re-activating switch and changing one tipo from EQ to NE --- 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 8992d5587..4e03fba01 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -96,7 +96,7 @@ #define HARM_2336_DOTP /* VA: basop 2336; Harmonisation of some dot_product function + some BE optimisation */ #define FIX_2431_AVOID_CALLOC /* VA: basp issue 2431: avoid use of calloc() */ #define FIX_2424_REMOVE_GAUSS_L2_ENC /* VA: basop issue 2424: Remove duplicated code in gauss_L2_ivas_fx() */ -//#define HARMONIZE_2446_CON_TCX_FX +#define HARMONIZE_2446_CON_TCX_FX /* #################### End BE switches ################################## */ /* #################### Start NON-BE switches ############################ */ -- GitLab From fdb6d83359b92679ccdb9978179f1e8478dca820 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 19 Feb 2026 15:45:55 +0100 Subject: [PATCH 09/44] issue: 2446 changing one instance of con_tcx_fx --- lib_dec/ivas_tcx_core_dec_fx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index c3d9b2911..669e41371 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -493,7 +493,11 @@ void stereo_tcx_core_dec_fx( } /* PLC: [TCX: TD PLC] */ - con_tcx_fx( st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */ ); +#ifndef 1 + con_tcx_fx(st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */); +#else + con_tcx_ivas_fx(st, &synthFB_fx[0], -16384, NULL, 0, NULL); +#endif // !1 test(); IF( ( EQ_16( st->nbLostCmpt, 1 ) ) || hTcxDec->tcxConceal_recalc_exc ) { -- GitLab From e39ed92ca43c03a78793dd7857cb3906f189d729 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 19 Feb 2026 15:48:59 +0100 Subject: [PATCH 10/44] issue: 2446 Clang formatting patch --- lib_dec/ivas_tcx_core_dec_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index 669e41371..041540dd1 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -494,9 +494,9 @@ void stereo_tcx_core_dec_fx( /* PLC: [TCX: TD PLC] */ #ifndef 1 - con_tcx_fx(st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */); + con_tcx_fx( st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */ ); #else - con_tcx_ivas_fx(st, &synthFB_fx[0], -16384, NULL, 0, NULL); + con_tcx_ivas_fx( st, &synthFB_fx[0], -16384, NULL, 0, NULL ); #endif // !1 test(); IF( ( EQ_16( st->nbLostCmpt, 1 ) ) || hTcxDec->tcxConceal_recalc_exc ) -- GitLab From 0c791a34b0ee5b87ed14cabf50867668f9cb6fad Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 19 Feb 2026 15:50:28 +0100 Subject: [PATCH 11/44] issue: 2446 Macro name correction --- lib_dec/ivas_tcx_core_dec_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index 041540dd1..4a903be9a 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -493,11 +493,11 @@ void stereo_tcx_core_dec_fx( } /* PLC: [TCX: TD PLC] */ -#ifndef 1 +#ifndef HARMONIZE_2446_CON_TCX_FX con_tcx_fx( st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */ ); #else con_tcx_ivas_fx( st, &synthFB_fx[0], -16384, NULL, 0, NULL ); -#endif // !1 +#endif // !HARMONIZE_2446_CON_TCX_FX test(); IF( ( EQ_16( st->nbLostCmpt, 1 ) ) || hTcxDec->tcxConceal_recalc_exc ) { -- GitLab From facd56789c8b24d8f190f4877eebabe1cd75e399 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 19 Feb 2026 18:49:55 +0100 Subject: [PATCH 12/44] issue: 2446 Replacing (L_mac_sat, L_mac) and (mac_r_sat, mac_r) in EVS_MONO case --- lib_dec/er_dec_tcx_fx.c | 71 +++++++++++++++++++++++++++++----- lib_dec/ivas_tcx_core_dec_fx.c | 2 +- 2 files changed, 63 insertions(+), 10 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 8cd5ab261..0ecb9cdc6 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1251,6 +1251,7 @@ void con_tcx_ivas_fx( { FOR( i = 0; i < Tc; i++ ) { +#ifndef HARMONIZE_2446_CON_TCX_FX *pt_exc++ = mac_r( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mult( 174 /* 0.0053f Q15*/, pt1_exc[-5] ), 0 /* 0.0000f Q15*/, pt1_exc[-4] ), @@ -1263,6 +1264,37 @@ void con_tcx_ivas_fx( -1442 /*-0.0440f Q15*/, pt1_exc[3] ), 0 /* 0.0000f Q15*/, pt1_exc[4] ), 174 /* 0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ +#else + IF(NE_32(st->element_mode, EVS_MONO)){ + *pt_exc++ = mac_r(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac( + L_mult(174 /* 0.0053f Q15*/, pt1_exc[-5]), + 0 /* 0.0000f Q15*/, pt1_exc[-4]), + -1442 /*-0.0440f Q15*/, pt1_exc[-3]), + 0 /* 0.0000f Q15*/, pt1_exc[-2]), + 8641 /* 0.2637f Q15*/, pt1_exc[-1]), + 18022 /* 0.5500f Q15*/, pt1_exc[0]), + 8641 /* 0.2637f Q15*/, pt1_exc[1]), + 0 /* 0.0000f Q15*/, pt1_exc[2]), + -1442 /*-0.0440f Q15*/, pt1_exc[3]), + 0 /* 0.0000f Q15*/, pt1_exc[4]), + 174 /* 0.0053f Q15*/, pt1_exc[5]); /*Q_exc*/ + } + ELSE{ + *pt_exc++ = mac_r_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat( + L_mult(174 /* 0.0053f Q15*/, pt1_exc[-5]), + 0 /* 0.0000f Q15*/, pt1_exc[-4]), + -1442 /*-0.0440f Q15*/, pt1_exc[-3]), + 0 /* 0.0000f Q15*/, pt1_exc[-2]), + 8641 /* 0.2637f Q15*/, pt1_exc[-1]), + 18022 /* 0.5500f Q15*/, pt1_exc[0]), + 8641 /* 0.2637f Q15*/, pt1_exc[1]), + 0 /* 0.0000f Q15*/, pt1_exc[2]), + -1442 /*-0.0440f Q15*/, pt1_exc[3]), + 0 /* 0.0000f Q15*/, pt1_exc[4]), + 174 /* 0.0053f Q15*/, pt1_exc[5]); /*Q_exc*/ + } + +#endif // !HARMONIZE_2446_CON_TCX_FX move16(); pt1_exc++; } @@ -1271,18 +1303,39 @@ void con_tcx_ivas_fx( { FOR( i = 0; i < Tc; i++ ) { - *pt_exc++ = mac_r( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( - L_mult( -174 /*-0.0053f Q15*/, pt1_exc[-5] ), - -121 /*-0.0037f Q15*/, pt1_exc[-4] ), - -459 /*-0.0140f Q15*/, pt1_exc[-3] ), - 590 /* 0.0180f Q15*/, pt1_exc[-2] ), - 8743 /* 0.2668f Q15*/, pt1_exc[-1] ), - 16355 /* 0.4991f Q15*/, pt1_exc[0] ), - 8743 /* 0.2668f Q15*/, pt1_exc[1] ), - 590 /* 0.0180f Q15*/, pt1_exc[2] ), +#ifndef HARMONIZE_2446_CON_TCX_FX + +#else + IF(NE_32(st->element_mode, EVS_MONO)) { + *pt_exc++ = mac_r(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac( + L_mult(-174 /*-0.0053f Q15*/, pt1_exc[-5]), + -121 /*-0.0037f Q15*/, pt1_exc[-4]), + -459 /*-0.0140f Q15*/, pt1_exc[-3]), + 590 /* 0.0180f Q15*/, pt1_exc[-2]), + 8743 /* 0.2668f Q15*/, pt1_exc[-1]), + 16355 /* 0.4991f Q15*/, pt1_exc[0]), + 8743 /* 0.2668f Q15*/, pt1_exc[1]), + 590 /* 0.0180f Q15*/, pt1_exc[2]), -459 /*-0.0140f Q15*/, pt1_exc[3] ), -121 /*-0.0037f Q15*/, pt1_exc[4] ), -174 /*-0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ + } + ELSE{ + *pt_exc++ = mac_r_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat( + L_mult(-174 /*-0.0053f Q15*/, pt1_exc[-5]), + -121 /*-0.0037f Q15*/, pt1_exc[-4]), + -459 /*-0.0140f Q15*/, pt1_exc[-3]), + 590 /* 0.0180f Q15*/, pt1_exc[-2]), + 8743 /* 0.2668f Q15*/, pt1_exc[-1]), + 16355 /* 0.4991f Q15*/, pt1_exc[0]), + 8743 /* 0.2668f Q15*/, pt1_exc[1]), + 590 /* 0.0180f Q15*/, pt1_exc[2]), + -459 /*-0.0140f Q15*/, pt1_exc[3]), + -121 /*-0.0037f Q15*/, pt1_exc[4]), + -174 /*-0.0053f Q15*/, pt1_exc[5]); /*Q_exc*/ + } + +#endif // !HARMONIZE_2446_CON_TCX_FX move16(); pt1_exc++; } diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index 4a903be9a..cd9b3f418 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -485,7 +485,7 @@ void stereo_tcx_core_dec_fx( { assert( bfi ); /*must only happen in BFI*/ - IF( !st->tcxonly ) + IF( !st->tcxonly ) { /*LPC interpolation*/ int_lsp_fx( st->L_frame, &lsp_fx[0], &lsp_fx[M], Aq_fx, M, interpol_frac_fx, 0 ); -- GitLab From d1ba96c84ec91cc13690260edaeea2d41c6572e1 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 19 Feb 2026 18:52:05 +0100 Subject: [PATCH 13/44] issue: 2446 Clang formatting patch --- lib_dec/er_dec_tcx_fx.c | 118 +++++++++++++++++---------------- lib_dec/ivas_tcx_core_dec_fx.c | 2 +- 2 files changed, 62 insertions(+), 58 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 0ecb9cdc6..1cd4089b2 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1264,36 +1264,38 @@ void con_tcx_ivas_fx( -1442 /*-0.0440f Q15*/, pt1_exc[3] ), 0 /* 0.0000f Q15*/, pt1_exc[4] ), 174 /* 0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ -#else - IF(NE_32(st->element_mode, EVS_MONO)){ - *pt_exc++ = mac_r(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac( - L_mult(174 /* 0.0053f Q15*/, pt1_exc[-5]), - 0 /* 0.0000f Q15*/, pt1_exc[-4]), - -1442 /*-0.0440f Q15*/, pt1_exc[-3]), - 0 /* 0.0000f Q15*/, pt1_exc[-2]), - 8641 /* 0.2637f Q15*/, pt1_exc[-1]), - 18022 /* 0.5500f Q15*/, pt1_exc[0]), - 8641 /* 0.2637f Q15*/, pt1_exc[1]), - 0 /* 0.0000f Q15*/, pt1_exc[2]), - -1442 /*-0.0440f Q15*/, pt1_exc[3]), - 0 /* 0.0000f Q15*/, pt1_exc[4]), - 174 /* 0.0053f Q15*/, pt1_exc[5]); /*Q_exc*/ +#else + IF( NE_32( st->element_mode, EVS_MONO ) ) + { + *pt_exc++ = mac_r( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( + L_mult( 174 /* 0.0053f Q15*/, pt1_exc[-5] ), + 0 /* 0.0000f Q15*/, pt1_exc[-4] ), + -1442 /*-0.0440f Q15*/, pt1_exc[-3] ), + 0 /* 0.0000f Q15*/, pt1_exc[-2] ), + 8641 /* 0.2637f Q15*/, pt1_exc[-1] ), + 18022 /* 0.5500f Q15*/, pt1_exc[0] ), + 8641 /* 0.2637f Q15*/, pt1_exc[1] ), + 0 /* 0.0000f Q15*/, pt1_exc[2] ), + -1442 /*-0.0440f Q15*/, pt1_exc[3] ), + 0 /* 0.0000f Q15*/, pt1_exc[4] ), + 174 /* 0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ } - ELSE{ - *pt_exc++ = mac_r_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat( - L_mult(174 /* 0.0053f Q15*/, pt1_exc[-5]), - 0 /* 0.0000f Q15*/, pt1_exc[-4]), - -1442 /*-0.0440f Q15*/, pt1_exc[-3]), - 0 /* 0.0000f Q15*/, pt1_exc[-2]), - 8641 /* 0.2637f Q15*/, pt1_exc[-1]), - 18022 /* 0.5500f Q15*/, pt1_exc[0]), - 8641 /* 0.2637f Q15*/, pt1_exc[1]), - 0 /* 0.0000f Q15*/, pt1_exc[2]), - -1442 /*-0.0440f Q15*/, pt1_exc[3]), - 0 /* 0.0000f Q15*/, pt1_exc[4]), - 174 /* 0.0053f Q15*/, pt1_exc[5]); /*Q_exc*/ + ELSE + { + *pt_exc++ = mac_r_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( + L_mult( 174 /* 0.0053f Q15*/, pt1_exc[-5] ), + 0 /* 0.0000f Q15*/, pt1_exc[-4] ), + -1442 /*-0.0440f Q15*/, pt1_exc[-3] ), + 0 /* 0.0000f Q15*/, pt1_exc[-2] ), + 8641 /* 0.2637f Q15*/, pt1_exc[-1] ), + 18022 /* 0.5500f Q15*/, pt1_exc[0] ), + 8641 /* 0.2637f Q15*/, pt1_exc[1] ), + 0 /* 0.0000f Q15*/, pt1_exc[2] ), + -1442 /*-0.0440f Q15*/, pt1_exc[3] ), + 0 /* 0.0000f Q15*/, pt1_exc[4] ), + 174 /* 0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ } - + #endif // !HARMONIZE_2446_CON_TCX_FX move16(); pt1_exc++; @@ -1306,35 +1308,37 @@ void con_tcx_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX #else - IF(NE_32(st->element_mode, EVS_MONO)) { - *pt_exc++ = mac_r(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac( - L_mult(-174 /*-0.0053f Q15*/, pt1_exc[-5]), - -121 /*-0.0037f Q15*/, pt1_exc[-4]), - -459 /*-0.0140f Q15*/, pt1_exc[-3]), - 590 /* 0.0180f Q15*/, pt1_exc[-2]), - 8743 /* 0.2668f Q15*/, pt1_exc[-1]), - 16355 /* 0.4991f Q15*/, pt1_exc[0]), - 8743 /* 0.2668f Q15*/, pt1_exc[1]), - 590 /* 0.0180f Q15*/, pt1_exc[2]), - -459 /*-0.0140f Q15*/, pt1_exc[3] ), - -121 /*-0.0037f Q15*/, pt1_exc[4] ), - -174 /*-0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ - } - ELSE{ - *pt_exc++ = mac_r_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat( - L_mult(-174 /*-0.0053f Q15*/, pt1_exc[-5]), - -121 /*-0.0037f Q15*/, pt1_exc[-4]), - -459 /*-0.0140f Q15*/, pt1_exc[-3]), - 590 /* 0.0180f Q15*/, pt1_exc[-2]), - 8743 /* 0.2668f Q15*/, pt1_exc[-1]), - 16355 /* 0.4991f Q15*/, pt1_exc[0]), - 8743 /* 0.2668f Q15*/, pt1_exc[1]), - 590 /* 0.0180f Q15*/, pt1_exc[2]), - -459 /*-0.0140f Q15*/, pt1_exc[3]), - -121 /*-0.0037f Q15*/, pt1_exc[4]), - -174 /*-0.0053f Q15*/, pt1_exc[5]); /*Q_exc*/ - } - + IF( NE_32( st->element_mode, EVS_MONO ) ) + { + *pt_exc++ = mac_r( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( + L_mult( -174 /*-0.0053f Q15*/, pt1_exc[-5] ), + -121 /*-0.0037f Q15*/, pt1_exc[-4] ), + -459 /*-0.0140f Q15*/, pt1_exc[-3] ), + 590 /* 0.0180f Q15*/, pt1_exc[-2] ), + 8743 /* 0.2668f Q15*/, pt1_exc[-1] ), + 16355 /* 0.4991f Q15*/, pt1_exc[0] ), + 8743 /* 0.2668f Q15*/, pt1_exc[1] ), + 590 /* 0.0180f Q15*/, pt1_exc[2] ), + -459 /*-0.0140f Q15*/, pt1_exc[3] ), + -121 /*-0.0037f Q15*/, pt1_exc[4] ), + -174 /*-0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ + } + ELSE + { + *pt_exc++ = mac_r_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( + L_mult( -174 /*-0.0053f Q15*/, pt1_exc[-5] ), + -121 /*-0.0037f Q15*/, pt1_exc[-4] ), + -459 /*-0.0140f Q15*/, pt1_exc[-3] ), + 590 /* 0.0180f Q15*/, pt1_exc[-2] ), + 8743 /* 0.2668f Q15*/, pt1_exc[-1] ), + 16355 /* 0.4991f Q15*/, pt1_exc[0] ), + 8743 /* 0.2668f Q15*/, pt1_exc[1] ), + 590 /* 0.0180f Q15*/, pt1_exc[2] ), + -459 /*-0.0140f Q15*/, pt1_exc[3] ), + -121 /*-0.0037f Q15*/, pt1_exc[4] ), + -174 /*-0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ + } + #endif // !HARMONIZE_2446_CON_TCX_FX move16(); pt1_exc++; diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index cd9b3f418..4a903be9a 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -485,7 +485,7 @@ void stereo_tcx_core_dec_fx( { assert( bfi ); /*must only happen in BFI*/ - IF( !st->tcxonly ) + IF( !st->tcxonly ) { /*LPC interpolation*/ int_lsp_fx( st->L_frame, &lsp_fx[0], &lsp_fx[M], Aq_fx, M, interpol_frac_fx, 0 ); -- GitLab From 9fb2ce5d23b2f52cd20ef6f36a85a7d7cdbbc97f Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Fri, 20 Feb 2026 10:47:45 +0100 Subject: [PATCH 14/44] issue: 2446 harmonizing further skipped places - reverting one wrong change --- lib_dec/er_dec_tcx_fx.c | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 1cd4089b2..ea8ba9a37 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1872,11 +1872,24 @@ void con_tcx_ivas_fx( syn = buf + M; /*Q_syn*/ Copy( synth - M, buf, M ); /*Q_syn*/ - scf = norm_s( tmp_deemph ); - new_Q = sub( Q_exc, 4 ); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow - new_Q = s_max( new_Q, -1 ); - new_Q = s_min( new_Q, scf ); - +#ifdef HARMONIZE_2446_CON_TCX_FX + IF(NE_32(st->element_mode, EVS_MONO)) // to keep evs bit-exactness + { +#endif // HARMONIZE_2446_CON_TCX_FX + scf = norm_s(tmp_deemph); + new_Q = sub(Q_exc, 4); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow + new_Q = s_max(new_Q, -1); + new_Q = s_min(new_Q, scf); +#ifdef HARMONIZE_2446_CON_TCX_FX + } + ELSE + { + new_Q = sub(Q_exc, 3); + new_Q = s_max(new_Q, -1); + scf = 0; + move16(); + } +#endif // HARMONIZE_2446_CON_TCX_FX tmp16 = s_min( new_Q, st->prev_Q_syn ); st->prev_Q_syn = new_Q; move16(); @@ -1886,11 +1899,24 @@ void con_tcx_ivas_fx( move16(); Copy_Scale_sig( buf, mem_syn, M, exp_scale ); /* Q: tmp16 */ +#ifdef HARMONIZE_2446_CON_TCX_FX + IF(NE_32(st->element_mode, EVS_MONO)) // to keep evs bit-exactness + { +#endif // !HARMONIZE_2446_CON_TCX_FX if ( GT_16( sub( Q_syn, st->Q_syn_factor ), scf ) ) { Q_syn = add( scf, st->Q_syn_factor ); // so that (Q_syn - st->Q_syn_factor) = scf; } tmp_deemph = shl( tmp_deemph, sub( Q_syn, st->Q_syn_factor ) ); +#ifdef HARMONIZE_2446_CON_TCX_FX + } + ELSE + { + tmp_deemph = shl_sat(tmp_deemph, Q_syn); /*Q_syn*/ + st->Q_syn_factor = 0; + move16(); + } +#endif // !HARMONIZE_2446_CON_TCX_FX st->Q_syn = Q_syn; move16(); @@ -2139,7 +2165,7 @@ void con_tcx_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX st->hHQ_core->Q_old_wtda_LB = Q_syn; // st->hHQ_core->Q_old_wtda #else - IF( NE_16( st->element_mode, EVS_MONO ) ) + IF( EQ_16( st->element_mode, EVS_MONO ) ) { st->hHQ_core->Q_old_wtda_LB = Q_syn; // st->hHQ_core->Q_old_wtda } -- GitLab From a4536fd8e4739d84bfca4ec141b4a6372658aa23 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Fri, 20 Feb 2026 10:51:16 +0100 Subject: [PATCH 15/44] issue: 2446 Clang formatting patch --- lib_dec/er_dec_tcx_fx.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index ea8ba9a37..b06f75986 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1873,19 +1873,19 @@ void con_tcx_ivas_fx( Copy( synth - M, buf, M ); /*Q_syn*/ #ifdef HARMONIZE_2446_CON_TCX_FX - IF(NE_32(st->element_mode, EVS_MONO)) // to keep evs bit-exactness + IF( NE_32( st->element_mode, EVS_MONO ) ) // to keep evs bit-exactness { #endif // HARMONIZE_2446_CON_TCX_FX - scf = norm_s(tmp_deemph); - new_Q = sub(Q_exc, 4); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow - new_Q = s_max(new_Q, -1); - new_Q = s_min(new_Q, scf); + scf = norm_s( tmp_deemph ); + new_Q = sub( Q_exc, 4 ); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow + new_Q = s_max( new_Q, -1 ); + new_Q = s_min( new_Q, scf ); #ifdef HARMONIZE_2446_CON_TCX_FX } ELSE { - new_Q = sub(Q_exc, 3); - new_Q = s_max(new_Q, -1); + new_Q = sub( Q_exc, 3 ); + new_Q = s_max( new_Q, -1 ); scf = 0; move16(); } @@ -1900,19 +1900,19 @@ void con_tcx_ivas_fx( Copy_Scale_sig( buf, mem_syn, M, exp_scale ); /* Q: tmp16 */ #ifdef HARMONIZE_2446_CON_TCX_FX - IF(NE_32(st->element_mode, EVS_MONO)) // to keep evs bit-exactness + IF( NE_32( st->element_mode, EVS_MONO ) ) // to keep evs bit-exactness { #endif // !HARMONIZE_2446_CON_TCX_FX - if ( GT_16( sub( Q_syn, st->Q_syn_factor ), scf ) ) - { - Q_syn = add( scf, st->Q_syn_factor ); // so that (Q_syn - st->Q_syn_factor) = scf; - } - tmp_deemph = shl( tmp_deemph, sub( Q_syn, st->Q_syn_factor ) ); + if ( GT_16( sub( Q_syn, st->Q_syn_factor ), scf ) ) + { + Q_syn = add( scf, st->Q_syn_factor ); // so that (Q_syn - st->Q_syn_factor) = scf; + } + tmp_deemph = shl( tmp_deemph, sub( Q_syn, st->Q_syn_factor ) ); #ifdef HARMONIZE_2446_CON_TCX_FX } ELSE { - tmp_deemph = shl_sat(tmp_deemph, Q_syn); /*Q_syn*/ + tmp_deemph = shl_sat( tmp_deemph, Q_syn ); /*Q_syn*/ st->Q_syn_factor = 0; move16(); } -- GitLab From 7c092f1d19d1e67476c6d9ba126fedbc3bea2d2f Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Fri, 20 Feb 2026 11:59:03 +0100 Subject: [PATCH 16/44] issue: 2446 re adding unintentially removed snippet --- lib_dec/er_dec_tcx_fx.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index b06f75986..9911b4afb 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1306,7 +1306,18 @@ void con_tcx_ivas_fx( FOR( i = 0; i < Tc; i++ ) { #ifndef HARMONIZE_2446_CON_TCX_FX - + * pt_exc++ = mac_r(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac( + L_mult(-174 /*-0.0053f Q15*/, pt1_exc[-5]), + -121 /*-0.0037f Q15*/, pt1_exc[-4] ), + -459 /*-0.0140f Q15*/, pt1_exc[-3] ), + 590 /* 0.0180f Q15*/, pt1_exc[-2] ), + 8743 /* 0.2668f Q15*/, pt1_exc[-1] ), + 16355 /* 0.4991f Q15*/, pt1_exc[0] ), + 8743 /* 0.2668f Q15*/, pt1_exc[1] ), + 590 /* 0.0180f Q15*/, pt1_exc[2] ), + -459 /*-0.0140f Q15*/, pt1_exc[3] ), + -121 /*-0.0037f Q15*/, pt1_exc[4] ), + -174 /*-0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ #else IF( NE_32( st->element_mode, EVS_MONO ) ) { -- GitLab From 5e649f7df643456993a6182dfa2fb79bd9ead2fa Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Fri, 20 Feb 2026 15:48:45 +0100 Subject: [PATCH 17/44] issue: 2446 fixing mistakinglz swaped if else statements --- lib_dec/er_dec_tcx_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 9911b4afb..65a90853d 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1054,11 +1054,11 @@ void con_tcx_ivas_fx( #else IF( NE_16( st->element_mode, EVS_MONO ) ) { - Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 ); + Q_exc = E_UTIL_f_preemph3(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), st->preemph_fac, add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl(M, 1)), &mem, 1); } ELSE { - Q_exc = E_UTIL_f_preemph3( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 ); + Q_exc = E_UTIL_f_preemph3_ivas_fx(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), st->preemph_fac, add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl(M, 1)), &mem, 1); } #endif // !HARMONIZE_2446_CON_TCX_FX -- GitLab From 7725ade594755ac3b3f4c871b0093ac973071160 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Fri, 20 Feb 2026 15:52:36 +0100 Subject: [PATCH 18/44] issue: 2446 Clang formatting patch --- lib_dec/er_dec_tcx_fx.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 65a90853d..7c81358fc 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1054,11 +1054,11 @@ void con_tcx_ivas_fx( #else IF( NE_16( st->element_mode, EVS_MONO ) ) { - Q_exc = E_UTIL_f_preemph3(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), st->preemph_fac, add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl(M, 1)), &mem, 1); + Q_exc = E_UTIL_f_preemph3( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 ); } ELSE { - Q_exc = E_UTIL_f_preemph3_ivas_fx(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), st->preemph_fac, add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl(M, 1)), &mem, 1); + Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 ); } #endif // !HARMONIZE_2446_CON_TCX_FX @@ -1306,18 +1306,18 @@ void con_tcx_ivas_fx( FOR( i = 0; i < Tc; i++ ) { #ifndef HARMONIZE_2446_CON_TCX_FX - * pt_exc++ = mac_r(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac(L_mac( - L_mult(-174 /*-0.0053f Q15*/, pt1_exc[-5]), - -121 /*-0.0037f Q15*/, pt1_exc[-4] ), - -459 /*-0.0140f Q15*/, pt1_exc[-3] ), - 590 /* 0.0180f Q15*/, pt1_exc[-2] ), - 8743 /* 0.2668f Q15*/, pt1_exc[-1] ), - 16355 /* 0.4991f Q15*/, pt1_exc[0] ), - 8743 /* 0.2668f Q15*/, pt1_exc[1] ), - 590 /* 0.0180f Q15*/, pt1_exc[2] ), - -459 /*-0.0140f Q15*/, pt1_exc[3] ), - -121 /*-0.0037f Q15*/, pt1_exc[4] ), - -174 /*-0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ + *pt_exc++ = mac_r( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( + L_mult( -174 /*-0.0053f Q15*/, pt1_exc[-5] ), + -121 /*-0.0037f Q15*/, pt1_exc[-4] ), + -459 /*-0.0140f Q15*/, pt1_exc[-3] ), + 590 /* 0.0180f Q15*/, pt1_exc[-2] ), + 8743 /* 0.2668f Q15*/, pt1_exc[-1] ), + 16355 /* 0.4991f Q15*/, pt1_exc[0] ), + 8743 /* 0.2668f Q15*/, pt1_exc[1] ), + 590 /* 0.0180f Q15*/, pt1_exc[2] ), + -459 /*-0.0140f Q15*/, pt1_exc[3] ), + -121 /*-0.0037f Q15*/, pt1_exc[4] ), + -174 /*-0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ #else IF( NE_32( st->element_mode, EVS_MONO ) ) { -- GitLab From 2965b69b41b4876750bb7508a12d63e7ce9b47f8 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 23 Feb 2026 16:52:20 +0100 Subject: [PATCH 19/44] =?UTF-8?q?issue:=202446=20=C2=B4Replacing=20the=20l?= =?UTF-8?q?egacy=20flag=20with=20a=20more=20generalized=20one=20-=20replac?= =?UTF-8?q?ing=20shl()=20function=20with=20shl=5Fsat()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib_dec/er_dec_tcx_fx.c | 159 +++++++++++++++------------------------- 1 file changed, 61 insertions(+), 98 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 7c81358fc..fb26fc665 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -985,6 +985,10 @@ void con_tcx_ivas_fx( HQ_DEC_HANDLE hHQ_core; TCX_LTP_DEC_HANDLE hTcxLtpDec; TCX_DEC_HANDLE hTcxDec; +#ifdef HARMONIZE_2446_CON_TCX_FX + Word16 leg_flag; + leg_flag = EQ_16(st->element_mode, EVS_MONO) || EQ_16(st->element_mode, IVAS_SCE) || LE_16(st->element_brate,48000); +#endif // HARMONIZE_2446_CON_TCX_FX hTcxLtpDec = st->hTcxLtpDec; hHQ_core = st->hHQ_core; @@ -1046,28 +1050,28 @@ void con_tcx_ivas_fx( IF( ( EQ_16( st->nbLostCmpt, 1 ) ) || hTcxDec->tcxConceal_recalc_exc ) { /* apply pre-emphasis to the signal */ - mem = shl( synth[( -( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + M + M ) - 1 )], st->Q_syn_factor ); + mem = shl_sat( synth[( -( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + M + M ) - 1 )], st->Q_syn_factor ); move16(); #ifndef HARMONIZE_2446_CON_TCX_FX Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 ); #else - IF( NE_16( st->element_mode, EVS_MONO ) ) + IF( !leg_flag ) { - Q_exc = E_UTIL_f_preemph3( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 ); + Q_exc = E_UTIL_f_preemph3_ivas_fx(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), st->preemph_fac, add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl_sat(M, 1)), &mem, 1); } ELSE { - Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 ); + Q_exc = E_UTIL_f_preemph3(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), st->preemph_fac, add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl_sat(M, 1)), &mem, 1); } #endif // !HARMONIZE_2446_CON_TCX_FX - scale_sig( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ + scale_sig( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl_sat( M, 1 ) ), negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ st->Mode2_lp_gainc = L_deposit_l( 0 ); - st->Mode2_lp_gainp = get_gain2( synth - shl( L_subfr, 1 ), synth - add( shl( L_subfr, 1 ), Tc ), shl( L_subfr, 1 ) ); + st->Mode2_lp_gainp = get_gain2( synth - shl_sat( L_subfr, 1 ), synth - add( shl_sat( L_subfr, 1 ), Tc ), shl_sat( L_subfr, 1 ) ); move32(); st->Mode2_lp_gainp = L_max( st->Mode2_lp_gainp, 0 ); /*Q16*/ @@ -1091,7 +1095,7 @@ void con_tcx_ivas_fx( E_LPC_lev_dur_ivas_fx( r_h, r_l, A_local, NULL, M, NULL ); #else - IF( NE_16( st->element_mode, EVS_MONO ) ) + IF( !leg_flag ) { E_LPC_lev_dur_ivas_fx( r_h, r_l, A_local, NULL, M, NULL ); } @@ -1111,23 +1115,23 @@ void con_tcx_ivas_fx( BASOP_SATURATE_WARNING_OFF_EVS /*saturation possible in case of spiky synthesis*/ Residu3_fx( A_local, - &( synth[-add( add( add( shl( L_subfr, 1 ), Tc ), 1 ), M )] ), /*Qx = Q0*/ - &( exc[-add( add( add( shl( L_subfr, 1 ), Tc ), 1 ), M )] ), /*Qx+1 = Q1*/ - add( add( add( shl( L_subfr, 1 ), Tc ), 1 ), M ), + &( synth[-add( add( add( shl_sat( L_subfr, 1 ), Tc ), 1 ), M )] ), /*Qx = Q0*/ + &( exc[-add( add( add( shl_sat( L_subfr, 1 ), Tc ), 1 ), M )] ), /*Qx+1 = Q1*/ + add( add( add( shl_sat( L_subfr, 1 ), Tc ), 1 ), M ), 1 ); BASOP_SATURATE_WARNING_ON_EVS } ELSE { /* apply pre-emphasis to the signal */ - mem = shl( synth[( -L_frame - 1 )], st->Q_syn_factor ); /*hTcxDec->Q_synth_factor_old*/ + mem = shl_sat( synth[( -L_frame - 1 )], st->Q_syn_factor ); /*hTcxDec->Q_synth_factor_old*/ move16(); #ifndef HARMONIZE_2446_CON_TCX_FX Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-L_frame] ), st->preemph_fac, L_frame, &mem, 1 ); scale_sig( &synth[-L_frame], L_frame, negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ #else - IF( NE_16( st->element_mode, EVS_MONO ) ) + IF( !leg_flag ) { Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-L_frame] ), st->preemph_fac, L_frame, &mem, 1 ); scale_sig( &synth[-L_frame], L_frame, negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ @@ -1153,7 +1157,7 @@ void con_tcx_ivas_fx( } ELSE { - Copy_Scale_sig( hTcxDec->old_excFB_fx, &( exc[-( L_subfr * 2 )] ), add( shl( L_subfr, 1 ), offset ), sub( Q_exc, st->Q_exc ) ); /*Q_exc*/ + Copy_Scale_sig( hTcxDec->old_excFB_fx, &( exc[-( L_subfr * 2 )] ), add( shl_sat( L_subfr, 1 ), offset ), sub( Q_exc, st->Q_exc ) ); /*Q_exc*/ } } @@ -1192,7 +1196,7 @@ void con_tcx_ivas_fx( scale_tmp = mult_r( hTcxDec->L_frameTCX, getInvFrameLen( st->L_frame ) ); /*getInvFrameLen()->9Q6*/ tmp_shift = norm_s( scale_tmp ); - predPitchLag = L_shl( Mpy_32_16_1( tcxltp_pitch_tmp, shl( scale_tmp, tmp_shift ) ), sub( 9, tmp_shift ) ); /*Q16*/ + predPitchLag = L_shl( Mpy_32_16_1( tcxltp_pitch_tmp, shl_sat( scale_tmp, tmp_shift ) ), sub( 9, tmp_shift ) ); /*Q16*/ T0 = round_fx( predPitchLag ); /*Q0*/ @@ -1265,36 +1269,19 @@ void con_tcx_ivas_fx( 0 /* 0.0000f Q15*/, pt1_exc[4] ), 174 /* 0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ #else - IF( NE_32( st->element_mode, EVS_MONO ) ) - { - *pt_exc++ = mac_r( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( - L_mult( 174 /* 0.0053f Q15*/, pt1_exc[-5] ), - 0 /* 0.0000f Q15*/, pt1_exc[-4] ), - -1442 /*-0.0440f Q15*/, pt1_exc[-3] ), - 0 /* 0.0000f Q15*/, pt1_exc[-2] ), - 8641 /* 0.2637f Q15*/, pt1_exc[-1] ), - 18022 /* 0.5500f Q15*/, pt1_exc[0] ), - 8641 /* 0.2637f Q15*/, pt1_exc[1] ), - 0 /* 0.0000f Q15*/, pt1_exc[2] ), - -1442 /*-0.0440f Q15*/, pt1_exc[3] ), - 0 /* 0.0000f Q15*/, pt1_exc[4] ), - 174 /* 0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ - } - ELSE - { - *pt_exc++ = mac_r_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( - L_mult( 174 /* 0.0053f Q15*/, pt1_exc[-5] ), - 0 /* 0.0000f Q15*/, pt1_exc[-4] ), - -1442 /*-0.0440f Q15*/, pt1_exc[-3] ), - 0 /* 0.0000f Q15*/, pt1_exc[-2] ), - 8641 /* 0.2637f Q15*/, pt1_exc[-1] ), - 18022 /* 0.5500f Q15*/, pt1_exc[0] ), - 8641 /* 0.2637f Q15*/, pt1_exc[1] ), - 0 /* 0.0000f Q15*/, pt1_exc[2] ), - -1442 /*-0.0440f Q15*/, pt1_exc[3] ), - 0 /* 0.0000f Q15*/, pt1_exc[4] ), - 174 /* 0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ - } + * pt_exc++ = mac_r_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat( + L_mult(174 /* 0.0053f Q15*/, pt1_exc[-5]), + 0 /* 0.0000f Q15*/, pt1_exc[-4]), + -1442 /*-0.0440f Q15*/, pt1_exc[-3]), + 0 /* 0.0000f Q15*/, pt1_exc[-2]), + 8641 /* 0.2637f Q15*/, pt1_exc[-1]), + 18022 /* 0.5500f Q15*/, pt1_exc[0]), + 8641 /* 0.2637f Q15*/, pt1_exc[1]), + 0 /* 0.0000f Q15*/, pt1_exc[2]), + -1442 /*-0.0440f Q15*/, pt1_exc[3]), + 0 /* 0.0000f Q15*/, pt1_exc[4]), + 174 /* 0.0053f Q15*/, pt1_exc[5]); /*Q_exc*/ + #endif // !HARMONIZE_2446_CON_TCX_FX move16(); @@ -1319,36 +1306,19 @@ void con_tcx_ivas_fx( -121 /*-0.0037f Q15*/, pt1_exc[4] ), -174 /*-0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ #else - IF( NE_32( st->element_mode, EVS_MONO ) ) - { - *pt_exc++ = mac_r( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( L_mac( - L_mult( -174 /*-0.0053f Q15*/, pt1_exc[-5] ), - -121 /*-0.0037f Q15*/, pt1_exc[-4] ), - -459 /*-0.0140f Q15*/, pt1_exc[-3] ), - 590 /* 0.0180f Q15*/, pt1_exc[-2] ), - 8743 /* 0.2668f Q15*/, pt1_exc[-1] ), - 16355 /* 0.4991f Q15*/, pt1_exc[0] ), - 8743 /* 0.2668f Q15*/, pt1_exc[1] ), - 590 /* 0.0180f Q15*/, pt1_exc[2] ), - -459 /*-0.0140f Q15*/, pt1_exc[3] ), - -121 /*-0.0037f Q15*/, pt1_exc[4] ), - -174 /*-0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ - } - ELSE - { - *pt_exc++ = mac_r_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( - L_mult( -174 /*-0.0053f Q15*/, pt1_exc[-5] ), - -121 /*-0.0037f Q15*/, pt1_exc[-4] ), - -459 /*-0.0140f Q15*/, pt1_exc[-3] ), - 590 /* 0.0180f Q15*/, pt1_exc[-2] ), - 8743 /* 0.2668f Q15*/, pt1_exc[-1] ), - 16355 /* 0.4991f Q15*/, pt1_exc[0] ), - 8743 /* 0.2668f Q15*/, pt1_exc[1] ), - 590 /* 0.0180f Q15*/, pt1_exc[2] ), - -459 /*-0.0140f Q15*/, pt1_exc[3] ), - -121 /*-0.0037f Q15*/, pt1_exc[4] ), - -174 /*-0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ - } + * pt_exc++ = mac_r_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat( + L_mult(-174 /*-0.0053f Q15*/, pt1_exc[-5]), + -121 /*-0.0037f Q15*/, pt1_exc[-4]), + -459 /*-0.0140f Q15*/, pt1_exc[-3]), + 590 /* 0.0180f Q15*/, pt1_exc[-2]), + 8743 /* 0.2668f Q15*/, pt1_exc[-1]), + 16355 /* 0.4991f Q15*/, pt1_exc[0]), + 8743 /* 0.2668f Q15*/, pt1_exc[1]), + 590 /* 0.0180f Q15*/, pt1_exc[2]), + -459 /*-0.0140f Q15*/, pt1_exc[3]), + -121 /*-0.0037f Q15*/, pt1_exc[4]), + -174 /*-0.0053f Q15*/, pt1_exc[5]); /*Q_exc*/ + #endif // !HARMONIZE_2446_CON_TCX_FX move16(); @@ -1458,11 +1428,11 @@ void con_tcx_ivas_fx( /*step = (1.0f/(L_frame+(L_frame/2))) * (gain - alpha);*/ tmp16 = shr( imult1616( 3, L_frame ), 1 ); tmp_e = norm_s( tmp16 ); - tmp16 = shl( tmp16, tmp_e ); + tmp16 = shl_sat(tmp16, tmp_e); + tmp16 = div_s( 16384 /*1.f Q14*/, tmp16 ); /*Q15,1+tmp_e-15*/ tmp16_2 = sub( shr( gain, 1 ), alpha ) /*Q14*/; - step32 = L_shl( L_mult( tmp16, tmp16_2 ) /*Q30, 1+tmp_e-15*/, add( 1 - 14, tmp_e ) ) /*Q31*/; - + step32 = L_shl_sat(L_mult(tmp16, tmp16_2) /*Q30, 1+tmp_e-15*/, add(1 - 14, tmp_e)) /*Q31*/; /* PLC: Apply fade out */ tmp_loop = shr( imult1616( L_frame, 3 ), 1 ); FOR( i = offset; i < tmp_loop; i++ ) @@ -1507,7 +1477,7 @@ void con_tcx_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX IF( NE_16( coh, -16384 ) ) #else - IF( NE_16( coh, -16384 ) && NE_16( st->element_mode, EVS_MONO ) ) + IF( NE_16( coh, -16384 ) && !leg_flag ) #endif // !HARMONIZE_2446_CON_TCX_FX { Word16 tmpSeed1; @@ -1574,7 +1544,7 @@ void con_tcx_ivas_fx( st->seed_acelp = tmpSeed; move16(); - tmp_loop = add( add( L_frame, shr( L_frame, 1 ) ), shl( L_FIR_FER2, 1 ) ); + tmp_loop = add( add( L_frame, shr( L_frame, 1 ) ), shl_sat( L_FIR_FER2, 1 ) ); FOR( ; i < tmp_loop; i++ ) { Random( &tmpSeed ); @@ -1695,14 +1665,7 @@ void con_tcx_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX L_tmp = L_shl( gain32, 1 ); /*Q16*/ #else - IF( NE_16( st->element_mode, EVS_MONO ) ) - { - L_tmp = L_shl( gain32, 1 ); /*Q16*/ - } - ELSE - { L_tmp = L_shl_sat( gain32, 1 ); /*Q16*/ - } #endif // !HARMONIZE_2446_CON_TCX_FX IF( GT_32( L_shl( L_deposit_h( gainCNG ), sub( gainCNG_e, 31 - 16 ) /*Q16*/ ), L_tmp ) ) @@ -1740,9 +1703,9 @@ void con_tcx_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX tmp_e = sub( add( tmp_e, shl( noise_e, 1 ) ), 1 ); // actual multiplier! #else - IF( NE_16( st->element_mode, EVS_MONO ) ) + IF( !leg_flag ) { - tmp_e = sub( add( tmp_e, shl( noise_e, 1 ) ), 1 ); // actual multiplier! + tmp_e = sub( add( tmp_e, shl_sat( noise_e, 1 ) ), 1 ); // actual multiplier! } #endif // !HARMONIZE_2446_CON_TCX_FX @@ -1855,7 +1818,7 @@ void con_tcx_ivas_fx( ELSE { bufferCopyFx( noise + L_FIR_FER2 / 2, exc, add( L_frame, shr( L_frame, 1 ) ), 0 /*Q_noise*/, noise_e, Q_exc, 0 /*exc_e*/ ); - Copy( exc + sub( L_frame, shl( L_subfr, 1 ) ), hTcxDec->old_excFB_fx, add( shl( L_subfr, 1 ), shr( L_frame, 1 ) ) ); /*Q_exc*/ + Copy( exc + sub( L_frame, shl_sat( L_subfr, 1 ) ), hTcxDec->old_excFB_fx, add( shl_sat( L_subfr, 1 ), shr( L_frame, 1 ) ) ); /*Q_exc*/ /* copy old_exc as 16kHz for acelp decoding */ IF( EQ_16( st->nbLostCmpt, 1 ) ) { @@ -1884,7 +1847,7 @@ void con_tcx_ivas_fx( Copy( synth - M, buf, M ); /*Q_syn*/ #ifdef HARMONIZE_2446_CON_TCX_FX - IF( NE_32( st->element_mode, EVS_MONO ) ) // to keep evs bit-exactness + IF( !leg_flag ) // to keep evs bit-exactness { #endif // HARMONIZE_2446_CON_TCX_FX scf = norm_s( tmp_deemph ); @@ -1911,14 +1874,14 @@ void con_tcx_ivas_fx( Copy_Scale_sig( buf, mem_syn, M, exp_scale ); /* Q: tmp16 */ #ifdef HARMONIZE_2446_CON_TCX_FX - IF( NE_32( st->element_mode, EVS_MONO ) ) // to keep evs bit-exactness + IF( !leg_flag ) // to keep evs bit-exactness { #endif // !HARMONIZE_2446_CON_TCX_FX if ( GT_16( sub( Q_syn, st->Q_syn_factor ), scf ) ) { Q_syn = add( scf, st->Q_syn_factor ); // so that (Q_syn - st->Q_syn_factor) = scf; } - tmp_deemph = shl( tmp_deemph, sub( Q_syn, st->Q_syn_factor ) ); + tmp_deemph = shl_sat( tmp_deemph, sub( Q_syn, st->Q_syn_factor ) ); #ifdef HARMONIZE_2446_CON_TCX_FX } ELSE @@ -1936,7 +1899,7 @@ void con_tcx_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX IF( A_cng != NULL ) #else - IF( ( A_cng != NULL ) && NE_32( st->element_mode, EVS_MONO ) ) + IF( ( A_cng != NULL ) && !leg_flag ) #endif // !HARMONIZE_2446_CON_TCX_FX { Word16 alpha_delayed; @@ -1998,7 +1961,7 @@ void con_tcx_ivas_fx( deemph_fx( syn, st->preemph_fac, add( L_frame, shr( L_frame, 1 ) ), &tmp_deemph ); #ifdef HARMONIZE_2446_CON_TCX_FX - IF( EQ_32( st->element_mode, EVS_MONO ) ) + IF( leg_flag ) { bufferCopyFx( syn + sub( L_frame, M + 1 ), st->syn, 1 + M, Q_syn, 0, 0, 0 ); /*Q_syn*/ } @@ -2043,7 +2006,7 @@ void con_tcx_ivas_fx( Copy_Scale_sig( syn + L_frame, hTcxDec->syn_OverlFB, shr( L_frame, 1 ), sub( st->Q_syn_factor, Q_syn ) ); hTcxDec->Q_syn_OverlFB = st->Q_syn_factor; #else - IF( NE_16( st->element_mode, EVS_MONO ) ) + IF( !leg_flag ) { scf = add( getScaleFactor16( syn, L_frame ), Q_syn ); IF( LT_16( scf, 0 ) ) // Only avoid left shift in bufferCopyFX when overflow could occur @@ -2094,7 +2057,7 @@ void con_tcx_ivas_fx( hTcxDec->Q_syn_Overl_TDACFB = Q_syn; #else - IF( NE_16( st->element_mode, EVS_MONO ) ) + IF( !leg_flag ) { Copy( syn + L_frame, hTcxDec->syn_Overl_TDACFB, shr( L_frame, 1 ) ); hTcxDec->Q_syn_Overl_TDACFB = Q_syn; @@ -2154,7 +2117,7 @@ void con_tcx_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX st->Q_syn = Q_syn; #else - IF( NE_16( st->element_mode, EVS_MONO ) ) + IF( !leg_flag ) { st->Q_syn = Q_syn; } @@ -2176,7 +2139,7 @@ void con_tcx_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX st->hHQ_core->Q_old_wtda_LB = Q_syn; // st->hHQ_core->Q_old_wtda #else - IF( EQ_16( st->element_mode, EVS_MONO ) ) + IF( leg_flag ) { st->hHQ_core->Q_old_wtda_LB = Q_syn; // st->hHQ_core->Q_old_wtda } -- GitLab From fac516079c85e53fbf6a9c9164959e4bfde3f8e0 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 23 Feb 2026 16:54:45 +0100 Subject: [PATCH 20/44] issue: 2446 Clang formatting patch --- lib_dec/er_dec_tcx_fx.c | 60 ++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index fb26fc665..3e731b8ec 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -987,7 +987,7 @@ void con_tcx_ivas_fx( TCX_DEC_HANDLE hTcxDec; #ifdef HARMONIZE_2446_CON_TCX_FX Word16 leg_flag; - leg_flag = EQ_16(st->element_mode, EVS_MONO) || EQ_16(st->element_mode, IVAS_SCE) || LE_16(st->element_brate,48000); + leg_flag = EQ_16( st->element_mode, EVS_MONO ) || EQ_16( st->element_mode, IVAS_SCE ) || LE_16( st->element_brate, 48000 ); #endif // HARMONIZE_2446_CON_TCX_FX hTcxLtpDec = st->hTcxLtpDec; @@ -1058,11 +1058,11 @@ void con_tcx_ivas_fx( #else IF( !leg_flag ) { - Q_exc = E_UTIL_f_preemph3_ivas_fx(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), st->preemph_fac, add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl_sat(M, 1)), &mem, 1); + Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl_sat( M, 1 ) ), &mem, 1 ); } ELSE { - Q_exc = E_UTIL_f_preemph3(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), st->preemph_fac, add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl_sat(M, 1)), &mem, 1); + Q_exc = E_UTIL_f_preemph3( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl_sat( M, 1 ) ), &mem, 1 ); } #endif // !HARMONIZE_2446_CON_TCX_FX @@ -1269,18 +1269,18 @@ void con_tcx_ivas_fx( 0 /* 0.0000f Q15*/, pt1_exc[4] ), 174 /* 0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ #else - * pt_exc++ = mac_r_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat( - L_mult(174 /* 0.0053f Q15*/, pt1_exc[-5]), - 0 /* 0.0000f Q15*/, pt1_exc[-4]), - -1442 /*-0.0440f Q15*/, pt1_exc[-3]), - 0 /* 0.0000f Q15*/, pt1_exc[-2]), - 8641 /* 0.2637f Q15*/, pt1_exc[-1]), - 18022 /* 0.5500f Q15*/, pt1_exc[0]), - 8641 /* 0.2637f Q15*/, pt1_exc[1]), - 0 /* 0.0000f Q15*/, pt1_exc[2]), - -1442 /*-0.0440f Q15*/, pt1_exc[3]), - 0 /* 0.0000f Q15*/, pt1_exc[4]), - 174 /* 0.0053f Q15*/, pt1_exc[5]); /*Q_exc*/ + *pt_exc++ = mac_r_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( + L_mult( 174 /* 0.0053f Q15*/, pt1_exc[-5] ), + 0 /* 0.0000f Q15*/, pt1_exc[-4] ), + -1442 /*-0.0440f Q15*/, pt1_exc[-3] ), + 0 /* 0.0000f Q15*/, pt1_exc[-2] ), + 8641 /* 0.2637f Q15*/, pt1_exc[-1] ), + 18022 /* 0.5500f Q15*/, pt1_exc[0] ), + 8641 /* 0.2637f Q15*/, pt1_exc[1] ), + 0 /* 0.0000f Q15*/, pt1_exc[2] ), + -1442 /*-0.0440f Q15*/, pt1_exc[3] ), + 0 /* 0.0000f Q15*/, pt1_exc[4] ), + 174 /* 0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ #endif // !HARMONIZE_2446_CON_TCX_FX @@ -1306,18 +1306,18 @@ void con_tcx_ivas_fx( -121 /*-0.0037f Q15*/, pt1_exc[4] ), -174 /*-0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ #else - * pt_exc++ = mac_r_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat(L_mac_sat( - L_mult(-174 /*-0.0053f Q15*/, pt1_exc[-5]), - -121 /*-0.0037f Q15*/, pt1_exc[-4]), - -459 /*-0.0140f Q15*/, pt1_exc[-3]), - 590 /* 0.0180f Q15*/, pt1_exc[-2]), - 8743 /* 0.2668f Q15*/, pt1_exc[-1]), - 16355 /* 0.4991f Q15*/, pt1_exc[0]), - 8743 /* 0.2668f Q15*/, pt1_exc[1]), - 590 /* 0.0180f Q15*/, pt1_exc[2]), - -459 /*-0.0140f Q15*/, pt1_exc[3]), - -121 /*-0.0037f Q15*/, pt1_exc[4]), - -174 /*-0.0053f Q15*/, pt1_exc[5]); /*Q_exc*/ + *pt_exc++ = mac_r_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( L_mac_sat( + L_mult( -174 /*-0.0053f Q15*/, pt1_exc[-5] ), + -121 /*-0.0037f Q15*/, pt1_exc[-4] ), + -459 /*-0.0140f Q15*/, pt1_exc[-3] ), + 590 /* 0.0180f Q15*/, pt1_exc[-2] ), + 8743 /* 0.2668f Q15*/, pt1_exc[-1] ), + 16355 /* 0.4991f Q15*/, pt1_exc[0] ), + 8743 /* 0.2668f Q15*/, pt1_exc[1] ), + 590 /* 0.0180f Q15*/, pt1_exc[2] ), + -459 /*-0.0140f Q15*/, pt1_exc[3] ), + -121 /*-0.0037f Q15*/, pt1_exc[4] ), + -174 /*-0.0053f Q15*/, pt1_exc[5] ); /*Q_exc*/ #endif // !HARMONIZE_2446_CON_TCX_FX @@ -1428,11 +1428,11 @@ void con_tcx_ivas_fx( /*step = (1.0f/(L_frame+(L_frame/2))) * (gain - alpha);*/ tmp16 = shr( imult1616( 3, L_frame ), 1 ); tmp_e = norm_s( tmp16 ); - tmp16 = shl_sat(tmp16, tmp_e); + tmp16 = shl_sat( tmp16, tmp_e ); tmp16 = div_s( 16384 /*1.f Q14*/, tmp16 ); /*Q15,1+tmp_e-15*/ tmp16_2 = sub( shr( gain, 1 ), alpha ) /*Q14*/; - step32 = L_shl_sat(L_mult(tmp16, tmp16_2) /*Q30, 1+tmp_e-15*/, add(1 - 14, tmp_e)) /*Q31*/; + step32 = L_shl_sat( L_mult( tmp16, tmp16_2 ) /*Q30, 1+tmp_e-15*/, add( 1 - 14, tmp_e ) ) /*Q31*/; /* PLC: Apply fade out */ tmp_loop = shr( imult1616( L_frame, 3 ), 1 ); FOR( i = offset; i < tmp_loop; i++ ) @@ -1665,7 +1665,7 @@ void con_tcx_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX L_tmp = L_shl( gain32, 1 ); /*Q16*/ #else - L_tmp = L_shl_sat( gain32, 1 ); /*Q16*/ + L_tmp = L_shl_sat( gain32, 1 ); /*Q16*/ #endif // !HARMONIZE_2446_CON_TCX_FX IF( GT_32( L_shl( L_deposit_h( gainCNG ), sub( gainCNG_e, 31 - 16 ) /*Q16*/ ), L_tmp ) ) -- GitLab From 8db09fde252f07c30274603d2380283e056b5b86 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 23 Feb 2026 16:58:31 +0100 Subject: [PATCH 21/44] issue: 2446 changing definition of flag to avoid warning treated as error --- lib_dec/er_dec_tcx_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 3e731b8ec..aed100462 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -986,7 +986,7 @@ void con_tcx_ivas_fx( TCX_LTP_DEC_HANDLE hTcxLtpDec; TCX_DEC_HANDLE hTcxDec; #ifdef HARMONIZE_2446_CON_TCX_FX - Word16 leg_flag; + Word32 leg_flag; leg_flag = EQ_16( st->element_mode, EVS_MONO ) || EQ_16( st->element_mode, IVAS_SCE ) || LE_16( st->element_brate, 48000 ); #endif // HARMONIZE_2446_CON_TCX_FX -- GitLab From 0ca1be07983e72717966de368d8d07ae48829c87 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 23 Feb 2026 17:03:50 +0100 Subject: [PATCH 22/44] issue: 2446 changing definition of flag to avoid warning treated as error --- lib_dec/er_dec_tcx_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index aed100462..e45539ee9 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -986,7 +986,7 @@ void con_tcx_ivas_fx( TCX_LTP_DEC_HANDLE hTcxLtpDec; TCX_DEC_HANDLE hTcxDec; #ifdef HARMONIZE_2446_CON_TCX_FX - Word32 leg_flag; + int leg_flag; leg_flag = EQ_16( st->element_mode, EVS_MONO ) || EQ_16( st->element_mode, IVAS_SCE ) || LE_16( st->element_brate, 48000 ); #endif // HARMONIZE_2446_CON_TCX_FX -- GitLab From 6b6eab31ee55f193ae966752245d8e7a109f4c28 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 23 Feb 2026 17:19:40 +0100 Subject: [PATCH 23/44] issue: 2446 trying to fix overflow through auto casting --- lib_dec/er_dec_tcx_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index e45539ee9..7f9a6a9eb 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -987,7 +987,7 @@ void con_tcx_ivas_fx( TCX_DEC_HANDLE hTcxDec; #ifdef HARMONIZE_2446_CON_TCX_FX int leg_flag; - leg_flag = EQ_16( st->element_mode, EVS_MONO ) || EQ_16( st->element_mode, IVAS_SCE ) || LE_16( st->element_brate, 48000 ); + leg_flag = EQ_16( st->element_mode, EVS_MONO ) || EQ_16( st->element_mode, IVAS_SCE ) || LT_32( st->element_brate, 48000 ); #endif // HARMONIZE_2446_CON_TCX_FX hTcxLtpDec = st->hTcxLtpDec; -- GitLab From a6bd2407cd33db6ca520746a41afa5595e3a1ce6 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Tue, 24 Feb 2026 16:37:24 +0100 Subject: [PATCH 24/44] issue: 2446 replacing old flag that was overlooked --- lib_dec/er_dec_tcx_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 7f9a6a9eb..cdd43b5d5 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1723,7 +1723,7 @@ void con_tcx_ivas_fx( move16(); } #else - IF( NE_16( st->element_mode, EVS_MONO ) ) + IF( !leg_flag ) { tmp_e = add( tmp_e, 31 - 6 ); /*-->Q31*/ gain_inov = 0; -- GitLab From b6109e60e405c2fd8ff1bcb5ea535d6ccae0199d Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Wed, 25 Feb 2026 14:22:44 +0100 Subject: [PATCH 25/44] issue: 2446 refining conditional statements that were mistakenly harmonized - reverting one condition at the end of the function --- lib_dec/er_dec_tcx_fx.c | 85 ++++++++++++++++++++++++++--------------- 1 file changed, 55 insertions(+), 30 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index cdd43b5d5..f8dc3a085 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1845,25 +1845,28 @@ void con_tcx_ivas_fx( syn = buf + M; /*Q_syn*/ Copy( synth - M, buf, M ); /*Q_syn*/ - -#ifdef HARMONIZE_2446_CON_TCX_FX - IF( !leg_flag ) // to keep evs bit-exactness - { -#endif // HARMONIZE_2446_CON_TCX_FX - scf = norm_s( tmp_deemph ); - new_Q = sub( Q_exc, 4 ); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow - new_Q = s_max( new_Q, -1 ); - new_Q = s_min( new_Q, scf ); -#ifdef HARMONIZE_2446_CON_TCX_FX +#ifndef HARMONIZE_2446_CON_TCX_FX + scf = norm_s(tmp_deemph); + new_Q = sub(Q_exc, 4); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow + new_Q = s_max(new_Q, -1); + new_Q = s_min(new_Q, scf); +#else + IF(!leg_flag || NE_32(st->element_mode, EVS_MONO)) { + scf = norm_s(tmp_deemph); + new_Q = sub(Q_exc, 4); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow + new_Q = s_max(new_Q, -1); + new_Q = s_min(new_Q, scf); } - ELSE - { - new_Q = sub( Q_exc, 3 ); - new_Q = s_max( new_Q, -1 ); + ELSE{ + new_Q = sub(Q_exc, 3); + new_Q = s_max(new_Q, -1); + scf = 0; move16(); } -#endif // HARMONIZE_2446_CON_TCX_FX +#endif // !HARMONIZE_2446_CON_TCX_FX + + tmp16 = s_min( new_Q, st->prev_Q_syn ); st->prev_Q_syn = new_Q; move16(); @@ -1873,27 +1876,49 @@ void con_tcx_ivas_fx( move16(); Copy_Scale_sig( buf, mem_syn, M, exp_scale ); /* Q: tmp16 */ -#ifdef HARMONIZE_2446_CON_TCX_FX - IF( !leg_flag ) // to keep evs bit-exactness +#ifndef HARMONIZE_2446_CON_TCX_FX + + if ( GT_16( sub( Q_syn, st->Q_syn_factor ), scf ) ) { -#endif // !HARMONIZE_2446_CON_TCX_FX - if ( GT_16( sub( Q_syn, st->Q_syn_factor ), scf ) ) + Q_syn = add( scf, st->Q_syn_factor ); // so that (Q_syn - st->Q_syn_factor) = scf; + } + tmp_deemph = shl_sat( tmp_deemph, sub( Q_syn, st->Q_syn_factor ) ); + + st->Q_syn = Q_syn; + move16(); + +#else + IF(!leg_flag) { + + if (GT_16(sub(Q_syn, st->Q_syn_factor), scf)) { - Q_syn = add( scf, st->Q_syn_factor ); // so that (Q_syn - st->Q_syn_factor) = scf; + Q_syn = add(scf, st->Q_syn_factor); // so that (Q_syn - st->Q_syn_factor) = scf; } - tmp_deemph = shl_sat( tmp_deemph, sub( Q_syn, st->Q_syn_factor ) ); -#ifdef HARMONIZE_2446_CON_TCX_FX - } - ELSE - { - tmp_deemph = shl_sat( tmp_deemph, Q_syn ); /*Q_syn*/ - st->Q_syn_factor = 0; + tmp_deemph = shl_sat(tmp_deemph, sub(Q_syn, st->Q_syn_factor)); + + st->Q_syn = Q_syn; move16(); + } -#endif // !HARMONIZE_2446_CON_TCX_FX + ELSE { + IF(NE_32(st->element_mode, EVS_MONO)) // to keep evs bit-exactness + { + if (GT_16(sub(Q_syn, st->Q_syn_factor), scf)) + { + Q_syn = add(scf, st->Q_syn_factor); // so that (Q_syn - st->Q_syn_factor) = scf; + } + tmp_deemph = shl(tmp_deemph, sub(Q_syn, st->Q_syn_factor)); + } + ELSE + { + tmp_deemph = shl_sat(tmp_deemph, Q_syn); /*Q_syn*/ + } + st->Q_syn_factor = 0; + move16(); st->Q_syn = Q_syn; move16(); - + } +#endif // !HARMONIZE_2446_CON_TCX_FX /*buf[OLD_EXC_SIZE_DEC;3/2 L_frame] Q1: exc*/ /*buf[0;M] Q0: mem_syn*/ #ifndef HARMONIZE_2446_CON_TCX_FX @@ -2139,7 +2164,7 @@ void con_tcx_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX st->hHQ_core->Q_old_wtda_LB = Q_syn; // st->hHQ_core->Q_old_wtda #else - IF( leg_flag ) + IF( !leg_flag ) { st->hHQ_core->Q_old_wtda_LB = Q_syn; // st->hHQ_core->Q_old_wtda } -- GitLab From 28ccece878d438c2b873adee09bba103d7d0b668 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Wed, 25 Feb 2026 14:48:07 +0100 Subject: [PATCH 26/44] issue: 2446 clang formatting patch --- lib_dec/er_dec_tcx_fx.c | 59 ++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index f8dc3a085..5e39afce8 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1846,27 +1846,29 @@ void con_tcx_ivas_fx( syn = buf + M; /*Q_syn*/ Copy( synth - M, buf, M ); /*Q_syn*/ #ifndef HARMONIZE_2446_CON_TCX_FX - scf = norm_s(tmp_deemph); - new_Q = sub(Q_exc, 4); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow - new_Q = s_max(new_Q, -1); - new_Q = s_min(new_Q, scf); + scf = norm_s( tmp_deemph ); + new_Q = sub( Q_exc, 4 ); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow + new_Q = s_max( new_Q, -1 ); + new_Q = s_min( new_Q, scf ); #else - IF(!leg_flag || NE_32(st->element_mode, EVS_MONO)) { - scf = norm_s(tmp_deemph); - new_Q = sub(Q_exc, 4); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow - new_Q = s_max(new_Q, -1); - new_Q = s_min(new_Q, scf); + IF( !leg_flag || NE_32( st->element_mode, EVS_MONO ) ) + { + scf = norm_s( tmp_deemph ); + new_Q = sub( Q_exc, 4 ); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow + new_Q = s_max( new_Q, -1 ); + new_Q = s_min( new_Q, scf ); } - ELSE{ - new_Q = sub(Q_exc, 3); - new_Q = s_max(new_Q, -1); + ELSE + { + new_Q = sub( Q_exc, 3 ); + new_Q = s_max( new_Q, -1 ); scf = 0; move16(); } #endif // !HARMONIZE_2446_CON_TCX_FX - + tmp16 = s_min( new_Q, st->prev_Q_syn ); st->prev_Q_syn = new_Q; move16(); @@ -1888,35 +1890,36 @@ void con_tcx_ivas_fx( move16(); #else - IF(!leg_flag) { + IF( !leg_flag ) + { - if (GT_16(sub(Q_syn, st->Q_syn_factor), scf)) + if ( GT_16( sub( Q_syn, st->Q_syn_factor ), scf ) ) { - Q_syn = add(scf, st->Q_syn_factor); // so that (Q_syn - st->Q_syn_factor) = scf; + Q_syn = add( scf, st->Q_syn_factor ); // so that (Q_syn - st->Q_syn_factor) = scf; } - tmp_deemph = shl_sat(tmp_deemph, sub(Q_syn, st->Q_syn_factor)); + tmp_deemph = shl_sat( tmp_deemph, sub( Q_syn, st->Q_syn_factor ) ); st->Q_syn = Q_syn; move16(); - } - ELSE { - IF(NE_32(st->element_mode, EVS_MONO)) // to keep evs bit-exactness + ELSE + { + IF( NE_32( st->element_mode, EVS_MONO ) ) // to keep evs bit-exactness { - if (GT_16(sub(Q_syn, st->Q_syn_factor), scf)) + if ( GT_16( sub( Q_syn, st->Q_syn_factor ), scf ) ) { - Q_syn = add(scf, st->Q_syn_factor); // so that (Q_syn - st->Q_syn_factor) = scf; + Q_syn = add( scf, st->Q_syn_factor ); // so that (Q_syn - st->Q_syn_factor) = scf; } - tmp_deemph = shl(tmp_deemph, sub(Q_syn, st->Q_syn_factor)); + tmp_deemph = shl( tmp_deemph, sub( Q_syn, st->Q_syn_factor ) ); } ELSE { - tmp_deemph = shl_sat(tmp_deemph, Q_syn); /*Q_syn*/ + tmp_deemph = shl_sat( tmp_deemph, Q_syn ); /*Q_syn*/ } - st->Q_syn_factor = 0; - move16(); - st->Q_syn = Q_syn; - move16(); + st->Q_syn_factor = 0; + move16(); + st->Q_syn = Q_syn; + move16(); } #endif // !HARMONIZE_2446_CON_TCX_FX /*buf[OLD_EXC_SIZE_DEC;3/2 L_frame] Q1: exc*/ -- GitLab From 5d62d198fc9835533559d5d2922f68eca31720da Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 26 Feb 2026 13:43:17 +0100 Subject: [PATCH 27/44] issue: 2446 fixing previously mistake using ivas function for legacy purpose --- lib_dec/er_dec_tcx_fx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 5e39afce8..b10b8e4be 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -988,6 +988,11 @@ void con_tcx_ivas_fx( #ifdef HARMONIZE_2446_CON_TCX_FX int leg_flag; leg_flag = EQ_16( st->element_mode, EVS_MONO ) || EQ_16( st->element_mode, IVAS_SCE ) || LT_32( st->element_brate, 48000 ); +#if 1 + IF(coh == -16384 && noise_seed == NULL && only_left == 0 && A_cng == NULL) { + leg_flag = 0; + } +#endif #endif // HARMONIZE_2446_CON_TCX_FX hTcxLtpDec = st->hTcxLtpDec; -- GitLab From fbcf8945e8db86e17cdd611ca2576a6a7d238392 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 26 Feb 2026 13:46:09 +0100 Subject: [PATCH 28/44] issue: 2446 Clang formatting patch --- lib_dec/er_dec_tcx_fx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index b10b8e4be..ea86d08aa 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -989,7 +989,8 @@ void con_tcx_ivas_fx( int leg_flag; leg_flag = EQ_16( st->element_mode, EVS_MONO ) || EQ_16( st->element_mode, IVAS_SCE ) || LT_32( st->element_brate, 48000 ); #if 1 - IF(coh == -16384 && noise_seed == NULL && only_left == 0 && A_cng == NULL) { + IF( coh == -16384 && noise_seed == NULL && only_left == 0 && A_cng == NULL ) + { leg_flag = 0; } #endif -- GitLab From 7c5be96bec26d2d98b1606d224806be8abb05c7b Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 26 Feb 2026 15:29:02 +0100 Subject: [PATCH 29/44] issue: 2446 Adding #ifdef to overlooked places --- lib_dec/er_dec_tcx_fx.c | 72 +++++++++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 17 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index ea86d08aa..13aac65fa 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1056,8 +1056,12 @@ void con_tcx_ivas_fx( IF( ( EQ_16( st->nbLostCmpt, 1 ) ) || hTcxDec->tcxConceal_recalc_exc ) { /* apply pre-emphasis to the signal */ - mem = shl_sat( synth[( -( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + M + M ) - 1 )], st->Q_syn_factor ); - move16(); +#ifndef HARMONIZE_2446_CON_TCX_FX + mem = shl(synth[(-(((L_frame / 2) + hTcxDec->pit_max_TCX) + M + M) - 1)], st->Q_syn_factor); +#else + mem = shl_sat(synth[(-(((L_frame / 2) + hTcxDec->pit_max_TCX) + M + M) - 1)], st->Q_syn_factor); +#endif // !HARMONIZE_2446_CON_TCX_FX + move16(); #ifndef HARMONIZE_2446_CON_TCX_FX Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 ); @@ -1119,12 +1123,21 @@ void con_tcx_ivas_fx( assert( ( 2 * L_subfr + Tc + 1 + M ) <= hTcxDec->old_synth_lenFB ); BASOP_SATURATE_WARNING_OFF_EVS /*saturation possible in case of spiky synthesis*/ +#ifndef HARMONIZE_2446_CON_TCX_FX Residu3_fx( A_local, - &( synth[-add( add( add( shl_sat( L_subfr, 1 ), Tc ), 1 ), M )] ), /*Qx = Q0*/ - &( exc[-add( add( add( shl_sat( L_subfr, 1 ), Tc ), 1 ), M )] ), /*Qx+1 = Q1*/ - add( add( add( shl_sat( L_subfr, 1 ), Tc ), 1 ), M ), + &(synth[-add(add(add(shl(L_subfr, 1), Tc), 1), M)]), /*Qx = Q0*/ + &(exc[-add(add(add(shl(L_subfr, 1), Tc), 1), M)]), /*Qx+1 = Q1*/ + add(add(add(shl(L_subfr, 1), Tc), 1), M), 1 ); +#else + Residu3_fx( + A_local, + &(synth[-add(add(add(shl_sat(L_subfr, 1), Tc), 1), M)]), /*Qx = Q0*/ + &(exc[-add(add(add(shl_sat(L_subfr, 1), Tc), 1), M)]), /*Qx+1 = Q1*/ + add(add(add(shl_sat(L_subfr, 1), Tc), 1), M), + 1); +#endif // !HARMONIZE_2446_CON_TCX_FX BASOP_SATURATE_WARNING_ON_EVS } ELSE @@ -1162,8 +1175,12 @@ void con_tcx_ivas_fx( Copy_Scale_sig( hTcxDec->old_excFB_fx, &( exc[-tmp16] ), add( offset, tmp16 ), sub( Q_exc, st->Q_exc ) ); /*Q_exc*/ } ELSE - { - Copy_Scale_sig( hTcxDec->old_excFB_fx, &( exc[-( L_subfr * 2 )] ), add( shl_sat( L_subfr, 1 ), offset ), sub( Q_exc, st->Q_exc ) ); /*Q_exc*/ + { +#ifndef HARMONIZE_2446_CON_TCX_FX + Copy_Scale_sig(hTcxDec->old_excFB_fx, &(exc[-(L_subfr * 2)]), add(shl(L_subfr, 1), offset), sub(Q_exc, st->Q_exc)); /*Q_exc*/ +#else + Copy_Scale_sig(hTcxDec->old_excFB_fx, &(exc[-(L_subfr * 2)]), add(shl_sat(L_subfr, 1), offset), sub(Q_exc, st->Q_exc)); /*Q_exc*/ +#endif // !HARMONIZE_2446_CON_TCX_FX } } @@ -1201,9 +1218,13 @@ void con_tcx_ivas_fx( tcxltp_pitch_tmp = L_add( L_deposit_h( hTcxLtpDec->tcxltp_pitch_int ), L_shl( L_deposit_l( div_s( hTcxLtpDec->tcxltp_pitch_fr, st->pit_res_max ) ), 1 ) ); /*15Q16*/ scale_tmp = mult_r( hTcxDec->L_frameTCX, getInvFrameLen( st->L_frame ) ); /*getInvFrameLen()->9Q6*/ tmp_shift = norm_s( scale_tmp ); +#ifndef HARMONIZE_2446_CON_TCX_FX + predPitchLag = L_shl(Mpy_32_16_1(tcxltp_pitch_tmp, shl(scale_tmp, tmp_shift)), sub(9, tmp_shift)); /*Q16*/ +#else + predPitchLag = L_shl(Mpy_32_16_1(tcxltp_pitch_tmp, shl_sat(scale_tmp, tmp_shift)), sub(9, tmp_shift)); /*Q16*/ +#endif // !HARMONIZE_2446_CON_TCX_FX - predPitchLag = L_shl( Mpy_32_16_1( tcxltp_pitch_tmp, shl_sat( scale_tmp, tmp_shift ) ), sub( 9, tmp_shift ) ); /*Q16*/ - + T0 = round_fx( predPitchLag ); /*Q0*/ test(); @@ -1434,11 +1455,19 @@ void con_tcx_ivas_fx( /*step = (1.0f/(L_frame+(L_frame/2))) * (gain - alpha);*/ tmp16 = shr( imult1616( 3, L_frame ), 1 ); tmp_e = norm_s( tmp16 ); - tmp16 = shl_sat( tmp16, tmp_e ); - +#ifndef HARMONIZE_2446_CON_TCX_FX + tmp16 = shl(tmp16, tmp_e); +#else + tmp16 = shl_sat(tmp16, tmp_e); +#endif // !HARMONIZE_2446_CON_TCX_FX + tmp16 = div_s( 16384 /*1.f Q14*/, tmp16 ); /*Q15,1+tmp_e-15*/ tmp16_2 = sub( shr( gain, 1 ), alpha ) /*Q14*/; - step32 = L_shl_sat( L_mult( tmp16, tmp16_2 ) /*Q30, 1+tmp_e-15*/, add( 1 - 14, tmp_e ) ) /*Q31*/; +#ifndef HARMONIZE_2446_CON_TCX_FX + step32 = L_shl(L_mult(tmp16, tmp16_2) /*Q30, 1+tmp_e-15*/, add(1 - 14, tmp_e)) /*Q31*/; +#else + step32 = L_shl_sat(L_mult(tmp16, tmp16_2) /*Q30, 1+tmp_e-15*/, add(1 - 14, tmp_e)) /*Q31*/; +#endif // HARMONIZE_2446_CON_TCX_FX /* PLC: Apply fade out */ tmp_loop = shr( imult1616( L_frame, 3 ), 1 ); FOR( i = offset; i < tmp_loop; i++ ) @@ -1549,8 +1578,12 @@ void con_tcx_ivas_fx( } st->seed_acelp = tmpSeed; move16(); - - tmp_loop = add( add( L_frame, shr( L_frame, 1 ) ), shl_sat( L_FIR_FER2, 1 ) ); +#ifndef HARMONIZE_2446_CON_TCX_FX + tmp_loop = add(add(L_frame, shr(L_frame, 1)), shl((L_FIR_FER2, 1)); +#else + tmp_loop = add(add(L_frame, shr(L_frame, 1)), shl_sat(L_FIR_FER2, 1)); +#endif // !HARMONIZE_2446_CON_TCX_FX + FOR( ; i < tmp_loop; i++ ) { Random( &tmpSeed ); @@ -1824,7 +1857,12 @@ void con_tcx_ivas_fx( ELSE { bufferCopyFx( noise + L_FIR_FER2 / 2, exc, add( L_frame, shr( L_frame, 1 ) ), 0 /*Q_noise*/, noise_e, Q_exc, 0 /*exc_e*/ ); - Copy( exc + sub( L_frame, shl_sat( L_subfr, 1 ) ), hTcxDec->old_excFB_fx, add( shl_sat( L_subfr, 1 ), shr( L_frame, 1 ) ) ); /*Q_exc*/ +#ifndef HARMONIZE_2446_CON_TCX_FX + Copy(exc + sub(L_frame, shl(L_subfr, 1)), hTcxDec->old_excFB_fx, add(shl(L_subfr, 1), shr(L_frame, 1))); /*Q_exc*/ +#else + Copy(exc + sub(L_frame, shl_sat(L_subfr, 1)), hTcxDec->old_excFB_fx, add(shl_sat(L_subfr, 1), shr(L_frame, 1))); /*Q_exc*/ +#endif // !HARMONIZE_2446_CON_TCX_FX + /* copy old_exc as 16kHz for acelp decoding */ IF( EQ_16( st->nbLostCmpt, 1 ) ) { @@ -1890,7 +1928,7 @@ void con_tcx_ivas_fx( { Q_syn = add( scf, st->Q_syn_factor ); // so that (Q_syn - st->Q_syn_factor) = scf; } - tmp_deemph = shl_sat( tmp_deemph, sub( Q_syn, st->Q_syn_factor ) ); + tmp_deemph = shl( tmp_deemph, sub( Q_syn, st->Q_syn_factor ) ); st->Q_syn = Q_syn; move16(); @@ -1916,7 +1954,7 @@ void con_tcx_ivas_fx( { Q_syn = add( scf, st->Q_syn_factor ); // so that (Q_syn - st->Q_syn_factor) = scf; } - tmp_deemph = shl( tmp_deemph, sub( Q_syn, st->Q_syn_factor ) ); + tmp_deemph = shl_sat(tmp_deemph, sub(Q_syn, st->Q_syn_factor)); } ELSE { -- GitLab From 7c33b452d0892adbb07d618aca5842b549cb8a24 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 26 Feb 2026 15:36:12 +0100 Subject: [PATCH 30/44] issue: 2446 removing if statement made on leg_flag --- lib_dec/er_dec_tcx_fx.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 13aac65fa..c259a8adb 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -988,12 +988,6 @@ void con_tcx_ivas_fx( #ifdef HARMONIZE_2446_CON_TCX_FX int leg_flag; leg_flag = EQ_16( st->element_mode, EVS_MONO ) || EQ_16( st->element_mode, IVAS_SCE ) || LT_32( st->element_brate, 48000 ); -#if 1 - IF( coh == -16384 && noise_seed == NULL && only_left == 0 && A_cng == NULL ) - { - leg_flag = 0; - } -#endif #endif // HARMONIZE_2446_CON_TCX_FX hTcxLtpDec = st->hTcxLtpDec; -- GitLab From 2737098539355f0ace8b654076270dc87caa5a3a Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Fri, 27 Feb 2026 10:25:22 +0100 Subject: [PATCH 31/44] issue: 2446 clang formatting patch --- lib_dec/er_dec_tcx_fx.c | 54 ++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index c259a8adb..190755169 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1051,11 +1051,11 @@ void con_tcx_ivas_fx( { /* apply pre-emphasis to the signal */ #ifndef HARMONIZE_2446_CON_TCX_FX - mem = shl(synth[(-(((L_frame / 2) + hTcxDec->pit_max_TCX) + M + M) - 1)], st->Q_syn_factor); + mem = shl( synth[( -( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + M + M ) - 1 )], st->Q_syn_factor ); #else - mem = shl_sat(synth[(-(((L_frame / 2) + hTcxDec->pit_max_TCX) + M + M) - 1)], st->Q_syn_factor); + mem = shl_sat( synth[( -( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + M + M ) - 1 )], st->Q_syn_factor ); #endif // !HARMONIZE_2446_CON_TCX_FX - move16(); + move16(); #ifndef HARMONIZE_2446_CON_TCX_FX Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 ); @@ -1120,17 +1120,17 @@ void con_tcx_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX Residu3_fx( A_local, - &(synth[-add(add(add(shl(L_subfr, 1), Tc), 1), M)]), /*Qx = Q0*/ - &(exc[-add(add(add(shl(L_subfr, 1), Tc), 1), M)]), /*Qx+1 = Q1*/ - add(add(add(shl(L_subfr, 1), Tc), 1), M), + &( synth[-add( add( add( shl( L_subfr, 1 ), Tc ), 1 ), M )] ), /*Qx = Q0*/ + &( exc[-add( add( add( shl( L_subfr, 1 ), Tc ), 1 ), M )] ), /*Qx+1 = Q1*/ + add( add( add( shl( L_subfr, 1 ), Tc ), 1 ), M ), 1 ); #else Residu3_fx( A_local, - &(synth[-add(add(add(shl_sat(L_subfr, 1), Tc), 1), M)]), /*Qx = Q0*/ - &(exc[-add(add(add(shl_sat(L_subfr, 1), Tc), 1), M)]), /*Qx+1 = Q1*/ - add(add(add(shl_sat(L_subfr, 1), Tc), 1), M), - 1); + &( synth[-add( add( add( shl_sat( L_subfr, 1 ), Tc ), 1 ), M )] ), /*Qx = Q0*/ + &( exc[-add( add( add( shl_sat( L_subfr, 1 ), Tc ), 1 ), M )] ), /*Qx+1 = Q1*/ + add( add( add( shl_sat( L_subfr, 1 ), Tc ), 1 ), M ), + 1 ); #endif // !HARMONIZE_2446_CON_TCX_FX BASOP_SATURATE_WARNING_ON_EVS } @@ -1169,12 +1169,12 @@ void con_tcx_ivas_fx( Copy_Scale_sig( hTcxDec->old_excFB_fx, &( exc[-tmp16] ), add( offset, tmp16 ), sub( Q_exc, st->Q_exc ) ); /*Q_exc*/ } ELSE - { + { #ifndef HARMONIZE_2446_CON_TCX_FX - Copy_Scale_sig(hTcxDec->old_excFB_fx, &(exc[-(L_subfr * 2)]), add(shl(L_subfr, 1), offset), sub(Q_exc, st->Q_exc)); /*Q_exc*/ + Copy_Scale_sig( hTcxDec->old_excFB_fx, &( exc[-( L_subfr * 2 )] ), add( shl( L_subfr, 1 ), offset ), sub( Q_exc, st->Q_exc ) ); /*Q_exc*/ #else - Copy_Scale_sig(hTcxDec->old_excFB_fx, &(exc[-(L_subfr * 2)]), add(shl_sat(L_subfr, 1), offset), sub(Q_exc, st->Q_exc)); /*Q_exc*/ -#endif // !HARMONIZE_2446_CON_TCX_FX + Copy_Scale_sig( hTcxDec->old_excFB_fx, &( exc[-( L_subfr * 2 )] ), add( shl_sat( L_subfr, 1 ), offset ), sub( Q_exc, st->Q_exc ) ); /*Q_exc*/ +#endif // !HARMONIZE_2446_CON_TCX_FX } } @@ -1213,12 +1213,12 @@ void con_tcx_ivas_fx( scale_tmp = mult_r( hTcxDec->L_frameTCX, getInvFrameLen( st->L_frame ) ); /*getInvFrameLen()->9Q6*/ tmp_shift = norm_s( scale_tmp ); #ifndef HARMONIZE_2446_CON_TCX_FX - predPitchLag = L_shl(Mpy_32_16_1(tcxltp_pitch_tmp, shl(scale_tmp, tmp_shift)), sub(9, tmp_shift)); /*Q16*/ + predPitchLag = L_shl( Mpy_32_16_1( tcxltp_pitch_tmp, shl( scale_tmp, tmp_shift ) ), sub( 9, tmp_shift ) ); /*Q16*/ #else - predPitchLag = L_shl(Mpy_32_16_1(tcxltp_pitch_tmp, shl_sat(scale_tmp, tmp_shift)), sub(9, tmp_shift)); /*Q16*/ + predPitchLag = L_shl( Mpy_32_16_1( tcxltp_pitch_tmp, shl_sat( scale_tmp, tmp_shift ) ), sub( 9, tmp_shift ) ); /*Q16*/ #endif // !HARMONIZE_2446_CON_TCX_FX - + T0 = round_fx( predPitchLag ); /*Q0*/ test(); @@ -1450,18 +1450,18 @@ void con_tcx_ivas_fx( tmp16 = shr( imult1616( 3, L_frame ), 1 ); tmp_e = norm_s( tmp16 ); #ifndef HARMONIZE_2446_CON_TCX_FX - tmp16 = shl(tmp16, tmp_e); + tmp16 = shl( tmp16, tmp_e ); #else - tmp16 = shl_sat(tmp16, tmp_e); + tmp16 = shl_sat( tmp16, tmp_e ); #endif // !HARMONIZE_2446_CON_TCX_FX - + tmp16 = div_s( 16384 /*1.f Q14*/, tmp16 ); /*Q15,1+tmp_e-15*/ tmp16_2 = sub( shr( gain, 1 ), alpha ) /*Q14*/; #ifndef HARMONIZE_2446_CON_TCX_FX - step32 = L_shl(L_mult(tmp16, tmp16_2) /*Q30, 1+tmp_e-15*/, add(1 - 14, tmp_e)) /*Q31*/; + step32 = L_shl( L_mult( tmp16, tmp16_2 ) /*Q30, 1+tmp_e-15*/, add( 1 - 14, tmp_e ) ) /*Q31*/; #else - step32 = L_shl_sat(L_mult(tmp16, tmp16_2) /*Q30, 1+tmp_e-15*/, add(1 - 14, tmp_e)) /*Q31*/; -#endif // HARMONIZE_2446_CON_TCX_FX + step32 = L_shl_sat( L_mult( tmp16, tmp16_2 ) /*Q30, 1+tmp_e-15*/, add( 1 - 14, tmp_e ) ) /*Q31*/; +#endif // HARMONIZE_2446_CON_TCX_FX /* PLC: Apply fade out */ tmp_loop = shr( imult1616( L_frame, 3 ), 1 ); FOR( i = offset; i < tmp_loop; i++ ) @@ -1575,7 +1575,7 @@ void con_tcx_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX tmp_loop = add(add(L_frame, shr(L_frame, 1)), shl((L_FIR_FER2, 1)); #else - tmp_loop = add(add(L_frame, shr(L_frame, 1)), shl_sat(L_FIR_FER2, 1)); + tmp_loop = add( add( L_frame, shr( L_frame, 1 ) ), shl_sat( L_FIR_FER2, 1 ) ); #endif // !HARMONIZE_2446_CON_TCX_FX FOR( ; i < tmp_loop; i++ ) @@ -1852,9 +1852,9 @@ void con_tcx_ivas_fx( { bufferCopyFx( noise + L_FIR_FER2 / 2, exc, add( L_frame, shr( L_frame, 1 ) ), 0 /*Q_noise*/, noise_e, Q_exc, 0 /*exc_e*/ ); #ifndef HARMONIZE_2446_CON_TCX_FX - Copy(exc + sub(L_frame, shl(L_subfr, 1)), hTcxDec->old_excFB_fx, add(shl(L_subfr, 1), shr(L_frame, 1))); /*Q_exc*/ + Copy( exc + sub( L_frame, shl( L_subfr, 1 ) ), hTcxDec->old_excFB_fx, add( shl( L_subfr, 1 ), shr( L_frame, 1 ) ) ); /*Q_exc*/ #else - Copy(exc + sub(L_frame, shl_sat(L_subfr, 1)), hTcxDec->old_excFB_fx, add(shl_sat(L_subfr, 1), shr(L_frame, 1))); /*Q_exc*/ + Copy( exc + sub( L_frame, shl_sat( L_subfr, 1 ) ), hTcxDec->old_excFB_fx, add( shl_sat( L_subfr, 1 ), shr( L_frame, 1 ) ) ); /*Q_exc*/ #endif // !HARMONIZE_2446_CON_TCX_FX /* copy old_exc as 16kHz for acelp decoding */ @@ -1948,7 +1948,7 @@ void con_tcx_ivas_fx( { Q_syn = add( scf, st->Q_syn_factor ); // so that (Q_syn - st->Q_syn_factor) = scf; } - tmp_deemph = shl_sat(tmp_deemph, sub(Q_syn, st->Q_syn_factor)); + tmp_deemph = shl_sat( tmp_deemph, sub( Q_syn, st->Q_syn_factor ) ); } ELSE { -- GitLab From 9aacef5ad0cffe805d7fd45d12d37a66ee974fcb Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Wed, 4 Mar 2026 09:48:18 +0100 Subject: [PATCH 32/44] issue: 2446 clang formatting patch --- lib_dec/er_dec_tcx_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 190755169..26c893d42 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1215,7 +1215,7 @@ void con_tcx_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX predPitchLag = L_shl( Mpy_32_16_1( tcxltp_pitch_tmp, shl( scale_tmp, tmp_shift ) ), sub( 9, tmp_shift ) ); /*Q16*/ #else - predPitchLag = L_shl( Mpy_32_16_1( tcxltp_pitch_tmp, shl_sat( scale_tmp, tmp_shift ) ), sub( 9, tmp_shift ) ); /*Q16*/ + predPitchLag = L_shl( Mpy_32_16_1( tcxltp_pitch_tmp, shl_sat( scale_tmp, tmp_shift ) ), sub( 9, tmp_shift ) ); /*Q16*/ #endif // !HARMONIZE_2446_CON_TCX_FX -- GitLab From c2c1ee66b605887c9fa31916866152d947c94309 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Wed, 4 Mar 2026 13:38:16 +0100 Subject: [PATCH 33/44] issue: 2446 Fixing overflow problem in scale_sig() in con_tcx_ivas_fx() --- lib_dec/er_dec_tcx_fx.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 26c893d42..7304af4c8 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1070,9 +1070,19 @@ void con_tcx_ivas_fx( } #endif // !HARMONIZE_2446_CON_TCX_FX +#ifndef HARMONIZE_2446_CON_TCX_FX + scale_sig(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl_sat(M, 1)), negate(st->Q_syn_factor)); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ +#else + IF(!leg_flag) { + scale_sig(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl_sat(M, 1)), negate(st->Q_syn_factor)); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ + } + ELSE{ + Scale_sig(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl_sat(M, 1)), negate(st->Q_syn_factor)); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ + } + +#endif // !HARMONIZE_2446_CON_TCX_FX - scale_sig( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl_sat( M, 1 ) ), negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ - + st->Mode2_lp_gainc = L_deposit_l( 0 ); st->Mode2_lp_gainp = get_gain2( synth - shl_sat( L_subfr, 1 ), synth - add( shl_sat( L_subfr, 1 ), Tc ), shl_sat( L_subfr, 1 ) ); -- GitLab From 10c8685bf0495989788c1a367deb0eb7754aa0df Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Wed, 4 Mar 2026 13:42:51 +0100 Subject: [PATCH 34/44] issue: 2446 Clang formatting patch --- lib_dec/er_dec_tcx_fx.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 7304af4c8..c65b1e98b 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -1071,18 +1071,20 @@ void con_tcx_ivas_fx( #endif // !HARMONIZE_2446_CON_TCX_FX #ifndef HARMONIZE_2446_CON_TCX_FX - scale_sig(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl_sat(M, 1)), negate(st->Q_syn_factor)); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ + scale_sig( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl_sat( M, 1 ) ), negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ #else - IF(!leg_flag) { - scale_sig(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl_sat(M, 1)), negate(st->Q_syn_factor)); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ + IF( !leg_flag ) + { + scale_sig( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl_sat( M, 1 ) ), negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ } - ELSE{ - Scale_sig(&(synth[-(((L_frame / 2) + hTcxDec->pit_max_TCX) + 2 * M)]), add(add(shr(L_frame, 1), hTcxDec->pit_max_TCX), shl_sat(M, 1)), negate(st->Q_syn_factor)); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ + ELSE + { + Scale_sig( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl_sat( M, 1 ) ), negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */ } - + #endif // !HARMONIZE_2446_CON_TCX_FX - + st->Mode2_lp_gainc = L_deposit_l( 0 ); st->Mode2_lp_gainp = get_gain2( synth - shl_sat( L_subfr, 1 ), synth - add( shl_sat( L_subfr, 1 ), Tc ), shl_sat( L_subfr, 1 ) ); -- GitLab From 689d65f8ca4ce34980cdd80e80c5d96a7c0c229f Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Wed, 4 Mar 2026 16:59:39 +0100 Subject: [PATCH 35/44] issue: 2446 correcting legacy flag --- lib_dec/er_dec_tcx_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index c65b1e98b..ef2fb1291 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -987,7 +987,7 @@ void con_tcx_ivas_fx( TCX_DEC_HANDLE hTcxDec; #ifdef HARMONIZE_2446_CON_TCX_FX int leg_flag; - leg_flag = EQ_16( st->element_mode, EVS_MONO ) || EQ_16( st->element_mode, IVAS_SCE ) || LT_32( st->element_brate, 48000 ); + leg_flag = EQ_16( st->element_mode, EVS_MONO ) || EQ_16( st->element_mode, IVAS_SCE ) ; /* || LT_32( st->element_brate, 48000 );*/ #endif // HARMONIZE_2446_CON_TCX_FX hTcxLtpDec = st->hTcxLtpDec; -- GitLab From af47b59515d841543843572f272ec2126ef8cf07 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Wed, 4 Mar 2026 17:17:04 +0100 Subject: [PATCH 36/44] issue: 2446 Clang formatting patch --- lib_dec/er_dec_tcx_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index ef2fb1291..513f3c3a6 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -987,8 +987,8 @@ void con_tcx_ivas_fx( TCX_DEC_HANDLE hTcxDec; #ifdef HARMONIZE_2446_CON_TCX_FX int leg_flag; - leg_flag = EQ_16( st->element_mode, EVS_MONO ) || EQ_16( st->element_mode, IVAS_SCE ) ; /* || LT_32( st->element_brate, 48000 );*/ -#endif // HARMONIZE_2446_CON_TCX_FX + leg_flag = EQ_16( st->element_mode, EVS_MONO ) || EQ_16( st->element_mode, IVAS_SCE ); /* || LT_32( st->element_brate, 48000 );*/ +#endif // HARMONIZE_2446_CON_TCX_FX hTcxLtpDec = st->hTcxLtpDec; hHQ_core = st->hHQ_core; -- GitLab From 5c55e152de2ee573ea05451638fb715441e1263a Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 5 Mar 2026 11:50:40 +0100 Subject: [PATCH 37/44] issue: 2446 Changes in leg_flag mechanism; instaed of computing leg_flag during function runtime, it is passed down to it. Avoids false positives. --- lib_com/prot_fx.h | 18 +++++++++++++++--- lib_dec/er_dec_tcx_fx.c | 26 +++++++++++++++++--------- lib_dec/ivas_mdct_core_dec_fx.c | 23 ++++++++++++++++++----- lib_dec/ivas_tcx_core_dec_fx.c | 2 +- 4 files changed, 51 insertions(+), 18 deletions(-) diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index b7f81c484..f03c0c224 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -8900,14 +8900,26 @@ void decoder_tcx_post_ivas_fx( Word16 bfi, Word16 MCT_flag ); +#ifndef HARMONIZE_2446_CON_TCX_FX void con_tcx_ivas_fx( - Decoder_State *st, /* i/o: coder memory state */ + Decoder_State* st, /* i/o: coder memory state */ Word16 synth[], /* i/o: synth[] Q0 */ const Word16 coh, /* i : coherence of stereo signal */ - Word16 *noise_seed, /* i/o: noise seed for stereo */ + Word16* noise_seed, /* i/o: noise seed for stereo */ const Word16 only_left, /* i : TD-PLC only in left channel */ - const Word16 *A_cng /* i : CNG LP filter coefficients */ + const Word16* A_cng /* i : CNG LP filter coefficients */ ); +#else +void con_tcx_ivas_fx( + Decoder_State* st, /* i/o: coder memory state */ + Word16 synth[], /* i/o: synth[] Q0 */ + const Word16 coh, /* i : coherence of stereo signal */ + Word16* noise_seed, /* i/o: noise seed for stereo */ + const Word16 only_left, /* i : TD-PLC only in left channel */ + const Word16* A_cng, /* i : CNG LP filter coefficients */ + const leg_flag +); +#endif // !HARMONIZE_2446_CON_TCX_FX void ivas_mdct_core_reconstruct_fx( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 513f3c3a6..072c4ad81 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -944,15 +944,27 @@ void con_tcx_fx( return; } - +#ifdef HARMONIZE_2446_CON_TCX_FX void con_tcx_ivas_fx( - Decoder_State *st, /* i/o: coder memory state */ + Decoder_State* st, /* i/o: coder memory state */ Word16 synth[], /* i/o: synth[] Q0 */ const Word16 coh, /* i : coherence of stereo signal Q14*/ - Word16 *noise_seed, /* i/o: noise seed for stereo Q0 */ + Word16* noise_seed, /* i/o: noise seed for stereo Q0 */ const Word16 only_left, /* i : TD-PLC only in left channel Q0 */ - const Word16 *A_cng /* i : CNG LP filter coefficients Q14*/ + const Word16* A_cng, /* i : CNG LP filter coefficients Q14*/ + const Word16 leg_flag + ) +#else +void con_tcx_ivas_fx( + Decoder_State* st, /* i/o: coder memory state */ + Word16 synth[], /* i/o: synth[] Q0 */ + const Word16 coh, /* i : coherence of stereo signal Q14*/ + Word16* noise_seed, /* i/o: noise seed for stereo Q0 */ + const Word16 only_left, /* i : TD-PLC only in left channel Q0 */ + const Word16* A_cng /* i : CNG LP filter coefficients Q14*/ ) +#endif // HARMONIZE_2446_CON_TCX_FX + { Word16 i, s, c, L_frame, L_subfr, fLowPassFilter, T0; Word16 n, mem_syn_r_size_old, mem_syn_r_size_new; @@ -984,11 +996,7 @@ void con_tcx_ivas_fx( Word16 offset; HQ_DEC_HANDLE hHQ_core; TCX_LTP_DEC_HANDLE hTcxLtpDec; - TCX_DEC_HANDLE hTcxDec; -#ifdef HARMONIZE_2446_CON_TCX_FX - int leg_flag; - leg_flag = EQ_16( st->element_mode, EVS_MONO ) || EQ_16( st->element_mode, IVAS_SCE ); /* || LT_32( st->element_brate, 48000 );*/ -#endif // HARMONIZE_2446_CON_TCX_FX + TCX_DEC_HANDLE hTcxDec; // HARMONIZE_2446_CON_TCX_FX hTcxLtpDec = st->hTcxLtpDec; hHQ_core = st->hHQ_core; diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index 65479c7a1..cbf48fafb 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -1296,18 +1296,31 @@ void ivas_mdct_core_reconstruct_fx( assert( EQ_16( st->bfi, 1 ) ); /* PLC: [TCX: TD PLC] */ IF( MCT_flag != 0 ) - { - con_tcx_ivas_fx( st, &synthFB_fx[0], -16384, NULL, 0, NULL ); //-1.Q14 = -16384 + { +#ifndef HARMONIZE_2446_CON_TCX_FX + con_tcx_ivas_fx(st, &synthFB_fx[0], -16384, NULL, 0, NULL); //-1.Q14 = -16384 +#else + con_tcx_ivas_fx(st, &synthFB_fx[0], -16384, NULL, 0, NULL, 0); //-1.Q14 = -16384 +#endif // !HARMONIZE_2446_CON_TCX_FX } ELSE { IF( sts[1]->core != ACELP_CORE ) - { - con_tcx_ivas_fx( st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 1, &st->hFdCngDec->hFdCngCom->A_cng[0] ); + { +#ifndef HARMONIZE_2446_CON_TCX_FX + con_tcx_ivas_fx(st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 1, &st->hFdCngDec->hFdCngCom->A_cng[0]); +#else + con_tcx_ivas_fx(st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 1, &st->hFdCngDec->hFdCngCom->A_cng[0], 0); +#endif // !HARMONIZE_2446_CON_TCX_FX + } ELSE { - con_tcx_ivas_fx( st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 0, &st->hFdCngDec->hFdCngCom->A_cng[0] ); +#ifndef HARMONIZE_2446_CON_TCX_FX + con_tcx_ivas_fx(st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 0, &st->hFdCngDec->hFdCngCom->A_cng[0]); +#else + con_tcx_ivas_fx(st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 0, &st->hFdCngDec->hFdCngCom->A_cng[0], 0); +#endif // !HARMONIZE_2446_CON_TCX_FX } } st->hHQ_core->Q_old_wtda = add( st->hHQ_core->Q_old_wtda, q_syn ); diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index 12f87ae3f..374ef833a 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -492,7 +492,7 @@ void stereo_tcx_core_dec_fx( #ifndef HARMONIZE_2446_CON_TCX_FX con_tcx_fx( st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */ ); #else - con_tcx_ivas_fx( st, &synthFB_fx[0], -16384, NULL, 0, NULL ); + con_tcx_ivas_fx( st, &synthFB_fx[0], -16384, NULL, 0, NULL, 1 ); #endif // !HARMONIZE_2446_CON_TCX_FX test(); IF( ( EQ_16( st->nbLostCmpt, 1 ) ) || hTcxDec->tcxConceal_recalc_exc ) -- GitLab From 5602c6c43afbb4fedb4dd382764a3eed2bbe1024 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 5 Mar 2026 12:09:14 +0100 Subject: [PATCH 38/44] issue: 2446 Clang formatting patch --- lib_com/prot_fx.h | 15 +++++++-------- lib_dec/er_dec_tcx_fx.c | 17 ++++++++--------- lib_dec/ivas_mdct_core_dec_fx.c | 21 ++++++++++----------- 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index f03c0c224..e1dac05a0 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -8902,23 +8902,22 @@ void decoder_tcx_post_ivas_fx( #ifndef HARMONIZE_2446_CON_TCX_FX void con_tcx_ivas_fx( - Decoder_State* st, /* i/o: coder memory state */ + Decoder_State *st, /* i/o: coder memory state */ Word16 synth[], /* i/o: synth[] Q0 */ const Word16 coh, /* i : coherence of stereo signal */ - Word16* noise_seed, /* i/o: noise seed for stereo */ + Word16 *noise_seed, /* i/o: noise seed for stereo */ const Word16 only_left, /* i : TD-PLC only in left channel */ - const Word16* A_cng /* i : CNG LP filter coefficients */ + const Word16 *A_cng /* i : CNG LP filter coefficients */ ); #else void con_tcx_ivas_fx( - Decoder_State* st, /* i/o: coder memory state */ + Decoder_State *st, /* i/o: coder memory state */ Word16 synth[], /* i/o: synth[] Q0 */ const Word16 coh, /* i : coherence of stereo signal */ - Word16* noise_seed, /* i/o: noise seed for stereo */ + Word16 *noise_seed, /* i/o: noise seed for stereo */ const Word16 only_left, /* i : TD-PLC only in left channel */ - const Word16* A_cng, /* i : CNG LP filter coefficients */ - const leg_flag -); + const Word16 *A_cng, /* i : CNG LP filter coefficients */ + const leg_flag ); #endif // !HARMONIZE_2446_CON_TCX_FX void ivas_mdct_core_reconstruct_fx( diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 072c4ad81..c712c815e 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -946,22 +946,21 @@ void con_tcx_fx( } #ifdef HARMONIZE_2446_CON_TCX_FX void con_tcx_ivas_fx( - Decoder_State* st, /* i/o: coder memory state */ + Decoder_State *st, /* i/o: coder memory state */ Word16 synth[], /* i/o: synth[] Q0 */ const Word16 coh, /* i : coherence of stereo signal Q14*/ - Word16* noise_seed, /* i/o: noise seed for stereo Q0 */ + Word16 *noise_seed, /* i/o: noise seed for stereo Q0 */ const Word16 only_left, /* i : TD-PLC only in left channel Q0 */ - const Word16* A_cng, /* i : CNG LP filter coefficients Q14*/ - const Word16 leg_flag - ) + const Word16 *A_cng, /* i : CNG LP filter coefficients Q14*/ + const Word16 leg_flag ) #else void con_tcx_ivas_fx( - Decoder_State* st, /* i/o: coder memory state */ + Decoder_State *st, /* i/o: coder memory state */ Word16 synth[], /* i/o: synth[] Q0 */ const Word16 coh, /* i : coherence of stereo signal Q14*/ - Word16* noise_seed, /* i/o: noise seed for stereo Q0 */ + Word16 *noise_seed, /* i/o: noise seed for stereo Q0 */ const Word16 only_left, /* i : TD-PLC only in left channel Q0 */ - const Word16* A_cng /* i : CNG LP filter coefficients Q14*/ + const Word16 *A_cng /* i : CNG LP filter coefficients Q14*/ ) #endif // HARMONIZE_2446_CON_TCX_FX @@ -996,7 +995,7 @@ void con_tcx_ivas_fx( Word16 offset; HQ_DEC_HANDLE hHQ_core; TCX_LTP_DEC_HANDLE hTcxLtpDec; - TCX_DEC_HANDLE hTcxDec; // HARMONIZE_2446_CON_TCX_FX + TCX_DEC_HANDLE hTcxDec; // HARMONIZE_2446_CON_TCX_FX hTcxLtpDec = st->hTcxLtpDec; hHQ_core = st->hHQ_core; diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index cbf48fafb..e03042d1c 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -1296,31 +1296,30 @@ void ivas_mdct_core_reconstruct_fx( assert( EQ_16( st->bfi, 1 ) ); /* PLC: [TCX: TD PLC] */ IF( MCT_flag != 0 ) - { + { #ifndef HARMONIZE_2446_CON_TCX_FX - con_tcx_ivas_fx(st, &synthFB_fx[0], -16384, NULL, 0, NULL); //-1.Q14 = -16384 + con_tcx_ivas_fx( st, &synthFB_fx[0], -16384, NULL, 0, NULL ); //-1.Q14 = -16384 #else - con_tcx_ivas_fx(st, &synthFB_fx[0], -16384, NULL, 0, NULL, 0); //-1.Q14 = -16384 -#endif // !HARMONIZE_2446_CON_TCX_FX + con_tcx_ivas_fx( st, &synthFB_fx[0], -16384, NULL, 0, NULL, 0 ); //-1.Q14 = -16384 +#endif // !HARMONIZE_2446_CON_TCX_FX } ELSE { IF( sts[1]->core != ACELP_CORE ) - { + { #ifndef HARMONIZE_2446_CON_TCX_FX - con_tcx_ivas_fx(st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 1, &st->hFdCngDec->hFdCngCom->A_cng[0]); + con_tcx_ivas_fx( st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 1, &st->hFdCngDec->hFdCngCom->A_cng[0] ); #else - con_tcx_ivas_fx(st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 1, &st->hFdCngDec->hFdCngCom->A_cng[0], 0); + con_tcx_ivas_fx( st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 1, &st->hFdCngDec->hFdCngCom->A_cng[0], 0 ); #endif // !HARMONIZE_2446_CON_TCX_FX - } ELSE { #ifndef HARMONIZE_2446_CON_TCX_FX - con_tcx_ivas_fx(st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 0, &st->hFdCngDec->hFdCngCom->A_cng[0]); + con_tcx_ivas_fx( st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 0, &st->hFdCngDec->hFdCngCom->A_cng[0] ); #else - con_tcx_ivas_fx(st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 0, &st->hFdCngDec->hFdCngCom->A_cng[0], 0); -#endif // !HARMONIZE_2446_CON_TCX_FX + con_tcx_ivas_fx( st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 0, &st->hFdCngDec->hFdCngCom->A_cng[0], 0 ); +#endif // !HARMONIZE_2446_CON_TCX_FX } } st->hHQ_core->Q_old_wtda = add( st->hHQ_core->Q_old_wtda, q_syn ); -- GitLab From 7c18cb528c4d0c60042e17b1bf5f31b5b597dd2d Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 5 Mar 2026 12:17:21 +0100 Subject: [PATCH 39/44] issue: 2446 fix of wrong argument for function header signature - fix of implicit int to Word16 casting --- lib_com/prot_fx.h | 2 +- lib_dec/ivas_mdct_core_dec_fx.c | 6 +++--- lib_dec/ivas_tcx_core_dec_fx.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index e1dac05a0..482238661 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -8917,7 +8917,7 @@ void con_tcx_ivas_fx( Word16 *noise_seed, /* i/o: noise seed for stereo */ const Word16 only_left, /* i : TD-PLC only in left channel */ const Word16 *A_cng, /* i : CNG LP filter coefficients */ - const leg_flag ); + const Word16 leg_flag ); #endif // !HARMONIZE_2446_CON_TCX_FX void ivas_mdct_core_reconstruct_fx( diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index e03042d1c..df3600130 100644 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -1300,7 +1300,7 @@ void ivas_mdct_core_reconstruct_fx( #ifndef HARMONIZE_2446_CON_TCX_FX con_tcx_ivas_fx( st, &synthFB_fx[0], -16384, NULL, 0, NULL ); //-1.Q14 = -16384 #else - con_tcx_ivas_fx( st, &synthFB_fx[0], -16384, NULL, 0, NULL, 0 ); //-1.Q14 = -16384 + con_tcx_ivas_fx( st, &synthFB_fx[0], -16384, NULL, 0, NULL, (Word16) 0 ); //-1.Q14 = -16384 #endif // !HARMONIZE_2446_CON_TCX_FX } ELSE @@ -1310,7 +1310,7 @@ void ivas_mdct_core_reconstruct_fx( #ifndef HARMONIZE_2446_CON_TCX_FX con_tcx_ivas_fx( st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 1, &st->hFdCngDec->hFdCngCom->A_cng[0] ); #else - con_tcx_ivas_fx( st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 1, &st->hFdCngDec->hFdCngCom->A_cng[0], 0 ); + con_tcx_ivas_fx( st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 1, &st->hFdCngDec->hFdCngCom->A_cng[0], (Word16) 0 ); #endif // !HARMONIZE_2446_CON_TCX_FX } ELSE @@ -1318,7 +1318,7 @@ void ivas_mdct_core_reconstruct_fx( #ifndef HARMONIZE_2446_CON_TCX_FX con_tcx_ivas_fx( st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 0, &st->hFdCngDec->hFdCngCom->A_cng[0] ); #else - con_tcx_ivas_fx( st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 0, &st->hFdCngDec->hFdCngCom->A_cng[0], 0 ); + con_tcx_ivas_fx( st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 0, &st->hFdCngDec->hFdCngCom->A_cng[0], (Word16) 0 ); #endif // !HARMONIZE_2446_CON_TCX_FX } } diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index 374ef833a..6def7b519 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -492,7 +492,7 @@ void stereo_tcx_core_dec_fx( #ifndef HARMONIZE_2446_CON_TCX_FX con_tcx_fx( st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */ ); #else - con_tcx_ivas_fx( st, &synthFB_fx[0], -16384, NULL, 0, NULL, 1 ); + con_tcx_ivas_fx( st, &synthFB_fx[0], -16384, NULL, 0, NULL, (Word16) 1 ); #endif // !HARMONIZE_2446_CON_TCX_FX test(); IF( ( EQ_16( st->nbLostCmpt, 1 ) ) || hTcxDec->tcxConceal_recalc_exc ) -- GitLab From 3c03c1366c50695ea9966e9f1ee1bfbfbdf52e56 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 5 Mar 2026 13:48:47 +0100 Subject: [PATCH 40/44] issue: 2446 changing two remaining instances of con_tcx_fx() to ivas version --- lib_dec/dec_LPD_fx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_dec/dec_LPD_fx.c b/lib_dec/dec_LPD_fx.c index 4cafdfed7..1a7c30bf1 100644 --- a/lib_dec/dec_LPD_fx.c +++ b/lib_dec/dec_LPD_fx.c @@ -570,7 +570,11 @@ void decoder_LPD_fx( IF( bfi != 0 && ( st->last_core != ACELP_CORE ) ) { /* PLC: [TCX: TD PLC] */ +#ifndef HARMONIZE_2446_CON_TCX_FX con_tcx_fx( st, &synthFB[0] ); +#else + con_tcx_ivas_fx(st, &synthFB[0], NULL, 0, NULL, (Word16)1); +#endif lerp( synthFB, synth, st->L_frame, hTcxDec->L_frameTCX ); st->con_tcx = 1; move16(); -- GitLab From 15bfc659227c43deea77f3604b8d01b4c7a27200 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 5 Mar 2026 13:52:58 +0100 Subject: [PATCH 41/44] issue: 2446 Clang formatting patch --- lib_dec/dec_LPD_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/dec_LPD_fx.c b/lib_dec/dec_LPD_fx.c index 1a7c30bf1..c1f9ecf47 100644 --- a/lib_dec/dec_LPD_fx.c +++ b/lib_dec/dec_LPD_fx.c @@ -573,7 +573,7 @@ void decoder_LPD_fx( #ifndef HARMONIZE_2446_CON_TCX_FX con_tcx_fx( st, &synthFB[0] ); #else - con_tcx_ivas_fx(st, &synthFB[0], NULL, 0, NULL, (Word16)1); + con_tcx_ivas_fx( st, &synthFB[0], NULL, 0, NULL, (Word16) 1 ); #endif lerp( synthFB, synth, st->L_frame, hTcxDec->L_frameTCX ); st->con_tcx = 1; -- GitLab From 5fb9a7241a145d7eb7208d3e93535c60e2c835eb Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 5 Mar 2026 14:26:45 +0100 Subject: [PATCH 42/44] issue: 2446 Fixing build problem, missing argument --- lib_dec/dec_LPD_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/dec_LPD_fx.c b/lib_dec/dec_LPD_fx.c index c1f9ecf47..00102e297 100644 --- a/lib_dec/dec_LPD_fx.c +++ b/lib_dec/dec_LPD_fx.c @@ -573,7 +573,7 @@ void decoder_LPD_fx( #ifndef HARMONIZE_2446_CON_TCX_FX con_tcx_fx( st, &synthFB[0] ); #else - con_tcx_ivas_fx( st, &synthFB[0], NULL, 0, NULL, (Word16) 1 ); + con_tcx_ivas_fx( st, &synthFB[0], -16384, NULL, 0, NULL, (Word16) 1 ); #endif lerp( synthFB, synth, st->L_frame, hTcxDec->L_frameTCX ); st->con_tcx = 1; -- GitLab From 47030e130cb81685f78af3c049bc8272d3b04b09 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 5 Mar 2026 15:13:29 +0100 Subject: [PATCH 43/44] issue: 2446 removing legacy function altogether --- lib_com/prot_fx.h | 2 ++ lib_dec/er_dec_tcx_fx.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index a4336ea58..1c04e9155 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -8407,10 +8407,12 @@ void modify_lsf( const Word16 reset_q /* Q0 */ ); +#ifndef HARMONIZE_2446_CON_TCX_FX void con_tcx_fx( Decoder_State *st, /* i/o: coder memory state */ Word16 synth[] /* i/o: synth[] Q0 */ ); +#endif // !HARMONIZE_2446_CON_TCX_FX /* o : damping factor Q14*/ Word16 Damping_fact_fx( diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index c712c815e..73e17639f 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -87,6 +87,7 @@ con_tcx \brief main function in time domain TCX concealment *******************************************************/ +#ifndef HARMONIZE_2446_CON_TCX_FX void con_tcx_fx( Decoder_State *st, /* i/o: coder memory state */ @@ -944,6 +945,9 @@ void con_tcx_fx( return; } + +#endif // !HARMONIZE_2446_CON_TCX_FX + #ifdef HARMONIZE_2446_CON_TCX_FX void con_tcx_ivas_fx( Decoder_State *st, /* i/o: coder memory state */ -- GitLab From 5741b31012ece4a722ced90507f41d269c7a5dc7 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 5 Mar 2026 16:13:58 +0100 Subject: [PATCH 44/44] issue: 2446 removing residue comments and wrapping macro around a line which was overlooked --- lib_dec/er_dec_tcx_fx.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 73e17639f..1002f10a4 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -999,7 +999,7 @@ void con_tcx_ivas_fx( Word16 offset; HQ_DEC_HANDLE hHQ_core; TCX_LTP_DEC_HANDLE hTcxLtpDec; - TCX_DEC_HANDLE hTcxDec; // HARMONIZE_2446_CON_TCX_FX + TCX_DEC_HANDLE hTcxDec; hTcxLtpDec = st->hTcxLtpDec; hHQ_core = st->hHQ_core; @@ -1094,11 +1094,13 @@ void con_tcx_ivas_fx( } #endif // !HARMONIZE_2446_CON_TCX_FX - - st->Mode2_lp_gainc = L_deposit_l( 0 ); - - st->Mode2_lp_gainp = get_gain2( synth - shl_sat( L_subfr, 1 ), synth - add( shl_sat( L_subfr, 1 ), Tc ), shl_sat( L_subfr, 1 ) ); +#ifndef HARMONIZE_2446_CON_TCX_FX + st->Mode2_lp_gainp = get_gain2(synth - shl(L_subfr, 1), synth - add(shl(L_subfr, 1), Tc), shl(L_subfr, 1)); +#else + st->Mode2_lp_gainp = get_gain2(synth - shl_sat(L_subfr, 1), synth - add(shl_sat(L_subfr, 1), Tc), shl_sat(L_subfr, 1)); +#endif // !HARMONIZE_2446_CON_TCX_FX + move32(); st->Mode2_lp_gainp = L_max( st->Mode2_lp_gainp, 0 ); /*Q16*/ -- GitLab