Word16Ener_per_bd_iQ[],/* i : Target ener per band Q13 */
Word16Ener_per_bd_yQ[],/* i/o: Ener per band for norm vector i->Q13/o->Q13 */
Word16Mbands_gn,/* i : number of bands */
constWord16ReUseGain,/* i : Reuse the gain in Ener_per_bd_yQ */
#ifdef FIX_2380_HARM_GSC_GAIN_COMP_FX
constWord16max_lt_ener,/* i : max_lt_ener of lt_ener_per_band_fx */
#endif
Word16Qexc_diff,
Word16Q_exc)
{
@@ -83,6 +90,9 @@ void Comp_and_apply_gain_fx(
Word16StartBin,NB_Qbins;
Word16y_gain;
Word16L16,frac,exp1,tmp_exp;
#ifdef FIX_2380_HARM_GSC_GAIN_COMP_FX
Word16Q_adapt;
#endif
Word32L32;
/* Recreate excitation for local synthesis and decoder */
@@ -92,6 +102,16 @@ void Comp_and_apply_gain_fx(
move16();
tmp_exp=add(14,sub(Q_exc,Qexc_diff));/* In case of reuse, it can be computed outside the loop*/
#ifdef FIX_2380_HARM_GSC_GAIN_COMP_FX
Q_adapt=0;
move16();
test();
test();
IF(GT_16(Q_exc,3)&&EQ_16(ReUseGain,0)&>_16(max_lt_ener,8192/* 13 bits */))/* When lt_energy is high, Q_exc shouldn't be high too, addresses cases when switching from CNG */
{
Q_adapt=sub(3-1,Q_exc);/* add extra 1 bit headroom */
#define FIX_2250_LARGE_DIFFERENCES_BETWEEN_BASOP_AND_FLOAT /* Dolby: Issue 2250: random vector generation in GenShapedSHBExcitation() */
#define FIX_2338_HARM_GSC_GAIN_COMP /* VA: basop issue 2338: harmonization of band gain computation for both EVS and IVAS */
#define FIX_2380_HARM_GSC_GAIN_COMP_FX /* VA: basop issue 2380 & 2381: Fix issue when switching from CNG low energy to active content with high energy */
#define FIX_BASOP_2317_UNINIT_VALUE_IN_STEREO_CNG /* Eri: Basop issue 2317: Uninitialized value read in case of DTX and BW switching */
/* ##################### End NON-BE switches ########################### */