annotate libgsmhr1/dtx_enc.c @ 622:3ae5508f9a54 default tip

libgsmhr1/sp_sfrm.c: constify "ROM" static data
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 05 Mar 2026 21:56:18 +0000
parents e6e9d5104503
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
613
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /***************************************************************************
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * File Name: dtx_enc.c
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * Derivation: this module is the subset of GSM 06.06 dtx.c
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * reduced to those functions that are used only by the speech
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 * encoder.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 **************************************************************************/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 /*________________________________________________________________________
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 | |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 | Include Files |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 |________________________________________________________________________|
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 #include "typedefs.h"
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 #include "namespace.h"
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 #include "mathhalf.h"
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 #include "mathdp31.h"
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 #include "enc_state.h"
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 #include "dtx_const.h"
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 #include "dtx_enc.h"
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #include "dtx_rxfe.h"
618
e6e9d5104503 libgsmhr1: integrate DTX encoder function lpcCorrQntz()
Mychaela Falconia <falcon@freecalypso.org>
parents: 613
diff changeset
25 #include "sp_frm.h"
613
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 /*________________________________________________________________________
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 | |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 | Defines |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 |________________________________________________________________________|
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 #define OH_SHIFT 3 /* shift corresponding to OVERHANG */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 #define NP_AFLAT 4
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 #define LPC_VQ_SEG 3
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 /*************************************************************************
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 * FUNCTION NAME: swComfortNoise
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 * PURPOSE:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 * This routine perform the following tasks:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 * - generation of the speech flag (swSP)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 * - averaging and encoding of the comfort noise parameters
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 * - randomization of the codebook indices
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 * INPUTS:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 * swVadFrmCnt (global) - swVadFlag=0 frame counter.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 * If swVadFlag=1 then this counter is 0, the first frame with
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 * swVadFlag=0 will set this counter to 1, with each additional
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 * swVadFlag=0 frame the counter is incremented.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 * swVadFlag - voise activity flag. swVadFlag=0 frame with
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 * no voice activity, swVadFlag=0 frame with voice activity
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 * L_UnqntzdR0 - unquantized R(0), 32 bit value, output of
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 * FLAT.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 * pL_UnqntzdCorr[NP+1] - unquantized correlation sequence,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 * also an output of FLAT.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 * OUTPUTS:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 * swCNR0 - global variable, the output quantized R0 index
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 * pswCNLpc[3] - global variable, the output quantized LPC to the
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 * transmitted in the SID frame
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 * pswCNGsp0Code[N_SUB] - global variable, the output quantized GSP0 indices
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 * pswCNVSCode1[N_SUB] - global variable, the output quantized codevector 1
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 * indices.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 * pswCNVSCode2[N_SUB] - global variable, the output quantized codevector 2
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 * indices.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 * RETURN VALUE:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 * swSP - speech flag, swSP=1 speech frames are generated, swSP=0
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 * SID frames are generated.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 *************************************************************************/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 Shortword swComfortNoise(struct gsmhr_encoder_state *st, Shortword swVadFlag,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 Longword L_UnqntzdR0, Longword *pL_UnqntzdCorr)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 /*_________________________________________________________________________
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 | |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 | Automatic Variables |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 |_________________________________________________________________________|
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 struct cn_state *cn_st = &st->cn_state;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 Shortword swSP;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 Shortword pswFinalRc[NP];
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 /* unquantized reference parameters */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 Longword L_RefR0;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 Longword pL_RefCorr[NP + 1];
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 Longword L_RefGs;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 int i;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 /*_________________________________________________________________________
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 | |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 | Executable Code |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 |_________________________________________________________________________|
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 swSP = 1;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 /* VadFrmCnt will indicate the number of sequential frames where */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 /* swVadFlag == 0 */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 /* ------------------------------------------------------------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 if (swVadFlag)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 st->swVadFrmCnt = 0; /* Voice acitvity present */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 else
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 st->swVadFrmCnt = add(st->swVadFrmCnt, 1); /* no voice activity */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 /* swNElapsed will indicate the number of frames that have elapsed */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 /* since the last SID frame with updated comfort noise parameters */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 /* was generated */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 /* --------------------------------------------------------------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 st->swNElapsed = add(st->swNElapsed, 1);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 /* If no voice activity was detected. */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 /* ----------------------------------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 if (st->swVadFrmCnt)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 /* Short speech burst ? */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 /* -------------------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 if (st->swVadFrmCnt == 1)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 if (sub(st->swNElapsed, 24) < 0)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 cn_st->swShortBurst = 1; /* short speech burst detected */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 else
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 cn_st->swShortBurst = 0; /* long speech burst detected */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 }
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 /* Update history, with this frames data */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 /* ------------------------------------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 updateCNHist(st, L_UnqntzdR0, pL_UnqntzdCorr,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 cn_st->pL_R0Hist, cn_st->ppL_CorrHist);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 /* first SID frame */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 /* --------------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 if (((cn_st->swShortBurst == 0) && (st->swVadFrmCnt == OVERHANG)) ||
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 ((cn_st->swShortBurst == 1) && (st->swVadFrmCnt == 1)))
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 /* init. random generator */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 /* ---------------------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 cn_st->L_TxPNSeed = PN_INIT_SEED;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176 /* average GS */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
177 /* ---------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 avgGsHistQntz(st->pL_GsHist, &L_RefGs);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
179
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 /* GS quantization */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182 /* --------------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183 cn_st->swRefGsIndex = gsQuant(L_RefGs, 0);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 }
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 /* No Overhang in case of short speech bursts, */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 /* generate SID frames with repeated comfort noise parameters */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190 /* ---------------------------------------------------------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192 if ((cn_st->swShortBurst == 1) && (st->swVadFrmCnt < OVERHANG))
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
193 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
195 /* generate a SID frame with repeated parameters */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
196 /* --------------------------------------------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198 swSP = 0;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
199
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
200
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
201 /* repeat data: r0, LPC, GS */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
202 /* ------------------------ */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
203
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
204 st->swCNR0 = cn_st->swQntRefR0;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
205
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 for (i = 0; i < 3; i++)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207 st->pswCNLpc[i] = cn_st->piRefVqCodewds[i];
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209 for (i = 0; i < N_SUB; i++)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210 st->pswCNGsp0Code[i] = cn_st->swRefGsIndex;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212 }
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215 /* generate SID frames with updated comfort noise parameters */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 /* --------------------------------------------------------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 if (st->swVadFrmCnt >= OVERHANG)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
219 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
220
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
221 /* A SID frame with updated parameters */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
222 /* ----------------------------------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
224 swSP = 0;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
225 st->swNElapsed = 0;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
226
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
227
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
228 /* average R0 and correlation values */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
229 /* --------------------------------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
230
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
231 avgCNHist(cn_st->pL_R0Hist, cn_st->ppL_CorrHist, &L_RefR0,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
232 pL_RefCorr);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
233
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
234
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
235 /* now quantize the averaged R(0) */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
236 /* ------------------------------ */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
237
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
238 cn_st->swQntRefR0 = r0Quant(L_RefR0);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
239
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
240
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
241 /* Quantize the averaged correlation */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
242 /* --------------------------------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
243
618
e6e9d5104503 libgsmhr1: integrate DTX encoder function lpcCorrQntz()
Mychaela Falconia <falcon@freecalypso.org>
parents: 613
diff changeset
244 lpcCorrQntz(st, pL_RefCorr,
613
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
245 pswFinalRc,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
246 cn_st->piRefVqCodewds);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
247
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
248
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249 /* update frame data: r0, LPC */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
250 /* -------------------------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
251
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
252 st->swCNR0 = cn_st->swQntRefR0;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253 for (i = 0; i < 3; i++)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254 st->pswCNLpc[i] = cn_st->piRefVqCodewds[i];
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257 /* update subframe data (unvoiced mode): GSP0 */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258 /* ------------------------------------------ */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260 for (i = 0; i < N_SUB; i++)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261 st->pswCNGsp0Code[i] = cn_st->swRefGsIndex;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
263 }
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
266 /* random codevectors */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267 /* ------------------ */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269 if (swSP == 0)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271 for (i = 0; i < N_SUB; i++)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273 st->pswCNVSCode1[i] = getPnBits(7, &cn_st->L_TxPNSeed);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274 st->pswCNVSCode2[i] = getPnBits(7, &cn_st->L_TxPNSeed);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 }
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276 }
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
277
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
279 }
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
280
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
281 return (swSP);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
282 }
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
283
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
284
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
285 /*************************************************************************
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
287 * FUNCTION NAME: updateCNHist
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
289 * PURPOSE:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
290 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
291 * Add current frame's unquantized R(0) and LPC information to the
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
292 * comfort noise history, so that it will be available for
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
293 * averaging.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
294 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
295 * INPUTS:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
296 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
297 * Unquantized values from the coder:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
298 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
299 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
300 * L_UnqntzdR0 - unquantized frame energy R(0), an output of FLAT
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
301 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
302 * pL_UnqntzdCorr[NP+1] - unquantized correlation coefficient
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
303 * array. Also an output of FLAT.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
304 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
305 * siUpdPointer (global) - A modulo counter which counts up from
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
306 * 0 to OVERHANG-1.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
307 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
308 * OUTPUTS:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
309 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
310 * pL_R0History[OVERHANG] - history of the OVERHANG frames worth of
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
311 * R(0).
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
312 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
313 * ppL_CorrHistory[OVERHANG][NP+1] - - history of the OVERHANG
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
314 * frames worth of pL_UnqntzdCorr[].
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
315 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
316 * RETURN VALUE:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
317 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
318 * none
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
319 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
320 *************************************************************************/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
321
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
322 void updateCNHist(struct gsmhr_encoder_state *st, Longword L_UnqntzdR0,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
323 Longword *pL_UnqntzdCorr, Longword pL_R0Hist[],
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
324 Longword ppL_CorrHist[OVERHANG][NP + 1])
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
325 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
326
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
327 /*_________________________________________________________________________
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
328 | |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
329 | Automatic Variables |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
330 |_________________________________________________________________________|
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
331 */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
332
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
333 int i;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
334
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
335
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
336 /*_________________________________________________________________________
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
337 | |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
338 | Executable Code |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
339 |_________________________________________________________________________|
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
340 */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
341
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
342 /* update */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
343 pL_R0Hist[st->siUpdPointer] = L_UnqntzdR0;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
344
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
345 for (i = 0; i < NP + 1; i++)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
346 ppL_CorrHist[st->siUpdPointer][i] = pL_UnqntzdCorr[i];
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
347
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
348 st->siUpdPointer = (st->siUpdPointer + 1) % OVERHANG;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
349 }
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
350
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
351
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
352 /*************************************************************************
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
353 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
354 * FUNCTION NAME: avgCNHist
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
355 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
356 * PURPOSE:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
357 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
358 * Average the unquantized R0 and LPC data stored at the encoder
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
359 * to arrive at an average R0 and LPC frame for use in a SID
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
360 * frame.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
361 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
362 * INPUTS:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
363 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
364 * pL_R0History[OVERHANG] - contains unquantized R(0) data from the
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
365 * most recent OVERHANG frame (including this one).
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
366 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
367 * ppL_CorrHistory[OVERHANG][NP+1] - Unquantized correlation
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
368 * coefficients from the most recent OVERHANG frame (including this
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
369 * one). The data stored here is an output of FLAT.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
370 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
371 * OUTPUTS:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
372 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
373 * *pL_AvgdR0 - the average of pL_R0History[]
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
374 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
375 * pL_AvgdCorrSeq[NP+1] - the average of ppL_CorrHistory[][].
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
376 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
377 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
378 * RETURN VALUE:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
379 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
380 * none
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
381 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
382 *************************************************************************/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
383
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
384 void avgCNHist(Longword pL_R0History[],
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
385 Longword ppL_CorrHistory[OVERHANG][NP + 1],
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
386 Longword *pL_AvgdR0, Longword pL_AvgdCorrSeq[])
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
387 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
388
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
389 /*_________________________________________________________________________
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
390 | |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
391 | Automatic Variables |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
392 |_________________________________________________________________________|
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
393 */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
394
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
395 int i,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
396 j;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
397 Longword L_avg;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
398
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
399 /*_________________________________________________________________________
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
400 | |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
401 | Executable Code |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
402 |_________________________________________________________________________|
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
403 */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
404
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
405 /* R0 Averaging */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
406 /* ------------ */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
407
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
408 for (L_avg = 0, i = 0; i < OVERHANG; i++)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
409 L_avg = L_add(L_shr(pL_R0History[i], OH_SHIFT), L_avg);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
410
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
411 *pL_AvgdR0 = L_avg;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
412
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
413
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
414 /* LPC: average the last OVERHANG frames */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
415 /* ------------------------------------- */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
416
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
417 for (j = 0; j < NP + 1; j++)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
418 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
419 for (L_avg = 0, i = 0; i < OVERHANG; i++)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
420 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
421 L_avg = L_add(L_shift_r(ppL_CorrHistory[i][j], -OH_SHIFT), L_avg);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
422 }
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
423
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
424 pL_AvgdCorrSeq[j] = L_avg;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
425 }
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
426
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
427 }
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
428
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
429
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
430 /***************************************************************************
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
431 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
432 * FUNCTION NAME: lpcCorrQntz
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
433 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
434 * PURPOSE: Quantize a correlation sequence
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
435 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
436 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
437 * INPUT:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
438 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
439 * pL_CorrelSeq[NP+1]
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
440 * Correlation sequence to quantize.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
441 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
442 * OUTPUTS:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
443 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
444 * pswFinalRc[0:NP-1]
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
445 * A quantized set of NP reflection coefficients.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
446 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
447 * piVQCodewds[0:2]
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
448 * An array containing the indices of the 3 reflection
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
449 * coefficient vectors selected from the three segment
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
450 * Rc-VQ.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
451 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
452 * RETURN:
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
453 * None.
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
454 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
455 * KEYWORDS: AFLAT,aflat,flat,vectorquantization, reflectioncoefficients
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
456 *
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
457 *************************************************************************/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
458
618
e6e9d5104503 libgsmhr1: integrate DTX encoder function lpcCorrQntz()
Mychaela Falconia <falcon@freecalypso.org>
parents: 613
diff changeset
459 void lpcCorrQntz(struct gsmhr_encoder_state *st, Longword pL_CorrelSeq[],
e6e9d5104503 libgsmhr1: integrate DTX encoder function lpcCorrQntz()
Mychaela Falconia <falcon@freecalypso.org>
parents: 613
diff changeset
460 Shortword pswFinalRc[], int piVQCodewds[])
613
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
461 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
462
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
463 /*_________________________________________________________________________
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
464 | |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
465 | Automatic Variables |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
466 |_________________________________________________________________________|
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
467 */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
468
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
469 Shortword pswPOldSpace[NP_AFLAT],
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
470 pswPNewSpace[NP_AFLAT],
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
471 pswVOldSpace[2 * NP_AFLAT - 1],
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
472 pswVNewSpace[2 * NP_AFLAT - 1],
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
473 *ppswPAddrs[2],
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
474 *ppswVAddrs[2],
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
475 *pswVBar,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
476 pswPBar[NP_AFLAT],
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
477 pswVBarSpace[2 * NP_AFLAT - 1],
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
478 pswFlatsRc[NP], /* Unquantized Rc's computed by FLAT */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
479 pswRc[NP + 1]; /* Temp list for the converted RC's */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
480 Longword *pL_VBarFull,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
481 pL_PBarFull[NP],
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
482 pL_VBarFullSpace[2 * NP - 1];
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
483
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
484 int i,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
485 iVec,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
486 iSeg,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
487 iCnt; /* Loop counter */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
488 struct QuantList quantList, /* A list of vectors */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
489 bestPql[4]; /* The four best vectors from
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
490 * the PreQ */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
491 struct QuantList bestQl[LPC_VQ_SEG + 1]; /* Best vectors for each of
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
492 * the three segments */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
493
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
494 /*_________________________________________________________________________
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
495 | |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
496 | Executable Code |
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
497 |_________________________________________________________________________|
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
498 */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
499
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
500 /* Setup pointers temporary space */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
501 /*--------------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
502
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
503 pswVBar = pswVBarSpace + NP_AFLAT - 1;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
504 pL_VBarFull = pL_VBarFullSpace + NP - 1;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
505 ppswPAddrs[0] = pswPOldSpace;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
506 ppswPAddrs[1] = pswPNewSpace;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
507 ppswVAddrs[0] = pswVOldSpace + NP_AFLAT - 1;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
508 ppswVAddrs[1] = pswVNewSpace + NP_AFLAT - 1;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
509
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
510
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
511 /* Set up pL_PBarFull and pL_VBarFull initial conditions, using the */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
512 /* autocorrelation sequence derived from the optimal reflection */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
513 /* coefficients computed by FLAT. The initial conditions are shifted */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
514 /* right by RSHIFT bits. These initial conditions, stored as */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
515 /* Longwords, are used to initialize PBar and VBar arrays for the */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
516 /* next VQ segment. */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
517 /*--------------------------------------------------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
518
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
519 initPBarFullVBarFullL(pL_CorrelSeq, pL_PBarFull, pL_VBarFull);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
520
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
521 /* Set up initial PBar and VBar initial conditions, using pL_PBarFull */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
522 /* and pL_VBarFull arrays initialized above. These are the initial */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
523 /* PBar and VBar conditions to be used by the AFLAT recursion at the */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
524 /* 1-st Rc-VQ segment. */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
525 /*--------------------------------------------------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
526
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
527 initPBarVBarL(pL_PBarFull, pswPBar, pswVBar);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
528
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
529 for (iSeg = 1; iSeg <= LPC_VQ_SEG; iSeg++)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
530 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
531 /* initialize candidate list */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
532 /*---------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
533
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
534 quantList.iNum = psrPreQSz[iSeg - 1];
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
535 quantList.iRCIndex = 0;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
536
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
537 /* do aflat for all vectors in the list */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
538 /*--------------------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
539
618
e6e9d5104503 libgsmhr1: integrate DTX encoder function lpcCorrQntz()
Mychaela Falconia <falcon@freecalypso.org>
parents: 613
diff changeset
540 setupPreQ(st, iSeg, quantList.iRCIndex); /* set up vector ptrs */
613
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
541
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
542 for (iCnt = 0; iCnt < quantList.iNum; iCnt++)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
543 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
544 /* get a vector */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
545 /*--------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
546
618
e6e9d5104503 libgsmhr1: integrate DTX encoder function lpcCorrQntz()
Mychaela Falconia <falcon@freecalypso.org>
parents: 613
diff changeset
547 getNextVec(st, pswRc);
613
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
548
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
549 /* clear the limiter flag */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
550 /*------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
551
618
e6e9d5104503 libgsmhr1: integrate DTX encoder function lpcCorrQntz()
Mychaela Falconia <falcon@freecalypso.org>
parents: 613
diff changeset
552 st->iLimit = 0;
613
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
553
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
554 /* find the error values for each vector */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
555 /*---------------------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
556
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
557 quantList.pswPredErr[iCnt] =
618
e6e9d5104503 libgsmhr1: integrate DTX encoder function lpcCorrQntz()
Mychaela Falconia <falcon@freecalypso.org>
parents: 613
diff changeset
558 aflatRecursion(st, &pswRc[psvqIndex[iSeg - 1].l],
613
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
559 pswPBar, pswVBar,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
560 ppswPAddrs, ppswVAddrs,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
561 psvqIndex[iSeg - 1].len);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
562
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
563 /* check the limiter flag */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
564 /*------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
565
618
e6e9d5104503 libgsmhr1: integrate DTX encoder function lpcCorrQntz()
Mychaela Falconia <falcon@freecalypso.org>
parents: 613
diff changeset
566 if (st->iLimit)
613
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
567 quantList.pswPredErr[iCnt] = 0x7fff; /* set error to bad value */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
568
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
569 } /* done list loop */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
570
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
571 /* find 4 best prequantizer levels */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
572 /*---------------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
573
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
574 findBestInQuantList(quantList, 4, bestPql);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
575
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
576 for (iVec = 0; iVec < 4; iVec++)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
577 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
578
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
579 /* initialize quantizer list */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
580 /*---------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
581
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
582 quantList.iNum = psrQuantSz[iSeg - 1];
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
583 quantList.iRCIndex = bestPql[iVec].iRCIndex * psrQuantSz[iSeg - 1];
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
584
618
e6e9d5104503 libgsmhr1: integrate DTX encoder function lpcCorrQntz()
Mychaela Falconia <falcon@freecalypso.org>
parents: 613
diff changeset
585 setupQuant(st, iSeg, quantList.iRCIndex); /* set up vector ptrs */
613
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
586
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
587 /* do aflat recursion on each element of list */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
588 /*--------------------------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
589
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
590 for (iCnt = 0; iCnt < quantList.iNum; iCnt++)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
591 {
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
592 /* get a vector */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
593 /*--------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
594
618
e6e9d5104503 libgsmhr1: integrate DTX encoder function lpcCorrQntz()
Mychaela Falconia <falcon@freecalypso.org>
parents: 613
diff changeset
595 getNextVec(st, pswRc);
613
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
596
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
597 /* clear the limiter flag */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
598 /*------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
599
618
e6e9d5104503 libgsmhr1: integrate DTX encoder function lpcCorrQntz()
Mychaela Falconia <falcon@freecalypso.org>
parents: 613
diff changeset
600 st->iLimit = 0;
613
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
601
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
602 /* find the error values for each vector */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
603 /*---------------------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
604
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
605 quantList.pswPredErr[iCnt] =
618
e6e9d5104503 libgsmhr1: integrate DTX encoder function lpcCorrQntz()
Mychaela Falconia <falcon@freecalypso.org>
parents: 613
diff changeset
606 aflatRecursion(st, &pswRc[psvqIndex[iSeg - 1].l],
613
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
607 pswPBar, pswVBar,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
608 ppswPAddrs, ppswVAddrs,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
609 psvqIndex[iSeg - 1].len);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
610
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
611 /* check the limiter flag */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
612 /*------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
613
618
e6e9d5104503 libgsmhr1: integrate DTX encoder function lpcCorrQntz()
Mychaela Falconia <falcon@freecalypso.org>
parents: 613
diff changeset
614 if (st->iLimit)
613
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
615 quantList.pswPredErr[iCnt] = 0x7fff; /* set error to the worst
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
616 * value */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
617
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
618 } /* done list loop */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
619
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
620 /* find best quantizer vector for this segment, and save it */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
621 /*----------------------------------------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
622
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
623 findBestInQuantList(quantList, 1, bestQl);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
624 if (iVec == 0)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
625 bestQl[iSeg] = bestQl[0];
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
626 else if (sub(bestQl[iSeg].pswPredErr[0], bestQl[0].pswPredErr[0]) > 0)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
627 bestQl[iSeg] = bestQl[0];
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
628
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
629 }
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
630
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
631 /* find the quantized reflection coefficients */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
632 /*--------------------------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
633
618
e6e9d5104503 libgsmhr1: integrate DTX encoder function lpcCorrQntz()
Mychaela Falconia <falcon@freecalypso.org>
parents: 613
diff changeset
634 setupQuant(st, iSeg, bestQl[iSeg].iRCIndex); /* set up vector ptrs */
e6e9d5104503 libgsmhr1: integrate DTX encoder function lpcCorrQntz()
Mychaela Falconia <falcon@freecalypso.org>
parents: 613
diff changeset
635 getNextVec(st, (Shortword *) (pswFinalRc - 1));
613
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
636
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
637
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
638 /* Update pBarFull and vBarFull for the next Rc-VQ segment, and */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
639 /* update the pswPBar and pswVBar for the next Rc-VQ segment */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
640 /*--------------------------------------------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
641
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
642 if (iSeg < LPC_VQ_SEG)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
643 aflatNewBarRecursionL(&pswFinalRc[psvqIndex[iSeg - 1].l - 1], iSeg,
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
644 pL_PBarFull, pL_VBarFull, pswPBar, pswVBar);
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
645
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
646 }
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
647
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
648 /* find the quantizer index (the values to be output in the symbol file) */
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
649 /*-----------------------------------------------------------------*/
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
650
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
651 for (iSeg = 1; iSeg <= LPC_VQ_SEG; iSeg++)
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
652 piVQCodewds[iSeg - 1] = bestQl[iSeg].iRCIndex;
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
653
7ce83c70ec5f libgsmhr1: integrate encoder DTX functions, first round
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
654 }