libavcodec/iirfilter.c File Reference

different IIR filters implementation More...

#include "iirfilter.h"
#include <complex.h>
#include <math.h>

Go to the source code of this file.

Data Structures

struct  FFIIRFilterCoeffs
 IIR filter global parameters. More...
struct  FFIIRFilterState
 IIR filter state. More...


#define MAXORDER   30
 maximum supported filter order
#define FILTER(i0, i1, i2, i3)


struct FFIIRFilterCoeffsff_iir_filter_init_coeffs (enum IIRFilterType filt_type, enum IIRFilterMode filt_mode, int order, float cutoff_ratio, float stopband, float ripple)
 Initialize filter coefficients.
struct FFIIRFilterStateff_iir_filter_init_state (int order)
 Create new filter state.
void ff_iir_filter (const struct FFIIRFilterCoeffs *c, struct FFIIRFilterState *s, int size, const int16_t *src, int sstep, int16_t *dst, int dstep)
 Perform lowpass filtering on input samples.
void ff_iir_filter_free_state (struct FFIIRFilterState *state)
 Free filter state.
void ff_iir_filter_free_coeffs (struct FFIIRFilterCoeffs *coeffs)
 Free filter coefficients.

Detailed Description

different IIR filters implementation

Definition in file iirfilter.c.

Define Documentation

#define FILTER ( i0,
i3   ) 


in =   *src * c->gain                         \
         + c->cy[0]*s->x[i0] + c->cy[1]*s->x[i1]  \
         + c->cy[2]*s->x[i2] + c->cy[3]*s->x[i3]; \
    res =  (s->x[i0] + in      )*1                \
         + (s->x[i1] + s->x[i3])*4                \
         +  s->x[i2]            *6;               \
    *dst = av_clip_int16(lrintf(res));            \
    s->x[i0] = in;                                \
    src += sstep;                                 \
    dst += dstep;                                 \

Definition at line 106 of file iirfilter.c.

#define MAXORDER   30

maximum supported filter order

Definition at line 49 of file iirfilter.c.

Referenced by ff_iir_filter_init_coeffs().

Function Documentation

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 lowpass filtering on 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 118 of file iirfilter.c.

void ff_iir_filter_free_coeffs ( struct FFIIRFilterCoeffs coeffs  ) 

Free filter coefficients.

coeffs pointer allocated with ff_iir_filter_init_coeffs()

Definition at line 156 of file iirfilter.c.

void ff_iir_filter_free_state ( struct FFIIRFilterState state  ) 

Free filter state.

state pointer allocated with ff_iir_filter_init_state()

Definition at line 151 of file iirfilter.c.

struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs ( enum IIRFilterType  filt_type,
enum IIRFilterMode  filt_mode,
int  order,
float  cutoff_ratio,
float  stopband,
float  ripple 
) [read]

Initialize filter coefficients.

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)
pointer to filter coefficients structure or NULL if filter cannot be created

Definition at line 51 of file iirfilter.c.

struct FFIIRFilterState* ff_iir_filter_init_state ( int  order  )  [read]

Create new filter state.

order filter order
pointer to new filter state or NULL if state creation fails

Definition at line 100 of file iirfilter.c.

Generated on Fri Oct 26 02:35:43 2012 for FFmpeg by  doxygen 1.5.8