39#define OFFSET(x) offsetof(AudioVirtualBassContext, x)
40#define TFLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_RUNTIME_PARAM
41#define FLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
80 const double Q = 0.707;
85 s->a[0] = 1. / (1. +
g * (
g + k));
86 s->a[1] =
g *
s->a[0];
87 s->a[2] =
g *
s->a[1];
95#define SQR(x) ((x) * (x))
99 double y = 2.5 * atan(0.9 * x) + 2.5 * sqrt(1. -
SQR(0.9 * x)) - 2.5;
101 return y < 0. ? sin(y) : y;
109 double *ldst = (
double *)
out->extended_data[0];
110 double *rdst = (
double *)
out->extended_data[1];
111 double *lfe = (
double *)
out->extended_data[2];
112 const double st =
M_PI /
s->strength;
113 const double a0 =
s->a[0];
114 const double a1 =
s->a[1];
115 const double a2 =
s->a[2];
116 const double m0 =
s->m[0];
117 const double m1 =
s->m[1];
118 const double m2 =
s->m[2];
119 double b0 =
s->cf[0];
120 double b1 =
s->cf[1];
122 memcpy(ldst, lsrc, in->
nb_samples *
sizeof(
double));
123 memcpy(rdst, rsrc, in->
nb_samples *
sizeof(
double));
126 const double center = (lsrc[n] + rsrc[n]) * 0.5;
127 const double v0 = center;
128 const double v3 = v0 -
b1;
129 const double v1 =
a0 *
b0 +
a1 * v3;
130 const double v2 =
b1 +
a1 *
b0 +
a2 * v3;
136 b = m0 * v0 + m1 * v1 + m2 * v2;
175 .p.name =
"virtualbass",
177 .p.priv_class = &virtualbass_class,
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static const AVFilterPad inputs[]
static int config_input(AVFilterLink *inlink)
static void vb_stereo(AVFilterContext *ctx, AVFrame *out, AVFrame *in)
const FFFilter ff_af_virtualbass
static int config_input(AVFilterLink *inlink)
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static double vb_fun(double x)
static const AVOption virtualbass_options[]
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
Main libavfilter public API header.
Public libavutil channel layout APIs header.
static const uint16_t channel_layouts[7]
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
#define AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_2POINT1
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
AVSampleFormat
Audio sample formats.
@ AV_SAMPLE_FMT_DBLP
double, planar
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define AVFILTER_DEFINE_CLASS(fname)
#define FILTER_QUERY_FUNC2(func)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
An AVChannelLayout holds information about the channel layout of audio data.
Describe the class of an AVClass context structure.
A list of supported channel layouts.
A link between two filters.
int sample_rate
samples per second
AVFilterContext * dst
dest filter
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
int nb_samples
number of audio samples (per channel) described by this frame
uint8_t ** extended_data
pointers to the data planes/channels.
static AVFormatContext * ctx
static double b1(void *priv, double x, double y)
static double a0(void *priv, double x, double y)
static double b0(void *priv, double x, double y)
static double a2(void *priv, double x, double y)
static double a1(void *priv, double x, double y)