Go to the documentation of this file.
49 static double prewarp(
double w,
double T,
double wp)
51 return wp * tan(
w *
T * 0.5) / tan(wp *
T * 0.5);
54 static double mz(
int i,
double w0,
double r,
double alpha)
59 static double mp(
int i,
double w0,
double r)
61 return w0 * pow(
r,
i);
64 static double mzh(
int i,
double T,
double w0,
double r,
double alpha)
69 static double mph(
int i,
double T,
double w0,
double r)
75 double w1,
double sr,
double alpha)
77 double c = 1.0 / tan(w1 * 0.5 / sr);
87 int order,
double sr,
double f0,
88 double bw,
double alpha)
91 const double w0 = 2. *
M_PI * f0;
92 const double f1 = f0 + bw;
94 const double r = pow(f1 / f0, 1.0 / (order - 1.0));
95 const double T = 1. / sr;
97 for (
int i = 0;
i < order;
i++) {
100 set_tf1s(coeffs, 1.0,
mzh(
i,
T, w0,
r,
alpha),
mph(
i,
T, w0,
r),
119 #define FILTER(name, type) \
120 static int filter_channels_## name(AVFilterContext *ctx, void *arg, \
121 int jobnr, int nb_jobs) \
123 ATiltContext *s = ctx->priv; \
124 ThreadData *td = arg; \
125 AVFrame *out = td->out; \
126 AVFrame *in = td->in; \
127 const int start = (in->ch_layout.nb_channels * jobnr) / nb_jobs; \
128 const int end = (in->ch_layout.nb_channels * (jobnr+1)) / nb_jobs; \
129 const type level = s->level; \
131 for (int ch = start; ch < end; ch++) { \
132 const type *src = (const type *)in->extended_data[ch]; \
133 type *dst = (type *)out->extended_data[ch]; \
135 for (int b = 0; b < s->order; b++) { \
136 Coeffs *coeffs = &s->coeffs[b]; \
137 const type g = coeffs->g; \
138 const type a1 = coeffs->a1; \
139 const type b0 = coeffs->b0; \
140 const type b1 = coeffs->b1; \
141 type *w = ((type *)s->w->extended_data[ch]) + b * 2; \
143 for (int n = 0; n < in->nb_samples; n++) { \
144 type sain = b ? dst[n] : src[n] * level; \
145 type saout = sain * b0 + w[0] * b1 - w[1] * a1; \
150 dst[n] = saout * g; \
207 char *res,
int res_len,
int flags)
225 #define OFFSET(x) offsetof(ATiltContext, x)
226 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
252 .priv_class = &atilt_class,
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
@ AV_SAMPLE_FMT_FLTP
float, planar
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
const AVFilter ff_af_atilt
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static int get_coeffs(AVFilterContext *ctx)
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.
static double mp(int i, double w0, double r)
This structure describes decoded (raw) audio or video data.
static void set_tf1s(Coeffs *coeffs, double b1, double b0, double a0, double w1, double sr, double alpha)
const char * name
Filter name.
A link between two filters.
static void set_filter(AVFilterContext *ctx, int order, double sr, double f0, double bw, double alpha)
static double b1(void *priv, double x, double y)
A filter pad used for either input or output.
static double mzh(int i, double T, double w0, double r, double alpha)
#define FILTER(name, type)
static double mph(int i, double T, double w0, double r)
#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 process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
static av_cold void uninit(AVFilterContext *ctx)
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 int config_input(AVFilterLink *inlink)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static double mz(int i, double w0, double r, double alpha)
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.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
int nb_samples
number of audio samples (per channel) described by this frame
#define i(width, name, range_min, range_max)
static const AVFilterPad inputs[]
static double prewarp(double w, double T, double wp)
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Used for passing data between threads.
const char * name
Pad name.
static const AVOption atilt_options[]
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
int(* filter_channels)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
@ 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 flags(name, subs,...)
AVFILTER_DEFINE_CLASS(atilt)
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)
#define FILTER_SAMPLEFMTS(...)