annotate libtwamr/lag_wind.c @ 542:f2d0f2f15d5f

libgsmefr: add wrapper for TW-TS-001 RTP input
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 28 Sep 2024 06:38:08 +0000
parents a8dab7028e4d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
384
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 ********************************************************************************
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 *
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * R99 Version 3.3.0
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * REL-4 Version 4.1.0
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 *
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 ********************************************************************************
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 *
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 * File : lag_wind.c
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 * Purpose : Lag windowing of autocorrelations.
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 *
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 ********************************************************************************
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 */
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 /*
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 ********************************************************************************
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 * MODULE INCLUDE FILE AND VERSION ID
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 ********************************************************************************
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 */
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 #include "namespace.h"
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 #include "lag_wind.h"
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 /*
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 ********************************************************************************
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 * INCLUDE FILES
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 ********************************************************************************
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 */
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 #include "typedef.h"
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 #include "basic_op.h"
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #include "oper_32b.h"
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #include "no_count.h"
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 /*
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 ********************************************************************************
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 * LOCAL VARIABLES AND TABLES
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 ********************************************************************************
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 */
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 #include "lag_wind.tab" /* Table for Lag_Window() */
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 /*
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 ********************************************************************************
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 * PUBLIC PROGRAM CODE
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 ********************************************************************************
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 */
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 /*************************************************************************
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 *
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 * FUNCTION: Lag_window()
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 *
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 * PURPOSE: Lag windowing of autocorrelations.
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 *
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 * DESCRIPTION:
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 * r[i] = r[i]*lag_wind[i], i=1,...,10
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 *
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 * r[i] and lag_wind[i] are in special double precision format.
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 * See "oper_32b.c" for the format.
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 *
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 *************************************************************************/
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 void Lag_window (
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 Word16 m, /* (i) : LPC order */
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 Word16 r_h[], /* (i/o) : Autocorrelations (msb) */
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 Word16 r_l[] /* (i/o) : Autocorrelations (lsb) */
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 )
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 {
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 Word16 i;
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 Word32 x;
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 for (i = 1; i <= m; i++)
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 {
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 x = Mpy_32 (r_h[i], r_l[i], lag_h[i - 1], lag_l[i - 1]);
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 L_Extract (x, &r_h[i], &r_l[i]);
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 }
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 return;
a8dab7028e4d libtwamr: integrate lag_wind.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 }