diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c index 42802ee152657a498613e2801bd14d9b6f1226af..084f28796f11101d73d7789a7972e75e36b03651 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 f7b58ae6256c1f34a0a6fde9f0e94886369dd540..0a1fe1d3287ee24cb325e1eae7a65acee2c82841 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 b207c8345cf4fbbb1512c38dd208dd0ad1b8e58f..8b6b40f990c1cfc91d230b1e5b02713c95edf160 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -101,6 +101,7 @@ #define HARMONIZE_TBE3 /* VA: basop issue 2399: Remove duplicated code: TBE, step 3 */ #define FIX_2459_USAN_AMR_SIDSTART /* FhG: basop issue 2459: fix msan complaint */ #define FIX_2458_USAN_NULLPTR_WITH_ZERO_OFFSET /* FhG: basop issue 2458: avoid indexing into null pointer */ +#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 068770b1c6720fbe43942109b1e61da8a00486cf..8f41d4871348d5726f07ca490e060c95110d50a1 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -4884,6 +4884,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 */ @@ -4891,6 +4892,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 e76a227ae6774b7fb23e6a8e5044eebd28c9ae63..0d6de1ed5a36991bb3ac3b9f2793a5a773703656 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 }