7673
|
1 /*
|
|
2 * Lowpass IIR filter
|
|
3 * Copyright (c) 2008 Konstantin Shishkov
|
|
4 *
|
|
5 * This file is part of FFmpeg.
|
|
6 *
|
|
7 * FFmpeg is free software; you can redistribute it and/or
|
|
8 * modify it under the terms of the GNU Lesser General Public
|
|
9 * License as published by the Free Software Foundation; either
|
|
10 * version 2.1 of the License, or (at your option) any later version.
|
|
11 *
|
|
12 * FFmpeg is distributed in the hope that it will be useful,
|
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
15 * Lesser General Public License for more details.
|
|
16 *
|
|
17 * You should have received a copy of the GNU Lesser General Public
|
|
18 * License along with FFmpeg; if not, write to the Free Software
|
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
20 */
|
|
21
|
|
22 /**
|
|
23 * @file lowpass.h
|
|
24 * lowpass filter interface
|
|
25 */
|
|
26
|
|
27 #ifndef FFMPEG_LOWPASS_H
|
|
28 #define FFMPEG_LOWPASS_H
|
|
29
|
|
30 #include "avcodec.h"
|
|
31
|
|
32 struct FFLPFilterCoeffs;
|
|
33 struct FFLPFilterState;
|
|
34
|
|
35 /**
|
|
36 * Initialize filter coefficients.
|
|
37 *
|
|
38 * @param order filter order
|
|
39 * @param cutoff_ratio cutoff to input frequency ratio
|
|
40 *
|
|
41 * @return pointer to filter coefficients structure or NULL if filter cannot be created
|
|
42 */
|
|
43 const struct FFLPFilterCoeffs* ff_lowpass_filter_init_coeffs(int order, float cutoff_ratio);
|
|
44
|
|
45 /**
|
|
46 * Create new filter state.
|
|
47 *
|
|
48 * @param order filter order
|
|
49 *
|
|
50 * @return pointer to new filter state or NULL if state creation fails
|
|
51 */
|
|
52 struct FFLPFilterState* ff_lowpass_filter_init_state(int order);
|
|
53
|
|
54 #if 0 //enable with arbitrary order filter implementation, use av_free() for filter state only for now
|
|
55 /**
|
|
56 * Free filter coefficients.
|
|
57 *
|
|
58 * @param coeffs pointer allocated with ff_lowpass_filter_init_coeffs()
|
|
59 */
|
|
60 void ff_lowpass_filter_free_coeffs(struct FFLPFilterCoeffs *coeffs);
|
|
61
|
|
62 /**
|
|
63 * Free filter state.
|
|
64 *
|
|
65 * @param state pointer allocated with ff_lowpass_filter_init_state()
|
|
66 */
|
|
67 void ff_lowpass_filter_free_state(struct FFLPFilterState *state);
|
|
68 #endif
|
|
69
|
|
70 /**
|
|
71 * Perform lowpass filtering on input samples.
|
|
72 *
|
|
73 * @param coeffs pointer to filter coefficients
|
|
74 * @param state pointer to filter state
|
|
75 * @param size input length
|
|
76 * @param src source samples
|
|
77 * @param sstep source stride
|
|
78 * @param dst filtered samples (destination may be the same as input)
|
|
79 * @param dstep destination stride
|
|
80 */
|
|
81 void ff_lowpass_filter(const struct FFLPFilterCoeffs *coeffs, struct FFLPFilterState *state, int size, int16_t *src, int sstep, int16_t *dst, int dstep);
|
|
82
|
|
83 #endif /* FFMPEG_LOWPASS_H */
|