annotate libtwamr/lsp.h @ 470:ea89eb8291bf

libgsmefr: add RTP-encoded DHF const datum to public API
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 14 May 2024 07:13:59 +0000
parents 550d3594c878
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
388
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 ********************************************************************************
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 *
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * R99 Version 3.3.0
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * REL-4 Version 4.1.0
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 *
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 ********************************************************************************
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 *
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 * File : lsp.h
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 * Purpose : Conversion from A(z) to LSP. Quantization and
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 * interpolation of LSPs.
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 *
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 ********************************************************************************
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 */
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #ifndef lsp_h
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 #define lsp_h "$Id $"
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 /*
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 ********************************************************************************
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 * INCLUDE FILES
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 ********************************************************************************
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 */
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #include "tw_amr.h"
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 #include "typedef.h"
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 #include "q_plsf.h"
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 /*
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 ********************************************************************************
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 * LOCAL VARIABLES AND TABLES
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 ********************************************************************************
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 */
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 /*
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 ********************************************************************************
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 * DEFINITION OF DATA TYPES
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 ********************************************************************************
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 */
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 typedef struct {
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 /* Past LSPs */
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 Word16 lsp_old[M];
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 Word16 lsp_old_q[M];
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 /* Quantization state */
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 Q_plsfState qSt;
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 } lspState;
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 /*
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 ********************************************************************************
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 * DECLARATION OF PROTOTYPES
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 ********************************************************************************
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 */
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 /*
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 **************************************************************************
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 *
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 * Function : lsp_reset
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 * Purpose : Resets state memory
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 * Returns : 0 on success
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 *
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 **************************************************************************
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 */
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 void lsp_reset (lspState *st);
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 /*
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 **************************************************************************
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 *
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 * Function : lsp
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 * Purpose : Conversion from LP coefficients to LSPs.
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 * Quantization of LSPs.
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 * Description : Generates 2 sets of LSPs from 2 sets of
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 * LP coefficients for mode 12.2. For the other
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 * modes 1 set of LSPs is generated from 1 set of
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 * LP coefficients. These LSPs are quantized with
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 * Matrix/Vector quantization (depending on the mode)
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 * and interpolated for the subframes not yet having
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 * their own LSPs.
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 *
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 **************************************************************************
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 */
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 int lsp(lspState *st, /* i/o : State struct */
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 enum Mode req_mode, /* i : requested coder mode */
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 enum Mode used_mode, /* i : used coder mode */
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 Word16 az[], /* i/o : interpolated LP parameters Q12 */
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 Word16 azQ[], /* o : quantization interpol. LP parameters Q12*/
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 Word16 lsp_new[], /* o : new lsp vector */
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 Word16 **anap /* o : analysis parameters */
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 );
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89
550d3594c878 libtwamr: integrate lsp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 #endif