FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
af_biquads.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Paul B Mahol
3  * Copyright (c) 2006-2008 Rob Sykes <robs@users.sourceforge.net>
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  * 2-pole filters designed by Robert Bristow-Johnson <rbj@audioimagination.com>
24  * see http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
25  *
26  * 1-pole filters based on code (c) 2000 Chris Bagwell <cbagwell@sprynet.com>
27  * Algorithms: Recursive single pole low/high pass filter
28  * Reference: The Scientist and Engineer's Guide to Digital Signal Processing
29  *
30  * low-pass: output[N] = input[N] * A + output[N-1] * B
31  * X = exp(-2.0 * pi * Fc)
32  * A = 1 - X
33  * B = X
34  * Fc = cutoff freq / sample rate
35  *
36  * Mimics an RC low-pass filter:
37  *
38  * ---/\/\/\/\----------->
39  * |
40  * --- C
41  * ---
42  * |
43  * |
44  * V
45  *
46  * high-pass: output[N] = A0 * input[N] + A1 * input[N-1] + B1 * output[N-1]
47  * X = exp(-2.0 * pi * Fc)
48  * A0 = (1 + X) / 2
49  * A1 = -(1 + X) / 2
50  * B1 = X
51  * Fc = cutoff freq / sample rate
52  *
53  * Mimics an RC high-pass filter:
54  *
55  * || C
56  * ----||--------->
57  * || |
58  * <
59  * > R
60  * <
61  * |
62  * V
63  */
64 
65 #include "libavutil/avassert.h"
66 #include "libavutil/opt.h"
67 #include "audio.h"
68 #include "avfilter.h"
69 #include "internal.h"
70 
71 enum FilterType {
82 };
83 
84 enum WidthType {
90 };
91 
92 typedef struct ChanCache {
93  double i1, i2;
94  double o1, o2;
95 } ChanCache;
96 
97 typedef struct BiquadsContext {
98  const AVClass *class;
99 
102  int poles;
103  int csg;
104 
105  double gain;
106  double frequency;
107  double width;
108 
109  double a0, a1, a2;
110  double b0, b1, b2;
111 
114 
115  void (*filter)(struct BiquadsContext *s, const void *ibuf, void *obuf, int len,
116  double *i1, double *i2, double *o1, double *o2,
117  double b0, double b1, double b2, double a1, double a2);
119 
121 {
122  BiquadsContext *s = ctx->priv;
123 
124  if (s->filter_type != biquad) {
125  if (s->frequency <= 0 || s->width <= 0) {
126  av_log(ctx, AV_LOG_ERROR, "Invalid frequency %f and/or width %f <= 0\n",
127  s->frequency, s->width);
128  return AVERROR(EINVAL);
129  }
130  }
131 
132  return 0;
133 }
134 
136 {
139  static const enum AVSampleFormat sample_fmts[] = {
145  };
146  int ret;
147 
148  layouts = ff_all_channel_counts();
149  if (!layouts)
150  return AVERROR(ENOMEM);
151  ret = ff_set_common_channel_layouts(ctx, layouts);
152  if (ret < 0)
153  return ret;
154 
155  formats = ff_make_format_list(sample_fmts);
156  if (!formats)
157  return AVERROR(ENOMEM);
158  ret = ff_set_common_formats(ctx, formats);
159  if (ret < 0)
160  return ret;
161 
162  formats = ff_all_samplerates();
163  if (!formats)
164  return AVERROR(ENOMEM);
165  return ff_set_common_samplerates(ctx, formats);
166 }
167 
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) \
175 { \
176  const type *ibuf = input; \
177  type *obuf = output; \
178  double i1 = *in1; \
179  double i2 = *in2; \
180  double o1 = *out1; \
181  double o2 = *out2; \
182  int i; \
183  a1 = -a1; \
184  a2 = -a2; \
185  \
186  for (i = 0; i+1 < len; i++) { \
187  o2 = i2 * b2 + i1 * b1 + ibuf[i] * b0 + o2 * a2 + o1 * a1; \
188  i2 = ibuf[i]; \
189  if (need_clipping && o2 < min) { \
190  s->clippings++; \
191  obuf[i] = min; \
192  } else if (need_clipping && o2 > max) { \
193  s->clippings++; \
194  obuf[i] = max; \
195  } else { \
196  obuf[i] = o2; \
197  } \
198  i++; \
199  o1 = i1 * b2 + i2 * b1 + ibuf[i] * b0 + o1 * a2 + o2 * a1; \
200  i1 = ibuf[i]; \
201  if (need_clipping && o1 < min) { \
202  s->clippings++; \
203  obuf[i] = min; \
204  } else if (need_clipping && o1 > max) { \
205  s->clippings++; \
206  obuf[i] = max; \
207  } else { \
208  obuf[i] = o1; \
209  } \
210  } \
211  if (i < len) { \
212  double o0 = ibuf[i] * b0 + i1 * b1 + i2 * b2 + o1 * a1 + o2 * a2; \
213  i2 = i1; \
214  i1 = ibuf[i]; \
215  o2 = o1; \
216  o1 = o0; \
217  if (need_clipping && o0 < min) { \
218  s->clippings++; \
219  obuf[i] = min; \
220  } else if (need_clipping && o0 > max) { \
221  s->clippings++; \
222  obuf[i] = max; \
223  } else { \
224  obuf[i] = o0; \
225  } \
226  } \
227  *in1 = i1; \
228  *in2 = i2; \
229  *out1 = o1; \
230  *out2 = o2; \
231 }
232 
233 BIQUAD_FILTER(s16, int16_t, INT16_MIN, INT16_MAX, 1)
234 BIQUAD_FILTER(s32, int32_t, INT32_MIN, INT32_MAX, 1)
235 BIQUAD_FILTER(flt, float, -1., 1., 0)
236 BIQUAD_FILTER(dbl, double, -1., 1., 0)
237 
238 static int config_output(AVFilterLink *outlink)
239 {
240  AVFilterContext *ctx = outlink->src;
241  BiquadsContext *s = ctx->priv;
242  AVFilterLink *inlink = ctx->inputs[0];
243  double A = exp(s->gain / 40 * log(10.));
244  double w0 = 2 * M_PI * s->frequency / inlink->sample_rate;
245  double alpha;
246 
247  if (w0 > M_PI) {
248  av_log(ctx, AV_LOG_ERROR,
249  "Invalid frequency %f. Frequency must be less than half the sample-rate %d.\n",
250  s->frequency, inlink->sample_rate);
251  return AVERROR(EINVAL);
252  }
253 
254  switch (s->width_type) {
255  case NONE:
256  alpha = 0.0;
257  break;
258  case HERTZ:
259  alpha = sin(w0) / (2 * s->frequency / s->width);
260  break;
261  case OCTAVE:
262  alpha = sin(w0) * sinh(log(2.) / 2 * s->width * w0 / sin(w0));
263  break;
264  case QFACTOR:
265  alpha = sin(w0) / (2 * s->width);
266  break;
267  case SLOPE:
268  alpha = sin(w0) / 2 * sqrt((A + 1 / A) * (1 / s->width - 1) + 2);
269  break;
270  default:
271  av_assert0(0);
272  }
273 
274  switch (s->filter_type) {
275  case biquad:
276  break;
277  case equalizer:
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;
284  break;
285  case bass:
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);
292  break;
293  case treble:
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);
300  break;
301  case bandpass:
302  if (s->csg) {
303  s->a0 = 1 + alpha;
304  s->a1 = -2 * cos(w0);
305  s->a2 = 1 - alpha;
306  s->b0 = sin(w0) / 2;
307  s->b1 = 0;
308  s->b2 = -sin(w0) / 2;
309  } else {
310  s->a0 = 1 + alpha;
311  s->a1 = -2 * cos(w0);
312  s->a2 = 1 - alpha;
313  s->b0 = alpha;
314  s->b1 = 0;
315  s->b2 = -alpha;
316  }
317  break;
318  case bandreject:
319  s->a0 = 1 + alpha;
320  s->a1 = -2 * cos(w0);
321  s->a2 = 1 - alpha;
322  s->b0 = 1;
323  s->b1 = -2 * cos(w0);
324  s->b2 = 1;
325  break;
326  case lowpass:
327  if (s->poles == 1) {
328  s->a0 = 1;
329  s->a1 = -exp(-w0);
330  s->a2 = 0;
331  s->b0 = 1 + s->a1;
332  s->b1 = 0;
333  s->b2 = 0;
334  } else {
335  s->a0 = 1 + alpha;
336  s->a1 = -2 * cos(w0);
337  s->a2 = 1 - alpha;
338  s->b0 = (1 - cos(w0)) / 2;
339  s->b1 = 1 - cos(w0);
340  s->b2 = (1 - cos(w0)) / 2;
341  }
342  break;
343  case highpass:
344  if (s->poles == 1) {
345  s->a0 = 1;
346  s->a1 = -exp(-w0);
347  s->a2 = 0;
348  s->b0 = (1 - s->a1) / 2;
349  s->b1 = -s->b0;
350  s->b2 = 0;
351  } else {
352  s->a0 = 1 + alpha;
353  s->a1 = -2 * cos(w0);
354  s->a2 = 1 - alpha;
355  s->b0 = (1 + cos(w0)) / 2;
356  s->b1 = -(1 + cos(w0));
357  s->b2 = (1 + cos(w0)) / 2;
358  }
359  break;
360  case allpass:
361  s->a0 = 1 + alpha;
362  s->a1 = -2 * cos(w0);
363  s->a2 = 1 - alpha;
364  s->b0 = 1 - alpha;
365  s->b1 = -2 * cos(w0);
366  s->b2 = 1 + alpha;
367  break;
368  default:
369  av_assert0(0);
370  }
371 
372  s->a1 /= s->a0;
373  s->a2 /= s->a0;
374  s->b0 /= s->a0;
375  s->b1 /= s->a0;
376  s->b2 /= s->a0;
377 
378  s->cache = av_realloc_f(s->cache, sizeof(ChanCache), inlink->channels);
379  if (!s->cache)
380  return AVERROR(ENOMEM);
381  memset(s->cache, 0, sizeof(ChanCache) * inlink->channels);
382 
383  switch (inlink->format) {
384  case AV_SAMPLE_FMT_S16P: s->filter = biquad_s16; break;
385  case AV_SAMPLE_FMT_S32P: s->filter = biquad_s32; break;
386  case AV_SAMPLE_FMT_FLTP: s->filter = biquad_flt; break;
387  case AV_SAMPLE_FMT_DBLP: s->filter = biquad_dbl; break;
388  default: av_assert0(0);
389  }
390 
391  return 0;
392 }
393 
394 static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
395 {
396  AVFilterContext *ctx = inlink->dst;
397  BiquadsContext *s = ctx->priv;
398  AVFilterLink *outlink = ctx->outputs[0];
399  AVFrame *out_buf;
400  int nb_samples = buf->nb_samples;
401  int ch;
402 
403  if (av_frame_is_writable(buf)) {
404  out_buf = buf;
405  } else {
406  out_buf = ff_get_audio_buffer(inlink, nb_samples);
407  if (!out_buf) {
408  av_frame_free(&buf);
409  return AVERROR(ENOMEM);
410  }
411  av_frame_copy_props(out_buf, buf);
412  }
413 
414  for (ch = 0; ch < av_frame_get_channels(buf); ch++)
415  s->filter(s, buf->extended_data[ch],
416  out_buf->extended_data[ch], nb_samples,
417  &s->cache[ch].i1, &s->cache[ch].i2,
418  &s->cache[ch].o1, &s->cache[ch].o2,
419  s->b0, s->b1, s->b2, s->a1, s->a2);
420 
421  if (s->clippings > 0)
422  av_log(ctx, AV_LOG_WARNING, "clipping %d times. Please reduce gain.\n", s->clippings);
423 
424  if (buf != out_buf)
425  av_frame_free(&buf);
426 
427  return ff_filter_frame(outlink, out_buf);
428 }
429 
431 {
432  BiquadsContext *s = ctx->priv;
433 
434  av_freep(&s->cache);
435 }
436 
437 static const AVFilterPad inputs[] = {
438  {
439  .name = "default",
440  .type = AVMEDIA_TYPE_AUDIO,
441  .filter_frame = filter_frame,
442  },
443  { NULL }
444 };
445 
446 static const AVFilterPad outputs[] = {
447  {
448  .name = "default",
449  .type = AVMEDIA_TYPE_AUDIO,
450  .config_props = config_output,
451  },
452  { NULL }
453 };
454 
455 #define OFFSET(x) offsetof(BiquadsContext, x)
456 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
457 
458 #define DEFINE_BIQUAD_FILTER(name_, description_) \
459 AVFILTER_DEFINE_CLASS(name_); \
460 static av_cold int name_##_init(AVFilterContext *ctx) \
461 { \
462  BiquadsContext *s = ctx->priv; \
463  s->class = &name_##_class; \
464  s->filter_type = name_; \
465  return init(ctx); \
466 } \
467  \
468 AVFilter ff_af_##name_ = { \
469  .name = #name_, \
470  .description = NULL_IF_CONFIG_SMALL(description_), \
471  .priv_size = sizeof(BiquadsContext), \
472  .init = name_##_init, \
473  .uninit = uninit, \
474  .query_formats = query_formats, \
475  .inputs = inputs, \
476  .outputs = outputs, \
477  .priv_class = &name_##_class, \
478 }
479 
480 #if CONFIG_EQUALIZER_FILTER
481 static const AVOption equalizer_options[] = {
482  {"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 999999, FLAGS},
483  {"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 999999, FLAGS},
484  {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, SLOPE, FLAGS, "width_type"},
485  {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
486  {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
487  {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
488  {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
489  {"width", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 999, FLAGS},
490  {"w", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 999, FLAGS},
491  {"gain", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
492  {"g", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
493  {NULL}
494 };
495 
496 DEFINE_BIQUAD_FILTER(equalizer, "Apply two-pole peaking equalization (EQ) filter.");
497 #endif /* CONFIG_EQUALIZER_FILTER */
498 #if CONFIG_BASS_FILTER
499 static const AVOption bass_options[] = {
500  {"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=100}, 0, 999999, FLAGS},
501  {"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=100}, 0, 999999, FLAGS},
502  {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, SLOPE, FLAGS, "width_type"},
503  {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
504  {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
505  {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
506  {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
507  {"width", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
508  {"w", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
509  {"gain", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
510  {"g", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
511  {NULL}
512 };
513 
514 DEFINE_BIQUAD_FILTER(bass, "Boost or cut lower frequencies.");
515 #endif /* CONFIG_BASS_FILTER */
516 #if CONFIG_TREBLE_FILTER
517 static const AVOption treble_options[] = {
518  {"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
519  {"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
520  {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, SLOPE, FLAGS, "width_type"},
521  {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
522  {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
523  {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
524  {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
525  {"width", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
526  {"w", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
527  {"gain", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
528  {"g", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
529  {NULL}
530 };
531 
532 DEFINE_BIQUAD_FILTER(treble, "Boost or cut upper frequencies.");
533 #endif /* CONFIG_TREBLE_FILTER */
534 #if CONFIG_BANDPASS_FILTER
535 static const AVOption bandpass_options[] = {
536  {"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
537  {"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
538  {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, SLOPE, FLAGS, "width_type"},
539  {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
540  {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
541  {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
542  {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
543  {"width", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 999, FLAGS},
544  {"w", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 999, FLAGS},
545  {"csg", "use constant skirt gain", OFFSET(csg), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
546  {NULL}
547 };
548 
549 DEFINE_BIQUAD_FILTER(bandpass, "Apply a two-pole Butterworth band-pass filter.");
550 #endif /* CONFIG_BANDPASS_FILTER */
551 #if CONFIG_BANDREJECT_FILTER
552 static const AVOption bandreject_options[] = {
553  {"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
554  {"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
555  {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, SLOPE, FLAGS, "width_type"},
556  {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
557  {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
558  {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
559  {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
560  {"width", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 999, FLAGS},
561  {"w", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 999, FLAGS},
562  {NULL}
563 };
564 
565 DEFINE_BIQUAD_FILTER(bandreject, "Apply a two-pole Butterworth band-reject filter.");
566 #endif /* CONFIG_BANDREJECT_FILTER */
567 #if CONFIG_LOWPASS_FILTER
568 static const AVOption lowpass_options[] = {
569  {"frequency", "set frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=500}, 0, 999999, FLAGS},
570  {"f", "set frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=500}, 0, 999999, FLAGS},
571  {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, SLOPE, FLAGS, "width_type"},
572  {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
573  {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
574  {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
575  {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
576  {"width", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.707}, 0, 99999, FLAGS},
577  {"w", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.707}, 0, 99999, FLAGS},
578  {"poles", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, FLAGS},
579  {"p", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, FLAGS},
580  {NULL}
581 };
582 
583 DEFINE_BIQUAD_FILTER(lowpass, "Apply a low-pass filter with 3dB point frequency.");
584 #endif /* CONFIG_LOWPASS_FILTER */
585 #if CONFIG_HIGHPASS_FILTER
586 static const AVOption highpass_options[] = {
587  {"frequency", "set frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
588  {"f", "set frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
589  {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, SLOPE, FLAGS, "width_type"},
590  {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
591  {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
592  {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
593  {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
594  {"width", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.707}, 0, 99999, FLAGS},
595  {"w", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.707}, 0, 99999, FLAGS},
596  {"poles", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, FLAGS},
597  {"p", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, FLAGS},
598  {NULL}
599 };
600 
601 DEFINE_BIQUAD_FILTER(highpass, "Apply a high-pass filter with 3dB point frequency.");
602 #endif /* CONFIG_HIGHPASS_FILTER */
603 #if CONFIG_ALLPASS_FILTER
604 static const AVOption allpass_options[] = {
605  {"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
606  {"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
607  {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=HERTZ}, HERTZ, SLOPE, FLAGS, "width_type"},
608  {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
609  {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
610  {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
611  {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
612  {"width", "set filter-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=707.1}, 0, 99999, FLAGS},
613  {"w", "set filter-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=707.1}, 0, 99999, FLAGS},
614  {NULL}
615 };
616 
617 DEFINE_BIQUAD_FILTER(allpass, "Apply a two-pole all-pass filter.");
618 #endif /* CONFIG_ALLPASS_FILTER */
619 #if CONFIG_BIQUAD_FILTER
620 static const AVOption biquad_options[] = {
621  {"a0", NULL, OFFSET(a0), AV_OPT_TYPE_DOUBLE, {.dbl=1}, INT16_MIN, INT16_MAX, FLAGS},
622  {"a1", NULL, OFFSET(a1), AV_OPT_TYPE_DOUBLE, {.dbl=1}, INT16_MIN, INT16_MAX, FLAGS},
623  {"a2", NULL, OFFSET(a2), AV_OPT_TYPE_DOUBLE, {.dbl=1}, INT16_MIN, INT16_MAX, FLAGS},
624  {"b0", NULL, OFFSET(b0), AV_OPT_TYPE_DOUBLE, {.dbl=1}, INT16_MIN, INT16_MAX, FLAGS},
625  {"b1", NULL, OFFSET(b1), AV_OPT_TYPE_DOUBLE, {.dbl=1}, INT16_MIN, INT16_MAX, FLAGS},
626  {"b2", NULL, OFFSET(b2), AV_OPT_TYPE_DOUBLE, {.dbl=1}, INT16_MIN, INT16_MAX, FLAGS},
627  {NULL}
628 };
629 
630 DEFINE_BIQUAD_FILTER(biquad, "Apply a biquad IIR filter with the given coefficients.");
631 #endif /* CONFIG_BIQUAD_FILTER */
float, planar
Definition: samplefmt.h:69
#define NULL
Definition: coverity.c:32
int ff_set_common_channel_layouts(AVFilterContext *ctx, AVFilterChannelLayouts *layouts)
A helper for query_formats() which sets all links to the same list of channel layouts/sample rates...
Definition: formats.c:549
const char * s
Definition: avisynth_c.h:768
This structure describes decoded (raw) audio or video data.
Definition: frame.h:184
#define av_realloc_f(p, o, n)
AVOption.
Definition: opt.h:245
ChanCache * cache
Definition: af_biquads.c:112
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
Main libavfilter public API header.
double i2
Definition: af_biquads.c:93
#define a0
Definition: regdef.h:46
static enum AVSampleFormat formats[]
Definition: avresample.c:163
double, planar
Definition: samplefmt.h:70
#define a1
Definition: regdef.h:47
static const AVFilterPad inputs[]
Definition: af_biquads.c:437
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:283
const char * name
Pad name.
Definition: internal.h:59
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:315
FilterType
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1189
#define OFFSET(x)
Definition: af_biquads.c:455
#define av_cold
Definition: attributes.h:82
AVOptions.
#define A(x)
Definition: vp56_arith.h:28
#define av_log(a,...)
static const AVFilterPad outputs[]
Definition: af_biquads.c:446
A filter pad used for either input or output.
Definition: internal.h:53
static av_cold int init(AVFilterContext *ctx)
Definition: af_biquads.c:120
static double alpha(void *priv, double x, double y)
Definition: vf_geq.c:99
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:568
#define FLAGS
Definition: af_biquads.c:456
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
Definition: audio.c:64
#define AVERROR(e)
Definition: error.h:43
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:158
void * priv
private data for use by the filter
Definition: avfilter.h:322
simple assert() macros that are a bit more flexible than ISO C assert().
int8_t exp
Definition: eval.c:64
double o1
Definition: af_biquads.c:94
signed 32 bits, planar
Definition: samplefmt.h:68
#define width
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
int32_t
AVFormatContext * ctx
Definition: movenc.c:48
#define a2
Definition: regdef.h:48
A list of supported channel layouts.
Definition: formats.h:85
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)
Definition: af_biquads.c:115
#define BIQUAD_FILTER(name, type, min, max, need_clipping)
Definition: af_biquads.c:168
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:529
static int config_output(AVFilterLink *outlink)
Definition: af_biquads.c:238
void * buf
Definition: avisynth_c.h:690
Describe the class of an AVClass context structure.
Definition: log.h:67
int av_frame_get_channels(const AVFrame *frame)
#define DEFINE_BIQUAD_FILTER(name_, description_)
Definition: af_biquads.c:458
static int query_formats(AVFilterContext *ctx)
Definition: af_biquads.c:135
double o2
Definition: af_biquads.c:94
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:319
enum MovChannelLayoutTag * layouts
Definition: mov_chan.c:434
AVFilterFormats * ff_all_samplerates(void)
Definition: formats.c:395
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_biquads.c:430
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(constuint8_t *) pi-0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(constint16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(constint32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(constint64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(constfloat *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(constdouble *) pi *(INT64_C(1)<< 63)))#defineFMT_PAIR_FUNC(out, in) staticconv_func_type *constfmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64),};staticvoidcpy1(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, len);}staticvoidcpy2(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 2 *len);}staticvoidcpy4(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 4 *len);}staticvoidcpy8(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 8 *len);}AudioConvert *swri_audio_convert_alloc(enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, constint *ch_map, intflags){AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) returnNULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) returnNULL;if(channels==1){in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);}ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map){switch(av_get_bytes_per_sample(in_fmt)){case1:ctx->simd_f=cpy1;break;case2:ctx->simd_f=cpy2;break;case4:ctx->simd_f=cpy4;break;case8:ctx->simd_f=cpy8;break;}}if(HAVE_YASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);returnctx;}voidswri_audio_convert_free(AudioConvert **ctx){av_freep(ctx);}intswri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, intlen){intch;intoff=0;constintos=(out->planar?1:out->ch_count)*out->bps;unsignedmisaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask){intplanes=in->planar?in->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;}if(ctx->out_simd_align_mask){intplanes=out->planar?out->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;}if(ctx->simd_f &&!ctx->ch_map &&!misaligned){off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){if(out->planar==in->planar){intplanes=out->planar?out->ch_count:1;for(ch=0;ch< planes;ch++){ctx->simd_f(out-> ch ch
Definition: audioconvert.c:56
WidthType
Definition: af_biquads.c:84
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
Definition: af_biquads.c:394
int len
double i1
Definition: af_biquads.c:93
A list of supported formats for one end of a filter link.
Definition: formats.h:64
An instance of a filter.
Definition: avfilter.h:307
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:701
#define av_freep(p)
signed 16 bits, planar
Definition: samplefmt.h:67
double frequency
Definition: af_biquads.c:106
#define M_PI
Definition: mathematics.h:52
internal API functions
AVFilterChannelLayouts * ff_all_channel_counts(void)
Construct an AVFilterChannelLayouts coding for any channel layout, with known or unknown disposition...
Definition: formats.c:410
uint8_t ** extended_data
pointers to the data planes/channels.
Definition: frame.h:231
enum FilterType filter_type
Definition: af_biquads.c:100
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:241
int ff_set_common_samplerates(AVFilterContext *ctx, AVFilterFormats *samplerates)
Definition: formats.c:556
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:589