116                    double *i1, 
double *i2, 
double *o1, 
double *o2,
 
  117                    double b0, 
double b1, 
double b2, 
double a1, 
double a2);
 
  168 #define BIQUAD_FILTER(name, type, min, max, need_clipping)                    \ 
  169 static void biquad_## name (BiquadsContext *s,                                \ 
  170                             const void *input, void *output, int len,         \ 
  171                             double *in1, double *in2,                         \ 
  172                             double *out1, double *out2,                       \ 
  173                             double b0, double b1, double b2,                  \ 
  174                             double a1, double a2)                             \ 
  176     const type *ibuf = input;                                                 \ 
  177     type *obuf = output;                                                      \ 
  186     for (i = 0; i+1 < len; i++) {                                             \ 
  187         o2 = i2 * b2 + i1 * b1 + ibuf[i] * b0 + o2 * a2 + o1 * a1;            \ 
  189         if (need_clipping && o2 < min) {                                      \ 
  192         } else if (need_clipping && o2 > max) {                               \ 
  199         o1 = i1 * b2 + i2 * b1 + ibuf[i] * b0 + o1 * a2 + o2 * a1;            \ 
  201         if (need_clipping && o1 < min) {                                      \ 
  204         } else if (need_clipping && o1 > max) {                               \ 
  212         double o0 = ibuf[i] * b0 + i1 * b1 + i2 * b2 + o1 * a1 + o2 * a2;     \ 
  217         if (need_clipping && o0 < min) {                                      \ 
  220         } else if (need_clipping && o0 > max) {                               \ 
  243     double A = 
exp(s->
gain / 40 * log(10.));
 
  249                "Invalid frequency %f. Frequency must be less than half the sample-rate %d.\n",
 
  262         alpha = sin(w0) * sinh(log(2.) / 2 * s->
width * w0 / sin(w0));
 
  265         alpha = sin(w0) / (2 * s->
width);
 
  268         alpha = sin(w0) / 2 * sqrt((A + 1 / A) * (1 / s->
width - 1) + 2);
 
  278         s->
a0 =   1 + alpha / 
A;
 
  279         s->
a1 =  -2 * cos(w0);
 
  280         s->
a2 =   1 - alpha / 
A;
 
  281         s->
b0 =   1 + alpha * 
A;
 
  282         s->
b1 =  -2 * cos(w0);
 
  283         s->
b2 =   1 - alpha * 
A;
 
  286         s->
a0 =          (A + 1) + (A - 1) * cos(w0) + 2 * sqrt(A) * 
alpha;
 
  287         s->
a1 =    -2 * ((A - 1) + (A + 1) * cos(w0));
 
  288         s->
a2 =          (A + 1) + (A - 1) * cos(w0) - 2 * sqrt(A) * 
alpha;
 
  289         s->
b0 =     A * ((A + 1) - (A - 1) * cos(w0) + 2 * sqrt(A) * 
alpha);
 
  290         s->
b1 = 2 * A * ((A - 1) - (A + 1) * cos(w0));
 
  291         s->
b2 =     A * ((A + 1) - (A - 1) * cos(w0) - 2 * sqrt(A) * 
alpha);
 
  294         s->
a0 =          (A + 1) - (A - 1) * cos(w0) + 2 * sqrt(A) * 
alpha;
 
  295         s->
a1 =     2 * ((A - 1) - (A + 1) * cos(w0));
 
  296         s->
a2 =          (A + 1) - (A - 1) * cos(w0) - 2 * sqrt(A) * 
alpha;
 
  297         s->
b0 =     A * ((A + 1) + (A - 1) * cos(w0) + 2 * sqrt(A) * 
alpha);
 
  298         s->
b1 =-2 * A * ((A - 1) + (A + 1) * cos(w0));
 
  299         s->
b2 =     A * ((A + 1) + (A - 1) * cos(w0) - 2 * sqrt(A) * 
alpha);
 
  304             s->
a1 = -2 * cos(w0);
 
  308             s->
b2 = -sin(w0) / 2;
 
  311             s->
a1 = -2 * cos(w0);
 
  320         s->
a1 = -2 * cos(w0);
 
  323         s->
b1 = -2 * cos(w0);
 
  336             s->
a1 = -2 * cos(w0);
 
  338             s->
b0 = (1 - cos(w0)) / 2;
 
  340             s->
b2 = (1 - cos(w0)) / 2;
 
  348             s->
b0 = (1 - s->
a1) / 2;
 
  353             s->
a1 =  -2 * cos(w0);
 
  355             s->
b0 =  (1 + cos(w0)) / 2;
 
  356             s->
b1 = -(1 + cos(w0));
 
  357             s->
b2 =  (1 + cos(w0)) / 2;
 
  362         s->
a1 = -2 * cos(w0);
 
  365         s->
b1 = -2 * cos(w0);
 
  455 #define OFFSET(x) offsetof(BiquadsContext, x) 
  456 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM 
  458 #define DEFINE_BIQUAD_FILTER(name_, description_)                       \ 
  459 AVFILTER_DEFINE_CLASS(name_);                                           \ 
  460 static av_cold int name_##_init(AVFilterContext *ctx) \ 
  462     BiquadsContext *s = ctx->priv;                                      \ 
  463     s->class = &name_##_class;                                          \ 
  464     s->filter_type = name_;                                             \ 
  468 AVFilter ff_af_##name_ = {                         \ 
  470     .description   = NULL_IF_CONFIG_SMALL(description_), \ 
  471     .priv_size     = sizeof(BiquadsContext),             \ 
  472     .init          = name_##_init,                       \ 
  474     .query_formats = query_formats,                      \ 
  476     .outputs       = outputs,                            \ 
  477     .priv_class    = &name_##_class,                     \ 
  480 #if CONFIG_EQUALIZER_FILTER 
  481 static const AVOption equalizer_options[] = {
 
  498 #if CONFIG_BASS_FILTER 
  499 static const AVOption bass_options[] = {
 
  516 #if CONFIG_TREBLE_FILTER 
  517 static const AVOption treble_options[] = {
 
  534 #if CONFIG_BANDPASS_FILTER 
  535 static const AVOption bandpass_options[] = {
 
  551 #if CONFIG_BANDREJECT_FILTER 
  552 static const AVOption bandreject_options[] = {
 
  567 #if CONFIG_LOWPASS_FILTER 
  568 static const AVOption lowpass_options[] = {
 
  585 #if CONFIG_HIGHPASS_FILTER 
  586 static const AVOption highpass_options[] = {
 
  603 #if CONFIG_ALLPASS_FILTER 
  604 static const AVOption allpass_options[] = {
 
  619 #if CONFIG_BIQUAD_FILTER 
  620 static const AVOption biquad_options[] = {
 
This structure describes decoded (raw) audio or video data. 
#define av_realloc_f(p, o, n)
#define AV_LOG_WARNING
Something somehow does not look correct. 
Main libavfilter public API header. 
static enum AVSampleFormat formats[]
static const AVFilterPad inputs[]
const char * name
Pad name. 
AVFilterLink ** inputs
array of pointers to input links 
#define av_assert0(cond)
assert() equivalent, that is always enabled. 
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter. 
static const AVFilterPad outputs[]
A filter pad used for either input or output. 
static av_cold int init(AVFilterContext *ctx)
A link between two filters. 
static double alpha(void *priv, double x, double y)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
int sample_rate
samples per second 
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions. 
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g. 
void * priv
private data for use by the filter 
simple assert() macros that are a bit more flexible than ISO C assert(). 
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
int format
agreed upon media format 
A list of supported channel layouts. 
void(* filter)(struct BiquadsContext *s, const void *ibuf, void *obuf, int len, double *i1, double *i2, double *o1, double *o2, double b0, double b1, double b2, double a1, double a2)
#define BIQUAD_FILTER(name, type, min, max, need_clipping)
AVSampleFormat
Audio sample formats. 
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable. 
static int config_output(AVFilterLink *outlink)
Describe the class of an AVClass context structure. 
int av_frame_get_channels(const AVFrame *frame)
#define DEFINE_BIQUAD_FILTER(name_, description_)
static int query_formats(AVFilterContext *ctx)
AVFilterLink ** outputs
array of pointers to output links 
enum MovChannelLayoutTag * layouts
static av_cold void uninit(AVFilterContext *ctx)
int channels
Number of channels. 
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
AVFilterContext * dst
dest filter 
static enum AVSampleFormat sample_fmts[]
uint8_t ** extended_data
pointers to the data planes/channels. 
enum FilterType filter_type
int nb_samples
number of audio samples (per channel) described by this frame 
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.