FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
af_afftfilt.c File Reference
#include "libavutil/audio_fifo.h"
#include "libavutil/avstring.h"
#include "libavfilter/internal.h"
#include "libavutil/common.h"
#include "libavutil/opt.h"
#include "libavcodec/avfft.h"
#include "libavutil/eval.h"
#include "audio.h"
#include "filters.h"
#include "window_func.h"

Go to the source code of this file.

Data Structures

struct  AFFTFiltContext
 

Macros

#define OFFSET(x)   offsetof(AFFTFiltContext, x)
 
#define A   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Enumerations

enum  {
  VAR_SAMPLE_RATE, VAR_BIN, VAR_NBBINS, VAR_CHANNEL,
  VAR_CHANNELS, VAR_PTS, VAR_REAL, VAR_IMAG,
  VAR_VARS_NB
}
 

Functions

 AVFILTER_DEFINE_CLASS (afftfilt)
 
static double getreal (void *priv, double x, double ch)
 
static double getimag (void *priv, double x, double ch)
 
static double realf (void *priv, double x, double ch)
 
static double imagf (void *priv, double x, double ch)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink)
 
static int activate (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const char *const var_names [] = { "sr", "b", "nb", "ch", "chs", "pts", "re", "im", NULL }
 
static const AVOption afftfilt_options []
 
static const char *const func2_names [] = { "real", "imag", NULL }
 
static double(*const func2 [])(void *, double, double) = { realf, imagf, NULL }
 
static const AVFilterPad inputs []
 
static const AVFilterPad outputs []
 
AVFilter ff_af_afftfilt
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 60 of file af_afftfilt.c.

◆ A

Definition at line 61 of file af_afftfilt.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
VAR_SAMPLE_RATE 
VAR_BIN 
VAR_NBBINS 
VAR_CHANNEL 
VAR_CHANNELS 
VAR_PTS 
VAR_REAL 
VAR_IMAG 
VAR_VARS_NB 

Definition at line 58 of file af_afftfilt.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( afftfilt  )

◆ getreal()

static double getreal ( void *  priv,
double  x,
double  ch 
)
inlinestatic

Definition at line 95 of file af_afftfilt.c.

Referenced by realf().

◆ getimag()

static double getimag ( void *  priv,
double  x,
double  ch 
)
inlinestatic

Definition at line 106 of file af_afftfilt.c.

Referenced by imagf().

◆ realf()

static double realf ( void *  priv,
double  x,
double  ch 
)
static

Definition at line 117 of file af_afftfilt.c.

◆ imagf()

static double imagf ( void *  priv,
double  x,
double  ch 
)
static

Definition at line 118 of file af_afftfilt.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 123 of file af_afftfilt.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink)
static

Definition at line 234 of file af_afftfilt.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 345 of file af_afftfilt.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 402 of file af_afftfilt.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 432 of file af_afftfilt.c.

Variable Documentation

◆ var_names

const char* const var_names[] = { "sr", "b", "nb", "ch", "chs", "pts", "re", "im", NULL }
static

Definition at line 57 of file af_afftfilt.c.

Referenced by config_input().

◆ afftfilt_options

const AVOption afftfilt_options[]
static
Initial value:
= {
{ "real", "set channels real expressions", OFFSET(real_str), AV_OPT_TYPE_STRING, {.str = "re" }, 0, 0, A },
{ "imag", "set channels imaginary expressions", OFFSET(img_str), AV_OPT_TYPE_STRING, {.str = "im" }, 0, 0, A },
{ "win_size", "set window size", OFFSET(fft_size), AV_OPT_TYPE_INT, {.i64=4096}, 16, 131072, A },
{ "win_func", "set window function", OFFSET(win_func), AV_OPT_TYPE_INT, {.i64 = WFUNC_HANNING}, 0, NB_WFUNC-1, A, "win_func" },
{ "rect", "Rectangular", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_RECT}, 0, 0, A, "win_func" },
{ "bartlett", "Bartlett", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BARTLETT}, 0, 0, A, "win_func" },
{ "hann", "Hann", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_HANNING}, 0, 0, A, "win_func" },
{ "hanning", "Hanning", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_HANNING}, 0, 0, A, "win_func" },
{ "hamming", "Hamming", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_HAMMING}, 0, 0, A, "win_func" },
{ "blackman", "Blackman", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BLACKMAN}, 0, 0, A, "win_func" },
{ "welch", "Welch", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_WELCH}, 0, 0, A, "win_func" },
{ "flattop", "Flat-top", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_FLATTOP}, 0, 0, A, "win_func" },
{ "bharris", "Blackman-Harris", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BHARRIS}, 0, 0, A, "win_func" },
{ "bnuttall", "Blackman-Nuttall", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BNUTTALL}, 0, 0, A, "win_func" },
{ "bhann", "Bartlett-Hann", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BHANN}, 0, 0, A, "win_func" },
{ "sine", "Sine", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_SINE}, 0, 0, A, "win_func" },
{ "nuttall", "Nuttall", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_NUTTALL}, 0, 0, A, "win_func" },
{ "lanczos", "Lanczos", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_LANCZOS}, 0, 0, A, "win_func" },
{ "gauss", "Gauss", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_GAUSS}, 0, 0, A, "win_func" },
{ "tukey", "Tukey", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_TUKEY}, 0, 0, A, "win_func" },
{ "dolph", "Dolph-Chebyshev", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_DOLPH}, 0, 0, A, "win_func" },
{ "cauchy", "Cauchy", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_CAUCHY}, 0, 0, A, "win_func" },
{ "parzen", "Parzen", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_PARZEN}, 0, 0, A, "win_func" },
{ "poisson", "Poisson", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_POISSON}, 0, 0, A, "win_func" },
{ "bohman", "Bohman", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BOHMAN}, 0, 0, A, "win_func" },
{ "overlap", "set window overlap", OFFSET(overlap), AV_OPT_TYPE_FLOAT, {.dbl=0.75}, 0, 1, A },
{ NULL },
}

