FFmpeg
af_agate.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2001-2010 Krzysztof Foltman, Markus Schmidt, Thor Harald Johansen, Damien Zammit
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, 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 /**
22  * @file
23  * Audio (Sidechain) Gate filter
24  */
25 
26 #include "libavutil/audio_fifo.h"
28 #include "libavutil/opt.h"
29 #include "avfilter.h"
30 #include "audio.h"
31 #include "filters.h"
32 #include "formats.h"
33 #include "hermite.h"
34 
35 typedef struct AudioGateContext {
36  const AVClass *class;
37 
38  double level_in;
39  double level_sc;
40  double attack;
41  double release;
42  double threshold;
43  double ratio;
44  double knee;
45  double makeup;
46  double range;
47  int link;
48  int detection;
49  int mode;
50 
51  double thres;
52  double knee_start;
53  double knee_stop;
55  double lin_knee_stop;
56  double lin_slope;
57  double attack_coeff;
58  double release_coeff;
59 
61  int64_t pts;
63 
64 #define OFFSET(x) offsetof(AudioGateContext, x)
65 #define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
66 
67 static const AVOption options[] = {
68  { "level_in", "set input level", OFFSET(level_in), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, A },
69  { "mode", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, A, "mode" },
70  { "downward",0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, A, "mode" },
71  { "upward", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, A, "mode" },
72  { "range", "set max gain reduction", OFFSET(range), AV_OPT_TYPE_DOUBLE, {.dbl=0.06125}, 0, 1, A },
73  { "threshold", "set threshold", OFFSET(threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0.125}, 0, 1, A },
74  { "ratio", "set ratio", OFFSET(ratio), AV_OPT_TYPE_DOUBLE, {.dbl=2}, 1, 9000, A },
75  { "attack", "set attack", OFFSET(attack), AV_OPT_TYPE_DOUBLE, {.dbl=20}, 0.01, 9000, A },
76  { "release", "set release", OFFSET(release), AV_OPT_TYPE_DOUBLE, {.dbl=250}, 0.01, 9000, A },
77  { "makeup", "set makeup gain", OFFSET(makeup), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 1, 64, A },
78  { "knee", "set knee", OFFSET(knee), AV_OPT_TYPE_DOUBLE, {.dbl=2.828427125}, 1, 8, A },
79  { "detection", "set detection", OFFSET(detection), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, A, "detection" },
80  { "peak", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, A, "detection" },
81  { "rms", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, A, "detection" },
82  { "link", "set link", OFFSET(link), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, A, "link" },
83  { "average", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, A, "link" },
84  { "maximum", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, A, "link" },
85  { "level_sc", "set sidechain gain", OFFSET(level_sc), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, A },
86  { NULL }
87 };
88 
89 AVFILTER_DEFINE_CLASS_EXT(agate_sidechaingate, "agate/sidechaingate", options);
90 
92 {
93  AVFilterContext *ctx = inlink->dst;
94  AudioGateContext *s = ctx->priv;
95  double lin_threshold = s->threshold;
96  double lin_knee_sqrt = sqrt(s->knee);
97 
98  if (s->detection)
99  lin_threshold *= lin_threshold;
100 
101  s->attack_coeff = FFMIN(1., 1. / (s->attack * inlink->sample_rate / 4000.));
102  s->release_coeff = FFMIN(1., 1. / (s->release * inlink->sample_rate / 4000.));
103  s->lin_knee_stop = lin_threshold * lin_knee_sqrt;
104  s->lin_knee_start = lin_threshold / lin_knee_sqrt;
105  s->thres = log(lin_threshold);
106  s->knee_start = log(s->lin_knee_start);
107  s->knee_stop = log(s->lin_knee_stop);
108 
109  return 0;
110 }
111 
112 // A fake infinity value (because real infinity may break some hosts)
113 #define FAKE_INFINITY (65536.0 * 65536.0)
114 
115 // Check for infinity (with appropriate-ish tolerance)
116 #define IS_FAKE_INFINITY(value) (fabs(value-FAKE_INFINITY) < 1.0)
117 
118 static double output_gain(double lin_slope, double ratio, double thres,
119  double knee, double knee_start, double knee_stop,
120  double range, int mode)
121 {
122  double slope = log(lin_slope);
123  double tratio = ratio;
124  double gain = 0.;
125  double delta = 0.;
126 
127  if (IS_FAKE_INFINITY(ratio))
128  tratio = 1000.;
129  gain = (slope - thres) * tratio + thres;
130  delta = tratio;
131 
132  if (mode) {
133  if (knee > 1. && slope < knee_stop)
134  gain = hermite_interpolation(slope, knee_stop, knee_start, ((knee_stop - thres) * tratio + thres), knee_start, delta, 1.);
135  } else {
136  if (knee > 1. && slope > knee_start)
137  gain = hermite_interpolation(slope, knee_start, knee_stop, ((knee_start - thres) * tratio + thres), knee_stop, delta, 1.);
138  }
139  return FFMAX(range, exp(gain - slope));
140 }
141 
142 static void gate(AudioGateContext *s,
143  const double *src, double *dst, const double *scsrc,
144  int nb_samples, double level_in, double level_sc,
145  AVFilterLink *inlink, AVFilterLink *sclink)
146 {
147  AVFilterContext *ctx = inlink->dst;
148  const double makeup = s->makeup;
149  const double attack_coeff = s->attack_coeff;
150  const double release_coeff = s->release_coeff;
151  int n, c;
152 
153  for (n = 0; n < nb_samples; n++, src += inlink->channels, dst += inlink->channels, scsrc += sclink->channels) {
154  double abs_sample = fabs(scsrc[0] * level_sc), gain = 1.0;
155  double factor;
156  int detected;
157 
158  if (s->link == 1) {
159  for (c = 1; c < sclink->channels; c++)
160  abs_sample = FFMAX(fabs(scsrc[c] * level_sc), abs_sample);
161  } else {
162  for (c = 1; c < sclink->channels; c++)
163  abs_sample += fabs(scsrc[c] * level_sc);
164 
165  abs_sample /= sclink->channels;
166  }
167 
168  if (s->detection)
169  abs_sample *= abs_sample;
170 
171  s->lin_slope += (abs_sample - s->lin_slope) * (abs_sample > s->lin_slope ? attack_coeff : release_coeff);
172 
173  if (s->mode)
174  detected = s->lin_slope > s->lin_knee_start;
175  else
176  detected = s->lin_slope < s->lin_knee_stop;
177 
178  if (s->lin_slope > 0.0 && detected)
179  gain = output_gain(s->lin_slope, s->ratio, s->thres,
180  s->knee, s->knee_start, s->knee_stop,
181  s->range, s->mode);
182 
183  factor = ctx->is_disabled ? 1.f : level_in * gain * makeup;
184  for (c = 0; c < inlink->channels; c++)
185  dst[c] = src[c] * factor;
186  }
187 }
188 
189 #if CONFIG_AGATE_FILTER
190 
191 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
192 {
193  const double *src = (const double *)in->data[0];
194  AVFilterContext *ctx = inlink->dst;
195  AVFilterLink *outlink = ctx->outputs[0];
196  AudioGateContext *s = ctx->priv;
197  AVFrame *out;
198  double *dst;
199 
200  if (av_frame_is_writable(in)) {
201  out = in;
202  } else {
203  out = ff_get_audio_buffer(outlink, in->nb_samples);
204  if (!out) {
205  av_frame_free(&in);
206  return AVERROR(ENOMEM);
207  }
209  }
210  dst = (double *)out->data[0];
211 
212  gate(s, src, dst, src, in->nb_samples,
213  s->level_in, s->level_in, inlink, inlink);
214 
215  if (out != in)
216  av_frame_free(&in);
217  return ff_filter_frame(outlink, out);
218 }
219 
220 static const AVFilterPad inputs[] = {
221  {
222  .name = "default",
223  .type = AVMEDIA_TYPE_AUDIO,
224  .filter_frame = filter_frame,
225  .config_props = agate_config_input,
226  },
227 };
228 
229 static const AVFilterPad outputs[] = {
230  {
231  .name = "default",
232  .type = AVMEDIA_TYPE_AUDIO,
233  },
234 };
235 
236 const AVFilter ff_af_agate = {
237  .name = "agate",
238  .description = NULL_IF_CONFIG_SMALL("Audio gate."),
239  .priv_class = &agate_sidechaingate_class,
240  .priv_size = sizeof(AudioGateContext),
244  .process_command = ff_filter_process_command,
246 };
247 
248 #endif /* CONFIG_AGATE_FILTER */
249 
250 #if CONFIG_SIDECHAINGATE_FILTER
251 
252 static int activate(AVFilterContext *ctx)
253 {
254  AudioGateContext *s = ctx->priv;
255  AVFrame *out = NULL, *in[2] = { NULL };
256  int ret, i, nb_samples;
257  double *dst;
258 
260  if ((ret = ff_inlink_consume_frame(ctx->inputs[0], &in[0])) > 0) {
261  av_audio_fifo_write(s->fifo[0], (void **)in[0]->extended_data,
262  in[0]->nb_samples);
263  av_frame_free(&in[0]);
264  }
265  if (ret < 0)
266  return ret;
267  if ((ret = ff_inlink_consume_frame(ctx->inputs[1], &in[1])) > 0) {
268  av_audio_fifo_write(s->fifo[1], (void **)in[1]->extended_data,
269  in[1]->nb_samples);
270  av_frame_free(&in[1]);
271  }
272  if (ret < 0)
273  return ret;
274 
275  nb_samples = FFMIN(av_audio_fifo_size(s->fifo[0]), av_audio_fifo_size(s->fifo[1]));
276  if (nb_samples) {
277  out = ff_get_audio_buffer(ctx->outputs[0], nb_samples);
278  if (!out)
279  return AVERROR(ENOMEM);
280  for (i = 0; i < 2; i++) {
281  in[i] = ff_get_audio_buffer(ctx->inputs[i], nb_samples);
282  if (!in[i]) {
283  av_frame_free(&in[0]);
284  av_frame_free(&in[1]);
285  av_frame_free(&out);
286  return AVERROR(ENOMEM);
287  }
288  av_audio_fifo_read(s->fifo[i], (void **)in[i]->data, nb_samples);
289  }
290 
291  dst = (double *)out->data[0];
292  out->pts = s->pts;
293  s->pts += av_rescale_q(nb_samples, (AVRational){1, ctx->outputs[0]->sample_rate}, ctx->outputs[0]->time_base);
294 
295  gate(s, (double *)in[0]->data[0], dst,
296  (double *)in[1]->data[0], nb_samples,
297  s->level_in, s->level_sc,
298  ctx->inputs[0], ctx->inputs[1]);
299 
300  av_frame_free(&in[0]);
301  av_frame_free(&in[1]);
302 
303  ret = ff_filter_frame(ctx->outputs[0], out);
304  if (ret < 0)
305  return ret;
306  }
307  FF_FILTER_FORWARD_STATUS(ctx->inputs[0], ctx->outputs[0]);
308  FF_FILTER_FORWARD_STATUS(ctx->inputs[1], ctx->outputs[0]);
309  if (ff_outlink_frame_wanted(ctx->outputs[0])) {
310  if (!av_audio_fifo_size(s->fifo[0]))
311  ff_inlink_request_frame(ctx->inputs[0]);
312  if (!av_audio_fifo_size(s->fifo[1]))
313  ff_inlink_request_frame(ctx->inputs[1]);
314  }
315  return 0;
316 }
317 
318 static int scquery_formats(AVFilterContext *ctx)
319 {
320  static const enum AVSampleFormat sample_fmts[] = {
323  };
325  &ctx->inputs[1]->outcfg.channel_layouts);
326  if (ret < 0)
327  return ret;
328 
329  /* This will link the channel properties of the main input and the output;
330  * it won't touch the second input as its channel_layouts is already set. */
332  return ret;
333 
335  return ret;
336 
338 }
339 
340 static int scconfig_output(AVFilterLink *outlink)
341 {
342  AVFilterContext *ctx = outlink->src;
343  AudioGateContext *s = ctx->priv;
344 
345  outlink->time_base = ctx->inputs[0]->time_base;
346 
347  s->fifo[0] = av_audio_fifo_alloc(ctx->inputs[0]->format, ctx->inputs[0]->channels, 1024);
348  s->fifo[1] = av_audio_fifo_alloc(ctx->inputs[1]->format, ctx->inputs[1]->channels, 1024);
349  if (!s->fifo[0] || !s->fifo[1])
350  return AVERROR(ENOMEM);
351 
352 
353  agate_config_input(ctx->inputs[0]);
354 
355  return 0;
356 }
357 
358 static av_cold void uninit(AVFilterContext *ctx)
359 {
360  AudioGateContext *s = ctx->priv;
361 
362  av_audio_fifo_free(s->fifo[0]);
363  av_audio_fifo_free(s->fifo[1]);
364 }
365 
366 static const AVFilterPad sidechaingate_inputs[] = {
367  {
368  .name = "main",
369  .type = AVMEDIA_TYPE_AUDIO,
370  },{
371  .name = "sidechain",
372  .type = AVMEDIA_TYPE_AUDIO,
373  },
374 };
375 
376 static const AVFilterPad sidechaingate_outputs[] = {
377  {
378  .name = "default",
379  .type = AVMEDIA_TYPE_AUDIO,
380  .config_props = scconfig_output,
381  },
382 };
383 
385  .name = "sidechaingate",
386  .description = NULL_IF_CONFIG_SMALL("Audio sidechain gate."),
387  .priv_class = &agate_sidechaingate_class,
388  .priv_size = sizeof(AudioGateContext),
389  .activate = activate,
390  .uninit = uninit,
391  FILTER_INPUTS(sidechaingate_inputs),
392  FILTER_OUTPUTS(sidechaingate_outputs),
393  FILTER_QUERY_FUNC(scquery_formats),
394  .process_command = ff_filter_process_command,
396 };
397 #endif /* CONFIG_SIDECHAINGATE_FILTER */
AudioGateContext::lin_slope
double lin_slope
Definition: af_agate.c:56
av_audio_fifo_free
void av_audio_fifo_free(AVAudioFifo *af)
Free an AVAudioFifo.
Definition: audio_fifo.c:45
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:88
AudioGateContext::range
double range
Definition: af_agate.c:46
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
AudioGateContext::attack
double attack
Definition: af_agate.c:40
out
FILE * out
Definition: movenc.c:54
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1018
sample_fmts
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:948
ff_channel_layouts_ref
int ff_channel_layouts_ref(AVFilterChannelLayouts *f, AVFilterChannelLayouts **ref)
Add *ref as a new reference to f.
Definition: formats.c:550
FILTER_SINGLE_SAMPLEFMT
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
Definition: internal.h:184
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_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:112
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:525
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:310
AudioGateContext::level_in
double level_in
Definition: af_agate.c:38
AudioGateContext::knee
double knee
Definition: af_agate.c:44
AVOption
AVOption.
Definition: opt.h:247
AudioGateContext::ratio
double ratio
Definition: af_agate.c:43
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:168
data
const char data[16]
Definition: mxf.c:143
ff_set_common_all_samplerates
int ff_set_common_all_samplerates(AVFilterContext *ctx)
Equivalent to ff_set_common_samplerates(ctx, ff_all_samplerates())
Definition: formats.c:689
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:153
ff_af_agate
const AVFilter ff_af_agate
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:329
formats.h
AVFILTER_DEFINE_CLASS_EXT
AVFILTER_DEFINE_CLASS_EXT(agate_sidechaingate, "agate/sidechaingate", options)
ff_inlink_consume_frame
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Definition: avfilter.c:1417
AudioGateContext::knee_start
double knee_start
Definition: af_agate.c:52
FF_FILTER_FORWARD_STATUS_BACK_ALL
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
Definition: filters.h:212
AVAudioFifo
Context for an Audio FIFO Buffer.
Definition: audio_fifo.c:34
AudioGateContext::makeup
double makeup
Definition: af_agate.c:45
AudioGateContext::lin_knee_start
double lin_knee_start
Definition: af_agate.c:54
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:50
av_cold
#define av_cold
Definition: attributes.h:90
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
ff_inlink_request_frame
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Definition: avfilter.c:1534
s
#define s(width, name)
Definition: cbs_vp9.c:257
AudioGateContext::mode
int mode
Definition: af_agate.c:49
hermite_interpolation
static double hermite_interpolation(double x, double x0, double x1, double p0, double p1, double m0, double m1)
Definition: hermite.h:22
av_audio_fifo_write
int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples)
Write data to an AVAudioFifo.
Definition: audio_fifo.c:112
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:226
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AudioGateContext::release
double release
Definition: af_agate.c:41
ff_set_common_formats_from_list
int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts)
Equivalent to ff_set_common_formats(ctx, ff_make_format_list(fmts))
Definition: formats.c:705
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:172
filters.h
ctx
AVFormatContext * ctx
Definition: movenc.c:48
av_rescale_q
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:141
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
link
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 link
Definition: filter_design.txt:23
if
if(ret)
Definition: filter_design.txt:179
output_gain
static double output_gain(double lin_slope, double ratio, double thres, double knee, double knee_start, double knee_stop, double range, int mode)
Definition: af_agate.c:118
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
fabs
static __device__ float fabs(float a)
Definition: cuda_runtime.h:182
NULL
#define NULL
Definition: coverity.c:32
A
#define A
Definition: af_agate.c:65
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:537
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
av_audio_fifo_alloc
AVAudioFifo * av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, int nb_samples)
Allocate an AVAudioFifo.
Definition: audio_fifo.c:59
activate
filter_frame For filters that do not use the activate() callback
src
#define src
Definition: vp8dsp.c:255
options
static const AVOption options[]
Definition: af_agate.c:67
AudioGateContext::thres
double thres
Definition: af_agate.c:51
filter_frame
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition: dolby_e.c:1050
AudioGateContext
Definition: af_agate.c:35
ff_set_common_all_channel_counts
int ff_set_common_all_channel_counts(AVFilterContext *ctx)
Equivalent to ff_set_common_channel_layouts(ctx, ff_all_channel_counts())
Definition: formats.c:671
exp
int8_t exp
Definition: eval.c:72
c
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
Definition: undefined.txt:32
AudioGateContext::attack_coeff
double attack_coeff
Definition: af_agate.c:57
OFFSET
#define OFFSET(x)
Definition: af_agate.c:64
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:117
AudioGateContext::level_sc
double level_sc
Definition: af_agate.c:39
hermite.h
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:59
av_frame_is_writable
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:473
AudioGateContext::lin_knee_stop
double lin_knee_stop
Definition: af_agate.c:55
ff_filter_process_command
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.
Definition: avfilter.c:882
AudioGateContext::fifo
AVAudioFifo * fifo[2]
Definition: af_agate.c:60
av_audio_fifo_size
int av_audio_fifo_size(AVAudioFifo *af)
Get the current number of samples in the AVAudioFifo available for reading.
Definition: audio_fifo.c:228
IS_FAKE_INFINITY
#define IS_FAKE_INFINITY(value)
Definition: af_agate.c:116
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:130
av_audio_fifo_read
int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples)
Read data from an AVAudioFifo.
Definition: audio_fifo.c:181
AVFrame::nb_samples
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:388
AudioGateContext::release_coeff
double release_coeff
Definition: af_agate.c:58
AudioGateContext::pts
int64_t pts
Definition: af_agate.c:61
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
delta
float delta
Definition: vorbis_enc_data.h:430
AudioGateContext::knee_stop
double knee_stop
Definition: af_agate.c:53
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
audio_fifo.h
ff_af_sidechaingate
const AVFilter ff_af_sidechaingate
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:56
AudioGateContext::link
int link
Definition: af_agate.c:47
AudioGateContext::threshold
double threshold
Definition: af_agate.c:42
AVFilter
Filter definition.
Definition: avfilter.h:149
ret
ret
Definition: filter_design.txt:187
channel_layout.h
mode
mode
Definition: ebur128.h:83
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
avfilter.h
AVFilterContext
An instance of a filter.
Definition: avfilter.h:386
factor
static const int factor[16]
Definition: vf_pp7.c:76
audio.h
FF_FILTER_FORWARD_STATUS
FF_FILTER_FORWARD_STATUS(inlink, outlink)
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
gate
static void gate(AudioGateContext *s, const double *src, double *dst, const double *scsrc, int nb_samples, double level_in, double level_sc, AVFilterLink *inlink, AVFilterLink *sclink)
Definition: af_agate.c:142
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
#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:138
AudioGateContext::detection
int detection
Definition: af_agate.c:48
uninit
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:282
ff_outlink_frame_wanted
the definition of that something depends on the semantic of the filter The callback must examine the status of the filter s links and proceed accordingly The status of output links is stored in the status_in and status_out fields and tested by the ff_outlink_frame_wanted() function. If this function returns true
AV_SAMPLE_FMT_DBL
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:64
agate_config_input
static int agate_config_input(AVFilterLink *inlink)
Definition: af_agate.c:91
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233