Loading lib_com/gs_gains_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -331,7 +331,7 @@ void Ener_per_band_comp_fx( #endif return; } //#ifndef HARM_GSC_ENC_PART3 #ifndef HARM_GSC_ENC_PART3 void Ener_per_band_comp_ivas_fx( const Word16 exc_diff_fx[], /* i : target signal Q_exc_diff */ Word16 y_gain4_fx[], /* o : Energy per band to quantize Q12 */ Loading Loading @@ -377,7 +377,7 @@ void Ener_per_band_comp_ivas_fx( return; } //#endif HARM_GSC_ENC_PART3 #endif /*-------------------------------------------------------------------* Loading lib_com/gs_inact_switching_fx.c +12 −3 Original line number Diff line number Diff line Loading @@ -77,8 +77,11 @@ void Inac_switch_ematch_fx( test(); IF( ( EQ_16( coder_type, AUDIO ) || ( EQ_16( coder_type, UNVOICED ) && EQ_16( tdm_low_rate_mode, 1 ) ) ) && bfi == 0 ) { #ifdef HARM_GSC_ENC_PART3 Ener_per_band_comp_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1, L_frame ); #else Ener_per_band_comp_ivas_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1, L_frame ); #endif /* reset long-term energy per band */ FOR( i = 0; i < MBANDS_GN; i++ ) { Loading @@ -91,8 +94,11 @@ void Inac_switch_ematch_fx( /* Find spectrum and energy per band for GC and VC frames */ edct_16fx( exc2, dct_exc_tmp, L_frame, 5, element_mode ); #ifdef HARM_GSC_ENC_PART3 Ener_per_band_comp_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1, L_frame ); #else Ener_per_band_comp_ivas_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1, L_frame ); #endif /* reset long-term energy per band */ FOR( i = 0; i < MBANDS_GN; i++ ) { Loading @@ -104,8 +110,11 @@ void Inac_switch_ematch_fx( { /* Find spectrum and energy per band for inactive frames */ edct_16fx( exc2, dct_exc_tmp, L_frame, 5, element_mode ); #ifdef HARM_GSC_ENC_PART3 Ener_per_band_comp_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1, L_frame ); #else Ener_per_band_comp_ivas_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1, L_frame ); #endif /* More agressive smoothing in the first 50 frames */ pt_exc = dct_exc_tmp; move16(); Loading lib_com/gs_noisefill_fx.c +10 −3 Original line number Diff line number Diff line Loading @@ -636,7 +636,7 @@ static void envelop_modify_fx( return; } #ifndef HARM_GSC_ENC_PART3 void highband_exc_dct_in_fx( const Word32 core_brate, /* i : core bitrate */ const Word16 *mfreq_bindiv, /* i : bin per bands tables */ Loading Loading @@ -1017,7 +1017,7 @@ void highband_exc_dct_in_fx( return; } #endif void highband_exc_dct_in_ivas_fx( const Word32 core_brate, /* i : core bitrate */ const Word16 *mfreq_bindiv, /* i : bin per bands tables */ Loading Loading @@ -1183,12 +1183,19 @@ void highband_exc_dct_in_ivas_fx( test(); IF( EQ_32( core_brate, ACELP_8k00 ) && NE_16( bwidth, NB ) ) { #ifdef HARM_GSC_ENC_PART3 Ener_per_band_comp_fx( exc_diffQ, Ener_per_bd_yQ, Qexc_diffQ, add( last_bin, 1 ), 0, L_frame ); #else Ener_per_band_comp_ivas_fx( exc_diffQ, Ener_per_bd_yQ, Qexc_diffQ, add( last_bin, 1 ), 0, L_frame ); #endif } ELSE { #ifdef HARM_GSC_ENC_PART3 Ener_per_band_comp_fx( exc_diffQ, Ener_per_bd_yQ, Qexc_diffQ, MBANDS_GN, 1, L_frame ); #else Ener_per_band_comp_ivas_fx( exc_diffQ, Ener_per_bd_yQ, Qexc_diffQ, MBANDS_GN, 1, L_frame ); #endif test(); IF( LT_16( nb_subfr, 4 ) && LT_16( L_frame, L_FRAME16k ) ) { Loading lib_com/gs_preech_fx.c +75 −33 Original line number Diff line number Diff line Loading @@ -58,6 +58,10 @@ void pre_echo_att_fx( const Word16 Q_new, const Word16 last_coder_type, /* i : Last coding mode Q0*/ const Word16 L_frame /* i : Frame length Q0*/ #ifdef HARM_GSC_ENC_PART3 , const Word16 element_mode /* i : Current IVAS element mode*/ #endif ) { Word32 etmp_fx; Loading @@ -69,7 +73,9 @@ void pre_echo_att_fx( Word16 tmp, n1, n2, exp, frac1, frac2; Word32 etmp1_fx; Word16 att_len; #ifdef HARM_GSC_ENC_PART3 Word16 etmp_e, tmp_e; #endif test(); IF( gsc_attack_flag_fx > 0 && EQ_16( last_coder_type, AUDIO ) ) /*gsc_attack_flag_fx does not get set for all the test cases */ { Loading Loading @@ -108,6 +114,26 @@ void pre_echo_att_fx( IF( GT_32( etmp_fx, *Last_frame_ener_fx ) && attack_pos_fx > 0 ) { /* Find the average energy before the attack */ #ifdef HARM_GSC_ENC_PART3 IF( NE_16( element_mode, EVS_MONO ) ) /* This could be harmonized with EVS, but won't be BE */ { etmp_fx = sum32_fx( finc_fx, attack_pos_fx ); etmp_e = sub( 31, add( shl( Q_new, 1 ), 1 ) ); etmp_fx = L_add( etmp_fx, L_shr( 21474836 /*0.01 in Q31*/, etmp_e ) ); /* etmp = etmp + 0.01; (exp = etmp_e) */ etmp_fx = L_deposit_h( BASOP_Util_Divide3232_Scale( etmp_fx, L_mult0( attack_pos_fx, ATT_SEG_LEN ), &tmp_e ) ); tmp_e = add( tmp_e, sub( etmp_e, 31 ) ); etmp_e = tmp_e; move16(); /* Find the correction factor and apply it before the attack */ tmp = BASOP_Util_Divide3232_Scale( *Last_frame_ener_fx, etmp_fx, &tmp_e ); /* numerator Q = 2 * Q_new + 1; denominator Q = 31 - tmp_e */ tmp_e = add( tmp_e, sub( sub( 31, etmp_e ), add( shl( Q_new, 1 ), 1 ) ) ); /* tmp_e = tmp_e + (31 - tmp_e) - (2 * Q_new + 1) */ tmp = Sqrt16( tmp, &tmp_e ); ratio_fx = shr_sat( tmp, sub( 2, tmp_e ) ); /* Q13 */ } ELSE #endif { L_tmp = sum32_fx( finc_fx, attack_pos_fx ); /*Q1 */ L_tmp1 = L_shr( L_mult( attack_pos_fx, attack_pos_fx ), 1 ); /*Q0 */ tmp = round_fx( Isqrt( L_tmp1 ) ); /*Q15 */ Loading @@ -134,7 +160,7 @@ void pre_echo_att_fx( L_tmp = Isqrt( L_tmp ); ratio_fx = round_fx( L_shl( L_tmp, 9 ) ); /* Q13 */ } /* Pre-echo atttenuation should never increase the energy */ ratio_fx = s_min( ratio_fx, 8192 /* 1 in Q13 */ ); /* Q13 */ FOR( i = 0; i < attack_pos_fx * ATT_SEG_LEN; i++ ) Loading @@ -152,17 +178,32 @@ void pre_echo_att_fx( /*-------------------------------------------------------* * In normal cases, just compute the energy of the frame *-------------------------------------------------------*/ #ifdef HARM_GSC_ENC_PART3 IF( NE_16( element_mode, EVS_MONO ) ) /* This could be harmonized with EVS, but won't be BE */ { Word16 exp_etmp = sub( 15, Q_new ); etmp_fx = sum2_16_exp_fx( exc_fx, L_frame, &exp_etmp, 7 ); /* Q = 31-exp_etmp */ etmp_fx = L_shr( etmp_fx, 8 ); /*31-exp_etmp//INV_L_FRAME = 1/256*/ IF( EQ_16( L_frame, L_FRAME16k ) ) { etmp_fx = Mpy_32_16_1( etmp_fx, 26214 /* 0.8 in Q15 */ ); /*31 - exp_etmp*/ } *Last_frame_ener_fx = L_shl( etmp_fx, sub( shl( Q_new, 1 ), sub( 30 /*31-1*/, exp_etmp ) ) ); /*2*Q_new+1*/ } ELSE #endif { etmp_fx = sum2_fx( exc_fx, L_frame ); /*2*Q_new+1 */ etmp_fx = L_shr( etmp_fx, add( 8 + 1 - 4, shl( Q_new, 1 ) ) ); /*2*Q_new+1 //INV_L_FRAME = 1/256 -> Q4*/ *Last_frame_ener_fx = etmp_fx; move32(); /*2*Q_new+1*/ } } return; } #ifndef HARM_GSC_ENC_PART3 void pre_echo_att_ivas_fx( Word32 *Last_frame_ener_fx, /* i/o: Energy of the last frame 2*Q_new+1*/ Word16 *exc_fx, /* i/o: Excitation of the current frame Q_new*/ Loading Loading @@ -267,3 +308,4 @@ void pre_echo_att_ivas_fx( return; } #endif No newline at end of file lib_com/prot_fx.h +8 −4 Original line number Diff line number Diff line Loading @@ -1799,8 +1799,12 @@ void pre_echo_att_fx( const Word16 Q_new, const Word16 last_coder_type, /* i : Last coding mode Q0*/ const Word16 L_frame /* i : Frame length Q0*/ #ifdef HARM_GSC_ENC_PART3 , const Word16 element_mode /* i : Current IVAS element mode*/ #endif ); #ifndef HARM_GSC_ENC_PART3 void pre_echo_att_ivas_fx( Word32 *Last_frame_ener_fx, /* i/o: Energy of the last frame 2*Q_new+1*/ Word16 *exc_fx, /* i/o: Excitation of the current frame Q_new*/ Loading @@ -1809,7 +1813,7 @@ void pre_echo_att_ivas_fx( const Word16 last_coder_type, /* i : Last coding mode Q0*/ const Word16 L_frame /* i : Frame length Q0*/ ); #endif void tcx_get_windows_mode1( const Word16 left_mode, /* i: overlap mode of left window half */ const Word16 right_mode, /* i: overlap mode of right window half */ Loading Loading @@ -5038,7 +5042,7 @@ void freq_dnw_scaling_fx( Word16 Qx, /* Q format of fy_norm*/ const Word16 L_frame /* i : frame length */ ); #ifndef HARM_GSC_ENC_PART3 void highband_exc_dct_in_fx( const Word32 core_brate, /* i : core bitrate */ const Word16 *mfreq_bindiv, /* i : bin per bands tables */ Loading Loading @@ -5070,7 +5074,7 @@ void highband_exc_dct_in_fx( const Word16 element_mode, /* i : IVAS element mode */ const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ ); #endif void highband_exc_dct_in_ivas_fx( const Word32 core_brate, /* i : core bitrate */ const Word16 *mfreq_bindiv, /* i : bin per bands tables */ Loading Loading
lib_com/gs_gains_fx.c +2 −2 Original line number Diff line number Diff line Loading @@ -331,7 +331,7 @@ void Ener_per_band_comp_fx( #endif return; } //#ifndef HARM_GSC_ENC_PART3 #ifndef HARM_GSC_ENC_PART3 void Ener_per_band_comp_ivas_fx( const Word16 exc_diff_fx[], /* i : target signal Q_exc_diff */ Word16 y_gain4_fx[], /* o : Energy per band to quantize Q12 */ Loading Loading @@ -377,7 +377,7 @@ void Ener_per_band_comp_ivas_fx( return; } //#endif HARM_GSC_ENC_PART3 #endif /*-------------------------------------------------------------------* Loading
lib_com/gs_inact_switching_fx.c +12 −3 Original line number Diff line number Diff line Loading @@ -77,8 +77,11 @@ void Inac_switch_ematch_fx( test(); IF( ( EQ_16( coder_type, AUDIO ) || ( EQ_16( coder_type, UNVOICED ) && EQ_16( tdm_low_rate_mode, 1 ) ) ) && bfi == 0 ) { #ifdef HARM_GSC_ENC_PART3 Ener_per_band_comp_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1, L_frame ); #else Ener_per_band_comp_ivas_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1, L_frame ); #endif /* reset long-term energy per band */ FOR( i = 0; i < MBANDS_GN; i++ ) { Loading @@ -91,8 +94,11 @@ void Inac_switch_ematch_fx( /* Find spectrum and energy per band for GC and VC frames */ edct_16fx( exc2, dct_exc_tmp, L_frame, 5, element_mode ); #ifdef HARM_GSC_ENC_PART3 Ener_per_band_comp_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1, L_frame ); #else Ener_per_band_comp_ivas_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1, L_frame ); #endif /* reset long-term energy per band */ FOR( i = 0; i < MBANDS_GN; i++ ) { Loading @@ -104,8 +110,11 @@ void Inac_switch_ematch_fx( { /* Find spectrum and energy per band for inactive frames */ edct_16fx( exc2, dct_exc_tmp, L_frame, 5, element_mode ); #ifdef HARM_GSC_ENC_PART3 Ener_per_band_comp_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1, L_frame ); #else Ener_per_band_comp_ivas_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1, L_frame ); #endif /* More agressive smoothing in the first 50 frames */ pt_exc = dct_exc_tmp; move16(); Loading
lib_com/gs_noisefill_fx.c +10 −3 Original line number Diff line number Diff line Loading @@ -636,7 +636,7 @@ static void envelop_modify_fx( return; } #ifndef HARM_GSC_ENC_PART3 void highband_exc_dct_in_fx( const Word32 core_brate, /* i : core bitrate */ const Word16 *mfreq_bindiv, /* i : bin per bands tables */ Loading Loading @@ -1017,7 +1017,7 @@ void highband_exc_dct_in_fx( return; } #endif void highband_exc_dct_in_ivas_fx( const Word32 core_brate, /* i : core bitrate */ const Word16 *mfreq_bindiv, /* i : bin per bands tables */ Loading Loading @@ -1183,12 +1183,19 @@ void highband_exc_dct_in_ivas_fx( test(); IF( EQ_32( core_brate, ACELP_8k00 ) && NE_16( bwidth, NB ) ) { #ifdef HARM_GSC_ENC_PART3 Ener_per_band_comp_fx( exc_diffQ, Ener_per_bd_yQ, Qexc_diffQ, add( last_bin, 1 ), 0, L_frame ); #else Ener_per_band_comp_ivas_fx( exc_diffQ, Ener_per_bd_yQ, Qexc_diffQ, add( last_bin, 1 ), 0, L_frame ); #endif } ELSE { #ifdef HARM_GSC_ENC_PART3 Ener_per_band_comp_fx( exc_diffQ, Ener_per_bd_yQ, Qexc_diffQ, MBANDS_GN, 1, L_frame ); #else Ener_per_band_comp_ivas_fx( exc_diffQ, Ener_per_bd_yQ, Qexc_diffQ, MBANDS_GN, 1, L_frame ); #endif test(); IF( LT_16( nb_subfr, 4 ) && LT_16( L_frame, L_FRAME16k ) ) { Loading
lib_com/gs_preech_fx.c +75 −33 Original line number Diff line number Diff line Loading @@ -58,6 +58,10 @@ void pre_echo_att_fx( const Word16 Q_new, const Word16 last_coder_type, /* i : Last coding mode Q0*/ const Word16 L_frame /* i : Frame length Q0*/ #ifdef HARM_GSC_ENC_PART3 , const Word16 element_mode /* i : Current IVAS element mode*/ #endif ) { Word32 etmp_fx; Loading @@ -69,7 +73,9 @@ void pre_echo_att_fx( Word16 tmp, n1, n2, exp, frac1, frac2; Word32 etmp1_fx; Word16 att_len; #ifdef HARM_GSC_ENC_PART3 Word16 etmp_e, tmp_e; #endif test(); IF( gsc_attack_flag_fx > 0 && EQ_16( last_coder_type, AUDIO ) ) /*gsc_attack_flag_fx does not get set for all the test cases */ { Loading Loading @@ -108,6 +114,26 @@ void pre_echo_att_fx( IF( GT_32( etmp_fx, *Last_frame_ener_fx ) && attack_pos_fx > 0 ) { /* Find the average energy before the attack */ #ifdef HARM_GSC_ENC_PART3 IF( NE_16( element_mode, EVS_MONO ) ) /* This could be harmonized with EVS, but won't be BE */ { etmp_fx = sum32_fx( finc_fx, attack_pos_fx ); etmp_e = sub( 31, add( shl( Q_new, 1 ), 1 ) ); etmp_fx = L_add( etmp_fx, L_shr( 21474836 /*0.01 in Q31*/, etmp_e ) ); /* etmp = etmp + 0.01; (exp = etmp_e) */ etmp_fx = L_deposit_h( BASOP_Util_Divide3232_Scale( etmp_fx, L_mult0( attack_pos_fx, ATT_SEG_LEN ), &tmp_e ) ); tmp_e = add( tmp_e, sub( etmp_e, 31 ) ); etmp_e = tmp_e; move16(); /* Find the correction factor and apply it before the attack */ tmp = BASOP_Util_Divide3232_Scale( *Last_frame_ener_fx, etmp_fx, &tmp_e ); /* numerator Q = 2 * Q_new + 1; denominator Q = 31 - tmp_e */ tmp_e = add( tmp_e, sub( sub( 31, etmp_e ), add( shl( Q_new, 1 ), 1 ) ) ); /* tmp_e = tmp_e + (31 - tmp_e) - (2 * Q_new + 1) */ tmp = Sqrt16( tmp, &tmp_e ); ratio_fx = shr_sat( tmp, sub( 2, tmp_e ) ); /* Q13 */ } ELSE #endif { L_tmp = sum32_fx( finc_fx, attack_pos_fx ); /*Q1 */ L_tmp1 = L_shr( L_mult( attack_pos_fx, attack_pos_fx ), 1 ); /*Q0 */ tmp = round_fx( Isqrt( L_tmp1 ) ); /*Q15 */ Loading @@ -134,7 +160,7 @@ void pre_echo_att_fx( L_tmp = Isqrt( L_tmp ); ratio_fx = round_fx( L_shl( L_tmp, 9 ) ); /* Q13 */ } /* Pre-echo atttenuation should never increase the energy */ ratio_fx = s_min( ratio_fx, 8192 /* 1 in Q13 */ ); /* Q13 */ FOR( i = 0; i < attack_pos_fx * ATT_SEG_LEN; i++ ) Loading @@ -152,17 +178,32 @@ void pre_echo_att_fx( /*-------------------------------------------------------* * In normal cases, just compute the energy of the frame *-------------------------------------------------------*/ #ifdef HARM_GSC_ENC_PART3 IF( NE_16( element_mode, EVS_MONO ) ) /* This could be harmonized with EVS, but won't be BE */ { Word16 exp_etmp = sub( 15, Q_new ); etmp_fx = sum2_16_exp_fx( exc_fx, L_frame, &exp_etmp, 7 ); /* Q = 31-exp_etmp */ etmp_fx = L_shr( etmp_fx, 8 ); /*31-exp_etmp//INV_L_FRAME = 1/256*/ IF( EQ_16( L_frame, L_FRAME16k ) ) { etmp_fx = Mpy_32_16_1( etmp_fx, 26214 /* 0.8 in Q15 */ ); /*31 - exp_etmp*/ } *Last_frame_ener_fx = L_shl( etmp_fx, sub( shl( Q_new, 1 ), sub( 30 /*31-1*/, exp_etmp ) ) ); /*2*Q_new+1*/ } ELSE #endif { etmp_fx = sum2_fx( exc_fx, L_frame ); /*2*Q_new+1 */ etmp_fx = L_shr( etmp_fx, add( 8 + 1 - 4, shl( Q_new, 1 ) ) ); /*2*Q_new+1 //INV_L_FRAME = 1/256 -> Q4*/ *Last_frame_ener_fx = etmp_fx; move32(); /*2*Q_new+1*/ } } return; } #ifndef HARM_GSC_ENC_PART3 void pre_echo_att_ivas_fx( Word32 *Last_frame_ener_fx, /* i/o: Energy of the last frame 2*Q_new+1*/ Word16 *exc_fx, /* i/o: Excitation of the current frame Q_new*/ Loading Loading @@ -267,3 +308,4 @@ void pre_echo_att_ivas_fx( return; } #endif No newline at end of file
lib_com/prot_fx.h +8 −4 Original line number Diff line number Diff line Loading @@ -1799,8 +1799,12 @@ void pre_echo_att_fx( const Word16 Q_new, const Word16 last_coder_type, /* i : Last coding mode Q0*/ const Word16 L_frame /* i : Frame length Q0*/ #ifdef HARM_GSC_ENC_PART3 , const Word16 element_mode /* i : Current IVAS element mode*/ #endif ); #ifndef HARM_GSC_ENC_PART3 void pre_echo_att_ivas_fx( Word32 *Last_frame_ener_fx, /* i/o: Energy of the last frame 2*Q_new+1*/ Word16 *exc_fx, /* i/o: Excitation of the current frame Q_new*/ Loading @@ -1809,7 +1813,7 @@ void pre_echo_att_ivas_fx( const Word16 last_coder_type, /* i : Last coding mode Q0*/ const Word16 L_frame /* i : Frame length Q0*/ ); #endif void tcx_get_windows_mode1( const Word16 left_mode, /* i: overlap mode of left window half */ const Word16 right_mode, /* i: overlap mode of right window half */ Loading Loading @@ -5038,7 +5042,7 @@ void freq_dnw_scaling_fx( Word16 Qx, /* Q format of fy_norm*/ const Word16 L_frame /* i : frame length */ ); #ifndef HARM_GSC_ENC_PART3 void highband_exc_dct_in_fx( const Word32 core_brate, /* i : core bitrate */ const Word16 *mfreq_bindiv, /* i : bin per bands tables */ Loading Loading @@ -5070,7 +5074,7 @@ void highband_exc_dct_in_fx( const Word16 element_mode, /* i : IVAS element mode */ const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ ); #endif void highband_exc_dct_in_ivas_fx( const Word32 core_brate, /* i : core bitrate */ const Word16 *mfreq_bindiv, /* i : bin per bands tables */ Loading