FreeCalypso > hg > gsm-codec-lib
annotate libtwamr/preemph.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 | 3618b5cf25a6 |
children |
rev | line source |
---|---|
399
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 ******************************************************************************** |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * R99 Version 3.3.0 |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * REL-4 Version 4.1.0 |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 ******************************************************************************** |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 * |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 * File : preemph.h |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 * Purpose : Preemphasis filtering |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 * Description : Filtering through 1 - g z^-1 |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 * |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 ******************************************************************************** |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 */ |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #ifndef preemph_h |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #define preemph_h "$Id $" |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 /* |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 ******************************************************************************** |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 * INCLUDE FILES |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 ******************************************************************************** |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 */ |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #include "typedef.h" |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 /* |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 ******************************************************************************** |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 * DEFINITION OF DATA TYPES |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 ******************************************************************************** |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 */ |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 typedef struct { |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 Word16 mem_pre; /* filter state */ |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 } preemphasisState; |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 /* |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 ******************************************************************************** |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 * DECLARATION OF PROTOTYPES |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 ******************************************************************************** |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 */ |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 void preemphasis_reset (preemphasisState *st); |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 /* reset of preemphasis filter (i.e. set state memory to zero) |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 returns 0 on success |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 */ |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 int preemphasis ( |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 preemphasisState *st, /* (i/o): preemphasis filter state */ |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 Word16 *signal, /* (i/o): input signal overwritten by the output */ |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 Word16 g, /* (i) : preemphasis coefficient */ |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 Word16 L /* (i) : size of filtering */ |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 ); |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 |
3618b5cf25a6
libtwamr: integrate preemph.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 #endif |