FFmpeg
Data Structures | Macros | Functions | Variables
af_superequalizer.c File Reference
#include "libavutil/opt.h"
#include "libavcodec/avfft.h"
#include "audio.h"
#include "avfilter.h"
#include "filters.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  EqParameter
 
struct  SuperEqualizerContext
 

Macros

#define NBANDS   17
 
#define M   15
 
#define AF   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define OFFSET(x)   offsetof(SuperEqualizerContext, x)
 

Functions

static float izero (SuperEqualizerContext *s, float x)
 
static float hn_lpf (int n, float f, float fs)
 
static float hn_imp (int n)
 
static float hn (int n, EqParameter *param, float fs)
 
static float alpha (float a)
 
static float win (SuperEqualizerContext *s, float n, int N)
 
static void process_param (float *bc, EqParameter *param, float fs)
 
static int equ_init (SuperEqualizerContext *s, int wb)
 
static void make_fir (SuperEqualizerContext *s, float *lbc, float *rbc, EqParameter *param, float fs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int activate (AVFilterContext *ctx)
 
static av_cold int init (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int config_output (AVFilterLink *outlink)
 
static av_cold void uninit (AVFilterContext *ctx)
 
 AVFILTER_DEFINE_CLASS (superequalizer)
 

Variables

static const float bands []
 
static const AVFilterPad superequalizer_inputs []
 
static const AVFilterPad superequalizer_outputs []
 
static const AVOption superequalizer_options []
 
const AVFilter ff_af_superequalizer
 

Macro Definition Documentation

◆ NBANDS

#define NBANDS   17

Definition at line 31 of file af_superequalizer.c.

◆ M

#define M   15

Definition at line 32 of file af_superequalizer.c.

◆ AF

Definition at line 323 of file af_superequalizer.c.

◆ OFFSET

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

Definition at line 324 of file af_superequalizer.c.

Function Documentation

◆ izero()

static float izero ( SuperEqualizerContext s,
float  x 
)
static

Definition at line 61 of file af_superequalizer.c.

Referenced by equ_init(), and win().

◆ hn_lpf()

static float hn_lpf ( int  n,
float  f,
float  fs 
)
static

Definition at line 76 of file af_superequalizer.c.

Referenced by hn().

◆ hn_imp()

static float hn_imp ( int  n)
static

Definition at line 86 of file af_superequalizer.c.

Referenced by hn().

◆ hn()

static float hn ( int  n,
EqParameter param,
float  fs 
)
static

Definition at line 91 of file af_superequalizer.c.

Referenced by make_fir(), and vaapi_encode_h264_default_ref_pic_list().

◆ alpha()

static float alpha ( float  a)
static

Definition at line 110 of file af_superequalizer.c.

Referenced by equ_init(), and win().

◆ win()

static float win ( SuperEqualizerContext s,
float  n,
int  N 
)
static

◆ process_param()

static void process_param ( float *  bc,
EqParameter param,
float  fs 
)
static

Definition at line 124 of file af_superequalizer.c.

Referenced by make_fir().

◆ equ_init()

static int equ_init ( SuperEqualizerContext s,
int  wb 
)
static

Definition at line 135 of file af_superequalizer.c.

Referenced by init().

◆ make_fir()

static void make_fir ( SuperEqualizerContext s,
float *  lbc,
float *  rbc,
EqParameter param,
float  fs 
)
static

Definition at line 163 of file af_superequalizer.c.

Referenced by config_output().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 185 of file af_superequalizer.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 244 of file af_superequalizer.c.

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 266 of file af_superequalizer.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 273 of file af_superequalizer.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 285 of file af_superequalizer.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 295 of file af_superequalizer.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( superequalizer  )

Variable Documentation

◆ bands

const float bands[]
static
Initial value:
= {
65.406392, 92.498606, 130.81278, 184.99721, 261.62557, 369.99442, 523.25113, 739.9884, 1046.5023,
1479.9768, 2093.0045, 2959.9536, 4186.0091, 5919.9072, 8372.0181, 11839.814, 16744.036
}

Definition at line 56 of file af_superequalizer.c.

Referenced by decode_component(), ff_ivi_init_planes(), ff_ivi_init_tiles(), ff_mpc_dequantize_and_synth(), ff_psy_init(), ivi_free_buffers(), make_bands(), make_filters_from_proto(), mpc7_decode_frame(), mpc8_decode_frame(), process_param(), read_coeffs_coarse(), set_best_abits_code(), and set_special_band_scalefactors().

◆ superequalizer_inputs

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

Definition at line 307 of file af_superequalizer.c.

◆ superequalizer_outputs

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

Definition at line 315 of file af_superequalizer.c.

◆ superequalizer_options

const AVOption superequalizer_options[]
static
Initial value:
= {
{ "1b", "set 65Hz band gain", OFFSET(gains [0]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "2b", "set 92Hz band gain", OFFSET(gains [1]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "3b", "set 131Hz band gain", OFFSET(gains [2]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "4b", "set 185Hz band gain", OFFSET(gains [3]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "5b", "set 262Hz band gain", OFFSET(gains [4]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "6b", "set 370Hz band gain", OFFSET(gains [5]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "7b", "set 523Hz band gain", OFFSET(gains [6]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "8b", "set 740Hz band gain", OFFSET(gains [7]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "9b", "set 1047Hz band gain", OFFSET(gains [8]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "10b", "set 1480Hz band gain", OFFSET(gains [9]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "11b", "set 2093Hz band gain", OFFSET(gains[10]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "12b", "set 2960Hz band gain", OFFSET(gains[11]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "13b", "set 4186Hz band gain", OFFSET(gains[12]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "14b", "set 5920Hz band gain", OFFSET(gains[13]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "15b", "set 8372Hz band gain", OFFSET(gains[14]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "16b", "set 11840Hz band gain", OFFSET(gains[15]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "17b", "set 16744Hz band gain", OFFSET(gains[16]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ "18b", "set 20000Hz band gain", OFFSET(gains[17]), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 20, AF },
{ NULL }
}

Definition at line 326 of file af_superequalizer.c.

◆ ff_af_superequalizer

const AVFilter ff_af_superequalizer
Initial value:
= {
.name = "superequalizer",
.description = NULL_IF_CONFIG_SMALL("Apply 18 band equalization filter."),
.priv_size = sizeof(SuperEqualizerContext),
.priv_class = &superequalizer_class,
.init = init,
}

Definition at line 350 of file af_superequalizer.c.

AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:69
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_superequalizer.c:295
FILTER_SINGLE_SAMPLEFMT
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
Definition: internal.h:184
SuperEqualizerContext
Definition: af_superequalizer.c:38
AF
#define AF
Definition: af_superequalizer.c:323
init
static av_cold int init(AVFilterContext *ctx)
Definition: af_superequalizer.c:266
config_output
static int config_output(AVFilterLink *outlink)
Definition: af_superequalizer.c:285
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
superequalizer_outputs
static const AVFilterPad superequalizer_outputs[]
Definition: af_superequalizer.c:315
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
NULL
#define NULL
Definition: coverity.c:32
OFFSET
#define OFFSET(x)
Definition: af_superequalizer.c:324
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
superequalizer_inputs
static const AVFilterPad superequalizer_inputs[]
Definition: af_superequalizer.c:307
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:227
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_superequalizer.c:273
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
activate
static int activate(AVFilterContext *ctx)
Definition: af_superequalizer.c:244