annotate libtwamr/weight_a.c @ 513:03a40ac2e931

libgsmhr1: implement validation for *.cod frames
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 25 Aug 2024 19:00:03 +0000
parents 8c7d5eec544c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
395
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 ********************************************************************************
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 *
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * R99 Version 3.3.0
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * REL-4 Version 4.1.0
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 *
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 ********************************************************************************
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 *
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 * File : weight_a.c
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 * Purpose : Spectral expansion of LP coefficients. (order==10)
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 * Description : a_exp[i] = a[i] * fac[i-1] ,i=1,10
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 *
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 ********************************************************************************
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 */
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 /*
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 ********************************************************************************
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 * MODULE INCLUDE FILE AND VERSION ID
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 ********************************************************************************
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 */
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 #include "namespace.h"
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 #include "weight_a.h"
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 /*
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 ********************************************************************************
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 * INCLUDE FILES
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 ********************************************************************************
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 */
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 #include "typedef.h"
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #include "basic_op.h"
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #include "no_count.h"
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 #include "cnst.h"
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 /*
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 ********************************************************************************
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 * LOCAL VARIABLES AND TABLES
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 ********************************************************************************
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 */
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 /*
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 *--------------------------------------*
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 * Constants (defined in cnst.h *
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 *--------------------------------------*
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 * M : LPC order *
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 *--------------------------------------*
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 */
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 /*
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 ********************************************************************************
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 * PUBLIC PROGRAM CODE
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 ********************************************************************************
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 */
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 void Weight_Ai (
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 Word16 a[], /* (i) : a[M+1] LPC coefficients (M=10) */
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 const Word16 fac[], /* (i) : Spectral expansion factors. */
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 Word16 a_exp[] /* (o) : Spectral expanded LPC coefficients */
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 )
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 {
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 Word16 i;
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 a_exp[0] = a[0]; move16 ();
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 for (i = 1; i <= M; i++)
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 {
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 a_exp[i] = round (L_mult (a[i], fac[i - 1])); move16 ();
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 }
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 return;
8c7d5eec544c libtwamr: integrate weight_a.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 }