FFmpeg
af_acrossover.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 /**
20  * @file
21  * Crossover filter
22  *
23  * Split an audio stream into several bands.
24  */
25 
26 #include "libavutil/attributes.h"
27 #include "libavutil/avstring.h"
29 #include "libavutil/eval.h"
30 #include "libavutil/internal.h"
31 #include "libavutil/opt.h"
32 
33 #include "audio.h"
34 #include "avfilter.h"
35 #include "formats.h"
36 #include "internal.h"
37 
38 #define MAX_SPLITS 16
39 #define MAX_BANDS MAX_SPLITS + 1
40 
41 typedef struct BiquadContext {
42  double a0, a1, a2;
43  double b1, b2;
44  double i1, i2;
45  double o1, o2;
47 
48 typedef struct CrossoverChannel {
52 
53 typedef struct AudioCrossoverContext {
54  const AVClass *class;
55 
56  char *splits_str;
57  int order;
58 
60  int nb_splits;
61  float *splits;
62 
64 
68 
69 #define OFFSET(x) offsetof(AudioCrossoverContext, x)
70 #define AF AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
71 
72 static const AVOption acrossover_options[] = {
73  { "split", "set split frequencies", OFFSET(splits_str), AV_OPT_TYPE_STRING, {.str="500"}, 0, 0, AF },
74  { "order", "set order", OFFSET(order), AV_OPT_TYPE_INT, {.i64=1}, 0, 2, AF, "m" },
75  { "2nd", "2nd order", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "m" },
76  { "4th", "4th order", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "m" },
77  { "8th", "8th order", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "m" },
78  { NULL }
79 };
80 
81 AVFILTER_DEFINE_CLASS(acrossover);
82 
84 {
85  AudioCrossoverContext *s = ctx->priv;
86  char *p, *arg, *saveptr = NULL;
87  int i, ret = 0;
88 
89  s->splits = av_calloc(MAX_SPLITS, sizeof(*s->splits));
90  if (!s->splits)
91  return AVERROR(ENOMEM);
92 
93  p = s->splits_str;
94  for (i = 0; i < MAX_SPLITS; i++) {
95  float freq;
96 
97  if (!(arg = av_strtok(p, " |", &saveptr)))
98  break;
99 
100  p = NULL;
101 
102  if (av_sscanf(arg, "%f", &freq) != 1) {
103  av_log(ctx, AV_LOG_ERROR, "Invalid syntax for frequency[%d].\n", i);
104  return AVERROR(EINVAL);
105  }
106  if (freq <= 0) {
107  av_log(ctx, AV_LOG_ERROR, "Frequency %f must be positive number.\n", freq);
108  return AVERROR(EINVAL);
109  }
110 
111  if (i > 0 && freq <= s->splits[i-1]) {
112  av_log(ctx, AV_LOG_ERROR, "Frequency %f must be in increasing order.\n", freq);
113  return AVERROR(EINVAL);
114  }
115 
116  s->splits[i] = freq;
117  }
118 
119  s->nb_splits = i;
120 
121  for (i = 0; i <= s->nb_splits; i++) {
122  AVFilterPad pad = { 0 };
123  char *name;
124 
125  pad.type = AVMEDIA_TYPE_AUDIO;
126  name = av_asprintf("out%d", ctx->nb_outputs);
127  if (!name)
128  return AVERROR(ENOMEM);
129  pad.name = name;
130 
131  if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) {
132  av_freep(&pad.name);
133  return ret;
134  }
135  }
136 
137  return ret;
138 }
139 
140 static void set_lp(BiquadContext *b, double fc, double q, double sr)
141 {
142  double omega = 2.0 * M_PI * fc / sr;
143  double sn = sin(omega);
144  double cs = cos(omega);
145  double alpha = sn / (2. * q);
146  double inv = 1.0 / (1.0 + alpha);
147 
148  b->a0 = (1. - cs) * 0.5 * inv;
149  b->a1 = (1. - cs) * inv;
150  b->a2 = b->a0;
151  b->b1 = -2. * cs * inv;
152  b->b2 = (1. - alpha) * inv;
153 }
154 
155 static void set_hp(BiquadContext *b, double fc, double q, double sr)
156 {
157  double omega = 2 * M_PI * fc / sr;
158  double sn = sin(omega);
159  double cs = cos(omega);
160  double alpha = sn / (2 * q);
161  double inv = 1.0 / (1.0 + alpha);
162 
163  b->a0 = inv * (1. + cs) / 2.;
164  b->a1 = -2. * b->a0;
165  b->a2 = b->a0;
166  b->b1 = -2. * cs * inv;
167  b->b2 = (1. - alpha) * inv;
168 }
169 
171 {
172  AVFilterContext *ctx = inlink->dst;
173  AudioCrossoverContext *s = ctx->priv;
174  int ch, band, sample_rate = inlink->sample_rate;
175  double q;
176 
177  s->xover = av_calloc(inlink->channels, sizeof(*s->xover));
178  if (!s->xover)
179  return AVERROR(ENOMEM);
180 
181  switch (s->order) {
182  case 0:
183  q = 0.5;
184  s->filter_count = 1;
185  break;
186  case 1:
187  q = M_SQRT1_2;
188  s->filter_count = 2;
189  break;
190  case 2:
191  q = 0.54;
192  s->filter_count = 4;
193  break;
194  }
195 
196  for (ch = 0; ch < inlink->channels; ch++) {
197  for (band = 0; band <= s->nb_splits; band++) {
198  set_lp(&s->xover[ch].lp[band][0], s->splits[band], q, sample_rate);
199  set_hp(&s->xover[ch].hp[band][0], s->splits[band], q, sample_rate);
200 
201  if (s->order > 1) {
202  set_lp(&s->xover[ch].lp[band][1], s->splits[band], 1.34, sample_rate);
203  set_hp(&s->xover[ch].hp[band][1], s->splits[band], 1.34, sample_rate);
204  set_lp(&s->xover[ch].lp[band][2], s->splits[band], q, sample_rate);
205  set_hp(&s->xover[ch].hp[band][2], s->splits[band], q, sample_rate);
206  set_lp(&s->xover[ch].lp[band][3], s->splits[band], 1.34, sample_rate);
207  set_hp(&s->xover[ch].hp[band][3], s->splits[band], 1.34, sample_rate);
208  } else {
209  set_lp(&s->xover[ch].lp[band][1], s->splits[band], q, sample_rate);
210  set_hp(&s->xover[ch].hp[band][1], s->splits[band], q, sample_rate);
211  }
212  }
213  }
214 
215  return 0;
216 }
217 
219 {
222  static const enum AVSampleFormat sample_fmts[] = {
225  };
226  int ret;
227 
229  if (!layouts)
230  return AVERROR(ENOMEM);
232  if (ret < 0)
233  return ret;
234 
236  if (!formats)
237  return AVERROR(ENOMEM);
239  if (ret < 0)
240  return ret;
241 
243  if (!formats)
244  return AVERROR(ENOMEM);
246 }
247 
248 static double biquad_process(BiquadContext *b, double in)
249 {
250  double out = in * b->a0 + b->i1 * b->a1 + b->i2 * b->a2 - b->o1 * b->b1 - b->o2 * b->b2;
251 
252  b->i2 = b->i1;
253  b->o2 = b->o1;
254  b->i1 = in;
255  b->o1 = out;
256 
257  return out;
258 }
259 
260 static int filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
261 {
262  AudioCrossoverContext *s = ctx->priv;
263  AVFrame *in = s->input_frame;
264  AVFrame **frames = s->frames;
265  const int start = (in->channels * jobnr) / nb_jobs;
266  const int end = (in->channels * (jobnr+1)) / nb_jobs;
267  int f, band;
268 
269  for (int ch = start; ch < end; ch++) {
270  const double *src = (const double *)in->extended_data[ch];
271  CrossoverChannel *xover = &s->xover[ch];
272 
273  for (int i = 0; i < in->nb_samples; i++) {
274  double sample = src[i], lo, hi;
275 
276  for (band = 0; band < ctx->nb_outputs; band++) {
277  double *dst = (double *)frames[band]->extended_data[ch];
278 
279  lo = sample;
280  hi = sample;
281  for (f = 0; band + 1 < ctx->nb_outputs && f < s->filter_count; f++) {
282  BiquadContext *lp = &xover->lp[band][f];
283  lo = biquad_process(lp, lo);
284  }
285 
286  for (f = 0; band + 1 < ctx->nb_outputs && f < s->filter_count; f++) {
287  BiquadContext *hp = &xover->hp[band][f];
288  hi = biquad_process(hp, hi);
289  }
290 
291  dst[i] = lo;
292 
293  sample = hi;
294  }
295  }
296  }
297 
298  return 0;
299 }
300 
302 {
303  AVFilterContext *ctx = inlink->dst;
304  AudioCrossoverContext *s = ctx->priv;
305  AVFrame **frames = s->frames;
306  int i, ret = 0;
307 
308  for (i = 0; i < ctx->nb_outputs; i++) {
309  frames[i] = ff_get_audio_buffer(ctx->outputs[i], in->nb_samples);
310 
311  if (!frames[i]) {
312  ret = AVERROR(ENOMEM);
313  break;
314  }
315 
316  frames[i]->pts = in->pts;
317  }
318 
319  if (ret < 0)
320  goto fail;
321 
322  s->input_frame = in;
323  ctx->internal->execute(ctx, filter_channels, NULL, NULL, FFMIN(inlink->channels,
325 
326  for (i = 0; i < ctx->nb_outputs; i++) {
327  ret = ff_filter_frame(ctx->outputs[i], frames[i]);
328  frames[i] = NULL;
329  if (ret < 0)
330  break;
331  }
332 
333 fail:
334  for (i = 0; i < ctx->nb_outputs; i++)
336  av_frame_free(&in);
337  s->input_frame = NULL;
338 
339  return ret;
340 }
341 
343 {
344  AudioCrossoverContext *s = ctx->priv;
345  int i;
346 
347  av_freep(&s->splits);
348  av_freep(&s->xover);
349 
350  for (i = 0; i < ctx->nb_outputs; i++)
351  av_freep(&ctx->output_pads[i].name);
352 }
353 
354 static const AVFilterPad inputs[] = {
355  {
356  .name = "default",
357  .type = AVMEDIA_TYPE_AUDIO,
358  .filter_frame = filter_frame,
359  .config_props = config_input,
360  },
361  { NULL }
362 };
363 
365  .name = "acrossover",
366  .description = NULL_IF_CONFIG_SMALL("Split audio into per-bands streams."),
367  .priv_size = sizeof(AudioCrossoverContext),
368  .priv_class = &acrossover_class,
369  .init = init,
370  .uninit = uninit,
372  .inputs = inputs,
373  .outputs = NULL,
376 };
formats
formats
Definition: signature.h:48
BiquadContext::a2
double a2
Definition: af_acrossover.c:42
ff_get_audio_buffer
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
Definition: audio.c:86
AVFilterChannelLayouts
A list of supported channel layouts.
Definition: formats.h:85
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
OFFSET
#define OFFSET(x)
Definition: af_acrossover.c:69
AVERROR
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
opt.h
ff_make_format_list
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:300
out
FILE * out
Definition: movenc.c:54
ff_set_common_channel_layouts
int ff_set_common_channel_layouts(AVFilterContext *ctx, AVFilterChannelLayouts *layouts)
A helper for query_formats() which sets all links to the same list of channel layouts/sample rates.
Definition: formats.c:586
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1075
sample_fmts
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:716
CrossoverChannel
Definition: af_acrossover.c:48
layouts
enum MovChannelLayoutTag * layouts
Definition: mov_chan.c:434
inlink
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
Definition: filter_design.txt:212
av_asprintf
char * av_asprintf(const char *fmt,...)
Definition: avstring.c:113
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:203
ff_all_channel_counts
AVFilterChannelLayouts * ff_all_channel_counts(void)
Construct an AVFilterChannelLayouts coding for any channel layout, with known or unknown disposition.
Definition: formats.c:454
end
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:92
AudioConvert::channels
int channels
Definition: audio_convert.c:54
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:300
AVOption
AVOption.
Definition: opt.h:246
b
#define b
Definition: input.c:41
MAX_SPLITS
#define MAX_SPLITS
Definition: af_acrossover.c:38
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(acrossover)
fc
#define fc(width, name, range_min, range_max)
Definition: cbs_av1.c:555
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:148
AudioCrossoverContext::frames
AVFrame * frames[MAX_BANDS]
Definition: af_acrossover.c:66
AVFormatContext::internal
AVFormatInternal * internal
An opaque field for libavformat internal usage.
Definition: avformat.h:1788
CrossoverChannel::lp
BiquadContext lp[MAX_BANDS][4]
Definition: af_acrossover.c:49
sample_rate
sample_rate
Definition: ffmpeg_filter.c:192
filter_channels
static int filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: af_acrossover.c:260
AudioCrossoverContext::input_frame
AVFrame * input_frame
Definition: af_acrossover.c:65
AVFilterFormats
A list of supported formats for one end of a filter link.
Definition: formats.h:64
formats.h
BiquadContext
Definition: af_acrossover.c:41
AF
#define AF
Definition: af_acrossover.c:70
acrossover_options
static const AVOption acrossover_options[]
Definition: af_acrossover.c:72
BiquadContext::i1
double i1
Definition: af_acrossover.c:44
fail
#define fail()
Definition: checkasm.h:123
frames
if it could not because there are no more frames
Definition: filter_design.txt:266
AudioCrossoverContext
Definition: af_acrossover.c:53
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:54
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
av_cold
#define av_cold
Definition: attributes.h:90
ff_set_common_formats
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:605
s
#define s(width, name)
Definition: cbs_vp9.c:257
AudioCrossoverContext::xover
CrossoverChannel * xover
Definition: af_acrossover.c:63
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
av_strtok
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:184
BiquadContext::i2
double i2
Definition: af_acrossover.c:44
set_lp
static void set_lp(BiquadContext *b, double fc, double q, double sr)
Definition: af_acrossover.c:140
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
ctx
AVFormatContext * ctx
Definition: movenc.c:48
f
#define f(width, name)
Definition: cbs_vp9.c:255
arg
const char * arg
Definition: jacosubdec.c:66
BiquadContext::o1
double o1
Definition: af_acrossover.c:45
av_sscanf
int av_sscanf(const char *string, const char *format,...)
See libc sscanf manual for more information.
Definition: avsscanf.c:962
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:67
NULL
#define NULL
Definition: coverity.c:32
src
#define src
Definition: vp8dsp.c:254
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_acrossover.c:301
AudioCrossoverContext::nb_splits
int nb_splits
Definition: af_acrossover.c:60
CrossoverChannel::hp
BiquadContext hp[MAX_BANDS][4]
Definition: af_acrossover.c:50
for
for(j=16;j >0;--j)
Definition: h264pred_template.c:469
AVFILTER_FLAG_DYNAMIC_OUTPUTS
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
Definition: avfilter.h:111
eval.h
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_acrossover.c:218
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:188
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_acrossover.c:342
BiquadContext::b1
double b1
Definition: af_acrossover.c:43
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:59
sample
#define sample
Definition: flacdsp_template.c:44
BiquadContext::a0
double a0
Definition: af_acrossover.c:42
FFMIN
#define FFMIN(a, b)
Definition: common.h:96
AudioCrossoverContext::splits
float * splits
Definition: af_acrossover.c:61
attributes.h
AudioCrossoverContext::order
int order
Definition: af_acrossover.c:57
M_PI
#define M_PI
Definition: mathematics.h:52
ff_af_acrossover
AVFilter ff_af_acrossover
Definition: af_acrossover.c:364
biquad_process
static double biquad_process(BiquadContext *b, double in)
Definition: af_acrossover.c:248
internal.h
in
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
Definition: audio_convert.c:326
AudioCrossoverContext::filter_count
int filter_count
Definition: af_acrossover.c:59
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
internal.h
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:784
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
BiquadContext::a1
double a1
Definition: af_acrossover.c:42
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:60
set_hp
static void set_hp(BiquadContext *b, double fc, double q, double sr)
Definition: af_acrossover.c:155
inputs
static const AVFilterPad inputs[]
Definition: af_acrossover.c:354
AVFilter
Filter definition.
Definition: avfilter.h:144
ret
ret
Definition: filter_design.txt:187
AVFilterPad::type
enum AVMediaType type
AVFilterPad type.
Definition: internal.h:65
M_SQRT1_2
#define M_SQRT1_2
Definition: mathematics.h:58
ff_all_samplerates
AVFilterFormats * ff_all_samplerates(void)
Definition: formats.c:439
init
static av_cold int init(AVFilterContext *ctx)
Definition: af_acrossover.c:83
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
Definition: mem.c:245
channel_layout.h
BiquadContext::b2
double b2
Definition: af_acrossover.c:43
ff_insert_outpad
static int ff_insert_outpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new output pad for the filter.
Definition: internal.h:274
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
avfilter.h
MAX_BANDS
#define MAX_BANDS
Definition: af_acrossover.c:39
AV_SAMPLE_FMT_DBLP
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition: samplefmt.h:70
AVFilterContext
An instance of a filter.
Definition: avfilter.h:338
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:116
audio.h
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_acrossover.c:170
alpha
static const int16_t alpha[]
Definition: ilbcdata.h:55
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
BiquadContext::o2
double o2
Definition: af_acrossover.c:45
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
ff_set_common_samplerates
int ff_set_common_samplerates(AVFilterContext *ctx, AVFilterFormats *samplerates)
Definition: formats.c:593
avstring.h
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:227
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232
AudioCrossoverContext::splits_str
char * splits_str
Definition: af_acrossover.c:56