Mercurial > libavcodec.hg
annotate acelp_filters.h @ 6779:a25842a4df43 libavcodec
cosmetics: indent after last commit. patch by matthieu castet <castet matthieu free fr>.
author | jbr |
---|---|
date | Sun, 11 May 2008 18:14:30 +0000 |
parents | 1f02f929b9ff |
children | b03cd8d29d60 |
rev | line source |
---|---|
6772 | 1 /* |
2 * various filters for ACELP-based codecs | |
3 * | |
4 * Copyright (c) 2008 Vladimir Voroshilov | |
5 * | |
6 * This file is part of FFmpeg. | |
7 * | |
8 * FFmpeg is free software; you can redistribute it and/or | |
9 * modify it under the terms of the GNU Lesser General Public | |
10 * License as published by the Free Software Foundation; either | |
11 * version 2.1 of the License, or (at your option) any later version. | |
12 * | |
13 * FFmpeg is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * Lesser General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU Lesser General Public | |
19 * License along with FFmpeg; if not, write to the Free Software | |
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
21 */ | |
22 | |
23 #ifndef FFMPEG_ACELP_FILTERS_H | |
24 #define FFMPEG_ACELP_FILTERS_H | |
25 | |
26 /** | |
27 * \brief Circularly convolve fixed vector with a phase dispersion impulse | |
28 * response filter (D.6.2 of G.729 and 6.1.5 of AMR). | |
29 * \param fc_out vector with filter applied | |
30 * \param fc_in source vector | |
31 * \param filter phase filter coefficients | |
32 * | |
33 * fc_out[n] = sum(i,0,len-1){ fc_in[i] * filter[(len + n - i)%len] } | |
34 * | |
35 * \note fc_in and fc_out should not overlap! | |
36 */ | |
37 void ff_acelp_convolve_circ( | |
38 int16_t* fc_out, | |
39 const int16_t* fc_in, | |
40 const int16_t* filter, | |
41 int subframe_size); | |
42 | |
43 /** | |
44 * \brief LP synthesis filter | |
45 * \param out [out] pointer to output buffer | |
46 * \param filter_coeffs filter coefficients (-0x8000 <= (3.12) < 0x8000) | |
47 * \param in input signal | |
48 * \param buffer_length amount of data to process | |
49 * \param filter_length filter length (11 for 10th order LP filter) | |
50 * \param stop_on_overflow 1 - return immediately if overflow occurs | |
51 * 0 - ignore overflows | |
52 * | |
53 * \return 1 if overflow occurred, 0 - otherwise | |
54 * | |
55 * \note Output buffer must contain 10 samples of past | |
56 * speech data before pointer. | |
57 * | |
58 * Routine applies 1/A(z) filter to given speech data. | |
59 */ | |
60 int ff_acelp_lp_synthesis_filter( | |
61 int16_t *out, | |
62 const int16_t* filter_coeffs, | |
63 const int16_t* in, | |
64 int buffer_length, | |
65 int filter_length, | |
66 int stop_on_overflow); | |
67 | |
68 /** | |
69 * \brief Calculates coefficients of weighted A(z/weight) filter. | |
70 * \param out [out] weighted A(z/weight) result | |
71 * filter (-0x8000 <= (3.12) < 0x8000) | |
72 * \param in source filter (-0x8000 <= (3.12) < 0x8000) | |
73 * \param weight_pow array containing weight^i (-0x8000 <= (0.15) < 0x8000) | |
74 * \param filter_length filter length (11 for 10th order LP filter) | |
75 * | |
76 * out[i]=weight_pow[i]*in[i] , i=0..9 | |
77 */ | |
78 void ff_acelp_weighted_filter( | |
79 int16_t *out, | |
80 const int16_t* in, | |
81 const int16_t *weight_pow, | |
82 int filter_length); | |
83 | |
84 /** | |
85 * \brief high-pass filtering and upscaling (4.2.5 of G.729) | |
86 * \param out [out] output buffer for filtered speech data | |
87 * \param hpf_f [in/out] past filtered data from previous (2 items long) | |
88 * frames (-0x20000000 <= (14.13) < 0x20000000) | |
89 * \param in speech data to process | |
90 * \param length input data size | |
91 * | |
92 * out[i] = 0.93980581 * in[i] - 1.8795834 * in[i-1] + 0.93980581 * in[i-2] + | |
93 * 1.9330735 * out[i-1] - 0.93589199 * out[i-2] | |
94 * | |
95 * The filter has a cut-off frequency of 100Hz | |
96 * | |
97 * \note Two items before the top of the out buffer must contain two items from the | |
98 * tail of the previous subframe. | |
99 * | |
6775
1f02f929b9ff
Update comment to version, negotiated with Diego, and
voroshil
parents:
6772
diff
changeset
|
100 * \remark It is safe to pass the same array in in and out parameters. |
6772 | 101 * |
102 * \remark AMR uses mostly the same filter (cut-off frequency 60Hz, same formula, | |
103 * but constants differs in 5th sign after comma). Fortunately in | |
104 * fixed-point all coefficients are the same as in G.729. Thus this | |
105 * routine can be used for the fixed-point AMR decoder, too. | |
106 */ | |
107 void ff_acelp_high_pass_filter( | |
108 int16_t* out, | |
109 int hpf_f[2], | |
110 const int16_t* in, | |
111 int length); | |
112 | |
113 #endif // FFMPEG_ACELP_FILTERS_H |