annotate pcmu2efr/comb-diff.c @ 55:f27bc1e17311

fr-sid/goodsp-frame41.gsmx: starting point This 33-byte binary file contains frame #41 from good_sp.cod from GSM 06.32 test sequence set, converted from ETSI *.cod format into our gsmx format. This frame is an example of a real FRv1 SID.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 22 Aug 2024 05:00:08 +0000
parents 2628a34fe75b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This program computes 160 possible EFR encoder outputs using standard EFR,
21
3eb407b08b4c pcmu2efr: confirm that we got 280 distinct outputs so far
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
3 * then 120 possible outputs using "simple" AMR-EFR, then does a diff
3eb407b08b4c pcmu2efr: confirm that we got 280 distinct outputs so far
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
4 * among them, seeking to verify that they are all distinct.
15
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 */
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdio.h>
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdint.h>
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <stdlib.h>
17
39b3c24256ae pcmu2efr: add stdefr-diff sanity check
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
10 #include <string.h>
39b3c24256ae pcmu2efr: add stdefr-diff sanity check
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
11 #include <strings.h>
15
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 extern uint8_t standard_efr[160][31];
21
3eb407b08b4c pcmu2efr: confirm that we got 280 distinct outputs so far
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
14 extern uint8_t amr_efr[160][31];
15
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 main(argc, argv)
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 char **argv;
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 {
21
3eb407b08b4c pcmu2efr: confirm that we got 280 distinct outputs so far
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
19 uint8_t combine[320][31];
17
39b3c24256ae pcmu2efr: add stdefr-diff sanity check
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
20 unsigned m, n;
15
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 generate_linear_inputs();
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 generate_std_efr();
21
3eb407b08b4c pcmu2efr: confirm that we got 280 distinct outputs so far
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
24 generate_amr_efr();
3eb407b08b4c pcmu2efr: confirm that we got 280 distinct outputs so far
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
25 bcopy(standard_efr, combine, 160*31);
3eb407b08b4c pcmu2efr: confirm that we got 280 distinct outputs so far
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
26 bcopy(amr_efr, combine + 160, 160*31);
23
2628a34fe75b pcmu2efr: encode 2nd frame for AMR-EFR offsets 120-159
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
27 for (m = 0; m < 319; m++) {
2628a34fe75b pcmu2efr: encode 2nd frame for AMR-EFR offsets 120-159
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
28 for (n = m + 1; n < 320; n++) {
21
3eb407b08b4c pcmu2efr: confirm that we got 280 distinct outputs so far
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
29 if (!memcmp(combine[m], combine[n], 31))
17
39b3c24256ae pcmu2efr: add stdefr-diff sanity check
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
30 printf("Bad: sequences #%u and #%u are equal\n",
39b3c24256ae pcmu2efr: add stdefr-diff sanity check
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
31 m, n);
39b3c24256ae pcmu2efr: add stdefr-diff sanity check
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
32 }
15
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 }
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 exit(0);
528eef871e23 pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 }