FreeCalypso > hg > vband-misc
comparison pcmu2efr/gen-amrefr.c @ 19:2bdcd2ed9a1c
pcmu2efr: generate AMR-EFR version
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 12 May 2024 00:56:42 +0000 |
parents | pcmu2efr/gen-efr.c@528eef871e23 |
children | f4420403219a |
comparison
equal
deleted
inserted
replaced
18:6bcb8e4ea669 | 19:2bdcd2ed9a1c |
---|---|
1 /* | |
2 * The code in this module takes linear_inputs[][] from gen160.c | |
3 * and generates EFR-format frames by way of libtwamr encoder. | |
4 */ | |
5 | |
6 #include <stdio.h> | |
7 #include <stdint.h> | |
8 #include <stdlib.h> | |
9 #include <gsm_efr.h> | |
10 #include <tw_amr.h> | |
11 | |
12 extern uint16_t linear_inputs[160][160]; | |
13 | |
14 uint8_t amr_efr[160][31]; | |
15 | |
16 void | |
17 generate_amr_efr(void) | |
18 { | |
19 struct amr_encoder_state *st; | |
20 struct amr_param_frame amr_frame; | |
21 unsigned m; | |
22 | |
23 st = amr_encoder_create(0, 0); | |
24 if (!st) { | |
25 fprintf(stderr, "error: amr_encoder_create() failed\n"); | |
26 exit(1); | |
27 } | |
28 for (m = 0; m < 160; m++) { | |
29 amr_encoder_reset(st, 0, 0); | |
30 amr_encode_frame(st, MR122, (const int16_t *) linear_inputs[m], | |
31 &amr_frame); | |
32 EFR_params2frame(amr_frame.param, amr_efr[m]); | |
33 } | |
34 free(st); | |
35 } |