FFmpeg
Data Structures | Macros | Functions | Variables
af_aemphasis.c File Reference
#include "libavutil/opt.h"
#include "avfilter.h"
#include "internal.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 int query_formats (AVFilterContext *ctx)
 
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 []
 
static const AVFilterPad avfilter_af_aemphasis_outputs []
 
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.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 154 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 184 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 208 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 222 of file af_aemphasis.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 235 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 366 of file af_aemphasis.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 378 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, "mode" },
{ "reproduction", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "mode" },
{ "production", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "mode" },
{ "type", "set filter type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=4}, 0, 8, FLAGS, "type" },
{ "col", "Columbia", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "type" },
{ "emi", "EMI", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "type" },
{ "bsi", "BSI (78RPM)", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "type" },
{ "riaa", "RIAA", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, FLAGS, "type" },
{ "cd", "Compact Disc (CD)", 0, AV_OPT_TYPE_CONST, {.i64=4}, 0, 0, FLAGS, "type" },
{ "50fm", "50µs (FM)", 0, AV_OPT_TYPE_CONST, {.i64=5}, 0, 0, FLAGS, "type" },
{ "75fm", "75µs (FM)", 0, AV_OPT_TYPE_CONST, {.i64=6}, 0, 0, FLAGS, "type" },
{ "50kf", "50µs (FM-KF)", 0, AV_OPT_TYPE_CONST, {.i64=7}, 0, 0, FLAGS, "type" },
{ "75kf", "75µs (FM-KF)", 0, AV_OPT_TYPE_CONST, {.i64=8}, 0, 0, FLAGS, "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,
},
{ NULL }
}

Definition at line 385 of file af_aemphasis.c.

◆ avfilter_af_aemphasis_outputs

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

Definition at line 395 of file af_aemphasis.c.

◆ ff_af_aemphasis

const AVFilter ff_af_aemphasis
Initial value:

Definition at line 403 of file af_aemphasis.c.

OFFSET
#define OFFSET(x)
Definition: af_aemphasis.c:46
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
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
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:227
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:366
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
avfilter_af_aemphasis_inputs
static const AVFilterPad avfilter_af_aemphasis_inputs[]
Definition: af_aemphasis.c:385
NULL
#define NULL
Definition: coverity.c:32
avfilter_af_aemphasis_outputs
static const AVFilterPad avfilter_af_aemphasis_outputs[]
Definition: af_aemphasis.c:395
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_aemphasis.c:154
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
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:126
FLAGS
#define FLAGS
Definition: af_aemphasis.c:47
mode
mode
Definition: ebur128.h:83
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
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:117
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_aemphasis.c:235
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_aemphasis.c:378
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234