FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
af_biquads.c File Reference
#include "config_components.h"
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/ffmath.h"
#include "libavutil/opt.h"
#include "audio.h"
#include "avfilter.h"
#include "filters.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_TDI_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 BIQUAD_ZDF_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, TDI, TDII,
  LATT, SVF, ZDF, NB_TTYPE
}
 

Functions

static int query_formats (AVFilterContext *ctx)
 
static void convert_dir2latt (BiquadsContext *s)
 
static void convert_dir2svf (BiquadsContext *s)
 
static double convert_width2qfactor (double width, double frequency, double gain, double sample_rate, int width_type)
 
static void convert_dir2zdf (BiquadsContext *s, int sample_rate)
 
static int config_filter (AVFilterLink *outlink, int reset)
 
static int config_output (AVFilterLink *outlink)
 
static void reverse_samples (AVFrame *out, AVFrame *in, int p, int oo, int io, int nb_samples)
 
static int filter_channel (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *buf, int eof)
 
static int activate (AVFilterContext *ctx)
 
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 204 of file af_biquads.c.

◆ BIQUAD_DII_FILTER

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

Definition at line 287 of file af_biquads.c.

◆ BIQUAD_TDI_FILTER

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

Definition at line 335 of file af_biquads.c.

◆ BIQUAD_TDII_FILTER

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

Definition at line 391 of file af_biquads.c.

◆ BIQUAD_LATT_FILTER

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

Definition at line 438 of file af_biquads.c.

◆ BIQUAD_SVF_FILTER

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

Definition at line 494 of file af_biquads.c.

◆ BIQUAD_ZDF_FILTER

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

Definition at line 542 of file af_biquads.c.

◆ OFFSET

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

Definition at line 1402 of file af_biquads.c.

◆ FLAGS

Definition at line 1403 of file af_biquads.c.

◆ AF

Definition at line 1404 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_; \
s->pts = AV_NOPTS_VALUE; \
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 1406 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 1430 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 76 of file af_biquads.c.

◆ WidthType

enum WidthType
Enumerator
NONE 
HERTZ 
OCTAVE 
QFACTOR 
SLOPE 
KHERTZ 
NB_WTYPE 

Definition at line 90 of file af_biquads.c.

◆ TransformType

Enumerator
PREDICTOR_TRANSFORM 
COLOR_TRANSFORM 
SUBTRACT_GREEN 
COLOR_INDEXING_TRANSFORM 
DI 
DII 
TDI 
TDII 
LATT 
SVF 
ZDF 
NB_TTYPE 

Definition at line 100 of file af_biquads.c.

Function Documentation

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 161 of file af_biquads.c.

◆ convert_dir2latt()

static void convert_dir2latt ( BiquadsContext s)
static

Definition at line 592 of file af_biquads.c.

Referenced by config_filter().

◆ convert_dir2svf()

static void convert_dir2svf ( BiquadsContext s)
static

Definition at line 609 of file af_biquads.c.

Referenced by config_filter().

◆ convert_width2qfactor()

static double convert_width2qfactor ( double  width,
double  frequency,
double  gain,
double  sample_rate,
int  width_type 
)
static

Definition at line 627 of file af_biquads.c.

Referenced by convert_dir2zdf().

◆ convert_dir2zdf()

static void convert_dir2zdf ( BiquadsContext s,
int  sample_rate 
)
static

Definition at line 662 of file af_biquads.c.

Referenced by config_filter().

◆ config_filter()

static int config_filter ( AVFilterLink outlink,
int  reset 
)
static

Definition at line 775 of file af_biquads.c.

Referenced by config_output(), and process_command().

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 1140 of file af_biquads.c.

◆ reverse_samples()

static void reverse_samples ( AVFrame out,
AVFrame in,
int  p,
int  oo,
int  io,
int  nb_samples 
)
static

Definition at line 1150 of file af_biquads.c.

Referenced by filter_channel().

◆ filter_channel()

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

Definition at line 1185 of file af_biquads.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame buf,
int  eof 
)
static

Definition at line 1249 of file af_biquads.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

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

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 1377 of file af_biquads.c.

Variable Documentation

◆ inputs

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

Definition at line 1387 of file af_biquads.c.

◆ outputs

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

Definition at line 1394 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:119
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:175
init
static int init
Definition: av_tx.c:47
outputs
static const AVFilterPad outputs[]
Definition: af_biquads.c:1394
description
Tag description
Definition: snow.txt:206
activate
static int activate(AVFilterContext *ctx)
Definition: af_biquads.c:1318
av_cold
#define av_cold
Definition: attributes.h:90
s
#define s(width, name)
Definition: cbs_vp9.c:256
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:190
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:1364
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:116
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
config_output
static int config_output(AVFilterLink *outlink)
Definition: af_biquads.c:1140
inputs
static const AVFilterPad inputs[]
Definition: af_biquads.c:1387
AVFILTER_DEFINE_CLASS
#define AVFILTER_DEFINE_CLASS(fname)
Definition: internal.h:325
AVFilter
Filter definition.
Definition: avfilter.h:171
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_biquads.c:161
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_biquads.c:1377
AVFilterContext
An instance of a filter.
Definition: avfilter.h:408
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:127
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:160