FFmpeg
Data Structures | Macros | Functions | Variables
af_aspectralstats.c File Reference
#include <float.h>
#include <math.h>
#include "libavutil/opt.h"
#include "libavutil/tx.h"
#include "audio.h"
#include "avfilter.h"
#include "filters.h"
#include "internal.h"
#include "window_func.h"

Go to the source code of this file.

Data Structures

struct  ChannelSpectralStats
 
struct  AudioSpectralStatsContext
 

Macros

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

Functions

 AVFILTER_DEFINE_CLASS (aspectralstats)
 
static int config_output (AVFilterLink *outlink)
 
static void set_meta (AVDictionary **metadata, int chan, const char *key, const char *fmt, float val)
 
static void set_metadata (AudioSpectralStatsContext *s, AVDictionary **metadata)
 
static float spectral_mean (const float *const spectral, int size, int max_freq)
 
static float sqrf (float a)
 
static float spectral_variance (const float *const spectral, int size, int max_freq, float mean)
 
static float spectral_centroid (const float *const spectral, int size, int max_freq)
 
static float spectral_spread (const float *const spectral, int size, int max_freq, float centroid)
 
static float cbrf (float a)
 
static float spectral_skewness (const float *const spectral, int size, int max_freq, float centroid, float spread)
 
static float spectral_kurtosis (const float *const spectral, int size, int max_freq, float centroid, float spread)
 
static float spectral_entropy (const float *const spectral, int size, int max_freq)
 
static float spectral_flatness (const float *const spectral, int size, int max_freq)
 
static float spectral_crest (const float *const spectral, int size, int max_freq)
 
static float spectral_flux (const float *const spectral, const float *const prev_spectral, int size, int max_freq)
 
static float spectral_slope (const float *const spectral, int size, int max_freq)
 
static float spectral_decrease (const float *const spectral, int size, int max_freq)
 
static float spectral_rolloff (const float *const spectral, int size, int max_freq)
 
