annotate pcma2efr/comb-diff.c @ 29:fc4544e3687b

pcma2efr: comb-diff check passes
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 13 May 2024 02:49:26 +0000
parents pcmu2efr/comb-diff.c@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,
29
fc4544e3687b pcma2efr: comb-diff check passes
Mychaela Falconia <falcon@freecalypso.org>
parents: 23
diff changeset
3 * then 160 possible outputs using our current understanding of AMR-EFR, then
fc4544e3687b pcma2efr: comb-diff check passes
Mychaela Falconia <falcon@freecalypso.org>
parents: 23
diff changeset
4 * does a diff 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 }