Go to the documentation of this file.
40 #define OFFSET(x) offsetof(AudioVirtualBassContext, x)
41 #define TFLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_RUNTIME_PARAM
42 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
73 const double Q = 0.707;
78 s->a[0] = 1. / (1. +
g * (
g + k));
79 s->a[1] =
g *
s->a[0];
80 s->a[2] =
g *
s->a[1];
88 #define SQR(x) ((x) * (x))
92 double y = 2.5 * atan(0.9 * x) + 2.5 * sqrt(1. -
SQR(0.9 * x)) - 2.5;
94 return y < 0. ? sin(y) : y;
102 double *ldst = (
double *)
out->extended_data[0];
103 double *rdst = (
double *)
out->extended_data[1];
104 double *lfe = (
double *)
out->extended_data[2];
105 const double st =
M_PI /
s->strength;
106 const double a0 =
s->a[0];
107 const double a1 =
s->a[1];
108 const double a2 =
s->a[2];
109 const double m0 =
s->m[0];
110 const double m1 =
s->m[1];
111 const double m2 =
s->m[2];
112 double b0 =
s->cf[0];
113 double b1 =
s->cf[1];
115 memcpy(ldst, lsrc, in->
nb_samples *
sizeof(
double));
116 memcpy(rdst, rsrc, in->
nb_samples *
sizeof(
double));
119 const double center = (lsrc[n] + rsrc[n]) * 0.5;
120 const double v0 = center;
121 const double v3 =
v0 -
b1;
122 const double v1 =
a0 *
b0 +
a1 * v3;
123 const double v2 =
b1 +
a1 *
b0 +
a2 * v3;
129 b = m0 *
v0 + m1 * v1 + m2 * v2;
168 .
name =
"virtualbass",
171 .priv_class = &virtualbass_class,
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
A list of supported channel layouts.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
#define AV_CHANNEL_LAYOUT_STEREO
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
const AVFilter ff_af_virtualbass
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
AVFILTER_DEFINE_CLASS(virtualbass)
#define FILTER_QUERY_FUNC(func)
static int query_formats(AVFilterContext *ctx)
const char * name
Filter name.
A link between two filters.
static double b1(void *priv, double x, double y)
#define AV_CHANNEL_LAYOUT_2POINT1
A filter pad used for either input or output.
static const AVFilterPad inputs[]
#define FILTER_INPUTS(array)
Describe the class of an AVClass context structure.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
static void vb_stereo(AVFilterContext *ctx, AVFrame *out, AVFrame *in)
static double vb_fun(double x)
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
#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.
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.
static int config_input(AVFilterLink *inlink)
int nb_samples
number of audio samples (per channel) described by this frame
uint8_t ** extended_data
pointers to the data planes/channels.
const char * name
Pad name.
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
@ AV_SAMPLE_FMT_DBLP
double, planar
#define FILTER_OUTPUTS(array)
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
static double b0(void *priv, double x, double y)
static const AVOption virtualbass_options[]