FreeCalypso > hg > vband-misc
comparison efr-sid/mk-sid-test.c @ 43:8bfc517fda3b
efr-sid: hack created
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 09 Jun 2024 05:57:48 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
42:982169986a14 | 43:8bfc517fda3b |
---|---|
1 /* | |
2 * This program generates a sequence of 95 EFR codec frames that starts | |
3 * with a perfect SID and is degraded by one bit in the SID field | |
4 * on every output frame. | |
5 */ | |
6 | |
7 #include <stdio.h> | |
8 #include <stdint.h> | |
9 #include <stdlib.h> | |
10 #include <gsm_efr.h> | |
11 #include "etsi.h" | |
12 | |
13 extern const uint8_t SID_codeword_bit_idx[95]; | |
14 | |
15 static void | |
16 read_input_file(filename, cod_frame) | |
17 char *filename; | |
18 uint8_t *cod_frame; | |
19 { | |
20 FILE *inf; | |
21 | |
22 inf = fopen(filename, "r"); | |
23 if (!inf) { | |
24 perror(filename); | |
25 exit(1); | |
26 } | |
27 read_etsi_bits(inf, 0, cod_frame, ETSI_ENC_NWORDS, filename); | |
28 fclose(inf); | |
29 } | |
30 | |
31 main(argc, argv) | |
32 char **argv; | |
33 { | |
34 uint8_t cod_frame[ETSI_ENC_NWORDS], packed_frame[EFR_RTP_FRAME_LEN]; | |
35 FILE *outf; | |
36 unsigned nf; | |
37 | |
38 if (argc != 3) { | |
39 fprintf(stderr, "usage: %s input.cod output.gsmx\n", argv[0]); | |
40 exit(1); | |
41 } | |
42 read_input_file(argv[1], cod_frame); | |
43 outf = fopen(argv[2], "w"); | |
44 if (!outf) { | |
45 perror(argv[2]); | |
46 exit(1); | |
47 } | |
48 for (nf = 0; nf < 95; nf++) { | |
49 bits2frame(cod_frame, packed_frame, argv[1], 0); | |
50 fwrite(packed_frame, 1, EFR_RTP_FRAME_LEN, outf); | |
51 cod_frame[SID_codeword_bit_idx[nf]] = 0; | |
52 } | |
53 fclose(outf); | |
54 exit(0); | |
55 } |