diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 235e704cc971a0a6aa72463c7cc5cb994055abd7..739771b06cf02c42be4b348fdc8972b261472002 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -3146,8 +3146,8 @@ void GenShapedSHBExcitation_ivas_fx( /* calculate pow22 */ /* pow22=0.00001f */ - tmp = sub( shl( sub( Q_excTmp2, NOISE_QADJ ), 1 ), 31 ); - pow22 = L_shl( 21475l /*0.00001f Q31*/, tmp ); /* 0.00001f in 2*(Q_excTmp2-NOISE_QADJ) */ + tmp = sub( shl( sub( *Q_bwe_exc, NOISE_QADJ ), 1 ), 31 ); + pow22 = L_shl( 21475l /*0.00001f Q31*/, tmp ); /* 0.00001f in 2*(*Q_bwe_exc-NOISE_QADJ) */ tmp = sub( NOISE_QFAC, 5 ); FOR( k = 0; k < L_FRAME16k; k++ ) { diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index 189f914fb91dc943a05bf0a308afd046567ef929..a98bd9b3083690a36c013f1f53d1b2b2595a08c2 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -2193,7 +2193,7 @@ static void ivas_subst_spec_fx( Word32 *pCorrPhase; Word16 cos_F, sin_F, tmp; Word16 Lprot, m, i, e, im_ind, delta_corr_up, delta_corr_dn, delta_tmp; - UWord16 lsb; + Word32 tmp1; Word16 j, re, im, *pReX, *pImX, lastPeak, lprotBy2Minus1, segmentLen; Word16 pkLocation_1, pkLocation, pkLocation1; const Word16 *pPlocs; @@ -2251,16 +2251,14 @@ static void ivas_subst_spec_fx( tmp = sub( tmp, ph_ecu_lookahead ); tmp = add( tmp, sub( Lecu, shr( sub( Lecu, Lprot ), 1 ) ) ); tmp = sub( tmp, shr( output_frame, 1 ) ); - tmp = add( tmp, time_offs ); - tmp = round_fx( L_shl( L_mult0( tmp, Lprot_inv ), 4 ) ); /* 0+22+4-16=10 */ + tmp1 = L_add( L_mult0( tmp, Lprot_inv ), L_mult0( time_offs, Lprot_inv ) ); /* Q22 */ pPlocsi = plocsi; pCorrPhase = corr_phase; FOR( m = 0; m < *num_plocs; m++ ) { - Mpy_32_16_ss( *pPlocsi++, tmp, &acc, &lsb ); /* plocsi[] in Q16, tmp in Q10 and tmp does not include 2*PI. */ - acc = L_add( L_shl( acc, 5 ), lshr( (Word16) lsb, 11 ) ); - *pCorrPhase++ = acc; /* in Q16. 2*PI is not included. */ + acc = L_shl( Mpy_32_32( *pPlocsi++, tmp1 ), 9 ); /* 16+22+9-31 = 16*/ + *pCorrPhase++ = acc; /* in Q16. 2*PI is not included. */ move32(); } } @@ -4958,7 +4956,7 @@ static void ivas_hq_phase_ecu_fx( } ELSE { - *time_offs = add( *time_offs, output_frame ); + *time_offs = add_sat( *time_offs, output_frame ); move16(); offset = sub( shl( output_frame, 1 ), lprot ); trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab, @@ -4972,7 +4970,7 @@ static void ivas_hq_phase_ecu_fx( move16(); IF( *num_p > 0 ) { - seed = add( seed, plocs[sub( *num_p, 1 )] ); + seed = extract_l( L_add( L_deposit_l( seed ), L_deposit_l( plocs[sub( *num_p, 1 )] ) ) ); } ivas_subst_spec_fx( plocs, plocsi, num_p, *time_offs, X, mag_chg, ph_dith, old_is_transient, output_frame, &seed,