comparison libtwamr/tseq_out.c @ 420:eced57698c03

libtwamr: implement test sequence output
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 07 May 2024 05:07:41 +0000
parents
children
comparison
equal deleted inserted replaced
419:2a094af3d384 420:eced57698c03
1 /*
2 * In this module we implement encoder output conversion to 3GPP
3 * test sequence format.
4 */
5
6 #include <stdint.h>
7 #include <string.h>
8 #include "tw_amr.h"
9 #include "namespace.h"
10 #include "typedef.h"
11 #include "cnst.h"
12 #include "prm2bits.h"
13
14 void amr_frame_to_tseq(const struct amr_param_frame *frame, uint16_t *cod)
15 {
16 enum Mode pack_mode;
17
18 cod[0] = frame->type;
19 memset(cod + 1, 0, (AMR_COD_WORDS-1) * sizeof(uint16_t));
20 switch (frame->type) {
21 case TX_SPEECH_GOOD:
22 pack_mode = frame->mode;
23 cod[MAX_SERIAL_SIZE+1] = frame->mode;
24 break;
25 case TX_SID_FIRST:
26 case TX_SID_UPDATE:
27 pack_mode = MRDTX;
28 cod[MAX_SERIAL_SIZE+1] = frame->mode;
29 break;
30 case TX_NO_DATA:
31 pack_mode = MRDTX;
32 cod[MAX_SERIAL_SIZE+1] = 0xFFFF;
33 break;
34 default:
35 /* invalid usage, not allowed! */
36 return;
37 }
38 Prm2bits(pack_mode, frame->param, (Word16 *)(cod + 1));
39 }