Loading lib_enc/swb_bwe_enc_fx.c +47 −15 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ static Word16 WB_BWE_encoding_fx( const Word16 coder_type, const Word16 *yos_fx, Word16 *WB_fenv_fx, Encoder_State *st_fx, const Word16 Q_synth, const Word16 Q_synth_lf ); static Word16 WB_BWE_encoding_fx_32( Encoder_State *st_fx, const Word32 *yos_fx, Word16 *WB_fenv_fx, Word16 Q_synth, Word16 Q_synth_lf ); static Word16 WB_BWE_encoding_fx_32( Encoder_State *st_fx, const Word32 *yos_fx, Word16 *WB_fenv_fx, Word16 Q_synth, const Word16 Q_synth_lf ); static Word16 SWB_BWE_encoding_fx( Encoder_State *st_fx, Word16 *insig_fx, const Word16 *insig_lp_fx, const Word16 *insig_hp_fx, const Word16 *synth_fx, const Word16 *yos_fx, Word16 *SWB_fenv_fx, const Word16 tilt_nb_fx, const Word16 st_offset, const Word16 coder_type, const Word16 Q_insig_lp, const Word16 Q_shb, const Word16 Q_synth, const Word16 Q_synth_lf ); Loading Loading @@ -233,13 +233,12 @@ void wb_bwe_enc_ivas_fx( #endif wtda_fx( old_input_fx, &new_input_fx_exp, L_wtda_synth_fx, hBWE_FD->L_old_wtda_swb_fx, &st_fx->Q_old_wtda, ALDO_WINDOW, ALDO_WINDOW, /* window overlap of current frame (0: full, 2: none, or 3: half) */ L_FRAME16k ); &st_fx->Q_old_wtda, ALDO_WINDOW, ALDO_WINDOW, /* window overlap of current frame (0: full, 2: none, or 3: half) */ L_FRAME16k ); /* DCT of the ACELP core synthesis */ direct_transform_fx( L_wtda_synth_fx, yorig_32, 0, L_FRAME16k, &new_input_fx_exp, st_fx->element_mode ); #ifdef HARM_FD_BWE #ifdef HARM_FD_BWEaa IF( st_fx->element_mode == EVS_MONO ) { Word16 scl, Q_synth; Loading Loading @@ -2585,7 +2584,7 @@ static Word16 WB_BWE_encoding_fx_32( const Word32 *yos_fx, /* i : MDCT coefficients of weighted original */ Word16 *WB_fenv_fx, /* i/o: energy of WB envelope */ Word16 Q_synth, Word16 Q_synth_lf ) const Word16 Q_synth_lf ) { Word16 mode; Word16 i, n_coeff, n_band; Loading @@ -2600,8 +2599,9 @@ static Word16 WB_BWE_encoding_fx_32( Word16 q_shift, scale; Word16 q_WB_fenv[2]; Word16 yos_fx_16[L_FRAME16k]; #ifdef HARM_FD_BWE Word16 Q_class, Q_energy, Q_fenv; IF( st_fx->element_mode == EVS_MONO ) { Word16 new_input_fx_exp = Q_synth; Loading @@ -2621,12 +2621,28 @@ static Word16 WB_BWE_encoding_fx_32( } Copy_Scale_sig32_16( yos_fx, yos_fx_16, L_FRAME16k, scale ); Q_synth = sub( add( sub( new_input_fx_exp, 16 ), scale ), 1 ); Q_synth_lf = Q_synth; n_band = 0; move16(); FOR( i = 0; i < 2; i++ ) { energy_fx = L_deposit_l( 0 ); FOR( n_coeff = swb_bwe_subband[n_band]; n_coeff < swb_bwe_subband[n_band + 2]; n_coeff++ ) { energy_fx = L_add( energy_fx, L_shr( L_mult0( yos_fx_16[n_coeff], yos_fx_16[n_coeff] ), 6 ) ); /*2*Q_synth-6 */ } mode = FD_BWE_class_fx( yos_fx_16, 0, 0, Q_synth, 0, st_fx ); L_WB_fenv_fx[i] = energy_fx; move32(); /*2*Q_synth-6 */ n_band = add( n_band, 2 ); } energy_control_fx( st_fx, ACELP_CORE, mode, st_fx->coder_type, yos_fx_16, 0, energy_factor_fx, Q_synth_lf ); Q_class = Q_synth; Q_energy = Q_synth; Q_fenv = sub( shl( Q_synth, 1 ), 2 ); move16(); move16(); move16(); } ELSE #endif Loading Loading @@ -2655,14 +2671,25 @@ static Word16 WB_BWE_encoding_fx_32( scale = s_min( L_norm_arr( yos_fx, L_FRAME16k ), sub( Q27, Q_synth ) /* To accomodate 10 in Q_synth*/ ); Copy_Scale_sig32_16( yos_fx, yos_fx_16, L_FRAME16k, scale ); Q_class = sub( add( Q_synth, scale ), Q16 ); Q_energy = sub( add( Q_synth_lf, scale ), Q16 ); Q_fenv = add( q_WB_fenv[i], 4 ); move16(); move16(); move16(); } #ifdef HARM_FD_BWE mode = FD_BWE_class_fx( yos_fx_16, 0, 0, Q_class, 0, st_fx ); #else mode = FD_BWE_class_fx( yos_fx_16, 0, 0, sub( add( Q_synth, scale ), Q16 ), 0, st_fx ); #endif #ifdef HARM_FD_BWE energy_control_fx( st_fx, ACELP_CORE, mode, st_fx->coder_type, yos_fx_16, 0, energy_factor_fx, sub( add( Q_synth_lf, scale ), Q16 ) ); energy_control_fx( st_fx, ACELP_CORE, mode, st_fx->coder_type, yos_fx_16, 0, energy_factor_fx, Q_energy ); #else energy_control_ivas_fx( st_fx, ACELP_CORE, mode, st_fx->coder_type, yos_fx_16, 0, energy_factor_fx, sub( add( Q_synth_lf, scale ), Q16 ) ); #endif } FOR( i = 0; i < 2; i++ ) { Loading @@ -2673,7 +2700,12 @@ static Word16 WB_BWE_encoding_fx_32( exp = norm_l( L_tmp ); tmp = Log2_norm_lc( L_shl( L_tmp, exp ) ); /* exp = 30-exp-(2*Q_synth-2 / exp = 30-exp-(q_WB_fenv[i]+4) */ mode = FD_BWE_class_fx( yos_fx_16, 0, 0, sub( add( Q_synth, scale ), Q16 ), 0, st_fx ); #ifdef HARM_FD_BWE exp = sub( sub( 30, exp ), Q_fenv ); #else exp = sub( sub( 30, exp ), ( add( q_WB_fenv[i], 4 ) ) ); #endif L_tmp = Mpy_32_16( exp, tmp, 32767 ); /* Q16 */ WB_fenv_fx[i] = round_fx( L_shl( L_tmp, 10 ) ); /* Q10 */ move16(); Loading Loading
lib_enc/swb_bwe_enc_fx.c +47 −15 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ static Word16 WB_BWE_encoding_fx( const Word16 coder_type, const Word16 *yos_fx, Word16 *WB_fenv_fx, Encoder_State *st_fx, const Word16 Q_synth, const Word16 Q_synth_lf ); static Word16 WB_BWE_encoding_fx_32( Encoder_State *st_fx, const Word32 *yos_fx, Word16 *WB_fenv_fx, Word16 Q_synth, Word16 Q_synth_lf ); static Word16 WB_BWE_encoding_fx_32( Encoder_State *st_fx, const Word32 *yos_fx, Word16 *WB_fenv_fx, Word16 Q_synth, const Word16 Q_synth_lf ); static Word16 SWB_BWE_encoding_fx( Encoder_State *st_fx, Word16 *insig_fx, const Word16 *insig_lp_fx, const Word16 *insig_hp_fx, const Word16 *synth_fx, const Word16 *yos_fx, Word16 *SWB_fenv_fx, const Word16 tilt_nb_fx, const Word16 st_offset, const Word16 coder_type, const Word16 Q_insig_lp, const Word16 Q_shb, const Word16 Q_synth, const Word16 Q_synth_lf ); Loading Loading @@ -233,13 +233,12 @@ void wb_bwe_enc_ivas_fx( #endif wtda_fx( old_input_fx, &new_input_fx_exp, L_wtda_synth_fx, hBWE_FD->L_old_wtda_swb_fx, &st_fx->Q_old_wtda, ALDO_WINDOW, ALDO_WINDOW, /* window overlap of current frame (0: full, 2: none, or 3: half) */ L_FRAME16k ); &st_fx->Q_old_wtda, ALDO_WINDOW, ALDO_WINDOW, /* window overlap of current frame (0: full, 2: none, or 3: half) */ L_FRAME16k ); /* DCT of the ACELP core synthesis */ direct_transform_fx( L_wtda_synth_fx, yorig_32, 0, L_FRAME16k, &new_input_fx_exp, st_fx->element_mode ); #ifdef HARM_FD_BWE #ifdef HARM_FD_BWEaa IF( st_fx->element_mode == EVS_MONO ) { Word16 scl, Q_synth; Loading Loading @@ -2585,7 +2584,7 @@ static Word16 WB_BWE_encoding_fx_32( const Word32 *yos_fx, /* i : MDCT coefficients of weighted original */ Word16 *WB_fenv_fx, /* i/o: energy of WB envelope */ Word16 Q_synth, Word16 Q_synth_lf ) const Word16 Q_synth_lf ) { Word16 mode; Word16 i, n_coeff, n_band; Loading @@ -2600,8 +2599,9 @@ static Word16 WB_BWE_encoding_fx_32( Word16 q_shift, scale; Word16 q_WB_fenv[2]; Word16 yos_fx_16[L_FRAME16k]; #ifdef HARM_FD_BWE Word16 Q_class, Q_energy, Q_fenv; IF( st_fx->element_mode == EVS_MONO ) { Word16 new_input_fx_exp = Q_synth; Loading @@ -2621,12 +2621,28 @@ static Word16 WB_BWE_encoding_fx_32( } Copy_Scale_sig32_16( yos_fx, yos_fx_16, L_FRAME16k, scale ); Q_synth = sub( add( sub( new_input_fx_exp, 16 ), scale ), 1 ); Q_synth_lf = Q_synth; n_band = 0; move16(); FOR( i = 0; i < 2; i++ ) { energy_fx = L_deposit_l( 0 ); FOR( n_coeff = swb_bwe_subband[n_band]; n_coeff < swb_bwe_subband[n_band + 2]; n_coeff++ ) { energy_fx = L_add( energy_fx, L_shr( L_mult0( yos_fx_16[n_coeff], yos_fx_16[n_coeff] ), 6 ) ); /*2*Q_synth-6 */ } mode = FD_BWE_class_fx( yos_fx_16, 0, 0, Q_synth, 0, st_fx ); L_WB_fenv_fx[i] = energy_fx; move32(); /*2*Q_synth-6 */ n_band = add( n_band, 2 ); } energy_control_fx( st_fx, ACELP_CORE, mode, st_fx->coder_type, yos_fx_16, 0, energy_factor_fx, Q_synth_lf ); Q_class = Q_synth; Q_energy = Q_synth; Q_fenv = sub( shl( Q_synth, 1 ), 2 ); move16(); move16(); move16(); } ELSE #endif Loading Loading @@ -2655,14 +2671,25 @@ static Word16 WB_BWE_encoding_fx_32( scale = s_min( L_norm_arr( yos_fx, L_FRAME16k ), sub( Q27, Q_synth ) /* To accomodate 10 in Q_synth*/ ); Copy_Scale_sig32_16( yos_fx, yos_fx_16, L_FRAME16k, scale ); Q_class = sub( add( Q_synth, scale ), Q16 ); Q_energy = sub( add( Q_synth_lf, scale ), Q16 ); Q_fenv = add( q_WB_fenv[i], 4 ); move16(); move16(); move16(); } #ifdef HARM_FD_BWE mode = FD_BWE_class_fx( yos_fx_16, 0, 0, Q_class, 0, st_fx ); #else mode = FD_BWE_class_fx( yos_fx_16, 0, 0, sub( add( Q_synth, scale ), Q16 ), 0, st_fx ); #endif #ifdef HARM_FD_BWE energy_control_fx( st_fx, ACELP_CORE, mode, st_fx->coder_type, yos_fx_16, 0, energy_factor_fx, sub( add( Q_synth_lf, scale ), Q16 ) ); energy_control_fx( st_fx, ACELP_CORE, mode, st_fx->coder_type, yos_fx_16, 0, energy_factor_fx, Q_energy ); #else energy_control_ivas_fx( st_fx, ACELP_CORE, mode, st_fx->coder_type, yos_fx_16, 0, energy_factor_fx, sub( add( Q_synth_lf, scale ), Q16 ) ); #endif } FOR( i = 0; i < 2; i++ ) { Loading @@ -2673,7 +2700,12 @@ static Word16 WB_BWE_encoding_fx_32( exp = norm_l( L_tmp ); tmp = Log2_norm_lc( L_shl( L_tmp, exp ) ); /* exp = 30-exp-(2*Q_synth-2 / exp = 30-exp-(q_WB_fenv[i]+4) */ mode = FD_BWE_class_fx( yos_fx_16, 0, 0, sub( add( Q_synth, scale ), Q16 ), 0, st_fx ); #ifdef HARM_FD_BWE exp = sub( sub( 30, exp ), Q_fenv ); #else exp = sub( sub( 30, exp ), ( add( q_WB_fenv[i], 4 ) ) ); #endif L_tmp = Mpy_32_16( exp, tmp, 32767 ); /* Q16 */ WB_fenv_fx[i] = round_fx( L_shl( L_tmp, 10 ) ); /* Q10 */ move16(); Loading