Loading lib_com/ivas_prot_fx.h +6 −6 Original line number Diff line number Diff line Loading @@ -2996,7 +2996,7 @@ Word16 ivas_acelp_tcx20_switching_fx( const Word16 flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz */ ); void encod_gen_2sbfr( void encod_gen_2sbfr_fx( Encoder_State *st, /* i/o: state structure */ const Word16 speech[], /* i : input speech */ const Word16 Aw[], /* i : weighted A(z) unquantized for subframes */ Loading @@ -3010,8 +3010,8 @@ void encod_gen_2sbfr( Word16 *bwe_exc, /* o : excitation for SWB TBE */ const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ const Word16 tdm_Pri_pitch_buf[], /* i : pitch values for primary channel */ Word16 Q_new, Word16 shift const Word16 Q_new, /* i : Scaling factor */ const Word16 shift /* i : Shift needed to obtain 12 bits vectors */ ); void acelp_fast_fx( Loading Loading @@ -4489,7 +4489,7 @@ ivas_error signaling_enc_secondary_fx( const Word16 tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag */ ); void tdm_low_rate_enc( void tdm_low_rate_enc_fx( Encoder_State *st, /* i/o: State structure */ const Word16 Aq[], /* i : 12k8 Lp coefficient */ const Word16 *res, /* i : residual signal Q_new*/ Loading @@ -4501,7 +4501,7 @@ void tdm_low_rate_enc( const Word16 attack_flag, /* i : attack flag */ const Word16 *lsf_new, /* i : current frame ISF vector x2.56 */ Word16 *tmp_noise, /* o : long-term noise energy Q8 */ Word16 Q_new const Word16 Q_new /* i : Scaling factor */ ); void tdm_low_rate_dec_fx( Loading lib_enc/acelp_core_enc_fx.c +7 −2 Original line number Diff line number Diff line Loading @@ -499,8 +499,13 @@ ivas_error acelp_core_enc_fx( } ELSE IF( EQ_16( coder_type, TRANSITION ) ) { #ifdef CLEANUP_ACELP_ENC tc_subfr_fx = encod_tran_ivas_fx( st_fx, inp_fx, Aw_fx, Aq_fx, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf_fx, voice_factors_fx, bwe_exc_fx, tc_subfr_fx, position, unbits_fx, shift, Q_new ); /* Q0 */ #else tc_subfr_fx = encod_tran_fx( st_fx, inp_fx, Aw_fx, Aq_fx, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf_fx, voice_factors_fx, bwe_exc_fx, tc_subfr_fx, position, unbits_fx, shift, Q_new ); /* Q0 */ #endif } ELSE IF( hSC_VBR->ppp_mode ) { Loading Loading @@ -1344,11 +1349,11 @@ ivas_error acelp_core_enc_ivas_fx( { IF( LE_16( st->coder_type, UNVOICED ) ) { tdm_low_rate_enc( st, Aq, res_fx, syn_fx, exc_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, 0 /*attack_flag*/, lsf_new_fx, &tmp_noise_fx, Q_new ); tdm_low_rate_enc_fx( st, Aq, res_fx, syn_fx, exc_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, 0 /*attack_flag*/, lsf_new_fx, &tmp_noise_fx, Q_new ); } ELSE /* GENERIC */ { encod_gen_2sbfr( st, inp, Aw, Aq, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, Q_new, 0 ); encod_gen_2sbfr_fx( st, inp, Aw, Aq, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, Q_new, 0 ); } } ELSE IF( nelp_mode ) Loading lib_enc/enc_gen_voic_fx.c +7 −2 Original line number Diff line number Diff line Loading @@ -466,8 +466,9 @@ void encod_gen_voic_ivas_fx( Word16 *unbits_fx, /* i/o: number of unused bits Q0*/ const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag Q0*/ const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer Q6*/ Word16 shift, Word16 Q_new ) const Word16 shift, /* i : Shift needed to obtain 12 bits vectors */ const Word16 Q_new /* i : Scaling factor */ ) { Word16 xn_fx[L_SUBFR]; /* Target vector for pitch search */ Word16 xn2_fx[L_SUBFR]; /* Target vector for codebook search */ Loading Loading @@ -612,6 +613,7 @@ void encod_gen_voic_ivas_fx( Copy_Scale_sig( h1_fx, h2_fx, L_SUBFR, -2 ); /*Q11*/ Scale_sig( h1_fx, L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution Q(14+shift)*/ /* scaling of xn[] to limit dynamic at 12 bits */ Scale_sig( xn_fx, L_SUBFR, shift ); } Loading @@ -624,8 +626,10 @@ void encod_gen_voic_ivas_fx( q_h1 = sub( 14, norm_s( h1_fx[0] ) ); Copy_Scale_sig( h1_fx, h2_fx, L_SUBFR, sub( 11, q_h1 ) ); /*Q11*/ Scale_sig( h1_fx, L_SUBFR, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14*/ /* scaling of xn[] to limit dynamic at 12 bits */ Scale_sig( xn_fx, L_SUBFR, shift ); test(); test(); IF( Es_pred_fx < 0 && LE_16( i_subfr_fx, L_SUBFR ) && NE_16( st_fx->last_core, ACELP_CORE ) ) Loading Loading @@ -908,6 +912,7 @@ void encod_gen_voic_ivas_fx( push_indice( hBstr, IND_UNUSED, 0, i ); unbits_PI_fx -= i; } IF( st_fx->Opt_SC_VBR ) { /* SC-VBR */ Loading lib_enc/enc_ppp_fx.c +7 −7 Original line number Diff line number Diff line /*==================================================================================== EVS Codec 3GPP TS26.452 Nov 04, 2021. Version 16.4.0 ====================================================================================*/ #include <stdint.h> #include "options.h" /* Compilation switches */ #include "cnst.h" /* Common constants */ //#include "prot_fx.h" /* Function prototypes */ #include "rom_com.h" /* Common constants */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "basop_util.h" /* Function prototypes */ /*Temporary location to be move in prot* when merge is done */ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ); /*=======================================================================================*/ /* FUNCTION : encod_ppp_fx() */ Loading Loading @@ -51,6 +49,7 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ); /*---------------------------------------------------------------------------------------*/ /* CALLED FROM : TX */ /*=======================================================================================*/ ivas_error encod_ppp_fx( Encoder_State *st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : input speech Q_new*/ Loading @@ -63,8 +62,9 @@ ivas_error encod_ppp_fx( Word16 *pitch_buf_fx, /* o : floating pitch values for each subframe Q6*/ Word16 *voice_factors, /* o : voicing factors Q15*/ Word16 *bwe_exc, /* o : excitation for SWB TBE Q_new*/ Word16 Q_new, Word16 shift ) const Word16 Q_new, /* i : Scaling factor */ const Word16 shift /* i : Shift needed to obtain 12 bits vectors */ ) { Word16 xn_fx[L_SUBFR]; /* Target vector for pitch search */ Word16 h1_fx[L_SUBFR + ( M + 1 )]; /* Impulse response vector */ Loading lib_enc/enc_tran_fx.c +61 −19 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ /* RETURN ARGUMENTS : */ /* _ None */ /*---------------------------------------------------------------------------------*/ #ifndef CLEANUP_ACELP_ENC Word16 encod_tran_fx( Encoder_State *st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : input speech Q0*/ Loading Loading @@ -422,9 +422,13 @@ Word16 encod_tran_fx( return tc_subfr; } #endif #ifdef CLEANUP_ACELP_ENC Word16 encod_tran_ivas_fx( #else Word16 encod_tran_ivas_fx( #endif Encoder_State *st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : input speech Q0*/ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes Q12*/ Loading Loading @@ -485,8 +489,9 @@ Word16 encod_tran_ivas_fx( L_frame_fx = st_fx->L_frame; move16(); #ifndef CLEANUP_ACELP_ENC set16_fx( h1, 0, L_SUBFR + ( M + 1 ) ); #endif /*------------------------------------------------------------------* * Initializations *------------------------------------------------------------------*/ Loading Loading @@ -528,7 +533,12 @@ Word16 encod_tran_ivas_fx( move16(); set16_fx( code_preQ, 0, L_SUBFR ); shift_wsp = add( Q_new, shift ); #ifdef CLEANUP_ACELP_ENC test(); if ( LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && st_fx->element_mode != EVS_MONO ) #else if ( LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) ) #endif { shift_wsp = sub( shift_wsp, 1 ); } Loading @@ -547,7 +557,21 @@ Word16 encod_tran_ivas_fx( Copy( &res_fx[i_subfr], &exc_fx[i_subfr], L_SUBFR ); /* Q_new */ #ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { find_targets_fx( speech_fx, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, res_fx, L_SUBFR, p_Aw, st_fx->preemph_fac, xn, cn, h1 ); Copy_Scale_sig( h1, h2_fx, L_SUBFR, -2 ); Scale_sig( h1, L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */ /* scaling of xn[] to limit dynamic at 12 bits */ Scale_sig( xn, L_SUBFR, shift ); } ELSE #endif { find_targets_ivas_fx( speech_fx, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, res_fx, L_SUBFR, p_Aw, st_fx->preemph_fac, xn, cn, h1 ); Loading @@ -561,8 +585,10 @@ Word16 encod_tran_ivas_fx( } Copy_Scale_sig( h1, h2_fx, L_SUBFR, sub( 11, q_h1 ) ); /*Q11*/ Scale_sig( h1, L_SUBFR, add( sub( 14, q_h1 ), shift ) ); /* scaling of xn[] to limit dynamic at 12 bits */ Scale_sig( xn, L_SUBFR, shift ); } /*-----------------------------------------------------------------* * TC: subframe determination & Loading Loading @@ -646,7 +672,14 @@ Word16 encod_tran_ivas_fx( gcode16 = round_fx_sat( Lgcode ); #ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { hLPDmem->tilt_code = Est_tilt2( &exc_fx[i_subfr], gain_pit, code, Lgcode, &voice_fac, shift ); /* Q15 */ } ELSE { hLPDmem->tilt_code = est_tilt_fx( &exc_fx[i_subfr], gain_pit, code, gain_code, &voice_fac, Q_new, L_SUBFR ); // Q15 } move16(); #else hLPDmem->tilt_code = est_tilt_ivas_fx( &exc_fx[i_subfr], gain_pit, code, gain_code, &voice_fac, Q_new, L_SUBFR, 0 ); // Q15 Loading @@ -657,7 +690,16 @@ Word16 encod_tran_ivas_fx( *-----------------------------------------------------------------*/ /*st->mem_w0 = xn[L_SUBFR-1] - (gain_pit*y1[L_SUBFR-1]) - (gain_code*y2[L_SUBFR-1]);*/ #ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { L_tmp = L_mult( gcode16, y2[L_SUBFR - 1] ); /* Q10 + Q_new */ } ELSE #endif { L_tmp = L_mult0( gcode16, y2[L_SUBFR - 1] ); } L_tmp = L_shl( L_tmp, add( 5, shift ) ); // Q_new+14+shift L_tmp = L_negate( L_tmp ); L_tmp = L_mac( L_tmp, xn[L_SUBFR - 1], 16384 ); // Q_new-1+15+shift Loading @@ -680,7 +722,7 @@ Word16 encod_tran_ivas_fx( { FOR( i = 0; i < L_SUBFR; i++ ) { exc2_fx[i + i_subfr] = round_fx_sat( L_shl_sat( L_mult_sat( gain_pit, exc_fx[i + i_subfr] ), 1 ) ); /* Q_exc */ exc2_fx[i + i_subfr] = round_fx_sat( L_shl_sat( L_mult_sat( gain_pit, exc_fx[i + i_subfr] ), 1 ) ); /* Q_new / Q_exc */ } } ELSE Loading @@ -688,7 +730,7 @@ Word16 encod_tran_ivas_fx( Gain_pitX2 = shl( gain_pit, 1 ); FOR( i = 0; i < L_SUBFR; i++ ) { exc2_fx[i + i_subfr] = mult_r( Gain_pitX2, exc_fx[i + i_subfr] ); /* Q_exc */ exc2_fx[i + i_subfr] = mult_r( Gain_pitX2, exc_fx[i + i_subfr] ); /* Q_new / Q_exc */ } } Loading Loading
lib_com/ivas_prot_fx.h +6 −6 Original line number Diff line number Diff line Loading @@ -2996,7 +2996,7 @@ Word16 ivas_acelp_tcx20_switching_fx( const Word16 flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz */ ); void encod_gen_2sbfr( void encod_gen_2sbfr_fx( Encoder_State *st, /* i/o: state structure */ const Word16 speech[], /* i : input speech */ const Word16 Aw[], /* i : weighted A(z) unquantized for subframes */ Loading @@ -3010,8 +3010,8 @@ void encod_gen_2sbfr( Word16 *bwe_exc, /* o : excitation for SWB TBE */ const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ const Word16 tdm_Pri_pitch_buf[], /* i : pitch values for primary channel */ Word16 Q_new, Word16 shift const Word16 Q_new, /* i : Scaling factor */ const Word16 shift /* i : Shift needed to obtain 12 bits vectors */ ); void acelp_fast_fx( Loading Loading @@ -4489,7 +4489,7 @@ ivas_error signaling_enc_secondary_fx( const Word16 tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag */ ); void tdm_low_rate_enc( void tdm_low_rate_enc_fx( Encoder_State *st, /* i/o: State structure */ const Word16 Aq[], /* i : 12k8 Lp coefficient */ const Word16 *res, /* i : residual signal Q_new*/ Loading @@ -4501,7 +4501,7 @@ void tdm_low_rate_enc( const Word16 attack_flag, /* i : attack flag */ const Word16 *lsf_new, /* i : current frame ISF vector x2.56 */ Word16 *tmp_noise, /* o : long-term noise energy Q8 */ Word16 Q_new const Word16 Q_new /* i : Scaling factor */ ); void tdm_low_rate_dec_fx( Loading
lib_enc/acelp_core_enc_fx.c +7 −2 Original line number Diff line number Diff line Loading @@ -499,8 +499,13 @@ ivas_error acelp_core_enc_fx( } ELSE IF( EQ_16( coder_type, TRANSITION ) ) { #ifdef CLEANUP_ACELP_ENC tc_subfr_fx = encod_tran_ivas_fx( st_fx, inp_fx, Aw_fx, Aq_fx, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf_fx, voice_factors_fx, bwe_exc_fx, tc_subfr_fx, position, unbits_fx, shift, Q_new ); /* Q0 */ #else tc_subfr_fx = encod_tran_fx( st_fx, inp_fx, Aw_fx, Aq_fx, Es_pred_fx, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf_fx, voice_factors_fx, bwe_exc_fx, tc_subfr_fx, position, unbits_fx, shift, Q_new ); /* Q0 */ #endif } ELSE IF( hSC_VBR->ppp_mode ) { Loading Loading @@ -1344,11 +1349,11 @@ ivas_error acelp_core_enc_ivas_fx( { IF( LE_16( st->coder_type, UNVOICED ) ) { tdm_low_rate_enc( st, Aq, res_fx, syn_fx, exc_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, 0 /*attack_flag*/, lsf_new_fx, &tmp_noise_fx, Q_new ); tdm_low_rate_enc_fx( st, Aq, res_fx, syn_fx, exc_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, 0 /*attack_flag*/, lsf_new_fx, &tmp_noise_fx, Q_new ); } ELSE /* GENERIC */ { encod_gen_2sbfr( st, inp, Aw, Aq, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, Q_new, 0 ); encod_gen_2sbfr_fx( st, inp, Aw, Aq, res_fx, syn_fx, exc_fx, exc2_fx, pitch_buf, voice_factors_fx, bwe_exc_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf_fx, Q_new, 0 ); } } ELSE IF( nelp_mode ) Loading
lib_enc/enc_gen_voic_fx.c +7 −2 Original line number Diff line number Diff line Loading @@ -466,8 +466,9 @@ void encod_gen_voic_ivas_fx( Word16 *unbits_fx, /* i/o: number of unused bits Q0*/ const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag Q0*/ const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer Q6*/ Word16 shift, Word16 Q_new ) const Word16 shift, /* i : Shift needed to obtain 12 bits vectors */ const Word16 Q_new /* i : Scaling factor */ ) { Word16 xn_fx[L_SUBFR]; /* Target vector for pitch search */ Word16 xn2_fx[L_SUBFR]; /* Target vector for codebook search */ Loading Loading @@ -612,6 +613,7 @@ void encod_gen_voic_ivas_fx( Copy_Scale_sig( h1_fx, h2_fx, L_SUBFR, -2 ); /*Q11*/ Scale_sig( h1_fx, L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution Q(14+shift)*/ /* scaling of xn[] to limit dynamic at 12 bits */ Scale_sig( xn_fx, L_SUBFR, shift ); } Loading @@ -624,8 +626,10 @@ void encod_gen_voic_ivas_fx( q_h1 = sub( 14, norm_s( h1_fx[0] ) ); Copy_Scale_sig( h1_fx, h2_fx, L_SUBFR, sub( 11, q_h1 ) ); /*Q11*/ Scale_sig( h1_fx, L_SUBFR, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14*/ /* scaling of xn[] to limit dynamic at 12 bits */ Scale_sig( xn_fx, L_SUBFR, shift ); test(); test(); IF( Es_pred_fx < 0 && LE_16( i_subfr_fx, L_SUBFR ) && NE_16( st_fx->last_core, ACELP_CORE ) ) Loading Loading @@ -908,6 +912,7 @@ void encod_gen_voic_ivas_fx( push_indice( hBstr, IND_UNUSED, 0, i ); unbits_PI_fx -= i; } IF( st_fx->Opt_SC_VBR ) { /* SC-VBR */ Loading
lib_enc/enc_ppp_fx.c +7 −7 Original line number Diff line number Diff line /*==================================================================================== EVS Codec 3GPP TS26.452 Nov 04, 2021. Version 16.4.0 ====================================================================================*/ #include <stdint.h> #include "options.h" /* Compilation switches */ #include "cnst.h" /* Common constants */ //#include "prot_fx.h" /* Function prototypes */ #include "rom_com.h" /* Common constants */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ #include "basop_util.h" /* Function prototypes */ /*Temporary location to be move in prot* when merge is done */ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ); /*=======================================================================================*/ /* FUNCTION : encod_ppp_fx() */ Loading Loading @@ -51,6 +49,7 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m ); /*---------------------------------------------------------------------------------------*/ /* CALLED FROM : TX */ /*=======================================================================================*/ ivas_error encod_ppp_fx( Encoder_State *st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : input speech Q_new*/ Loading @@ -63,8 +62,9 @@ ivas_error encod_ppp_fx( Word16 *pitch_buf_fx, /* o : floating pitch values for each subframe Q6*/ Word16 *voice_factors, /* o : voicing factors Q15*/ Word16 *bwe_exc, /* o : excitation for SWB TBE Q_new*/ Word16 Q_new, Word16 shift ) const Word16 Q_new, /* i : Scaling factor */ const Word16 shift /* i : Shift needed to obtain 12 bits vectors */ ) { Word16 xn_fx[L_SUBFR]; /* Target vector for pitch search */ Word16 h1_fx[L_SUBFR + ( M + 1 )]; /* Impulse response vector */ Loading
lib_enc/enc_tran_fx.c +61 −19 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ /* RETURN ARGUMENTS : */ /* _ None */ /*---------------------------------------------------------------------------------*/ #ifndef CLEANUP_ACELP_ENC Word16 encod_tran_fx( Encoder_State *st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : input speech Q0*/ Loading Loading @@ -422,9 +422,13 @@ Word16 encod_tran_fx( return tc_subfr; } #endif #ifdef CLEANUP_ACELP_ENC Word16 encod_tran_ivas_fx( #else Word16 encod_tran_ivas_fx( #endif Encoder_State *st_fx, /* i/o: state structure */ const Word16 speech_fx[], /* i : input speech Q0*/ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes Q12*/ Loading Loading @@ -485,8 +489,9 @@ Word16 encod_tran_ivas_fx( L_frame_fx = st_fx->L_frame; move16(); #ifndef CLEANUP_ACELP_ENC set16_fx( h1, 0, L_SUBFR + ( M + 1 ) ); #endif /*------------------------------------------------------------------* * Initializations *------------------------------------------------------------------*/ Loading Loading @@ -528,7 +533,12 @@ Word16 encod_tran_ivas_fx( move16(); set16_fx( code_preQ, 0, L_SUBFR ); shift_wsp = add( Q_new, shift ); #ifdef CLEANUP_ACELP_ENC test(); if ( LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && st_fx->element_mode != EVS_MONO ) #else if ( LT_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) ) #endif { shift_wsp = sub( shift_wsp, 1 ); } Loading @@ -547,7 +557,21 @@ Word16 encod_tran_ivas_fx( Copy( &res_fx[i_subfr], &exc_fx[i_subfr], L_SUBFR ); /* Q_new */ #ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { find_targets_fx( speech_fx, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, res_fx, L_SUBFR, p_Aw, st_fx->preemph_fac, xn, cn, h1 ); Copy_Scale_sig( h1, h2_fx, L_SUBFR, -2 ); Scale_sig( h1, L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */ /* scaling of xn[] to limit dynamic at 12 bits */ Scale_sig( xn, L_SUBFR, shift ); } ELSE #endif { find_targets_ivas_fx( speech_fx, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, res_fx, L_SUBFR, p_Aw, st_fx->preemph_fac, xn, cn, h1 ); Loading @@ -561,8 +585,10 @@ Word16 encod_tran_ivas_fx( } Copy_Scale_sig( h1, h2_fx, L_SUBFR, sub( 11, q_h1 ) ); /*Q11*/ Scale_sig( h1, L_SUBFR, add( sub( 14, q_h1 ), shift ) ); /* scaling of xn[] to limit dynamic at 12 bits */ Scale_sig( xn, L_SUBFR, shift ); } /*-----------------------------------------------------------------* * TC: subframe determination & Loading Loading @@ -646,7 +672,14 @@ Word16 encod_tran_ivas_fx( gcode16 = round_fx_sat( Lgcode ); #ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { hLPDmem->tilt_code = Est_tilt2( &exc_fx[i_subfr], gain_pit, code, Lgcode, &voice_fac, shift ); /* Q15 */ } ELSE { hLPDmem->tilt_code = est_tilt_fx( &exc_fx[i_subfr], gain_pit, code, gain_code, &voice_fac, Q_new, L_SUBFR ); // Q15 } move16(); #else hLPDmem->tilt_code = est_tilt_ivas_fx( &exc_fx[i_subfr], gain_pit, code, gain_code, &voice_fac, Q_new, L_SUBFR, 0 ); // Q15 Loading @@ -657,7 +690,16 @@ Word16 encod_tran_ivas_fx( *-----------------------------------------------------------------*/ /*st->mem_w0 = xn[L_SUBFR-1] - (gain_pit*y1[L_SUBFR-1]) - (gain_code*y2[L_SUBFR-1]);*/ #ifdef CLEANUP_ACELP_ENC IF( st_fx->element_mode == EVS_MONO ) { L_tmp = L_mult( gcode16, y2[L_SUBFR - 1] ); /* Q10 + Q_new */ } ELSE #endif { L_tmp = L_mult0( gcode16, y2[L_SUBFR - 1] ); } L_tmp = L_shl( L_tmp, add( 5, shift ) ); // Q_new+14+shift L_tmp = L_negate( L_tmp ); L_tmp = L_mac( L_tmp, xn[L_SUBFR - 1], 16384 ); // Q_new-1+15+shift Loading @@ -680,7 +722,7 @@ Word16 encod_tran_ivas_fx( { FOR( i = 0; i < L_SUBFR; i++ ) { exc2_fx[i + i_subfr] = round_fx_sat( L_shl_sat( L_mult_sat( gain_pit, exc_fx[i + i_subfr] ), 1 ) ); /* Q_exc */ exc2_fx[i + i_subfr] = round_fx_sat( L_shl_sat( L_mult_sat( gain_pit, exc_fx[i + i_subfr] ), 1 ) ); /* Q_new / Q_exc */ } } ELSE Loading @@ -688,7 +730,7 @@ Word16 encod_tran_ivas_fx( Gain_pitX2 = shl( gain_pit, 1 ); FOR( i = 0; i < L_SUBFR; i++ ) { exc2_fx[i + i_subfr] = mult_r( Gain_pitX2, exc_fx[i + i_subfr] ); /* Q_exc */ exc2_fx[i + i_subfr] = mult_r( Gain_pitX2, exc_fx[i + i_subfr] ); /* Q_new / Q_exc */ } } Loading