Loading lib_com/gs_noisefill_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -1321,9 +1321,9 @@ void highband_exc_dct_in_ivas_fx( { FOR( i = 0; i < last_bin; i++ ) { Ener_per_bd_iQ[i] = s_min( Ener_per_bd_iQ[i], sub_sat( sub_sat( lt_ener_per_band_fx[i], 154 ), Ener_per_bd_yQ[i] ) ); Ener_per_bd_iQ[i] = s_min( Ener_per_bd_iQ[i], sub( sub( lt_ener_per_band_fx[i], 154 ), Ener_per_bd_yQ[i] ) ); move16(); lt_ener_per_band_fx[i] = sub_sat( lt_ener_per_band_fx[i], 77 ); lt_ener_per_band_fx[i] = sub( lt_ener_per_band_fx[i], 77 ); move16(); } FOR( ; i < MBANDS_GN; i++ ) Loading lib_enc/swb_bwe_enc_fx.c +66 −24 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ static Word16 SWB_BWE_encoding_ivas_fx( const Word16 *insig_lp_fx, /* i : delayed original lowband input signal at 32kHz */ const Word16 *insig_hp_fx, /* i : delayed original highband input signal at 32kHz */ const Word16 *synth_fx, /* i : delayed ACELP core synthesis at 12.8kHz */ const Word16 *yos_fx, /* i : MDCT coefficients of the windowed original input signal at 32kHz */ const Word32 *yos_fx, /* i : MDCT coefficients of the windowed original input signal at 32kHz */ Word16 *SWB_fenv_fx, /* o : frequency-domain quantized BWE envelope */ const Word16 tilt_nb_fx, /* i : SWB tilt */ const Word16 st_offset, /* i : start frequency offset for BWE envelope */ Loading Loading @@ -324,6 +324,7 @@ void swb_bwe_enc_ivas_fx( move32(); #endif Word16 fb_band_begin; Word16 sf; FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD; Loading Loading @@ -437,8 +438,9 @@ void swb_bwe_enc_ivas_fx( inner_frame ); /* Scaling has been added to avoid the yorig_32 buffer becoming zero inside direct_transform_fx */ Scale_sig32( L_old_input_fx, inner_frame, Q5 ); new_input_fx_exp = add( new_input_fx_exp, 5 ); sf = L_norm_arr( L_old_input_fx, inner_frame ); scale_sig32( L_old_input_fx, inner_frame, sf ); new_input_fx_exp = add( new_input_fx_exp, sf ); // It is Q, not exp /* DCT of the ACELP core synthesis */ direct_transform_fx( L_old_input_fx, yorig_32, 0, inner_frame, &new_input_fx_exp, st_fx->element_mode ); Loading Loading @@ -572,13 +574,13 @@ void swb_bwe_enc_ivas_fx( /* SWB BWE encoding */ IF( EQ_16( st_fx->L_frame, L_FRAME16k ) ) { SWB_BWE_encoding_ivas_fx( st_fx, old_input_fx, old_input_lp_fx, new_input_hp_fx, old_syn_12k8_16k_fx, yorig_fx, SWB_fenv_fx, tilt_nb_fx, 80, Q_slb_speech, Q_shb, Q_synth_hf, Q_synth ); SWB_BWE_encoding_ivas_fx( st_fx, old_input_fx, old_input_lp_fx, new_input_hp_fx, old_syn_12k8_16k_fx, yorig_32, SWB_fenv_fx, tilt_nb_fx, 80, Q_slb_speech, Q_shb, new_input_fx_exp, Q_synth ); } ELSE { SWB_BWE_encoding_ivas_fx( st_fx, old_input_fx, old_input_lp_fx, new_input_hp_fx, old_syn_12k8_16k_fx, yorig_fx, SWB_fenv_fx, tilt_nb_fx, 6, Q_slb_speech, Q_shb, Q_synth_hf, Q_synth ); SWB_BWE_encoding_ivas_fx( st_fx, old_input_fx, old_input_lp_fx, new_input_hp_fx, old_syn_12k8_16k_fx, yorig_32, SWB_fenv_fx, tilt_nb_fx, 6, Q_slb_speech, Q_shb, new_input_fx_exp, Q_synth ); } Loading Loading @@ -2054,7 +2056,7 @@ static void calculate_Tonality_fx( { max = gen_spec[n_coeff];move16(); }*/ max = s_max( max, org_spec[n_coeff] ); max = s_max( max, gen_spec[n_coeff] ); } l_shift = norm_s( max ); FOR( n_coeff = 0; n_coeff < length; n_coeff++ ) Loading Loading @@ -2974,7 +2976,7 @@ static Word16 SWB_BWE_encoding_ivas_fx( const Word16 *insig_lp_fx, /* i : delayed original lowband input signal at 32kHz */ const Word16 *insig_hp_fx, /* i : delayed original highband input signal at 32kHz */ const Word16 *synth_fx, /* i : delayed ACELP core synthesis at 12.8kHz */ const Word16 *yos_fx, /* i : MDCT coefficients of the windowed original input signal at 32kHz */ const Word32 *yos_fx, /* i : MDCT coefficients of the windowed original input signal at 32kHz */ Word16 *SWB_fenv_fx, /* o : frequency-domain quantized BWE envelope */ const Word16 tilt_nb_fx, /* i : SWB tilt */ const Word16 st_offset, /* i : start frequency offset for BWE envelope */ Loading @@ -2991,10 +2993,13 @@ static Word16 SWB_BWE_encoding_ivas_fx( Word16 tmp; Word32 energy_fx; Word64 energy_fx_64; Word16 tilt_fx; Word32 global_gain_fx; Word32 L_tmp; Word64 W_tmp; Word32 L_SWB_fenv_fx[SWB_FENV]; Word16 q_SWB_fenv[SWB_FENV]; Word16 SWB_tenv_fx[SWB_TENV]; Word32 L_SWB_tenv, WB_tenv_syn_fx, WB_tenv_orig_fx; Word16 exp, expn, expd; Loading @@ -3008,6 +3013,10 @@ static Word16 SWB_BWE_encoding_ivas_fx( Flag Overflow = 0; move32(); #endif Word16 inner_frame; Word16 q_shift; Word16 yos_fx_16[L_FRAME_MAX]; Word16 sf; FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; Loading @@ -3023,6 +3032,17 @@ static Word16 SWB_BWE_encoding_ivas_fx( move16(); } IF( EQ_16( st_fx->extl, FB_BWE ) ) { inner_frame = L_FRAME48k; move16(); } ELSE { inner_frame = L_FRAME32k; move16(); } /* HF transient detect */ IsTransient = detect_transient_fx( insig_hp_fx, L_FRAME16k, Q_shb, st_fx ); st_fx->EnergyLT_fx_exp = shl( Q_shb, 1 ); Loading Loading @@ -3076,15 +3096,29 @@ static Word16 SWB_BWE_encoding_ivas_fx( global_gain_fx = L_deposit_l( 0 ); FOR( n_band = 0; n_band < SWB_FENV_TRANS; n_band++ ) { energy_fx = L_deposit_l( 0 ); energy_fx_64 = W_deposit32_l( 0 ); FOR( n_coeff = swb_bwe_trans_subband[n_band] + st_offset; n_coeff < swb_bwe_trans_subband[n_band + 1] + st_offset; n_coeff++ ) { L_tmp = L_shr( L_mult0( yos_fx[n_coeff], yos_fx[n_coeff] ), 7 ); /*2*Q_synth-7 */ energy_fx = L_add( L_tmp, energy_fx ); /*2*Q_synth-7 */ W_tmp = W_mult0_32_32( yos_fx[n_coeff], yos_fx[n_coeff] ); /*2*Q_synth */ energy_fx_64 = W_add( W_tmp, energy_fx_64 ); /*2*Q_synth */ } global_gain_fx = L_add( global_gain_fx, L_shr( energy_fx, sub( sub( shl( Q_synth, 1 ), 7 ), shl( Q_shb, 1 ) ) ) ); /*2*Q_shb */ q_shift = W_norm( energy_fx_64 ); energy_fx = W_extract_h( W_shl( energy_fx_64, q_shift ) ); /*2*Q_synth + q_shift - 32*/ q_shift = sub( q_shift, 32 ); global_gain_fx = L_add( global_gain_fx, L_shr( energy_fx, sub( add( shl( Q_synth, 1 ), q_shift ), shl( Q_shb, 1 ) ) ) ); /*2*Q_shb */ L_SWB_fenv_fx[n_band] = energy_fx; move32(); IF( L_SWB_fenv_fx[n_band] == 0 ) { q_SWB_fenv[n_band] = Q31; move16(); } ELSE { q_SWB_fenv[n_band] = add( shl( Q_synth, 1 ), q_shift ); move16(); } } global_gain_fx = L_shr( global_gain_fx, 1 ); /*2*Q_shb */ Loading @@ -3092,10 +3126,10 @@ static Word16 SWB_BWE_encoding_ivas_fx( { expd = norm_s( swb_bwe_trans_subband_width[n_band] ); tmp = div_s( shl( 1, sub( 14, expd ) ), swb_bwe_trans_subband_width[n_band] ); /*Q(29-expd) */ L_tmp = Mult_32_16( L_SWB_fenv_fx[n_band], tmp ); /*2*Q_synth-7+29-expd - 15 */ L_tmp = Mult_32_16( L_SWB_fenv_fx[n_band], tmp ); /*q_SWB_fenv[n_band]+29-expd - 15 */ exp = norm_l( L_tmp ); tmp = Log2_norm_lc( L_shl( L_tmp, exp ) ); exp = sub( sub( 30, exp ), sub( add( shl( Q_synth, 1 ), 7 ), expd ) ); exp = sub( sub( 30, exp ), sub( add( q_SWB_fenv[n_band], Q14 ), expd ) ); L_tmp = Mpy_32_16( exp, tmp, 24660 ); /* Q14 */ /*10log10(2) in Q13 */ tmp = round_fx( L_shl( L_tmp, 10 ) ); /* Q8 */ Loading Loading @@ -3371,37 +3405,45 @@ static Word16 SWB_BWE_encoding_ivas_fx( global_gain_fx = L_deposit_l( 0 ); FOR( n_band = 0; n_band < SWB_FENV; n_band++ ) { energy_fx = L_deposit_l( 0 ); energy_fx_64 = W_deposit32_l( 0 ); FOR( n_coeff = swb_bwe_subband[n_band] + st_offset; n_coeff < swb_bwe_subband[n_band + 1] + st_offset; n_coeff++ ) { L_tmp = L_shr( L_mult0( yos_fx[n_coeff], yos_fx[n_coeff] ), 5 ); /*2*Q_synth-5 */ energy_fx = L_add( L_tmp, energy_fx ); /*2*Q_synth-5 */ W_tmp = W_mult0_32_32( yos_fx[n_coeff], yos_fx[n_coeff] ); /*2*Q_synth */ energy_fx_64 = W_add( W_tmp, energy_fx_64 ); /*2*Q_synth */ } q_shift = W_norm( energy_fx_64 ); energy_fx = W_extract_h( W_shl( energy_fx_64, q_shift ) ); /*2*Q_synth + q_shift - 32*/ q_shift = sub( q_shift, 32 ); IF( LT_16( n_band, SWB_FENV - 2 ) ) { global_gain_fx = L_add( global_gain_fx, L_shr( energy_fx, sub( sub( shl( Q_synth, 1 ), 5 ), shl( Q_shb, 1 ) ) ) ); /*2*Q_shb */ global_gain_fx = L_add( global_gain_fx, L_shr( energy_fx, sub( add( shl( Q_synth, 1 ), q_shift ), shl( Q_shb, 1 ) ) ) ); /*2*Q_shb */ } L_SWB_fenv_fx[n_band] = energy_fx; move32(); q_SWB_fenv[n_band] = add( shl( Q_synth, 1 ), q_shift ); move16(); } global_gain_fx = L_shr( global_gain_fx, 1 ); /*2*Q_shb */ mode = FD_BWE_class_fx( yos_fx, global_gain_fx, tilt_nb_fx, Q_synth, Q_shb, st_fx ); sf = getScaleFactor32( yos_fx, inner_frame ); Copy_Scale_sig32_16( yos_fx, yos_fx_16, inner_frame, sf ); mode = FD_BWE_class_fx( yos_fx_16, global_gain_fx, tilt_nb_fx, sub( add( Q_synth, sf ), Q16 ), Q_shb, st_fx ); push_indice( hBstr, IND_SWB_CLASS, mode, 2 ); energy_control_ivas_fx( st_fx, ACELP_CORE, mode, -1, yos_fx, st_offset, energy_factor_fx, Q_synth_lf ); energy_control_ivas_fx( st_fx, ACELP_CORE, mode, -1, yos_fx_16, st_offset, energy_factor_fx, Q_synth_lf + sf - 16 ); FOR( n_band = 0; n_band < SWB_FENV; n_band++ ) { L_tmp = Mult_32_16( L_SWB_fenv_fx[n_band], energy_factor_fx[n_band] ); /*2*Q_synth-5 */ L_tmp = Mult_32_16( L_tmp, swb_inv_bwe_subband_width_fx[n_band] ); /*2*Q_synth-5 */ L_tmp = Mult_32_16( L_SWB_fenv_fx[n_band], energy_factor_fx[n_band] ); /*q_SWB_fenv[n_band] */ L_tmp = Mult_32_16( L_tmp, swb_inv_bwe_subband_width_fx[n_band] ); /*q_SWB_fenv[n_band] */ IF( L_tmp != 0 ) { expn = norm_l( L_tmp ); tmp = Log2_norm_lc( L_shl( L_tmp, expn ) ); expn = sub( 30, add( expn, sub( shl( Q_synth, 1 ), 5 ) ) ); expn = sub( 30, add( expn, q_SWB_fenv[n_band] ) ); L_tmp = Mpy_32_16( expn, tmp, 24660 ); /* Q14 */ /*10log10(2) in Q13 */ SWB_fenv_fx[n_band] = round_fx( L_shl( L_tmp, 10 ) ); /* Q8 */ move16(); Loading Loading
lib_com/gs_noisefill_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -1321,9 +1321,9 @@ void highband_exc_dct_in_ivas_fx( { FOR( i = 0; i < last_bin; i++ ) { Ener_per_bd_iQ[i] = s_min( Ener_per_bd_iQ[i], sub_sat( sub_sat( lt_ener_per_band_fx[i], 154 ), Ener_per_bd_yQ[i] ) ); Ener_per_bd_iQ[i] = s_min( Ener_per_bd_iQ[i], sub( sub( lt_ener_per_band_fx[i], 154 ), Ener_per_bd_yQ[i] ) ); move16(); lt_ener_per_band_fx[i] = sub_sat( lt_ener_per_band_fx[i], 77 ); lt_ener_per_band_fx[i] = sub( lt_ener_per_band_fx[i], 77 ); move16(); } FOR( ; i < MBANDS_GN; i++ ) Loading
lib_enc/swb_bwe_enc_fx.c +66 −24 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ static Word16 SWB_BWE_encoding_ivas_fx( const Word16 *insig_lp_fx, /* i : delayed original lowband input signal at 32kHz */ const Word16 *insig_hp_fx, /* i : delayed original highband input signal at 32kHz */ const Word16 *synth_fx, /* i : delayed ACELP core synthesis at 12.8kHz */ const Word16 *yos_fx, /* i : MDCT coefficients of the windowed original input signal at 32kHz */ const Word32 *yos_fx, /* i : MDCT coefficients of the windowed original input signal at 32kHz */ Word16 *SWB_fenv_fx, /* o : frequency-domain quantized BWE envelope */ const Word16 tilt_nb_fx, /* i : SWB tilt */ const Word16 st_offset, /* i : start frequency offset for BWE envelope */ Loading Loading @@ -324,6 +324,7 @@ void swb_bwe_enc_ivas_fx( move32(); #endif Word16 fb_band_begin; Word16 sf; FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD; Loading Loading @@ -437,8 +438,9 @@ void swb_bwe_enc_ivas_fx( inner_frame ); /* Scaling has been added to avoid the yorig_32 buffer becoming zero inside direct_transform_fx */ Scale_sig32( L_old_input_fx, inner_frame, Q5 ); new_input_fx_exp = add( new_input_fx_exp, 5 ); sf = L_norm_arr( L_old_input_fx, inner_frame ); scale_sig32( L_old_input_fx, inner_frame, sf ); new_input_fx_exp = add( new_input_fx_exp, sf ); // It is Q, not exp /* DCT of the ACELP core synthesis */ direct_transform_fx( L_old_input_fx, yorig_32, 0, inner_frame, &new_input_fx_exp, st_fx->element_mode ); Loading Loading @@ -572,13 +574,13 @@ void swb_bwe_enc_ivas_fx( /* SWB BWE encoding */ IF( EQ_16( st_fx->L_frame, L_FRAME16k ) ) { SWB_BWE_encoding_ivas_fx( st_fx, old_input_fx, old_input_lp_fx, new_input_hp_fx, old_syn_12k8_16k_fx, yorig_fx, SWB_fenv_fx, tilt_nb_fx, 80, Q_slb_speech, Q_shb, Q_synth_hf, Q_synth ); SWB_BWE_encoding_ivas_fx( st_fx, old_input_fx, old_input_lp_fx, new_input_hp_fx, old_syn_12k8_16k_fx, yorig_32, SWB_fenv_fx, tilt_nb_fx, 80, Q_slb_speech, Q_shb, new_input_fx_exp, Q_synth ); } ELSE { SWB_BWE_encoding_ivas_fx( st_fx, old_input_fx, old_input_lp_fx, new_input_hp_fx, old_syn_12k8_16k_fx, yorig_fx, SWB_fenv_fx, tilt_nb_fx, 6, Q_slb_speech, Q_shb, Q_synth_hf, Q_synth ); SWB_BWE_encoding_ivas_fx( st_fx, old_input_fx, old_input_lp_fx, new_input_hp_fx, old_syn_12k8_16k_fx, yorig_32, SWB_fenv_fx, tilt_nb_fx, 6, Q_slb_speech, Q_shb, new_input_fx_exp, Q_synth ); } Loading Loading @@ -2054,7 +2056,7 @@ static void calculate_Tonality_fx( { max = gen_spec[n_coeff];move16(); }*/ max = s_max( max, org_spec[n_coeff] ); max = s_max( max, gen_spec[n_coeff] ); } l_shift = norm_s( max ); FOR( n_coeff = 0; n_coeff < length; n_coeff++ ) Loading Loading @@ -2974,7 +2976,7 @@ static Word16 SWB_BWE_encoding_ivas_fx( const Word16 *insig_lp_fx, /* i : delayed original lowband input signal at 32kHz */ const Word16 *insig_hp_fx, /* i : delayed original highband input signal at 32kHz */ const Word16 *synth_fx, /* i : delayed ACELP core synthesis at 12.8kHz */ const Word16 *yos_fx, /* i : MDCT coefficients of the windowed original input signal at 32kHz */ const Word32 *yos_fx, /* i : MDCT coefficients of the windowed original input signal at 32kHz */ Word16 *SWB_fenv_fx, /* o : frequency-domain quantized BWE envelope */ const Word16 tilt_nb_fx, /* i : SWB tilt */ const Word16 st_offset, /* i : start frequency offset for BWE envelope */ Loading @@ -2991,10 +2993,13 @@ static Word16 SWB_BWE_encoding_ivas_fx( Word16 tmp; Word32 energy_fx; Word64 energy_fx_64; Word16 tilt_fx; Word32 global_gain_fx; Word32 L_tmp; Word64 W_tmp; Word32 L_SWB_fenv_fx[SWB_FENV]; Word16 q_SWB_fenv[SWB_FENV]; Word16 SWB_tenv_fx[SWB_TENV]; Word32 L_SWB_tenv, WB_tenv_syn_fx, WB_tenv_orig_fx; Word16 exp, expn, expd; Loading @@ -3008,6 +3013,10 @@ static Word16 SWB_BWE_encoding_ivas_fx( Flag Overflow = 0; move32(); #endif Word16 inner_frame; Word16 q_shift; Word16 yos_fx_16[L_FRAME_MAX]; Word16 sf; FD_BWE_ENC_HANDLE hBWE_FD = st_fx->hBWE_FD; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; Loading @@ -3023,6 +3032,17 @@ static Word16 SWB_BWE_encoding_ivas_fx( move16(); } IF( EQ_16( st_fx->extl, FB_BWE ) ) { inner_frame = L_FRAME48k; move16(); } ELSE { inner_frame = L_FRAME32k; move16(); } /* HF transient detect */ IsTransient = detect_transient_fx( insig_hp_fx, L_FRAME16k, Q_shb, st_fx ); st_fx->EnergyLT_fx_exp = shl( Q_shb, 1 ); Loading Loading @@ -3076,15 +3096,29 @@ static Word16 SWB_BWE_encoding_ivas_fx( global_gain_fx = L_deposit_l( 0 ); FOR( n_band = 0; n_band < SWB_FENV_TRANS; n_band++ ) { energy_fx = L_deposit_l( 0 ); energy_fx_64 = W_deposit32_l( 0 ); FOR( n_coeff = swb_bwe_trans_subband[n_band] + st_offset; n_coeff < swb_bwe_trans_subband[n_band + 1] + st_offset; n_coeff++ ) { L_tmp = L_shr( L_mult0( yos_fx[n_coeff], yos_fx[n_coeff] ), 7 ); /*2*Q_synth-7 */ energy_fx = L_add( L_tmp, energy_fx ); /*2*Q_synth-7 */ W_tmp = W_mult0_32_32( yos_fx[n_coeff], yos_fx[n_coeff] ); /*2*Q_synth */ energy_fx_64 = W_add( W_tmp, energy_fx_64 ); /*2*Q_synth */ } global_gain_fx = L_add( global_gain_fx, L_shr( energy_fx, sub( sub( shl( Q_synth, 1 ), 7 ), shl( Q_shb, 1 ) ) ) ); /*2*Q_shb */ q_shift = W_norm( energy_fx_64 ); energy_fx = W_extract_h( W_shl( energy_fx_64, q_shift ) ); /*2*Q_synth + q_shift - 32*/ q_shift = sub( q_shift, 32 ); global_gain_fx = L_add( global_gain_fx, L_shr( energy_fx, sub( add( shl( Q_synth, 1 ), q_shift ), shl( Q_shb, 1 ) ) ) ); /*2*Q_shb */ L_SWB_fenv_fx[n_band] = energy_fx; move32(); IF( L_SWB_fenv_fx[n_band] == 0 ) { q_SWB_fenv[n_band] = Q31; move16(); } ELSE { q_SWB_fenv[n_band] = add( shl( Q_synth, 1 ), q_shift ); move16(); } } global_gain_fx = L_shr( global_gain_fx, 1 ); /*2*Q_shb */ Loading @@ -3092,10 +3126,10 @@ static Word16 SWB_BWE_encoding_ivas_fx( { expd = norm_s( swb_bwe_trans_subband_width[n_band] ); tmp = div_s( shl( 1, sub( 14, expd ) ), swb_bwe_trans_subband_width[n_band] ); /*Q(29-expd) */ L_tmp = Mult_32_16( L_SWB_fenv_fx[n_band], tmp ); /*2*Q_synth-7+29-expd - 15 */ L_tmp = Mult_32_16( L_SWB_fenv_fx[n_band], tmp ); /*q_SWB_fenv[n_band]+29-expd - 15 */ exp = norm_l( L_tmp ); tmp = Log2_norm_lc( L_shl( L_tmp, exp ) ); exp = sub( sub( 30, exp ), sub( add( shl( Q_synth, 1 ), 7 ), expd ) ); exp = sub( sub( 30, exp ), sub( add( q_SWB_fenv[n_band], Q14 ), expd ) ); L_tmp = Mpy_32_16( exp, tmp, 24660 ); /* Q14 */ /*10log10(2) in Q13 */ tmp = round_fx( L_shl( L_tmp, 10 ) ); /* Q8 */ Loading Loading @@ -3371,37 +3405,45 @@ static Word16 SWB_BWE_encoding_ivas_fx( global_gain_fx = L_deposit_l( 0 ); FOR( n_band = 0; n_band < SWB_FENV; n_band++ ) { energy_fx = L_deposit_l( 0 ); energy_fx_64 = W_deposit32_l( 0 ); FOR( n_coeff = swb_bwe_subband[n_band] + st_offset; n_coeff < swb_bwe_subband[n_band + 1] + st_offset; n_coeff++ ) { L_tmp = L_shr( L_mult0( yos_fx[n_coeff], yos_fx[n_coeff] ), 5 ); /*2*Q_synth-5 */ energy_fx = L_add( L_tmp, energy_fx ); /*2*Q_synth-5 */ W_tmp = W_mult0_32_32( yos_fx[n_coeff], yos_fx[n_coeff] ); /*2*Q_synth */ energy_fx_64 = W_add( W_tmp, energy_fx_64 ); /*2*Q_synth */ } q_shift = W_norm( energy_fx_64 ); energy_fx = W_extract_h( W_shl( energy_fx_64, q_shift ) ); /*2*Q_synth + q_shift - 32*/ q_shift = sub( q_shift, 32 ); IF( LT_16( n_band, SWB_FENV - 2 ) ) { global_gain_fx = L_add( global_gain_fx, L_shr( energy_fx, sub( sub( shl( Q_synth, 1 ), 5 ), shl( Q_shb, 1 ) ) ) ); /*2*Q_shb */ global_gain_fx = L_add( global_gain_fx, L_shr( energy_fx, sub( add( shl( Q_synth, 1 ), q_shift ), shl( Q_shb, 1 ) ) ) ); /*2*Q_shb */ } L_SWB_fenv_fx[n_band] = energy_fx; move32(); q_SWB_fenv[n_band] = add( shl( Q_synth, 1 ), q_shift ); move16(); } global_gain_fx = L_shr( global_gain_fx, 1 ); /*2*Q_shb */ mode = FD_BWE_class_fx( yos_fx, global_gain_fx, tilt_nb_fx, Q_synth, Q_shb, st_fx ); sf = getScaleFactor32( yos_fx, inner_frame ); Copy_Scale_sig32_16( yos_fx, yos_fx_16, inner_frame, sf ); mode = FD_BWE_class_fx( yos_fx_16, global_gain_fx, tilt_nb_fx, sub( add( Q_synth, sf ), Q16 ), Q_shb, st_fx ); push_indice( hBstr, IND_SWB_CLASS, mode, 2 ); energy_control_ivas_fx( st_fx, ACELP_CORE, mode, -1, yos_fx, st_offset, energy_factor_fx, Q_synth_lf ); energy_control_ivas_fx( st_fx, ACELP_CORE, mode, -1, yos_fx_16, st_offset, energy_factor_fx, Q_synth_lf + sf - 16 ); FOR( n_band = 0; n_band < SWB_FENV; n_band++ ) { L_tmp = Mult_32_16( L_SWB_fenv_fx[n_band], energy_factor_fx[n_band] ); /*2*Q_synth-5 */ L_tmp = Mult_32_16( L_tmp, swb_inv_bwe_subband_width_fx[n_band] ); /*2*Q_synth-5 */ L_tmp = Mult_32_16( L_SWB_fenv_fx[n_band], energy_factor_fx[n_band] ); /*q_SWB_fenv[n_band] */ L_tmp = Mult_32_16( L_tmp, swb_inv_bwe_subband_width_fx[n_band] ); /*q_SWB_fenv[n_band] */ IF( L_tmp != 0 ) { expn = norm_l( L_tmp ); tmp = Log2_norm_lc( L_shl( L_tmp, expn ) ); expn = sub( 30, add( expn, sub( shl( Q_synth, 1 ), 5 ) ) ); expn = sub( 30, add( expn, q_SWB_fenv[n_band] ) ); L_tmp = Mpy_32_16( expn, tmp, 24660 ); /* Q14 */ /*10log10(2) in Q13 */ SWB_fenv_fx[n_band] = round_fx( L_shl( L_tmp, 10 ) ); /* Q8 */ move16(); Loading