Loading lib_enc/acelp_core_switch_enc_fx.c +7 −16 Original line number Diff line number Diff line Loading @@ -400,14 +400,9 @@ static void encod_gen_voic_core_switch_fx( * Close-loop pitch search and quantization * Adaptive exc. construction *----------------------------------------------------------------*/ set16_fx( dummyF, -1, NB_SUBFR16k ); /* hack to signal ACELP->HQ switching frame */ pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/ #if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif ); /* Q6 */ pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/, st_fx->element_mode, Q_new ); /* Q6 */ /*-----------------------------------------------------------------* * Find adaptive exitation Loading Loading @@ -612,14 +607,10 @@ static void encod_gen_voic_core_switch_ivas_fx( * Close-loop pitch search and quantization * Adaptive exc. construction *----------------------------------------------------------------*/ set16_fx( dummyF, -1, NB_SUBFR16k ); /* hack to signal ACELP->HQ switching frame */ pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/ #if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif ); /* Q6 */ pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/, st_fx->element_mode, Q_new ); /* Q6 */ /*-----------------------------------------------------------------* * Find adaptive exitation *-----------------------------------------------------------------*/ Loading lib_enc/enc_amr_wb_fx.c +9 −8 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ void encod_amr_wb_fx( * target in residual domain "cn" * Compute impulse response, h1[], of weighted synthesis filter *----------------------------------------------------------------*/ Copy( &res[i_subfr], &exc[i_subfr], L_SUBFR ); /*Q_new*/ find_targets_fx( speech, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, Loading @@ -146,12 +147,7 @@ void encod_amr_wb_fx( *----------------------------------------------------------------*/ *pt_pitch = pit_encode_fx( hBstr, st->acelp_cfg.pitch_bits, st->core_brate, 1, L_FRAME, -1, &pitch_limit_flag, i_subfr, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, NULL /*hStereoTD->tdm_Pri_pitch_buf*/ #if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0, Q_new #endif ); L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, NULL /*hStereoTD->tdm_Pri_pitch_buf*/, 0, Q_new ); /*-----------------------------------------------------------------* * Find adaptive exitation Loading @@ -170,8 +166,7 @@ void encod_amr_wb_fx( * LP filtering of the adaptive excitation, codebook target computation *-----------------------------------------------------------------*/ lp_select = lp_filt_exc_enc_fx( MODE1, -1, i_subfr, exc, h1, xn, y1, xn2, L_SUBFR, L_FRAME, g_corr, clip_gain, &gain_pit, &lp_flag ); lp_select = lp_filt_exc_enc_fx( MODE1, -1, i_subfr, exc, h1, xn, y1, xn2, L_SUBFR, L_FRAME, g_corr, clip_gain, &gain_pit, &lp_flag ); IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { Loading @@ -181,13 +176,16 @@ void encod_amr_wb_fx( /*-----------------------------------------------------------------* * Innovation encoding *-----------------------------------------------------------------*/ inov_encode_fx( st, st->core_brate, 1, L_FRAME, st->last_L_frame, -1, -1, 0, i_subfr, -1, p_Aq, gain_pit, cn, exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits, L_SUBFR, shift ); /*-----------------------------------------------------------------* * Gain encoding * Pitch gain clipping test * Estimate spectrum tilt and voicing *-----------------------------------------------------------------*/ gain_enc_amr_wb_fx( hBstr, xn, shift_wsp, y1, y2, code, st->core_brate, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain, hAmrwb_IO->past_qua_en_fx ); Loading Loading @@ -216,9 +214,11 @@ void encod_amr_wb_fx( Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); /* Q_new+15 */ hLPDmem->mem_w0 = round_fx_sat( Ltmp ); /*Q_new-1 */ move16(); /*-----------------------------------------------------------------* * Find the total excitation *-----------------------------------------------------------------*/ FOR( i = 0; i < L_SUBFR; i++ ) { L_tmp = L_mult( gcode16, code[i] ); /*Q10*/ Loading @@ -233,6 +233,7 @@ void encod_amr_wb_fx( * Synthesize speech to update mem_syn[] * Update A(z) filters *-----------------------------------------------------------------*/ Syn_filt_s( 1, p_Aq, M, &exc[i_subfr], &syn[i_subfr], L_SUBFR, hLPDmem->mem_syn, 1 ); /*-----------------------------------------------------------------* Loading lib_enc/enc_gen_voic_fx.c +10 −14 Original line number Diff line number Diff line Loading @@ -202,6 +202,7 @@ void encod_gen_voic_fx( /* set and write harmonicity flag */ harm_flag_acelp = 0; move16(); test(); test(); IF( GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && LE_32( st_fx->core_brate, MAX_BRATE_AVQ_EXC_TD ) && EQ_16( st_fx->coder_type, GENERIC ) ) Loading Loading @@ -244,12 +245,8 @@ void encod_gen_voic_fx( *----------------------------------------------------------------*/ *pt_pitch_fx = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx, L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf #if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif ); /* Q6 */ L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st_fx->element_mode, Q_new ); /* Q6 */ tbe_celp_exc( L_frame, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx ); /*-----------------------------------------------------------------* Loading Loading @@ -395,6 +392,7 @@ void encod_gen_voic_fx( * Construct adaptive part of the excitation * Save the non-enhanced excitation for FEC_exc *-----------------------------------------------------------------*/ FOR( i = 0; i < L_SUBFR; i++ ) { /* code in Q9, gain_pit in Q14 */ Loading Loading @@ -535,7 +533,6 @@ void encod_gen_voic_ivas_fx( L_frame = st_fx->L_frame; move16(); IF( EQ_16( L_frame, L_FRAME ) ) { T0_max_fx = PIT_MAX; Loading Loading @@ -568,9 +565,11 @@ void encod_gen_voic_ivas_fx( { shift_wsp = sub( shift_wsp, 1 ); } /* set and write harmonicity flag */ harm_flag_acelp = 0; move16(); test(); test(); IF( GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && LE_32( st_fx->core_brate, MAX_BRATE_AVQ_EXC_TD ) && EQ_16( st_fx->coder_type, GENERIC ) ) Loading Loading @@ -621,12 +620,7 @@ void encod_gen_voic_ivas_fx( *----------------------------------------------------------------*/ *pt_pitch_fx = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx, L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf #if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif ); /* Q6 */ L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st_fx->element_mode, Q_new ); /* Q6 */ move16(); tbe_celp_exc_ivas( st_fx->element_mode, st_fx->idchan, L_frame, L_SUBFR, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx, st_fx->tdm_LRTD_flag ); Loading @@ -653,6 +647,7 @@ void encod_gen_voic_ivas_fx( /*-----------------------------------------------------------------* * LP filtering of the adaptive excitation, codebook target computation *-----------------------------------------------------------------*/ lp_select = lp_filt_exc_enc_fx( MODE1, st_fx->coder_type, i_subfr_fx, exc_fx, h1_fx, xn_fx, y1_fx, xn2_fx, L_SUBFR, L_frame, g_corr_fx, clip_gain_fx, &gain_pit_fx, &lp_flag ); Loading Loading @@ -683,6 +678,7 @@ void encod_gen_voic_ivas_fx( /*-----------------------------------------------------------------* * Gain encoding *-----------------------------------------------------------------*/ IF( LE_32( st_fx->core_brate, ACELP_8k00 ) ) { gain_enc_lbr_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->coder_type, i_subfr_fx, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx, Loading Loading @@ -731,7 +727,6 @@ void encod_gen_voic_ivas_fx( * Update memory of the weighting filter *-----------------------------------------------------------------*/ /*At this point xn has to be in Qnew yn has to be in Qnew Loading Loading @@ -786,6 +781,7 @@ void encod_gen_voic_ivas_fx( * Construct adaptive part of the excitation * Save the non-enhanced excitation for FEC_exc *-----------------------------------------------------------------*/ FOR( i = 0; i < L_SUBFR; i++ ) { /* code in Q9, gain_pit in Q14 */ Loading lib_enc/enc_pit_exc_fx.c +36 −20 Original line number Diff line number Diff line /*==================================================================================== EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 ====================================================================================*/ #include <stdint.h> #include "options.h" /* Compilation switches */ #include "cnst.h" /* Common constants */ Loading Loading @@ -45,6 +46,7 @@ /* RETURN ARGUMENTS : */ /* _ None */ /*=======================================================================*/ void enc_pit_exc_fx( Encoder_State *st_fx, /* i/o: State structure */ const Word16 *speech, /* i : Input speech Q_new-1*/ Loading Loading @@ -157,7 +159,6 @@ void enc_pit_exc_fx( } ELSE { Local_BR = ACELP_7k20; move32(); Pitch_BR = st_fx->core_brate; /* Q0 */ Loading Loading @@ -228,6 +229,7 @@ void enc_pit_exc_fx( /*------------------------------------------------------------------* * ACELP subframe loop *------------------------------------------------------------------*/ cn = NULL; if ( EQ_16( L_subfr, L_SUBFR ) ) { Loading @@ -239,6 +241,7 @@ void enc_pit_exc_fx( p_Aq = Aq; pt_pitch = pitch_buf; /* pointer to the pitch buffer */ shift_wsp = add( Q_new, shift ); FOR( i_subfr = 0; i_subfr < st_fx->L_frame; i_subfr += L_subfr ) { Loading @@ -248,6 +251,7 @@ void enc_pit_exc_fx( * target in residual domain "cn" * Compute impulse response, h1[], of weighted synthesis filter *----------------------------------------------------------------*/ Copy( &res[i_subfr], &exc[i_subfr], L_subfr ); /* Q_new */ /* condition on target (compared to float) has been put outside the loop */ find_targets_fx( speech, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, Loading @@ -262,13 +266,10 @@ void enc_pit_exc_fx( * Close-loop pitch search and quantization * Adaptive exc. construction *----------------------------------------------------------------*/ *pt_pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, Pitch_BR, 0, st_fx->L_frame, Pitch_CT, &pitch_limit_flag, i_subfr, exc, L_subfr, st_fx->pitch, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf #if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif ); /* Q6 */ L_subfr, st_fx->pitch, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st_fx->element_mode, Q_new ); /* Q6 */ /*-----------------------------------------------------------------* * Find adaptive exitation *-----------------------------------------------------------------*/ Loading @@ -286,8 +287,7 @@ void enc_pit_exc_fx( * (No LP filtering of the adaptive excitation) *-----------------------------------------------------------------*/ lp_select = lp_filt_exc_enc_fx( MODE1, AUDIO, i_subfr, exc, h1, xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ lp_select = lp_filt_exc_enc_fx( MODE1, AUDIO, i_subfr, exc, h1, xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { Loading Loading @@ -320,7 +320,7 @@ void enc_pit_exc_fx( push_indice( hBstr, IND_PIT_IDX, pit_idx, 4 ); } } else if ( use_fcb == 2 ) ELSE IF( use_fcb == 2 ) { /*-----------------------------------------------------------------* * Innovation encoding Loading @@ -344,9 +344,11 @@ void enc_pit_exc_fx( inov_encode_fx( st_fx, Local_BR, 0, st_fx->L_frame, st_fx->last_L_frame, LOCAL_CT, WB, 1, i_subfr, -1, p_Aq, gain_pit, cn, exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, L_SUBFR, shift ); /*-----------------------------------------------------------------* * Gain encoding *-----------------------------------------------------------------*/ gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_FRAME, i_subfr, -1, xn, y1, shift_wsp, y2, code, Es_pred, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain ); } Loading @@ -364,9 +366,11 @@ void enc_pit_exc_fx( hLPDmem->tilt_code = 0; move16(); } /*-----------------------------------------------------------------* * Update memory of the weighting filter *-----------------------------------------------------------------*/ IF( use_fcb != 0 ) { Ltmp = L_mult( gcode16, y2[L_subfr - 1] ); /* Q10 + Q_new */ Loading @@ -391,6 +395,7 @@ void enc_pit_exc_fx( * Construct adaptive part of the excitation * Save the non-enhanced excitation for FEC_exc *-----------------------------------------------------------------*/ IF( use_fcb != 0 ) { FOR( i = 0; i < L_subfr; i++ ) Loading Loading @@ -525,8 +530,11 @@ void enc_pit_exc_fx( cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ *gpit = round_fx( L_mac( L_mult( 3277, *gpit ), 29491, cum_gpit ) ); /*Q15*/ return; } void enc_pit_exc_ivas_fx( Encoder_State *st_fx, /* i/o: State structure */ const Word16 *speech, /* i : Input speech Q_new-1*/ Loading Loading @@ -710,11 +718,12 @@ void enc_pit_exc_ivas_fx( /*------------------------------------------------------------------* * ACELP subframe loop *------------------------------------------------------------------*/ p_Aw = Aw; p_Aw = Aw; p_Aq = Aq; pt_pitch = pitch_buf; /* pointer to the pitch buffer */ shift_wsp = add( Q_new, shift ); FOR( i_subfr = 0; i_subfr < st_fx->L_frame; i_subfr += L_subfr ) { Loading @@ -740,13 +749,10 @@ void enc_pit_exc_ivas_fx( * Close-loop pitch search and quantization * Adaptive exc. construction *----------------------------------------------------------------*/ *pt_pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, Pitch_BR, 0, st_fx->L_frame, Pitch_CT, &pitch_limit_flag, i_subfr, exc, L_subfr, st_fx->pitch, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf #if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif ); /* Q6 */ L_subfr, st_fx->pitch, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st_fx->element_mode, Q_new ); /* Q6 */ Scale_sig( h1, L_subfr, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14*/ /*-----------------------------------------------------------------* Loading @@ -754,6 +760,7 @@ void enc_pit_exc_ivas_fx( *-----------------------------------------------------------------*/ pred_lt4_ivas_fx( &exc[i_subfr], &exc[i_subfr], *T0, *T0_frac, L_subfr + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); /*-----------------------------------------------------------------* * Gain clipping test to avoid unstable synthesis on frame erasure * or in case of floating point encoder & fixed p. decoder Loading @@ -765,8 +772,9 @@ void enc_pit_exc_ivas_fx( * Codebook target computation * (No LP filtering of the adaptive excitation) *-----------------------------------------------------------------*/ lp_select = lp_filt_exc_enc_fx( MODE1, AUDIO, i_subfr, exc, h1, xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ lp_select = lp_filt_exc_enc_fx( MODE1, AUDIO, i_subfr, exc, h1, xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); Loading Loading @@ -797,7 +805,7 @@ void enc_pit_exc_ivas_fx( push_indice( hBstr, IND_PIT_IDX, pit_idx, 4 ); } } else if ( use_fcb == 2 ) ELSE IF( use_fcb == 2 ) { /*-----------------------------------------------------------------* * Innovation encoding Loading @@ -821,12 +829,15 @@ void enc_pit_exc_ivas_fx( inov_encode_ivas_fx( st_fx, Local_BR, 0, st_fx->L_frame, st_fx->last_L_frame, LOCAL_CT, WB, 1, i_subfr, -1, p_Aq, gain_pit, cn, exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, L_SUBFR, shift, Q_new ); /*-----------------------------------------------------------------* * Gain encoding *-----------------------------------------------------------------*/ gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, st_fx->L_frame, i_subfr, -1, xn, y1, sub( shift_wsp, 1 ), y2, code, Es_pred, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain ); } gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit, st_fx->clip_var_fx ); Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/ Loading @@ -841,9 +852,11 @@ void enc_pit_exc_ivas_fx( hLPDmem->tilt_code = 0; move16(); } /*-----------------------------------------------------------------* * Update memory of the weighting filter *-----------------------------------------------------------------*/ IF( use_fcb != 0 ) { Ltmp = L_mult0( gcode16, y2[L_subfr - 1] ); Loading @@ -866,6 +879,7 @@ void enc_pit_exc_ivas_fx( * Construct adaptive part of the excitation * Save the non-enhanced excitation for FEC_exc *-----------------------------------------------------------------*/ IF( use_fcb != 0 ) { FOR( i = 0; i < L_subfr; i++ ) Loading Loading @@ -1001,4 +1015,6 @@ void enc_pit_exc_ivas_fx( cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ *gpit = round_fx( L_mac( L_mult( 3277, *gpit ), 29491, cum_gpit ) ); /*Q15*/ return; } lib_enc/ivas_td_low_rate_enc_fx.c +7 −6 Original line number Diff line number Diff line Loading @@ -163,6 +163,7 @@ void tdm_low_rate_enc( /*--------------------------------------------------------------------------------------* * Updates *--------------------------------------------------------------------------------------*/ Copy( exc_wo_nf_fx, exc_fx, L_FRAME ); /* Q_new */ return; Loading Loading @@ -274,12 +275,8 @@ void encod_gen_2sbfr( * Close-loop pitch search on the 1st and 3rd subfr only and quantization * Adaptive exc. construction *------------------------------------------------------------------------*/ *pt_pitch = pit_encode_fx( st->hBstr, st->acelp_cfg.pitch_bits, st->core_brate, 0, L_frame, coder_type, &pitch_limit_flag, i_subfr, exc, 2 * L_SUBFR, st->pitch, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf #if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st->element_mode, Q_new #endif ); *pt_pitch = pit_encode_fx( st->hBstr, st->acelp_cfg.pitch_bits, st->core_brate, 0, L_frame, coder_type, &pitch_limit_flag, i_subfr, exc, 2 * L_SUBFR, st->pitch, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st->element_mode, Q_new ); move16(); Scale_sig( h1, 2 * L_SUBFR, sub( 13, q_h1 ) ); // Q13 Loading @@ -297,12 +294,15 @@ void encod_gen_2sbfr( *-----------------------------------------------------------------*/ clip_gain = gp_clip_fx( st->element_mode, st->core_brate, st->voicing_fx, i_subfr, coder_type, xn, st->clip_var_fx, sub( Q_new, 1 ) ); // Q0 /*-----------------------------------------------------------------* * LP filtering of the adaptive excitation, codebook target computation *-----------------------------------------------------------------*/ Scale_sig( h1, 2 * L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */ lp_filt_exc_enc_fx( MODE1, coder_type, i_subfr, exc, h1, xn, y1, xn2, 2 * L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &st->acelp_cfg.ltf_mode ); /* update long-term pitch gain for speech/music classifier */ st->hSpMusClas->lowrate_pitchGain = add( mult( 29491, st->hSpMusClas->lowrate_pitchGain ), mult( 3277 /*Q15*/, gain_pit ) ); // Q14 move16(); Loading @@ -319,6 +319,7 @@ void encod_gen_2sbfr( gain_enc_lbr_fx( st->hBstr, st->acelp_cfg.gains_mode, coder_type, i_subfr, xn, y1, add( sub( Q_new, 1 ), shift ), y2, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, gc_mem, gp_mem, clip_gain, 2 * L_SUBFR, st->element_mode ); IF( st->Opt_SC_VBR ) { if ( EQ_16( st->hSC_VBR->last_ppp_mode, 1 ) ) Loading Loading
lib_enc/acelp_core_switch_enc_fx.c +7 −16 Original line number Diff line number Diff line Loading @@ -400,14 +400,9 @@ static void encod_gen_voic_core_switch_fx( * Close-loop pitch search and quantization * Adaptive exc. construction *----------------------------------------------------------------*/ set16_fx( dummyF, -1, NB_SUBFR16k ); /* hack to signal ACELP->HQ switching frame */ pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/ #if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif ); /* Q6 */ pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/, st_fx->element_mode, Q_new ); /* Q6 */ /*-----------------------------------------------------------------* * Find adaptive exitation Loading Loading @@ -612,14 +607,10 @@ static void encod_gen_voic_core_switch_ivas_fx( * Close-loop pitch search and quantization * Adaptive exc. construction *----------------------------------------------------------------*/ set16_fx( dummyF, -1, NB_SUBFR16k ); /* hack to signal ACELP->HQ switching frame */ pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/ #if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif ); /* Q6 */ pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/, st_fx->element_mode, Q_new ); /* Q6 */ /*-----------------------------------------------------------------* * Find adaptive exitation *-----------------------------------------------------------------*/ Loading
lib_enc/enc_amr_wb_fx.c +9 −8 Original line number Diff line number Diff line Loading @@ -129,6 +129,7 @@ void encod_amr_wb_fx( * target in residual domain "cn" * Compute impulse response, h1[], of weighted synthesis filter *----------------------------------------------------------------*/ Copy( &res[i_subfr], &exc[i_subfr], L_SUBFR ); /*Q_new*/ find_targets_fx( speech, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, Loading @@ -146,12 +147,7 @@ void encod_amr_wb_fx( *----------------------------------------------------------------*/ *pt_pitch = pit_encode_fx( hBstr, st->acelp_cfg.pitch_bits, st->core_brate, 1, L_FRAME, -1, &pitch_limit_flag, i_subfr, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, NULL /*hStereoTD->tdm_Pri_pitch_buf*/ #if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , 0, Q_new #endif ); L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, NULL /*hStereoTD->tdm_Pri_pitch_buf*/, 0, Q_new ); /*-----------------------------------------------------------------* * Find adaptive exitation Loading @@ -170,8 +166,7 @@ void encod_amr_wb_fx( * LP filtering of the adaptive excitation, codebook target computation *-----------------------------------------------------------------*/ lp_select = lp_filt_exc_enc_fx( MODE1, -1, i_subfr, exc, h1, xn, y1, xn2, L_SUBFR, L_FRAME, g_corr, clip_gain, &gain_pit, &lp_flag ); lp_select = lp_filt_exc_enc_fx( MODE1, -1, i_subfr, exc, h1, xn, y1, xn2, L_SUBFR, L_FRAME, g_corr, clip_gain, &gain_pit, &lp_flag ); IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { Loading @@ -181,13 +176,16 @@ void encod_amr_wb_fx( /*-----------------------------------------------------------------* * Innovation encoding *-----------------------------------------------------------------*/ inov_encode_fx( st, st->core_brate, 1, L_FRAME, st->last_L_frame, -1, -1, 0, i_subfr, -1, p_Aq, gain_pit, cn, exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits, L_SUBFR, shift ); /*-----------------------------------------------------------------* * Gain encoding * Pitch gain clipping test * Estimate spectrum tilt and voicing *-----------------------------------------------------------------*/ gain_enc_amr_wb_fx( hBstr, xn, shift_wsp, y1, y2, code, st->core_brate, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain, hAmrwb_IO->past_qua_en_fx ); Loading Loading @@ -216,9 +214,11 @@ void encod_amr_wb_fx( Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); /* Q_new+15 */ hLPDmem->mem_w0 = round_fx_sat( Ltmp ); /*Q_new-1 */ move16(); /*-----------------------------------------------------------------* * Find the total excitation *-----------------------------------------------------------------*/ FOR( i = 0; i < L_SUBFR; i++ ) { L_tmp = L_mult( gcode16, code[i] ); /*Q10*/ Loading @@ -233,6 +233,7 @@ void encod_amr_wb_fx( * Synthesize speech to update mem_syn[] * Update A(z) filters *-----------------------------------------------------------------*/ Syn_filt_s( 1, p_Aq, M, &exc[i_subfr], &syn[i_subfr], L_SUBFR, hLPDmem->mem_syn, 1 ); /*-----------------------------------------------------------------* Loading
lib_enc/enc_gen_voic_fx.c +10 −14 Original line number Diff line number Diff line Loading @@ -202,6 +202,7 @@ void encod_gen_voic_fx( /* set and write harmonicity flag */ harm_flag_acelp = 0; move16(); test(); test(); IF( GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && LE_32( st_fx->core_brate, MAX_BRATE_AVQ_EXC_TD ) && EQ_16( st_fx->coder_type, GENERIC ) ) Loading Loading @@ -244,12 +245,8 @@ void encod_gen_voic_fx( *----------------------------------------------------------------*/ *pt_pitch_fx = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx, L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf #if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif ); /* Q6 */ L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st_fx->element_mode, Q_new ); /* Q6 */ tbe_celp_exc( L_frame, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx ); /*-----------------------------------------------------------------* Loading Loading @@ -395,6 +392,7 @@ void encod_gen_voic_fx( * Construct adaptive part of the excitation * Save the non-enhanced excitation for FEC_exc *-----------------------------------------------------------------*/ FOR( i = 0; i < L_SUBFR; i++ ) { /* code in Q9, gain_pit in Q14 */ Loading Loading @@ -535,7 +533,6 @@ void encod_gen_voic_ivas_fx( L_frame = st_fx->L_frame; move16(); IF( EQ_16( L_frame, L_FRAME ) ) { T0_max_fx = PIT_MAX; Loading Loading @@ -568,9 +565,11 @@ void encod_gen_voic_ivas_fx( { shift_wsp = sub( shift_wsp, 1 ); } /* set and write harmonicity flag */ harm_flag_acelp = 0; move16(); test(); test(); IF( GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && LE_32( st_fx->core_brate, MAX_BRATE_AVQ_EXC_TD ) && EQ_16( st_fx->coder_type, GENERIC ) ) Loading Loading @@ -621,12 +620,7 @@ void encod_gen_voic_ivas_fx( *----------------------------------------------------------------*/ *pt_pitch_fx = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx, L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf #if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif ); /* Q6 */ L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st_fx->element_mode, Q_new ); /* Q6 */ move16(); tbe_celp_exc_ivas( st_fx->element_mode, st_fx->idchan, L_frame, L_SUBFR, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx, st_fx->tdm_LRTD_flag ); Loading @@ -653,6 +647,7 @@ void encod_gen_voic_ivas_fx( /*-----------------------------------------------------------------* * LP filtering of the adaptive excitation, codebook target computation *-----------------------------------------------------------------*/ lp_select = lp_filt_exc_enc_fx( MODE1, st_fx->coder_type, i_subfr_fx, exc_fx, h1_fx, xn_fx, y1_fx, xn2_fx, L_SUBFR, L_frame, g_corr_fx, clip_gain_fx, &gain_pit_fx, &lp_flag ); Loading Loading @@ -683,6 +678,7 @@ void encod_gen_voic_ivas_fx( /*-----------------------------------------------------------------* * Gain encoding *-----------------------------------------------------------------*/ IF( LE_32( st_fx->core_brate, ACELP_8k00 ) ) { gain_enc_lbr_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->coder_type, i_subfr_fx, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx, Loading Loading @@ -731,7 +727,6 @@ void encod_gen_voic_ivas_fx( * Update memory of the weighting filter *-----------------------------------------------------------------*/ /*At this point xn has to be in Qnew yn has to be in Qnew Loading Loading @@ -786,6 +781,7 @@ void encod_gen_voic_ivas_fx( * Construct adaptive part of the excitation * Save the non-enhanced excitation for FEC_exc *-----------------------------------------------------------------*/ FOR( i = 0; i < L_SUBFR; i++ ) { /* code in Q9, gain_pit in Q14 */ Loading
lib_enc/enc_pit_exc_fx.c +36 −20 Original line number Diff line number Diff line /*==================================================================================== EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 ====================================================================================*/ #include <stdint.h> #include "options.h" /* Compilation switches */ #include "cnst.h" /* Common constants */ Loading Loading @@ -45,6 +46,7 @@ /* RETURN ARGUMENTS : */ /* _ None */ /*=======================================================================*/ void enc_pit_exc_fx( Encoder_State *st_fx, /* i/o: State structure */ const Word16 *speech, /* i : Input speech Q_new-1*/ Loading Loading @@ -157,7 +159,6 @@ void enc_pit_exc_fx( } ELSE { Local_BR = ACELP_7k20; move32(); Pitch_BR = st_fx->core_brate; /* Q0 */ Loading Loading @@ -228,6 +229,7 @@ void enc_pit_exc_fx( /*------------------------------------------------------------------* * ACELP subframe loop *------------------------------------------------------------------*/ cn = NULL; if ( EQ_16( L_subfr, L_SUBFR ) ) { Loading @@ -239,6 +241,7 @@ void enc_pit_exc_fx( p_Aq = Aq; pt_pitch = pitch_buf; /* pointer to the pitch buffer */ shift_wsp = add( Q_new, shift ); FOR( i_subfr = 0; i_subfr < st_fx->L_frame; i_subfr += L_subfr ) { Loading @@ -248,6 +251,7 @@ void enc_pit_exc_fx( * target in residual domain "cn" * Compute impulse response, h1[], of weighted synthesis filter *----------------------------------------------------------------*/ Copy( &res[i_subfr], &exc[i_subfr], L_subfr ); /* Q_new */ /* condition on target (compared to float) has been put outside the loop */ find_targets_fx( speech, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, Loading @@ -262,13 +266,10 @@ void enc_pit_exc_fx( * Close-loop pitch search and quantization * Adaptive exc. construction *----------------------------------------------------------------*/ *pt_pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, Pitch_BR, 0, st_fx->L_frame, Pitch_CT, &pitch_limit_flag, i_subfr, exc, L_subfr, st_fx->pitch, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf #if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif ); /* Q6 */ L_subfr, st_fx->pitch, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st_fx->element_mode, Q_new ); /* Q6 */ /*-----------------------------------------------------------------* * Find adaptive exitation *-----------------------------------------------------------------*/ Loading @@ -286,8 +287,7 @@ void enc_pit_exc_fx( * (No LP filtering of the adaptive excitation) *-----------------------------------------------------------------*/ lp_select = lp_filt_exc_enc_fx( MODE1, AUDIO, i_subfr, exc, h1, xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ lp_select = lp_filt_exc_enc_fx( MODE1, AUDIO, i_subfr, exc, h1, xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { Loading Loading @@ -320,7 +320,7 @@ void enc_pit_exc_fx( push_indice( hBstr, IND_PIT_IDX, pit_idx, 4 ); } } else if ( use_fcb == 2 ) ELSE IF( use_fcb == 2 ) { /*-----------------------------------------------------------------* * Innovation encoding Loading @@ -344,9 +344,11 @@ void enc_pit_exc_fx( inov_encode_fx( st_fx, Local_BR, 0, st_fx->L_frame, st_fx->last_L_frame, LOCAL_CT, WB, 1, i_subfr, -1, p_Aq, gain_pit, cn, exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, L_SUBFR, shift ); /*-----------------------------------------------------------------* * Gain encoding *-----------------------------------------------------------------*/ gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_FRAME, i_subfr, -1, xn, y1, shift_wsp, y2, code, Es_pred, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain ); } Loading @@ -364,9 +366,11 @@ void enc_pit_exc_fx( hLPDmem->tilt_code = 0; move16(); } /*-----------------------------------------------------------------* * Update memory of the weighting filter *-----------------------------------------------------------------*/ IF( use_fcb != 0 ) { Ltmp = L_mult( gcode16, y2[L_subfr - 1] ); /* Q10 + Q_new */ Loading @@ -391,6 +395,7 @@ void enc_pit_exc_fx( * Construct adaptive part of the excitation * Save the non-enhanced excitation for FEC_exc *-----------------------------------------------------------------*/ IF( use_fcb != 0 ) { FOR( i = 0; i < L_subfr; i++ ) Loading Loading @@ -525,8 +530,11 @@ void enc_pit_exc_fx( cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ *gpit = round_fx( L_mac( L_mult( 3277, *gpit ), 29491, cum_gpit ) ); /*Q15*/ return; } void enc_pit_exc_ivas_fx( Encoder_State *st_fx, /* i/o: State structure */ const Word16 *speech, /* i : Input speech Q_new-1*/ Loading Loading @@ -710,11 +718,12 @@ void enc_pit_exc_ivas_fx( /*------------------------------------------------------------------* * ACELP subframe loop *------------------------------------------------------------------*/ p_Aw = Aw; p_Aw = Aw; p_Aq = Aq; pt_pitch = pitch_buf; /* pointer to the pitch buffer */ shift_wsp = add( Q_new, shift ); FOR( i_subfr = 0; i_subfr < st_fx->L_frame; i_subfr += L_subfr ) { Loading @@ -740,13 +749,10 @@ void enc_pit_exc_ivas_fx( * Close-loop pitch search and quantization * Adaptive exc. construction *----------------------------------------------------------------*/ *pt_pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, Pitch_BR, 0, st_fx->L_frame, Pitch_CT, &pitch_limit_flag, i_subfr, exc, L_subfr, st_fx->pitch, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf #if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st_fx->element_mode, Q_new #endif ); /* Q6 */ L_subfr, st_fx->pitch, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st_fx->element_mode, Q_new ); /* Q6 */ Scale_sig( h1, L_subfr, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14*/ /*-----------------------------------------------------------------* Loading @@ -754,6 +760,7 @@ void enc_pit_exc_ivas_fx( *-----------------------------------------------------------------*/ pred_lt4_ivas_fx( &exc[i_subfr], &exc[i_subfr], *T0, *T0_frac, L_subfr + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); /*-----------------------------------------------------------------* * Gain clipping test to avoid unstable synthesis on frame erasure * or in case of floating point encoder & fixed p. decoder Loading @@ -765,8 +772,9 @@ void enc_pit_exc_ivas_fx( * Codebook target computation * (No LP filtering of the adaptive excitation) *-----------------------------------------------------------------*/ lp_select = lp_filt_exc_enc_fx( MODE1, AUDIO, i_subfr, exc, h1, xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ lp_select = lp_filt_exc_enc_fx( MODE1, AUDIO, i_subfr, exc, h1, xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */ IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); Loading Loading @@ -797,7 +805,7 @@ void enc_pit_exc_ivas_fx( push_indice( hBstr, IND_PIT_IDX, pit_idx, 4 ); } } else if ( use_fcb == 2 ) ELSE IF( use_fcb == 2 ) { /*-----------------------------------------------------------------* * Innovation encoding Loading @@ -821,12 +829,15 @@ void enc_pit_exc_ivas_fx( inov_encode_ivas_fx( st_fx, Local_BR, 0, st_fx->L_frame, st_fx->last_L_frame, LOCAL_CT, WB, 1, i_subfr, -1, p_Aq, gain_pit, cn, exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, L_SUBFR, shift, Q_new ); /*-----------------------------------------------------------------* * Gain encoding *-----------------------------------------------------------------*/ gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, st_fx->L_frame, i_subfr, -1, xn, y1, sub( shift_wsp, 1 ), y2, code, Es_pred, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain ); } gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit, st_fx->clip_var_fx ); Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/ Loading @@ -841,9 +852,11 @@ void enc_pit_exc_ivas_fx( hLPDmem->tilt_code = 0; move16(); } /*-----------------------------------------------------------------* * Update memory of the weighting filter *-----------------------------------------------------------------*/ IF( use_fcb != 0 ) { Ltmp = L_mult0( gcode16, y2[L_subfr - 1] ); Loading @@ -866,6 +879,7 @@ void enc_pit_exc_ivas_fx( * Construct adaptive part of the excitation * Save the non-enhanced excitation for FEC_exc *-----------------------------------------------------------------*/ IF( use_fcb != 0 ) { FOR( i = 0; i < L_subfr; i++ ) Loading Loading @@ -1001,4 +1015,6 @@ void enc_pit_exc_ivas_fx( cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/ *gpit = round_fx( L_mac( L_mult( 3277, *gpit ), 29491, cum_gpit ) ); /*Q15*/ return; }
lib_enc/ivas_td_low_rate_enc_fx.c +7 −6 Original line number Diff line number Diff line Loading @@ -163,6 +163,7 @@ void tdm_low_rate_enc( /*--------------------------------------------------------------------------------------* * Updates *--------------------------------------------------------------------------------------*/ Copy( exc_wo_nf_fx, exc_fx, L_FRAME ); /* Q_new */ return; Loading Loading @@ -274,12 +275,8 @@ void encod_gen_2sbfr( * Close-loop pitch search on the 1st and 3rd subfr only and quantization * Adaptive exc. construction *------------------------------------------------------------------------*/ *pt_pitch = pit_encode_fx( st->hBstr, st->acelp_cfg.pitch_bits, st->core_brate, 0, L_frame, coder_type, &pitch_limit_flag, i_subfr, exc, 2 * L_SUBFR, st->pitch, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf #if !defined REUSE_EVS_ACELP_PITCH_NORM_CORR , st->element_mode, Q_new #endif ); *pt_pitch = pit_encode_fx( st->hBstr, st->acelp_cfg.pitch_bits, st->core_brate, 0, L_frame, coder_type, &pitch_limit_flag, i_subfr, exc, 2 * L_SUBFR, st->pitch, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st->element_mode, Q_new ); move16(); Scale_sig( h1, 2 * L_SUBFR, sub( 13, q_h1 ) ); // Q13 Loading @@ -297,12 +294,15 @@ void encod_gen_2sbfr( *-----------------------------------------------------------------*/ clip_gain = gp_clip_fx( st->element_mode, st->core_brate, st->voicing_fx, i_subfr, coder_type, xn, st->clip_var_fx, sub( Q_new, 1 ) ); // Q0 /*-----------------------------------------------------------------* * LP filtering of the adaptive excitation, codebook target computation *-----------------------------------------------------------------*/ Scale_sig( h1, 2 * L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */ lp_filt_exc_enc_fx( MODE1, coder_type, i_subfr, exc, h1, xn, y1, xn2, 2 * L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &st->acelp_cfg.ltf_mode ); /* update long-term pitch gain for speech/music classifier */ st->hSpMusClas->lowrate_pitchGain = add( mult( 29491, st->hSpMusClas->lowrate_pitchGain ), mult( 3277 /*Q15*/, gain_pit ) ); // Q14 move16(); Loading @@ -319,6 +319,7 @@ void encod_gen_2sbfr( gain_enc_lbr_fx( st->hBstr, st->acelp_cfg.gains_mode, coder_type, i_subfr, xn, y1, add( sub( Q_new, 1 ), shift ), y2, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, gc_mem, gp_mem, clip_gain, 2 * L_SUBFR, st->element_mode ); IF( st->Opt_SC_VBR ) { if ( EQ_16( st->hSC_VBR->last_ppp_mode, 1 ) ) Loading