annotate libtwamr/d_plsf.c @ 443:526a7f0e027d

amrtest: implement twamr-encode
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 09 May 2024 21:00:33 +0000
parents 3f574255c3aa
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
343
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 *****************************************************************************
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 *
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * R99 Version 3.3.0
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * REL-4 Version 4.1.0
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 *
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 *****************************************************************************
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 *
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 * File : d_plsf.c
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 * Purpose : common part (init, exit, reset) of LSF decoder
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 * module (rest in d_plsf_3.c and d_plsf_5.c)
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 *
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 *****************************************************************************
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 */
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 /*
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 *****************************************************************************
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 * MODULE INCLUDE FILE AND VERSION ID
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 *****************************************************************************
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 */
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 #include "namespace.h"
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #include "d_plsf.h"
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 /*
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 *****************************************************************************
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 * INCLUDE FILES
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 *****************************************************************************
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 */
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #include "typedef.h"
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 #include "basic_op.h"
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 #include "no_count.h"
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 #include "cnst.h"
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 #include "memops.h"
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 #include "q_plsf5_tab.h"
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 /*
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 *--------------------------------------------------*
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 * Constants (defined in cnst.h) *
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 *--------------------------------------------------*
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 * M : LPC order
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 *--------------------------------------------------*
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 */
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 /*
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 *****************************************************************************
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 * PUBLIC PROGRAM CODE
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 *****************************************************************************
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 */
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 /*
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 **************************************************************************
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 *
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 * Function : D_plsf_reset
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 * Purpose : Resets state memory
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 *
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 **************************************************************************
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 */
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 void D_plsf_reset (D_plsfState *state)
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 {
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 Word16 i;
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 for (i = 0; i < M; i++){
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 state->past_r_q[i] = 0; /* Past quantized prediction error */
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 }
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 /* Past dequantized lsfs */
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 Copy(mean_lsf, &state->past_lsf_q[0], M);
3f574255c3aa libtwamr: integrate d_plsf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 }