FreeCalypso > hg > vband-misc
annotate pcma2efr/pcma-input.c @ 38:e96e8d8973c0
ul-test: generate hex include files for PCMU
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 14 May 2024 05:36:38 +0000 |
parents | dd9a9368009e |
children |
rev | line source |
---|---|
26
1794bf0fbcf7
pcmu2efr: emit full PCMU input
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
31
dd9a9368009e
pcma2efr: emit full input sequence
Mychaela Falconia <falcon@freecalypso.org>
parents:
26
diff
changeset
|
2 * This program emits the full sequence (3 EHFs and 2 copies of seqsynca) |
dd9a9368009e
pcma2efr: emit full input sequence
Mychaela Falconia <falcon@freecalypso.org>
parents:
26
diff
changeset
|
3 * that needs to be fed to TRAU DL input from G.711 PCMA side to perform |
26
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 |
31
dd9a9368009e
pcma2efr: emit full input sequence
Mychaela Falconia <falcon@freecalypso.org>
parents:
26
diff
changeset
|
13 extern const uint8_t seqsynca_last_frame[160]; |
26
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) { |
31
dd9a9368009e
pcma2efr: emit full input sequence
Mychaela Falconia <falcon@freecalypso.org>
parents:
26
diff
changeset
|
22 fprintf(stderr, "usage: %s pcma-out-file\n", argv[0]); |
26
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 } |
31
dd9a9368009e
pcma2efr: emit full input sequence
Mychaela Falconia <falcon@freecalypso.org>
parents:
26
diff
changeset
|
30 memset(ehf, 0xD5, 160); |
26
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); |
31
dd9a9368009e
pcma2efr: emit full input sequence
Mychaela Falconia <falcon@freecalypso.org>
parents:
26
diff
changeset
|
34 fwrite(seqsynca_last_frame, 1, 160, outf); |
dd9a9368009e
pcma2efr: emit full input sequence
Mychaela Falconia <falcon@freecalypso.org>
parents:
26
diff
changeset
|
35 fwrite(seqsynca_last_frame, 1, 160, outf); |
26
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 } |