FreeCalypso > hg > vband-misc
annotate pcma2efr/dhf-check.c @ 41:4e031007e6dd
ae-dec-dhf: generate TCH UL input
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 14 May 2024 08:26:00 +0000 |
parents | 4f47447fd17f |
children |
rev | line source |
---|---|
20
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This program generates both standard-EFR and AMR-EFR versions of |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * sample-shifted first encoder frame, and checks them against |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * both EFR and MR122 DHFs. |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 */ |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdio.h> |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdint.h> |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdlib.h> |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <string.h> |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <strings.h> |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include <gsm_efr.h> |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include <tw_amr.h> |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 extern uint8_t standard_efr[160][31]; |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 extern uint8_t amr_efr[160][31]; |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 static void |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 check_for_dhf(efr_frame, name, num) |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 uint8_t *efr_frame; |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 char *name; |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 unsigned num; |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 { |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 int16_t params[EFR_NUM_PARAMS]; |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 EFR_frame2params(efr_frame, params); |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 if (!bcmp(params, amr_dhf_gsmefr, EFR_NUM_PARAMS * sizeof(int16_t))) |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 printf("%s frame %u matches EFR DHF\n", name, num); |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 else if (!bcmp(params, amr_dhf_mr122, EFR_NUM_PARAMS * sizeof(int16_t))) |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 printf("%s frame %u matches MR122 DHF\n", name, num); |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 } |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 main(argc, argv) |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 char **argv; |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 { |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 unsigned n; |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 generate_linear_inputs(); |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 generate_std_efr(); |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 generate_amr_efr(); |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 for (n = 0; n < 160; n++) |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 check_for_dhf(standard_efr[n], "std EFR", n); |
23
2628a34fe75b
pcmu2efr: encode 2nd frame for AMR-EFR offsets 120-159
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
43 for (n = 0; n < 160; n++) |
20
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 check_for_dhf(amr_efr[n], "AMR-EFR", n); |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 exit(0); |
f5f541bc9415
pcmu2efr: check all generated frames against DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 } |