FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
avf_showfreqs.c File Reference
#include <float.h>
#include <math.h>
#include "libavutil/mem.h"
#include "libavutil/tx.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "audio.h"
#include "filters.h"
#include "formats.h"
#include "video.h"
#include "avfilter.h"
#include "window_func.h"

Go to the source code of this file.

Data Structures

struct  ShowFreqsContext
 

Macros

#define OFFSET(x)   offsetof(ShowFreqsContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define RE(x, ch)   s->fft_data[ch][x].re
 
#define IM(x, ch)   s->fft_data[ch][x].im
 
#define M(a, b)   (sqrt((a) * (a) + (b) * (b)))
 
#define P(a, b)   (atan2((b), (a)))
 

Enumerations

enum  DataMode {
  MAGNITUDE, PHASE, DELAY, NB_DATA,
  D_MAGNITUDE, D_PHASE, D_UPHASE, NB_DMODES
}
 
enum  DisplayMode {
  SINGLE, SEPARATE, NB_DMODES, LINE,
  BAR, DOT, NB_MODES, COMBINED,
  SEPARATE, NB_MODES
}
 
enum  ChannelMode { COMBINED, SEPARATE, NB_CMODES }
 
enum  FrequencyScale {
  FSCALE_LINEAR, FSCALE_LOG, FSCALE_BARK, FSCALE_MEL,
  FSCALE_ERBS, FSCALE_SQRT, FSCALE_CBRT, FSCALE_QDRT,
  FSCALE_FM, NB_FSCALE, FS_LINEAR, FS_LOG,
  FS_RLOG, NB_FSCALES, F_LINEAR, F_LOG,
  NB_FSCALES
}
 
enum  AmplitudeScale {
  ALINEAR, ALOG, NB_ASCALES, AS_LINEAR,
  AS_SQRT, AS_CBRT, AS_LOG, NB_ASCALES
}
 

Functions

 AVFILTER_DEFINE_CLASS (showfreqs)
 
static int query_formats (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
static int config_output (AVFilterLink *outlink)
 
static void draw_dot (AVFrame *out, int x, int y, uint8_t fg[4])
 
static int get_sx (ShowFreqsContext *s, int f)
 
static float get_bsize (ShowFreqsContext *s, int f)
 
static void plot_freq (ShowFreqsContext *s, int ch, double a, int f, uint8_t fg[4], int *prev_y, AVFrame *out, AVFilterLink *outlink)
 
static int plot_freqs (AVFilterLink *inlink, int64_t pts)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int activate (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption showfreqs_options []
 
static const AVFilterPad showfreqs_outputs []
 
const AVFilter ff_avf_showfreqs
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 79 of file avf_showfreqs.c.

◆ FLAGS

Definition at line 80 of file avf_showfreqs.c.

◆ RE

#define RE (   x,
  ch 
)    s->fft_data[ch][x].re

◆ IM

#define IM (   x,
  ch 
)    s->fft_data[ch][x].im

◆ M

#define M (   a,
  b 
)    (sqrt((a) * (a) + (b) * (b)))

◆ P

#define P (   a,
  b 
)    (atan2((b), (a)))

Enumeration Type Documentation

◆ DataMode

enum DataMode
Enumerator
MAGNITUDE 
PHASE 
DELAY 
NB_DATA 
D_MAGNITUDE 
D_PHASE 
D_UPHASE 
NB_DMODES 

Definition at line 39 of file avf_showfreqs.c.

◆ DisplayMode

Enumerator
SINGLE 
SEPARATE 
NB_DMODES 
LINE 
BAR 
DOT 
NB_MODES 
COMBINED 
SEPARATE 
NB_MODES 

Definition at line 40 of file avf_showfreqs.c.

◆ ChannelMode

Enumerator
COMBINED 
SEPARATE 
NB_CMODES 

Definition at line 41 of file avf_showfreqs.c.

◆ FrequencyScale

Enumerator
FSCALE_LINEAR 
FSCALE_LOG 
FSCALE_BARK 
FSCALE_MEL 
FSCALE_ERBS 
FSCALE_SQRT 
FSCALE_CBRT 
FSCALE_QDRT 
FSCALE_FM 
NB_FSCALE 
FS_LINEAR 
FS_LOG 
FS_RLOG 
NB_FSCALES 
F_LINEAR 
F_LOG 
NB_FSCALES 

Definition at line 42 of file avf_showfreqs.c.

◆ AmplitudeScale

Enumerator
ALINEAR 
ALOG 
NB_ASCALES 
AS_LINEAR 
AS_SQRT 
AS_CBRT 
AS_LOG 
NB_ASCALES 

Definition at line 43 of file avf_showfreqs.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( showfreqs  )

◆ query_formats()

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

Definition at line 119 of file avf_showfreqs.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 141 of file avf_showfreqs.c.

◆ draw_dot()

static void draw_dot ( AVFrame out,
int  x,
int  y,
uint8_t  fg[4] 
)
inlinestatic

Definition at line 246 of file avf_showfreqs.c.

Referenced by plot_freq().

◆ get_sx()

static int get_sx ( ShowFreqsContext s,
int  f 
)
static

Definition at line 257 of file avf_showfreqs.c.

Referenced by plot_freq().

◆ get_bsize()

static float get_bsize ( ShowFreqsContext s,
int  f 
)
static

Definition at line 271 of file avf_showfreqs.c.

Referenced by plot_freq().

◆ plot_freq()

static void plot_freq ( ShowFreqsContext s,
int  ch,
double  a,
int  f,
uint8_t  fg[4],
int *  prev_y,
AVFrame out,
AVFilterLink outlink 
)
inlinestatic

Definition at line 287 of file avf_showfreqs.c.

Referenced by plot_freqs().

◆ plot_freqs()

static int plot_freqs ( AVFilterLink inlink,
int64_t  pts 
)
static

Definition at line 371 of file avf_showfreqs.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 471 of file avf_showfreqs.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 491 of file avf_showfreqs.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 521 of file avf_showfreqs.c.

Variable Documentation

◆ showfreqs_options

const AVOption showfreqs_options[]
static

Definition at line 82 of file avf_showfreqs.c.

◆ showfreqs_outputs

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

Definition at line 544 of file avf_showfreqs.c.

◆ ff_avf_showfreqs

const AVFilter ff_avf_showfreqs
Initial value:
= {
.name = "showfreqs",
.description = NULL_IF_CONFIG_SMALL("Convert input audio to a frequencies video output."),
.uninit = uninit,
.priv_size = sizeof(ShowFreqsContext),
.priv_class = &showfreqs_class,
}

Definition at line 552 of file avf_showfreqs.c.

query_formats
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: avf_showfreqs.c:119
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
config_output
static int config_output(AVFilterLink *outlink)
Definition: avf_showfreqs.c:141
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
ff_audio_default_filterpad
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
Definition: audio.c:34
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
activate
static int activate(AVFilterContext *ctx)
Definition: avf_showfreqs.c:491
ShowFreqsContext
Definition: avf_showfreqs.c:45
FILTER_QUERY_FUNC2
#define FILTER_QUERY_FUNC2(func)
Definition: filters.h:239
showfreqs_outputs
static const AVFilterPad showfreqs_outputs[]
Definition: avf_showfreqs.c:544
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: avf_showfreqs.c:521
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201