FreeCalypso > hg > vband-misc
annotate pcmu2efr/gen-efr.c @ 15:528eef871e23
pcmu2efr project started
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 16 Apr 2024 23:30:49 +0000 |
parents | |
children | f4420403219a |
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 * The code in this module takes linear_inputs[][] from gen160.c |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * and generates standard EFR-encoded frames. |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
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 #include <stdio.h> |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdint.h> |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdlib.h> |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <gsm_efr.h> |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 extern uint16_t linear_inputs[160][160]; |
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 uint8_t standard_efr[160][31]; |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 void |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 generate_std_efr(void) |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 { |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 struct EFR_encoder_state *st; |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 unsigned m; |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 st = EFR_encoder_create(0); |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 if (!st) { |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 fprintf(stderr, "error: EFR_encoder_create() failed\n"); |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 exit(1); |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 } |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 for (m = 0; m < 160; m++) { |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 EFR_encoder_reset(st, 0); |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 EFR_encode_frame(st, (const int16_t *) linear_inputs[m], |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 standard_efr[m], (int *) 0, (int *) 0); |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 } |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 free(st); |
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 } |