Line data Source code
1 : /*==================================================================================== 2 : EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 3 : ====================================================================================*/ 4 : 5 : #include "options.h" /* Compilation switches */ 6 : #include "cnst.h" /* Common constants */ 7 : #include "rom_com.h" /* Static table prototypes */ 8 : #include "prot_fx.h" /* Function prototypes */ 9 : #include "prot_fx_enc.h" /* Function prototypes */ 10 : #include "stl.h" 11 : 12 : 13 : /*-------------------------------------------------------------------* 14 : * CNG_reset_enc() 15 : * 16 : * Reset encoder static variables after a CNG frame 17 : *-------------------------------------------------------------------*/ 18 : 19 14142 : void CNG_reset_enc_fx( 20 : Encoder_State *st_fx, /* i/o: encoder state structure */ 21 : LPD_state_HANDLE hLPDmem, /* i/o: acelp memories */ 22 : Word16 *pitch_buf, /* o : floating pitch for each subframe Q6*/ 23 : Word16 *voice_factors, /* o : voicing factors Q15*/ 24 : Word16 VBR_cng_reset_flag /* Q0 */ 25 : ) 26 : { 27 14142 : TD_CNG_ENC_HANDLE hTdCngEnc = st_fx->hTdCngEnc; 28 : 29 14142 : init_gp_clip_fx( st_fx->clip_var_fx ); 30 14142 : Copy( UVWB_Ave_fx, st_fx->mem_AR_fx, M ); /* Qlog2(2.56) */ 31 14142 : set16_fx( st_fx->mem_MA_fx, 0, M ); 32 14142 : hLPDmem->mem_w0 = 0; 33 14142 : move16(); 34 14142 : hLPDmem->tilt_code = 0; 35 14142 : move16(); 36 14142 : hLPDmem->gc_threshold = 0; 37 14142 : move16(); 38 14142 : IF( EQ_16( VBR_cng_reset_flag, 1 ) ) 39 : { 40 0 : set16_fx( hLPDmem->mem_syn, 0, M ); 41 : } 42 14142 : set16_fx( hLPDmem->dm_fx.prev_gain_pit, 0, 6 ); 43 14142 : hLPDmem->dm_fx.prev_gain_code = L_deposit_l( 0 ); 44 14142 : hLPDmem->dm_fx.prev_state = 0; 45 : // PMTE() 46 14142 : move16(); 47 : 48 : /* last good received frame for FEC in ACELP */ 49 14142 : st_fx->clas = UNVOICED_CLAS; 50 14142 : move16(); 51 : 52 : /* reset the pitch buffer in case of FRAME_NO_DATA or SID frames */ 53 14142 : IF( EQ_16( st_fx->L_frame, L_FRAME ) ) 54 : { 55 6977 : set16_fx( pitch_buf, L_SUBFR << 6, NB_SUBFR ); 56 : } 57 : ELSE /* st->L_frame == L_FRAME16k */ 58 : { 59 7165 : set16_fx( pitch_buf, L_SUBFR16k << 6, NB_SUBFR16k ); 60 : } 61 : 62 14142 : set16_fx( voice_factors, 1, NB_SUBFR16k ); 63 : 64 : /* deactivate bass post-filter */ 65 14142 : st_fx->bpf_off = 1; 66 14142 : move16(); 67 : 68 : /* Reset active frame counter */ 69 14142 : if ( hTdCngEnc != NULL ) 70 : { 71 12027 : hTdCngEnc->act_cnt2 = 0; 72 12027 : move16(); 73 : } 74 : 75 14142 : return; 76 : }