FFmpeg
Data Structures | Macros | Functions | Variables
af_adynamicequalizer.c File Reference
#include <float.h>
#include "libavutil/opt.h"
#include "avfilter.h"
#include "audio.h"
#include "formats.h"

Go to the source code of this file.

Data Structures

struct  AudioDynamicEqualizerContext
 
struct  ThreadData
 Used for passing data between threads. More...
 

Macros

#define OFFSET(x)   offsetof(AudioDynamicEqualizerContext, x)
 
#define FLAGS   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 

Functions

static int config_input (AVFilterLink *inlink)
 
static double get_svf (double in, double *m, double *a, double *b)
 
static double from_dB (double x)
 
static double to_dB (double x)
 
static double sqr (double x)
 
static double get_gain (double in, double srate, double makeup, double aattack, double iratio, double knee, double range, double thresdb, double slewfactor, double *state, double attack_coeff, double release_coeff, double nc)
 
static int filter_channels (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static double get_coef (double x, double sr)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void uninit (AVFilterContext *ctx)
 
 AVFILTER_DEFINE_CLASS (adynamicequalizer)
 

Variables

static const AVOption adynamicequalizer_options []
 
static const AVFilterPad inputs []
 
static const AVFilterPad outputs []
 
const AVFilter ff_af_adynamicequalizer
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 290 of file af_adynamicequalizer.c.

◆ FLAGS

Definition at line 291 of file af_adynamicequalizer.c.

Function Documentation

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 49 of file af_adynamicequalizer.c.

◆ get_svf()

static double get_svf ( double  in,
double m,
double a,
double b 
)
static

Definition at line 61 of file af_adynamicequalizer.c.

Referenced by filter_channels().

◆ from_dB()

static double from_dB ( double  x)
inlinestatic

Definition at line 74 of file af_adynamicequalizer.c.

Referenced by get_gain().

◆ to_dB()

static double to_dB ( double  x)
inlinestatic

Definition at line 79 of file af_adynamicequalizer.c.

Referenced by filter_channels(), and get_gain().

◆ sqr()

static double sqr ( double  x)
inlinestatic

Definition at line 84 of file af_adynamicequalizer.c.

Referenced by bitreduction(), encode_block(), get_gain(), and get_visual_weight().

◆ get_gain()

static double get_gain ( double  in,
double  srate,
double  makeup,
double  aattack,
double  iratio,
double  knee,
double  range,
double  thresdb,
double  slewfactor,
double state,
double  attack_coeff,
double  release_coeff,
double  nc 
)
static

Definition at line 89 of file af_adynamicequalizer.c.

Referenced by filter_channels().

◆ filter_channels()

static int filter_channels ( AVFilterContext ctx,
void *  arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 141 of file af_adynamicequalizer.c.

Referenced by filter_frame().

◆ get_coef()

static double get_coef ( double  x,
double  sr 
)
static

Definition at line 246 of file af_adynamicequalizer.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 251 of file af_adynamicequalizer.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 283 of file af_adynamicequalizer.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( adynamicequalizer  )

Variable Documentation

◆ adynamicequalizer_options

const AVOption adynamicequalizer_options[]
static
Initial value:
= {
{ "threshold", "set detection threshold", OFFSET(threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 100, FLAGS },
{ "dfrequency", "set detection frequency", OFFSET(dfrequency), AV_OPT_TYPE_DOUBLE, {.dbl=1000}, 2, 1000000, FLAGS },
{ "dqfactor", "set detection Q factor", OFFSET(dqfactor), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.001, 1000, FLAGS },
{ "tfrequency", "set target frequency", OFFSET(tfrequency), AV_OPT_TYPE_DOUBLE, {.dbl=1000}, 2, 1000000, FLAGS },
{ "tqfactor", "set target Q factor", OFFSET(tqfactor), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.001, 1000, FLAGS },
{ "attack", "set attack duration", OFFSET(attack), AV_OPT_TYPE_DOUBLE, {.dbl=20}, 1, 2000, FLAGS },
{ "release", "set release duration", OFFSET(release), AV_OPT_TYPE_DOUBLE, {.dbl=200}, 1, 2000, FLAGS },
{ "knee", "set knee factor", OFFSET(knee), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 8, FLAGS },
{ "ratio", "set ratio factor", OFFSET(ratio), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 1, 20, FLAGS },
{ "makeup", "set makeup gain", OFFSET(makeup), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 30, FLAGS },
{ "range", "set max gain", OFFSET(range), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 200, FLAGS },
{ "slew", "set slew factor", OFFSET(slew), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 1, 200, FLAGS },
{ "mode", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, -1, 1, FLAGS, "mode" },
{ "listen", 0, 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, FLAGS, "mode" },
{ "cut", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "mode" },
{ "boost", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "mode" },
{ "tftype", "set target filter type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, "type" },
{ "bell", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "type" },
{ "lowshelf", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "type" },
{ "highshelf",0, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "type" },
{ NULL }
}

Definition at line 293 of file af_adynamicequalizer.c.

◆ inputs

const AVFilterPad inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
}

Definition at line 319 of file af_adynamicequalizer.c.

◆ outputs

const AVFilterPad outputs[]
static
Initial value:
= {
{
.name = "default",
},
}

Definition at line 328 of file af_adynamicequalizer.c.

◆ ff_af_adynamicequalizer

const AVFilter ff_af_adynamicequalizer
Initial value:
= {
.name = "adynamicequalizer",
.description = NULL_IF_CONFIG_SMALL("Apply Dynamic Equalization of input audio."),
.priv_size = sizeof(AudioDynamicEqualizerContext),
.priv_class = &adynamicequalizer_class,
.process_command = ff_filter_process_command,
}

Definition at line 335 of file af_adynamicequalizer.c.

FILTER_SINGLE_SAMPLEFMT
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
Definition: internal.h:183
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_adynamicequalizer.c:49
FLAGS
#define FLAGS
Definition: af_adynamicequalizer.c:291
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_adynamicequalizer.c:251
type
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 type
Definition: writing_filters.txt:86
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_adynamicequalizer.c:283
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:227
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:190
NULL
#define NULL
Definition: coverity.c:32
outputs
static const AVFilterPad outputs[]
Definition: af_adynamicequalizer.c:328
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:116
OFFSET
#define OFFSET(x)
Definition: af_adynamicequalizer.c:290
AudioDynamicEqualizerContext
Definition: af_adynamicequalizer.c:26
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:863
mode
mode
Definition: ebur128.h:83
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AV_SAMPLE_FMT_DBLP
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition: samplefmt.h:67
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:127
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:191
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:160
inputs
static const AVFilterPad inputs[]
Definition: af_adynamicequalizer.c:319
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234