comparison libgsmefr/dtx.h @ 39:36e1363ad885

libgsmefr: initial import of ETSI header files
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 24 Nov 2022 07:38:23 +0000
parents
children 988fd7ff514f
comparison
equal deleted inserted replaced
38:38326102fc43 39:36e1363ad885
1 /***************************************************************************
2 *
3 * File Name: dtx.h
4 *
5 * Purpose: Contains the prototypes for all the functions of DTX.
6 * Also contains definitions of constants used in DTX functions.
7 *
8 **************************************************************************/
9
10 #define PN_INITIAL_SEED 0x70816958L /* Pseudo noise generator seed value */
11
12 #define CN_INT_PERIOD 24 /* Comfort noise interpolation period
13 (nbr of frames between successive
14 SID updates in the decoder) */
15
16 #define DTX_HANGOVER 7 /* Period when SP=1 although VAD=0.
17 Used for comfort noise averaging */
18
19
20 /* Frame classification constants */
21
22 #define VALID_SID_FRAME 1
23 #define INVALID_SID_FRAME 2
24 #define GOOD_SPEECH_FRAME 3
25 #define UNUSABLE_FRAME 4
26
27 /* Encoder DTX control flags */
28
29 #define TX_SP_FLAG 0x0001
30 #define TX_VAD_FLAG 0x0002
31 #define TX_HANGOVER_ACTIVE 0x0004
32 #define TX_PREV_HANGOVER_ACTIVE 0x0008
33 #define TX_SID_UPDATE 0x0010
34 #define TX_USE_OLD_SID 0x0020
35
36 /* Decoder DTX control flags */
37
38 #define RX_SP_FLAG 0x0001
39 #define RX_UPD_SID_QUANT_MEM 0x0002
40 #define RX_FIRST_SID_UPDATE 0x0004
41 #define RX_CONT_SID_UPDATE 0x0008
42 #define RX_LOST_SID_FRAME 0x0010
43 #define RX_INVALID_SID_FRAME 0x0020
44 #define RX_NO_TRANSMISSION 0x0040
45 #define RX_DTX_MUTING 0x0080
46 #define RX_PREV_DTX_MUTING 0x0100
47 #define RX_CNI_BFI 0x0200
48 #define RX_FIRST_SP_FLAG 0x0400
49
50 void reset_tx_dtx (void); /* Reset tx dtx variables */
51 void reset_rx_dtx (void); /* Reset rx dtx variables */
52
53 void tx_dtx (
54 Word16 VAD_flag,
55 Word16 *txdtx_ctrl
56 );
57
58 void rx_dtx (
59 Word16 *rxdtx_ctrl,
60 Word16 TAF,
61 Word16 bfi,
62 Word16 SID_flag
63 );
64
65 void CN_encoding (
66 Word16 params[],
67 Word16 txdtx_ctrl
68 );
69
70 void update_lsf_history (
71 Word16 lsf1[M],
72 Word16 lsf2[M],
73 Word16 lsf_old[DTX_HANGOVER][M]
74 );
75
76 void update_lsf_p_CN (
77 Word16 lsf_old[DTX_HANGOVER][M],
78 Word16 lsf_p_CN[M]
79 );
80
81 void aver_lsf_history (
82 Word16 lsf_old[DTX_HANGOVER][M],
83 Word16 lsf1[M],
84 Word16 lsf2[M],
85 Word16 lsf_aver[M]
86 );
87
88 void update_gain_code_history_tx (
89 Word16 new_gain_code,
90 Word16 gain_code_old_tx[4 * DTX_HANGOVER]
91 );
92
93 void update_gain_code_history_rx (
94 Word16 new_gain_code,
95 Word16 gain_code_old_rx[4 * DTX_HANGOVER]
96 );
97
98 Word16 compute_CN_excitation_gain (
99 Word16 res2[L_SUBFR]
100 );
101
102 Word16 update_gcode0_CN (
103 Word16 gain_code_old_tx[4 * DTX_HANGOVER]
104 );
105
106 Word16 aver_gain_code_history (
107 Word16 CN_excitation_gain,
108 Word16 gain_code_old[4 * DTX_HANGOVER]
109 );
110
111 void build_CN_code (
112 Word16 cod[],
113 Word32 *seed
114 );
115
116 Word16 pseudonoise (
117 Word32 *shift_reg,
118 Word16 no_bits
119 );
120
121 Word16 interpolate_CN_param (
122 Word16 old_param,
123 Word16 new_param,
124 Word16 rx_dtx_state
125 );
126
127 void interpolate_CN_lsf (
128 Word16 lsf_old_CN[M],
129 Word16 lsf_new_CN[M],
130 Word16 lsf_interp_CN[M],
131 Word16 rx_dtx_state
132 );