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/float_dsp.h"
#include "libavutil/internal.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "audio.h"
#include "avfilter.h"
#include "filters.h"
#include "formats.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 (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
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 39 of file af_acrossover.c.

◆ MAX_BANDS

#define MAX_BANDS   MAX_SPLITS + 1

Definition at line 40 of file af_acrossover.c.

◆ B0

#define B0   0

Definition at line 42 of file af_acrossover.c.

◆ B1

#define B1   1

Definition at line 43 of file af_acrossover.c.

◆ B2

#define B2   2

Definition at line 44 of file af_acrossover.c.

◆ A1

#define A1   3

Definition at line 45 of file af_acrossover.c.

◆ A2

#define A2   4

Definition at line 46 of file af_acrossover.c.

◆ OFFSET

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

Definition at line 84 of file af_acrossover.c.

◆ AF

Definition at line 85 of file af_acrossover.c.

◆ BIQUAD_PROCESS

#define BIQUAD_PROCESS (   name,
  type 
)

Definition at line 345 of file af_acrossover.c.

◆ XOVER_PROCESS

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

Definition at line 394 of file af_acrossover.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( acrossover  )

◆ query_formats()

static int query_formats ( const AVFilterContext ctx,
AVFilterFormatsConfig **  cfg_in,
AVFilterFormatsConfig **  cfg_out 
)
static

Definition at line 111 of file af_acrossover.c.

◆ parse_gains()

static int parse_gains ( AVFilterContext ctx)
static

Definition at line 148 of file af_acrossover.c.

Referenced by init().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 183 of file af_acrossover.c.

◆ set_lp()

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

Definition at line 242 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 268 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 294 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 320 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 337 of file af_acrossover.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 469 of file af_acrossover.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 519 of file af_acrossover.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 561 of file af_acrossover.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 604 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 87 of file af_acrossover.c.

◆ inputs

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

Definition at line 612 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 620 of file af_acrossover.c.

OFFSET
#define OFFSET(x)
Definition: af_acrossover.c:84
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
AF
#define AF
Definition: af_acrossover.c:85
AudioCrossoverContext
Definition: af_acrossover.c:53
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
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:147
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:94
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_acrossover.c:604
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition: opt.h:271
query_formats
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: af_acrossover.c:111
FILTER_QUERY_FUNC2
#define FILTER_QUERY_FUNC2(func)
Definition: filters.h:239
inputs
static const AVFilterPad inputs[]
Definition: af_acrossover.c:612
init
static av_cold int init(AVFilterContext *ctx)
Definition: af_acrossover.c:183
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
activate
static int activate(AVFilterContext *ctx)
Definition: af_acrossover.c:561
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:152
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_acrossover.c:469
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299