From 3ff461a05f01d07287da94ae958a3f33cb17ae9f Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 16 Mar 2026 12:40:56 +0100 Subject: [PATCH 01/20] issue: 2457 Unfinished commits trying to harmonize Extend function pair --- lib_com/options.h | 1 + lib_dec/jbm_pcmdsp_apa_fx.c | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index b63ee327f..a4646082d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -95,6 +95,7 @@ #define FIX_1525_UNINIT_FORMAT_SWITCHING_DEC /* VA: float issue 1525: fix reading of uninitialized memory in format switching at the decoder */ #define HARMONIZE_2446_CON_TCX_FX /* FhG: basop issue: 2446 harmonization of function con_tcx_fx() */ #define FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC /* Nokia: Fix to convert non-converted binary operations */ +#define HARMONIZE_2481_EXTEND_SHRINK /* FhG: basop issue 2481 Harmonizing functions extend_frm_*fx() and shrink_frm_*fx */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 27fc1afa0..82cbd72f1 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -1952,6 +1952,7 @@ static bool shrink_frm_ivas_fx( * ******************************************************************************** */ +#ifndef HARMONIZE_2481_EXTEND_SHRINK static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in_fx[], // Qx @@ -2206,13 +2207,23 @@ static bool extend_frm_fx( return 0; } +#endif // !HARMONIZE_2481_EXTEND_SHRINK +#ifndef HARMONIZE_2481_EXTEND_SHRINK static bool extend_frm_ivas_fx( - apa_state_t *ps, + apa_state_t* ps, const Word16 frm_in_fx[], // Qx Word16 frm_out_fx[], // Qx Word16 Q_frm_in, - UWord16 *l_frm_out ) + UWord16* l_frm_out ) +#else +static bool extend_frm_fx( + apa_state_t* ps, + const Word16 frm_in_fx[], // Qx + Word16 frm_out_fx[], // Qx + Word16 Q_frm_in, + UWord16* l_frm_out) +#endif // !HARMONIZE_2481_EXTEND_SHRINK { bool findSynchResult = 0; move16(); @@ -2334,7 +2345,12 @@ static bool extend_frm_ivas_fx( IF( over[n] ) { /* calculate overlap position */ - IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) ) +#ifndef HARMONIZE_2481_EXTEND_SHRINK + IF(isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10)) +#else + + IF((isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10) && NE_16(st->element_mode, EVS_MONO)) || (isSilence_fx(frm_in_fx, l_seg, 10) && EQ_16(st->element_mode, EVS_MONO))) +#endif // !HARMONIZE_2481_EXTEND_SHRINK { /* maximum scaling */ energy_fx = -65 * ( 1 << 8 ); // Q8 -- GitLab From 544660dcc0162a67cb57b71e829951098b4cc4c7 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 16 Mar 2026 14:24:11 +0100 Subject: [PATCH 02/20] issue: 2457 Complementing commit 3ff461a0 and finalizing harmonization --- lib_dec/jbm_pcmdsp_apa_fx.c | 39 ++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 82cbd72f1..3f82c01c7 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -794,8 +794,13 @@ UWord8 apa_exec_fx( } /* extend */ ELSE - { - extend_frm_fx( ps, frm_in, a_out, &l_frm_out ); + { +#ifndef HARMONIZE_2481_EXTEND_SHRINK + extend_frm_fx(ps, frm_in, a_out, &l_frm_out); +#else + extend_frm_fx(ps, frm_in, a_out, NULL, &l_frm_out); +#endif // !HARMONIZE_2481_EXTEND_SHRINK + } /* control the amount/frequency of scaling */ IF( NE_32( l_frm_out, ps->l_frm ) ) @@ -1030,7 +1035,11 @@ UWord8 apa_exec_ivas_fx( /* extend */ ELSE { - extend_frm_ivas_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out ); +#ifndef HARMONIZE_2481_EXTEND_SHRINK + extend_frm_ivas_fx(ps, frm_in, a_tmp, Q_a_out, &l_frm_out); +#else + extend_frm_fx(ps, frm_in, a_tmp, Q_a_out, &l_frm_out); +#endif // !HARMONIZE_2481_EXTEND_SHRINK } /* control the amount/frequency of scaling */ IF( NE_32( l_frm_out, ps->l_frm ) ) @@ -2344,12 +2353,11 @@ static bool extend_frm_fx( IF( over[n] ) { - /* calculate overlap position */ + /* calculate overlap position */ #ifndef HARMONIZE_2481_EXTEND_SHRINK IF(isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10)) #else - - IF((isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10) && NE_16(st->element_mode, EVS_MONO)) || (isSilence_fx(frm_in_fx, l_seg, 10) && EQ_16(st->element_mode, EVS_MONO))) + IF(isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10) && (Q_frm_in != NULL) || (isSilence_fx(frm_in_fx, l_seg, 10) && (Q_frm_in == NULL))) #endif // !HARMONIZE_2481_EXTEND_SHRINK { /* maximum scaling */ @@ -2378,9 +2386,22 @@ static bool extend_frm_fx( frmInScaled = ps->frmInScaled; assert( sizeof( ps->frmInScaled ) / sizeof( ps->frmInScaled[0] ) >= 2 * (size_t) l_frm ); scaleSignal16( frm_in_fx, frmInScaled, shl( l_frm, 1 ), ps->signalScaleForCorrelation ); - ps->signalScaleForCorrelation = sub( ps->signalScaleForCorrelation, Q_frm_in ); - findSynchResult = find_synch_fx( ps, frmInScaled, extract_l( L_shl( l_frm, 1 ) ), s_start, sub( s_end, s_start ), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n] ); - ps->signalScaleForCorrelation = add( ps->signalScaleForCorrelation, Q_frm_in ); +#ifndef HARMONIZE_2481_EXTEND_SHRINK + ps->signalScaleForCorrelation = sub(ps->signalScaleForCorrelation, Q_frm_in); + findSynchResult = find_synch_fx(ps, frmInScaled, extract_l(L_shl(l_frm, 1)), s_start, sub(s_end, s_start), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n]); + ps->signalScaleForCorrelation = add(ps->signalScaleForCorrelation, Q_frm_in); +#else + IF(Q_frm_in == NULL) { + findSynchResult = find_synch_fx(ps, frmInScaled, extract_l(L_shl(l_frm, 1)), s_start, sub(s_end, s_start), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n]); + } + ELSE{ + ps->signalScaleForCorrelation = sub(ps->signalScaleForCorrelation, Q_frm_in); + findSynchResult = find_synch_fx(ps, frmInScaled, extract_l(L_shl(l_frm, 1)), s_start, sub(s_end, s_start), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n]); + ps->signalScaleForCorrelation = add(ps->signalScaleForCorrelation, Q_frm_in); + } +#endif // !HARMONIZE_2481_EXTEND_SHRINK + + } /* assert synch_pos is cleanly divisible by number of channels */ assert( xtract[n] % ps->num_channels == 0 ); -- GitLab From 0f7e028f41fbea1b8c28dd394e64bdeef232255a Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 16 Mar 2026 14:26:50 +0100 Subject: [PATCH 03/20] issue: 2457 Clang formatting patch --- lib_dec/jbm_pcmdsp_apa_fx.c | 47 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 3f82c01c7..8c4f03cef 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -794,13 +794,12 @@ UWord8 apa_exec_fx( } /* extend */ ELSE - { + { #ifndef HARMONIZE_2481_EXTEND_SHRINK - extend_frm_fx(ps, frm_in, a_out, &l_frm_out); + extend_frm_fx( ps, frm_in, a_out, &l_frm_out ); #else - extend_frm_fx(ps, frm_in, a_out, NULL, &l_frm_out); + extend_frm_fx( ps, frm_in, a_out, NULL, &l_frm_out ); #endif // !HARMONIZE_2481_EXTEND_SHRINK - } /* control the amount/frequency of scaling */ IF( NE_32( l_frm_out, ps->l_frm ) ) @@ -1036,9 +1035,9 @@ UWord8 apa_exec_ivas_fx( ELSE { #ifndef HARMONIZE_2481_EXTEND_SHRINK - extend_frm_ivas_fx(ps, frm_in, a_tmp, Q_a_out, &l_frm_out); + extend_frm_ivas_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out ); #else - extend_frm_fx(ps, frm_in, a_tmp, Q_a_out, &l_frm_out); + extend_frm_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* control the amount/frequency of scaling */ @@ -2220,18 +2219,18 @@ static bool extend_frm_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK static bool extend_frm_ivas_fx( - apa_state_t* ps, + apa_state_t *ps, const Word16 frm_in_fx[], // Qx Word16 frm_out_fx[], // Qx Word16 Q_frm_in, - UWord16* l_frm_out ) + UWord16 *l_frm_out ) #else static bool extend_frm_fx( - apa_state_t* ps, + apa_state_t *ps, const Word16 frm_in_fx[], // Qx Word16 frm_out_fx[], // Qx Word16 Q_frm_in, - UWord16* l_frm_out) + UWord16 *l_frm_out ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { bool findSynchResult = 0; @@ -2353,11 +2352,11 @@ static bool extend_frm_fx( IF( over[n] ) { - /* calculate overlap position */ + /* calculate overlap position */ #ifndef HARMONIZE_2481_EXTEND_SHRINK - IF(isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10)) + IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) ) #else - IF(isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10) && (Q_frm_in != NULL) || (isSilence_fx(frm_in_fx, l_seg, 10) && (Q_frm_in == NULL))) + IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) && ( Q_frm_in != NULL ) || ( isSilence_fx( frm_in_fx, l_seg, 10 ) && ( Q_frm_in == NULL ) ) ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { /* maximum scaling */ @@ -2387,21 +2386,21 @@ static bool extend_frm_fx( assert( sizeof( ps->frmInScaled ) / sizeof( ps->frmInScaled[0] ) >= 2 * (size_t) l_frm ); scaleSignal16( frm_in_fx, frmInScaled, shl( l_frm, 1 ), ps->signalScaleForCorrelation ); #ifndef HARMONIZE_2481_EXTEND_SHRINK - ps->signalScaleForCorrelation = sub(ps->signalScaleForCorrelation, Q_frm_in); - findSynchResult = find_synch_fx(ps, frmInScaled, extract_l(L_shl(l_frm, 1)), s_start, sub(s_end, s_start), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n]); - ps->signalScaleForCorrelation = add(ps->signalScaleForCorrelation, Q_frm_in); + ps->signalScaleForCorrelation = sub( ps->signalScaleForCorrelation, Q_frm_in ); + findSynchResult = find_synch_fx( ps, frmInScaled, extract_l( L_shl( l_frm, 1 ) ), s_start, sub( s_end, s_start ), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n] ); + ps->signalScaleForCorrelation = add( ps->signalScaleForCorrelation, Q_frm_in ); #else - IF(Q_frm_in == NULL) { - findSynchResult = find_synch_fx(ps, frmInScaled, extract_l(L_shl(l_frm, 1)), s_start, sub(s_end, s_start), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n]); + IF( Q_frm_in == NULL ) + { + findSynchResult = find_synch_fx( ps, frmInScaled, extract_l( L_shl( l_frm, 1 ) ), s_start, sub( s_end, s_start ), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n] ); } - ELSE{ - ps->signalScaleForCorrelation = sub(ps->signalScaleForCorrelation, Q_frm_in); - findSynchResult = find_synch_fx(ps, frmInScaled, extract_l(L_shl(l_frm, 1)), s_start, sub(s_end, s_start), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n]); - ps->signalScaleForCorrelation = add(ps->signalScaleForCorrelation, Q_frm_in); + ELSE + { + ps->signalScaleForCorrelation = sub( ps->signalScaleForCorrelation, Q_frm_in ); + findSynchResult = find_synch_fx( ps, frmInScaled, extract_l( L_shl( l_frm, 1 ) ), s_start, sub( s_end, s_start ), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n] ); + ps->signalScaleForCorrelation = add( ps->signalScaleForCorrelation, Q_frm_in ); } #endif // !HARMONIZE_2481_EXTEND_SHRINK - - } /* assert synch_pos is cleanly divisible by number of channels */ assert( xtract[n] % ps->num_channels == 0 ); -- GitLab From b083ddceeed91b6875bc722760fabd0cee04e11d Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 16 Mar 2026 14:33:26 +0100 Subject: [PATCH 04/20] issue: 2457 Editing declaration according to changes in definition of Extend function --- lib_dec/jbm_pcmdsp_apa_fx.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 8c4f03cef..1cbf77d0f 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -153,9 +153,17 @@ static bool shrink_frm_fx( apa_state_t *ps, const Word16 frm_in[], UWord16 maxSc static bool shrink_frm_ivas_fx( apa_state_t *ps, const Word16 frm_in[], UWord16 maxScaling, Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out ); -static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], UWord16 *l_frm_out ); +#ifndef HARMONIZE_2481_EXTEND_SHRINK + +static bool extend_frm_fx(apa_state_t* ps, const Word16 frm_in[], Word16 frm_out[], UWord16* l_frm_out); -static bool extend_frm_ivas_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out ); +static bool extend_frm_ivas_fx(apa_state_t* ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16* l_frm_out); + +#else + +static bool extend_frm_fx(apa_state_t* ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16* l_frm_out); + +#endif // !HARMONIZE_2481_EXTEND_SHRINK /*---------------------------------------------------------------------* * Public functions -- GitLab From 211fab326a842fa4fb7d09682bdd1c3392820997 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 16 Mar 2026 12:40:56 +0100 Subject: [PATCH 05/20] issue: 2481 Unfinished commits trying to harmonize Extend function pair --- lib_com/options.h | 1 + lib_dec/jbm_pcmdsp_apa_fx.c | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index b63ee327f..a4646082d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -95,6 +95,7 @@ #define FIX_1525_UNINIT_FORMAT_SWITCHING_DEC /* VA: float issue 1525: fix reading of uninitialized memory in format switching at the decoder */ #define HARMONIZE_2446_CON_TCX_FX /* FhG: basop issue: 2446 harmonization of function con_tcx_fx() */ #define FIX_2433_ARITH_OVERFLOW_IN_QMETA_ENC /* Nokia: Fix to convert non-converted binary operations */ +#define HARMONIZE_2481_EXTEND_SHRINK /* FhG: basop issue 2481 Harmonizing functions extend_frm_*fx() and shrink_frm_*fx */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 27fc1afa0..82cbd72f1 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -1952,6 +1952,7 @@ static bool shrink_frm_ivas_fx( * ******************************************************************************** */ +#ifndef HARMONIZE_2481_EXTEND_SHRINK static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in_fx[], // Qx @@ -2206,13 +2207,23 @@ static bool extend_frm_fx( return 0; } +#endif // !HARMONIZE_2481_EXTEND_SHRINK +#ifndef HARMONIZE_2481_EXTEND_SHRINK static bool extend_frm_ivas_fx( - apa_state_t *ps, + apa_state_t* ps, const Word16 frm_in_fx[], // Qx Word16 frm_out_fx[], // Qx Word16 Q_frm_in, - UWord16 *l_frm_out ) + UWord16* l_frm_out ) +#else +static bool extend_frm_fx( + apa_state_t* ps, + const Word16 frm_in_fx[], // Qx + Word16 frm_out_fx[], // Qx + Word16 Q_frm_in, + UWord16* l_frm_out) +#endif // !HARMONIZE_2481_EXTEND_SHRINK { bool findSynchResult = 0; move16(); @@ -2334,7 +2345,12 @@ static bool extend_frm_ivas_fx( IF( over[n] ) { /* calculate overlap position */ - IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) ) +#ifndef HARMONIZE_2481_EXTEND_SHRINK + IF(isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10)) +#else + + IF((isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10) && NE_16(st->element_mode, EVS_MONO)) || (isSilence_fx(frm_in_fx, l_seg, 10) && EQ_16(st->element_mode, EVS_MONO))) +#endif // !HARMONIZE_2481_EXTEND_SHRINK { /* maximum scaling */ energy_fx = -65 * ( 1 << 8 ); // Q8 -- GitLab From 1a3c5b6a7b4e5f5eec48864bd20c1cfab254a881 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 16 Mar 2026 14:24:11 +0100 Subject: [PATCH 06/20] issue: 2481 Complementing commit 3ff461a0 and finalizing harmonization --- lib_dec/jbm_pcmdsp_apa_fx.c | 39 ++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 82cbd72f1..3f82c01c7 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -794,8 +794,13 @@ UWord8 apa_exec_fx( } /* extend */ ELSE - { - extend_frm_fx( ps, frm_in, a_out, &l_frm_out ); + { +#ifndef HARMONIZE_2481_EXTEND_SHRINK + extend_frm_fx(ps, frm_in, a_out, &l_frm_out); +#else + extend_frm_fx(ps, frm_in, a_out, NULL, &l_frm_out); +#endif // !HARMONIZE_2481_EXTEND_SHRINK + } /* control the amount/frequency of scaling */ IF( NE_32( l_frm_out, ps->l_frm ) ) @@ -1030,7 +1035,11 @@ UWord8 apa_exec_ivas_fx( /* extend */ ELSE { - extend_frm_ivas_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out ); +#ifndef HARMONIZE_2481_EXTEND_SHRINK + extend_frm_ivas_fx(ps, frm_in, a_tmp, Q_a_out, &l_frm_out); +#else + extend_frm_fx(ps, frm_in, a_tmp, Q_a_out, &l_frm_out); +#endif // !HARMONIZE_2481_EXTEND_SHRINK } /* control the amount/frequency of scaling */ IF( NE_32( l_frm_out, ps->l_frm ) ) @@ -2344,12 +2353,11 @@ static bool extend_frm_fx( IF( over[n] ) { - /* calculate overlap position */ + /* calculate overlap position */ #ifndef HARMONIZE_2481_EXTEND_SHRINK IF(isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10)) #else - - IF((isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10) && NE_16(st->element_mode, EVS_MONO)) || (isSilence_fx(frm_in_fx, l_seg, 10) && EQ_16(st->element_mode, EVS_MONO))) + IF(isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10) && (Q_frm_in != NULL) || (isSilence_fx(frm_in_fx, l_seg, 10) && (Q_frm_in == NULL))) #endif // !HARMONIZE_2481_EXTEND_SHRINK { /* maximum scaling */ @@ -2378,9 +2386,22 @@ static bool extend_frm_fx( frmInScaled = ps->frmInScaled; assert( sizeof( ps->frmInScaled ) / sizeof( ps->frmInScaled[0] ) >= 2 * (size_t) l_frm ); scaleSignal16( frm_in_fx, frmInScaled, shl( l_frm, 1 ), ps->signalScaleForCorrelation ); - ps->signalScaleForCorrelation = sub( ps->signalScaleForCorrelation, Q_frm_in ); - findSynchResult = find_synch_fx( ps, frmInScaled, extract_l( L_shl( l_frm, 1 ) ), s_start, sub( s_end, s_start ), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n] ); - ps->signalScaleForCorrelation = add( ps->signalScaleForCorrelation, Q_frm_in ); +#ifndef HARMONIZE_2481_EXTEND_SHRINK + ps->signalScaleForCorrelation = sub(ps->signalScaleForCorrelation, Q_frm_in); + findSynchResult = find_synch_fx(ps, frmInScaled, extract_l(L_shl(l_frm, 1)), s_start, sub(s_end, s_start), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n]); + ps->signalScaleForCorrelation = add(ps->signalScaleForCorrelation, Q_frm_in); +#else + IF(Q_frm_in == NULL) { + findSynchResult = find_synch_fx(ps, frmInScaled, extract_l(L_shl(l_frm, 1)), s_start, sub(s_end, s_start), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n]); + } + ELSE{ + ps->signalScaleForCorrelation = sub(ps->signalScaleForCorrelation, Q_frm_in); + findSynchResult = find_synch_fx(ps, frmInScaled, extract_l(L_shl(l_frm, 1)), s_start, sub(s_end, s_start), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n]); + ps->signalScaleForCorrelation = add(ps->signalScaleForCorrelation, Q_frm_in); + } +#endif // !HARMONIZE_2481_EXTEND_SHRINK + + } /* assert synch_pos is cleanly divisible by number of channels */ assert( xtract[n] % ps->num_channels == 0 ); -- GitLab From 66c95ea96cc0fa3fc77f985a8630c58571b4670a Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 16 Mar 2026 14:26:50 +0100 Subject: [PATCH 07/20] issue: 2481 Clang formatting patch --- lib_dec/jbm_pcmdsp_apa_fx.c | 47 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 3f82c01c7..8c4f03cef 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -794,13 +794,12 @@ UWord8 apa_exec_fx( } /* extend */ ELSE - { + { #ifndef HARMONIZE_2481_EXTEND_SHRINK - extend_frm_fx(ps, frm_in, a_out, &l_frm_out); + extend_frm_fx( ps, frm_in, a_out, &l_frm_out ); #else - extend_frm_fx(ps, frm_in, a_out, NULL, &l_frm_out); + extend_frm_fx( ps, frm_in, a_out, NULL, &l_frm_out ); #endif // !HARMONIZE_2481_EXTEND_SHRINK - } /* control the amount/frequency of scaling */ IF( NE_32( l_frm_out, ps->l_frm ) ) @@ -1036,9 +1035,9 @@ UWord8 apa_exec_ivas_fx( ELSE { #ifndef HARMONIZE_2481_EXTEND_SHRINK - extend_frm_ivas_fx(ps, frm_in, a_tmp, Q_a_out, &l_frm_out); + extend_frm_ivas_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out ); #else - extend_frm_fx(ps, frm_in, a_tmp, Q_a_out, &l_frm_out); + extend_frm_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* control the amount/frequency of scaling */ @@ -2220,18 +2219,18 @@ static bool extend_frm_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK static bool extend_frm_ivas_fx( - apa_state_t* ps, + apa_state_t *ps, const Word16 frm_in_fx[], // Qx Word16 frm_out_fx[], // Qx Word16 Q_frm_in, - UWord16* l_frm_out ) + UWord16 *l_frm_out ) #else static bool extend_frm_fx( - apa_state_t* ps, + apa_state_t *ps, const Word16 frm_in_fx[], // Qx Word16 frm_out_fx[], // Qx Word16 Q_frm_in, - UWord16* l_frm_out) + UWord16 *l_frm_out ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { bool findSynchResult = 0; @@ -2353,11 +2352,11 @@ static bool extend_frm_fx( IF( over[n] ) { - /* calculate overlap position */ + /* calculate overlap position */ #ifndef HARMONIZE_2481_EXTEND_SHRINK - IF(isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10)) + IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) ) #else - IF(isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10) && (Q_frm_in != NULL) || (isSilence_fx(frm_in_fx, l_seg, 10) && (Q_frm_in == NULL))) + IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) && ( Q_frm_in != NULL ) || ( isSilence_fx( frm_in_fx, l_seg, 10 ) && ( Q_frm_in == NULL ) ) ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { /* maximum scaling */ @@ -2387,21 +2386,21 @@ static bool extend_frm_fx( assert( sizeof( ps->frmInScaled ) / sizeof( ps->frmInScaled[0] ) >= 2 * (size_t) l_frm ); scaleSignal16( frm_in_fx, frmInScaled, shl( l_frm, 1 ), ps->signalScaleForCorrelation ); #ifndef HARMONIZE_2481_EXTEND_SHRINK - ps->signalScaleForCorrelation = sub(ps->signalScaleForCorrelation, Q_frm_in); - findSynchResult = find_synch_fx(ps, frmInScaled, extract_l(L_shl(l_frm, 1)), s_start, sub(s_end, s_start), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n]); - ps->signalScaleForCorrelation = add(ps->signalScaleForCorrelation, Q_frm_in); + ps->signalScaleForCorrelation = sub( ps->signalScaleForCorrelation, Q_frm_in ); + findSynchResult = find_synch_fx( ps, frmInScaled, extract_l( L_shl( l_frm, 1 ) ), s_start, sub( s_end, s_start ), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n] ); + ps->signalScaleForCorrelation = add( ps->signalScaleForCorrelation, Q_frm_in ); #else - IF(Q_frm_in == NULL) { - findSynchResult = find_synch_fx(ps, frmInScaled, extract_l(L_shl(l_frm, 1)), s_start, sub(s_end, s_start), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n]); + IF( Q_frm_in == NULL ) + { + findSynchResult = find_synch_fx( ps, frmInScaled, extract_l( L_shl( l_frm, 1 ) ), s_start, sub( s_end, s_start ), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n] ); } - ELSE{ - ps->signalScaleForCorrelation = sub(ps->signalScaleForCorrelation, Q_frm_in); - findSynchResult = find_synch_fx(ps, frmInScaled, extract_l(L_shl(l_frm, 1)), s_start, sub(s_end, s_start), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n]); - ps->signalScaleForCorrelation = add(ps->signalScaleForCorrelation, Q_frm_in); + ELSE + { + ps->signalScaleForCorrelation = sub( ps->signalScaleForCorrelation, Q_frm_in ); + findSynchResult = find_synch_fx( ps, frmInScaled, extract_l( L_shl( l_frm, 1 ) ), s_start, sub( s_end, s_start ), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n] ); + ps->signalScaleForCorrelation = add( ps->signalScaleForCorrelation, Q_frm_in ); } #endif // !HARMONIZE_2481_EXTEND_SHRINK - - } /* assert synch_pos is cleanly divisible by number of channels */ assert( xtract[n] % ps->num_channels == 0 ); -- GitLab From a5b10d2b56883710ce1efa9043bad0195b3aaeb5 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 16 Mar 2026 14:33:26 +0100 Subject: [PATCH 08/20] issue: 2481 Editing declaration according to changes in definition of Extend function --- lib_dec/jbm_pcmdsp_apa_fx.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 8c4f03cef..1cbf77d0f 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -153,9 +153,17 @@ static bool shrink_frm_fx( apa_state_t *ps, const Word16 frm_in[], UWord16 maxSc static bool shrink_frm_ivas_fx( apa_state_t *ps, const Word16 frm_in[], UWord16 maxScaling, Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out ); -static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], UWord16 *l_frm_out ); +#ifndef HARMONIZE_2481_EXTEND_SHRINK + +static bool extend_frm_fx(apa_state_t* ps, const Word16 frm_in[], Word16 frm_out[], UWord16* l_frm_out); -static bool extend_frm_ivas_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out ); +static bool extend_frm_ivas_fx(apa_state_t* ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16* l_frm_out); + +#else + +static bool extend_frm_fx(apa_state_t* ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16* l_frm_out); + +#endif // !HARMONIZE_2481_EXTEND_SHRINK /*---------------------------------------------------------------------* * Public functions -- GitLab From e653d751a4a7874b59ca5a5772389e39cffd8b08 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 16 Mar 2026 14:35:18 +0100 Subject: [PATCH 09/20] issue: 2481 Clang formatting patch --- lib_dec/jbm_pcmdsp_apa_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 1cbf77d0f..f9a40d2bc 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -155,13 +155,13 @@ static bool shrink_frm_ivas_fx( apa_state_t *ps, const Word16 frm_in[], UWord16 #ifndef HARMONIZE_2481_EXTEND_SHRINK -static bool extend_frm_fx(apa_state_t* ps, const Word16 frm_in[], Word16 frm_out[], UWord16* l_frm_out); +static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], UWord16 *l_frm_out ); -static bool extend_frm_ivas_fx(apa_state_t* ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16* l_frm_out); +static bool extend_frm_ivas_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out ); #else -static bool extend_frm_fx(apa_state_t* ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16* l_frm_out); +static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out ); #endif // !HARMONIZE_2481_EXTEND_SHRINK -- GitLab From 4da2b2f1c474a02bfc26f59dab7052273661ebc3 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Mon, 16 Mar 2026 14:44:39 +0100 Subject: [PATCH 10/20] issue: 2481 Clang formatting patch --- lib_dec/jbm_pcmdsp_apa_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 1cbf77d0f..f9a40d2bc 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -155,13 +155,13 @@ static bool shrink_frm_ivas_fx( apa_state_t *ps, const Word16 frm_in[], UWord16 #ifndef HARMONIZE_2481_EXTEND_SHRINK -static bool extend_frm_fx(apa_state_t* ps, const Word16 frm_in[], Word16 frm_out[], UWord16* l_frm_out); +static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], UWord16 *l_frm_out ); -static bool extend_frm_ivas_fx(apa_state_t* ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16* l_frm_out); +static bool extend_frm_ivas_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out ); #else -static bool extend_frm_fx(apa_state_t* ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16* l_frm_out); +static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out ); #endif // !HARMONIZE_2481_EXTEND_SHRINK -- GitLab From 2fcd6932d12cd412949e913d0f3fb02efd779917 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Tue, 17 Mar 2026 10:22:20 +0100 Subject: [PATCH 11/20] issue: 2481 Adding legacy flag in the function signature. changing the mechanism of deciding legacy case --- lib_dec/jbm_pcmdsp_apa_fx.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index f9a40d2bc..f3eaf3868 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -161,7 +161,7 @@ static bool extend_frm_ivas_fx( apa_state_t *ps, const Word16 frm_in[], Word16 f #else -static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out ); +static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out, Word16 leg_flag ); #endif // !HARMONIZE_2481_EXTEND_SHRINK @@ -806,7 +806,7 @@ UWord8 apa_exec_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK extend_frm_fx( ps, frm_in, a_out, &l_frm_out ); #else - extend_frm_fx( ps, frm_in, a_out, NULL, &l_frm_out ); + extend_frm_fx( ps, frm_in, a_out, 0 , &l_frm_out, (Word16) 1 ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* control the amount/frequency of scaling */ @@ -1045,7 +1045,7 @@ UWord8 apa_exec_ivas_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK extend_frm_ivas_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out ); #else - extend_frm_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out ); + extend_frm_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out, (Word16) 0 ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* control the amount/frequency of scaling */ @@ -2238,7 +2238,8 @@ static bool extend_frm_fx( const Word16 frm_in_fx[], // Qx Word16 frm_out_fx[], // Qx Word16 Q_frm_in, - UWord16 *l_frm_out ) + UWord16 *l_frm_out, + Word16 leg_flag) #endif // !HARMONIZE_2481_EXTEND_SHRINK { bool findSynchResult = 0; @@ -2364,7 +2365,7 @@ static bool extend_frm_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) ) #else - IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) && ( Q_frm_in != NULL ) || ( isSilence_fx( frm_in_fx, l_seg, 10 ) && ( Q_frm_in == NULL ) ) ) + IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) && ( !leg_flag ) || ( isSilence_fx( frm_in_fx, l_seg, 10 ) && leg_flag ) ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { /* maximum scaling */ @@ -2398,7 +2399,7 @@ static bool extend_frm_fx( findSynchResult = find_synch_fx( ps, frmInScaled, extract_l( L_shl( l_frm, 1 ) ), s_start, sub( s_end, s_start ), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n] ); ps->signalScaleForCorrelation = add( ps->signalScaleForCorrelation, Q_frm_in ); #else - IF( Q_frm_in == NULL ) + IF( leg_flag ) { findSynchResult = find_synch_fx( ps, frmInScaled, extract_l( L_shl( l_frm, 1 ) ), s_start, sub( s_end, s_start ), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n] ); } -- GitLab From 5b0d9972d49b82cc5cc53b2fd15765a824a31f05 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Tue, 17 Mar 2026 10:25:13 +0100 Subject: [PATCH 12/20] issue: 2481 Clang formatting patch --- lib_dec/jbm_pcmdsp_apa_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index f3eaf3868..7f55c6555 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -806,7 +806,7 @@ UWord8 apa_exec_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK extend_frm_fx( ps, frm_in, a_out, &l_frm_out ); #else - extend_frm_fx( ps, frm_in, a_out, 0 , &l_frm_out, (Word16) 1 ); + extend_frm_fx( ps, frm_in, a_out, 0, &l_frm_out, (Word16) 1 ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* control the amount/frequency of scaling */ @@ -2239,7 +2239,7 @@ static bool extend_frm_fx( Word16 frm_out_fx[], // Qx Word16 Q_frm_in, UWord16 *l_frm_out, - Word16 leg_flag) + Word16 leg_flag ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { bool findSynchResult = 0; -- GitLab From 4cd041f4593aaf061d4216d59659f3a4e334a71c Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Tue, 17 Mar 2026 10:30:59 +0100 Subject: [PATCH 13/20] issue: 2481 Adding parentheses to avoid linux warnings as errors --- lib_dec/jbm_pcmdsp_apa_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 7f55c6555..5d6eff4bf 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -2365,7 +2365,7 @@ static bool extend_frm_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) ) #else - IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) && ( !leg_flag ) || ( isSilence_fx( frm_in_fx, l_seg, 10 ) && leg_flag ) ) + IF( (isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) && ( !leg_flag )) || ( isSilence_fx( frm_in_fx, l_seg, 10 ) && leg_flag ) ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { /* maximum scaling */ -- GitLab From e7fd7c44f571228792236914dc3ff8aa96c401ea Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Tue, 17 Mar 2026 10:33:29 +0100 Subject: [PATCH 14/20] issue: 2481 Clang formatting patch --- lib_dec/jbm_pcmdsp_apa_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 5d6eff4bf..f8a5599e0 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -2365,7 +2365,7 @@ static bool extend_frm_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) ) #else - IF( (isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) && ( !leg_flag )) || ( isSilence_fx( frm_in_fx, l_seg, 10 ) && leg_flag ) ) + IF( ( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) && ( !leg_flag ) ) || ( isSilence_fx( frm_in_fx, l_seg, 10 ) && leg_flag ) ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { /* maximum scaling */ -- GitLab From 4a7062d58d9545821c8652bc58d44f7a7fa52a16 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Tue, 17 Mar 2026 17:00:00 +0100 Subject: [PATCH 15/20] issue: 2481 Applying the same commits for shrink_frm_fx(). The two pairs were mostly different in the same places --- lib_dec/jbm_pcmdsp_apa_fx.c | 72 ++++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 12 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index f8a5599e0..c074aba3a 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -149,18 +149,20 @@ static Word16 find_synch_fx( apa_state_t *ps, const Word16 *in, Word16 l_in, Wor static bool copy_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], UWord16 *l_frm_out ); +#ifndef HARMONIZE_2481_EXTEND_SHRINK + static bool shrink_frm_fx( apa_state_t *ps, const Word16 frm_in[], UWord16 maxScaling, Word16 frm_out[], UWord16 *l_frm_out ); static bool shrink_frm_ivas_fx( apa_state_t *ps, const Word16 frm_in[], UWord16 maxScaling, Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out ); -#ifndef HARMONIZE_2481_EXTEND_SHRINK - static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], UWord16 *l_frm_out ); static bool extend_frm_ivas_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out ); #else +static bool shrink_frm_fx(apa_state_t* ps, const Word16 frm_in[], UWord16 maxScaling, Word16 frm_out[], Word16 Q_frm_in, UWord16* l_frm_out, Word16 leg_flag); + static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out, Word16 leg_flag ); #endif // !HARMONIZE_2481_EXTEND_SHRINK @@ -797,8 +799,14 @@ UWord8 apa_exec_fx( } /* shrink */ ELSE IF( LT_32( ps->scale, 100 ) ) - { - shrink_frm_fx( ps, frm_in, maxScaling, a_out, &l_frm_out ); + { + +#ifndef HARMONIZE_2481_EXTEND_SHRINK + shrink_frm_fx(ps, frm_in, maxScaling, a_out, &l_frm_out); +#else + shrink_frm_fx(ps, frm_in, maxScaling, a_out, 0 ,&l_frm_out, (Word16) 1); +#endif // !HARMONIZE_2481_EXTEND_SHRINK + } /* extend */ ELSE @@ -1037,7 +1045,11 @@ UWord8 apa_exec_ivas_fx( /* shrink */ IF( LT_32( ps->scale, 100 ) ) { - shrink_frm_ivas_fx( ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out ); +#ifndef HARMONIZE_2481_EXTEND_SHRINK + shrink_frm_ivas_fx(ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out); +#else + shrink_frm_fx(ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out, (Word16) 0); +#endif // !HARMONIZE_2481_EXTEND_SHRINK } /* extend */ ELSE @@ -1606,6 +1618,8 @@ static bool copy_frm_fx( * ******************************************************************************** */ +#ifndef HARMONIZE_2481_EXTEND_SHRINK + static bool shrink_frm_fx( apa_state_t *ps, const Word16 frm_in_fx[], // Qx @@ -1774,13 +1788,26 @@ static bool shrink_frm_fx( return 0; } +#endif // !HARMONIZE_2481_EXTEND_SHRINK + +#ifndef HARMONIZE_2481_EXTEND_SHRINK static bool shrink_frm_ivas_fx( - apa_state_t *ps, + apa_state_t* ps, const Word16 frm_in_fx[], // Qx UWord16 maxScaling, Word16 frm_out_fx[], // Qx Word16 Q_frm_in, - UWord16 *l_frm_out ) + UWord16* l_frm_out ) +#else +static bool shrink_frm_fx( + apa_state_t* ps, + const Word16 frm_in_fx[], // Qx + UWord16 maxScaling, + Word16 frm_out_fx[], // Qx + Word16 Q_frm_in, + UWord16* l_frm_out, + Word16 leg_flag) +#endif // !HARMONIZE_2481_EXTEND_SHRINK { bool findSynchResult = 0; move16(); @@ -1815,7 +1842,11 @@ static bool shrink_frm_ivas_fx( } /* calculate overlap position */ - IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) ) +#ifndef HARMONIZE_2481_EXTEND_SHRINK + IF(isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10)) +#else + IF((isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10) && (!leg_flag)) || (isSilence_fx(frm_in_fx, l_seg, 10) && leg_flag)) +#endif // !HARMONIZE_2481_EXTEND_SHRINK { /* maximum scaling */ energy_fx = -65 * ( 1 << 8 ); // Q8 @@ -1856,11 +1887,24 @@ static bool shrink_frm_ivas_fx( { /* find synch */ scaleSignal16( frm_in_fx, ps->frmInScaled, l_frm, ps->signalScaleForCorrelation ); - ps->signalScaleForCorrelation = sub( ps->signalScaleForCorrelation, Q_frm_in ); +#ifndef HARMONIZE_2481_EXTEND_SHRINK + ps->signalScaleForCorrelation = sub(ps->signalScaleForCorrelation, Q_frm_in); move16(); - findSynchResult = find_synch_fx( ps, ps->frmInScaled, l_frm, s_start, (UWord16) ( sub( s_end, s_start ) ), 0, l_seg, 0, &energy_fx, &quality_fx, &xtract ); - ps->signalScaleForCorrelation = add( ps->signalScaleForCorrelation, Q_frm_in ); + findSynchResult = find_synch_fx(ps, ps->frmInScaled, l_frm, s_start, (UWord16)(sub(s_end, s_start)), 0, l_seg, 0, &energy_fx, &quality_fx, &xtract); + ps->signalScaleForCorrelation = add(ps->signalScaleForCorrelation, Q_frm_in); + move16(); +#else + IF(leg_flag) { + findSynchResult = find_synch_fx(ps, ps->frmInScaled, l_frm, s_start, (UWord16)(sub(s_end, s_start)), 0, l_seg, 0, &energy_fx, &quality_fx, &xtract); + } + ELSE{ + ps->signalScaleForCorrelation = sub(ps->signalScaleForCorrelation, Q_frm_in); move16(); + findSynchResult = find_synch_fx(ps, ps->frmInScaled, l_frm, s_start, (UWord16)(sub(s_end, s_start)), 0, l_seg, 0, &energy_fx, &quality_fx, &xtract); + ps->signalScaleForCorrelation = add(ps->signalScaleForCorrelation, Q_frm_in); + move16(); + } +#endif // !HARMONIZE_2481_EXTEND_SHRINK } /* assert synch_pos is cleanly divisible by number of channels */ @@ -1892,7 +1936,11 @@ static bool shrink_frm_ivas_fx( ELSE { /* sufficient quality */ - IF( ps->bad_frame_count > 0 ) +#ifndef HARMONIZE_2481_EXTEND_SHRINK + IF(ps->bad_frame_count > 0) +#else + IF(GT_32(ps->bad_frame_count, 0)) +#endif // !HARMONIZE_2481_EXTEND_SHRINK { ps->bad_frame_count = u_extract_l( UL_subNsD( ps->bad_frame_count, 1 ) ); move16(); -- GitLab From fdd370d866367d098e2c0b402cad29cbd76d887b Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Tue, 17 Mar 2026 17:05:29 +0100 Subject: [PATCH 16/20] issue: 2481 Clang formatting patch --- lib_dec/jbm_pcmdsp_apa_fx.c | 61 +++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index c074aba3a..65254d1e5 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -161,7 +161,7 @@ static bool extend_frm_ivas_fx( apa_state_t *ps, const Word16 frm_in[], Word16 f #else -static bool shrink_frm_fx(apa_state_t* ps, const Word16 frm_in[], UWord16 maxScaling, Word16 frm_out[], Word16 Q_frm_in, UWord16* l_frm_out, Word16 leg_flag); +static bool shrink_frm_fx( apa_state_t *ps, const Word16 frm_in[], UWord16 maxScaling, Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out, Word16 leg_flag ); static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out, Word16 leg_flag ); @@ -799,14 +799,13 @@ UWord8 apa_exec_fx( } /* shrink */ ELSE IF( LT_32( ps->scale, 100 ) ) - { + { #ifndef HARMONIZE_2481_EXTEND_SHRINK - shrink_frm_fx(ps, frm_in, maxScaling, a_out, &l_frm_out); + shrink_frm_fx( ps, frm_in, maxScaling, a_out, &l_frm_out ); #else - shrink_frm_fx(ps, frm_in, maxScaling, a_out, 0 ,&l_frm_out, (Word16) 1); + shrink_frm_fx( ps, frm_in, maxScaling, a_out, 0, &l_frm_out, (Word16) 1 ); #endif // !HARMONIZE_2481_EXTEND_SHRINK - } /* extend */ ELSE @@ -1046,9 +1045,9 @@ UWord8 apa_exec_ivas_fx( IF( LT_32( ps->scale, 100 ) ) { #ifndef HARMONIZE_2481_EXTEND_SHRINK - shrink_frm_ivas_fx(ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out); + shrink_frm_ivas_fx( ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out ); #else - shrink_frm_fx(ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out, (Word16) 0); + shrink_frm_fx( ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out, (Word16) 0 ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* extend */ @@ -1792,21 +1791,21 @@ static bool shrink_frm_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK static bool shrink_frm_ivas_fx( - apa_state_t* ps, + apa_state_t *ps, const Word16 frm_in_fx[], // Qx UWord16 maxScaling, Word16 frm_out_fx[], // Qx Word16 Q_frm_in, - UWord16* l_frm_out ) + UWord16 *l_frm_out ) #else static bool shrink_frm_fx( - apa_state_t* ps, + apa_state_t *ps, const Word16 frm_in_fx[], // Qx UWord16 maxScaling, Word16 frm_out_fx[], // Qx Word16 Q_frm_in, - UWord16* l_frm_out, - Word16 leg_flag) + UWord16 *l_frm_out, + Word16 leg_flag ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { bool findSynchResult = 0; @@ -1843,9 +1842,9 @@ static bool shrink_frm_fx( /* calculate overlap position */ #ifndef HARMONIZE_2481_EXTEND_SHRINK - IF(isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10)) + IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) ) #else - IF((isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10) && (!leg_flag)) || (isSilence_fx(frm_in_fx, l_seg, 10) && leg_flag)) + IF( ( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) && ( !leg_flag ) ) || ( isSilence_fx( frm_in_fx, l_seg, 10 ) && leg_flag ) ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { /* maximum scaling */ @@ -1888,23 +1887,25 @@ static bool shrink_frm_fx( /* find synch */ scaleSignal16( frm_in_fx, ps->frmInScaled, l_frm, ps->signalScaleForCorrelation ); #ifndef HARMONIZE_2481_EXTEND_SHRINK - ps->signalScaleForCorrelation = sub(ps->signalScaleForCorrelation, Q_frm_in); + ps->signalScaleForCorrelation = sub( ps->signalScaleForCorrelation, Q_frm_in ); move16(); - findSynchResult = find_synch_fx(ps, ps->frmInScaled, l_frm, s_start, (UWord16)(sub(s_end, s_start)), 0, l_seg, 0, &energy_fx, &quality_fx, &xtract); - ps->signalScaleForCorrelation = add(ps->signalScaleForCorrelation, Q_frm_in); + findSynchResult = find_synch_fx( ps, ps->frmInScaled, l_frm, s_start, (UWord16) ( sub( s_end, s_start ) ), 0, l_seg, 0, &energy_fx, &quality_fx, &xtract ); + ps->signalScaleForCorrelation = add( ps->signalScaleForCorrelation, Q_frm_in ); move16(); #else - IF(leg_flag) { - findSynchResult = find_synch_fx(ps, ps->frmInScaled, l_frm, s_start, (UWord16)(sub(s_end, s_start)), 0, l_seg, 0, &energy_fx, &quality_fx, &xtract); - } - ELSE{ - ps->signalScaleForCorrelation = sub(ps->signalScaleForCorrelation, Q_frm_in); - move16(); - findSynchResult = find_synch_fx(ps, ps->frmInScaled, l_frm, s_start, (UWord16)(sub(s_end, s_start)), 0, l_seg, 0, &energy_fx, &quality_fx, &xtract); - ps->signalScaleForCorrelation = add(ps->signalScaleForCorrelation, Q_frm_in); - move16(); - } -#endif // !HARMONIZE_2481_EXTEND_SHRINK + IF( leg_flag ) + { + findSynchResult = find_synch_fx( ps, ps->frmInScaled, l_frm, s_start, (UWord16) ( sub( s_end, s_start ) ), 0, l_seg, 0, &energy_fx, &quality_fx, &xtract ); + } + ELSE + { + ps->signalScaleForCorrelation = sub( ps->signalScaleForCorrelation, Q_frm_in ); + move16(); + findSynchResult = find_synch_fx( ps, ps->frmInScaled, l_frm, s_start, (UWord16) ( sub( s_end, s_start ) ), 0, l_seg, 0, &energy_fx, &quality_fx, &xtract ); + ps->signalScaleForCorrelation = add( ps->signalScaleForCorrelation, Q_frm_in ); + move16(); + } +#endif // !HARMONIZE_2481_EXTEND_SHRINK } /* assert synch_pos is cleanly divisible by number of channels */ @@ -1937,9 +1938,9 @@ static bool shrink_frm_fx( { /* sufficient quality */ #ifndef HARMONIZE_2481_EXTEND_SHRINK - IF(ps->bad_frame_count > 0) + IF( ps->bad_frame_count > 0 ) #else - IF(GT_32(ps->bad_frame_count, 0)) + IF( GT_32( ps->bad_frame_count, 0 ) ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { ps->bad_frame_count = u_extract_l( UL_subNsD( ps->bad_frame_count, 1 ) ); -- GitLab From 2590e9bd041bcb13d8b9a6b199167926d5ce690a Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Wed, 18 Mar 2026 16:51:21 +0100 Subject: [PATCH 17/20] issue: 2479 Introducing the legacy flag variable instead of giving the function a vague integer --- lib_dec/jbm_pcmdsp_apa_fx.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 65254d1e5..c238704b6 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -706,6 +706,9 @@ UWord8 apa_exec_fx( Word32 dl_scaled, dl_copied, l_frm_out_target; Word32 expScaling, actScaling; UWord32 statsResetThreshold, statsResetShift; +#ifdef HARMONIZE_2481_EXTEND_SHRINK + Word16 leg_flag = 1; +#endif // HARMONIZE_2481_EXTEND_SHRINK statsResetThreshold = 1637; move32(); @@ -804,7 +807,7 @@ UWord8 apa_exec_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK shrink_frm_fx( ps, frm_in, maxScaling, a_out, &l_frm_out ); #else - shrink_frm_fx( ps, frm_in, maxScaling, a_out, 0, &l_frm_out, (Word16) 1 ); + shrink_frm_fx( ps, frm_in, maxScaling, a_out, 0, &l_frm_out, leg_flag ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* extend */ @@ -813,7 +816,7 @@ UWord8 apa_exec_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK extend_frm_fx( ps, frm_in, a_out, &l_frm_out ); #else - extend_frm_fx( ps, frm_in, a_out, 0, &l_frm_out, (Word16) 1 ); + extend_frm_fx( ps, frm_in, a_out, 0, &l_frm_out, leg_flag ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* control the amount/frequency of scaling */ @@ -933,6 +936,9 @@ UWord8 apa_exec_ivas_fx( UWord32 statsResetThreshold, statsResetShift; Word16 Q_a_out; Word16 Q_a_out_init_old; +#ifdef HARMONIZE_2481_EXTEND_SHRINK + Word16 leg_flag = 0; +#endif // HARMONIZE_2481_EXTEND_SHRINK Q_a_out = add( getScaleFactor32_copy( a_in, l_in ), Q11 - Q16 - Q1 ); Q_a_out_init_old = Q_a_out; /* store the possible scaling of a_in, to be re-used in the next frame */ @@ -1047,7 +1053,7 @@ UWord8 apa_exec_ivas_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK shrink_frm_ivas_fx( ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out ); #else - shrink_frm_fx( ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out, (Word16) 0 ); + shrink_frm_fx( ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out, leg_flag ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* extend */ @@ -1056,7 +1062,7 @@ UWord8 apa_exec_ivas_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK extend_frm_ivas_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out ); #else - extend_frm_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out, (Word16) 0 ); + extend_frm_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out, leg_flag ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* control the amount/frequency of scaling */ -- GitLab From 220eec0e60678b0cac9d752234d302cb1eddd645 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 19 Mar 2026 10:27:34 +0100 Subject: [PATCH 18/20] issue: 2481 Changing name 0f leg_flag to isEVS. Reworking certain condition to reduce number of executed functions. --- lib_dec/jbm_pcmdsp_apa_fx.c | 52 +++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index c238704b6..31e989061 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -161,9 +161,9 @@ static bool extend_frm_ivas_fx( apa_state_t *ps, const Word16 frm_in[], Word16 f #else -static bool shrink_frm_fx( apa_state_t *ps, const Word16 frm_in[], UWord16 maxScaling, Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out, Word16 leg_flag ); +static bool shrink_frm_fx( apa_state_t *ps, const Word16 frm_in[], UWord16 maxScaling, Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out, Word16 isEVS ); -static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out, Word16 leg_flag ); +static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out, Word16 isEVS ); #endif // !HARMONIZE_2481_EXTEND_SHRINK @@ -707,7 +707,7 @@ UWord8 apa_exec_fx( Word32 expScaling, actScaling; UWord32 statsResetThreshold, statsResetShift; #ifdef HARMONIZE_2481_EXTEND_SHRINK - Word16 leg_flag = 1; + Word16 isEVS = 1; #endif // HARMONIZE_2481_EXTEND_SHRINK statsResetThreshold = 1637; @@ -807,7 +807,7 @@ UWord8 apa_exec_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK shrink_frm_fx( ps, frm_in, maxScaling, a_out, &l_frm_out ); #else - shrink_frm_fx( ps, frm_in, maxScaling, a_out, 0, &l_frm_out, leg_flag ); + shrink_frm_fx( ps, frm_in, maxScaling, a_out, 0, &l_frm_out, isEVS ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* extend */ @@ -816,7 +816,7 @@ UWord8 apa_exec_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK extend_frm_fx( ps, frm_in, a_out, &l_frm_out ); #else - extend_frm_fx( ps, frm_in, a_out, 0, &l_frm_out, leg_flag ); + extend_frm_fx( ps, frm_in, a_out, 0, &l_frm_out, isEVS ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* control the amount/frequency of scaling */ @@ -937,7 +937,7 @@ UWord8 apa_exec_ivas_fx( Word16 Q_a_out; Word16 Q_a_out_init_old; #ifdef HARMONIZE_2481_EXTEND_SHRINK - Word16 leg_flag = 0; + Word16 isEVS = 0; #endif // HARMONIZE_2481_EXTEND_SHRINK Q_a_out = add( getScaleFactor32_copy( a_in, l_in ), Q11 - Q16 - Q1 ); @@ -1053,7 +1053,7 @@ UWord8 apa_exec_ivas_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK shrink_frm_ivas_fx( ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out ); #else - shrink_frm_fx( ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out, leg_flag ); + shrink_frm_fx( ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out, isEVS ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* extend */ @@ -1062,7 +1062,7 @@ UWord8 apa_exec_ivas_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK extend_frm_ivas_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out ); #else - extend_frm_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out, leg_flag ); + extend_frm_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out, isEVS ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* control the amount/frequency of scaling */ @@ -1811,7 +1811,7 @@ static bool shrink_frm_fx( Word16 frm_out_fx[], // Qx Word16 Q_frm_in, UWord16 *l_frm_out, - Word16 leg_flag ) + Word16 isEVS ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { bool findSynchResult = 0; @@ -1823,6 +1823,9 @@ static bool shrink_frm_fx( Word32 quality_fx = 0; UWord16 l_frm; UWord16 l_seg; +#ifdef HARMONIZE_2481_EXTEND_SHRINK + Word16 Silence; +#endif // HARMONIZE_2481_EXTEND_SHRINK move16(); move32(); @@ -1850,7 +1853,14 @@ static bool shrink_frm_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) ) #else - IF( ( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) && ( !leg_flag ) ) || ( isSilence_fx( frm_in_fx, l_seg, 10 ) && leg_flag ) ) + + IF(isEVS) { + Silence = isSilence_fx(frm_in_fx, l_seg, 10); + } + ELSE{ + Silence = isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10); + } + IF( Silence ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { /* maximum scaling */ @@ -1899,7 +1909,7 @@ static bool shrink_frm_fx( ps->signalScaleForCorrelation = add( ps->signalScaleForCorrelation, Q_frm_in ); move16(); #else - IF( leg_flag ) + IF( isEVS ) { findSynchResult = find_synch_fx( ps, ps->frmInScaled, l_frm, s_start, (UWord16) ( sub( s_end, s_start ) ), 0, l_seg, 0, &energy_fx, &quality_fx, &xtract ); } @@ -2294,7 +2304,7 @@ static bool extend_frm_fx( Word16 frm_out_fx[], // Qx Word16 Q_frm_in, UWord16 *l_frm_out, - Word16 leg_flag ) + Word16 isEVS ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { bool findSynchResult = 0; @@ -2312,6 +2322,10 @@ static bool extend_frm_fx( Word32 quality_fx = 0; move32(); UWord16 l_frm, l_seg; +#ifdef HARMONIZE_2481_EXTEND_SHRINK + Word16 Silence; +#endif // HARMONIZE_2481_EXTEND_SHRINK + const Word16 *fadeOut_fx, *fadeIn_fx; Word16 *out_fx; @@ -2416,11 +2430,17 @@ static bool extend_frm_fx( IF( over[n] ) { - /* calculate overlap position */ + /* calculate overlap position */ #ifndef HARMONIZE_2481_EXTEND_SHRINK - IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) ) + IF(isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10)) #else - IF( ( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) && ( !leg_flag ) ) || ( isSilence_fx( frm_in_fx, l_seg, 10 ) && leg_flag ) ) + IF(isEVS) { + Silence = isSilence_fx(frm_in_fx, l_seg, 10); + } + ELSE{ + Silence = isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10); + } + IF(Silence) #endif // !HARMONIZE_2481_EXTEND_SHRINK { /* maximum scaling */ @@ -2454,7 +2474,7 @@ static bool extend_frm_fx( findSynchResult = find_synch_fx( ps, frmInScaled, extract_l( L_shl( l_frm, 1 ) ), s_start, sub( s_end, s_start ), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n] ); ps->signalScaleForCorrelation = add( ps->signalScaleForCorrelation, Q_frm_in ); #else - IF( leg_flag ) + IF( isEVS ) { findSynchResult = find_synch_fx( ps, frmInScaled, extract_l( L_shl( l_frm, 1 ) ), s_start, sub( s_end, s_start ), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n] ); } -- GitLab From 2c9793b4eb29bb88bb135f37129ff602f7a93a40 Mon Sep 17 00:00:00 2001 From: "Azizi, Arash" Date: Thu, 19 Mar 2026 10:35:06 +0100 Subject: [PATCH 19/20] issue: 2481 Clang formatting patch --- lib_dec/jbm_pcmdsp_apa_fx.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 31e989061..8cac82232 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -1854,11 +1854,13 @@ static bool shrink_frm_fx( IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) ) #else - IF(isEVS) { - Silence = isSilence_fx(frm_in_fx, l_seg, 10); + IF( isEVS ) + { + Silence = isSilence_fx( frm_in_fx, l_seg, 10 ); } - ELSE{ - Silence = isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10); + ELSE + { + Silence = isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ); } IF( Silence ) #endif // !HARMONIZE_2481_EXTEND_SHRINK @@ -2430,17 +2432,19 @@ static bool extend_frm_fx( IF( over[n] ) { - /* calculate overlap position */ + /* calculate overlap position */ #ifndef HARMONIZE_2481_EXTEND_SHRINK - IF(isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10)) + IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) ) #else - IF(isEVS) { - Silence = isSilence_fx(frm_in_fx, l_seg, 10); + IF( isEVS ) + { + Silence = isSilence_fx( frm_in_fx, l_seg, 10 ); } - ELSE{ - Silence = isSilence_ivas_fx(frm_in_fx, Q_frm_in, l_seg, 10); + ELSE + { + Silence = isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ); } - IF(Silence) + IF( Silence ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { /* maximum scaling */ -- GitLab From d9eafd023cee08732510bc4c79ac5209ecd30372 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 23 Mar 2026 13:56:26 +0100 Subject: [PATCH 20/20] consistency on types --- lib_com/options.h | 2 +- lib_dec/jbm_pcmdsp_apa_fx.c | 46 +++++++++----------- lib_dec/jbm_pcmdsp_similarityestimation.h | 6 ++- lib_dec/jbm_pcmdsp_similarityestimation_fx.c | 33 ++++++++++++++ 4 files changed, 59 insertions(+), 28 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c807713ed..e5c6ed6a0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -54,7 +54,7 @@ /*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ /*#define WMOPS_DETAIL*/ /* Output detailed complexity printout for every function. Increases runtime overhead */ /*#define WMOPS_WC_FRAME_ANALYSIS*/ /* Output detailed complexity analysis for the worst-case frame */ -/*define MEM_COUNT_DETAILS*/ /* Output detailed memory analysis for the worst-case frame (writes to the file "mem_analysis.csv") */ +/*#define MEM_COUNT_DETAILS*/ /* Output detailed memory analysis for the worst-case frame (writes to the file "mem_analysis.csv") */ #ifdef DEBUGGING /*#define DBG_BITSTREAM_ANALYSIS*/ /* Write bitstream with annotations to a text file */ diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index 8cac82232..75a1fba48 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -161,9 +161,9 @@ static bool extend_frm_ivas_fx( apa_state_t *ps, const Word16 frm_in[], Word16 f #else -static bool shrink_frm_fx( apa_state_t *ps, const Word16 frm_in[], UWord16 maxScaling, Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out, Word16 isEVS ); +static bool shrink_frm_fx( apa_state_t *ps, const Word16 frm_in[], UWord16 maxScaling, Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out, bool bIsEVS ); -static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out, Word16 isEVS ); +static bool extend_frm_fx( apa_state_t *ps, const Word16 frm_in[], Word16 frm_out[], Word16 Q_frm_in, UWord16 *l_frm_out, bool bIsEVS ); #endif // !HARMONIZE_2481_EXTEND_SHRINK @@ -706,9 +706,6 @@ UWord8 apa_exec_fx( Word32 dl_scaled, dl_copied, l_frm_out_target; Word32 expScaling, actScaling; UWord32 statsResetThreshold, statsResetShift; -#ifdef HARMONIZE_2481_EXTEND_SHRINK - Word16 isEVS = 1; -#endif // HARMONIZE_2481_EXTEND_SHRINK statsResetThreshold = 1637; move32(); @@ -807,7 +804,7 @@ UWord8 apa_exec_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK shrink_frm_fx( ps, frm_in, maxScaling, a_out, &l_frm_out ); #else - shrink_frm_fx( ps, frm_in, maxScaling, a_out, 0, &l_frm_out, isEVS ); + shrink_frm_fx( ps, frm_in, maxScaling, a_out, 0, &l_frm_out, true ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* extend */ @@ -816,7 +813,7 @@ UWord8 apa_exec_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK extend_frm_fx( ps, frm_in, a_out, &l_frm_out ); #else - extend_frm_fx( ps, frm_in, a_out, 0, &l_frm_out, isEVS ); + extend_frm_fx( ps, frm_in, a_out, 0, &l_frm_out, true ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* control the amount/frequency of scaling */ @@ -936,9 +933,6 @@ UWord8 apa_exec_ivas_fx( UWord32 statsResetThreshold, statsResetShift; Word16 Q_a_out; Word16 Q_a_out_init_old; -#ifdef HARMONIZE_2481_EXTEND_SHRINK - Word16 isEVS = 0; -#endif // HARMONIZE_2481_EXTEND_SHRINK Q_a_out = add( getScaleFactor32_copy( a_in, l_in ), Q11 - Q16 - Q1 ); Q_a_out_init_old = Q_a_out; /* store the possible scaling of a_in, to be re-used in the next frame */ @@ -1053,7 +1047,7 @@ UWord8 apa_exec_ivas_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK shrink_frm_ivas_fx( ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out ); #else - shrink_frm_fx( ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out, isEVS ); + shrink_frm_fx( ps, frm_in, maxScaling, a_tmp, Q_a_out, &l_frm_out, false ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* extend */ @@ -1062,7 +1056,7 @@ UWord8 apa_exec_ivas_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK extend_frm_ivas_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out ); #else - extend_frm_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out, isEVS ); + extend_frm_fx( ps, frm_in, a_tmp, Q_a_out, &l_frm_out, false ); #endif // !HARMONIZE_2481_EXTEND_SHRINK } /* control the amount/frequency of scaling */ @@ -1811,7 +1805,7 @@ static bool shrink_frm_fx( Word16 frm_out_fx[], // Qx Word16 Q_frm_in, UWord16 *l_frm_out, - Word16 isEVS ) + bool bIsEVS ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { bool findSynchResult = 0; @@ -1824,7 +1818,7 @@ static bool shrink_frm_fx( UWord16 l_frm; UWord16 l_seg; #ifdef HARMONIZE_2481_EXTEND_SHRINK - Word16 Silence; + bool bIsSilence; #endif // HARMONIZE_2481_EXTEND_SHRINK move16(); move32(); @@ -1854,15 +1848,15 @@ static bool shrink_frm_fx( IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) ) #else - IF( isEVS ) + IF( bIsEVS ) { - Silence = isSilence_fx( frm_in_fx, l_seg, 10 ); + bIsSilence = isSilence_fx( frm_in_fx, l_seg, 10 ); } ELSE { - Silence = isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ); + bIsSilence = isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ); } - IF( Silence ) + IF( bIsSilence ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { /* maximum scaling */ @@ -1911,7 +1905,7 @@ static bool shrink_frm_fx( ps->signalScaleForCorrelation = add( ps->signalScaleForCorrelation, Q_frm_in ); move16(); #else - IF( isEVS ) + IF( bIsEVS ) { findSynchResult = find_synch_fx( ps, ps->frmInScaled, l_frm, s_start, (UWord16) ( sub( s_end, s_start ) ), 0, l_seg, 0, &energy_fx, &quality_fx, &xtract ); } @@ -2306,7 +2300,7 @@ static bool extend_frm_fx( Word16 frm_out_fx[], // Qx Word16 Q_frm_in, UWord16 *l_frm_out, - Word16 isEVS ) + bool bIsEVS ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { bool findSynchResult = 0; @@ -2325,7 +2319,7 @@ static bool extend_frm_fx( move32(); UWord16 l_frm, l_seg; #ifdef HARMONIZE_2481_EXTEND_SHRINK - Word16 Silence; + bool bIsSilence; #endif // HARMONIZE_2481_EXTEND_SHRINK const Word16 *fadeOut_fx, *fadeIn_fx; @@ -2436,15 +2430,15 @@ static bool extend_frm_fx( #ifndef HARMONIZE_2481_EXTEND_SHRINK IF( isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ) ) #else - IF( isEVS ) + IF( bIsEVS ) { - Silence = isSilence_fx( frm_in_fx, l_seg, 10 ); + bIsSilence = isSilence_fx( frm_in_fx, l_seg, 10 ); } ELSE { - Silence = isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ); + bIsSilence = isSilence_ivas_fx( frm_in_fx, Q_frm_in, l_seg, 10 ); } - IF( Silence ) + IF( bIsSilence ) #endif // !HARMONIZE_2481_EXTEND_SHRINK { /* maximum scaling */ @@ -2478,7 +2472,7 @@ static bool extend_frm_fx( findSynchResult = find_synch_fx( ps, frmInScaled, extract_l( L_shl( l_frm, 1 ) ), s_start, sub( s_end, s_start ), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n] ); ps->signalScaleForCorrelation = add( ps->signalScaleForCorrelation, Q_frm_in ); #else - IF( isEVS ) + IF( bIsEVS ) { findSynchResult = find_synch_fx( ps, frmInScaled, extract_l( L_shl( l_frm, 1 ) ), s_start, sub( s_end, s_start ), sync_start, l_seg, l_frm, &energy_fx, &quality_fx, &xtract[n] ); } diff --git a/lib_dec/jbm_pcmdsp_similarityestimation.h b/lib_dec/jbm_pcmdsp_similarityestimation.h index 5ab60f3be..af12f22ba 100644 --- a/lib_dec/jbm_pcmdsp_similarityestimation.h +++ b/lib_dec/jbm_pcmdsp_similarityestimation.h @@ -64,8 +64,12 @@ Word32 cross_correlation_self_fx( const Word16 *signal, Word16 y, Word16 corr_len ); - +#ifdef HARMONIZE_2481_EXTEND_SHRINK +bool isSilence_fx( const Word16 *signal, Word16 len, Word16 segments ); +bool isSilence_ivas_fx( const Word16 *signal, Word16 q_sig, Word16 len, Word16 segments ); +#else Word8 isSilence_fx( const Word16 *signal, Word16 len, Word16 segments ); Word8 isSilence_ivas_fx( const Word16 *signal, Word16 q_sig, Word16 len, Word16 segments ); +#endif #endif /* JBM_PCMDSP_SIMILARITYESTIMATION_H */ diff --git a/lib_dec/jbm_pcmdsp_similarityestimation_fx.c b/lib_dec/jbm_pcmdsp_similarityestimation_fx.c index 16fd9193f..e1ddd5993 100644 --- a/lib_dec/jbm_pcmdsp_similarityestimation_fx.c +++ b/lib_dec/jbm_pcmdsp_similarityestimation_fx.c @@ -190,11 +190,19 @@ Word32 cross_correlation_self_fx( const Word16 *signal, return sum; } +#ifdef HARMONIZE_2481_EXTEND_SHRINK +bool isSilence_fx( const Word16 *signal, Word16 len, Word16 segments ) +#else Word8 isSilence_fx( const Word16 *signal, Word16 len, Word16 segments ) +#endif { Word16 i, j, samplesPerSegment; Word32 energy, maxEnergy; +#ifdef HARMONIZE_2481_EXTEND_SHRINK + bool ret; +#else Word8 ret; +#endif assert( len > 0 ); assert( segments > 0 ); @@ -205,7 +213,11 @@ Word8 isSilence_fx( const Word16 *signal, Word16 len, Word16 segments ) * 20 * log10(sum_i(abs(signal[i]))) > -65 */ +#ifdef HARMONIZE_2481_EXTEND_SHRINK + ret = true; +#else ret = 1; +#endif move16(); energy = 0; move32(); @@ -227,7 +239,11 @@ Word8 isSilence_fx( const Word16 *signal, Word16 len, Word16 segments ) * => energy > samplesPerSegment * 10 ^ (-65 / 20) * 32768 */ IF( GT_32( energy, maxEnergy ) ) { +#ifdef HARMONIZE_2481_EXTEND_SHRINK + ret = false; +#else ret = 0; +#endif move16(); BREAK; } @@ -239,13 +255,22 @@ Word8 isSilence_fx( const Word16 *signal, Word16 len, Word16 segments ) /* check last segment */ if ( GT_32( energy, maxEnergy ) ) { +#ifdef HARMONIZE_2481_EXTEND_SHRINK + ret = false; +#else ret = 0; +#endif move16(); } + return ret; } +#ifdef HARMONIZE_2481_EXTEND_SHRINK +bool isSilence_ivas_fx( const Word16 *signal, Word16 q_sig, Word16 len, Word16 segments ) +#else Word8 isSilence_ivas_fx( const Word16 *signal, Word16 q_sig, Word16 len, Word16 segments ) +#endif { Word16 i, j, samplesPerSegment; Word64 energy, maxEnergy; @@ -276,7 +301,11 @@ Word8 isSilence_ivas_fx( const Word16 *signal, Word16 q_sig, Word16 len, Word16 * => energy > samplesPerSegment * 10 ^ (-65 / 10) * 32768 * 32768.0*/ IF( GT_64( energy, maxEnergy ) ) { +#ifdef HARMONIZE_2481_EXTEND_SHRINK + return false; +#else return 0; +#endif } IF( EQ_16( i, j ) ) { @@ -286,5 +315,9 @@ Word8 isSilence_ivas_fx( const Word16 *signal, Word16 q_sig, Word16 len, Word16 } } +#ifdef HARMONIZE_2481_EXTEND_SHRINK + return true; +#else return 1; +#endif } -- GitLab