blob: 9a00f0d3f15fbfce309fab18632f01df8392513d [file] [log] [blame]
Vadim Yanitskiy3262f822016-09-23 01:48:59 +07001/*
2 * (C) 2013 by Andreas Eversberg <jolly@eversberg.eu>
3 * (C) 2015 by Alexander Chemeris <Alexander.Chemeris@fairwaves.co>
4 *
5 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 */
21
22#include <stdio.h>
23#include <errno.h>
24#include <unistd.h>
25#include <string.h>
26#include <stdlib.h>
27
28#include <osmocom/core/bits.h>
29#include <osmocom/core/utils.h>
30
31#include <osmocom/coding/gsm0503_coding.h>
32
33#define ASSERT_TRUE(rc) \
34 if (!(rc)) { \
35 printf("Assert failed in %s:%d.\n", \
36 __FILE__, __LINE__); \
37 abort(); \
38 }
39
40/* set condition to 1, to show debugging */
41#define printd if (0) printf
42
43static int ubits2sbits(ubit_t *ubits, sbit_t *sbits, int count)
44{
45 int i;
46
47 for (i = 0; i < count; i++) {
48 if (*ubits == 0x23) {
49 ubits++;
50 sbits++;
51 continue;
52 }
53
54 if ((*ubits++) & 1) {
55 *sbits++ = -127;
56 } else {
57 *sbits++ = 127;
58 }
59 }
60
61 return count;
62}
63
64static void test_xcch(uint8_t *l2)
65{
66 uint8_t result[23];
67 ubit_t bursts_u[116 * 4];
68 sbit_t bursts_s[116 * 4];
69 int n_errors, n_bits_total;
70
71 /* Encode L2 message */
72 printd("Encoding: %s\n", osmo_hexdump(l2, 23));
73 gsm0503_xcch_encode(bursts_u, l2);
74
75 /* Prepare soft-bits */
76 ubits2sbits(bursts_u, bursts_s, 116 * 4);
77
78 printd("U-Bits:\n");
79 printd("%s %02x %02x ", osmo_hexdump(bursts_u, 57),
80 bursts_u[57], bursts_u[58]);
81 printd("%s\n", osmo_hexdump(bursts_u + 59, 57));
82 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 116, 57),
83 bursts_u[57 + 116], bursts_u[58 + 116]);
84 printd("%s\n", osmo_hexdump(bursts_u + 59 + 116, 57));
85 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 232, 57),
86 bursts_u[57 + 232], bursts_u[58 + 232]);
87 printd("%s\n", osmo_hexdump(bursts_u + 59 + 232, 57));
88 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 348, 57),
89 bursts_u[57 + 348], bursts_u[58 + 348]);
90 printd("%s\n", osmo_hexdump(bursts_u + 59 + 348, 57));
91
92 printd("S-Bits:\n");
93 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s, 57),
94 (uint8_t)bursts_s[57], (uint8_t)bursts_s[58]);
95 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59, 57));
96 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 116, 57),
97 (uint8_t)bursts_s[57 + 116], (uint8_t)bursts_s[58 + 116]);
98 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 116, 57));
99 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 232, 57),
100 (uint8_t)bursts_s[57 + 232], (uint8_t)bursts_s[58 + 232]);
101 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 232, 57));
102 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 348, 57),
103 (uint8_t)bursts_s[57 + 348], (uint8_t)bursts_s[58 + 348]);
104 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 348, 57));
105
106 /* Destroy some bits */
107 memset(bursts_s, 0, 30);
108 memset(bursts_s + 116, 0, 30);
109
110 /* Decode, correcting errors */
111 gsm0503_xcch_decode(result, bursts_s, &n_errors, &n_bits_total);
112 printd("Decoded: %s\n", osmo_hexdump(result, 23));
113 printf("xcch_decode: n_errors=%d n_bits_total=%d ber=%.2f\n",
114 n_errors, n_bits_total, (float) n_errors / n_bits_total);
115
116 ASSERT_TRUE(n_bits_total == 456);
117 ASSERT_TRUE(!memcmp(l2, result, 23));
118
119 printd("\n");
120}
121
122static void test_rach(uint8_t bsic, uint8_t ra)
123{
124 uint8_t result;
125 ubit_t bursts_u[36];
126 sbit_t bursts_s[36];
127
128 /* Encode L2 message */
129 printd("Encoding: %02x\n", ra);
130 gsm0503_rach_encode(bursts_u, &ra, bsic);
131
132 /* Prepare soft-bits */
133 ubits2sbits(bursts_u, bursts_s, 36);
134
135 printd("U-Bits:\n");
136 printd("%s\n", osmo_hexdump(bursts_u, 36));
137
138 printd("S-Bits:\n");
139 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s, 36));
140
141 /* Destroy some bits */
142 memset(bursts_s + 6, 0, 8);
143
144 /* Decode, correcting errors */
145 gsm0503_rach_decode(&result, bursts_s, bsic);
146 printd("Decoded: %02x\n", result);
147
148 ASSERT_TRUE(ra == result);
149
150 printd("\n");
151}
152
153static void test_sch(uint8_t *info)
154{
155 uint8_t result[4];
156 ubit_t bursts_u[78];
157 sbit_t bursts_s[78];
158
159 /* Zero bits 25 and above */
160 info[3] &= 1;
161 result[3] = 0;
162
163 /* Encode L2 message */
164 printd("Encoding: %s\n", osmo_hexdump(info, 4));
165 gsm0503_sch_encode(bursts_u, info);
166
167 /* Prepare soft-bits */
168 ubits2sbits(bursts_u, bursts_s, 78);
169
170 printd("U-Bits:\n");
171 printd("%s\n", osmo_hexdump(bursts_u, 78));
172
173 printd("S-Bits:\n");
174 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s, 78));
175
176 /* Destroy some bits */
177 memset(bursts_s + 6, 0, 10);
178
179 /* Decode, correcting errors */
180 gsm0503_sch_decode(result, bursts_s);
181 printd("Decoded: %s\n", osmo_hexdump(result, 4));
182
183 ASSERT_TRUE(!memcmp(info, result, 4));
184
185 printd("\n");
186}
187
188static void test_fr(uint8_t *speech, int len)
189{
190 uint8_t result[33];
191 ubit_t bursts_u[116 * 8];
192 sbit_t bursts_s[116 * 8];
193 int n_errors, n_bits_total;
194 int rc;
195
196 memset(bursts_u, 0x23, sizeof(bursts_u));
197 memset(bursts_s, 0, sizeof(bursts_s));
198
199 /* Encode L2 message */
200 printd("Encoding: %s\n", osmo_hexdump(speech, len));
201 gsm0503_tch_fr_encode(bursts_u, speech, len, 1);
202
203 /* Prepare soft-bits */
204 ubits2sbits(bursts_u, bursts_s, 116 * 8);
205
206 printd("U-Bits:\n");
207 printd("%s %02x %02x ", osmo_hexdump(bursts_u, 57),
208 bursts_u[57], bursts_u[58]);
209 printd("%s\n", osmo_hexdump(bursts_u + 59, 57));
210 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 116, 57),
211 bursts_u[57 + 116], bursts_u[58 + 116]);
212 printd("%s\n", osmo_hexdump(bursts_u + 59 + 116, 57));
213 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 232, 57),
214 bursts_u[57 + 232], bursts_u[58 + 232]);
215 printd("%s\n", osmo_hexdump(bursts_u + 59 + 232, 57));
216 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 348, 57),
217 bursts_u[57 + 348], bursts_u[58 + 348]);
218 printd("%s\n", osmo_hexdump(bursts_u + 59 + 348, 57));
219 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 464, 57),
220 bursts_u[57 + 464], bursts_u[58 + 464]);
221 printd("%s\n", osmo_hexdump(bursts_u + 59 + 464, 57));
222 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 580, 57),
223 bursts_u[57 + 580], bursts_u[58 + 580]);
224 printd("%s\n", osmo_hexdump(bursts_u + 59 + 580, 57));
225 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 696, 57),
226 bursts_u[57 + 696], bursts_u[58 + 696]);
227 printd("%s\n", osmo_hexdump(bursts_u + 59 + 696, 57));
228 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 812, 57),
229 bursts_u[57 + 812], bursts_u[58 + 812]);
230 printd("%s\n", osmo_hexdump(bursts_u + 59 + 812, 57));
231
232 printd("S-Bits:\n");
233 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s, 57),
234 (uint8_t)bursts_s[57], (uint8_t)bursts_s[58]);
235 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59, 57));
236 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 116, 57),
237 (uint8_t)bursts_s[57 + 116], (uint8_t)bursts_s[58 + 116]);
238 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 116, 57));
239 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 232, 57),
240 (uint8_t)bursts_s[57 + 232], (uint8_t)bursts_s[58 + 232]);
241 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 232, 57));
242 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 348, 57),
243 (uint8_t)bursts_s[57 + 348], (uint8_t)bursts_s[58 + 348]);
244 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 348, 57));
245 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 464, 57),
246 (uint8_t)bursts_s[57 + 464], (uint8_t)bursts_s[58 + 464]);
247 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 464, 57));
248 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 580, 57),
249 (uint8_t)bursts_s[57 + 580], (uint8_t)bursts_s[58 + 580]);
250 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 580, 57));
251 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 696, 57),
252 (uint8_t)bursts_s[57 + 696], (uint8_t)bursts_s[58 + 696]);
253 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 696, 57));
254 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 812, 57),
255 (uint8_t)bursts_s[57 + 812], (uint8_t)bursts_s[58 + 812]);
256 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 812, 57));
257
258 /* Destroy some bits */
259 memset(bursts_s + 6, 0, 20);
260
261 /* Decode, correcting errors */
262 rc = gsm0503_tch_fr_decode(result, bursts_s, 1, len == 31,
263 &n_errors, &n_bits_total);
264 printd("Decoded: %s\n", osmo_hexdump(result, len));
265 printf("tch_fr_decode: n_errors=%d n_bits_total=%d ber=%.2f\n",
266 n_errors, n_bits_total, (float)n_errors/n_bits_total);
267
268 ASSERT_TRUE(rc == len);
269 ASSERT_TRUE(!memcmp(speech, result, len));
270
271 printd("\n");
272}
273
274static void test_hr(uint8_t *speech, int len)
275{
276 uint8_t result[23];
277 ubit_t bursts_u[116 * 6];
278 sbit_t bursts_s[116 * 6];
279 int n_errors, n_bits_total;
280 int rc;
281
282 memset(bursts_u, 0x23, sizeof(bursts_u));
283 memset(bursts_s, 0, sizeof(bursts_s));
284
285 /* Encode L2 message */
286 printd("Encoding: %s\n", osmo_hexdump(speech, len));
287 gsm0503_tch_hr_encode(bursts_u, speech, len);
288
289 /* Prepare soft-bits */
290 ubits2sbits(bursts_u, bursts_s, 116 * 6);
291
292 printd("U-Bits:\n");
293 printd("%s %02x %02x ", osmo_hexdump(bursts_u, 57),
294 bursts_u[57], bursts_u[58]);
295 printd("%s\n", osmo_hexdump(bursts_u + 59, 57));
296 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 116, 57),
297 bursts_u[57 + 116], bursts_u[58 + 116]);
298 printd("%s\n", osmo_hexdump(bursts_u + 59 + 116, 57));
299 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 232, 57),
300 bursts_u[57 + 232], bursts_u[58 + 232]);
301 printd("%s\n", osmo_hexdump(bursts_u + 59 + 232, 57));
302 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 348, 57),
303 bursts_u[57 + 348], bursts_u[58 + 348]);
304 printd("%s\n", osmo_hexdump(bursts_u + 59 + 348, 57));
305 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 464, 57),
306 bursts_u[57 + 464], bursts_u[58 + 464]);
307 printd("%s\n", osmo_hexdump(bursts_u + 59 + 464, 57));
308 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 580, 57),
309 bursts_u[57 + 580], bursts_u[58 + 580]);
310 printd("%s\n", osmo_hexdump(bursts_u + 59 + 580, 57));
311
312 printd("S-Bits:\n");
313 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s, 57),
314 (uint8_t)bursts_s[57], (uint8_t)bursts_s[58]);
315 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59, 57));
316 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 116, 57),
317 (uint8_t)bursts_s[57 + 116], (uint8_t)bursts_s[58 + 116]);
318 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 116, 57));
319 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 232, 57),
320 (uint8_t)bursts_s[57 + 232], (uint8_t)bursts_s[58 + 232]);
321 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 232, 57));
322 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 348, 57),
323 (uint8_t)bursts_s[57 + 348], (uint8_t)bursts_s[58 + 348]);
324 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 348, 57));
325 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 464, 57),
326 (uint8_t)bursts_s[57 + 464], (uint8_t)bursts_s[58 + 464]);
327 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 464, 57));
328 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 580, 57),
329 (uint8_t)bursts_s[57 + 580], (uint8_t)bursts_s[58 + 580]);
330 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 580, 57));
331
332 /* Destroy some bits */
333 memset(bursts_s + 6, 0, 20);
334
335 /* Decode, correcting errors */
336 rc = gsm0503_tch_hr_decode(result, bursts_s, 0,
337 &n_errors, &n_bits_total);
338 printd("Decoded: %s\n", osmo_hexdump(result, len));
339 printf("tch_hr_decode: n_errors=%d n_bits_total=%d ber=%.2f\n",
340 n_errors, n_bits_total, (float)n_errors/n_bits_total);
341
342 ASSERT_TRUE(rc == len);
343 ASSERT_TRUE(!memcmp(speech, result, len));
344
345 printd("\n");
346}
347
348static void test_pdtch(uint8_t *l2, int len)
349{
350 uint8_t result[len];
351 ubit_t bursts_u[116 * 4];
352 sbit_t bursts_s[116 * 4];
353 int n_errors, n_bits_total;
354 int rc;
355
356 /* Zero the not coded tail bits */
357 switch (len) {
358 case 34:
359 case 54:
360 l2[len - 1] &= 0x7f;
361 result[len - 1] &= 0x7f;
362 break;
363 case 40:
364 l2[len - 1] &= 0x07;
365 result[len - 1] &= 0x07;
366 break;
367 }
368
369 /* Encode L2 message */
370 printd("Encoding: %s\n", osmo_hexdump(l2, len));
371 gsm0503_pdtch_encode(bursts_u, l2, len);
372
373 /* Prepare soft-bits */
374 ubits2sbits(bursts_u, bursts_s, 116 * 4);
375
376 printd("U-Bits:\n");
377 printd("%s %02x %02x ", osmo_hexdump(bursts_u, 57),
378 bursts_u[57], bursts_u[58]);
379 printd("%s\n", osmo_hexdump(bursts_u + 59, 57));
380 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 116, 57),
381 bursts_u[57 + 116], bursts_u[58 + 116]);
382 printd("%s\n", osmo_hexdump(bursts_u + 59 + 116, 57));
383 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 232, 57),
384 bursts_u[57 + 232], bursts_u[58 + 232]);
385 printd("%s\n", osmo_hexdump(bursts_u + 59 + 232, 57));
386 printd("%s %02x %02x ", osmo_hexdump(bursts_u + 348, 57),
387 bursts_u[57 + 348], bursts_u[58 + 348]);
388 printd("%s\n", osmo_hexdump(bursts_u + 59 + 348, 57));
389
390 printd("S-Bits:\n");
391 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s, 57),
392 (uint8_t)bursts_s[57], (uint8_t)bursts_s[58]);
393 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59, 57));
394 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 116, 57),
395 (uint8_t)bursts_s[57 + 116], (uint8_t)bursts_s[58 + 116]);
396 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 116, 57));
397 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 232, 57),
398 (uint8_t)bursts_s[57 + 232], (uint8_t)bursts_s[58 + 232]);
399 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 232, 57));
400 printd("%s %02x %02x ", osmo_hexdump((uint8_t *)bursts_s + 348, 57),
401 (uint8_t)bursts_s[57 + 348], (uint8_t)bursts_s[58 + 348]);
402 printd("%s\n", osmo_hexdump((uint8_t *)bursts_s + 59 + 348, 57));
403
404 /* Decode */
405 rc = gsm0503_pdtch_decode(result, bursts_s, NULL,
406 &n_errors, &n_bits_total);
407 printd("Decoded: %s\n", osmo_hexdump(result, len));
408 printf("pdtch_decode: n_errors=%d n_bits_total=%d ber=%.2f\n",
409 n_errors, n_bits_total, (float)n_errors/n_bits_total);
410
411 ASSERT_TRUE(rc == len);
412 ASSERT_TRUE(!memcmp(l2, result, len));
413
414 printd("\n");
415}
416
417uint8_t test_l2[][23] = {
418 /* Dummy frame */
419 { 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
420 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
421 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
422 /* Random frame */
423 { 0xa3, 0xaf, 0x5f, 0xc6, 0x36, 0x43, 0x44, 0xab,
424 0xd9, 0x6d, 0x7d, 0x62, 0x24, 0xc9, 0xd2, 0x92,
425 0xfa, 0x27, 0x5d, 0x71, 0x7a, 0x59, 0xa8 },
426 /* jolly frame */
427 { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
428 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
429 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 },
430};
431
432uint8_t test_macblock[][54] = {
433 /* Random frame */
434 { 0xa3, 0xaf, 0x5f, 0xc6, 0x36, 0x43, 0x44, 0xab,
435 0xd9, 0x6d, 0x7d, 0x62, 0x24, 0xc9, 0xd2, 0x92,
436 0xfa, 0x27, 0x5d, 0x71, 0x7a, 0x59, 0xa8, 0x42,
437 0xa3, 0xaf, 0x5f, 0xc6, 0x36, 0x43, 0x44, 0xab,
438 0xa3, 0xaf, 0x5f, 0xc6, 0x36, 0x43, 0x44, 0xab,
439 0xd9, 0x6d, 0x7d, 0x62, 0x24, 0xc9, 0xd2, 0x92,
440 0xfa, 0x27, 0x5d, 0x71, 0x7a, 0xa8 },
441 /* jolly frame */
442 { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
443 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
444 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 },
445};
446
447uint8_t test_speech_fr[33];
448uint8_t test_speech_efr[31];
449uint8_t test_speech_hr[15];
450
451int main(int argc, char **argv)
452{
453 int i, len_l2, len_mb;
454
455 len_l2 = sizeof(test_l2) / sizeof(test_l2[0]);
456 len_mb = sizeof(test_macblock) / sizeof(test_macblock[0]);
457
458 for (i = 0; i < len_l2; i++)
459 test_xcch(test_l2[i]);
460
461 for (i = 0; i < 256; i++) {
462 test_rach(0x3f, i);
463 test_rach(0x00, i);
464 test_rach(0x1a, i);
465 }
466
467 for (i = 0; i < len_l2; i++)
468 test_sch(test_l2[i]);
469
470 for (i = 0; i < sizeof(test_speech_fr); i++)
471 test_speech_fr[i] = i;
472 test_speech_fr[0] = 0xd0;
473 test_fr(test_speech_fr, sizeof(test_speech_fr));
474
475 for (i = 0; i < sizeof(test_speech_efr); i++)
476 test_speech_efr[i] = i;
477 test_speech_efr[0] = 0xc0;
478 test_fr(test_speech_efr, sizeof(test_speech_efr));
479
480 for (i = 0; i < len_l2; i++)
481 test_fr(test_l2[i], sizeof(test_l2[0]));
482
483 for (i = 0; i < sizeof(test_speech_hr); i++)
484 test_speech_hr[i] = i * 17;
485 test_speech_hr[0] = 0x00;
486 test_hr(test_speech_hr, sizeof(test_speech_hr));
487
488 for (i = 0; i < len_l2; i++)
489 test_hr(test_l2[i], sizeof(test_l2[0]));
490
491 for (i = 0; i < len_mb; i++) {
492 test_pdtch(test_macblock[i], 23);
493 test_pdtch(test_macblock[i], 34);
494 test_pdtch(test_macblock[i], 40);
495 test_pdtch(test_macblock[i], 54);
496 }
497
498 printf("Success\n");
499
500 return 0;
501}