125                    double *i1, 
double *i2, 
double *o1, 
double *o2,
 
  126                    double b0, 
double b1, 
double b2, 
double a1, 
double a2, 
int *clippings,
 
  134     if (
s->filter_type != 
biquad) {
 
  135         if (
s->frequency <= 0 || 
s->width <= 0) {
 
  137                    s->frequency, 
s->width);
 
  178 #define BIQUAD_FILTER(name, type, min, max, need_clipping)                    \ 
  179 static void biquad_## name (BiquadsContext *s,                                \ 
  180                             const void *input, void *output, int len,         \ 
  181                             double *in1, double *in2,                         \ 
  182                             double *out1, double *out2,                       \ 
  183                             double b0, double b1, double b2,                  \ 
  184                             double a1, double a2, int *clippings,             \ 
  187     const type *ibuf = input;                                                 \ 
  188     type *obuf = output;                                                      \ 
  193     double wet = s->mix;                                                      \ 
  194     double dry = 1. - wet;                                                    \ 
  200     for (i = 0; i+1 < len; i++) {                                             \ 
  201         o2 = i2 * b2 + i1 * b1 + ibuf[i] * b0 + o2 * a2 + o1 * a1;            \ 
  203         out = o2 * wet + i2 * dry;                                            \ 
  206         } else if (need_clipping && out < min) {                              \ 
  209         } else if (need_clipping && out > max) {                              \ 
  216         o1 = i1 * b2 + i2 * b1 + ibuf[i] * b0 + o1 * a2 + o2 * a1;            \ 
  218         out = o1 * wet + i1 * dry;                                            \ 
  221         } else if (need_clipping && out < min) {                              \ 
  224         } else if (need_clipping && out > max) {                              \ 
  232         double o0 = ibuf[i] * b0 + i1 * b1 + i2 * b2 + o1 * a1 + o2 * a2;     \ 
  237         out = o0 * wet + i1 * dry;                                            \ 
  240         } else if (need_clipping && out < min) {                              \ 
  243         } else if (need_clipping && out > max) {                              \ 
  267     double w0 = 2 * 
M_PI * 
s->frequency / 
inlink->sample_rate;
 
  268     double K = tan(w0 / 2.);
 
  273                "Invalid frequency %f. Frequency must be less than half the sample-rate %d.\n",
 
  274                s->frequency, 
inlink->sample_rate);
 
  278     switch (
s->width_type) {
 
  283         alpha = sin(w0) / (2 * 
s->frequency / 
s->width);
 
  286         alpha = sin(w0) / (2 * 
s->frequency / (
s->width * 1000));
 
  289         alpha = sin(w0) * sinh(log(2.) / 2 * 
s->width * w0 / sin(w0));
 
  292         alpha = sin(w0) / (2 * 
s->width);
 
  295         alpha = sin(w0) / 2 * sqrt((
A + 1 / 
A) * (1 / 
s->width - 1) + 2);
 
  303     switch (
s->filter_type) {
 
  308         s->a1 =  -2 * cos(w0);
 
  311         s->b1 =  -2 * cos(w0);
 
  315         beta = sqrt((
A * 
A + 1) - (
A - 1) * (
A - 1));
 
  317         s->a0 =          (
A + 1) + (
A - 1) * cos(w0) + beta * 
alpha;
 
  318         s->a1 =    -2 * ((
A - 1) + (
A + 1) * cos(w0));
 
  319         s->a2 =          (
A + 1) + (
A - 1) * cos(w0) - beta * 
alpha;
 
  320         s->b0 =     
A * ((
A + 1) - (
A - 1) * cos(w0) + beta * 
alpha);
 
  321         s->b1 = 2 * 
A * ((
A - 1) - (
A + 1) * cos(w0));
 
  322         s->b2 =     
A * ((
A + 1) - (
A - 1) * cos(w0) - beta * 
alpha);
 
  325         beta = sqrt((
A * 
A + 1) - (
A - 1) * (
A - 1));
 
  327         s->a0 =          (
A + 1) - (
A - 1) * cos(w0) + beta * 
alpha;
 
  328         s->a1 =     2 * ((
A - 1) - (
A + 1) * cos(w0));
 
  329         s->a2 =          (
A + 1) - (
A - 1) * cos(w0) - beta * 
alpha;
 
  330         s->b0 =     
A * ((
A + 1) + (
A - 1) * cos(w0) + beta * 
alpha);
 
  331         s->b1 =-2 * 
A * ((
A - 1) + (
A + 1) * cos(w0));
 
  332         s->b2 =     
A * ((
A + 1) + (
A - 1) * cos(w0) - beta * 
alpha);
 
  337             s->a1 = -2 * cos(w0);
 
  341             s->b2 = -sin(w0) / 2;
 
  344             s->a1 = -2 * cos(w0);
 
  353         s->a1 = -2 * cos(w0);
 
  356         s->b1 = -2 * cos(w0);
 
  369             s->a1 = -2 * cos(w0);
 
  371             s->b0 = (1 - cos(w0)) / 2;
 
  373             s->b2 = (1 - cos(w0)) / 2;
 
  381             s->b0 = (1 - 
s->a1) / 2;
 
  386             s->a1 =  -2 * cos(w0);
 
  388             s->b0 =  (1 + cos(w0)) / 2;
 
  389             s->b1 = -(1 + cos(w0));
 
  390             s->b2 =  (1 + cos(w0)) / 2;
 
  397             s->a1 = -(1. - K) / (1. + K);
 
  405             s->a1 = -2 * cos(w0);
 
  408             s->b1 = -2 * cos(w0);
 
  426     if (
s->normalize && fabs(
s->b0 + 
s->b1 + 
s->b2) > 1e-6) {
 
  427         double factor = (
s->a0 + 
s->a1 + 
s->a2) / (
s->b0 + 
s->b1 + 
s->b2);
 
  469     const int start = (buf->
channels * jobnr) / nb_jobs;
 
  470     const int end = (buf->
channels * (jobnr+1)) / nb_jobs;
 
  473     for (ch = start; ch < 
end; ch++) {
 
  482                   &
s->cache[ch].i1, &
s->cache[ch].i2, &
s->cache[ch].o1, &
s->cache[ch].o2,
 
  483                   s->b0, 
s->b1, 
s->b2, 
s->a1, 
s->a2, &
s->cache[ch].clippings, 
ctx->is_disabled);
 
  513     for (ch = 0; ch < outlink->
channels; ch++) {
 
  514         if (
s->cache[ch].clippings > 0)
 
  516                    ch, 
s->cache[ch].clippings);
 
  517         s->cache[ch].clippings = 0;
 
  527                            char *res, 
int res_len, 
int flags)
 
  564 #define OFFSET(x) offsetof(BiquadsContext, x) 
  565 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM 
  566 #define AF AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM 
  568 #define DEFINE_BIQUAD_FILTER(name_, description_)                       \ 
  569 AVFILTER_DEFINE_CLASS(name_);                                           \ 
  570 static av_cold int name_##_init(AVFilterContext *ctx) \ 
  572     BiquadsContext *s = ctx->priv;                                      \ 
  573     s->class = &name_##_class;                                          \ 
  574     s->filter_type = name_;                                             \ 
  578 AVFilter ff_af_##name_ = {                         \ 
  580     .description   = NULL_IF_CONFIG_SMALL(description_), \ 
  581     .priv_size     = sizeof(BiquadsContext),             \ 
  582     .init          = name_##_init,                       \ 
  584     .query_formats = query_formats,                      \ 
  586     .outputs       = outputs,                            \ 
  587     .priv_class    = &name_##_class,                     \ 
  588     .process_command = process_command,                  \ 
  589     .flags         = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, \ 
  592 #if CONFIG_EQUALIZER_FILTER 
  593 static const AVOption equalizer_options[] = {
 
  618 #if CONFIG_BASS_FILTER 
  619 static const AVOption bass_options[] = {
 
  644 #if CONFIG_TREBLE_FILTER 
  645 static const AVOption treble_options[] = {
 
  670 #if CONFIG_BANDPASS_FILTER 
  671 static const AVOption bandpass_options[] = {
 
  695 #if CONFIG_BANDREJECT_FILTER 
  696 static const AVOption bandreject_options[] = {
 
  719 #if CONFIG_LOWPASS_FILTER 
  720 static const AVOption lowpass_options[] = {
 
  745 #if CONFIG_HIGHPASS_FILTER 
  746 static const AVOption highpass_options[] = {
 
  771 #if CONFIG_ALLPASS_FILTER 
  772 static const AVOption allpass_options[] = {
 
  797 #if CONFIG_LOWSHELF_FILTER 
  798 static const AVOption lowshelf_options[] = {
 
  823 #if CONFIG_HIGHSHELF_FILTER 
  824 static const AVOption highshelf_options[] = {
 
  849 #if CONFIG_BIQUAD_FILTER 
  850 static const AVOption biquad_options[] = {