comparison sp_rom.h @ 0:9008dbc8ca74

import original C code from GSM 06.06
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 14 Jun 2024 23:27:16 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:9008dbc8ca74
1 /***************************************************************************
2 *
3 * Purpose: Define the structure of the Global Constants
4 *
5 **************************************************************************/
6
7 #ifndef ___ROM
8 #define ___ROM
9
10 #include "typedefs.h"
11 #include "mathhalf.h"
12 #include "mathdp31.h"
13
14 /*_________________________________________________________________________
15 | |
16 | Data Types |
17 |_________________________________________________________________________|
18 */
19
20 /* gsp0 vector quantizer */
21 /*-----------------------*/
22 #define GSP0_NUM_OF_TABLES 4
23 #define GSP0_NUM 32
24 #define GSP0_VECTOR_SIZE 5
25
26 extern ShortwordRom pppsrGsp0
27 [GSP0_NUM_OF_TABLES][GSP0_NUM][GSP0_VECTOR_SIZE];
28
29
30 /* unvoiced code vectors */
31 /*-----------------------*/
32 #define UVCODEVEC_NUM_OF_CODE_BOOKS 2
33 #define UVCODEVEC_NUM_OF_CODE_BITS 7
34
35 extern ShortwordRom pppsrUvCodeVec
36 [UVCODEVEC_NUM_OF_CODE_BOOKS][UVCODEVEC_NUM_OF_CODE_BITS][S_LEN];
37
38
39 /* voiced code vectors */
40 /*---------------------*/
41 #define VCDCODEVEC_NUM_OF_CODE_BOOKS 1
42 #define VCDCODEVEC_NUM_OF_CODE_BITS 9
43
44 extern ShortwordRom pppsrVcdCodeVec
45 [VCDCODEVEC_NUM_OF_CODE_BOOKS][VCDCODEVEC_NUM_OF_CODE_BITS][S_LEN];
46
47
48 /* vector quantizer tables */
49 /*-------------------------*/
50 #define QUANT_NUM_OF_TABLES 3
51
52 #define QUANT1_NUM_OF_BITS 11
53 #define QUANT1_NUM_OF_ROWS (1 << QUANT1_NUM_OF_BITS)
54 #define QUANT1_NUM_OF_STAGES 3
55 #define QUANT1_NUM_OF_WORDS (QUANT1_NUM_OF_ROWS*QUANT1_NUM_OF_STAGES/2)
56
57 #define QUANT2_NUM_OF_BITS 9
58 #define QUANT2_NUM_OF_ROWS (1 << QUANT2_NUM_OF_BITS)
59 #define QUANT2_NUM_OF_STAGES 3
60 #define QUANT2_NUM_OF_WORDS (QUANT2_NUM_OF_ROWS*QUANT2_NUM_OF_STAGES/2)
61
62 #define QUANT3_NUM_OF_BITS 8
63 #define QUANT3_NUM_OF_ROWS (1 << QUANT3_NUM_OF_BITS)
64 #define QUANT3_NUM_OF_STAGES 4
65 #define QUANT3_NUM_OF_WORDS (QUANT3_NUM_OF_ROWS*QUANT3_NUM_OF_STAGES/2)
66
67 extern ShortwordRom psrQuant1[QUANT1_NUM_OF_WORDS];
68
69 extern ShortwordRom psrQuant2[QUANT2_NUM_OF_WORDS];
70
71 extern ShortwordRom psrQuant3[QUANT3_NUM_OF_WORDS];
72
73
74 /* lpc pre-quantizer */
75 /*-------------------*/
76 #define PREQ1_NUM_OF_BITS 6
77 #define PREQ1_NUM_OF_ROWS (1 << PREQ1_NUM_OF_BITS)
78 #define PREQ1_NUM_OF_STAGES 3
79 #define PREQ1_NUM_OF_WORDS (PREQ1_NUM_OF_ROWS*PREQ1_NUM_OF_STAGES/2)
80
81 #define PREQ2_NUM_OF_BITS 5
82 #define PREQ2_NUM_OF_ROWS (1 << PREQ2_NUM_OF_BITS)
83 #define PREQ2_NUM_OF_STAGES 3
84 #define PREQ2_NUM_OF_WORDS (PREQ2_NUM_OF_ROWS*PREQ2_NUM_OF_STAGES/2)
85
86 #define PREQ3_NUM_OF_BITS 4
87 #define PREQ3_NUM_OF_ROWS (1 << PREQ3_NUM_OF_BITS)
88 #define PREQ3_NUM_OF_STAGES 4
89 #define PREQ3_NUM_OF_WORDS (PREQ3_NUM_OF_ROWS*PREQ3_NUM_OF_STAGES/2)
90
91 extern ShortwordRom psrPreQ1[PREQ1_NUM_OF_WORDS];
92
93 extern ShortwordRom psrPreQ2[PREQ2_NUM_OF_WORDS];
94
95 extern ShortwordRom psrPreQ3[PREQ3_NUM_OF_WORDS];
96
97
98 /* size of the vq subset in the kth segment */
99 /*------------------------------------------*/
100 extern ShortwordRom psrQuantSz[QUANT_NUM_OF_TABLES];
101
102
103 /* pre-quantizer size */
104 /*--------------------*/
105 extern ShortwordRom psrPreQSz[QUANT_NUM_OF_TABLES];
106
107
108 /* reflection coeff scalar quantizer */
109 /*-----------------------------------*/
110 #define SQUANT_NUM_OF_BITS 8
111 #define SQUANT_NUM_OF_ROWS (1 << SQUANT_NUM_OF_BITS)
112
113 extern ShortwordRom psrSQuant[SQUANT_NUM_OF_ROWS];
114
115
116 /* index structure for LPC Vector Quantizer */
117 /*------------------------------------------*/
118 struct IsubLHn
119 { /* index structure for LPC Vector
120 * Quantizer */
121 ShortwordRom l; /* lowest index index range
122 * from 1..NP */
123 ShortwordRom h; /* highest index */
124 ShortwordRom len; /* h-l+1 */
125 };
126
127
128 extern struct IsubLHn psvqIndex[QUANT_NUM_OF_TABLES];
129
130
131 /* square root of p0 table */
132 /*-------------------------*/
133 #define SQRTP0_NUM_OF_BITS 5
134 #define SQRTP0_NUM_OF_ROWS (1 << SQRTP0_NUM_OF_BITS)
135 #define SQRTP0_NUM_OF_MODES 3
136
137 extern ShortwordRom ppsrSqrtP0[SQRTP0_NUM_OF_MODES][SQRTP0_NUM_OF_ROWS];
138
139
140 /* interpolation filter used for C and G */
141 /*---------------------------------------*/
142 #define CGINTFILT_MACS 6
143
144 extern ShortwordRom ppsrCGIntFilt[CGINTFILT_MACS][OS_FCTR];
145
146
147 /* interpolation filter used pitch */
148 /*---------------------------------*/
149 #define PVECINTFILT_MACS 10
150
151 extern ShortwordRom ppsrPVecIntFilt[PVECINTFILT_MACS][OS_FCTR];
152
153
154 /* fractional pitch lag table lag*OS_FCTR */
155 /*----------------------------------------*/
156 #define LAGTBL_NUM_OF_ROWS 256
157
158 extern ShortwordRom psrLagTbl[LAGTBL_NUM_OF_ROWS];
159
160
161 /* R0 decision value table defines range (not the levels themselves */
162 /*------------------------------------------------------------------*/
163
164 #define R0DECTBL_NUM_OF_R0BITS 5
165 #define R0DECTBL_NUM_OF_ROWS ((1 << R0DECTBL_NUM_OF_R0BITS)*2 - 1)
166
167 extern ShortwordRom psrR0DecTbl[R0DECTBL_NUM_OF_ROWS];
168
169
170 /* high pass filter coefficients */
171 /*-------------------------------*/
172 #define HPFCOEFS_NUM_OF_CODES 10
173
174 extern ShortwordRom psrHPFCoefs[HPFCOEFS_NUM_OF_CODES];
175
176
177 /* spectral smoothing coefficients */
178 /*---------------------------------*/
179 #define NWCOEFS_NUM_OF_CODES 20
180
181 extern ShortwordRom psrNWCoefs[NWCOEFS_NUM_OF_CODES];
182
183
184 /* spectral smoothing coefficients for FLAT */
185 /*------------------------------------------*/
186 #define FLATSSTCOEFS_NUM_OF_CODES 10
187
188 extern LongwordRom pL_rFlatSstCoefs[FLATSSTCOEFS_NUM_OF_CODES];
189
190 extern ShortwordRom psrOldCont[4];
191 extern ShortwordRom psrNewCont[4];
192
193 #endif