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
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 .
name =
"virtualbass",
178 .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.
#define FILTER_INPUTS(array)
This structure describes decoded (raw) audio or video data.
AVFILTER_DEFINE_CLASS(virtualbass)
const char * name
Filter name.
A link between two filters.
static double b1(void *priv, double x, double y)
#define AV_CHANNEL_LAYOUT_2POINT1
static double a2(void *priv, double x, double y)
A filter pad used for either input or output.
static const AVFilterPad inputs[]
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
#define FILTER_OUTPUTS(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 int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
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 double a0(void *priv, double x, double y)
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.
AVSampleFormat
Audio sample formats.
#define FILTER_QUERY_FUNC2(func)
const char * name
Pad name.
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
@ AV_SAMPLE_FMT_DBLP
double, planar
static const uint16_t channel_layouts[7]
#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 double a1(void *priv, double x, double y)
static const AVOption virtualbass_options[]