FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
iirfilter.h
Go to the documentation of this file.
1 /*
2  * 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
24  * IIR filter interface
25  */
26 
27 #ifndef AVCODEC_IIRFILTER_H
28 #define AVCODEC_IIRFILTER_H
29 
30 #include "avcodec.h"
31 
32 struct FFIIRFilterCoeffs;
33 struct FFIIRFilterState;
34 
41 };
42 
48 };
49 
50 typedef struct FFIIRFilterContext {
51  /**
52  * Perform IIR filtering on floating-point input samples.
53  *
54  * @param coeffs pointer to filter coefficients
55  * @param state pointer to filter state
56  * @param size input length
57  * @param src source samples
58  * @param sstep source stride
59  * @param dst filtered samples (destination may be the same as input)
60  * @param dstep destination stride
61  */
63  struct FFIIRFilterState *state, int size,
64  const float *src, int sstep, float *dst, int dstep);
66 
67 /**
68  * Initialize FFIIRFilterContext
69  */
72 
73 /**
74  * Initialize filter coefficients.
75  *
76  * @param avc a pointer to an arbitrary struct of which the first
77  * field is a pointer to an AVClass struct
78  * @param filt_type filter type (e.g. Butterworth)
79  * @param filt_mode filter mode (e.g. lowpass)
80  * @param order filter order
81  * @param cutoff_ratio cutoff to input frequency ratio
82  * @param stopband stopband to input frequency ratio (used by bandpass and bandstop filter modes)
83  * @param ripple ripple factor (used only in Chebyshev filters)
84  *
85  * @return pointer to filter coefficients structure or NULL if filter cannot be created
86  */
88  enum IIRFilterType filt_type,
89  enum IIRFilterMode filt_mode,
90  int order, float cutoff_ratio,
91  float stopband, float ripple);
92 
93 /**
94  * Create new filter state.
95  *
96  * @param order filter order
97  *
98  * @return pointer to new filter state or NULL if state creation fails
99  */
100 struct FFIIRFilterState* ff_iir_filter_init_state(int order);
101 
102 /**
103  * Free filter coefficients.
104  *
105  * @param coeffs pointer allocated with ff_iir_filter_init_coeffs()
106  */
108 
109 /**
110  * Free and zero filter state.
111  *
112  * @param state pointer to pointer allocated with ff_iir_filter_init_state()
113  */
115 
116 /**
117  * Perform IIR filtering on signed 16-bit input samples.
118  *
119  * @param coeffs pointer to filter coefficients
120  * @param state pointer to filter state
121  * @param size input length
122  * @param src source samples
123  * @param sstep source stride
124  * @param dst filtered samples (destination may be the same as input)
125  * @param dstep destination stride
126  */
127 void ff_iir_filter(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterState *state,
128  int size, const int16_t *src, int sstep, int16_t *dst, int dstep);
129 
130 /**
131  * Perform IIR filtering on floating-point input samples.
132  *
133  * @param coeffs pointer to filter coefficients
134  * @param state pointer to filter state
135  * @param size input length
136  * @param src source samples
137  * @param sstep source stride
138  * @param dst filtered samples (destination may be the same as input)
139  * @param dstep destination stride
140  */
141 void ff_iir_filter_flt(const struct FFIIRFilterCoeffs *coeffs,
142  struct FFIIRFilterState *state, int size,
143  const float *src, int sstep, float *dst, int dstep);
144 
145 #endif /* AVCODEC_IIRFILTER_H */
void ff_iir_filter_flt(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterState *state, int size, const float *src, int sstep, float *dst, int dstep)
Perform IIR filtering on floating-point input samples.
Definition: iirfilter.c:289
void(* filter_flt)(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterState *state, int size, const float *src, int sstep, float *dst, int dstep)
Perform IIR filtering on floating-point input samples.
Definition: iirfilter.h:62
struct FFIIRFilterState * ff_iir_filter_init_state(int order)
Create new filter state.
Definition: iirfilter.c:203
IIRFilterMode
Definition: iirfilter.h:43
void ff_iir_filter_free_statep(struct FFIIRFilterState **state)
Free and zero filter state.
Definition: iirfilter.c:302
ptrdiff_t size
Definition: opengl_enc.c:101
struct FFIIRFilterCoeffs * ff_iir_filter_init_coeffs(void *avc, enum IIRFilterType filt_type, enum IIRFilterMode filt_mode, int order, float cutoff_ratio, float stopband, float ripple)
Initialize filter coefficients.
Definition: iirfilter.c:161
Libavcodec external API header.
IIR filter state.
Definition: iirfilter.c:45
void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffs)
Free filter coefficients.
Definition: iirfilter.c:307
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
void ff_iir_filter(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterState *state, int size, const int16_t *src, int sstep, int16_t *dst, int dstep)
Perform IIR filtering on signed 16-bit input samples.
Definition: iirfilter.c:276
static struct @197 state
AVS_Value src
Definition: avisynth_c.h:482
IIRFilterType
Definition: iirfilter.h:35
IIR filter global parameters.
Definition: iirfilter.c:35
void ff_iir_filter_init_mips(FFIIRFilterContext *f)
static const int16_t coeffs[]
void ff_iir_filter_init(FFIIRFilterContext *f)
Initialize FFIIRFilterContext.
Definition: iirfilter.c:317