FFmpeg
Loading...
Searching...
No Matches
af_afftfilt.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Paul B Mahol
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation; either version 2.1 of the License,
9 * or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include "libavutil/avstring.h"
22#include "libavutil/mem.h"
23#include "libavutil/common.h"
24#include "libavutil/cpu.h"
25#include "libavutil/opt.h"
26#include "libavutil/eval.h"
27#include "libavutil/tx.h"
28#include "audio.h"
29#include "filters.h"
30#include "window_func.h"
31
55
56static const char *const var_names[] = { "sr", "b", "nb", "ch", "chs", "pts", "re", "im", NULL };
58
59#define OFFSET(x) offsetof(AFFTFiltContext, x)
60#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
61
62static const AVOption afftfilt_options[] = {
63 { "real", "set channels real expressions", OFFSET(real_str), AV_OPT_TYPE_STRING, {.str = "re" }, 0, 0, A },
64 { "imag", "set channels imaginary expressions", OFFSET(img_str), AV_OPT_TYPE_STRING, {.str = "im" }, 0, 0, A },
65 { "win_size", "set window size", OFFSET(fft_size), AV_OPT_TYPE_INT, {.i64=4096}, 16, 131072, A },
66 WIN_FUNC_OPTION("win_func", OFFSET(win_func), A, WFUNC_HANNING),
67 { "overlap", "set window overlap", OFFSET(overlap), AV_OPT_TYPE_FLOAT, {.dbl=0.75}, 0, 1, A },
68 { NULL },
69};
70
72
73static inline double getreal(void *priv, double x, double ch)
74{
75 AFFTFiltContext *s = priv;
76 int ich, ix;
77
78 ich = av_clip(ch, 0, s->nb_exprs - 1);
79 ix = av_clip(x, 0, s->window_size / 2);
80
81 return s->fft_out[ich][ix].re;
82}
83
84static inline double getimag(void *priv, double x, double ch)
85{
86 AFFTFiltContext *s = priv;
87 int ich, ix;
88
89 ich = av_clip(ch, 0, s->nb_exprs - 1);
90 ix = av_clip(x, 0, s->window_size / 2);
91
92 return s->fft_out[ich][ix].im;
93}
94
95static double realf(void *priv, double x, double ch) { return getreal(priv, x, ch); }
96static double imagf(void *priv, double x, double ch) { return getimag(priv, x, ch); }
97
98static const char *const func2_names[] = { "real", "imag", NULL };
99static double (*const func2[])(void *, double, double) = { realf, imagf, NULL };
100
101static int config_input(AVFilterLink *inlink)
102{
103 AVFilterContext *ctx = inlink->dst;
104 AFFTFiltContext *s = ctx->priv;
105 char *saveptr = NULL;
106 int ret = 0, ch;
107 float overlap, scale = 1.f;
108 char *args;
109 const char *last_expr = "1";
110 int buf_size;
111
112 s->channels = inlink->ch_layout.nb_channels;
113 s->fft = av_calloc(s->channels, sizeof(*s->fft));
114 s->ifft = av_calloc(s->channels, sizeof(*s->ifft));
115 if (!s->fft || !s->ifft)
116 return AVERROR(ENOMEM);
117
118 for (int ch = 0; ch < s->channels; ch++) {
119 ret = av_tx_init(&s->fft[ch], &s->tx_fn, AV_TX_FLOAT_FFT, 0, s->fft_size, &scale, 0);
120 if (ret < 0)
121 return ret;
122 }
123
124 for (int ch = 0; ch < s->channels; ch++) {
125 ret = av_tx_init(&s->ifft[ch], &s->itx_fn, AV_TX_FLOAT_FFT, 1, s->fft_size, &scale, 0);
126 if (ret < 0)
127 return ret;
128 }
129
130 s->window_size = s->fft_size;
131 size_t max_align = av_cpu_max_align();
132 buf_size = FFALIGN(s->window_size, max_align);
133
134 s->fft_in = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->fft_in));
135 if (!s->fft_in)
136 return AVERROR(ENOMEM);
137
138 s->fft_out = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->fft_out));
139 if (!s->fft_out)
140 return AVERROR(ENOMEM);
141
142 s->fft_temp = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->fft_temp));
143 if (!s->fft_temp)
144 return AVERROR(ENOMEM);
145
146 for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
147 s->fft_in[ch] = av_calloc(buf_size, sizeof(**s->fft_in));
148 if (!s->fft_in[ch])
149 return AVERROR(ENOMEM);
150
151 s->fft_out[ch] = av_calloc(buf_size, sizeof(**s->fft_out));
152 if (!s->fft_out[ch])
153 return AVERROR(ENOMEM);
154
155 s->fft_temp[ch] = av_calloc(buf_size, sizeof(**s->fft_temp));
156 if (!s->fft_temp[ch])
157 return AVERROR(ENOMEM);
158 }
159
160 s->real = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->real));
161 if (!s->real)
162 return AVERROR(ENOMEM);
163
164 s->imag = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->imag));
165 if (!s->imag)
166 return AVERROR(ENOMEM);
167
168 args = av_strdup(s->real_str);
169 if (!args)
170 return AVERROR(ENOMEM);
171
172 for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
173 char *arg = av_strtok(ch == 0 ? args : NULL, "|", &saveptr);
174
175 ret = av_expr_parse(&s->real[ch], arg ? arg : last_expr, var_names,
176 NULL, NULL, func2_names, func2, 0, ctx);
177 if (ret < 0)
178 goto fail;
179 if (arg)
180 last_expr = arg;
181 s->nb_exprs++;
182 }
183
184 av_freep(&args);
185
186 args = av_strdup(s->img_str ? s->img_str : s->real_str);
187 if (!args)
188 return AVERROR(ENOMEM);
189
190 saveptr = NULL;
191 last_expr = "1";
192 for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
193 char *arg = av_strtok(ch == 0 ? args : NULL, "|", &saveptr);
194
195 ret = av_expr_parse(&s->imag[ch], arg ? arg : last_expr, var_names,
196 NULL, NULL, func2_names, func2, 0, ctx);
197 if (ret < 0)
198 goto fail;
199 if (arg)
200 last_expr = arg;
201 }
202
203 av_freep(&args);
204
205 s->window_func_lut = av_realloc_f(s->window_func_lut, s->window_size,
206 sizeof(*s->window_func_lut));
207 if (!s->window_func_lut)
208 return AVERROR(ENOMEM);
209 generate_window_func(s->window_func_lut, s->window_size, s->win_func, &overlap);
210 for (int i = 0; i < s->window_size; i++)
211 s->window_func_lut[i] = sqrtf(s->window_func_lut[i] / s->window_size);
212 if (s->overlap == 1)
213 s->overlap = overlap;
214
215 s->hop_size = s->window_size * (1 - s->overlap);
216 if (s->hop_size <= 0)
217 return AVERROR(EINVAL);
218
219 s->window = ff_get_audio_buffer(inlink, s->window_size * 2);
220 if (!s->window)
221 return AVERROR(ENOMEM);
222
223 s->buffer = ff_get_audio_buffer(inlink, s->window_size * 2);
224 if (!s->buffer)
225 return AVERROR(ENOMEM);
226
227fail:
228 av_freep(&args);
229
230 return ret;
231}
232
233static int tx_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
234{
235 AFFTFiltContext *s = ctx->priv;
236 const int channels = s->channels;
237 const int start = ff_slice_pos(channels, jobnr, nb_jobs);
238 const int end = ff_slice_pos(channels, jobnr + 1, nb_jobs);
239
240 for (int ch = start; ch < end; ch++) {
241 AVComplexFloat *fft_in = s->fft_in[ch];
242 AVComplexFloat *fft_out = s->fft_out[ch];
243
244 s->tx_fn(s->fft[ch], fft_out, fft_in, sizeof(*fft_in));
245 }
246
247 return 0;
248}
249
250static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
251{
252 AFFTFiltContext *s = ctx->priv;
253 const int window_size = s->window_size;
254 const float *window_lut = s->window_func_lut;
255 const float f = sqrtf(1.f - s->overlap);
256 const int channels = s->channels;
257 const int start = ff_slice_pos(channels, jobnr, nb_jobs);
258 const int end = ff_slice_pos(channels, jobnr + 1, nb_jobs);
259 double values[VAR_VARS_NB];
260
261 memcpy(values, arg, sizeof(values));
262
263 for (int ch = start; ch < end; ch++) {
264 AVComplexFloat *fft_out = s->fft_out[ch];
265 AVComplexFloat *fft_temp = s->fft_temp[ch];
266 float *buf = (float *)s->buffer->extended_data[ch];
267
268 values[VAR_CHANNEL] = ch;
269
270 if (ctx->is_disabled) {
271 for (int n = 0; n < window_size; n++) {
272 fft_temp[n].re = fft_out[n].re;
273 fft_temp[n].im = fft_out[n].im;
274 }
275 } else {
276 for (int n = 0; n <= window_size / 2; n++) {
277 float fr, fi;
278
279 values[VAR_BIN] = n;
280 values[VAR_REAL] = fft_out[n].re;
281 values[VAR_IMAG] = fft_out[n].im;
282
283 fr = av_expr_eval(s->real[ch], values, s);
284 fi = av_expr_eval(s->imag[ch], values, s);
285
286 fft_temp[n].re = fr;
287 fft_temp[n].im = fi;
288 }
289
290 for (int n = window_size / 2 + 1, x = window_size / 2 - 1; n < window_size; n++, x--) {
291 fft_temp[n].re = fft_temp[x].re;
292 fft_temp[n].im = -fft_temp[x].im;
293 }
294 }
295
296 s->itx_fn(s->ifft[ch], fft_out, fft_temp, sizeof(*fft_temp));
297
298 memmove(buf, buf + s->hop_size, window_size * sizeof(float));
299 for (int i = 0; i < window_size; i++)
300 buf[i] += fft_out[i].re * window_lut[i] * f;
301 }
302
303 return 0;
304}
305
306static int filter_frame(AVFilterLink *inlink, AVFrame *in)
307{
308 AVFilterContext *ctx = inlink->dst;
309 AVFilterLink *outlink = ctx->outputs[0];
310 AFFTFiltContext *s = ctx->priv;
311 const int window_size = s->window_size;
312 const float *window_lut = s->window_func_lut;
313 double values[VAR_VARS_NB];
314 int ch, n, ret;
315 AVFrame *out;
316
317 for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
318 const int offset = s->window_size - s->hop_size;
319 float *src = (float *)s->window->extended_data[ch];
320 AVComplexFloat *fft_in = s->fft_in[ch];
321
322 memmove(src, &src[s->hop_size], offset * sizeof(float));
323 memcpy(&src[offset], in->extended_data[ch], in->nb_samples * sizeof(float));
324 memset(&src[offset + in->nb_samples], 0, (s->hop_size - in->nb_samples) * sizeof(float));
325
326 for (n = 0; n < window_size; n++) {
327 fft_in[n].re = src[n] * window_lut[n];
328 fft_in[n].im = 0;
329 }
330 }
331
332 values[VAR_PTS] = in->pts;
333 values[VAR_SAMPLE_RATE] = inlink->sample_rate;
334 values[VAR_NBBINS] = window_size / 2;
335 values[VAR_CHANNELS] = inlink->ch_layout.nb_channels;
336
338 FFMIN(s->channels, ff_filter_get_nb_threads(ctx)));
339
341 FFMIN(s->channels, ff_filter_get_nb_threads(ctx)));
342
343 out = ff_get_audio_buffer(outlink, s->hop_size);
344 if (!out) {
345 ret = AVERROR(ENOMEM);
346 goto fail;
347 }
348
350 out->nb_samples = in->nb_samples;
351
352 for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
353 float *dst = (float *)out->extended_data[ch];
354 float *buf = (float *)s->buffer->extended_data[ch];
355
356 memcpy(dst, buf, s->hop_size * sizeof(float));
357 }
358
359 ret = ff_filter_frame(outlink, out);
360 if (ret < 0)
361 goto fail;
362
363fail:
364 av_frame_free(&in);
365 return ret < 0 ? ret : 0;
366}
367
369{
370 AVFilterLink *inlink = ctx->inputs[0];
371 AVFilterLink *outlink = ctx->outputs[0];
372 AFFTFiltContext *s = ctx->priv;
373 AVFrame *in = NULL;
374 int ret = 0, status;
375 int64_t pts;
376
377 FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
378
379 ret = ff_inlink_consume_samples(inlink, s->hop_size, s->hop_size, &in);
380 if (ret < 0)
381 return ret;
382
383 if (ret > 0)
384 ret = filter_frame(inlink, in);
385 if (ret < 0)
386 return ret;
387
388 if (ff_inlink_acknowledge_status(inlink, &status, &pts)) {
389 ff_outlink_set_status(outlink, status, pts);
390 return 0;
391 }
392
393 FF_FILTER_FORWARD_WANTED(outlink, inlink);
394
395 return FFERROR_NOT_READY;
396}
397
399{
400 AFFTFiltContext *s = ctx->priv;
401 int i;
402
403
404 for (i = 0; i < s->channels; i++) {
405 if (s->ifft)
406 av_tx_uninit(&s->ifft[i]);
407 if (s->fft)
408 av_tx_uninit(&s->fft[i]);
409 if (s->fft_in)
410 av_freep(&s->fft_in[i]);
411 if (s->fft_out)
412 av_freep(&s->fft_out[i]);
413 if (s->fft_temp)
414 av_freep(&s->fft_temp[i]);
415 }
416
417 av_freep(&s->fft);
418 av_freep(&s->ifft);
419 av_freep(&s->fft_in);
420 av_freep(&s->fft_out);
421 av_freep(&s->fft_temp);
422
423 for (i = 0; i < s->nb_exprs; i++) {
424 av_expr_free(s->real[i]);
425 av_expr_free(s->imag[i]);
426 }
427
428 av_freep(&s->real);
429 av_freep(&s->imag);
430 av_frame_free(&s->buffer);
431 av_frame_free(&s->window);
432 av_freep(&s->window_func_lut);
433}
434
435static const AVFilterPad inputs[] = {
436 {
437 .name = "default",
438 .type = AVMEDIA_TYPE_AUDIO,
439 .config_props = config_input,
440 },
441};
442
444 .p.name = "afftfilt",
445 .p.description = NULL_IF_CONFIG_SMALL("Apply arbitrary expressions to samples in frequency domain."),
446 .p.priv_class = &afftfilt_class,
449 .priv_size = sizeof(AFFTFiltContext),
453 .activate = activate,
454 .uninit = uninit,
455};
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
static const AVFilterPad inputs[]
Definition af_aap.c:299
static int config_input(AVFilterLink *inlink)
static double imagf(void *priv, double x, double ch)
Definition af_afftfilt.c:96
static double(*const func2[])(void *, double, double)
Definition af_afftfilt.c:99
static int tx_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
const FFFilter ff_af_afftfilt
static const AVOption afftfilt_options[]
Definition af_afftfilt.c:62
static int config_input(AVFilterLink *inlink)
static double getreal(void *priv, double x, double ch)
Definition af_afftfilt.c:73
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static const char *const func2_names[]
Definition af_afftfilt.c:98
static double getimag(void *priv, double x, double ch)
Definition af_afftfilt.c:84
@ VAR_REAL
Definition af_afftfilt.c:57
@ VAR_IMAG
Definition af_afftfilt.c:57
@ VAR_CHANNEL
Definition af_afftfilt.c:57
@ VAR_NBBINS
Definition af_afftfilt.c:57
@ VAR_BIN
Definition af_afftfilt.c:57
@ VAR_SAMPLE_RATE
Definition af_afftfilt.c:57
@ VAR_CHANNELS
Definition af_afftfilt.c:57
static int activate(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define OFFSET(x)
Definition af_afftfilt.c:59
static double realf(void *priv, double x, double ch)
Definition af_afftfilt.c:95
channels
Definition aptx.h:31
#define A(x)
Definition vpx_arith.h:28
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
Definition audio.c:34
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
Definition audio.c:74
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
Definition avfilter.c:1467
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1068
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition avfilter.c:1696
int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, AVFrame **rframe)
Take samples from the link's FIFO and update the link's stats.
Definition avfilter.c:1540
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition avfilter.c:846
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define f(width, name)
Definition cbs_vp8.c:236
#define s(width, name)
Definition cbs_vp9.c:198
common internal and external API header
#define av_clip
Definition common.h:100
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
static __device__ float sqrtf(float a)
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
Definition eval.c:368
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
Definition eval.c:824
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
Definition eval.c:735
simple arithmetic expression evaluator
#define fail
Definition test.h:479
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition opt.h:270
@ 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...
Definition opt.h:275
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition avfilter.h:166
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
Definition avfilter.h:204
#define AVERROR(e)
Definition error.h:45
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition frame.c:599
@ AVMEDIA_TYPE_AUDIO
Definition avutil.h:201
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition samplefmt.h:66
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok().
Definition avstring.c:179
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition intra.c:278
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
unsigned offset
Definition libaomenc.c:763
const char * arg
Definition jacosubdec.c:65
static void filter_channel(MLPDecodeContext *m, unsigned int substr, unsigned int channel)
Generate PCM samples using the prediction filters and residual values read from the data stream,...
Definition mlpdec.c:972
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
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.
Definition filters.h:763
#define FF_FILTER_FORWARD_WANTED(outlink, inlink)
Forward the frame_wanted_out flag from an output link to an input link.
Definition filters.h:694
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
Definition filters.h:629
#define FFERROR_NOT_READY
Filters implementation helper functions and internal structures.
Definition filters.h:34
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
Definition filters.h:639
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
Definition filters.h:257
#define AVFILTER_DEFINE_CLASS(fname)
Definition filters.h:478
#define av_cold
Definition attributes.h:117
size_t av_cpu_max_align(void)
Get the maximum data alignment that may be required by FFmpeg.
Definition cpu.c:287
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
#define FFMIN(a, b)
Definition macros.h:49
#define FFALIGN(x, a)
Definition macros.h:78
void * av_calloc(size_t nmemb, size_t size)
Definition mem.c:264
Memory handling functions.
@ VAR_PTS
Definition noise.c:49
@ VAR_VARS_NB
Definition noise.c:59
static const char *const var_names[]
Definition noise.c:30
#define av_strdup(s)
Definition ops_static.c:55
AVOptions.
AVTXContext ** fft
Definition af_afftfilt.c:38
AVComplexFloat ** fft_out
Definition af_afftfilt.c:41
AVComplexFloat ** fft_temp
Definition af_afftfilt.c:42
av_tx_fn itx_fn
Definition af_afftfilt.c:39
float * window_func_lut
Definition af_afftfilt.c:53
AVFrame * window
Definition af_afftfilt.c:50
AVExpr ** imag
Definition af_afftfilt.c:47
AVFrame * buffer
Definition af_afftfilt.c:51
AVExpr ** real
Definition af_afftfilt.c:46
AVTXContext ** ifft
Definition af_afftfilt.c:38
AVComplexFloat ** fft_in
Definition af_afftfilt.c:40
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
Definition log.h:76
float im
Definition tx.h:28
float re
Definition tx.h:28
Definition eval.c:171
An instance of a filter.
Definition avfilter.h:273
A filter pad used for either input or output.
Definition filters.h:40
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
int nb_samples
number of audio samples (per channel) described by this frame
Definition frame.h:552
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition frame.h:574
uint8_t ** extended_data
pointers to the data planes/channels.
Definition frame.h:533
AVOption.
Definition opt.h:428
#define av_realloc_f(p, o, n)
#define av_freep(p)
#define src
Definition vp8dsp.c:248
static FILE * out
Definition movenc.c:55
static AVFormatContext * ctx
Definition movenc.c:49
static int64_t pts
av_cold void av_tx_uninit(AVTXContext **ctx)
Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
Definition tx.c:295
av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
Initialize a transform context with the given configuration (i)MDCTs with an odd length are currently...
Definition tx.c:903
@ AV_TX_FLOAT_FFT
Standard complex to complex FFT with sample data type of AVComplexFloat, AVComplexDouble or AVComplex...
Definition tx.h:47
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
Definition tx.h:151
#define WIN_FUNC_OPTION(win_func_opt_name, win_func_offset, flag, default_window_func)
Definition window_func.h:37
static void generate_window_func(float *lut, int N, int win_func, float *overlap)
Definition window_func.h:63
@ WFUNC_HANNING
Definition window_func.h:29