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"
#include "formats.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 []
 
static const AVFilterPad outputs []
 
const AVFilter ff_af_atilt
 

Macro Definition Documentation

◆ MAX_ORDER

#define MAX_ORDER   30

Definition at line 26 of file af_atilt.c.

◆ FILTER

#define FILTER (   name,
  type 
)

Definition at line 120 of file af_atilt.c.

◆ OFFSET

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

Definition at line 226 of file af_atilt.c.

◆ FLAGS

Definition at line 227 of file af_atilt.c.

Function Documentation

◆ prewarp()

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

Definition at line 50 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 55 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 65 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 70 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 75 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 87 of file af_atilt.c.

Referenced by get_coeffs().

◆ get_coeffs()

static int get_coeffs ( AVFilterContext ctx)
static

Definition at line 106 of file af_atilt.c.

Referenced by config_input(), and process_command().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 162 of file af_atilt.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 179 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 207 of file af_atilt.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 219 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 229 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 240 of file af_atilt.c.

◆ outputs

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

Definition at line 249 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 256 of file af_atilt.c.

AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:69
level
uint8_t level
Definition: svq3.c:204
ATiltContext
Definition: af_atilt.c:34
width
#define width
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:226
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
FLAGS
#define FLAGS
Definition: af_atilt.c:227
outputs
static const AVFilterPad outputs[]
Definition: af_atilt.c:249
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:207
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_atilt.c:219
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_atilt.c:162
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
MAX_ORDER
#define MAX_ORDER
Definition: af_atilt.c:26
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:146
inputs
static const AVFilterPad inputs[]
Definition: af_atilt.c:240
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_atilt.c:179
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
AV_SAMPLE_FMT_DBLP
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition: samplefmt.h:70
OFFSET
#define OFFSET(x)
Definition: af_atilt.c:226
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:121
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
FILTER_SAMPLEFMTS
#define FILTER_SAMPLEFMTS(...)
Definition: internal.h:179