static int filter_channel (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int activate (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption aspectralstats_options []
 
static const AVFilterPad aspectralstats_inputs []
 
static const AVFilterPad aspectralstats_outputs []
 
const AVFilter ff_af_aspectralstats
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 66 of file af_aspectralstats.c.

◆ A

Definition at line 67 of file af_aspectralstats.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( aspectralstats  )

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 78 of file af_aspectralstats.c.

◆ set_meta()

static void set_meta ( AVDictionary **  metadata,
int  chan,
const char *  key,
const char *  fmt,
float  val 
)
static

Definition at line 150 of file af_aspectralstats.c.

Referenced by do_vif(), and set_metadata().

◆ set_metadata()

static void set_metadata ( AudioSpectralStatsContext s,
AVDictionary **  metadata 
)
static

Definition at line 164 of file af_aspectralstats.c.

Referenced by filter_frame().

◆ spectral_mean()

static float spectral_mean ( const float *const  spectral,
int  size,
int  max_freq 
)
static

Definition at line 185 of file af_aspectralstats.c.

Referenced by filter_channel().

◆ sqrf()

static float sqrf ( float  a)
static

◆ spectral_variance()

static float spectral_variance ( const float *const  spectral,
int  size,
int  max_freq,
float  mean 
)
static

Definition at line 200 of file af_aspectralstats.c.

Referenced by filter_channel().

◆ spectral_centroid()

static float spectral_centroid ( const float *const  spectral,
int  size,
int  max_freq 
)
static

Definition at line 210 of file af_aspectralstats.c.

Referenced by filter_channel().

◆ spectral_spread()

static float spectral_spread ( const float *const  spectral,
int  size,
int  max_freq,
float  centroid 
)
static

Definition at line 225 of file af_aspectralstats.c.

Referenced by filter_channel().

◆ cbrf()

static float cbrf ( float  a)
static

Definition at line 240 of file af_aspectralstats.c.

Referenced by spectral_skewness().

◆ spectral_skewness()

static float spectral_skewness ( const float *const  spectral,
int  size,
int  max_freq,
float  centroid,
float  spread 
)
static

Definition at line 245 of file af_aspectralstats.c.

Referenced by filter_channel().

◆ spectral_kurtosis()

static float spectral_kurtosis ( const float *const  spectral,
int  size,
int  max_freq,
float  centroid,
float  spread 
)
static

Definition at line 261 of file af_aspectralstats.c.

Referenced by filter_channel().

◆ spectral_entropy()

static float spectral_entropy ( const float *const  spectral,
int  size,
int  max_freq 
)
static

Definition at line 277 of file af_aspectralstats.c.

Referenced by filter_channel().

◆ spectral_flatness()

static float spectral_flatness ( const float *const  spectral,
int  size,
int  max_freq 
)
static

Definition at line 291 of file af_aspectralstats.c.

Referenced by filter_channel().

◆ spectral_crest()

static float spectral_crest ( const float *const  spectral,
int  size,
int  max_freq 
)
static

Definition at line 309 of file af_aspectralstats.c.

Referenced by filter_channel().

◆ spectral_flux()

static float spectral_flux ( const float *const  spectral,
const float *const  prev_spectral,
int  size,
int  max_freq 
)
static

Definition at line 324 of file af_aspectralstats.c.

Referenced by filter_channel().

◆ spectral_slope()

static float spectral_slope ( const float *const  spectral,
int  size,
int  max_freq 
)
static

Definition at line 335 of file af_aspectralstats.c.

Referenced by filter_channel().

◆ spectral_decrease()

static float spectral_decrease ( const float *const  spectral,
int  size,
int  max_freq 
)
static

Definition at line 354 of file af_aspectralstats.c.

Referenced by filter_channel().

◆ spectral_rolloff()

static float spectral_rolloff ( const float *const  spectral,
int  size,
int  max_freq 
)
static

Definition at line 368 of file af_aspectralstats.c.

Referenced by filter_channel().

◆ filter_channel()

static int filter_channel ( AVFilterContext ctx,
void *  arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 389 of file af_aspectralstats.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 447 of file af_aspectralstats.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 487 of file af_aspectralstats.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 516 of file af_aspectralstats.c.

Variable Documentation

◆ aspectralstats_options

const AVOption aspectralstats_options[]
static
Initial value:
= {
{ "win_size", "set the window size", OFFSET(win_size), AV_OPT_TYPE_INT, {.i64=2048}, 32, 65536, A },
WIN_FUNC_OPTION("win_func", OFFSET(win_func), A, WFUNC_HANNING),
{ "overlap", "set window overlap", OFFSET(overlap), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, A },
{ NULL }
}

Definition at line 69 of file af_aspectralstats.c.

◆ aspectralstats_inputs

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

Definition at line 544 of file af_aspectralstats.c.

◆ aspectralstats_outputs

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

Definition at line 551 of file af_aspectralstats.c.

◆ ff_af_aspectralstats

const AVFilter ff_af_aspectralstats
Initial value:
= {
.name = "aspectralstats",
.description = NULL_IF_CONFIG_SMALL("Show frequency domain statistics about audio frames."),
.priv_size = sizeof(AudioSpectralStatsContext),
.priv_class = &aspectralstats_class,
}

Definition at line 559 of file af_aspectralstats.c.

AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:66
AudioSpectralStatsContext
Definition: af_aspectralstats.c:48
FILTER_SINGLE_SAMPLEFMT
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
Definition: internal.h:183
WIN_FUNC_OPTION
#define WIN_FUNC_OPTION(win_func_opt_name, win_func_offset, flag, default_window_func)
Definition: window_func.h:37
aspectralstats_outputs
static const AVFilterPad aspectralstats_outputs[]
Definition: af_aspectralstats.c:551
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:190
NULL
#define NULL
Definition: coverity.c:32
WFUNC_HANNING
@ WFUNC_HANNING
Definition: window_func.h:29
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
activate
static int activate(AVFilterContext *ctx)
Definition: af_aspectralstats.c:487
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_aspectralstats.c:516
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
config_output
static int config_output(AVFilterLink *outlink)
Definition: af_aspectralstats.c:78
aspectralstats_inputs
static const AVFilterPad aspectralstats_inputs[]
Definition: af_aspectralstats.c:544
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
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:127
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:191
A
#define A
Definition: af_aspectralstats.c:67
OFFSET
#define OFFSET(x)
Definition: af_aspectralstats.c:66