FreeCalypso > hg > vband-misc
comparison ae-dec-dhf/gen-test-frames.c @ 39:ab7c80f6f02d
ae-dec-dhf: initial generation
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 14 May 2024 08:13:01 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
38:e96e8d8973c0 | 39:ab7c80f6f02d |
---|---|
1 /* | |
2 * This program generates some test EFR frames that are meant to be fed | |
3 * to the uplink input of the alien GSM network under study, seeking to | |
4 * test if the AMR-EFR hybrid decoder's handling of DHF matches our model. | |
5 */ | |
6 | |
7 #include <stdio.h> | |
8 #include <stdint.h> | |
9 #include <stdlib.h> | |
10 #include <string.h> | |
11 #include <strings.h> | |
12 #include <gsm_efr.h> | |
13 #include <tw_amr.h> | |
14 | |
15 static FILE *outf; | |
16 | |
17 static void | |
18 emit_mr122_dhf() | |
19 { | |
20 uint8_t frame[EFR_RTP_FRAME_LEN]; | |
21 | |
22 EFR_params2frame(amr_dhf_mr122, frame); | |
23 fwrite(frame, 1, EFR_RTP_FRAME_LEN, outf); | |
24 } | |
25 | |
26 static void | |
27 emit_mixed_dhf() | |
28 { | |
29 int16_t params[EFR_NUM_PARAMS]; | |
30 uint8_t frame[EFR_RTP_FRAME_LEN]; | |
31 | |
32 memcpy(params, amr_dhf_gsmefr, sizeof(int16_t) * 18); | |
33 memcpy(params + 18, amr_dhf_mr122 + 18, sizeof(int16_t) * 39); | |
34 EFR_params2frame(params, frame); | |
35 fwrite(frame, 1, EFR_RTP_FRAME_LEN, outf); | |
36 } | |
37 | |
38 main(argc, argv) | |
39 char **argv; | |
40 { | |
41 if (argc != 2) { | |
42 fprintf(stderr, "usage: %s gsmx-out-file\n", argv[0]); | |
43 exit(1); | |
44 } | |
45 outf = fopen(argv[1], "w"); | |
46 if (!outf) { | |
47 perror(argv[1]); | |
48 exit(1); | |
49 } | |
50 emit_mr122_dhf(); | |
51 emit_mr122_dhf(); | |
52 emit_mixed_dhf(); | |
53 fwrite(EFR_decoder_homing_frame, 1, EFR_RTP_FRAME_LEN, outf); | |
54 emit_mixed_dhf(); | |
55 emit_mixed_dhf(); | |
56 emit_mr122_dhf(); | |
57 fclose(outf); | |
58 exit(0); | |
59 } |