FreeCalypso > hg > gsm-codec-lib
annotate libgsmhr1/dtx_dec.c @ 601:c7c03231002d
libgsmhr1: integrate main body of speech decoder
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Thu, 04 Dec 2025 12:49:19 +0000 |
| parents | 5809165fb140 |
| children |
| rev | line source |
|---|---|
|
598
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /*************************************************************************** |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * File Name: dtx_dec.c |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * Derivation: this module is the subset of GSM 06.06 dtx.c |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * reduced to decoder functions that aren't in dtx_rxfe.c, i.e., |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * apply only to the full decoder and not the TFO transform. |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 **************************************************************************/ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 /*________________________________________________________________________ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 | | |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 | Include Files | |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |________________________________________________________________________| |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #include <string.h> |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 #include "typedefs.h" |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 #include "namespace.h" |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 #include "mathhalf.h" |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 #include "mathdp31.h" |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 #include "dec_func.h" |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #include "dec_state.h" |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #include "dtx_const.h" |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #include "dtx_dec.h" |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 /*________________________________________________________________________ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 | | |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 | Defines | |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 |________________________________________________________________________| |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 #define ASHIFT 4 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 #define ASCALE 0x0800 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 /*________________________________________________________________________ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 | | |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 | DTX Rom Tables | |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 |________________________________________________________________________| |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 /* interpolation curve for comfort noise (i*1/12) i=1..12 */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 static const Shortword psrCNNewFactor[12] = { |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 0x0aaa, 0x1554, 0x1ffe, 0x2aa8, 0x3552, |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 0x3ffc, 0x4aa6, 0x5550, 0x5ffa, 0x6aa4, |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 0x754e, 0x7fff |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 }; |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 /* |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 * This function is a fragment from original rxInterpR0Lpc(): |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 * init or update CN interpolation endpoints on CNIFIRSTSID |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 * or CNICONT. |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 void Init_CN_interpolation(struct gsmhr_decoder_state *st, Shortword deco_mode, |
|
601
c7c03231002d
libgsmhr1: integrate main body of speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
598
diff
changeset
|
57 const Shortword *pswNewKs) |
|
598
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 { |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 st->swR0OldCN = st->swOldR0Dec; |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 if (deco_mode == CNIFIRSTSID) { |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 rcToCorrDpL(ASHIFT, ASCALE, st->pswOldFrmKsDec, |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 st->pL_OldCorrSeq); |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 } else { |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 memcpy(st->pL_OldCorrSeq, st->pL_CorrSeq, |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 sizeof(st->pL_CorrSeq)); |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 } |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 rcToCorrDpL(ASHIFT, ASCALE, pswNewKs, st->pL_NewCorrSeq); |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 } |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 /* |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 * This function is a fragment from original rxInterpR0Lpc(): |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 * interpolate R0 for CN output. |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 */ |
|
601
c7c03231002d
libgsmhr1: integrate main body of speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
598
diff
changeset
|
74 Shortword CN_Interpolate_R0(struct gsmhr_decoder_state *st, Shortword new_R0) |
|
598
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 { |
|
601
c7c03231002d
libgsmhr1: integrate main body of speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
598
diff
changeset
|
76 return linInterpSidShort(new_R0, st->swR0OldCN, st->swRxDTXState); |
|
598
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 } |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 /* |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 * This function is a fragment from original rxInterpR0Lpc(): |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 * interpolate LPC for CN output. |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 void CN_Interpolate_LPC(struct gsmhr_decoder_state *st, Shortword *pswNewKs) |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 { |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 int i; |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 /* linearly interpolate between the two sets of correlation coefs */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 /* -------------------------------------------------------------- */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 for (i = 0; i < NP + 1; i++) |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 { |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 st->pL_CorrSeq[i] = linInterpSid(st->pL_NewCorrSeq[i], |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 st->pL_OldCorrSeq[i], |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 st->swRxDTXState); |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 } |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 /* Generate this frames K's (overwrite input) */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 /* ------------------------------------------ */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 aFlatRcDp(st->pL_CorrSeq, pswNewKs); |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 } |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 /************************************************************************* |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 * FUNCTION NAME: linInterpSid |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 * PURPOSE: |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 * Linearly interpolate between two input numbers based on what the |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 * current DtxState is. |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 * INPUTS: |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 * L_New - longword more current value |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 * L_Old - longword oldest value |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 * swDtxState - state is 0 at the transmitted SID Frame. |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 * OUTPUTS: |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 * none |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 * RETURN VALUE: |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 * A value between old and new inputs with dtxState+1/12 of the new |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 * (dtxState+1)-12/12 of the old |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 *************************************************************************/ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 Longword linInterpSid(Longword L_New, Longword L_Old, Shortword swDtxState) |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 { |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 /*_________________________________________________________________________ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 | | |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 | Automatic Variables | |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 |_________________________________________________________________________| |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 Shortword swOldFactor; |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 /*_________________________________________________________________________ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 | | |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 | Executable Code | |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 |_________________________________________________________________________| |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 /* old factor = (1.0 - newFactor) */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 /* ------------------------------ */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 swOldFactor = sub(0x7fff, psrCNNewFactor[swDtxState]); |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 swOldFactor = add(0x1, swOldFactor); |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 /* contributions from new and old */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 /* ------------------------------ */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 L_New = L_mpy_ls(L_New, psrCNNewFactor[swDtxState]); |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 L_Old = L_mpy_ls(L_Old, swOldFactor); |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 return (L_add(L_New, L_Old)); |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 } |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 /************************************************************************* |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 * FUNCTION NAME: linInterpSidShort |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 * PURPOSE: |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 * Linearly interpolate between two input numbers based on what |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 * the current DtxState is. |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 * INPUTS: |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 * swNew - 16 bit, more current value |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 * swOld - 16 bit, oldest value |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 * swDtxState - state is 0 at the transmitted SID Frame. |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 * OUTPUTS: |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 * none |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 * RETURN VALUE: |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 * A value between old and new inputs with dtxState+1/12 of the new |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 * (dtxState+1)-12/12 of the old |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 * |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 *************************************************************************/ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 Shortword linInterpSidShort(Shortword swNew, Shortword swOld, |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
200 Shortword swDtxState) |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 { |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 /*_________________________________________________________________________ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 | | |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 | Automatic Variables | |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 |_________________________________________________________________________| |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 Shortword swOldFactor; |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 Longword L_New, |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 L_Old; |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
214 /*_________________________________________________________________________ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
215 | | |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
216 | Executable Code | |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
217 |_________________________________________________________________________| |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
218 */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
219 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
220 /* old factor = (1.0 - newFactor) */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
221 /* ------------------------------ */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
222 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
223 swOldFactor = sub(0x7fff, psrCNNewFactor[swDtxState]); |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
224 swOldFactor = add(0x1, swOldFactor); |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
226 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
227 /* contributions from new and old */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
228 /* ------------------------------ */ |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
229 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
230 L_New = L_mult(swNew, psrCNNewFactor[swDtxState]); |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
231 L_Old = L_mult(swOld, swOldFactor); |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
232 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
233 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
234 return (round(L_add(L_New, L_Old))); |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
235 |
|
5809165fb140
libgsmhr1: integrate DTX functions for speech decoder
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
236 } |
