annotate xa/xa_gsm.c @ 3572:dc8fe516de8f

"I updatet codecs.html and translated whole new file: bugsreports.html. In all three files I set the charset encodding." Justyna Bia\263a <nell@skrzynka.pl>
author gabucino
date Mon, 17 Dec 2001 23:54:13 +0000
parents a6c5a537f30a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1
867
d2d534253395 authors' notice changed/added
gabucino
parents: 1
diff changeset
2 /*
d2d534253395 authors' notice changed/added
gabucino
parents: 1
diff changeset
3 Written by Mark Podlipec <podlipec@ici.net>.
d2d534253395 authors' notice changed/added
gabucino
parents: 1
diff changeset
4
d2d534253395 authors' notice changed/added
gabucino
parents: 1
diff changeset
5 Most of this code comes from a GSM 06.10 library by
d2d534253395 authors' notice changed/added
gabucino
parents: 1
diff changeset
6 Jutta Degener and Carsten Bormann, available via
d2d534253395 authors' notice changed/added
gabucino
parents: 1
diff changeset
7 <http://www.pobox.com/~jutta/toast.html>.
d2d534253395 authors' notice changed/added
gabucino
parents: 1
diff changeset
8
d2d534253395 authors' notice changed/added
gabucino
parents: 1
diff changeset
9 That library is distributed with the following copyright:
d2d534253395 authors' notice changed/added
gabucino
parents: 1
diff changeset
10
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 Copyright 1992 by Jutta Degener and Carsten Bormann,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 Technische Universitaet Berlin
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 Any use of this software is permitted provided that this notice is not
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 removed and that neither the authors nor the Technische Universitaet Berlin
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 are deemed to have made any representations as to the suitability of this
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 software for any purpose nor are held responsible for any defects of
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 As a matter of courtesy, the authors request to be informed about uses
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 this software has found, about bugs in this software, and about any
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 improvements that may be of general interest.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 Berlin, 15.09.1992
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 Jutta Degener
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 Carsten Bormann
867
d2d534253395 authors' notice changed/added
gabucino
parents: 1
diff changeset
27 */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 #include <stdio.h>
2476
a6c5a537f30a a few warning fixes (missing #include's)
pl
parents: 867
diff changeset
31 #include <string.h>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 #include <assert.h> /* POD optional */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 #include "xa_gsm_int.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 //void XA_MSGSM_Decoder();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 static void GSM_Decode();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 static void Gsm_RPE_Decoding();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 //static short gsm_buf[320];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 static XA_GSM_STATE gsm_state;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 unsigned char xa_sign_2_ulaw[256];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 unsigned char XA_Signed_To_uLaw(long ch)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46 long mask;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 if (ch < 0) { ch = -ch; mask = 0x7f; }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 else { mask = 0xff; }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49 if (ch < 32) { ch = 0xF0 | (15 - (ch / 2)); }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 else if (ch < 96) { ch = 0xE0 | (15 - (ch - 32) / 4); }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 else if (ch < 224) { ch = 0xD0 | (15 - (ch - 96) / 8); }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52 else if (ch < 480) { ch = 0xC0 | (15 - (ch - 224) / 16); }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 else if (ch < 992) { ch = 0xB0 | (15 - (ch - 480) / 32); }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 else if (ch < 2016) { ch = 0xA0 | (15 - (ch - 992) / 64); }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 else if (ch < 4064) { ch = 0x90 | (15 - (ch - 2016) / 128); }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 else if (ch < 8160) { ch = 0x80 | (15 - (ch - 4064) / 256); }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 else { ch = 0x80; }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 return (mask & ch);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 void Gen_Signed_2_uLaw()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 unsigned long i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 for(i=0;i<256;i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 { unsigned char d;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 char ch = i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 long chr = ch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 d = XA_Signed_To_uLaw(chr * 16);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 xa_sign_2_ulaw[i] = d;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 void GSM_Init()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 memset((char *)(&gsm_state), 0, sizeof(XA_GSM_STATE));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 gsm_state.nrp = 40;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 Gen_Signed_2_uLaw();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 /* Table 4.3b Quantization levels of the LTP gain quantizer
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 /* bc 0 1 2 3 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 static word gsm_QLB[4] = { 3277, 11469, 21299, 32767 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 /* Table 4.6 Normalized direct mantissa used to compute xM/xmax
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 /* i 0 1 2 3 4 5 6 7 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 static word gsm_FAC[8] = { 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94 /****************/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 #define saturate(x) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 ((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 /****************/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99 static word gsm_sub (a,b)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 word a;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101 word b;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 longword diff = (longword)a - (longword)b;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 return saturate(diff);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 /****************/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108 static word gsm_asr (a,n)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 word a;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 int n;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 if (n >= 16) return -(a < 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 if (n <= -16) return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 if (n < 0) return a << -n;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116 # ifdef SASR
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117 return a >> n;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 # else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 if (a >= 0) return a >> n;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120 else return -(word)( -(uword)a >> n );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121 # endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
124 /****************/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125 static word gsm_asl (a,n)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126 word a;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 int n;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129 if (n >= 16) return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
130 if (n <= -16) return -(a < 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
131 if (n < 0) return gsm_asr(a, -n);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132 return a << n;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
133 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
134
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
135
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
136 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
138 * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139 * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142 /**** 4.2.17 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143 static void RPE_grid_positioning(Mc,xMp,ep)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144 word Mc; /* grid position IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145 register word * xMp; /* [0..12] IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146 register word * ep; /* [0..39] OUT */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148 * This procedure computes the reconstructed long term residual signal
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149 * ep[0..39] for the LTP analysis filter. The inputs are the Mc
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
150 * which is the grid position selection and the xMp[0..12] decoded
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
151 * RPE samples which are upsampled by a factor of 3 by inserting zero
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152 * values.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
155 int i = 13;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
156
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157 assert(0 <= Mc && Mc <= 3);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
158
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159 switch (Mc) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160 case 3: *ep++ = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161 case 2: do {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
162 *ep++ = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
163 case 1: *ep++ = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164 case 0: *ep++ = *xMp++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165 } while (--i);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167 while (++Mc < 4) *ep++ = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171 int i, k;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
172 for (k = 0; k <= 39; k++) ep[k] = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
173 for (i = 0; i <= 12; i++) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174 ep[ Mc + (3*i) ] = xMp[i];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
175 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180 /**** 4.2.16 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181 static void APCM_inverse_quantization (xMc,mant,exp,xMp)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 register word * xMc; /* [0..12] IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 word mant;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 word exp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185 register word * xMp; /* [0..12] OUT */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 * This part is for decoding the RPE sequence of coded xMc[0..12]
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188 * samples to obtain the xMp[0..12] array. Table 4.6 is used to get
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 * the mantissa of xmaxc (FAC[0..7]).
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193 word temp, temp1, temp2, temp3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194 longword ltmp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
196 assert( mant >= 0 && mant <= 7 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 temp1 = gsm_FAC[ mant ]; /* see 4.2-15 for mant */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199 temp2 = gsm_sub( 6, exp ); /* see 4.2-15 for exp */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 temp3 = gsm_asl( 1, gsm_sub( temp2, 1 ));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 for (i = 13; i--;) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204 assert( *xMc <= 7 && *xMc >= 0 ); /* 3 bit unsigned */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206 /* temp = gsm_sub( *xMc++ << 1, 7 ); */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 temp = (*xMc++ << 1) - 7; /* restore sign */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208 assert( temp <= 7 && temp >= -7 ); /* 4 bit signed */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 temp <<= 12; /* 16 bit signed */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 temp = GSM_MULT_R( temp1, temp );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212 temp = GSM_ADD( temp, temp3 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 *xMp++ = gsm_asr( temp, temp2 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218 /**** 4.12.15 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219 static void APCM_quantization_xmaxc_to_exp_mant (xmaxc,exp_out,mant_out)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220 word xmaxc; /* IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221 word * exp_out; /* OUT */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 word * mant_out; /* OUT */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224 word exp, mant;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
226 /* Compute exponent and mantissa of the decoded version of xmaxc
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
227 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
228
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229 exp = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230 if (xmaxc > 15) exp = SASR(xmaxc, 3) - 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
231 mant = xmaxc - (exp << 3);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233 if (mant == 0) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234 exp = -4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
235 mant = 7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237 else {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
238 while (mant <= 7) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
239 mant = mant << 1 | 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
240 exp--;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
242 mant -= 8;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
243 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
244
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
245 assert( exp >= -4 && exp <= 6 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
246 assert( mant >= 0 && mant <= 7 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
247
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
248 *exp_out = exp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
249 *mant_out = mant;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
250 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
251
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
252 static void Gsm_RPE_Decoding (S, xmaxcr, Mcr, xMcr, erp)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
253 XA_GSM_STATE * S;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
254 word xmaxcr;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
255 word Mcr;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
256 word * xMcr; /* [0..12], 3 bits IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
257 word * erp; /* [0..39] OUT */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
258
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
259 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
260 word exp, mant;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
261 word xMp[ 13 ];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
262
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
263 APCM_quantization_xmaxc_to_exp_mant( xmaxcr, &exp, &mant );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
264 APCM_inverse_quantization( xMcr, mant, exp, xMp );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
265 RPE_grid_positioning( Mcr, xMp, erp );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
266
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
267 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
268
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
269
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
270 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
271 * 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
272 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
273
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
274 static void Postprocessing(S,s)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
275 XA_GSM_STATE * S;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
276 register word * s;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
277 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
278 register int k;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
279 register word msr = S->msr;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
280 register longword ltmp; /* for GSM_ADD */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
281 register word tmp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
282
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
283 for (k = 160; k--; s++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
284 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
285 tmp = GSM_MULT_R( msr, 28180 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
286 msr = GSM_ADD(*s, tmp); /* Deemphasis */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
287 *s = GSM_ADD(msr, msr) & 0xFFF8; /* Truncation & Upscaling */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
288 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
289 S->msr = msr;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
290 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
291
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
292 /**** 4.3.2 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
293 void Gsm_Long_Term_Synthesis_Filtering (S,Ncr,bcr,erp,drp)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
294 XA_GSM_STATE * S;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
295 word Ncr;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
296 word bcr;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
297 register word * erp; /* [0..39] IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
298 register word * drp; /* [-120..-1] IN, [-120..40] OUT */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
299
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
300 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
301 * This procedure uses the bcr and Ncr parameter to realize the
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
302 * long term synthesis filtering. The decoding of bcr needs
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
303 * table 4.3b.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
304 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
305 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
306 register longword ltmp; /* for ADD */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
307 register int k;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
308 word brp, drpp, Nr;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
309
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
310 /* Check the limits of Nr.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
311 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
312 Nr = Ncr < 40 || Ncr > 120 ? S->nrp : Ncr;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
313 S->nrp = Nr;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
314 assert(Nr >= 40 && Nr <= 120);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
315
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
316 /* Decoding of the LTP gain bcr
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
317 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
318 brp = gsm_QLB[ bcr ];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
319
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
320 /* Computation of the reconstructed short term residual
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
321 * signal drp[0..39]
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
322 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
323 assert(brp != MIN_WORD);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
324
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
325 for (k = 0; k <= 39; k++) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
326 drpp = GSM_MULT_R( brp, drp[ k - Nr ] );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
327 drp[k] = GSM_ADD( erp[k], drpp );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
328 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
329
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
330 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
331 * Update of the reconstructed short term residual signal
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
332 * drp[ -1..-120 ]
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
333 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
334
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
335 for (k = 0; k <= 119; k++) drp[ -120 + k ] = drp[ -80 + k ];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
336 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
337
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
338 static void Short_term_synthesis_filtering (S,rrp,k,wt,sr)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
339 XA_GSM_STATE *S;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
340 register word *rrp; /* [0..7] IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
341 register int k; /* k_end - k_start */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
342 register word *wt; /* [0..k-1] IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
343 register word *sr; /* [0..k-1] OUT */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
344 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
345 register word * v = S->v;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
346 register int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
347 register word sri, tmp1, tmp2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
348 register longword ltmp; /* for GSM_ADD & GSM_SUB */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
349
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
350 while (k--) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
351 sri = *wt++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
352 for (i = 8; i--;) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
353
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
354 /* sri = GSM_SUB( sri, gsm_mult_r( rrp[i], v[i] ) );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
355 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
356 tmp1 = rrp[i];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
357 tmp2 = v[i];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
358 tmp2 = ( tmp1 == MIN_WORD && tmp2 == MIN_WORD
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
359 ? MAX_WORD
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
360 : 0x0FFFF & (( (longword)tmp1 * (longword)tmp2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
361 + 16384) >> 15)) ;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
362
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
363 sri = GSM_SUB( sri, tmp2 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
364
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
365 /* v[i+1] = GSM_ADD( v[i], gsm_mult_r( rrp[i], sri ) );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
366 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
367 tmp1 = ( tmp1 == MIN_WORD && sri == MIN_WORD
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
368 ? MAX_WORD
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
369 : 0x0FFFF & (( (longword)tmp1 * (longword)sri
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
370 + 16384) >> 15)) ;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
371
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
372 v[i+1] = GSM_ADD( v[i], tmp1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
373 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
374 *sr++ = v[0] = sri;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
375 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
376 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
377
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
378 /* 4.2.8 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
379
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
380 static void Decoding_of_the_coded_Log_Area_Ratios (LARc,LARpp)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
381 word * LARc; /* coded log area ratio [0..7] IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
382 word * LARpp; /* out: decoded .. */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
383 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
384 register word temp1 /* , temp2 */;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
385 register long ltmp; /* for GSM_ADD */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
386
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
387 /* This procedure requires for efficient implementation
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
388 * two tables.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
389 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
390 * INVA[1..8] = integer( (32768 * 8) / real_A[1..8])
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
391 * MIC[1..8] = minimum value of the LARc[1..8]
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
392 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
393
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
394 /* Compute the LARpp[1..8]
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
395 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
396
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
397 /* for (i = 1; i <= 8; i++, B++, MIC++, INVA++, LARc++, LARpp++) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
398 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
399 * temp1 = GSM_ADD( *LARc, *MIC ) << 10;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
400 * temp2 = *B << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
401 * temp1 = GSM_SUB( temp1, temp2 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
402 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
403 * assert(*INVA != MIN_WORD);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
404 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
405 * temp1 = GSM_MULT_R( *INVA, temp1 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
406 * *LARpp = GSM_ADD( temp1, temp1 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
407 * }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
408 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
409
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
410 #undef STEP
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
411 #define STEP( B, MIC, INVA ) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
412 temp1 = GSM_ADD( *LARc++, MIC ) << 10; \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
413 temp1 = GSM_SUB( temp1, B << 1 ); \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
414 temp1 = GSM_MULT_R( INVA, temp1 ); \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
415 *LARpp++ = GSM_ADD( temp1, temp1 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
416
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
417 STEP( 0, -32, 13107 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
418 STEP( 0, -32, 13107 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
419 STEP( 2048, -16, 13107 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
420 STEP( -2560, -16, 13107 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
421
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
422 STEP( 94, -8, 19223 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
423 STEP( -1792, -8, 17476 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
424 STEP( -341, -4, 31454 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
425 STEP( -1144, -4, 29708 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
426
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
427 /* NOTE: the addition of *MIC is used to restore
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
428 * the sign of *LARc.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
429 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
430 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
431
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
432 /* 4.2.9 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
433 /* Computation of the quantized reflection coefficients
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
434 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
435
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
436 /* 4.2.9.1 Interpolation of the LARpp[1..8] to get the LARp[1..8]
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
437 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
438
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
439 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
440 * Within each frame of 160 analyzed speech samples the short term
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
441 * analysis and synthesis filters operate with four different sets of
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
442 * coefficients, derived from the previous set of decoded LARs(LARpp(j-1))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
443 * and the actual set of decoded LARs (LARpp(j))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
444 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
445 * (Initial value: LARpp(j-1)[1..8] = 0.)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
446 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
447
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
448 static void Coefficients_0_12 (LARpp_j_1, LARpp_j, LARp)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
449 register word * LARpp_j_1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
450 register word * LARpp_j;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
451 register word * LARp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
452 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
453 register int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
454 register longword ltmp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
455
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
456 for (i = 1; i <= 8; i++, LARp++, LARpp_j_1++, LARpp_j++) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
457 *LARp = GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 ));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
458 *LARp = GSM_ADD( *LARp, SASR( *LARpp_j_1, 1));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
459 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
460 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
461
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
462 static void Coefficients_13_26 (LARpp_j_1, LARpp_j, LARp)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
463 register word * LARpp_j_1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
464 register word * LARpp_j;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
465 register word * LARp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
466 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
467 register int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
468 register longword ltmp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
469 for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
470 *LARp = GSM_ADD( SASR( *LARpp_j_1, 1), SASR( *LARpp_j, 1 ));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
471 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
472 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
473
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
474 static void Coefficients_27_39 (LARpp_j_1, LARpp_j, LARp)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
475 register word * LARpp_j_1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
476 register word * LARpp_j;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
477 register word * LARp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
478 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
479 register int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
480 register longword ltmp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
481
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
482 for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
483 *LARp = GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 ));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
484 *LARp = GSM_ADD( *LARp, SASR( *LARpp_j, 1 ));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
485 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
486 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
487
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
488
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
489 static void Coefficients_40_159 (LARpp_j, LARp)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
490 register word * LARpp_j;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
491 register word * LARp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
492 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
493 register int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
494
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
495 for (i = 1; i <= 8; i++, LARp++, LARpp_j++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
496 *LARp = *LARpp_j;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
497 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
498 /* 4.2.9.2 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
499
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
500 static void LARp_to_rp (LARp)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
501 register word * LARp; /* [0..7] IN/OUT */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
502 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
503 * The input of this procedure is the interpolated LARp[0..7] array.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
504 * The reflection coefficients, rp[i], are used in the analysis
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
505 * filter and in the synthesis filter.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
506 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
507 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
508 register int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
509 register word temp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
510 register longword ltmp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
511
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
512 for (i = 1; i <= 8; i++, LARp++) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
513
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
514 /* temp = GSM_ABS( *LARp );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
515 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
516 * if (temp < 11059) temp <<= 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
517 * else if (temp < 20070) temp += 11059;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
518 * else temp = GSM_ADD( temp >> 2, 26112 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
519 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
520 * *LARp = *LARp < 0 ? -temp : temp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
521 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
522
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
523 if (*LARp < 0) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
524 temp = *LARp == MIN_WORD ? MAX_WORD : -(*LARp);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
525 *LARp = - ((temp < 11059) ? temp << 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
526 : ((temp < 20070) ? temp + 11059
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
527 : GSM_ADD( temp >> 2, 26112 )));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
528 } else {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
529 temp = *LARp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
530 *LARp = (temp < 11059) ? temp << 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
531 : ((temp < 20070) ? temp + 11059
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
532 : GSM_ADD( temp >> 2, 26112 ));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
533 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
534 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
535 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
536
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
537
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
538
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
539
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
540
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
541 /**** */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
542 static void Gsm_Short_Term_Synthesis_Filter (S, LARcr, wt, s)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
543 XA_GSM_STATE * S;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
544 word * LARcr; /* received log area ratios [0..7] IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
545 word * wt; /* received d [0..159] IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
546 word * s; /* signal s [0..159] OUT */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
547 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
548 word * LARpp_j = S->LARpp[ S->j ];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
549 word * LARpp_j_1 = S->LARpp[ S->j ^=1 ];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
550
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
551 word LARp[8];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
552
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
553 #undef FILTER
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
554 #if defined(FAST) && defined(USE_FLOAT_MUL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
555
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
556 # define FILTER (* (S->fast \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
557 ? Fast_Short_term_synthesis_filtering \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
558 : Short_term_synthesis_filtering ))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
559 #else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
560 # define FILTER Short_term_synthesis_filtering
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
561 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
562
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
563 Decoding_of_the_coded_Log_Area_Ratios( LARcr, LARpp_j );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
564
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
565 Coefficients_0_12( LARpp_j_1, LARpp_j, LARp );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
566 LARp_to_rp( LARp );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
567 FILTER( S, LARp, 13, wt, s );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
568
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
569 Coefficients_13_26( LARpp_j_1, LARpp_j, LARp);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
570 LARp_to_rp( LARp );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
571 FILTER( S, LARp, 14, wt + 13, s + 13 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
572
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
573 Coefficients_27_39( LARpp_j_1, LARpp_j, LARp);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
574 LARp_to_rp( LARp );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
575 FILTER( S, LARp, 13, wt + 27, s + 27 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
576
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
577 Coefficients_40_159( LARpp_j, LARp );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
578 LARp_to_rp( LARp );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
579 FILTER(S, LARp, 120, wt + 40, s + 40);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
580 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
581
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
582
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
583
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
584
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
585 static void GSM_Decode(S,LARcr, Ncr,bcr,Mcr,xmaxcr,xMcr,s)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
586 XA_GSM_STATE *S;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
587 word *LARcr; /* [0..7] IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
588 word *Ncr; /* [0..3] IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
589 word *bcr; /* [0..3] IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
590 word *Mcr; /* [0..3] IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
591 word *xmaxcr; /* [0..3] IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
592 word *xMcr; /* [0..13*4] IN */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
593 word *s; /* [0..159] OUT */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
594 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
595 int j, k;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
596 word erp[40], wt[160];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
597 word *drp = S->dp0 + 120;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
598
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
599 for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
600 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
601 Gsm_RPE_Decoding( S, *xmaxcr, *Mcr, xMcr, erp );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
602 Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
603 for (k = 0; k <= 39; k++) wt[ j * 40 + k ] = drp[ k ];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
604 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
605
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
606 Gsm_Short_Term_Synthesis_Filter( S, LARcr, wt, s );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
607 Postprocessing(S, s);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
608 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
609
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
610
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
611
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
612 /****-------------------------------------------------------------------****
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
613 **** Podlipec: For AVI/WAV files GSM 6.10 combines two 33 bytes frames
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
614 **** into one 65 byte frame.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
615 ****-------------------------------------------------------------------****/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
616 void XA_MSGSM_Decoder(unsigned char *ibuf,unsigned short *obuf)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
617 { word sr;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
618 word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
619
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
620 sr = *ibuf++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
621
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
622 LARc[0] = sr & 0x3f; sr >>= 6;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
623 sr |= (word)*ibuf++ << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
624 LARc[1] = sr & 0x3f; sr >>= 6;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
625 sr |= (word)*ibuf++ << 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
626 LARc[2] = sr & 0x1f; sr >>= 5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
627 LARc[3] = sr & 0x1f; sr >>= 5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
628 sr |= (word)*ibuf++ << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
629 LARc[4] = sr & 0xf; sr >>= 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
630 LARc[5] = sr & 0xf; sr >>= 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
631 sr |= (word)*ibuf++ << 2; /* 5 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
632 LARc[6] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
633 LARc[7] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
634 sr |= (word)*ibuf++ << 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
635 Nc[0] = sr & 0x7f; sr >>= 7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
636 bc[0] = sr & 0x3; sr >>= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
637 Mc[0] = sr & 0x3; sr >>= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
638 sr |= (word)*ibuf++ << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
639 xmaxc[0] = sr & 0x3f; sr >>= 6;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
640 xmc[0] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
641 sr = *ibuf++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
642 xmc[1] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
643 xmc[2] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
644 sr |= (word)*ibuf++ << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
645 xmc[3] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
646 xmc[4] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
647 xmc[5] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
648 sr |= (word)*ibuf++ << 1; /* 10 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
649 xmc[6] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
650 xmc[7] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
651 xmc[8] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
652 sr = *ibuf++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
653 xmc[9] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
654 xmc[10] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
655 sr |= (word)*ibuf++ << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
656 xmc[11] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
657 xmc[12] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
658 sr |= (word)*ibuf++ << 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
659 Nc[1] = sr & 0x7f; sr >>= 7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
660 bc[1] = sr & 0x3; sr >>= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
661 Mc[1] = sr & 0x3; sr >>= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
662 sr |= (word)*ibuf++ << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
663 xmaxc[1] = sr & 0x3f; sr >>= 6;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
664 xmc[13] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
665 sr = *ibuf++; /* 15 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
666 xmc[14] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
667 xmc[15] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
668 sr |= (word)*ibuf++ << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
669 xmc[16] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
670 xmc[17] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
671 xmc[18] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
672 sr |= (word)*ibuf++ << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
673 xmc[19] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
674 xmc[20] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
675 xmc[21] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
676 sr = *ibuf++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
677 xmc[22] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
678 xmc[23] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
679 sr |= (word)*ibuf++ << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
680 xmc[24] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
681 xmc[25] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
682 sr |= (word)*ibuf++ << 4; /* 20 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
683 Nc[2] = sr & 0x7f; sr >>= 7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
684 bc[2] = sr & 0x3; sr >>= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
685 Mc[2] = sr & 0x3; sr >>= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
686 sr |= (word)*ibuf++ << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
687 xmaxc[2] = sr & 0x3f; sr >>= 6;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
688 xmc[26] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
689 sr = *ibuf++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
690 xmc[27] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
691 xmc[28] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
692 sr |= (word)*ibuf++ << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
693 xmc[29] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
694 xmc[30] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
695 xmc[31] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
696 sr |= (word)*ibuf++ << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
697 xmc[32] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
698 xmc[33] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
699 xmc[34] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
700 sr = *ibuf++; /* 25 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
701 xmc[35] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
702 xmc[36] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
703 sr |= (word)*ibuf++ << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
704 xmc[37] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
705 xmc[38] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
706 sr |= (word)*ibuf++ << 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
707 Nc[3] = sr & 0x7f; sr >>= 7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
708 bc[3] = sr & 0x3; sr >>= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
709 Mc[3] = sr & 0x3; sr >>= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
710 sr |= (word)*ibuf++ << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
711 xmaxc[3] = sr & 0x3f; sr >>= 6;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
712 xmc[39] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
713 sr = *ibuf++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
714 xmc[40] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
715 xmc[41] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
716 sr |= (word)*ibuf++ << 2; /* 30 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
717 xmc[42] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
718 xmc[43] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
719 xmc[44] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
720 sr |= (word)*ibuf++ << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
721 xmc[45] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
722 xmc[46] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
723 xmc[47] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
724 sr = *ibuf++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
725 xmc[48] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
726 xmc[49] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
727 sr |= (word)*ibuf++ << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
728 xmc[50] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
729 xmc[51] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
730
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
731 GSM_Decode(&gsm_state, LARc, Nc, bc, Mc, xmaxc, xmc, obuf);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
732
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
733 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
734 carry = sr & 0xf;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
735 sr = carry;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
736 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
737 /* 2nd frame */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
738 sr &= 0xf;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
739 sr |= (word)*ibuf++ << 4; /* 1 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
740 LARc[0] = sr & 0x3f; sr >>= 6;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
741 LARc[1] = sr & 0x3f; sr >>= 6;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
742 sr = *ibuf++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
743 LARc[2] = sr & 0x1f; sr >>= 5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
744 sr |= (word)*ibuf++ << 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
745 LARc[3] = sr & 0x1f; sr >>= 5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
746 LARc[4] = sr & 0xf; sr >>= 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
747 sr |= (word)*ibuf++ << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
748 LARc[5] = sr & 0xf; sr >>= 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
749 LARc[6] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
750 LARc[7] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
751 sr = *ibuf++; /* 5 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
752 Nc[0] = sr & 0x7f; sr >>= 7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
753 sr |= (word)*ibuf++ << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
754 bc[0] = sr & 0x3; sr >>= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
755 Mc[0] = sr & 0x3; sr >>= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
756 sr |= (word)*ibuf++ << 5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
757 xmaxc[0] = sr & 0x3f; sr >>= 6;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
758 xmc[0] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
759 xmc[1] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
760 sr |= (word)*ibuf++ << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
761 xmc[2] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
762 xmc[3] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
763 xmc[4] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
764 sr = *ibuf++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
765 xmc[5] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
766 xmc[6] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
767 sr |= (word)*ibuf++ << 2; /* 10 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
768 xmc[7] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
769 xmc[8] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
770 xmc[9] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
771 sr |= (word)*ibuf++ << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
772 xmc[10] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
773 xmc[11] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
774 xmc[12] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
775 sr = *ibuf++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
776 Nc[1] = sr & 0x7f; sr >>= 7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
777 sr |= (word)*ibuf++ << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
778 bc[1] = sr & 0x3; sr >>= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
779 Mc[1] = sr & 0x3; sr >>= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
780 sr |= (word)*ibuf++ << 5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
781 xmaxc[1] = sr & 0x3f; sr >>= 6;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
782 xmc[13] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
783 xmc[14] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
784 sr |= (word)*ibuf++ << 1; /* 15 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
785 xmc[15] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
786 xmc[16] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
787 xmc[17] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
788 sr = *ibuf++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
789 xmc[18] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
790 xmc[19] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
791 sr |= (word)*ibuf++ << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
792 xmc[20] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
793 xmc[21] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
794 xmc[22] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
795 sr |= (word)*ibuf++ << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
796 xmc[23] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
797 xmc[24] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
798 xmc[25] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
799 sr = *ibuf++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
800 Nc[2] = sr & 0x7f; sr >>= 7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
801 sr |= (word)*ibuf++ << 1; /* 20 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
802 bc[2] = sr & 0x3; sr >>= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
803 Mc[2] = sr & 0x3; sr >>= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
804 sr |= (word)*ibuf++ << 5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
805 xmaxc[2] = sr & 0x3f; sr >>= 6;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
806 xmc[26] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
807 xmc[27] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
808 sr |= (word)*ibuf++ << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
809 xmc[28] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
810 xmc[29] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
811 xmc[30] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
812 sr = *ibuf++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
813 xmc[31] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
814 xmc[32] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
815 sr |= (word)*ibuf++ << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
816 xmc[33] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
817 xmc[34] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
818 xmc[35] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
819 sr |= (word)*ibuf++ << 1; /* 25 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
820 xmc[36] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
821 xmc[37] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
822 xmc[38] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
823 sr = *ibuf++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
824 Nc[3] = sr & 0x7f; sr >>= 7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
825 sr |= (word)*ibuf++ << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
826 bc[3] = sr & 0x3; sr >>= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
827 Mc[3] = sr & 0x3; sr >>= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
828 sr |= (word)*ibuf++ << 5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
829 xmaxc[3] = sr & 0x3f; sr >>= 6;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
830 xmc[39] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
831 xmc[40] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
832 sr |= (word)*ibuf++ << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
833 xmc[41] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
834 xmc[42] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
835 xmc[43] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
836 sr = (word)*ibuf++; /* 30 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
837 xmc[44] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
838 xmc[45] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
839 sr |= (word)*ibuf++ << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
840 xmc[46] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
841 xmc[47] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
842 xmc[48] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
843 sr |= (word)*ibuf++ << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
844 xmc[49] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
845 xmc[50] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
846 xmc[51] = sr & 0x7; sr >>= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
847
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
848 GSM_Decode(&gsm_state, LARc, Nc, bc, Mc, xmaxc, xmc, &obuf[160]);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
849
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
850 /* Return number of source bytes consumed and output samples produced */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
851 // *icnt = 65;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
852 // *ocnt = 320;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
853 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
854 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
855
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
856 #define GSM_MAGIC 0xd
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
857
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
858 void XA_GSM_Decoder(unsigned char *ibuf,unsigned short *obuf)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
859 { word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
860
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
861 /* Sanity */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
862 if (((*ibuf >> 4) & 0x0F) != GSM_MAGIC)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
863 { int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
864 for(i=0;i<160;i++) obuf[i] = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
865 // *icnt = 33;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
866 // *ocnt = 160;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
867 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
868 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
869
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
870 LARc[0] = (*ibuf++ & 0xF) << 2; /* 1 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
871 LARc[0] |= (*ibuf >> 6) & 0x3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
872 LARc[1] = *ibuf++ & 0x3F;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
873 LARc[2] = (*ibuf >> 3) & 0x1F;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
874 LARc[3] = (*ibuf++ & 0x7) << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
875 LARc[3] |= (*ibuf >> 6) & 0x3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
876 LARc[4] = (*ibuf >> 2) & 0xF;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
877 LARc[5] = (*ibuf++ & 0x3) << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
878 LARc[5] |= (*ibuf >> 6) & 0x3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
879 LARc[6] = (*ibuf >> 3) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
880 LARc[7] = *ibuf++ & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
881
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
882 Nc[0] = (*ibuf >> 1) & 0x7F;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
883
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
884 bc[0] = (*ibuf++ & 0x1) << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
885 bc[0] |= (*ibuf >> 7) & 0x1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
886
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
887 Mc[0] = (*ibuf >> 5) & 0x3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
888
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
889 xmaxc[0] = (*ibuf++ & 0x1F) << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
890 xmaxc[0] |= (*ibuf >> 7) & 0x1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
891
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
892 xmc[0] = (*ibuf >> 4) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
893 xmc[1] = (*ibuf >> 1) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
894 xmc[2] = (*ibuf++ & 0x1) << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
895 xmc[2] |= (*ibuf >> 6) & 0x3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
896 xmc[3] = (*ibuf >> 3) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
897 xmc[4] = *ibuf++ & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
898 xmc[5] = (*ibuf >> 5) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
899 xmc[6] = (*ibuf >> 2) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
900 xmc[7] = (*ibuf++ & 0x3) << 1; /* 10 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
901 xmc[7] |= (*ibuf >> 7) & 0x1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
902 xmc[8] = (*ibuf >> 4) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
903 xmc[9] = (*ibuf >> 1) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
904 xmc[10] = (*ibuf++ & 0x1) << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
905 xmc[10] |= (*ibuf >> 6) & 0x3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
906 xmc[11] = (*ibuf >> 3) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
907 xmc[12] = *ibuf++ & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
908
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
909 Nc[1] = (*ibuf >> 1) & 0x7F;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
910
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
911 bc[1] = (*ibuf++ & 0x1) << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
912 bc[1] |= (*ibuf >> 7) & 0x1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
913
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
914 Mc[1] = (*ibuf >> 5) & 0x3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
915
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
916 xmaxc[1] = (*ibuf++ & 0x1F) << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
917 xmaxc[1] |= (*ibuf >> 7) & 0x1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
918
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
919
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
920 xmc[13] = (*ibuf >> 4) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
921 xmc[14] = (*ibuf >> 1) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
922 xmc[15] = (*ibuf++ & 0x1) << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
923 xmc[15] |= (*ibuf >> 6) & 0x3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
924 xmc[16] = (*ibuf >> 3) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
925 xmc[17] = *ibuf++ & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
926 xmc[18] = (*ibuf >> 5) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
927 xmc[19] = (*ibuf >> 2) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
928 xmc[20] = (*ibuf++ & 0x3) << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
929 xmc[20] |= (*ibuf >> 7) & 0x1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
930 xmc[21] = (*ibuf >> 4) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
931 xmc[22] = (*ibuf >> 1) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
932 xmc[23] = (*ibuf++ & 0x1) << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
933 xmc[23] |= (*ibuf >> 6) & 0x3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
934 xmc[24] = (*ibuf >> 3) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
935 xmc[25] = *ibuf++ & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
936
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
937 Nc[2] = (*ibuf >> 1) & 0x7F;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
938
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
939 bc[2] = (*ibuf++ & 0x1) << 1; /* 20 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
940 bc[2] |= (*ibuf >> 7) & 0x1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
941
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
942 Mc[2] = (*ibuf >> 5) & 0x3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
943
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
944 xmaxc[2] = (*ibuf++ & 0x1F) << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
945 xmaxc[2] |= (*ibuf >> 7) & 0x1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
946
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
947
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
948 xmc[26] = (*ibuf >> 4) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
949 xmc[27] = (*ibuf >> 1) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
950 xmc[28] = (*ibuf++ & 0x1) << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
951 xmc[28] |= (*ibuf >> 6) & 0x3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
952 xmc[29] = (*ibuf >> 3) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
953 xmc[30] = *ibuf++ & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
954 xmc[31] = (*ibuf >> 5) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
955 xmc[32] = (*ibuf >> 2) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
956 xmc[33] = (*ibuf++ & 0x3) << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
957 xmc[33] |= (*ibuf >> 7) & 0x1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
958 xmc[34] = (*ibuf >> 4) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
959 xmc[35] = (*ibuf >> 1) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
960 xmc[36] = (*ibuf++ & 0x1) << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
961 xmc[36] |= (*ibuf >> 6) & 0x3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
962 xmc[37] = (*ibuf >> 3) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
963 xmc[38] = *ibuf++ & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
964
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
965 Nc[3] = (*ibuf >> 1) & 0x7F;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
966
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
967 bc[3] = (*ibuf++ & 0x1) << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
968 bc[3] |= (*ibuf >> 7) & 0x1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
969
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
970 Mc[3] = (*ibuf >> 5) & 0x3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
971
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
972 xmaxc[3] = (*ibuf++ & 0x1F) << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
973 xmaxc[3] |= (*ibuf >> 7) & 0x1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
974
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
975 xmc[39] = (*ibuf >> 4) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
976 xmc[40] = (*ibuf >> 1) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
977 xmc[41] = (*ibuf++ & 0x1) << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
978 xmc[41] |= (*ibuf >> 6) & 0x3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
979 xmc[42] = (*ibuf >> 3) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
980 xmc[43] = *ibuf++ & 0x7; /* 30 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
981 xmc[44] = (*ibuf >> 5) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
982 xmc[45] = (*ibuf >> 2) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
983 xmc[46] = (*ibuf++ & 0x3) << 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
984 xmc[46] |= (*ibuf >> 7) & 0x1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
985 xmc[47] = (*ibuf >> 4) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
986 xmc[48] = (*ibuf >> 1) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
987 xmc[49] = (*ibuf++ & 0x1) << 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
988 xmc[49] |= (*ibuf >> 6) & 0x3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
989 xmc[50] = (*ibuf >> 3) & 0x7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
990 xmc[51] = *ibuf & 0x7; /* 33 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
991
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
992 GSM_Decode(&gsm_state, LARc, Nc, bc, Mc, xmaxc, xmc, obuf);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
993
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
994 /* Return number of source bytes consumed and output samples produced */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
995 // *icnt = 33;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
996 // *ocnt = 160;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
997 }