annotate libtwamr/dtx_enc.h @ 513:03a40ac2e931

libgsmhr1: implement validation for *.cod frames
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 25 Aug 2024 19:00:03 +0000
parents 5a1d18542f8a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
407
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 ********************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 *
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * R99 Version 3.3.0
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * REL-4 Version 4.1.0
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 *
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 ********************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 *
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 * File : dtx_enc.h
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 * Purpose : DTX mode computation of SID parameters
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 *
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 ********************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #ifndef dtx_enc_h
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #define dtx_enc_h "$Id $"
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 /*
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 ********************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 * INCLUDE FILES
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 ********************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 #include "tw_amr.h"
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #include "typedef.h"
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 #include "cnst.h"
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 #include "q_plsf.h"
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 #include "gc_pred.h"
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 #include "dtx_common.h"
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 /*
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 ********************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 * DEFINITION OF DATA TYPES
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 ********************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 typedef struct {
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 Word16 lsp_hist[M * DTX_HIST_SIZE];
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 Word16 log_en_hist[DTX_HIST_SIZE];
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 Word16 hist_ptr;
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 Word16 log_en_index;
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 Word16 init_lsf_vq_index;
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 Word16 lsp_index[3];
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 /* DTX handler stuff */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 Word16 dtxHangoverCount;
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 Word16 decAnaElapsedCount;
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 } dtx_encState;
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 /*
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 ********************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 * DECLARATION OF PROTOTYPES
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 ********************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 /*
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 **************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 *
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 * Function : dtx_enc_reset
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 * Purpose : Resets state memory
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 * Returns : 0 on success
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 *
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 **************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 void dtx_enc_reset (dtx_encState *st);
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 /*
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 **************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 *
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 * Function : dtx_enc
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 * Purpose :
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 * Description :
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 *
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 **************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 int dtx_enc(dtx_encState *st, /* i/o : State struct */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 Word16 computeSidFlag, /* i : compute SID */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 Q_plsfState *qSt, /* i/o : Qunatizer state struct */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 gc_predState* predState, /* i/o : State struct */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 Word16 **anap /* o : analysis parameters */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 );
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 /*
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 **************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 *
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 * Function : dtx_buffer
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 * Purpose : handles the DTX buffer
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 *
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 **************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 int dtx_buffer(dtx_encState *st, /* i/o : State struct */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 Word16 lsp_new[], /* i : LSP vector */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 Word16 speech[] /* i : speech samples */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 );
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 /*
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 **************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 *
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 * Function : tx_dtx_handler
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 * Purpose : adds extra speech hangover to analyze speech on the decoding side.
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 * Description : returns 1 when a new SID analysis may be made
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 * otherwise it adds the appropriate hangover after a sequence
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 * with out updates of SID parameters .
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 *
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 **************************************************************************
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 Word16 tx_dtx_handler(dtx_encState *st, /* i/o : State struct */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 Word16 vadFlag, /* i : vad control variable */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 enum Mode *usedMode /* o : mode changed or not */
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 );
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109
5a1d18542f8a libtwamr: integrate dtx_dec.c and dtx_enc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 #endif