Go to the documentation of this file.
51 double w0 = 2 *
M_PI *
s->cutoff /
inlink->sample_rate;
52 double alpha = sin(w0) / 2 * sqrt(2. * (1. /
s->slope - 1.) + 2.);
57 s->b0 = (1 - cos(w0)) / 2;
59 s->b2 = (1 - cos(w0)) / 2;
67 s->buffer_samples =
inlink->sample_rate *
s->delay / 1000;
80 if (!
s->buffer || !
s->w || !
s->write_pos)
96 const double mix =
ctx->is_disabled ? 0. : 1.;
97 const double wet =
ctx->is_disabled ? 1. :
s->wet_gain;
98 const double dry =
ctx->is_disabled ? 1. :
s->dry_gain;
99 const double feedback =
s->feedback, decay =
s->decay;
100 const double b0 =
s->b0;
101 const double b1 =
s->b1;
102 const double b2 =
s->b2;
103 const double a1 = -
s->a1;
104 const double a2 = -
s->a2;
105 const int start = (in->
channels * jobnr) / nb_jobs;
106 const int end = (in->
channels * (jobnr+1)) / nb_jobs;
107 const int buffer_samples =
s->buffer_samples;
109 for (
int ch = start; ch < end; ch++) {
111 double *dst = (
double *)
out->extended_data[ch];
112 double *
buffer = (
double *)
s->buffer->extended_data[ch];
113 double *
w = (
double *)
s->w->extended_data[ch];
114 int write_pos =
s->write_pos[ch];
119 out_sample =
src[n] *
b0 +
w[0];
120 w[0] =
b1 *
src[n] +
w[1] +
a1 * out_sample;
121 w[1] =
b2 *
src[n] +
a2 * out_sample;
123 buffer[write_pos] =
buffer[write_pos] * decay + out_sample * feedback;
124 dst[n] = (
src[n] * dry +
buffer[write_pos] *
mix) * wet;
126 if (++write_pos >= buffer_samples)
130 s->write_pos[ch] = write_pos;
173 char *res,
int res_len,
int flags)
184 #define OFFSET(x) offsetof(ASubBoostContext, x)
185 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
220 .priv_class = &asubboost_class,
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
static int mix(int c0, int c1)
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
static const AVFilterPad inputs[]
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
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
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.
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
const char * name
Filter name.
A link between two filters.
static double b1(void *priv, double x, double y)
static int config_input(AVFilterLink *inlink)
static const AVFilterPad outputs[]
A filter pad used for either input or output.
AVFILTER_DEFINE_CLASS(asubboost)
int channels
number of audio channels, only used for audio.
#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 int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int get_coeffs(AVFilterContext *ctx)
static const AVOption asubboost_options[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
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 b2(void *priv, double x, double y)
int nb_samples
number of audio samples (per channel) described by this frame
uint8_t ** extended_data
pointers to the data planes/channels.
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Used for passing data between threads.
const AVFilter ff_af_asubboost
const char * name
Pad name.
void * av_calloc(size_t nmemb, size_t size)
static int filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static av_cold void uninit(AVFilterContext *ctx)
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
@ AV_SAMPLE_FMT_DBLP
double, planar
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
static const int16_t alpha[]
#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...
#define flags(name, subs,...)
static double b0(void *priv, double x, double y)
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)