Definition at line 63 of file af_afftfilt.c.

◆ func2_names

const char* const func2_names[] = { "real", "imag", NULL }
static

◆ func2

double(*const func2[])(void *, double, double) = { realf, imagf, NULL }
static

◆ inputs

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

Definition at line 462 of file af_afftfilt.c.

◆ outputs

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

Definition at line 471 of file af_afftfilt.c.

◆ ff_af_afftfilt

AVFilter ff_af_afftfilt
Initial value:
= {
.name = "afftfilt",
.description = NULL_IF_CONFIG_SMALL("Apply arbitrary expressions to samples in frequency domain."),
.priv_size = sizeof(AFFTFiltContext),
.priv_class = &afftfilt_class,
}

Definition at line 479 of file af_afftfilt.c.

WFUNC_FLATTOP
@ WFUNC_FLATTOP
Definition: window_func.h:29
outputs
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:471
WFUNC_BLACKMAN
@ WFUNC_BLACKMAN
Definition: af_firequalizer.c:36
WFUNC_PARZEN
@ WFUNC_PARZEN
Definition: window_func.h:32
inputs
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:462
WFUNC_BHANN
@ WFUNC_BHANN
Definition: window_func.h:31
WFUNC_DOLPH
@ WFUNC_DOLPH
Definition: window_func.h:32
WFUNC_NUTTALL
@ WFUNC_NUTTALL
Definition: af_firequalizer.c:39
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
WFUNC_LANCZOS
@ WFUNC_LANCZOS
Definition: window_func.h:31
WFUNC_RECT
@ WFUNC_RECT
Definition: window_func.h:28
WFUNC_BHARRIS
@ WFUNC_BHARRIS
Definition: af_firequalizer.c:41
NULL
#define NULL
Definition: coverity.c:32
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_afftfilt.c:123
WFUNC_HAMMING
@ WFUNC_HAMMING
Definition: af_firequalizer.c:35
WFUNC_HANNING
@ WFUNC_HANNING
Definition: window_func.h:28
WFUNC_BARTLETT
@ WFUNC_BARTLETT
Definition: window_func.h:29
WFUNC_BOHMAN
@ WFUNC_BOHMAN
Definition: window_func.h:33
A
#define A
Definition: af_afftfilt.c:61
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
WFUNC_TUKEY
@ WFUNC_TUKEY
Definition: af_firequalizer.c:42
activate
static int activate(AVFilterContext *ctx)
Definition: af_afftfilt.c:345
AFFTFiltContext
Definition: af_afftfilt.c:32
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_afftfilt.c:402
NB_WFUNC
@ NB_WFUNC
Definition: af_firequalizer.c:43
WFUNC_SINE
@ WFUNC_SINE
Definition: window_func.h:30
WFUNC_CAUCHY
@ WFUNC_CAUCHY
Definition: window_func.h:32
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_afftfilt.c:432
WFUNC_GAUSS
@ WFUNC_GAUSS
Definition: window_func.h:31
OFFSET
#define OFFSET(x)
Definition: af_afftfilt.c:60
WFUNC_BNUTTALL
@ WFUNC_BNUTTALL
Definition: af_firequalizer.c:40
WFUNC_POISSON
@ WFUNC_POISSON
Definition: window_func.h:32
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
WFUNC_WELCH
@ WFUNC_WELCH
Definition: window_func.h:29