Remove explicit filename from Doxygen @file commands.
[libav.git] / libavcodec / iirfilter.h
CommitLineData
2e0b635a 1/*
a169f498 2 * IIR filter
2e0b635a
KS
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/**
ba87f080 23 * @file
a169f498 24 * IIR filter interface
2e0b635a
KS
25 */
26
98790382
SS
27#ifndef AVCODEC_IIRFILTER_H
28#define AVCODEC_IIRFILTER_H
2e0b635a
KS
29
30#include "avcodec.h"
31
a169f498
KS
32struct FFIIRFilterCoeffs;
33struct FFIIRFilterState;
34
35enum IIRFilterType{
36 FF_FILTER_TYPE_BESSEL,
37 FF_FILTER_TYPE_BUTTERWORTH,
38 FF_FILTER_TYPE_CHEBYSHEV,
39 FF_FILTER_TYPE_ELLIPTIC,
40};
41
42enum IIRFilterMode{
43 FF_FILTER_MODE_LOWPASS,
44 FF_FILTER_MODE_HIGHPASS,
45 FF_FILTER_MODE_BANDPASS,
46 FF_FILTER_MODE_BANDSTOP,
47};
2e0b635a
KS
48
49/**
50 * Initialize filter coefficients.
51 *
a169f498
KS
52 * @param filt_type filter type (e.g. Butterworth)
53 * @param filt_mode filter mode (e.g. lowpass)
2e0b635a
KS
54 * @param order filter order
55 * @param cutoff_ratio cutoff to input frequency ratio
a169f498
KS
56 * @param stopband stopband to input frequency ratio (used by bandpass and bandstop filter modes)
57 * @param ripple ripple factor (used only in Chebyshev filters)
2e0b635a
KS
58 *
59 * @return pointer to filter coefficients structure or NULL if filter cannot be created
60 */
a169f498
KS
61struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type,
62 enum IIRFilterMode filt_mode,
63 int order, float cutoff_ratio,
64 float stopband, float ripple);
2e0b635a
KS
65
66/**
67 * Create new filter state.
68 *
69 * @param order filter order
70 *
71 * @return pointer to new filter state or NULL if state creation fails
72 */
a169f498 73struct FFIIRFilterState* ff_iir_filter_init_state(int order);
2e0b635a 74
2e0b635a
KS
75/**
76 * Free filter coefficients.
77 *
a169f498 78 * @param coeffs pointer allocated with ff_iir_filter_init_coeffs()
2e0b635a 79 */
a169f498 80void ff_iir_filter_free_coeffs(struct FFIIRFilterCoeffs *coeffs);
2e0b635a
KS
81
82/**
83 * Free filter state.
84 *
a169f498 85 * @param state pointer allocated with ff_iir_filter_init_state()
2e0b635a 86 */
a169f498 87void ff_iir_filter_free_state(struct FFIIRFilterState *state);
2e0b635a
KS
88
89/**
90 * Perform lowpass filtering on input samples.
91 *
92 * @param coeffs pointer to filter coefficients
93 * @param state pointer to filter state
94 * @param size input length
95 * @param src source samples
96 * @param sstep source stride
97 * @param dst filtered samples (destination may be the same as input)
98 * @param dstep destination stride
99 */
a169f498
KS
100void ff_iir_filter(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterState *state,
101 int size, const int16_t *src, int sstep, int16_t *dst, int dstep);
2e0b635a 102
98790382 103#endif /* AVCODEC_IIRFILTER_H */