2013-01-24 20:20:05 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 Paul B Mahol
|
|
|
|
* Copyright (c) 2006-2008 Rob Sykes <robs@users.sourceforge.net>
|
|
|
|
*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 2-pole filters designed by Robert Bristow-Johnson <rbj@audioimagination.com>
|
|
|
|
* see http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
|
|
|
|
*
|
|
|
|
* 1-pole filters based on code (c) 2000 Chris Bagwell <cbagwell@sprynet.com>
|
|
|
|
* Algorithms: Recursive single pole low/high pass filter
|
|
|
|
* Reference: The Scientist and Engineer's Guide to Digital Signal Processing
|
|
|
|
*
|
|
|
|
* low-pass: output[N] = input[N] * A + output[N-1] * B
|
|
|
|
* X = exp(-2.0 * pi * Fc)
|
|
|
|
* A = 1 - X
|
|
|
|
* B = X
|
|
|
|
* Fc = cutoff freq / sample rate
|
|
|
|
*
|
|
|
|
* Mimics an RC low-pass filter:
|
|
|
|
*
|
|
|
|
* ---/\/\/\/\----------->
|
|
|
|
* |
|
|
|
|
* --- C
|
|
|
|
* ---
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* V
|
|
|
|
*
|
|
|
|
* high-pass: output[N] = A0 * input[N] + A1 * input[N-1] + B1 * output[N-1]
|
|
|
|
* X = exp(-2.0 * pi * Fc)
|
|
|
|
* A0 = (1 + X) / 2
|
|
|
|
* A1 = -(1 + X) / 2
|
|
|
|
* B1 = X
|
|
|
|
* Fc = cutoff freq / sample rate
|
|
|
|
*
|
|
|
|
* Mimics an RC high-pass filter:
|
|
|
|
*
|
|
|
|
* || C
|
|
|
|
* ----||--------->
|
|
|
|
* || |
|
|
|
|
* <
|
|
|
|
* > R
|
|
|
|
* <
|
|
|
|
* |
|
|
|
|
* V
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "libavutil/avassert.h"
|
2018-12-31 22:12:42 +02:00
|
|
|
#include "libavutil/ffmath.h"
|
2013-09-07 15:13:50 +03:00
|
|
|
#include "libavutil/opt.h"
|
2013-01-24 20:20:05 +03:00
|
|
|
#include "audio.h"
|
|
|
|
#include "avfilter.h"
|
|
|
|
#include "internal.h"
|
|
|
|
|
|
|
|
enum FilterType {
|
|
|
|
biquad,
|
|
|
|
equalizer,
|
|
|
|
bass,
|
|
|
|
treble,
|
|
|
|
bandpass,
|
|
|
|
bandreject,
|
|
|
|
allpass,
|
|
|
|
highpass,
|
|
|
|
lowpass,
|
2018-04-17 11:31:34 +02:00
|
|
|
lowshelf,
|
|
|
|
highshelf,
|
2013-01-24 20:20:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
enum WidthType {
|
|
|
|
NONE,
|
2013-06-30 14:32:59 +03:00
|
|
|
HERTZ,
|
2013-01-24 20:20:05 +03:00
|
|
|
OCTAVE,
|
|
|
|
QFACTOR,
|
|
|
|
SLOPE,
|
2017-12-21 12:40:38 +02:00
|
|
|
KHERTZ,
|
|
|
|
NB_WTYPE,
|
2013-01-24 20:20:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct ChanCache {
|
|
|
|
double i1, i2;
|
|
|
|
double o1, o2;
|
2018-05-01 15:26:20 +02:00
|
|
|
int clippings;
|
2013-01-24 20:20:05 +03:00
|
|
|
} ChanCache;
|
|
|
|
|
2015-12-23 20:15:25 +02:00
|
|
|
typedef struct BiquadsContext {
|
2013-01-24 20:20:05 +03:00
|
|
|
const AVClass *class;
|
|
|
|
|
|
|
|
enum FilterType filter_type;
|
2015-02-03 00:09:35 +02:00
|
|
|
int width_type;
|
2013-01-24 20:20:05 +03:00
|
|
|
int poles;
|
|
|
|
int csg;
|
|
|
|
|
|
|
|
double gain;
|
|
|
|
double frequency;
|
|
|
|
double width;
|
2019-07-08 16:20:57 +02:00
|
|
|
double mix;
|
2017-04-25 18:08:26 +02:00
|
|
|
uint64_t channels;
|
2013-01-24 20:20:05 +03:00
|
|
|
|
|
|
|
double a0, a1, a2;
|
|
|
|
double b0, b1, b2;
|
|
|
|
|
|
|
|
ChanCache *cache;
|
2017-04-25 18:08:26 +02:00
|
|
|
int block_align;
|
2013-01-24 20:20:05 +03:00
|
|
|
|
2015-12-23 20:15:25 +02:00
|
|
|
void (*filter)(struct BiquadsContext *s, const void *ibuf, void *obuf, int len,
|
2013-01-24 20:20:05 +03:00
|
|
|
double *i1, double *i2, double *o1, double *o2,
|
2019-05-01 12:55:34 +02:00
|
|
|
double b0, double b1, double b2, double a1, double a2, int *clippings,
|
|
|
|
int disabled);
|
2013-01-24 20:20:05 +03:00
|
|
|
} BiquadsContext;
|
|
|
|
|
2013-04-12 12:13:33 +03:00
|
|
|
static av_cold int init(AVFilterContext *ctx)
|
2013-01-24 20:20:05 +03:00
|
|
|
{
|
2015-01-28 16:30:27 +02:00
|
|
|
BiquadsContext *s = ctx->priv;
|
2013-01-24 20:20:05 +03:00
|
|
|
|
2015-01-28 16:30:27 +02:00
|
|
|
if (s->filter_type != biquad) {
|
|
|
|
if (s->frequency <= 0 || s->width <= 0) {
|
2013-01-24 20:20:05 +03:00
|
|
|
av_log(ctx, AV_LOG_ERROR, "Invalid frequency %f and/or width %f <= 0\n",
|
2015-01-28 16:30:27 +02:00
|
|
|
s->frequency, s->width);
|
2013-01-24 20:20:05 +03:00
|
|
|
return AVERROR(EINVAL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int query_formats(AVFilterContext *ctx)
|
|
|
|
{
|
|
|
|
AVFilterFormats *formats;
|
|
|
|
AVFilterChannelLayouts *layouts;
|
|
|
|
static const enum AVSampleFormat sample_fmts[] = {
|
|
|
|
AV_SAMPLE_FMT_S16P,
|
|
|
|
AV_SAMPLE_FMT_S32P,
|
|
|
|
AV_SAMPLE_FMT_FLTP,
|
|
|
|
AV_SAMPLE_FMT_DBLP,
|
|
|
|
AV_SAMPLE_FMT_NONE
|
|
|
|
};
|
2015-04-03 19:55:18 +02:00
|
|
|
int ret;
|
2013-01-24 20:20:05 +03:00
|
|
|
|
2015-09-11 20:51:10 +02:00
|
|
|
layouts = ff_all_channel_counts();
|
2013-01-24 20:20:05 +03:00
|
|
|
if (!layouts)
|
|
|
|
return AVERROR(ENOMEM);
|
2015-04-03 19:55:18 +02:00
|
|
|
ret = ff_set_common_channel_layouts(ctx, layouts);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2013-01-24 20:20:05 +03:00
|
|
|
|
|
|
|
formats = ff_make_format_list(sample_fmts);
|
|
|
|
if (!formats)
|
|
|
|
return AVERROR(ENOMEM);
|
2015-04-03 19:55:18 +02:00
|
|
|
ret = ff_set_common_formats(ctx, formats);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2013-01-24 20:20:05 +03:00
|
|
|
|
|
|
|
formats = ff_all_samplerates();
|
|
|
|
if (!formats)
|
|
|
|
return AVERROR(ENOMEM);
|
2015-04-03 19:55:18 +02:00
|
|
|
return ff_set_common_samplerates(ctx, formats);
|
2013-01-24 20:20:05 +03:00
|
|
|
}
|
|
|
|
|
2014-07-17 06:49:04 +03:00
|
|
|
#define BIQUAD_FILTER(name, type, min, max, need_clipping) \
|
2015-12-23 20:15:25 +02:00
|
|
|
static void biquad_## name (BiquadsContext *s, \
|
2015-12-07 12:14:59 +02:00
|
|
|
const void *input, void *output, int len, \
|
2013-01-24 20:20:05 +03:00
|
|
|
double *in1, double *in2, \
|
|
|
|
double *out1, double *out2, \
|
|
|
|
double b0, double b1, double b2, \
|
2019-05-01 12:55:34 +02:00
|
|
|
double a1, double a2, int *clippings, \
|
|
|
|
int disabled) \
|
2013-01-24 20:20:05 +03:00
|
|
|
{ \
|
|
|
|
const type *ibuf = input; \
|
|
|
|
type *obuf = output; \
|
|
|
|
double i1 = *in1; \
|
|
|
|
double i2 = *in2; \
|
|
|
|
double o1 = *out1; \
|
|
|
|
double o2 = *out2; \
|
2019-07-08 16:20:57 +02:00
|
|
|
double wet = s->mix; \
|
|
|
|
double dry = 1. - wet; \
|
|
|
|
double out; \
|
2013-01-24 20:20:05 +03:00
|
|
|
int i; \
|
2013-02-07 21:39:08 +03:00
|
|
|
a1 = -a1; \
|
|
|
|
a2 = -a2; \
|
2013-01-24 20:20:05 +03:00
|
|
|
\
|
2013-02-07 21:03:22 +03:00
|
|
|
for (i = 0; i+1 < len; i++) { \
|
2013-02-07 21:39:08 +03:00
|
|
|
o2 = i2 * b2 + i1 * b1 + ibuf[i] * b0 + o2 * a2 + o1 * a1; \
|
2013-02-07 21:03:22 +03:00
|
|
|
i2 = ibuf[i]; \
|
2019-07-08 16:20:57 +02:00
|
|
|
out = o2 * wet + i2 * dry; \
|
2019-05-01 12:55:34 +02:00
|
|
|
if (disabled) { \
|
|
|
|
obuf[i] = i2; \
|
2019-07-08 16:20:57 +02:00
|
|
|
} else if (need_clipping && out < min) { \
|
2018-05-01 15:26:20 +02:00
|
|
|
(*clippings)++; \
|
2013-02-07 21:03:22 +03:00
|
|
|
obuf[i] = min; \
|
2019-07-08 16:20:57 +02:00
|
|
|
} else if (need_clipping && out > max) { \
|
2018-05-01 15:26:20 +02:00
|
|
|
(*clippings)++; \
|
2013-02-07 21:03:22 +03:00
|
|
|
obuf[i] = max; \
|
|
|
|
} else { \
|
2019-07-08 16:20:57 +02:00
|
|
|
obuf[i] = out; \
|
2013-02-07 21:03:22 +03:00
|
|
|
} \
|
|
|
|
i++; \
|
2013-02-07 21:39:08 +03:00
|
|
|
o1 = i1 * b2 + i2 * b1 + ibuf[i] * b0 + o1 * a2 + o2 * a1; \
|
2013-02-07 21:03:22 +03:00
|
|
|
i1 = ibuf[i]; \
|
2019-07-08 16:20:57 +02:00
|
|
|
out = o1 * wet + i1 * dry; \
|
2019-05-01 12:55:34 +02:00
|
|
|
if (disabled) { \
|
|
|
|
obuf[i] = i1; \
|
2019-07-08 16:20:57 +02:00
|
|
|
} else if (need_clipping && out < min) { \
|
2018-05-01 15:26:20 +02:00
|
|
|
(*clippings)++; \
|
2013-02-07 21:03:22 +03:00
|
|
|
obuf[i] = min; \
|
2019-07-08 16:20:57 +02:00
|
|
|
} else if (need_clipping && out > max) { \
|
2018-05-01 15:26:20 +02:00
|
|
|
(*clippings)++; \
|
2013-02-07 21:03:22 +03:00
|
|
|
obuf[i] = max; \
|
|
|
|
} else { \
|
2019-07-08 16:20:57 +02:00
|
|
|
obuf[i] = out; \
|
2013-02-07 21:03:22 +03:00
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (i < len) { \
|
2013-02-07 21:39:08 +03:00
|
|
|
double o0 = ibuf[i] * b0 + i1 * b1 + i2 * b2 + o1 * a1 + o2 * a2; \
|
2013-01-24 20:20:05 +03:00
|
|
|
i2 = i1; \
|
|
|
|
i1 = ibuf[i]; \
|
|
|
|
o2 = o1; \
|
|
|
|
o1 = o0; \
|
2019-07-08 16:20:57 +02:00
|
|
|
out = o0 * wet + i1 * dry; \
|
2019-05-01 12:55:34 +02:00
|
|
|
if (disabled) { \
|
|
|
|
obuf[i] = i1; \
|
2019-07-08 16:20:57 +02:00
|
|
|
} else if (need_clipping && out < min) { \
|
2018-05-01 15:26:20 +02:00
|
|
|
(*clippings)++; \
|
2013-01-24 20:20:05 +03:00
|
|
|
obuf[i] = min; \
|
2019-07-08 16:20:57 +02:00
|
|
|
} else if (need_clipping && out > max) { \
|
2018-05-01 15:26:20 +02:00
|
|
|
(*clippings)++; \
|
2013-01-24 20:20:05 +03:00
|
|
|
obuf[i] = max; \
|
|
|
|
} else { \
|
2019-07-08 16:20:57 +02:00
|
|
|
obuf[i] = out; \
|
2013-01-24 20:20:05 +03:00
|
|
|
} \
|
|
|
|
} \
|
|
|
|
*in1 = i1; \
|
|
|
|
*in2 = i2; \
|
|
|
|
*out1 = o1; \
|
|
|
|
*out2 = o2; \
|
|
|
|
}
|
|
|
|
|
2014-07-17 06:49:04 +03:00
|
|
|
BIQUAD_FILTER(s16, int16_t, INT16_MIN, INT16_MAX, 1)
|
|
|
|
BIQUAD_FILTER(s32, int32_t, INT32_MIN, INT32_MAX, 1)
|
|
|
|
BIQUAD_FILTER(flt, float, -1., 1., 0)
|
|
|
|
BIQUAD_FILTER(dbl, double, -1., 1., 0)
|
2013-01-24 20:20:05 +03:00
|
|
|
|
2017-12-17 17:37:12 +02:00
|
|
|
static int config_filter(AVFilterLink *outlink, int reset)
|
2013-01-24 20:20:05 +03:00
|
|
|
{
|
|
|
|
AVFilterContext *ctx = outlink->src;
|
2015-01-28 16:30:27 +02:00
|
|
|
BiquadsContext *s = ctx->priv;
|
2013-01-24 20:20:05 +03:00
|
|
|
AVFilterLink *inlink = ctx->inputs[0];
|
2018-12-31 22:12:42 +02:00
|
|
|
double A = ff_exp10(s->gain / 40);
|
2015-01-28 16:30:27 +02:00
|
|
|
double w0 = 2 * M_PI * s->frequency / inlink->sample_rate;
|
2018-04-17 11:31:34 +02:00
|
|
|
double alpha, beta;
|
2013-01-24 20:20:05 +03:00
|
|
|
|
|
|
|
if (w0 > M_PI) {
|
|
|
|
av_log(ctx, AV_LOG_ERROR,
|
|
|
|
"Invalid frequency %f. Frequency must be less than half the sample-rate %d.\n",
|
2015-01-28 16:30:27 +02:00
|
|
|
s->frequency, inlink->sample_rate);
|
2013-01-24 20:20:05 +03:00
|
|
|
return AVERROR(EINVAL);
|
|
|
|
}
|
|
|
|
|
2015-01-28 16:30:27 +02:00
|
|
|
switch (s->width_type) {
|
2013-01-24 20:20:05 +03:00
|
|
|
case NONE:
|
|
|
|
alpha = 0.0;
|
|
|
|
break;
|
2013-06-30 14:32:59 +03:00
|
|
|
case HERTZ:
|
2015-01-28 16:30:27 +02:00
|
|
|
alpha = sin(w0) / (2 * s->frequency / s->width);
|
2013-01-24 20:20:05 +03:00
|
|
|
break;
|
2017-12-21 12:40:38 +02:00
|
|
|
case KHERTZ:
|
|
|
|
alpha = sin(w0) / (2 * s->frequency / (s->width * 1000));
|
|
|
|
break;
|
2013-01-24 20:20:05 +03:00
|
|
|
case OCTAVE:
|
2015-01-28 16:30:27 +02:00
|
|
|
alpha = sin(w0) * sinh(log(2.) / 2 * s->width * w0 / sin(w0));
|
2013-01-24 20:20:05 +03:00
|
|
|
break;
|
|
|
|
case QFACTOR:
|
2015-01-28 16:30:27 +02:00
|
|
|
alpha = sin(w0) / (2 * s->width);
|
2013-01-24 20:20:05 +03:00
|
|
|
break;
|
|
|
|
case SLOPE:
|
2015-01-28 16:30:27 +02:00
|
|
|
alpha = sin(w0) / 2 * sqrt((A + 1 / A) * (1 / s->width - 1) + 2);
|
2013-01-24 20:20:05 +03:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
av_assert0(0);
|
|
|
|
}
|
|
|
|
|
2018-04-17 11:31:34 +02:00
|
|
|
beta = 2 * sqrt(A);
|
|
|
|
|
2015-01-28 16:30:27 +02:00
|
|
|
switch (s->filter_type) {
|
2013-01-24 20:20:05 +03:00
|
|
|
case biquad:
|
|
|
|
break;
|
|
|
|
case equalizer:
|
2015-01-28 16:30:27 +02:00
|
|
|
s->a0 = 1 + alpha / A;
|
|
|
|
s->a1 = -2 * cos(w0);
|
|
|
|
s->a2 = 1 - alpha / A;
|
|
|
|
s->b0 = 1 + alpha * A;
|
|
|
|
s->b1 = -2 * cos(w0);
|
|
|
|
s->b2 = 1 - alpha * A;
|
2013-01-24 20:20:05 +03:00
|
|
|
break;
|
|
|
|
case bass:
|
2018-04-17 11:31:34 +02:00
|
|
|
beta = sqrt((A * A + 1) - (A - 1) * (A - 1));
|
|
|
|
case lowshelf:
|
|
|
|
s->a0 = (A + 1) + (A - 1) * cos(w0) + beta * alpha;
|
2015-01-28 16:30:27 +02:00
|
|
|
s->a1 = -2 * ((A - 1) + (A + 1) * cos(w0));
|
2018-04-17 11:31:34 +02:00
|
|
|
s->a2 = (A + 1) + (A - 1) * cos(w0) - beta * alpha;
|
|
|
|
s->b0 = A * ((A + 1) - (A - 1) * cos(w0) + beta * alpha);
|
2015-01-28 16:30:27 +02:00
|
|
|
s->b1 = 2 * A * ((A - 1) - (A + 1) * cos(w0));
|
2018-04-17 11:31:34 +02:00
|
|
|
s->b2 = A * ((A + 1) - (A - 1) * cos(w0) - beta * alpha);
|
2013-01-24 20:20:05 +03:00
|
|
|
break;
|
|
|
|
case treble:
|
2018-04-17 11:31:34 +02:00
|
|
|
beta = sqrt((A * A + 1) - (A - 1) * (A - 1));
|
|
|
|
case highshelf:
|
|
|
|
s->a0 = (A + 1) - (A - 1) * cos(w0) + beta * alpha;
|
2015-01-28 16:30:27 +02:00
|
|
|
s->a1 = 2 * ((A - 1) - (A + 1) * cos(w0));
|
2018-04-17 11:31:34 +02:00
|
|
|
s->a2 = (A + 1) - (A - 1) * cos(w0) - beta * alpha;
|
|
|
|
s->b0 = A * ((A + 1) + (A - 1) * cos(w0) + beta * alpha);
|
2015-01-28 16:30:27 +02:00
|
|
|
s->b1 =-2 * A * ((A - 1) + (A + 1) * cos(w0));
|
2018-04-17 11:31:34 +02:00
|
|
|
s->b2 = A * ((A + 1) + (A - 1) * cos(w0) - beta * alpha);
|
2013-01-24 20:20:05 +03:00
|
|
|
break;
|
|
|
|
case bandpass:
|
2015-01-28 16:30:27 +02:00
|
|
|
if (s->csg) {
|
|
|
|
s->a0 = 1 + alpha;
|
|
|
|
s->a1 = -2 * cos(w0);
|
|
|
|
s->a2 = 1 - alpha;
|
|
|
|
s->b0 = sin(w0) / 2;
|
|
|
|
s->b1 = 0;
|
|
|
|
s->b2 = -sin(w0) / 2;
|
2013-01-24 20:20:05 +03:00
|
|
|
} else {
|
2015-01-28 16:30:27 +02:00
|
|
|
s->a0 = 1 + alpha;
|
|
|
|
s->a1 = -2 * cos(w0);
|
|
|
|
s->a2 = 1 - alpha;
|
|
|
|
s->b0 = alpha;
|
|
|
|
s->b1 = 0;
|
|
|
|
s->b2 = -alpha;
|
2013-01-24 20:20:05 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case bandreject:
|
2015-01-28 16:30:27 +02:00
|
|
|
s->a0 = 1 + alpha;
|
|
|
|
s->a1 = -2 * cos(w0);
|
|
|
|
s->a2 = 1 - alpha;
|
|
|
|
s->b0 = 1;
|
|
|
|
s->b1 = -2 * cos(w0);
|
|
|
|
s->b2 = 1;
|
2013-01-24 20:20:05 +03:00
|
|
|
break;
|
|
|
|
case lowpass:
|
2015-01-28 16:30:27 +02:00
|
|
|
if (s->poles == 1) {
|
|
|
|
s->a0 = 1;
|
|
|
|
s->a1 = -exp(-w0);
|
|
|
|
s->a2 = 0;
|
|
|
|
s->b0 = 1 + s->a1;
|
|
|
|
s->b1 = 0;
|
|
|
|
s->b2 = 0;
|
2013-01-24 20:20:05 +03:00
|
|
|
} else {
|
2015-01-28 16:30:27 +02:00
|
|
|
s->a0 = 1 + alpha;
|
|
|
|
s->a1 = -2 * cos(w0);
|
|
|
|
s->a2 = 1 - alpha;
|
|
|
|
s->b0 = (1 - cos(w0)) / 2;
|
|
|
|
s->b1 = 1 - cos(w0);
|
|
|
|
s->b2 = (1 - cos(w0)) / 2;
|
2013-01-24 20:20:05 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case highpass:
|
2015-01-28 16:30:27 +02:00
|
|
|
if (s->poles == 1) {
|
|
|
|
s->a0 = 1;
|
|
|
|
s->a1 = -exp(-w0);
|
|
|
|
s->a2 = 0;
|
|
|
|
s->b0 = (1 - s->a1) / 2;
|
|
|
|
s->b1 = -s->b0;
|
|
|
|
s->b2 = 0;
|
2013-01-24 20:20:05 +03:00
|
|
|
} else {
|
2015-01-28 16:30:27 +02:00
|
|
|
s->a0 = 1 + alpha;
|
|
|
|
s->a1 = -2 * cos(w0);
|
|
|
|
s->a2 = 1 - alpha;
|
|
|
|
s->b0 = (1 + cos(w0)) / 2;
|
|
|
|
s->b1 = -(1 + cos(w0));
|
|
|
|
s->b2 = (1 + cos(w0)) / 2;
|
2013-01-24 20:20:05 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case allpass:
|
2015-01-28 16:30:27 +02:00
|
|
|
s->a0 = 1 + alpha;
|
|
|
|
s->a1 = -2 * cos(w0);
|
|
|
|
s->a2 = 1 - alpha;
|
|
|
|
s->b0 = 1 - alpha;
|
|
|
|
s->b1 = -2 * cos(w0);
|
|
|
|
s->b2 = 1 + alpha;
|
2013-01-24 20:20:05 +03:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
av_assert0(0);
|
|
|
|
}
|
|
|
|
|
2018-09-19 18:05:27 +02:00
|
|
|
av_log(ctx, AV_LOG_VERBOSE, "a=%f %f %f:b=%f %f %f\n", s->a0, s->a1, s->a2, s->b0, s->b1, s->b2);
|
2018-01-02 15:30:54 +02:00
|
|
|
|
2015-01-28 16:30:27 +02:00
|
|
|
s->a1 /= s->a0;
|
|
|
|
s->a2 /= s->a0;
|
|
|
|
s->b0 /= s->a0;
|
|
|
|
s->b1 /= s->a0;
|
|
|
|
s->b2 /= s->a0;
|
2018-01-06 15:58:00 +02:00
|
|
|
s->a0 /= s->a0;
|
2013-01-24 20:20:05 +03:00
|
|
|
|
2015-01-28 16:30:27 +02:00
|
|
|
s->cache = av_realloc_f(s->cache, sizeof(ChanCache), inlink->channels);
|
|
|
|
if (!s->cache)
|
2013-01-24 20:20:05 +03:00
|
|
|
return AVERROR(ENOMEM);
|
2017-12-17 17:37:12 +02:00
|
|
|
if (reset)
|
|
|
|
memset(s->cache, 0, sizeof(ChanCache) * inlink->channels);
|
2013-01-24 20:20:05 +03:00
|
|
|
|
|
|
|
switch (inlink->format) {
|
2015-01-28 16:30:27 +02:00
|
|
|
case AV_SAMPLE_FMT_S16P: s->filter = biquad_s16; break;
|
|
|
|
case AV_SAMPLE_FMT_S32P: s->filter = biquad_s32; break;
|
|
|
|
case AV_SAMPLE_FMT_FLTP: s->filter = biquad_flt; break;
|
|
|
|
case AV_SAMPLE_FMT_DBLP: s->filter = biquad_dbl; break;
|
2013-01-24 20:20:05 +03:00
|
|
|
default: av_assert0(0);
|
|
|
|
}
|
|
|
|
|
2017-04-25 18:08:26 +02:00
|
|
|
s->block_align = av_get_bytes_per_sample(inlink->format);
|
|
|
|
|
2013-01-24 20:20:05 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-12-17 17:37:12 +02:00
|
|
|
static int config_output(AVFilterLink *outlink)
|
|
|
|
{
|
|
|
|
return config_filter(outlink, 1);
|
|
|
|
}
|
|
|
|
|
2018-05-01 15:40:53 +02:00
|
|
|
typedef struct ThreadData {
|
|
|
|
AVFrame *in, *out;
|
|
|
|
} ThreadData;
|
|
|
|
|
|
|
|
static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
|
|
|
|
{
|
|
|
|
AVFilterLink *inlink = ctx->inputs[0];
|
|
|
|
ThreadData *td = arg;
|
|
|
|
AVFrame *buf = td->in;
|
|
|
|
AVFrame *out_buf = td->out;
|
|
|
|
BiquadsContext *s = ctx->priv;
|
|
|
|
const int start = (buf->channels * jobnr) / nb_jobs;
|
|
|
|
const int end = (buf->channels * (jobnr+1)) / nb_jobs;
|
|
|
|
int ch;
|
|
|
|
|
|
|
|
for (ch = start; ch < end; ch++) {
|
|
|
|
if (!((av_channel_layout_extract_channel(inlink->channel_layout, ch) & s->channels))) {
|
|
|
|
if (buf != out_buf)
|
|
|
|
memcpy(out_buf->extended_data[ch], buf->extended_data[ch],
|
|
|
|
buf->nb_samples * s->block_align);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
s->filter(s, buf->extended_data[ch], out_buf->extended_data[ch], buf->nb_samples,
|
|
|
|
&s->cache[ch].i1, &s->cache[ch].i2, &s->cache[ch].o1, &s->cache[ch].o2,
|
2019-05-01 12:55:34 +02:00
|
|
|
s->b0, s->b1, s->b2, s->a1, s->a2, &s->cache[ch].clippings, ctx->is_disabled);
|
2018-05-01 15:40:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-03-10 03:30:30 +03:00
|
|
|
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
|
2013-01-24 20:20:05 +03:00
|
|
|
{
|
2015-12-07 12:14:59 +02:00
|
|
|
AVFilterContext *ctx = inlink->dst;
|
|
|
|
BiquadsContext *s = ctx->priv;
|
|
|
|
AVFilterLink *outlink = ctx->outputs[0];
|
2013-03-10 03:30:30 +03:00
|
|
|
AVFrame *out_buf;
|
2018-05-01 15:40:53 +02:00
|
|
|
ThreadData td;
|
2013-01-24 20:20:05 +03:00
|
|
|
int ch;
|
|
|
|
|
2013-03-10 03:30:30 +03:00
|
|
|
if (av_frame_is_writable(buf)) {
|
2013-01-24 20:20:05 +03:00
|
|
|
out_buf = buf;
|
|
|
|
} else {
|
2018-05-01 15:40:53 +02:00
|
|
|
out_buf = ff_get_audio_buffer(outlink, buf->nb_samples);
|
2015-11-25 22:59:33 +02:00
|
|
|
if (!out_buf) {
|
|
|
|
av_frame_free(&buf);
|
2013-01-24 20:20:05 +03:00
|
|
|
return AVERROR(ENOMEM);
|
2015-11-25 22:59:33 +02:00
|
|
|
}
|
2013-04-03 14:10:00 +03:00
|
|
|
av_frame_copy_props(out_buf, buf);
|
2013-01-24 20:20:05 +03:00
|
|
|
}
|
|
|
|
|
2018-05-01 15:40:53 +02:00
|
|
|
td.in = buf;
|
|
|
|
td.out = out_buf;
|
|
|
|
ctx->internal->execute(ctx, filter_channel, &td, NULL, FFMIN(outlink->channels, ff_filter_get_nb_threads(ctx)));
|
2013-01-24 20:20:05 +03:00
|
|
|
|
2018-05-01 15:26:20 +02:00
|
|
|
for (ch = 0; ch < outlink->channels; ch++) {
|
|
|
|
if (s->cache[ch].clippings > 0)
|
|
|
|
av_log(ctx, AV_LOG_WARNING, "Channel %d clipping %d times. Please reduce gain.\n",
|
|
|
|
ch, s->cache[ch].clippings);
|
|
|
|
s->cache[ch].clippings = 0;
|
|
|
|
}
|
2015-12-23 20:15:25 +02:00
|
|
|
|
2013-01-24 20:20:05 +03:00
|
|
|
if (buf != out_buf)
|
2013-03-10 03:30:30 +03:00
|
|
|
av_frame_free(&buf);
|
2013-01-24 20:20:05 +03:00
|
|
|
|
|
|
|
return ff_filter_frame(outlink, out_buf);
|
|
|
|
}
|
|
|
|
|
2017-12-17 17:37:12 +02:00
|
|
|
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
|
|
|
|
char *res, int res_len, int flags)
|
|
|
|
{
|
|
|
|
AVFilterLink *outlink = ctx->outputs[0];
|
2019-10-09 11:15:56 +02:00
|
|
|
int ret;
|
2017-12-17 17:37:12 +02:00
|
|
|
|
2019-10-09 11:15:56 +02:00
|
|
|
ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2017-12-17 17:37:12 +02:00
|
|
|
|
|
|
|
return config_filter(outlink, 0);
|
|
|
|
}
|
|
|
|
|
2013-01-24 20:20:05 +03:00
|
|
|
static av_cold void uninit(AVFilterContext *ctx)
|
|
|
|
{
|
2015-01-28 16:30:27 +02:00
|
|
|
BiquadsContext *s = ctx->priv;
|
2013-01-24 20:20:05 +03:00
|
|
|
|
2015-01-28 16:30:27 +02:00
|
|
|
av_freep(&s->cache);
|
2013-01-24 20:20:05 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static const AVFilterPad inputs[] = {
|
|
|
|
{
|
|
|
|
.name = "default",
|
|
|
|
.type = AVMEDIA_TYPE_AUDIO,
|
|
|
|
.filter_frame = filter_frame,
|
|
|
|
},
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const AVFilterPad outputs[] = {
|
|
|
|
{
|
|
|
|
.name = "default",
|
|
|
|
.type = AVMEDIA_TYPE_AUDIO,
|
|
|
|
.config_props = config_output,
|
|
|
|
},
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
#define OFFSET(x) offsetof(BiquadsContext, x)
|
2019-10-09 11:15:56 +02:00
|
|
|
#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
|
|
|
|
#define AF AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
|
2013-01-24 20:20:05 +03:00
|
|
|
|
|
|
|
#define DEFINE_BIQUAD_FILTER(name_, description_) \
|
|
|
|
AVFILTER_DEFINE_CLASS(name_); \
|
2013-04-12 12:13:33 +03:00
|
|
|
static av_cold int name_##_init(AVFilterContext *ctx) \
|
2013-01-24 20:20:05 +03:00
|
|
|
{ \
|
2015-01-28 16:30:27 +02:00
|
|
|
BiquadsContext *s = ctx->priv; \
|
|
|
|
s->class = &name_##_class; \
|
|
|
|
s->filter_type = name_; \
|
2013-04-12 12:13:33 +03:00
|
|
|
return init(ctx); \
|
2013-01-24 20:20:05 +03:00
|
|
|
} \
|
|
|
|
\
|
2013-10-29 13:50:56 +03:00
|
|
|
AVFilter ff_af_##name_ = { \
|
2013-01-24 20:20:05 +03:00
|
|
|
.name = #name_, \
|
|
|
|
.description = NULL_IF_CONFIG_SMALL(description_), \
|
|
|
|
.priv_size = sizeof(BiquadsContext), \
|
|
|
|
.init = name_##_init, \
|
|
|
|
.uninit = uninit, \
|
|
|
|
.query_formats = query_formats, \
|
|
|
|
.inputs = inputs, \
|
|
|
|
.outputs = outputs, \
|
|
|
|
.priv_class = &name_##_class, \
|
2017-12-17 17:37:12 +02:00
|
|
|
.process_command = process_command, \
|
2019-05-01 12:55:34 +02:00
|
|
|
.flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, \
|
2013-01-24 20:20:05 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#if CONFIG_EQUALIZER_FILTER
|
|
|
|
static const AVOption equalizer_options[] = {
|
|
|
|
{"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 999999, FLAGS},
|
|
|
|
{"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 999999, FLAGS},
|
2017-12-21 12:40:38 +02:00
|
|
|
{"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
|
|
|
{"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
2013-06-30 14:32:59 +03:00
|
|
|
{"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
|
2013-01-24 20:20:05 +03:00
|
|
|
{"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
|
2017-12-21 12:40:38 +02:00
|
|
|
{"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
|
2017-12-21 12:44:22 +02:00
|
|
|
{"width", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 99999, FLAGS},
|
|
|
|
{"w", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 99999, FLAGS},
|
2013-01-24 20:20:05 +03:00
|
|
|
{"gain", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
|
|
|
|
{"g", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
|
2019-07-08 16:20:57 +02:00
|
|
|
{"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
|
|
|
{"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
2017-04-25 18:08:26 +02:00
|
|
|
{"channels", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
|
|
|
{"c", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
2013-09-07 15:13:50 +03:00
|
|
|
{NULL}
|
2013-01-24 20:20:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
DEFINE_BIQUAD_FILTER(equalizer, "Apply two-pole peaking equalization (EQ) filter.");
|
|
|
|
#endif /* CONFIG_EQUALIZER_FILTER */
|
|
|
|
#if CONFIG_BASS_FILTER
|
|
|
|
static const AVOption bass_options[] = {
|
|
|
|
{"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=100}, 0, 999999, FLAGS},
|
|
|
|
{"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=100}, 0, 999999, FLAGS},
|
2017-12-21 12:40:38 +02:00
|
|
|
{"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
|
|
|
{"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
2013-06-30 14:32:59 +03:00
|
|
|
{"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
|
2013-01-24 20:20:05 +03:00
|
|
|
{"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
|
2017-12-21 12:40:38 +02:00
|
|
|
{"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
|
2013-01-24 20:20:05 +03:00
|
|
|
{"width", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
|
|
|
|
{"w", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
|
|
|
|
{"gain", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
|
|
|
|
{"g", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
|
2019-07-08 16:20:57 +02:00
|
|
|
{"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
|
|
|
{"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
2017-04-25 18:08:26 +02:00
|
|
|
{"channels", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
|
|
|
{"c", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
2013-09-07 15:13:50 +03:00
|
|
|
{NULL}
|
2013-01-24 20:20:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
DEFINE_BIQUAD_FILTER(bass, "Boost or cut lower frequencies.");
|
|
|
|
#endif /* CONFIG_BASS_FILTER */
|
|
|
|
#if CONFIG_TREBLE_FILTER
|
|
|
|
static const AVOption treble_options[] = {
|
|
|
|
{"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
|
|
|
|
{"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
|
2017-12-21 12:40:38 +02:00
|
|
|
{"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
|
|
|
{"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
2013-06-30 14:32:59 +03:00
|
|
|
{"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
|
2013-01-24 20:20:05 +03:00
|
|
|
{"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
|
2017-12-21 12:40:38 +02:00
|
|
|
{"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
|
2013-01-24 20:20:05 +03:00
|
|
|
{"width", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
|
|
|
|
{"w", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
|
|
|
|
{"gain", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
|
|
|
|
{"g", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
|
2019-07-08 16:20:57 +02:00
|
|
|
{"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
|
|
|
{"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
2017-04-25 18:08:26 +02:00
|
|
|
{"channels", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
|
|
|
{"c", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
2013-09-07 15:13:50 +03:00
|
|
|
{NULL}
|
2013-01-24 20:20:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
DEFINE_BIQUAD_FILTER(treble, "Boost or cut upper frequencies.");
|
|
|
|
#endif /* CONFIG_TREBLE_FILTER */
|
|
|
|
#if CONFIG_BANDPASS_FILTER
|
|
|
|
static const AVOption bandpass_options[] = {
|
|
|
|
{"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
|
|
|
|
{"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
|
2017-12-21 12:40:38 +02:00
|
|
|
{"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
|
|
|
{"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
2013-06-30 14:32:59 +03:00
|
|
|
{"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
|
2013-01-24 20:20:05 +03:00
|
|
|
{"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
|
2017-12-21 12:40:38 +02:00
|
|
|
{"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"width", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
|
|
|
|
{"w", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
|
2015-09-11 21:17:05 +02:00
|
|
|
{"csg", "use constant skirt gain", OFFSET(csg), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
|
2019-07-08 16:20:57 +02:00
|
|
|
{"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
|
|
|
{"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
2017-04-25 18:08:26 +02:00
|
|
|
{"channels", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
|
|
|
{"c", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
2013-09-07 15:13:50 +03:00
|
|
|
{NULL}
|
2013-01-24 20:20:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
DEFINE_BIQUAD_FILTER(bandpass, "Apply a two-pole Butterworth band-pass filter.");
|
|
|
|
#endif /* CONFIG_BANDPASS_FILTER */
|
|
|
|
#if CONFIG_BANDREJECT_FILTER
|
|
|
|
static const AVOption bandreject_options[] = {
|
|
|
|
{"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
|
|
|
|
{"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
|
2017-12-21 12:40:38 +02:00
|
|
|
{"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
|
|
|
{"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
2013-06-30 14:32:59 +03:00
|
|
|
{"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
|
2013-01-24 20:20:05 +03:00
|
|
|
{"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
|
2017-12-21 12:40:38 +02:00
|
|
|
{"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
|
2017-12-21 12:44:22 +02:00
|
|
|
{"width", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
|
|
|
|
{"w", "set band-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
|
2019-07-08 16:20:57 +02:00
|
|
|
{"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
|
|
|
{"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
2017-04-25 18:08:26 +02:00
|
|
|
{"channels", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
|
|
|
{"c", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
2013-09-07 15:13:50 +03:00
|
|
|
{NULL}
|
2013-01-24 20:20:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
DEFINE_BIQUAD_FILTER(bandreject, "Apply a two-pole Butterworth band-reject filter.");
|
|
|
|
#endif /* CONFIG_BANDREJECT_FILTER */
|
|
|
|
#if CONFIG_LOWPASS_FILTER
|
|
|
|
static const AVOption lowpass_options[] = {
|
|
|
|
{"frequency", "set frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=500}, 0, 999999, FLAGS},
|
|
|
|
{"f", "set frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=500}, 0, 999999, FLAGS},
|
2017-12-21 12:40:38 +02:00
|
|
|
{"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
|
|
|
{"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
2013-06-30 14:32:59 +03:00
|
|
|
{"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
|
2013-01-24 20:20:05 +03:00
|
|
|
{"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
|
2017-12-21 12:40:38 +02:00
|
|
|
{"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
|
2013-01-24 20:20:05 +03:00
|
|
|
{"width", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.707}, 0, 99999, FLAGS},
|
|
|
|
{"w", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.707}, 0, 99999, FLAGS},
|
2019-10-09 11:15:56 +02:00
|
|
|
{"poles", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, AF},
|
|
|
|
{"p", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, AF},
|
2019-07-08 16:20:57 +02:00
|
|
|
{"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
|
|
|
{"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
2017-04-25 18:08:26 +02:00
|
|
|
{"channels", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
|
|
|
{"c", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
2013-09-07 15:13:50 +03:00
|
|
|
{NULL}
|
2013-01-24 20:20:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
DEFINE_BIQUAD_FILTER(lowpass, "Apply a low-pass filter with 3dB point frequency.");
|
|
|
|
#endif /* CONFIG_LOWPASS_FILTER */
|
|
|
|
#if CONFIG_HIGHPASS_FILTER
|
|
|
|
static const AVOption highpass_options[] = {
|
|
|
|
{"frequency", "set frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
|
|
|
|
{"f", "set frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
|
2017-12-21 12:40:38 +02:00
|
|
|
{"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
|
|
|
{"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
2013-06-30 14:32:59 +03:00
|
|
|
{"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
|
2013-01-24 20:20:05 +03:00
|
|
|
{"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
|
2017-12-21 12:40:38 +02:00
|
|
|
{"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
|
2013-01-24 20:20:05 +03:00
|
|
|
{"width", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.707}, 0, 99999, FLAGS},
|
|
|
|
{"w", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.707}, 0, 99999, FLAGS},
|
2019-10-09 11:15:56 +02:00
|
|
|
{"poles", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, AF},
|
|
|
|
{"p", "set number of poles", OFFSET(poles), AV_OPT_TYPE_INT, {.i64=2}, 1, 2, AF},
|
2019-07-08 16:20:57 +02:00
|
|
|
{"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
|
|
|
{"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
2017-04-25 18:08:26 +02:00
|
|
|
{"channels", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
|
|
|
{"c", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
2013-09-07 15:13:50 +03:00
|
|
|
{NULL}
|
2013-01-24 20:20:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
DEFINE_BIQUAD_FILTER(highpass, "Apply a high-pass filter with 3dB point frequency.");
|
|
|
|
#endif /* CONFIG_HIGHPASS_FILTER */
|
|
|
|
#if CONFIG_ALLPASS_FILTER
|
|
|
|
static const AVOption allpass_options[] = {
|
|
|
|
{"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
|
|
|
|
{"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
|
2017-12-21 12:40:38 +02:00
|
|
|
{"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=HERTZ}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
|
|
|
{"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=HERTZ}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
2013-06-30 14:32:59 +03:00
|
|
|
{"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
|
2013-01-24 20:20:05 +03:00
|
|
|
{"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
|
2017-12-21 12:40:38 +02:00
|
|
|
{"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
|
2013-01-24 20:20:05 +03:00
|
|
|
{"width", "set filter-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=707.1}, 0, 99999, FLAGS},
|
|
|
|
{"w", "set filter-width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=707.1}, 0, 99999, FLAGS},
|
2019-07-08 16:20:57 +02:00
|
|
|
{"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
|
|
|
{"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
2017-04-25 18:08:26 +02:00
|
|
|
{"channels", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
|
|
|
{"c", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
2013-09-07 15:13:50 +03:00
|
|
|
{NULL}
|
2013-01-24 20:20:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
DEFINE_BIQUAD_FILTER(allpass, "Apply a two-pole all-pass filter.");
|
|
|
|
#endif /* CONFIG_ALLPASS_FILTER */
|
2018-04-17 11:31:34 +02:00
|
|
|
#if CONFIG_LOWSHELF_FILTER
|
|
|
|
static const AVOption lowshelf_options[] = {
|
|
|
|
{"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=100}, 0, 999999, FLAGS},
|
|
|
|
{"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=100}, 0, 999999, FLAGS},
|
|
|
|
{"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
|
|
|
{"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
|
|
|
{"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"width", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
|
|
|
|
{"w", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
|
|
|
|
{"gain", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
|
|
|
|
{"g", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
|
2019-07-08 16:20:57 +02:00
|
|
|
{"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
|
|
|
{"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
2018-04-17 11:31:34 +02:00
|
|
|
{"channels", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
|
|
|
{"c", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
|
|
|
{NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
DEFINE_BIQUAD_FILTER(lowshelf, "Apply a low shelf filter.");
|
|
|
|
#endif /* CONFIG_LOWSHELF_FILTER */
|
|
|
|
#if CONFIG_HIGHSHELF_FILTER
|
|
|
|
static const AVOption highshelf_options[] = {
|
|
|
|
{"frequency", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
|
|
|
|
{"f", "set central frequency", OFFSET(frequency), AV_OPT_TYPE_DOUBLE, {.dbl=3000}, 0, 999999, FLAGS},
|
|
|
|
{"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
|
|
|
{"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=QFACTOR}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"},
|
|
|
|
{"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"},
|
|
|
|
{"width", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
|
|
|
|
{"w", "set shelf transition steep", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 99999, FLAGS},
|
|
|
|
{"gain", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
|
|
|
|
{"g", "set gain", OFFSET(gain), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -900, 900, FLAGS},
|
2019-07-08 16:20:57 +02:00
|
|
|
{"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
|
|
|
{"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
2018-04-17 11:31:34 +02:00
|
|
|
{"channels", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
|
|
|
{"c", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
|
|
|
{NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
DEFINE_BIQUAD_FILTER(highshelf, "Apply a high shelf filter.");
|
|
|
|
#endif /* CONFIG_HIGHSHELF_FILTER */
|
2013-01-24 20:20:05 +03:00
|
|
|
#if CONFIG_BIQUAD_FILTER
|
|
|
|
static const AVOption biquad_options[] = {
|
2017-12-21 12:44:22 +02:00
|
|
|
{"a0", NULL, OFFSET(a0), AV_OPT_TYPE_DOUBLE, {.dbl=1}, INT32_MIN, INT32_MAX, FLAGS},
|
2017-12-21 13:06:21 +02:00
|
|
|
{"a1", NULL, OFFSET(a1), AV_OPT_TYPE_DOUBLE, {.dbl=0}, INT32_MIN, INT32_MAX, FLAGS},
|
|
|
|
{"a2", NULL, OFFSET(a2), AV_OPT_TYPE_DOUBLE, {.dbl=0}, INT32_MIN, INT32_MAX, FLAGS},
|
|
|
|
{"b0", NULL, OFFSET(b0), AV_OPT_TYPE_DOUBLE, {.dbl=0}, INT32_MIN, INT32_MAX, FLAGS},
|
|
|
|
{"b1", NULL, OFFSET(b1), AV_OPT_TYPE_DOUBLE, {.dbl=0}, INT32_MIN, INT32_MAX, FLAGS},
|
|
|
|
{"b2", NULL, OFFSET(b2), AV_OPT_TYPE_DOUBLE, {.dbl=0}, INT32_MIN, INT32_MAX, FLAGS},
|
2019-07-08 16:20:57 +02:00
|
|
|
{"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
|
|
|
{"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS},
|
2017-04-25 18:08:26 +02:00
|
|
|
{"channels", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
|
|
|
{"c", "set channels to filter", OFFSET(channels), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64=-1}, INT64_MIN, INT64_MAX, FLAGS},
|
2013-09-07 15:13:50 +03:00
|
|
|
{NULL}
|
2013-01-24 20:20:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
DEFINE_BIQUAD_FILTER(biquad, "Apply a biquad IIR filter with the given coefficients.");
|
|
|
|
#endif /* CONFIG_BIQUAD_FILTER */
|