FFmpeg
|
different IIR filters implementation More...
#include <math.h>
#include "libavutil/attributes.h"
#include "libavutil/common.h"
#include "iirfilter.h"
Go to the source code of this file.
Data Structures | |
struct | FFIIRFilterCoeffs |
IIR filter global parameters. More... | |
struct | FFIIRFilterState |
IIR filter state. More... | |
Macros | |
#define | MAXORDER 30 |
maximum supported filter order More... | |
#define | CONV_S16(dest, source) dest = av_clip_int16(lrintf(source)); |
#define | CONV_FLT(dest, source) dest = source; |
#define | FILTER_BW_O4_1(i0, i1, i2, i3, fmt) |
#define | FILTER_BW_O4(type, fmt) |
#define | FILTER_DIRECT_FORM_II(type, fmt) |
#define | FILTER_O2(type, fmt) |
Functions | |
static av_cold int | butterworth_init_coeffs (void *avc, struct FFIIRFilterCoeffs *c, enum IIRFilterMode filt_mode, int order, float cutoff_ratio, float stopband) |
static av_cold int | biquad_init_coeffs (void *avc, struct FFIIRFilterCoeffs *c, enum IIRFilterMode filt_mode, int order, float cutoff_ratio, float stopband) |
av_cold 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. More... | |
av_cold struct FFIIRFilterState * | ff_iir_filter_init_state (int order) |
Create new filter state. More... | |
void | ff_iir_filter (const struct FFIIRFilterCoeffs *c, struct FFIIRFilterState *s, int size, const int16_t *src, ptrdiff_t sstep, int16_t *dst, ptrdiff_t dstep) |
Perform IIR filtering on signed 16-bit input samples. More... | |
void | ff_iir_filter_flt (const struct FFIIRFilterCoeffs *c, struct FFIIRFilterState *s, int size, const float *src, ptrdiff_t sstep, float *dst, ptrdiff_t dstep) |
Perform IIR filtering on floating-point input samples. More... | |
av_cold void | ff_iir_filter_free_statep (struct FFIIRFilterState **state) |
Free and zero filter state. More... | |
av_cold void | ff_iir_filter_free_coeffsp (struct FFIIRFilterCoeffs **coeffsp) |
Free filter coefficients. More... | |
void | ff_iir_filter_init (FFIIRFilterContext *f) |
Initialize FFIIRFilterContext. More... | |
different IIR filters implementation
Definition in file iirfilter.c.
#define MAXORDER 30 |
maximum supported filter order
Definition at line 52 of file iirfilter.c.
Referenced by butterworth_init_coeffs(), and ff_iir_filter_init_coeffs().
#define CONV_S16 | ( | dest, | |
source | |||
) | dest = av_clip_int16(lrintf(source)); |
Definition at line 210 of file iirfilter.c.
#define CONV_FLT | ( | dest, | |
source | |||
) | dest = source; |
Definition at line 212 of file iirfilter.c.
#define FILTER_BW_O4_1 | ( | i0, | |
i1, | |||
i2, | |||
i3, | |||
fmt | |||
) |
Definition at line 214 of file iirfilter.c.
Definition at line 228 of file iirfilter.c.
Referenced by ff_iir_filter(), and ff_iir_filter_flt().
Definition at line 241 of file iirfilter.c.
Referenced by ff_iir_filter(), and ff_iir_filter_flt().
Definition at line 263 of file iirfilter.c.
Referenced by ff_iir_filter(), and ff_iir_filter_flt().
|
static |
Definition at line 54 of file iirfilter.c.
Referenced by ff_iir_filter_init_coeffs().
|
static |
Definition at line 119 of file iirfilter.c.
Referenced by ff_iir_filter_init_coeffs().
av_cold 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.
avc | a pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct |
filt_type | filter type (e.g. Butterworth) |
filt_mode | filter mode (e.g. lowpass) |
order | filter order |
cutoff_ratio | cutoff to input frequency ratio |
stopband | stopband to input frequency ratio (used by bandpass and bandstop filter modes) |
ripple | ripple factor (used only in Chebyshev filters) |
Definition at line 162 of file iirfilter.c.
Referenced by ff_psy_preprocess_init(), and main().
av_cold struct FFIIRFilterState* ff_iir_filter_init_state | ( | int | order | ) |
Create new filter state.
order | filter order |
Definition at line 204 of file iirfilter.c.
Referenced by ff_psy_preprocess_init(), and main().
void ff_iir_filter | ( | const struct FFIIRFilterCoeffs * | coeffs, |
struct FFIIRFilterState * | state, | ||
int | size, | ||
const int16_t * | src, | ||
ptrdiff_t | sstep, | ||
int16_t * | dst, | ||
ptrdiff_t | dstep | ||
) |
Perform IIR filtering on signed 16-bit input samples.
coeffs | pointer to filter coefficients |
state | pointer to filter state |
size | input length |
src | source samples |
sstep | source stride |
dst | filtered samples (destination may be the same as input) |
dstep | destination stride |
Definition at line 279 of file iirfilter.c.
Referenced by main().
void ff_iir_filter_flt | ( | const struct FFIIRFilterCoeffs * | coeffs, |
struct FFIIRFilterState * | state, | ||
int | size, | ||
const float * | src, | ||
ptrdiff_t | sstep, | ||
float * | dst, | ||
ptrdiff_t | dstep | ||
) |
Perform IIR filtering on floating-point input samples.
coeffs | pointer to filter coefficients |
state | pointer to filter state |
size | input length |
src | source samples |
sstep | source stride |
dst | filtered samples (destination may be the same as input) |
dstep | destination stride |
Definition at line 293 of file iirfilter.c.
Referenced by ff_iir_filter_init().
av_cold void ff_iir_filter_free_statep | ( | struct FFIIRFilterState ** | state | ) |
Free and zero filter state.
state | pointer to pointer allocated with ff_iir_filter_init_state() |
Definition at line 307 of file iirfilter.c.
Referenced by ff_psy_preprocess_end(), and main().
av_cold void ff_iir_filter_free_coeffsp | ( | struct FFIIRFilterCoeffs ** | coeffs | ) |
Free filter coefficients.
coeffs | pointer allocated with ff_iir_filter_init_coeffs() |
Definition at line 312 of file iirfilter.c.
Referenced by ff_iir_filter_init_coeffs(), ff_psy_preprocess_end(), and main().
void ff_iir_filter_init | ( | FFIIRFilterContext * | f | ) |
Initialize FFIIRFilterContext.
Definition at line 322 of file iirfilter.c.
Referenced by ff_psy_preprocess_init().