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

Go to the source code of this file.

Data Structures

struct  ChanCache
 
struct  BiquadsContext
 
struct  ThreadData
 Used for passing data between threads. More...
 

Macros

#define BIQUAD_FILTER(name, type, min, max, need_clipping)
 
#define BIQUAD_DII_FILTER(name, type, min, max, need_clipping)
 
#define BIQUAD_TDII_FILTER(name, type, min, max, need_clipping)
 
#define BIQUAD_LATT_FILTER(name, type, min, max, need_clipping)
 
#define BIQUAD_SVF_FILTER(name, type, min, max, need_clipping)
 
#define OFFSET(x)   offsetof(BiquadsContext, x)
 
#define FLAGS   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 
#define AF   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define DEFINE_BIQUAD_FILTER_2(name_, description_, priv_class_)
 
#define DEFINE_BIQUAD_FILTER(name, description)
 

Enumerations

enum  FilterType {
  DC_TYPE, AC_TYPE, SQ_TYPE, PS_TYPE,
  NB_TYPES, BUTTERWORTH, CHEBYSHEV1, CHEBYSHEV2,
  NB_TYPES, biquad, equalizer, bass,
  treble, bandpass, bandreject, allpass,
  highpass, lowpass, lowshelf, highshelf,
  WEAK, STRONG, NB_FILTER, LOWPASS,
  FLAT, AFLAT, CHROMA, COLOR,
  ACOLOR, XFLAT, YFLAT, NB_FILTERS
}
 
enum  WidthType {
  NONE, HERTZ, OCTAVE, QFACTOR,
  SLOPE, KHERTZ, NB_WTYPE
}
 
enum  TransformType {
  PREDICTOR_TRANSFORM = 0, COLOR_TRANSFORM = 1, SUBTRACT_GREEN = 2, COLOR_INDEXING_TRANSFORM = 3,
  DI, DII, TDII, LATT,
  SVF, NB_TTYPE
}
 

Functions

static int query_formats (AVFilterContext *ctx)
 
static void convert_dir2latt (BiquadsContext *s)
 
static void convert_dir2svf (BiquadsContext *s)
 
static int config_filter (AVFilterLink *outlink, int reset)
 
static int config_output (AVFilterLink *outlink)
 
static int filter_channel (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *buf)
 
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 AVFilterPad inputs []
 
static const AVFilterPad outputs []
 

Macro Definition Documentation

◆ BIQUAD_FILTER

#define BIQUAD_FILTER (   name,
  type,
  min,
  max,
  need_clipping 
)

Definition at line 190 of file af_biquads.c.

◆ BIQUAD_DII_FILTER

#define BIQUAD_DII_FILTER (   name,
  type,
  min,
  max,
  need_clipping 
)

Definition at line 273 of file af_biquads.c.

◆ BIQUAD_TDII_FILTER

#define BIQUAD_TDII_FILTER (   name,
  type,
  min,
  max,
  need_clipping 
)

Definition at line 321 of file af_biquads.c.

◆ BIQUAD_LATT_FILTER

#define BIQUAD_LATT_FILTER (   name,
  type,
  min,
  max,
  need_clipping 
)

Definition at line 368 of file af_biquads.c.

◆ BIQUAD_SVF_FILTER

#define BIQUAD_SVF_FILTER (   name,
  type,
  min,
  max,
  need_clipping 
)

Definition at line 423 of file af_biquads.c.

◆ OFFSET

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

Definition at line 938 of file af_biquads.c.

◆ FLAGS

Definition at line 939 of file af_biquads.c.

◆ AF

Definition at line 940 of file af_biquads.c.

◆ DEFINE_BIQUAD_FILTER_2

