Go to the documentation of this file.
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
72 const double Q = 0.707;
77 s->a[0] = 1. / (1. +
g * (
g + k));
78 s->a[1] =
g *
s->a[0];
79 s->a[2] =
g *
s->a[1];
87 #define SQR(x) ((x) * (x))
91 double y = 2.5 * atan(0.9 * x) + 2.5 * sqrt(1. -
SQR(0.9 * x)) - 2.5;
93 return y < 0. ? sin(y) : y;
101 double *ldst = (
double *)
out->extended_data[0];
102 double *rdst = (
double *)
out->extended_data[1];
103 double *lfe = (
double *)
out->extended_data[2];
104 const double st =
M_PI /
s->strength;
105 const double a0 =
s->a[0];
106 const double a1 =
s->a[1];
107 const double a2 =
s->a[2];
108 const double m0 =
s->m[0];
109 const double m1 =
s->m[1];
110 const double m2 =
s->m[2];
111 double b0 =
s->cf[0];
112 double b1 =
s->cf[1];
114 memcpy(ldst, lsrc, in->
nb_samples *
sizeof(
double));
115 memcpy(rdst, rsrc, in->
nb_samples *
sizeof(
double));
118 const double center = (lsrc[n] + rsrc[n]) * 0.5;
119 const double v0 = center;
120 const double v3 =
v0 -
b1;
121 const double v1 =
a0 *
b0 +
a1 * v3;
122 const double v2 =
b1 +
a1 *
b0 +
a2 * v3;
128 b = m0 *
v0 + m1 * v1 + m2 * v2;
174 .
name =
"virtualbass",
177 .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)
static const AVFilterPad outputs[]
#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[]