FreeCalypso > hg > vband-misc
annotate pcmu2efr/pcmu-input.c @ 26:1794bf0fbcf7
pcmu2efr: emit full PCMU input
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 12 May 2024 04:48:36 +0000 |
parents | |
children |
rev | line source |
---|---|
26
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This program emits the full sequence (3 EHFs and 2 copies of seqsyncu) |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * that needs to be fed to TRAU DL input from G.711 PCMU side to perform |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * the test of reversing the EFR variant used and finding frame sync. |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 */ |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdio.h> |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdint.h> |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdlib.h> |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <string.h> |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <strings.h> |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 extern const uint8_t seqsyncu_last_frame[160]; |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 main(argc, argv) |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 char **argv; |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 { |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 FILE *outf; |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 uint8_t ehf[160]; |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 if (argc != 2) { |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 fprintf(stderr, "usage: %s pcmu-out-file\n", argv[0]); |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 exit(1); |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 } |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 outf = fopen(argv[1], "w"); |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 if (!outf) { |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 perror(argv[1]); |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 exit(1); |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 } |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 memset(ehf, 0xFE, 160); |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 fwrite(ehf, 1, 160, outf); |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 fwrite(ehf, 1, 160, outf); |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 fwrite(ehf, 1, 160, outf); |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 fwrite(seqsyncu_last_frame, 1, 160, outf); |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 fwrite(seqsyncu_last_frame, 1, 160, outf); |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 fclose(outf); |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 exit(0); |
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 } |