FreeCalypso > hg > gsm-codec-lib
annotate libtwamr/pstfilt.h @ 514:67b13a6a63c9
libgsmhr1: implement validation for *.dec frames
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 25 Aug 2024 19:14:40 +0000 |
parents | 59655481e45b |
children |
rev | line source |
---|---|
401
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 ******************************************************************************** |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * R99 Version 3.3.0 |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * REL-4 Version 4.1.0 |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 ******************************************************************************** |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 * |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 * File : pstfilt.h |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 * Purpose : Performs adaptive postfiltering on the synthesis |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 * : speech |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 * |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 ******************************************************************************** |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 */ |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #ifndef pstfilt_h |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #define pstfilt_h "$Id $" |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 /* |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 ******************************************************************************** |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 * INCLUDE FILES |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 ******************************************************************************** |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 */ |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #include "tw_amr.h" |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #include "typedef.h" |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 #include "cnst.h" |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 #include "preemph.h" |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 #include "agc.h" |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 /* |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 ******************************************************************************** |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 * DEFINITION OF DATA TYPES |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 ******************************************************************************** |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 */ |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 typedef struct{ |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 Word16 res2[L_SUBFR]; |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 Word16 mem_syn_pst[M]; |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 preemphasisState preemph_state; |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 agcState agc_state; |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 Word16 synth_buf[M + L_FRAME]; |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 } Post_FilterState; |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 /* |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 ******************************************************************************** |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 * DECLARATION OF PROTOTYPES |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 ******************************************************************************** |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 */ |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 void Post_Filter_reset (Post_FilterState *st); |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 /* reset post filter (i.e. set state memory to zero) |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 returns 0 on success |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 */ |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 int Post_Filter ( |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 Post_FilterState *st, /* i/o : post filter states */ |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 enum Mode mode, /* i : AMR mode */ |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 Word16 *syn, /* i/o : synthesis speech (postfiltered is output) */ |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 Word16 *Az_4 /* i : interpolated LPC parameters in all subfr. */ |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 ); |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 /* filters the signal syn using the parameters in Az_4 to calculate filter |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 coefficients. |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 The filter must be set up using Post_Filter_init prior to the first call |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 to Post_Filter. Post_FilterState is updated to mirror the current state |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 of the filter |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 return 0 on success |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 */ |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 |
59655481e45b
libtwamr: integrate pstfilt.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 #endif |