annotate libtwamr/weight_a.c @ 477:4c9222d95647

libtwamr encoder: always emit frame->mode = mode; In the original implementation of amr_encode_frame(), the 'mode' member of the output struct was set to 0xFF if the output frame type is TX_NO_DATA. This design was made to mimic the mode field (16-bit word) being set to 0xFFFF (or -1) in 3GPP test sequence format - but nothing actually depends on this struct member being set in any way, and amr_frame_to_tseq() generates the needed 0xFFFF on its own, based on frame->type being equal to TX_NO_DATA. It is simpler and more efficient to always set frame->mode to the actual encoding mode in amr_encode_frame(), and this new behavior has already been documented in doc/AMR-library-API description in anticipation of the present change.
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 18 May 2024 22:30:42 +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 }