Line data Source code
1 : /*==================================================================================== 2 : EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 3 : ====================================================================================*/ 4 : #include <stdint.h> 5 : #include "options.h" /* Compilation switches */ 6 : #include "cnst.h" /* Common constants */ 7 : #include "prot_fx.h" /* Function prototypes */ 8 : /*======================================================================*/ 9 : /* FUNCTION : decod_nelp_fx() */ 10 : /*-----------------------------------------------------------------------*/ 11 : /* PURPOSE : Decode unvoiced NELP */ 12 : /* */ 13 : /*-----------------------------------------------------------------------*/ 14 : /* GLOBAL INPUT ARGUMENTS : */ 15 : /* _ (Struct) st_fx : decoder static memory */ 16 : /* _ (Word16) coder_type : coding type */ 17 : /* _ (Word16[]) tmp_noise_fx : long term temporary noise energy */ 18 : /* _ (Word16[]) pitch_buf_fx : floating pitch values for each 19 : subframe(Q6) */ 20 : /* _ (Word16[]) exc_fx : adapt. excitation exc (Q_exc) */ 21 : /* _ (Word16[]) exc2_fx : adapt. excitation/total exc (Q_exc) */ 22 : /* _ (Word16) bfi : frame error rate */ 23 : /*-----------------------------------------------------------------------*/ 24 : /* OUTPUT ARGUMENTS : */ 25 : /* _ (Word16[]) exc_fx : adapt. excitation exc (Q_exc) */ 26 : /* _ (Word16[]) exc2_fx : adapt. excitation/total exc (Q_exc) */ 27 : /*-----------------------------------------------------------------------*/ 28 : 29 : /* _ (Word16[]) tmp_noise_fx : long term temporary noise energy 30 : (Q0) */ 31 : /* _ (Word16[]) pitch_buf_fx : floating pitch values for each 32 : subframe (Q6) */ 33 : /* _ (Word16[]) st_fx->dispMem : Noise enhancer - phase dispersion 34 : algorithm memory (Q14) */ 35 : /* _ (Word16) st_fx->tilt_code : tilt of code (Q15) */ 36 : /* _ (Word16) st_fx->prev_gain_pit_dec */ 37 : /*-----------------------------------------------------------------------*/ 38 : /* RETURN ARGUMENTS : */ 39 : /* _ None */ 40 : /*=======================================================================*/ 41 : 42 0 : void decod_nelp_fx( 43 : Decoder_State *st_fx, 44 : Word16 *tmp_noise_fx, 45 : Word16 *pitch_buf_fx, 46 : Word16 *exc_fx, 47 : Word16 *exc2_fx, 48 : Word16 *voice_factors, 49 : Word16 *bwe_exc_fx, 50 : Word16 *Q_exc, 51 : Word16 bfi, 52 : Word16 *gain_buf ) 53 : { 54 : Word16 i; 55 : Word16 exc_nelp_fx[L_FRAME]; 56 : Word16 coder_type; 57 0 : test(); 58 0 : IF( st_fx->use_partial_copy && EQ_16( st_fx->rf_frame_type, RF_NELP ) ) 59 : { 60 0 : coder_type = UNVOICED; 61 0 : move16(); 62 : } 63 : ELSE 64 : { 65 0 : coder_type = st_fx->coder_type; 66 0 : move16(); 67 : } 68 : 69 0 : *tmp_noise_fx = 0; 70 0 : move16(); 71 : 72 0 : nelp_decoder_fx( st_fx, exc_nelp_fx, exc_fx, Q_exc, bfi, coder_type, gain_buf ); 73 : 74 0 : Copy( exc_nelp_fx, exc_fx, L_FRAME ); 75 0 : Copy( exc_nelp_fx, exc2_fx, L_FRAME ); 76 : 77 0 : st_fx->tilt_code_fx = 0; 78 0 : move16(); /* purely unvoiced */ /* Q15 */ 79 0 : set16_fx( st_fx->tilt_code_dec_fx, 0, NB_SUBFR16k ); 80 : 81 0 : st_fx->dm_fx.prev_state = 0; 82 0 : move16(); /* Q0 */ 83 0 : st_fx->prev_gain_pit_dec_fx = 0; 84 0 : move16(); /* Q14 */ 85 0 : st_fx->dm_fx.prev_gain_pit[0] = st_fx->prev_gain_pit_dec_fx; 86 0 : move16(); /* Q16 */ 87 : 88 0 : FOR( i = 1; i < 5; i++ ) 89 : { 90 0 : st_fx->dm_fx.prev_gain_pit[i] = st_fx->dm_fx.prev_gain_pit[i - 1]; 91 0 : move16(); /* Q14 */ 92 : } 93 : 94 0 : set16_fx( pitch_buf_fx, L_SUBFR_Q6, NB_SUBFR ); /* L_SUBFR = 64, Q6 */ 95 0 : set16_fx( voice_factors, 0, NB_SUBFR16k ); 96 0 : IF( st_fx->hBWE_TD != NULL ) 97 : { 98 0 : interp_code_5over2_fx( exc2_fx, bwe_exc_fx, L_FRAME ); 99 : } 100 0 : return; 101 : }