FFmpeg
Data Structures | Macros | Functions | Variables
af_acrossover.c File Reference
#include "libavutil/attributes.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/eval.h"
#include "libavutil/float_dsp.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "audio.h"
#include "avfilter.h"
#include "filters.h"
#include "formats.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  BiquadCoeffs
 
struct  AudioCrossoverContext
 

Macros

#define MAX_SPLITS   16
 
#define MAX_BANDS   MAX_SPLITS + 1
 
#define B0   0
 
#define B1   1
 
#define B2   2
 
#define A1   3
 
#define A2   4
 
#define OFFSET(x)   offsetof(AudioCrossoverContext, x)
 
#define AF   AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
 
#define BIQUAD_PROCESS(name, type)
 
#define XOVER_PROCESS(name, type, one, ff)
 

Functions

 AVFILTER_DEFINE_CLASS (acrossover)
 
static int query_formats (AVFilterContext *ctx)
 
static int parse_gains (AVFilterContext *ctx)
 
static av_cold int init (AVFilterContext *ctx)
 
static void set_lp (BiquadCoeffs *b, double fc, double q, double sr)
 
static void set_hp (BiquadCoeffs *b, double fc, double q, double sr)
 
static void set_ap (BiquadCoeffs *b, double fc, double q, double sr)
 
static void set_ap1 (BiquadCoeffs *b, double fc, double sr)
 
static void calc_q_factors (int order, double *q)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int activate (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption acrossover_options []
 
static const AVFilterPad inputs []
 
const AVFilter ff_af_acrossover
 

Detailed Description

Crossover filter

Split an audio stream into several bands.

Definition in file af_acrossover.c.

Macro Definition Documentation

◆ MAX_SPLITS

#define MAX_SPLITS   16

Definition at line 40 of file af_acrossover.c.

◆ MAX_BANDS

#define MAX_BANDS   MAX_SPLITS + 1

Definition at line 41 of file af_acrossover.c.

◆ B0

#define B0   0

Definition at line 43 of file af_acrossover.c.

◆ B1

#define B1   1

Definition at line 44 of file af_acrossover.c.

◆ B2

#define B2   2

Definition at line 45 of file af_acrossover.c.

◆ A1

#define A1   3

Definition at line 46 of file af_acrossover.c.

◆ A2

#define A2   4

Definition at line 47 of file af_acrossover.c.

◆ OFFSET

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

Definition at line 85 of file af_acrossover.c.

◆ AF

Definition at line 86 of file af_acrossover.c.

◆ BIQUAD_PROCESS

#define BIQUAD_PROCESS (   name,
  type 
)

Definition at line 346 of file af_acrossover.c.

◆ XOVER_PROCESS

#define XOVER_PROCESS (   name,
  type,
  one,
  ff 
)

Definition at line 395 of file af_acrossover.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( acrossover  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 112 of file af_acrossover.c.

◆ parse_gains()

static int parse_gains ( AVFilterContext ctx)
static

Definition at line 149 of file af_acrossover.c.

Referenced by init().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 184 of file af_acrossover.c.

◆ set_lp()

static void set_lp ( BiquadCoeffs b,
double  fc,
double  q,
double  sr 
)
static

Definition at line 243 of file af_acrossover.c.

Referenced by config_input().

◆ set_hp()

static void set_hp ( BiquadCoeffs b,
double  fc,
double  q,
double  sr 
)
static

Definition at line 269 of file af_acrossover.c.

Referenced by config_input().

◆ set_ap()

static void set_ap ( BiquadCoeffs b,
double  fc,
double  q,
double  sr 
)
static

Definition at line 295 of file af_acrossover.c.

Referenced by config_input().

◆ set_ap1()

static void set_ap1 ( BiquadCoeffs b,
double  fc,
double  sr 
)
static

Definition at line 321 of file af_acrossover.c.

Referenced by config_input().

◆ calc_q_factors()

static void calc_q_factors ( int  order,
double q 
)
static

Definition at line 338 of file af_acrossover.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 470 of file af_acrossover.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 520 of file af_acrossover.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 562 of file af_acrossover.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 605 of file af_acrossover.c.

Variable Documentation

◆ acrossover_options

const AVOption acrossover_options[]
static
Initial value:
= {
{ "split", "set split frequencies", OFFSET(splits_str), AV_OPT_TYPE_STRING, {.str="500"}, 0, 0, AF },
{ "order", "set filter order", OFFSET(order_opt), AV_OPT_TYPE_INT, {.i64=1}, 0, 9, AF, .unit = "m" },
{ "2nd", "2nd order (12 dB/8ve)", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, .unit = "m" },
{ "4th", "4th order (24 dB/8ve)", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, .unit = "m" },
{ "6th", "6th order (36 dB/8ve)", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, .unit = "m" },
{ "8th", "8th order (48 dB/8ve)", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, .unit = "m" },
{ "10th", "10th order (60 dB/8ve)",0, AV_OPT_TYPE_CONST, {.i64=4}, 0, 0, AF, .unit = "m" },
{ "12th", "12th order (72 dB/8ve)",0, AV_OPT_TYPE_CONST, {.i64=5}, 0, 0, AF, .unit = "m" },
{ "14th", "14th order (84 dB/8ve)",0, AV_OPT_TYPE_CONST, {.i64=6}, 0, 0, AF, .unit = "m" },
{ "16th", "16th order (96 dB/8ve)",0, AV_OPT_TYPE_CONST, {.i64=7}, 0, 0, AF, .unit = "m" },
{ "18th", "18th order (108 dB/8ve)",0, AV_OPT_TYPE_CONST, {.i64=8}, 0, 0, AF, .unit = "m" },
{ "20th", "20th order (120 dB/8ve)",0, AV_OPT_TYPE_CONST, {.i64=9}, 0, 0, AF, .unit = "m" },
{ "level", "set input gain", OFFSET(level_in), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 1, AF },
{ "gain", "set output bands gain", OFFSET(gains_str), AV_OPT_TYPE_STRING, {.str="1.f"}, 0, 0, AF },
{ "precision", "set processing precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, AF, .unit = "precision" },
{ "auto", "set auto processing precision", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, .unit = "precision" },
{ "float", "set single-floating point processing precision", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, .unit = "precision" },
{ "double","set double-floating point processing precision", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, .unit = "precision" },
{ NULL }
}

Definition at line 88 of file af_acrossover.c.

◆ inputs

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

Definition at line 613 of file af_acrossover.c.

◆ ff_af_acrossover

const AVFilter ff_af_acrossover
Initial value:
= {
.name = "acrossover",
.description = NULL_IF_CONFIG_SMALL("Split audio into per-bands streams."),
.priv_size = sizeof(AudioCrossoverContext),
.priv_class = &acrossover_class,
.init = init,
.outputs = NULL,
}

Definition at line 621 of file af_acrossover.c.

OFFSET
#define OFFSET(x)
Definition: af_acrossover.c:85
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:159
AF
#define AF
Definition: af_acrossover.c:86
AudioCrossoverContext
Definition: af_acrossover.c:54
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
NULL
#define NULL
Definition: coverity.c:32
AVFILTER_FLAG_DYNAMIC_OUTPUTS
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
Definition: avfilter.h:112
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_acrossover.c:112
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
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_acrossover.c:605
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:238
inputs
static const AVFilterPad inputs[]
Definition: af_acrossover.c:613
init
static av_cold int init(AVFilterContext *ctx)
Definition: af_acrossover.c:184
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
activate
static int activate(AVFilterContext *ctx)
Definition: af_acrossover.c:562
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_acrossover.c:470
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:239
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244