annotate libtwamr/tseq_out.c @ 458:e26b974f7ba3

doc/AMR-study-utils: update for the current situation
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 10 May 2024 18:45:36 +0000
parents eced57698c03
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
420
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * In this module we implement encoder output conversion to 3GPP
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * test sequence format.
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdint.h>
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <string.h>
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include "tw_amr.h"
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include "namespace.h"
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "typedef.h"
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include "cnst.h"
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include "prm2bits.h"
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 void amr_frame_to_tseq(const struct amr_param_frame *frame, uint16_t *cod)
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 {
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 enum Mode pack_mode;
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 cod[0] = frame->type;
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 memset(cod + 1, 0, (AMR_COD_WORDS-1) * sizeof(uint16_t));
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 switch (frame->type) {
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 case TX_SPEECH_GOOD:
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 pack_mode = frame->mode;
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 cod[MAX_SERIAL_SIZE+1] = frame->mode;
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 break;
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 case TX_SID_FIRST:
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 case TX_SID_UPDATE:
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 pack_mode = MRDTX;
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 cod[MAX_SERIAL_SIZE+1] = frame->mode;
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 break;
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 case TX_NO_DATA:
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 pack_mode = MRDTX;
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 cod[MAX_SERIAL_SIZE+1] = 0xFFFF;
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 break;
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 default:
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 /* invalid usage, not allowed! */
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 return;
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 }
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 Prm2bits(pack_mode, frame->param, (Word16 *)(cod + 1));
eced57698c03 libtwamr: implement test sequence output
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 }