annotate xa/xa_gsm.c @ 1042:b333271f4e7c

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