FFmpeg
Data Structures | Macros | Functions | Variables
af_agate.c File Reference
#include "libavutil/audio_fifo.h"
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "audio.h"
#include "filters.h"
#include "formats.h"
#include "hermite.h"

Go to the source code of this file.

Data Structures

struct  AudioGateContext
 

Macros

#define OFFSET(x)   offsetof(AudioGateContext, x)
 
#define A   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define FAKE_INFINITY   (65536.0 * 65536.0)
 
#define IS_FAKE_INFINITY(value)   (fabs(value-FAKE_INFINITY) < 1.0)
 

Functions

static int agate_config_input (AVFilterLink *inlink)
 
static double output_gain (double lin_slope, double ratio, double thres, double knee, double knee_start, double knee_stop, double range, int mode)
 
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)
 

Variables

static const AVOption options []
 

Detailed Description

Audio (Sidechain) Gate filter

Definition in file af_agate.c.

Macro Definition Documentation

◆ OFFSET

#define OFFSET (   x)    offsetof(AudioGateContext, x)

Definition at line 65 of file af_agate.c.

◆ A

Definition at line 66 of file af_agate.c.

◆ FAKE_INFINITY

#define FAKE_INFINITY   (65536.0 * 65536.0)

Definition at line 112 of file af_agate.c.

◆ IS_FAKE_INFINITY

#define IS_FAKE_INFINITY (   value)    (fabs(value-FAKE_INFINITY) < 1.0)

Definition at line 115 of file af_agate.c.

Function Documentation

◆ agate_config_input()

static int agate_config_input ( AVFilterLink inlink)
static

Definition at line 90 of file af_agate.c.

◆ 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 
)
static

Definition at line 117 of file af_agate.c.

Referenced by gate().

◆ 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 
)
static

Definition at line 141 of file af_agate.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "level_in", "set input level", OFFSET(level_in), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, A },
{ "mode", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, A, "mode" },
{ "downward",0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, A, "mode" },
{ "upward", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, A, "mode" },
{ "range", "set max gain reduction", OFFSET(range), AV_OPT_TYPE_DOUBLE, {.dbl=0.06125}, 0, 1, A },
{ "threshold", "set threshold", OFFSET(threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0.125}, 0, 1, A },
{ "ratio", "set ratio", OFFSET(ratio), AV_OPT_TYPE_DOUBLE, {.dbl=2}, 1, 9000, A },
{ "attack", "set attack", OFFSET(attack), AV_OPT_TYPE_DOUBLE, {.dbl=20}, 0.01, 9000, A },
{ "release", "set release", OFFSET(release), AV_OPT_TYPE_DOUBLE, {.dbl=250}, 0.01, 9000, A },
{ "makeup", "set makeup gain", OFFSET(makeup), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 1, 64, A },
{ "knee", "set knee", OFFSET(knee), AV_OPT_TYPE_DOUBLE, {.dbl=2.828427125}, 1, 8, A },
{ "detection", "set detection", OFFSET(detection), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, A, "detection" },
{ "peak", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, A, "detection" },
{ "rms", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, A, "detection" },
{ "link", "set link", OFFSET(link), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, A, "link" },
{ "average", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, A, "link" },
{ "maximum", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, A, "link" },
{ "level_sc", "set sidechain gain", OFFSET(level_sc), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.015625, 64, A },
{ NULL }
}

Definition at line 68 of file af_agate.c.

AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:225
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
NULL
#define NULL
Definition: coverity.c:32
A
#define A
Definition: af_agate.c:66
OFFSET
#define OFFSET(x)
Definition: af_agate.c:65
mode
mode
Definition: ebur128.h:83
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232