Go to the documentation of this file.
55 double w0 = 2 *
M_PI *
s->cutoff /
inlink->sample_rate;
56 double alpha = sin(w0) / 2 * sqrt(2. * (1. /
s->slope - 1.) + 2.);
61 s->b0 = (1 - cos(w0)) / 2;
63 s->b2 = (1 - cos(w0)) / 2;
71 s->buffer_samples =
inlink->sample_rate *
s->delay / 1000;
84 if (!
s->buffer || !
s->w || !
s->write_pos)
100 const double mix =
ctx->is_disabled ? 0. : 1.;
101 const double wet =
ctx->is_disabled ? 1. :
s->wet_gain;
102 const double dry =
ctx->is_disabled ? 1. :
s->dry_gain;
103 const double feedback =
s->feedback, decay =
s->decay;
104 const double max_boost =
s->max_boost;
105 const double b0 =
s->b0;
106 const double b1 =
s->b1;
107 const double b2 =
s->b2;
108 const double a1 = -
s->a1;
109 const double a2 = -
s->a2;
112 const int buffer_samples =
s->buffer_samples;
114 for (
int ch = start; ch < end; ch++) {
116 double *dst = (
double *)
out->extended_data[ch];
117 double *
buffer = (
double *)
s->buffer->extended_data[ch];
118 double *
w = (
double *)
s->w->extended_data[ch];
119 int write_pos =
s->write_pos[ch];
122 const double a = 0.00001;
123 const double b = 1. -
a;
133 double out_sample, boost;
135 out_sample =
src[n] *
b0 +
w[0];
136 w[0] =
b1 *
src[n] +
w[1] +
a1 * out_sample;
137 w[1] =
b2 *
src[n] +
a2 * out_sample;
139 buffer[write_pos] =
buffer[write_pos] * decay + out_sample * feedback;
141 w[2] = boost >
w[2] ?
w[2] *
b +
a * boost :
w[2] *
a +
b * boost;
143 dst[n] = (
src[n] * dry +
w[2] *
buffer[write_pos] *
mix) * wet;
145 if (++write_pos >= buffer_samples)
149 s->write_pos[ch] = write_pos;
167 if (strcmp(
s->ch_layout_str,
"all"))
202 char *res,
int res_len,
int flags)
213 #define OFFSET(x) offsetof(ASubBoostContext, x)
214 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
251 .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.
int nb_channels
Number of channels in this layout.
A link between two filters.
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
static double b1(void *priv, double x, double y)
static int config_input(AVFilterLink *inlink)
AVChannelLayout ch_layout
Channel layout of the audio data.
static const AVFilterPad outputs[]
A filter pad used for either input or output.
AVFILTER_DEFINE_CLASS(asubboost)
#define FILTER_INPUTS(array)
Describe the class of an AVClass context structure.
static __device__ float fabs(float a)
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)
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
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.
An AVChannelLayout holds information about the channel layout of audio data.
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)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
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.
int av_channel_layout_index_from_channel(const AVChannelLayout *channel_layout, enum AVChannel channel)
Get the index of a given channel in a channel layout.
AVChannelLayout ch_layout
void * av_calloc(size_t nmemb, size_t size)
enum AVChannel av_channel_layout_channel_from_index(const AVChannelLayout *channel_layout, unsigned int idx)
Get the channel with the given index in a channel layout.
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
int av_channel_layout_from_string(AVChannelLayout *channel_layout, const char *str)
Initialize a channel layout from a given string description.
@ 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)