From 84dde289c9f99798a2fab5059ff99ae31e2a4e3d Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 26 Feb 2026 21:31:44 +0100 Subject: [PATCH] Harmonize apply_scale_ind(), apply_scale_ivas_fx() --- lib_com/cng_exc_fx.c | 4 ++++ lib_com/fd_cng_com_fx.c | 3 +++ lib_com/options.h | 1 + lib_com/prot_fx.h | 2 ++ lib_enc/cng_enc_fx.c | 5 +++++ 5 files changed, 15 insertions(+) diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c index 42802ee15..084f28796 100644 --- a/lib_com/cng_exc_fx.c +++ b/lib_com/cng_exc_fx.c @@ -872,7 +872,11 @@ void cng_params_upd_fx( Word16 index = 0; move32(); move16(); +#ifdef HARM_2456_APPLY_SCALE + index = apply_scale_ind( &att_fx, bwidth, last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO ); +#else apply_scale_ivas_fx( &att_fx, bwidth, last_active_brate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO, &index ); +#endif att_fx = pow_10_q23[index]; // Q23 move32(); tmp = extract_h( att_fx ); // Q7 diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index f7b58ae62..0a1fe1d32 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -1751,9 +1751,11 @@ Word16 apply_scale_ind( *scale = L_add( *scale, L_deposit_h( scaleTable[i].scale ) ); move32(); } + return i; } +#ifndef HARM_2456_APPLY_SCALE void apply_scale_ivas_fx( Word32 *scale, /* o : scalefactor */ const Word16 bwmode, /* i : audio bandwidth */ @@ -1780,6 +1782,7 @@ void apply_scale_ivas_fx( *index = i; move16(); } +#endif /*------------------------------------------------------------------- * bandcombinepow() * diff --git a/lib_com/options.h b/lib_com/options.h index b921da142..ac20e3390 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -98,6 +98,7 @@ #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 FIX_MDCT_STEREO_ENC_STACK /* VA: basop issue 2428: Move IGF temporary buffers out of the highest stack */ +#define HARM_2456_APPLY_SCALE /* FHG basop issue 2456: Harmonize apply_scale_ind(), apply_scale_ivas_fx() */ /* #################### End BE switches ################################## */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index c75e08312..f06a1536e 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -4875,6 +4875,7 @@ Word16 apply_scale_ind( const SCALE_SETUP *scaleTable, /* i : Scale table */ const Word16 scaleTableSize /* i : Size of scale table */ ); +#ifndef HARM_2456_APPLY_SCALE void apply_scale_ivas_fx( Word32 *scale, /* o : scalefactor */ const Word16 bwmode, /* i : audio bandwidth */ @@ -4882,6 +4883,7 @@ void apply_scale_ivas_fx( const SCALE_SETUP *scaleTable, /* i : Scale table */ const Word16 scaleTableSize, /* i : Size of scale table */ Word16 *index ); +#endif /* Compute the power for each partition */ void bandcombinepow( diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index e76a227ae..0d6de1ed5 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -1679,9 +1679,14 @@ static Word16 shb_DTX_fx( { Word32 att_fx32 = 0; move32(); +#ifdef HARM_2456_APPLY_SCALE + + apply_scale( &att_fx32, st->hFdCngEnc->hFdCngCom->CngBandwidth, st->hFdCngEnc->hFdCngCom->CngBitrate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO ); // Q23; +#else Word16 index; apply_scale_ivas_fx( &att_fx32, st->hFdCngEnc->hFdCngCom->CngBandwidth, st->hFdCngEnc->hFdCngCom->CngBitrate, scaleTableStereo, SIZE_SCALE_TABLE_STEREO, &index ); // Q23; +#endif att_fx = extract_l( L_shr( att_fx32, 15 ) ); // Q8 } -- GitLab