annotate xa/xa_gsm.c @ 88:747e1e4d7b0f

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