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

Go to the source code of this file.

Data Structures

struct  Coeffs
 
struct  ATiltContext
 
struct  ThreadData
 Used for passing data between threads. More...
 

Macros

#define MAX_ORDER   30
 
#define FILTER(name, type)
 
#define OFFSET(x)   offsetof(ATiltContext, x)
 
#define FLAGS   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 

Functions

static double prewarp (double w, double T, double wp)
 
static double mz (int i, double w0, double r, double alpha)
 
static double mp (int i, double w0, double r)
 
static double mzh (int i, double T, double w0, double r, double alpha)
 
static double mph (int i, double T, double w0, double r)
 
static void set_tf1s (Coeffs *coeffs, double b1, double b0, double a0, double w1, double sr, double alpha)
 
static void set_filter (AVFilterContext *ctx, int order, double sr, double f0, double bw, double alpha)
 
static int get_coeffs (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
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)
 
 AVFILTER_DEFINE_CLASS (atilt)
 

Variables

static const AVOption atilt_options []
 
static const AVFilterPad inputs []
 
const AVFilter ff_af_atilt
 

Macro Definition Documentation

◆ MAX_ORDER

#define MAX_ORDER   30

Definition at line 25 of file af_atilt.c.

◆ FILTER

#define FILTER (   name,
  type 
)

Definition at line 119 of file af_atilt.c.

◆ OFFSET

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

Definition at line 225 of file af_atilt.c.

◆ FLAGS

Definition at line 226 of file af_atilt.c.

Function Documentation

◆ prewarp()

static double prewarp ( double  w,
double  T,
double  wp 
)
static

Definition at line 49 of file af_atilt.c.

Referenced by mph(), and mzh().

◆ mz()

static double mz ( int  i,
double  w0,
double  r,
double  alpha 
)
static

Definition at line 54 of file af_atilt.c.

Referenced by mzh().

◆ mp()

static double mp ( int  i,
double  w0,
double  r 
)
static

◆ mzh()

static double mzh ( int  i,
double  T,
double  w0,
double  r,
double  alpha 
)
static

Definition at line 64 of file af_atilt.c.

Referenced by set_filter().

◆ mph()

static double mph ( int  i,
double  T,
double  w0,
double  r 
)
static

Definition at line 69 of file af_atilt.c.

Referenced by set_filter().

◆ set_tf1s()

static void set_tf1s ( Coeffs coeffs,
double  b1,
double  b0,
double  a0,
double  w1,
double  sr,
double  alpha 
)
static

Definition at line 74 of file af_atilt.c.

Referenced by set_filter().

◆ set_filter()

static void set_filter ( AVFilterContext ctx,
int  order,
double  sr,
double  f0,
double  bw,
double  alpha 
)
static

Definition at line 86 of file af_atilt.c.

Referenced by get_coeffs().

◆ get_coeffs()

static int get_coeffs ( AVFilterContext ctx)
static

Definition at line 105 of file af_atilt.c.

Referenced by config_input(), and process_command().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 161 of file af_atilt.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 178 of file af_atilt.c.

◆ 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 206 of file af_atilt.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 218 of file af_atilt.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( atilt  )

Variable Documentation

◆ atilt_options

const AVOption atilt_options[]
static
Initial value:
= {
{ "freq", "set central frequency",OFFSET(freq), AV_OPT_TYPE_DOUBLE, {.dbl=10000}, 20, 192000, FLAGS },
{ "slope", "set filter slope", OFFSET(slope), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS },
{ "width", "set filter width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=1000}, 100, 10000, FLAGS },
{ "order", "set filter order", OFFSET(order), AV_OPT_TYPE_INT, {.i64=5}, 2,MAX_ORDER, FLAGS },
{ "level", "set input level", OFFSET(level), AV_OPT_TYPE_DOUBLE, {.dbl=1.}, 0., 4., FLAGS },
{ NULL }
}

Definition at line 228 of file af_atilt.c.

◆ inputs

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

Definition at line 239 of file af_atilt.c.

◆ ff_af_atilt

const AVFilter ff_af_atilt
Initial value:
= {
.name = "atilt",
.description = NULL_IF_CONFIG_SMALL("Apply spectral tilt to audio."),
.priv_size = sizeof(ATiltContext),
.priv_class = &atilt_class,
.process_command = process_command,
}

Definition at line 248 of file af_atilt.c.

AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:66
level
uint8_t level
Definition: svq3.c:204
ATiltContext
Definition: af_atilt.c:33
width
#define width
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:192
FLAGS
#define FLAGS
Definition: af_atilt.c:226
NULL
#define NULL
Definition: coverity.c:32
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: af_atilt.c:206
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:32
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_atilt.c:218
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_atilt.c:161
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:106
MAX_ORDER
#define MAX_ORDER
Definition: af_atilt.c:25
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:147
inputs
static const AVFilterPad inputs[]
Definition: af_atilt.c:239
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_atilt.c:178
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
OFFSET
#define OFFSET(x)
Definition: af_atilt.c: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
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:193
FILTER_SAMPLEFMTS
#define FILTER_SAMPLEFMTS(...)
Definition: internal.h:180