FreeCalypso > hg > vband-misc
annotate efr-sid/mk-sid-test2.c @ 48:3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 11 Aug 2024 22:17:37 +0000 |
parents | efr-sid/mk-sid-test.c@8bfc517fda3b |
children | 2daadef1e70d |
rev | line source |
---|---|
43
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
48
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
2 * This program generates a set of EFR codec frames based on a single input |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
3 * frame (in ETSI cod format) that is expected to be a perfect SID. |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
4 * The output frame set is intended to serve as a unit test for the |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
5 * bit-counting SID classification function; it will contain different |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
6 * extents of bit clearing to produce valid SID, invalid SID and non-SID |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
7 * speech classifications. |
43
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 */ |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <stdio.h> |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <stdint.h> |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include <stdlib.h> |
48
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
13 #include <string.h> |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
14 #include <strings.h> |
43
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include <gsm_efr.h> |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #include "etsi.h" |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
48
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
18 #define TOTAL_BITS 244 |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
19 |
43
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 extern const uint8_t SID_codeword_bit_idx[95]; |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 |
48
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
22 static uint8_t input_frame[ETSI_ENC_NWORDS]; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
23 static FILE *outf; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
24 |
43
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 static void |
48
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
26 read_input_file(filename) |
43
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 char *filename; |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 { |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 FILE *inf; |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 inf = fopen(filename, "r"); |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 if (!inf) { |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 perror(filename); |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 exit(1); |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 } |
48
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
36 read_etsi_bits(inf, 0, input_frame, ETSI_ENC_NWORDS, filename); |
43
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 fclose(inf); |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 } |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 |
48
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
40 static void |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
41 emit_out_frame(bits) |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
42 uint8_t *bits; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
43 { |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
44 uint8_t packed_frame[EFR_RTP_FRAME_LEN]; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
45 |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
46 bits2frame(bits, packed_frame, "input", 0); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
47 fwrite(packed_frame, 1, EFR_RTP_FRAME_LEN, outf); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
48 } |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
49 |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
50 static void |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
51 emit_1bit_errors() |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
52 { |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
53 uint8_t frame_bits[TOTAL_BITS]; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
54 unsigned n; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
55 |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
56 for (n = 0; n < 95; n++) { |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
57 bcopy(input_frame, frame_bits, TOTAL_BITS); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
58 frame_bits[SID_codeword_bit_idx[n]] = 0; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
59 emit_out_frame(frame_bits); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
60 } |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
61 } |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
62 |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
63 static void |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
64 emit_2bit_errors() |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
65 { |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
66 uint8_t frame_bits[TOTAL_BITS]; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
67 |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
68 bcopy(input_frame, frame_bits, TOTAL_BITS); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
69 frame_bits[SID_codeword_bit_idx[3]] = 0; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
70 frame_bits[SID_codeword_bit_idx[14]] = 0; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
71 emit_out_frame(frame_bits); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
72 bcopy(input_frame, frame_bits, TOTAL_BITS); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
73 frame_bits[SID_codeword_bit_idx[15]] = 0; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
74 frame_bits[SID_codeword_bit_idx[92]] = 0; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
75 emit_out_frame(frame_bits); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
76 bcopy(input_frame, frame_bits, TOTAL_BITS); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
77 frame_bits[SID_codeword_bit_idx[65]] = 0; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
78 frame_bits[SID_codeword_bit_idx[35]] = 0; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
79 emit_out_frame(frame_bits); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
80 bcopy(input_frame, frame_bits, TOTAL_BITS); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
81 frame_bits[SID_codeword_bit_idx[89]] = 0; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
82 frame_bits[SID_codeword_bit_idx[79]] = 0; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
83 emit_out_frame(frame_bits); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
84 bcopy(input_frame, frame_bits, TOTAL_BITS); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
85 frame_bits[SID_codeword_bit_idx[32]] = 0; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
86 frame_bits[SID_codeword_bit_idx[38]] = 0; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
87 emit_out_frame(frame_bits); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
88 bcopy(input_frame, frame_bits, TOTAL_BITS); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
89 frame_bits[SID_codeword_bit_idx[46]] = 0; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
90 frame_bits[SID_codeword_bit_idx[26]] = 0; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
91 emit_out_frame(frame_bits); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
92 } |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
93 |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
94 static void |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
95 emit_15bit_errors() |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
96 { |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
97 uint8_t frame_bits[TOTAL_BITS]; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
98 unsigned i, j; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
99 |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
100 for (i = 0; i < 6; i++) { |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
101 bcopy(input_frame, frame_bits, TOTAL_BITS); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
102 for (j = 0; j < 15; j++) |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
103 frame_bits[SID_codeword_bit_idx[j * 6 + i]] = 0; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
104 emit_out_frame(frame_bits); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
105 } |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
106 } |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
107 |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
108 static void |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
109 emit_16bit_errors() |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
110 { |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
111 uint8_t frame_bits[TOTAL_BITS]; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
112 unsigned i, j; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
113 |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
114 for (i = 0; i < 6; i++) { |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
115 bcopy(input_frame, frame_bits, TOTAL_BITS); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
116 for (j = 0; j < 16; j++) |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
117 frame_bits[SID_codeword_bit_idx[j * 6 + i]] = 0; |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
118 emit_out_frame(frame_bits); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
119 } |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
120 } |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
121 |
43
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 main(argc, argv) |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 char **argv; |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 { |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 if (argc != 3) { |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 fprintf(stderr, "usage: %s input.cod output.gsmx\n", argv[0]); |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 exit(1); |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 } |
48
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
129 read_input_file(argv[1]); |
43
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 outf = fopen(argv[2], "w"); |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 if (!outf) { |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 perror(argv[2]); |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 exit(1); |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 } |
48
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
135 /* emit the perfect, error-free SID first */ |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
136 emit_out_frame(input_frame); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
137 /* now different bit-error possibilities */ |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
138 emit_1bit_errors(); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
139 emit_2bit_errors(); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
140 emit_15bit_errors(); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
141 emit_16bit_errors(); |
3e632126e099
efr-sid: generate efr-sid-test2.gsmx for OS#6538
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
142 /* all done */ |
43
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 fclose(outf); |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 exit(0); |
8bfc517fda3b
efr-sid: hack created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 } |