# HG changeset patch # User Mychaela Falconia # Date 1669275503 0 # Node ID 36e1363ad88573777f985970fb5fd53399860eaf # Parent 38326102fc431e6c1298eea9070882acc6daa938 libgsmefr: initial import of ETSI header files diff -r 38326102fc43 -r 36e1363ad885 libgsmefr/cnst.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmefr/cnst.h Thu Nov 24 07:38:23 2022 +0000 @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------* +* Codec constant parameters (coder, decoder, and postfilter) * +*---------------------------------------------------------------------------*/ + +#define L_TOTAL 320 /* Total size of speech buffer. */ +#define L_WINDOW 240 /* Window size in LP analysis */ +#define L_FRAME 160 /* Frame size */ +#define L_FRAME_BY2 80 /* Frame size divided by 2 */ +#define L_SUBFR 40 /* Subframe size */ +#define M 10 /* Order of LP filter */ +#define MP1 (M+1) /* Order of LP filter + 1 */ +#define AZ_SIZE (4*M+4) /* Size of array of LP filters in 4 subfr.s */ +#define PIT_MIN 18 /* Minimum pitch lag */ +#define PIT_MAX 143 /* Maximum pitch lag */ +#define L_INTERPOL (10+1) /* Length of filter for interpolation */ + +#define PRM_SIZE 57 /* Size of vector of analysis parameters */ +#define SERIAL_SIZE (244+1) /* bits per frame + bfi */ + +#define MU 26214 /* Factor for tilt compensation filter 0.8 */ +#define AGC_FAC 29491 /* Factor for automatic gain control 0.9 */ diff -r 38326102fc43 -r 36e1363ad885 libgsmefr/codec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmefr/codec.h Thu Nov 24 07:38:23 2022 +0000 @@ -0,0 +1,162 @@ +void Init_Coder_12k2 (void); + +void Coder_12k2 ( + Word16 ana[], /* output : Analysis parameters */ + Word16 synth[] /* output : Local synthesis */ +); + +void Init_Decoder_12k2 (void); + +void Decoder_12k2 ( + Word16 parm[], /* input : vector of synthesis parameters + parm[0] = bad frame indicator (bfi) */ + Word16 synth[], /* output: synthesis speech */ + Word16 A_t[], /* output: decoded LP filter in 4 subframes */ + Word16 TAF, + Word16 SID_flag +); + +void Init_Post_Filter (void); + +void Post_Filter ( + Word16 *syn, /* in/out: synthesis speech (postfiltered is output) */ + Word16 *Az_4 /* input : interpolated LPC parameters in all subfr. */ +); + +void code_10i40_35bits ( + Word16 x[], /* (i) : target vector */ + Word16 cn[], /* (i) : residual after long term prediction */ + Word16 h[], /* (i) : impulse response of weighted synthesis + filter */ + Word16 cod[], /* (o) : algebraic (fixed) codebook excitation */ + Word16 y[], /* (o) : filtered fixed codebook excitation */ + Word16 indx[] /* (o) : index of 10 pulses (sign + position) */ +); +void dec_10i40_35bits ( + Word16 index[], /* (i) : index of 10 pulses (sign+position) */ + Word16 cod[] /* (o) : algebraic (fixed) codebook excitation */ +); +Word16 Dec_lag6 ( /* output: return integer pitch lag */ + Word16 index, /* input : received pitch index */ + Word16 pit_min, /* input : minimum pitch lag */ + Word16 pit_max, /* input : maximum pitch lag */ + Word16 i_subfr, /* input : subframe flag */ + Word16 L_frame_by2,/* input : speech frame size divided by 2 */ + Word16 *T0_frac, /* output: fractional part of pitch lag */ + Word16 bfi /* input : bad frame indicator */ +); +Word16 d_gain_pitch ( /* out : quantized pitch gain */ + Word16 index, /* in : index of quantization */ + Word16 bfi, /* in : bad frame indicator (good = 0) */ + Word16 state, /* in : state of the state machine */ + Word16 prev_bf, /* Previous bf */ + Word16 rxdtx_ctrl + +); +void d_gain_code ( + Word16 index, /* input : received quantization index */ + Word16 code[], /* input : innovation codevector */ + Word16 lcode, /* input : codevector length */ + Word16 *gain_code, /* output: decoded innovation gain */ + Word16 bfi, /* input : bad frame indicator */ + Word16 state, /* in : state of the state machine */ + Word16 prev_bf, /* Previous bf */ + Word16 rxdtx_ctrl, + Word16 i_subfr, + Word16 rx_dtx_state + +); +void D_plsf_5 ( + Word16 *indice, /* input : quantization indices of 5 submatrices */ + Word16 *lsp1_q, /* output: quantized 1st LSP vector */ + Word16 *lsp2_q, /* output: quantized 2nd LSP vector */ + Word16 bfi, /* input : bad frame indicator (set to 1 if a bad + frame is received) */ + Word16 rxdtx_ctrl, + Word16 rx_dtx_state +); +Word16 Enc_lag6 ( /* output: Return index of encoding */ + Word16 T0, /* input : Pitch delay */ + Word16 *T0_frac, /* in/out: Fractional pitch delay */ + Word16 *T0_min, /* in/out: Minimum search delay */ + Word16 *T0_max, /* in/out: Maximum search delay */ + Word16 pit_min, /* input : Minimum pitch delay */ + Word16 pit_max, /* input : Maximum pitch delay */ + Word16 pit_flag /* input : Flag for 1st or 3rd subframe */ +); + +Word16 q_gain_pitch ( /* Return index of quantization */ + Word16 *gain /* (i) : Pitch gain to quantize */ +); + +Word16 q_gain_code ( /* Return quantization index */ + Word16 code[], /* (i) : fixed codebook excitation */ + Word16 lcode, /* (i) : codevector size */ + Word16 *gain, /* (i/o) : quantized fixed codebook gain */ + Word16 txdtx_ctrl, + Word16 i_subfr +); + +Word16 G_pitch ( /* (o) : Gain of pitch lag saturated to 1.2 */ + Word16 xn[], /* (i) : Pitch target. */ + Word16 y1[], /* (i) : Filtered adaptive codebook. */ + Word16 L_subfr /* : Length of subframe. */ +); +Word16 G_code ( /* out : Gain of innovation code. */ + Word16 xn[], /* in : target vector */ + Word16 y2[] /* in : filtered inovation vector */ +); + +Word16 Interpol_6 ( /* (o) : interpolated value */ + Word16 *x, /* (i) : input vector */ + Word16 frac /* (i) : fraction */ +); +void Int_lpc ( + Word16 lsp_old[], /* input: LSP vector at the 4th subfr. of past frame */ + Word16 lsp_mid[], /* input: LSP vector at the 2nd subfr. of + present frame */ + Word16 lsp_new[], /* input: LSP vector at the 4th subfr. of + present frame */ + Word16 Az[] /* output: interpolated LP parameters in all subfr. */ +); +void Int_lpc2 ( + Word16 lsp_old[], /* input: LSP vector at the 4th subfr. of past frame */ + Word16 lsp_mid[], /* input: LSP vector at the 2nd subframe of + present frame */ + Word16 lsp_new[], /* input: LSP vector at the 4th subframe of + present frame */ + Word16 Az[] /* output:interpolated LP parameters + in subframes 1 and 3 */ +); +Word16 Pitch_fr6 ( /* (o) : pitch period. */ + Word16 exc[], /* (i) : excitation buffer */ + Word16 xn[], /* (i) : target vector */ + Word16 h[], /* (i) : impulse response of synthesis and + weighting filters */ + Word16 L_subfr, /* (i) : Length of subframe */ + Word16 t0_min, /* (i) : minimum value in the searched range. */ + Word16 t0_max, /* (i) : maximum value in the searched range. */ + Word16 i_subfr, /* (i) : indicator for first subframe. */ + Word16 *pit_frac /* (o) : chosen fraction. */ +); +Word16 Pitch_ol ( /* output: open loop pitch lag */ + Word16 signal[], /* input: signal used to compute the open loop pitch */ + /* signal[-pit_max] to signal[-1] should be known */ + Word16 pit_min, /* input : minimum pitch lag */ + Word16 pit_max, /* input : maximum pitch lag */ + Word16 L_frame /* input : length of frame to compute pitch */ +); +void Pred_lt_6 ( + Word16 exc[], /* in/out: excitation buffer */ + Word16 T0, /* input : integer pitch lag */ + Word16 frac, /* input : fraction of lag */ + Word16 L_subfr /* input : subframe size */ +); +void Q_plsf_5 ( + Word16 *lsp1, /* input : 1st LSP vector */ + Word16 *lsp2, /* input : 2nd LSP vector */ + Word16 *lsp1_q, /* output: quantized 1st LSP vector */ + Word16 *lsp2_q, /* output: quantized 2nd LSP vector */ + Word16 *indice, /* output: quantization indices of 5 matrices */ + Word16 txdtx_ctrl /* input : tx dtx control word */ +); diff -r 38326102fc43 -r 36e1363ad885 libgsmefr/d_homing.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmefr/d_homing.h Thu Nov 24 07:38:23 2022 +0000 @@ -0,0 +1,18 @@ +/************************************************************************** + * + * File Name: d_homing.h + * + * Purpose: Contains the prototypes for all the functions of + * decoder homing. + * + **************************************************************************/ + +#define EHF_MASK 0x0008 /* Encoder Homing Frame pattern */ + +#define D_HOMING + +/* Function Prototypes */ + +Word16 decoder_homing_frame_test (Word16 parm[], Word16 nbr_of_params); + +void decoder_reset (void); diff -r 38326102fc43 -r 36e1363ad885 libgsmefr/dtx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmefr/dtx.h Thu Nov 24 07:38:23 2022 +0000 @@ -0,0 +1,132 @@ +/*************************************************************************** + * + * File Name: dtx.h + * + * Purpose: Contains the prototypes for all the functions of DTX. + * Also contains definitions of constants used in DTX functions. + * + **************************************************************************/ + +#define PN_INITIAL_SEED 0x70816958L /* Pseudo noise generator seed value */ + +#define CN_INT_PERIOD 24 /* Comfort noise interpolation period + (nbr of frames between successive + SID updates in the decoder) */ + +#define DTX_HANGOVER 7 /* Period when SP=1 although VAD=0. + Used for comfort noise averaging */ + + +/* Frame classification constants */ + +#define VALID_SID_FRAME 1 +#define INVALID_SID_FRAME 2 +#define GOOD_SPEECH_FRAME 3 +#define UNUSABLE_FRAME 4 + +/* Encoder DTX control flags */ + +#define TX_SP_FLAG 0x0001 +#define TX_VAD_FLAG 0x0002 +#define TX_HANGOVER_ACTIVE 0x0004 +#define TX_PREV_HANGOVER_ACTIVE 0x0008 +#define TX_SID_UPDATE 0x0010 +#define TX_USE_OLD_SID 0x0020 + +/* Decoder DTX control flags */ + +#define RX_SP_FLAG 0x0001 +#define RX_UPD_SID_QUANT_MEM 0x0002 +#define RX_FIRST_SID_UPDATE 0x0004 +#define RX_CONT_SID_UPDATE 0x0008 +#define RX_LOST_SID_FRAME 0x0010 +#define RX_INVALID_SID_FRAME 0x0020 +#define RX_NO_TRANSMISSION 0x0040 +#define RX_DTX_MUTING 0x0080 +#define RX_PREV_DTX_MUTING 0x0100 +#define RX_CNI_BFI 0x0200 +#define RX_FIRST_SP_FLAG 0x0400 + +void reset_tx_dtx (void); /* Reset tx dtx variables */ +void reset_rx_dtx (void); /* Reset rx dtx variables */ + +void tx_dtx ( + Word16 VAD_flag, + Word16 *txdtx_ctrl +); + +void rx_dtx ( + Word16 *rxdtx_ctrl, + Word16 TAF, + Word16 bfi, + Word16 SID_flag +); + +void CN_encoding ( + Word16 params[], + Word16 txdtx_ctrl +); + +void update_lsf_history ( + Word16 lsf1[M], + Word16 lsf2[M], + Word16 lsf_old[DTX_HANGOVER][M] +); + +void update_lsf_p_CN ( + Word16 lsf_old[DTX_HANGOVER][M], + Word16 lsf_p_CN[M] +); + +void aver_lsf_history ( + Word16 lsf_old[DTX_HANGOVER][M], + Word16 lsf1[M], + Word16 lsf2[M], + Word16 lsf_aver[M] +); + +void update_gain_code_history_tx ( + Word16 new_gain_code, + Word16 gain_code_old_tx[4 * DTX_HANGOVER] +); + +void update_gain_code_history_rx ( + Word16 new_gain_code, + Word16 gain_code_old_rx[4 * DTX_HANGOVER] +); + +Word16 compute_CN_excitation_gain ( + Word16 res2[L_SUBFR] +); + +Word16 update_gcode0_CN ( + Word16 gain_code_old_tx[4 * DTX_HANGOVER] +); + +Word16 aver_gain_code_history ( + Word16 CN_excitation_gain, + Word16 gain_code_old[4 * DTX_HANGOVER] +); + +void build_CN_code ( + Word16 cod[], + Word32 *seed +); + +Word16 pseudonoise ( + Word32 *shift_reg, + Word16 no_bits +); + +Word16 interpolate_CN_param ( + Word16 old_param, + Word16 new_param, + Word16 rx_dtx_state +); + +void interpolate_CN_lsf ( + Word16 lsf_old_CN[M], + Word16 lsf_new_CN[M], + Word16 lsf_interp_CN[M], + Word16 rx_dtx_state +); diff -r 38326102fc43 -r 36e1363ad885 libgsmefr/e_homing.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmefr/e_homing.h Thu Nov 24 07:38:23 2022 +0000 @@ -0,0 +1,16 @@ +/************************************************************************** + * + * File Name: e_homing.h + * + * Purpose: Contains the prototypes for all the functions of + * encoder homing. + * + **************************************************************************/ + +#define EHF_MASK 0x0008 /* Encoder Homing Frame pattern */ + +/* Function Prototypes */ + +Word16 encoder_homing_frame_test (Word16 input_frame[]); + +void encoder_reset (void); diff -r 38326102fc43 -r 36e1363ad885 libgsmefr/gains_tb.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmefr/gains_tb.h Thu Nov 24 07:38:23 2022 +0000 @@ -0,0 +1,21 @@ +/*-----------------------------------------------------------------------* + * Scalar quantization tables of the pitch gain and the codebook gain. * + *-----------------------------------------------------------------------*/ + +#define NB_QUA_PITCH 16 + +static const Word16 qua_gain_pitch[NB_QUA_PITCH] = +{ + 0, 3277, 6556, 8192, 9830, 11469, 12288, 13107, + 13926, 14746, 15565, 16384, 17203, 18022, 18842, 19661 +}; + +#define NB_QUA_CODE 32 + +static const Word16 qua_gain_code[NB_QUA_CODE] = +{ + 159, 206, 268, 349, 419, 482, 554, 637, + 733, 842, 969, 1114, 1281, 1473, 1694, 1948, + 2241, 2577, 2963, 3408, 3919, 4507, 5183, 5960, + 6855, 7883, 9065, 10425, 12510, 16263, 21142, 27485 +}; diff -r 38326102fc43 -r 36e1363ad885 libgsmefr/namespace.h --- a/libgsmefr/namespace.h Thu Nov 24 05:30:03 2022 +0000 +++ b/libgsmefr/namespace.h Thu Nov 24 07:38:23 2022 +0000 @@ -44,3 +44,94 @@ #define norm_m EFR__norm_s #define div_s EFR__div_s #define norm_l EFR__norm_l + +#define L_Extract EFR__L_Extract +#define L_Comp EFR__L_Comp +#define Mpy_32 EFR__Mpy_32 +#define Mpy_32_16 EFR__Mpy_32_16 +#define Div_32 EFR__Div_32 + +#define Inv_sqrt EFR__Inv_sqrt +#define Log2 EFR__Log2 +#define Pow2 EFR__Pow2 + +#define Init_Pre_Process EFR__Init_Pre_Process +#define Pre_Process EFR__Pre_Process +#define Autocorr EFR__Autocorr +#define Lag_window EFR__Lag_window +#define Levinson EFR__Levinson +#define Az_lsp EFR__Az_lsp +#define Lsp_Az EFR__Lsp_Az +#define Lsf_lsp EFR__Lsf_lsp +#define Lsp_lsf EFR__Lsp_lsf +#define Reorder_lsf EFR__Reorder_lsf +#define Weight_Fac EFR__Weight_Fac +#define Weight_Ai EFR__Weight_Ai +#define Residu EFR__Residu +#define Syn_filt EFR__Syn_filt +#define Convolve EFR__Convolve +#define agc EFR__agc +#define agc2 EFR__agc2 +#define preemphasis EFR__preemphasis + +#define Init_Coder_12k2 EFR__Init_Coder_12k2 +#define Coder_12k2 EFR__Coder_12k2 +#define Init_Decoder_12k2 EFR__Init_Decoder_12k2 +#define Decoder_12k2 EFR__Decoder_12k2 +#define Init_Post_Filter EFR__Init_Post_Filter +#define Post_Filter EFR__Post_Filter +#define code_10i40_35bits EFR__code_10i40_35bits +#define dec_10i40_35bits EFR__dec_10i40_35bits +#define Dec_lag6 EFR__Dec_lag6 +#define d_gain_pitch EFR__d_gain_pitch +#define D_plsf_5 EFR__D_plsf_5 +#define Enc_lag6 EFR__Enc_lag6 +#define q_gain_pitch EFR__q_gain_pitch +#define q_gain_code EFR__q_gain_code +#define G_pitch EFR__G_pitch +#define G_code EFR__G_code +#define Interpol_6 EFR__Interpol_6 +#define Int_lpc EFR__Int_lpc +#define Int_lpc2 EFR__Int_lpc2 +#define Pitch_fr6 EFR__Pitch_fr6 +#define Pitch_ol EFR__Pitch_ol +#define Pred_lt_6 EFR__Pred_lt_6 +#define Q_plsf_5 EFR__Q_plsf_5 + +#define decoder_homing_frame_test EFR__decoder_homing_frame_test +#define decoder_reset EFR__decoder_reset +#define encoder_homing_frame_test EFR__encoder_homing_frame_test +#define encoder_reset EFR__encoder_reset + +#define reset_tx_dtx EFR__reset_tx_dtx +#define reset_rx_dtx EFR__reset_rx_dtx +#define tx_dtx EFR__tx_dtx +#define rx_dtx EFR__rx_dtx +#define CN_encoding EFR__CN_encoding +#define update_lsf_history EFR__update_lsf_history +#define update_lsf_p_CN EFR__update_lsf_p_CN +#define aver_lsf_history EFR__aver_lsf_history +#define update_gain_code_history_tx EFR__update_gain_code_history_tx +#define update_gain_code_history_rx EFR__update_gain_code_history_rx +#define compute_CN_excitation_gain EFR__compute_CN_excitation_gain +#define update_gcode0_CN EFR__update_gcode0_CN +#define aver_gain_code_history EFR__aver_gain_code_history +#define build_CN_code EFR__build_CN_code +#define pseudonoise EFR__pseudonoise +#define interpolate_CN_param EFR__interpolate_CN_param +#define interpolate_CN_lsf EFR__interpolate_CN_lsf + +#define vad_reset EFR__vad_reset +#define vad_computation EFR__vad_computation +#define energy_computation EFR__energy_computation +#define acf_averaging EFR__acf_averaging +#define predictor_values EFR__predictor_values +#define schur_recursion EFR__schur_recursion +#define step_up EFR__step_up +#define compute_rav1 EFR__compute_rav1 +#define spectral_comparison EFR__spectral_comparison +#define threshold_adaptation EFR__threshold_adaptation +#define tone_detection EFR__tone_detection +#define vad_decision EFR__vad_decision +#define vad_hangover EFR__vad_hangover +#define periodicity_update EFR__periodicity_update diff -r 38326102fc43 -r 36e1363ad885 libgsmefr/no_count.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmefr/no_count.h Thu Nov 24 07:38:23 2022 +0000 @@ -0,0 +1,7 @@ +/* no-op definitions for ETSI's move/logic/test counting calls */ + +static inline void move16(void) {} +static inline void move32(void) {} +static inline void logic16(void) {} +static inline void logic32(void) {} +static inline void test(void) {} diff -r 38326102fc43 -r 36e1363ad885 libgsmefr/oper_32b.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmefr/oper_32b.h Thu Nov 24 07:38:23 2022 +0000 @@ -0,0 +1,7 @@ +/* Double precision operations */ + +void L_Extract (Word32 L_32, Word16 *hi, Word16 *lo); +Word32 L_Comp (Word16 hi, Word16 lo); +Word32 Mpy_32 (Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2); +Word32 Mpy_32_16 (Word16 hi, Word16 lo, Word16 n); +Word32 Div_32 (Word32 L_num, Word16 denom_hi, Word16 denom_lo); diff -r 38326102fc43 -r 36e1363ad885 libgsmefr/sig_proc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmefr/sig_proc.h Thu Nov 24 07:38:23 2022 +0000 @@ -0,0 +1,114 @@ +/*--------------------------------------------------------------* +* Function prototypes for general SIGnal PROCessing functions. * +*--------------------------------------------------------------*/ + +/* Mathematic functions */ + +Word32 Inv_sqrt ( /* (o) : output value (range: 0<=val<1) */ + Word32 L_x /* (i) : input value (range: 0<=val<=7fffffff) */ +); +void Log2 ( + Word32 L_x, /* (i) : input value */ + Word16 *exponent, /* (o) : Integer part of Log2. (range: 0<=val<=30) */ + Word16 *fraction /* (o) : Fractional part of Log2. (range: 0<=val<1)*/ +); +Word32 Pow2 ( /* (o) : result (range: 0<=val<=0x7fffffff) */ + Word16 exponent, /* (i) : Integer part. (range: 0<=val<=30) */ + Word16 fraction /* (i) : Fractional part. (range: 0.0<=val<1.0) */ +); + +/* General signal processing */ + +void Init_Pre_Process (void); +void Pre_Process ( + Word16 signal[], /* Input/output signal */ + Word16 lg /* Lenght of signal */ +); + +Word16 Autocorr ( + Word16 x[], /* (i) : Input signal */ + Word16 m, /* (i) : LPC order */ + Word16 r_h[], /* (o) : Autocorrelations (msb) */ + Word16 r_l[], /* (o) : Autocorrelations (lsb) */ + const Word16 wind[]/* (i) : window for LPC analysis. */ +); +void Lag_window ( + Word16 m, /* (i) : LPC order */ + Word16 r_h[], /* (i/o) : Autocorrelations (msb) */ + Word16 r_l[] /* (i/o) : Autocorrelations (lsb) */ +); +void Levinson ( + Word16 Rh[], /* (i) : Rh[m+1] Vector of autocorrelations (msb) */ + Word16 Rl[], /* (i) : Rl[m+1] Vector of autocorrelations (lsb) */ + Word16 A[], /* (o) : A[m] LPC coefficients (m = 10) */ + Word16 rc[] /* (o) : rc[4] First 4 reflection coefficients */ +); +void Az_lsp ( + Word16 a[], /* (i) : predictor coefficients */ + Word16 lsp[], /* (o) : line spectral pairs */ + Word16 old_lsp[] /* (i) : old lsp[] (in case not found 10 roots) */ +); +void Lsp_Az ( + Word16 lsp[], /* (i) : line spectral frequencies */ + Word16 a[] /* (o) : predictor coefficients (order = 10) */ +); +void Lsf_lsp ( + Word16 lsf[], /* (i) : lsf[m] normalized (range: 0.0<=val<=0.5) */ + Word16 lsp[], /* (o) : lsp[m] (range: -1<=val<1) */ + Word16 m /* (i) : LPC order */ +); +void Lsp_lsf ( + Word16 lsp[], /* (i) : lsp[m] (range: -1<=val<1) */ + Word16 lsf[], /* (o) : lsf[m] normalized (range: 0.0<=val<=0.5) */ + Word16 m /* (i) : LPC order */ +); +void Reorder_lsf ( + Word16 *lsf, /* (i/o) : vector of LSFs (range: 0<=val<=0.5) */ + Word16 min_dist, /* (i) : minimum required distance */ + Word16 n /* (i) : LPC order */ +); +void Weight_Fac ( + Word16 gamma, /* (i) : Spectral expansion. */ + Word16 fac[] /* (i/o) : Computed factors. */ +); +void Weight_Ai ( + Word16 a[], /* (i) : a[m+1] LPC coefficients (m=10) */ + const Word16 fac[],/* (i) : Spectral expansion factors. */ + Word16 a_exp[] /* (o) : Spectral expanded LPC coefficients */ +); +void Residu ( + Word16 a[], /* (i) : prediction coefficients */ + Word16 x[], /* (i) : speech signal */ + Word16 y[], /* (o) : residual signal */ + Word16 lg /* (i) : size of filtering */ +); +void Syn_filt ( + Word16 a[], /* (i) : a[m+1] prediction coefficients (m=10) */ + Word16 x[], /* (i) : input signal */ + Word16 y[], /* (o) : output signal */ + Word16 lg, /* (i) : size of filtering */ + Word16 mem[], /* (i/o): memory associated with this filtering. */ + Word16 update /* (i) : 0=no update, 1=update of memory. */ +); +void Convolve ( + Word16 x[], /* (i) : input vector */ + Word16 h[], /* (i) : impulse response */ + Word16 y[], /* (o) : output vector */ + Word16 L /* (i) : vector size */ +); +void agc ( + Word16 *sig_in, /* (i) : postfilter input signal */ + Word16 *sig_out, /* (i/o): postfilter output signal */ + Word16 agc_fac, /* (i) : AGC factor */ + Word16 l_trm /* (i) : subframe size */ +); +void agc2 ( + Word16 *sig_in, /* (i) : postfilter input signal */ + Word16 *sig_out, /* (i/o): postfilter output signal */ + Word16 l_trm /* (i) : subframe size */ +); +void preemphasis ( + Word16 *signal, /* (i/o): input signal overwritten by the output */ + Word16 g, /* (i) : preemphasis coefficient */ + Word16 L /* (i) : size of filtering */ +); diff -r 38326102fc43 -r 36e1363ad885 libgsmefr/vad.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libgsmefr/vad.h Thu Nov 24 07:38:23 2022 +0000 @@ -0,0 +1,106 @@ +/*************************************************************************** + * + * File Name: vad.h + * + * Purpose: Contains the prototypes for all functions of voice activity + * detection. Also contains the type definition for the pseudo + * floating point data type. + * + **************************************************************************/ + +/* Struct for storing pseudo floating point exponent and mantissa */ +struct _fp +{ + Word16 e; /* exponent */ + Word16 m; /* mantissa */ +}; + +typedef struct _fp Pfloat; + +void vad_reset (void); + +Word16 vad_computation ( + Word16 r_h[], + Word16 r_l[], + Word16 scal_acf, + Word16 rc[], + Word16 ptch +); + +void energy_computation ( + Word16 r_h[], + Word16 scal_acf, + Word16 rvad[], + Word16 scal_rvad, + Pfloat * acf0, + Pfloat * pvad +); + +void acf_averaging ( + Word16 r_h[], + Word16 r_l[], + Word16 scal_acf, + Word32 L_av0[], + Word32 L_av1[] +); + +void predictor_values ( + Word32 L_av1[], + Word16 rav1[], + Word16 *scal_rav1 +); + +void schur_recursion ( + Word32 L_av1[], + Word16 vpar[] +); + +void step_up ( + Word16 np, + Word16 vpar[], + Word16 aav1[] +); + +void compute_rav1 ( + Word16 aav1[], + Word16 rav1[], + Word16 *scal_rav1 +); + +Word16 spectral_comparison ( + Word16 rav1[], + Word16 scal_rav1, + Word32 L_av0[] +); + +void threshold_adaptation ( + Word16 stat, + Word16 ptch, + Word16 tone, + Word16 rav1[], + Word16 scal_rav1, + Pfloat pvad, + Pfloat acf0, + Word16 rvad[], + Word16 *scal_rvad, + Pfloat * thvad +); + +void tone_detection ( + Word16 rc[], + Word16 *tone +); + +Word16 vad_decision ( + Pfloat pvad, + Pfloat thvad +); + +Word16 vad_hangover ( + Word16 vvad +); + +void periodicity_update ( + Word16 lags[], + Word16 *ptch +);