3 * Copyright (c) 2008 Konstantin Shishkov
5 * This file is part of FFmpeg.
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.
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.
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
24 * lowpass filter interface
27 #ifndef FFMPEG_LOWPASS_H
28 #define FFMPEG_LOWPASS_H
32 struct FFLPFilterCoeffs;
33 struct FFLPFilterState;
36 * Initialize filter coefficients.
38 * @param order filter order
39 * @param cutoff_ratio cutoff to input frequency ratio
41 * @return pointer to filter coefficients structure or NULL if filter cannot be created
43 const struct FFLPFilterCoeffs* ff_lowpass_filter_init_coeffs(int order, float cutoff_ratio);
46 * Create new filter state.
48 * @param order filter order
50 * @return pointer to new filter state or NULL if state creation fails
52 struct FFLPFilterState* ff_lowpass_filter_init_state(int order);
54 #if 0 //enable with arbitrary order filter implementation, use av_free() for filter state only for now
56 * Free filter coefficients.
58 * @param coeffs pointer allocated with ff_lowpass_filter_init_coeffs()
60 void ff_lowpass_filter_free_coeffs(struct FFLPFilterCoeffs *coeffs);
65 * @param state pointer allocated with ff_lowpass_filter_init_state()
67 void ff_lowpass_filter_free_state(struct FFLPFilterState *state);
71 * Perform lowpass filtering on input samples.
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
81 void ff_lowpass_filter(const struct FFLPFilterCoeffs *coeffs, struct FFLPFilterState *state, int size, int16_t *src, int sstep, int16_t *dst, int dstep);
83 #endif /* FFMPEG_LOWPASS_H */