57 double alpha = sin(w0) / 2 * sqrt(2. * (1. /
s->slope - 1.) + 2.);
62 s->b0 = (1 - cos(w0)) / 2;
64 s->b2 = (1 - cos(w0)) / 2;
85 if (!
s->buffer || !
s->w || !
s->write_pos)
101 const double mix =
ctx->is_disabled ? 0. : 1.;
102 const double wet =
ctx->is_disabled ? 1. :
s->wet_gain;
103 const double dry =
ctx->is_disabled ? 1. :
s->dry_gain;
104 const double feedback =
s->feedback, decay =
s->decay;
105 const double max_boost =
s->max_boost;
106 const double b0 =
s->b0;
107 const double b1 =
s->b1;
108 const double b2 =
s->b2;
109 const double a1 = -
s->a1;
110 const double a2 = -
s->a2;
113 const int buffer_samples =
s->buffer_samples;
115 for (
int ch = start; ch < end; ch++) {
117 double *
dst = (
double *)
out->extended_data[ch];
118 double *
buffer = (
double *)
s->buffer->extended_data[ch];
119 double *
w = (
double *)
s->w->extended_data[ch];
120 int write_pos =
s->write_pos[ch];
123 const double a = 0.00001;
124 const double b = 1. -
a;
134 double out_sample, boost;
136 out_sample =
src[n] *
b0 +
w[0];
137 w[0] =
b1 *
src[n] +
w[1] +
a1 * out_sample;
138 w[1] =
b2 *
src[n] +
a2 * out_sample;
140 buffer[write_pos] =
buffer[write_pos] * decay + out_sample * feedback;
142 w[2] = boost >
w[2] ?
w[2] *
b +
a * boost :
w[2] *
a +
b * boost;
146 if (++write_pos >= buffer_samples)
150 s->write_pos[ch] = write_pos;
168 if (strcmp(
s->ch_layout_str,
"all"))
203 char *res,
int res_len,
int flags)
214#define OFFSET(x) offsetof(ASubBoostContext, x)
215#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
242 .p.name =
"asubboost",
244 .p.priv_class = &asubboost_class,
static int fn filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static const AVFilterPad inputs[]
static int config_input(AVFilterLink *inlink)
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
static int get_coeffs(AVFilterContext *ctx)
static int filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int config_input(AVFilterLink *inlink)
static const AVOption asubboost_options[]
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
const FFFilter ff_af_asubboost
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
static av_cold void uninit(AVFilterContext *ctx)
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
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.
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Main libavfilter public API header.
#define flags(name, subs,...)
Public libavutil channel layout APIs header.
static __device__ float fabs(float a)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
channel
Use these values when setting the channel map with ebur128_set_channel().
internal math functions header
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
int av_channel_layout_from_string(AVChannelLayout *channel_layout, const char *str)
Initialize a channel layout from a given string description.
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.
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.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
@ AV_SAMPLE_FMT_DBLP
double, planar
static const int16_t alpha[]
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int mix(int c0, int c1)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
static int ff_slice_pos(int total, int jobnr, int nb_jobs)
Compute the boundary index for a slice when work of size total is split into nb_jobs slices.
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
#define AVFILTER_DEFINE_CLASS(fname)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
AVChannelLayout ch_layout
An AVChannelLayout holds information about the channel layout of audio data.
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
A link between two filters.
int sample_rate
samples per second
AVChannelLayout ch_layout
channel layout of current buffer (see libavutil/channel_layout.h)
AVFilterContext * dst
dest filter
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
int nb_samples
number of audio samples (per channel) described by this frame
AVChannelLayout ch_layout
Channel layout of the audio data.
uint8_t ** extended_data
pointers to the data planes/channels.
Used for passing data between threads.
static AVFormatContext * ctx
static double b1(void *priv, double x, double y)
static double b2(void *priv, double x, double y)
static double b0(void *priv, double x, double y)
static double a2(void *priv, double x, double y)
static double a1(void *priv, double x, double y)