FFmpeg
Data Structures | Macros | Functions | Variables
af_aemphasis.c File Reference
#include "libavutil/opt.h"
#include "avfilter.h"
#include "filters.h"
#include "audio.h"

Go to the source code of this file.

Data Structures

struct  BiquadCoeffs
 
struct  RIAACurve
 
struct  AudioEmphasisContext
 
struct  ThreadData
 Used for passing data between threads. More...
 

Macros

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

Functions

 AVFILTER_DEFINE_CLASS (aemphasis)
 
static void biquad_process (BiquadCoeffs *bq, double *dst, const double *src, int nb_samples, double *w, double level_in, double level_out)
 
static int filter_channels (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static void set_highshelf_rbj (BiquadCoeffs *bq, double freq, double q, double peak, double sr)
 
static void set_lp_rbj (BiquadCoeffs *bq, double fc, double q, double sr, double gain)
 
static double freq_gain (BiquadCoeffs *c, double freq, double sr)
 
static int config_input (AVFilterLink *inlink)
 
static int process_command (AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption aemphasis_options []
 
static const AVFilterPad avfilter_af_aemphasis_inputs []
 
const AVFilter ff_af_aemphasis
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 46 of file af_aemphasis.c.

◆ FLAGS

Definition at line 47 of file af_aemphasis.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( aemphasis  )

◆ biquad_process()

static void biquad_process ( BiquadCoeffs bq,
double dst,
const double src,
int  nb_samples,
double w,
double  level_in,
double  level_out 
)
inlinestatic

Definition at line 70 of file af_aemphasis.c.

Referenced by filter_channels().

◆ filter_channels()

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

Definition at line 100 of file af_aemphasis.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 127 of file af_aemphasis.c.

◆ set_highshelf_rbj()

static void set_highshelf_rbj ( BiquadCoeffs bq,
double  freq,
double  q,
double  peak,
double  sr 
)
inlinestatic

Definition at line 154 of file af_aemphasis.c.

Referenced by config_input().

◆ set_lp_rbj()

static void set_lp_rbj ( BiquadCoeffs bq,
double  fc,
double  q,
double  sr,
double  gain 
)
inlinestatic

Definition at line 178 of file af_aemphasis.c.

Referenced by config_input().

◆ freq_gain()

static double freq_gain ( BiquadCoeffs c,
double  freq,
double  sr 
)
static

Definition at line 192 of file af_aemphasis.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 205 of file af_aemphasis.c.

Referenced by process_command().

◆ process_command()

static int process_command ( AVFilterContext ctx,
const char *  cmd,
const char *  args,
char *  res,
int  res_len,
int  flags 
)
static

Definition at line 336 of file af_aemphasis.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 348 of file af_aemphasis.c.

Variable Documentation

◆ aemphasis_options

const AVOption aemphasis_options[]
static
Initial value:
= {
{ "level_in", "set input gain", OFFSET(level_in), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 64, FLAGS },
{ "level_out", "set output gain", OFFSET(level_out), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 64, FLAGS },
{ "mode", "set filter mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, .unit = "mode" },
{ "reproduction", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, .unit = "mode" },
{ "production", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, .unit = "mode" },
{ "type", "set filter type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=4}, 0, 8, FLAGS, .unit = "type" },
{ "col", "Columbia", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, .unit = "type" },
{ "emi", "EMI", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, .unit = "type" },
{ "bsi", "BSI (78RPM)", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, .unit = "type" },
{ "riaa", "RIAA", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, FLAGS, .unit = "type" },
{ "cd", "Compact Disc (CD)", 0, AV_OPT_TYPE_CONST, {.i64=4}, 0, 0, FLAGS, .unit = "type" },
{ "50fm", "50µs (FM)", 0, AV_OPT_TYPE_CONST, {.i64=5}, 0, 0, FLAGS, .unit = "type" },
{ "75fm", "75µs (FM)", 0, AV_OPT_TYPE_CONST, {.i64=6}, 0, 0, FLAGS, .unit = "type" },
{ "50kf", "50µs (FM-KF)", 0, AV_OPT_TYPE_CONST, {.i64=7}, 0, 0, FLAGS, .unit = "type" },
{ "75kf", "75µs (FM-KF)", 0, AV_OPT_TYPE_CONST, {.i64=8}, 0, 0, FLAGS, .unit = "type" },
{ NULL }
}

Definition at line 49 of file af_aemphasis.c.

◆ avfilter_af_aemphasis_inputs

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

Definition at line 355 of file af_aemphasis.c.

◆ ff_af_aemphasis

const AVFilter ff_af_aemphasis
Initial value:
= {
.name = "aemphasis",
.description = NULL_IF_CONFIG_SMALL("Audio emphasis."),
.priv_size = sizeof(AudioEmphasisContext),
.priv_class = &aemphasis_class,
.process_command = process_command,
}

Definition at line 364 of file af_aemphasis.c.

OFFSET
#define OFFSET(x)
Definition: af_aemphasis.c:46
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
mode
Definition: swscale.c:52
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_aemphasis.c:127
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
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition: opt.h:267
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: af_aemphasis.c:336
avfilter_af_aemphasis_inputs
static const AVFilterPad avfilter_af_aemphasis_inputs[]
Definition: af_aemphasis.c:355
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
NULL
#define NULL
Definition: coverity.c:32
ff_audio_default_filterpad
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
FILTER_SINGLE_SAMPLEFMT
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
Definition: filters.h:255
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:94
AudioEmphasisContext
Definition: af_aemphasis.c:36
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:182
FLAGS
#define FLAGS
Definition: af_aemphasis.c:47
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
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:152
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_aemphasis.c:205
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_aemphasis.c:348
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299