#define DEFINE_BIQUAD_FILTER_2 (   name_,
  description_,
  priv_class_ 
)
Value:
static av_cold int name_##_init(AVFilterContext *ctx) \
{ \
BiquadsContext *s = ctx->priv; \
s->filter_type = name_; \
return 0; \
} \
\
const AVFilter ff_af_##name_ = { \
.name = #name_, \
.description = NULL_IF_CONFIG_SMALL(description_), \
.priv_class = &priv_class_##_class, \
.priv_size = sizeof(BiquadsContext), \
.init = name_##_init, \
.uninit = uninit, \
FILTER_OUTPUTS(outputs), \
FILTER_QUERY_FUNC(query_formats), \
.process_command = process_command, \
}

Definition at line 942 of file af_biquads.c.

◆ DEFINE_BIQUAD_FILTER

#define DEFINE_BIQUAD_FILTER (   name,
  description 
)
Value:
DEFINE_BIQUAD_FILTER_2(name, description, name)

Definition at line 964 of file af_biquads.c.

Enumeration Type Documentation

◆ FilterType

enum FilterType
Enumerator
DC_TYPE 
AC_TYPE 
SQ_TYPE 
PS_TYPE 
NB_TYPES 
BUTTERWORTH 
CHEBYSHEV1 
CHEBYSHEV2 
NB_TYPES 
biquad 
equalizer 
bass 
treble 
bandpass 
bandreject 
allpass 
highpass 
lowpass 
lowshelf 
highshelf 
WEAK 
STRONG 
NB_FILTER 
LOWPASS 
FLAT 
AFLAT 
CHROMA 
COLOR 
ACOLOR 
XFLAT 
YFLAT 
NB_FILTERS 

Definition at line 73 of file af_biquads.c.

◆ WidthType

enum WidthType
Enumerator
NONE 
HERTZ 
OCTAVE 
QFACTOR 
SLOPE 
KHERTZ 
NB_WTYPE 

Definition at line 87 of file af_biquads.c.

◆ TransformType

Enumerator
PREDICTOR_TRANSFORM 
COLOR_TRANSFORM 
SUBTRACT_GREEN 
COLOR_INDEXING_TRANSFORM 
DI 
DII 
TDII 
LATT 
SVF 
NB_TTYPE 

Definition at line 97 of file af_biquads.c.

Function Documentation

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 147 of file af_biquads.c.

◆ convert_dir2latt()

static void convert_dir2latt ( BiquadsContext s)
static

Definition at line 471 of file af_biquads.c.

Referenced by config_filter().

◆ convert_dir2svf()

static void convert_dir2svf ( BiquadsContext s)
static

Definition at line 488 of file af_biquads.c.

Referenced by config_filter().

◆ config_filter()

static int config_filter ( AVFilterLink outlink,
int  reset 
)
static

Definition at line 506 of file af_biquads.c.

Referenced by config_output(), and process_command().

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 825 of file af_biquads.c.

◆ filter_channel()

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

Definition at line 834 of file af_biquads.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame buf 
)
static

Definition at line 861 of file af_biquads.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 902 of file af_biquads.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 915 of file af_biquads.c.

Variable Documentation

◆ inputs

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

Definition at line 922 of file af_biquads.c.

◆ outputs

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

Definition at line 930 of file af_biquads.c.

name
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 default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
BiquadsContext
Definition: af_biquads.c:112
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:169
init
static int init
Definition: av_tx.c:47
outputs
static const AVFilterPad outputs[]
Definition: af_biquads.c:930
description
Tag description
Definition: snow.txt:206
av_cold
#define av_cold
Definition: attributes.h:90
s
#define s(width, name)
Definition: cbs_vp9.c:257
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
ctx
AVFormatContext * ctx
Definition: movenc.c:48
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
Definition: af_biquads.c:861
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: af_biquads.c:902
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
config_output
static int config_output(AVFilterLink *outlink)
Definition: af_biquads.c:825
inputs
static const AVFilterPad inputs[]
Definition: af_biquads.c:922
AVFILTER_DEFINE_CLASS
#define AVFILTER_DEFINE_CLASS(fname)
Definition: internal.h:326
AVFilter
Filter definition.
Definition: avfilter.h:165
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_biquads.c:147
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_biquads.c:915
AVFilterContext
An instance of a filter.
Definition: avfilter.h:402
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
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:154