FreeCalypso > hg > gsm-codec-lib
annotate libtwamr/pre_proc.h @ 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 | 9b699f30e6f3 |
children |
rev | line source |
---|---|
397
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 ******************************************************************************** |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * R99 Version 3.3.0 |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * REL-4 Version 4.1.0 |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 ******************************************************************************** |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 * |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 * File : pre_proc.h |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 * Purpose : Preprocessing of input speech. |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 * |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 ******************************************************************************** |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 */ |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #ifndef pre_proc_h |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #define pre_proc_h "$Id $" |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 /* |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 ******************************************************************************** |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 * INCLUDE FILES |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 ******************************************************************************** |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 */ |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #include "typedef.h" |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 /* |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 ******************************************************************************** |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 * LOCAL VARIABLES AND TABLES |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 ******************************************************************************** |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 */ |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 /* |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 ******************************************************************************** |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 * DEFINITION OF DATA TYPES |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 ******************************************************************************** |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 */ |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 typedef struct { |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 Word16 y2_hi; |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 Word16 y2_lo; |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 Word16 y1_hi; |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 Word16 y1_lo; |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 Word16 x0; |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 Word16 x1; |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 } Pre_ProcessState; |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 /* |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 ******************************************************************************** |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 * DECLARATION OF PROTOTYPES |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 ******************************************************************************** |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 */ |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 void Pre_Process_reset (Pre_ProcessState *st); |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 /* reset of pre processing state (i.e. set state memory to zero) |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 returns 0 on success |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 */ |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 int Pre_Process ( |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 Pre_ProcessState *st, |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 Word16 signal[], /* Input/output signal */ |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 Word16 lg /* Lenght of signal */ |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 ); |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
9b699f30e6f3
libtwamr: integrate pre_proc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 #endif |