Line data Source code
1 : /*==================================================================================== 2 : EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0 3 : ====================================================================================*/ 4 : 5 : #include <stdint.h> 6 : #include "options.h" /* Compilation switches */ 7 : #include "cnst.h" /* Common constants */ 8 : #include "prot_fx.h" /* Function prototypes */ 9 : 10 : /*======================================================================*/ 11 : /* FUNCTION : lp_filt_exc_dec_fx() */ 12 : /*-----------------------------------------------------------------------*/ 13 : /* PURPOSE : Low-pass filtering of the adaptive exctitation */ 14 : /* */ 15 : /*-----------------------------------------------------------------------*/ 16 : /* INPUT ARGUMENTS : */ 17 : /* _ (Word32) core_brate : Core bitrate Q0 */ 18 : /* _ (Word16) Opt_AMR_WB : flag indicating AMR-WB IO mode Q0 */ 19 : /* _ (Word16) coder_type : coding type Q0 */ 20 : /* _ (Word16) i_subfr : subframe index Q0 */ 21 : /* _ (Word16) L_subfr : subframe size Q0 */ 22 : /*-----------------------------------------------------------------------*/ 23 : /* OUTPUT ARGUMENTS : */ 24 : /*-----------------------------------------------------------------------*/ 25 : /* INPUT OUTPUT ARGUMENTS */ 26 : /* _ (Word16 *) exc : excitation buffer Q0 */ 27 : /*-----------------------------------------------------------------------*/ 28 : 29 : /* */ 30 : /*-----------------------------------------------------------------------*/ 31 : /* RETURN ARGUMENTS : */ 32 : /* _ None */ 33 : /*=======================================================================*/ 34 : 35 509423 : void lp_filt_exc_dec_fx( 36 : Decoder_State *st_fx, /* i/o: decoder state structure */ 37 : const Word16 codec_mode, /* i : coder mode */ 38 : const Word16 i_subfr, /* i : subframe index */ 39 : const Word16 L_subfr, /* i : subframe size */ 40 : const Word16 L_frame, /* i : frame size */ 41 : Word16 lp_flag, /* i : operation mode signaling */ 42 : Word16 *exc ) 43 : { 44 : 45 : Word16 i, fac_n, fac_m; 46 : Word16 code[L_FRAME]; 47 : Word32 L_tmp; 48 : 49 : /*-----------------------------------------------------------------* 50 : * Select LP filtering of the adaptive excitation 51 : *-----------------------------------------------------------------*/ 52 509423 : IF( EQ_16( codec_mode, MODE1 ) ) 53 : { 54 506373 : IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) 55 : { 56 444949 : lp_flag = (Word16) get_next_indice_fx( st_fx, 1 ); 57 : } 58 : } 59 509423 : IF( lp_flag == LOW_PASS ) 60 : { 61 : /* pointer positioning to avoid doing it inside the loop */ 62 335060 : test(); 63 335060 : IF( EQ_16( codec_mode, MODE2 ) && EQ_16( L_frame, L_FRAME16k ) ) 64 : { 65 2640 : fac_n = 6881 /*0.21f Q15*/; 66 2640 : fac_m = 19005 /*0.58f Q15*/; 67 : } 68 : ELSE 69 : { 70 332420 : fac_n = 5898 /*0.18f Q15*/; 71 332420 : fac_m = 20972 /*0.64f Q15*/; 72 : } 73 335060 : move16(); 74 335060 : move16(); 75 : 76 21778900 : FOR( i = 0; i < L_subfr; i++ ) 77 : { 78 21443840 : L_tmp = L_mult( fac_n, exc[( ( i - 1 ) + i_subfr )] ); 79 21443840 : L_tmp = L_mac( L_tmp, fac_m, exc[( i /*+ 0 */ + i_subfr )] ); 80 21443840 : code[i] = mac_r( L_tmp, fac_n, exc[( ( i + 1 ) + i_subfr )] ); 81 21443840 : move16(); 82 : } 83 : 84 : 85 335060 : Copy( code, &exc[i_subfr], L_subfr ); 86 : } 87 509423 : }