Go to the documentation of this file.
51 #define OFFSET(x) offsetof(AExciterContext, x)
52 #define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
68 static inline double M(
double x)
70 return (
fabs(x) > 0.00000001) ? x : 0.0;
73 static inline double D(
double x)
77 return (x > 0.00000001) ? sqrt(x) : 0.0;
81 double blend,
double drive,
82 double srate,
double freq,
88 p->
rbdr = p->
rdrive / (10.5 - blend) * 780.0 / 33.0;
90 p->
kpb = (2.0 - p->
kpa) / 2.0;
94 p->
srct = (0.1 * srate) / (0.1 * srate + 1.0);
99 p->
imr = 2.0 * p->
knb +
D(2.0 * p->
kna + 4.0 * p->
an - 1.0);
100 p->
pwrq = 2.0 / (p->
imr + 1.0);
102 w0 = 2 *
M_PI * freq / srate;
103 alpha = sin(w0) / (2. * 0.707);
107 b0 = (1 + cos(w0)) / 2;
109 b2 = (1 + cos(w0)) / 2;
118 alpha = sin(w0) / (2. * 0.707);
122 b0 = (1 - cos(w0)) / 2;
124 b2 = (1 - cos(w0)) / 2;
133 static double bprocess(
double in,
const double *
const c,
134 double *w1,
double *w2)
136 double out =
c[2] * in + *w1;
138 *w1 =
c[3] * in + *w2 +
c[0] *
out;
139 *w2 =
c[4] * in +
c[1] *
out;
146 double proc = in, med;
152 med = (
D(p->
ap + proc * (p->
kpa - proc)) + p->
kpb) * p->
pwrq;
154 med = (
D(p->
an - proc * (p->
kna + proc)) + p->
knb) * p->
pwrq * -1.0;
164 if (
s->ceil >= 10000.) {
178 const double *
src = (
const double *)in->
data[0];
179 const double level_in =
s->level_in;
180 const double level_out =
s->level_out;
181 const double amount =
s->amount;
182 const double listen = 1.0 -
s->listen;
196 dst = (
double *)
out->data[0];
198 for (
int c = 0;
c <
inlink->ch_layout.nb_channels;
c++) {
205 if (
ctx->is_disabled)
212 dst +=
inlink->ch_layout.nb_channels;
238 for (
int i = 0;
i <
inlink->ch_layout.nb_channels;
i++)
246 char *res,
int res_len,
int flags)
278 .priv_class = &aexciter_class,
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
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
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
#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.
const char * name
Filter name.
A link between two filters.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static double b1(void *priv, double x, double y)
A filter pad used for either input or output.
static av_cold void uninit(AVFilterContext *ctx)
static __device__ float ceil(float a)
static void set_params(ChannelParams *p, double blend, double drive, double srate, double freq, double ceil)
#define FILTER_INPUTS(array)
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
const AVFilter ff_af_aexciter
Describe the class of an AVClass context structure.
static __device__ float fabs(float a)
static const AVFilterPad avfilter_af_aexciter_inputs[]
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static double D(double x)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static const AVFilterPad avfilter_af_aexciter_outputs[]
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)
static double M(double x)
static int config_input(AVFilterLink *inlink)
int nb_samples
number of audio samples (per channel) described by this frame
#define i(width, name, range_min, range_max)
sample data coding information
const char * name
Pad name.
void * av_calloc(size_t nmemb, size_t size)
AVFILTER_DEFINE_CLASS(aexciter)
static const AVOption aexciter_options[]
static double distortion_process(AExciterContext *s, ChannelParams *p, double in)
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)
@ AV_SAMPLE_FMT_DBL
double
static double bprocess(double in, const double *const c, double *w1, double *w2)