FreeCalypso > hg > vband-misc
annotate pcma2efr/gen-efr.c @ 34:307fe06fabec
dhf: generate EFR hex DHF in C form
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 14 May 2024 03:36:31 +0000 |
parents | 4f47447fd17f |
children |
rev | line source |
---|---|
15
528eef871e23
pcmu2efr project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
22
f4420403219a
pcmu2efr: change linear input gen to support 2nd frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
2 * The code in this module takes linear_input_array[] from gen160.c |
15
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 |
22
f4420403219a
pcmu2efr: change linear input gen to support 2nd frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
11 extern uint16_t linear_input_array[480]; |
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 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); |
22
f4420403219a
pcmu2efr: change linear input gen to support 2nd frame
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
28 EFR_encode_frame(st, (const int16_t *) linear_input_array+160-m, |
15
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 } |