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