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 "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 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 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 304 of file af_acrossover.c.

◆ XOVER_PROCESS

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

Definition at line 353 of file af_acrossover.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( acrossover  )

◆ parse_gains()

static int parse_gains ( AVFilterContext ctx)
static

Definition at line 107 of file af_acrossover.c.

Referenced by init().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 142 of file af_acrossover.c.

◆ set_lp()

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

Definition at line 201 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 227 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 253 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 279 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 296 of file af_acrossover.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 428 of file af_acrossover.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 478 of file af_acrossover.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 519 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, "m" },
{ "2nd", "2nd order (12 dB/8ve)", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "m" },
{ "4th", "4th order (24 dB/8ve)", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "m" },
{ "6th", "6th order (36 dB/8ve)", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "m" },
{ "8th", "8th order (48 dB/8ve)", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, "m" },
{ "10th", "10th order (60 dB/8ve)",0, AV_OPT_TYPE_CONST, {.i64=4}, 0, 0, AF, "m" },
{ "12th", "12th order (72 dB/8ve)",0, AV_OPT_TYPE_CONST, {.i64=5}, 0, 0, AF, "m" },
{ "14th", "14th order (84 dB/8ve)",0, AV_OPT_TYPE_CONST, {.i64=6}, 0, 0, AF, "m" },
{ "16th", "16th order (96 dB/8ve)",0, AV_OPT_TYPE_CONST, {.i64=7}, 0, 0, AF, "m" },
{ "18th", "18th order (108 dB/8ve)",0, AV_OPT_TYPE_CONST, {.i64=8}, 0, 0, AF, "m" },
{ "20th", "20th order (120 dB/8ve)",0, AV_OPT_TYPE_CONST, {.i64=9}, 0, 0, AF, "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 },
{ NULL }
}

Definition at line 87 of file af_acrossover.c.

◆ inputs

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

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

AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:69
OFFSET
#define OFFSET(x)
Definition: af_acrossover.c:84
AF
#define AF
Definition: af_acrossover.c:85
AudioCrossoverContext
Definition: af_acrossover.c:53
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
NULL
#define NULL
Definition: coverity.c:32
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: af_acrossover.c:478
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:116
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
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_acrossover.c:519
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:227
inputs
static const AVFilterPad inputs[]
Definition: af_acrossover.c:527
init
static av_cold int init(AVFilterContext *ctx)
Definition: af_acrossover.c:142
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
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
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_acrossover.c:428
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:228
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233
FILTER_SAMPLEFMTS
#define FILTER_SAMPLEFMTS(...)
Definition: internal.h:179