Go to the documentation of this file.
52 #define OFFSET(x) offsetof(AExciterContext, x)
53 #define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
69 static inline double M(
double x)
71 return (
fabs(x) > 0.00000001) ? x : 0.0;
74 static inline double D(
double x)
78 return (x > 0.00000001) ? sqrt(x) : 0.0;
82 double blend,
double drive,
83 double srate,
double freq,
89 p->
rbdr = p->
rdrive / (10.5 - blend) * 780.0 / 33.0;
91 p->
kpb = (2.0 - p->
kpa) / 2.0;
95 p->
srct = (0.1 * srate) / (0.1 * srate + 1.0);
100 p->
imr = 2.0 * p->
knb +
D(2.0 * p->
kna + 4.0 * p->
an - 1.0);
101 p->
pwrq = 2.0 / (p->
imr + 1.0);
103 w0 = 2 *
M_PI * freq / srate;
104 alpha = sin(w0) / (2. * 0.707);
108 b0 = (1 + cos(w0)) / 2;
110 b2 = (1 + cos(w0)) / 2;
119 alpha = sin(w0) / (2. * 0.707);
123 b0 = (1 - cos(w0)) / 2;
125 b2 = (1 - cos(w0)) / 2;
134 static double bprocess(
double in,
const double *
const c,
135 double *w1,
double *w2)
137 double out =
c[2] * in + *w1;
139 *w1 =
c[3] * in + *w2 +
c[0] *
out;
140 *w2 =
c[4] * in +
c[1] *
out;
147 double proc = in, med;
153 med = (
D(p->
ap + proc * (p->
kpa - proc)) + p->
kpb) * p->
pwrq;
155 med = (
D(p->
an - proc * (p->
kna + proc)) + p->
knb) * p->
pwrq * -1.0;
165 if (
s->ceil >= 10000.) {
179 const double *
src = (
const double *)in->
data[0];
180 const double level_in =
s->level_in;
181 const double level_out =
s->level_out;
182 const double amount =
s->amount;
183 const double listen = 1.0 -
s->listen;
197 dst = (
double *)
out->data[0];
199 for (
int c = 0;
c <
inlink->ch_layout.nb_channels;
c++) {
206 if (
ctx->is_disabled)
239 for (
int i = 0;
i <
inlink->ch_layout.nb_channels;
i++)
247 char *res,
int res_len,
int flags)
272 .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)
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.
#define FILTER_INPUTS(array)
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)
static double a2(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)
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
static void set_params(ChannelParams *p, double blend, double drive, double srate, double freq, double ceil)
#define FILTER_OUTPUTS(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.
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
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 FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
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 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
#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[]
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
#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 double a1(void *priv, double x, double y)
@ AV_SAMPLE_FMT_DBL
double
static double bprocess(double in, const double *const c, double *w1, double *w2)