Go to the documentation of this file.
50 static double prewarp(
double w,
double T,
double wp)
52 return wp * tan(
w *
T * 0.5) / tan(wp *
T * 0.5);
55 static double mz(
int i,
double w0,
double r,
double alpha)
60 static double mp(
int i,
double w0,
double r)
62 return w0 * pow(
r,
i);
65 static double mzh(
int i,
double T,
double w0,
double r,
double alpha)
70 static double mph(
int i,
double T,
double w0,
double r)
76 double w1,
double sr,
double alpha)
78 double c = 1.0 / tan(w1 * 0.5 / sr);
88 int order,
double sr,
double f0,
89 double bw,
double alpha)
92 const double w0 = 2. *
M_PI * f0;
93 const double f1 = f0 + bw;
95 const double r = pow(f1 / f0, 1.0 / (order - 1.0));
96 const double T = 1. / sr;
98 for (
int i = 0;
i < order;
i++) {
101 set_tf1s(coeffs, 1.0,
mzh(
i,
T, w0,
r,
alpha),
mph(
i,
T, w0,
r),
120 #define FILTER(name, type) \
121 static int filter_channels_## name(AVFilterContext *ctx, void *arg, \
122 int jobnr, int nb_jobs) \
124 ATiltContext *s = ctx->priv; \
125 ThreadData *td = arg; \
126 AVFrame *out = td->out; \
127 AVFrame *in = td->in; \
128 const int start = (in->ch_layout.nb_channels * jobnr) / nb_jobs; \
129 const int end = (in->ch_layout.nb_channels * (jobnr+1)) / nb_jobs; \
130 const type level = s->level; \
132 for (int ch = start; ch < end; ch++) { \
133 const type *src = (const type *)in->extended_data[ch]; \
134 type *dst = (type *)out->extended_data[ch]; \
136 for (int b = 0; b < s->order; b++) { \
137 Coeffs *coeffs = &s->coeffs[b]; \
138 const type g = coeffs->g; \
139 const type a1 = coeffs->a1; \
140 const type b0 = coeffs->b0; \
141 const type b1 = coeffs->b1; \
142 type *w = ((type *)s->w->extended_data[ch]) + b * 2; \
144 for (int n = 0; n < in->nb_samples; n++) { \
145 type sain = b ? dst[n] : src[n] * level; \
146 type saout = sain * b0 + w[0] * b1 - w[1] * a1; \
151 dst[n] = saout * g; \
208 char *res,
int res_len,
int flags)
226 #define OFFSET(x) offsetof(ATiltContext, x)
227 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
260 .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)
static const AVFilterPad outputs[]
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)
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(...)