comparison pcmu2efr/dhf-check.c @ 20:f5f541bc9415

pcmu2efr: check all generated frames against DHF
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 12 May 2024 03:06:12 +0000
parents
children 2628a34fe75b
comparison
equal deleted inserted replaced
19:2bdcd2ed9a1c 20:f5f541bc9415
1 /*
2 * This program generates both standard-EFR and AMR-EFR versions of
3 * sample-shifted first encoder frame, and checks them against
4 * both EFR and MR122 DHFs.
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 extern uint8_t standard_efr[160][31];
16 extern uint8_t amr_efr[160][31];
17
18 static void
19 check_for_dhf(efr_frame, name, num)
20 uint8_t *efr_frame;
21 char *name;
22 unsigned num;
23 {
24 int16_t params[EFR_NUM_PARAMS];
25
26 EFR_frame2params(efr_frame, params);
27 if (!bcmp(params, amr_dhf_gsmefr, EFR_NUM_PARAMS * sizeof(int16_t)))
28 printf("%s frame %u matches EFR DHF\n", name, num);
29 else if (!bcmp(params, amr_dhf_mr122, EFR_NUM_PARAMS * sizeof(int16_t)))
30 printf("%s frame %u matches MR122 DHF\n", name, num);
31 }
32
33 main(argc, argv)
34 char **argv;
35 {
36 unsigned n;
37
38 generate_linear_inputs();
39 generate_std_efr();
40 generate_amr_efr();
41 for (n = 0; n < 160; n++)
42 check_for_dhf(standard_efr[n], "std EFR", n);
43 for (n = 0; n < 120; n++)
44 check_for_dhf(amr_efr[n], "AMR-EFR", n);
45 exit(0);
46 }