FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vaf_spectrumsynth.c File Reference
#include "libavutil/tx.h"
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/cpu.h"
#include "libavutil/ffmath.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "avfilter.h"
#include "formats.h"
#include "audio.h"
#include "video.h"
#include "filters.h"
#include "internal.h"
#include "window_func.h"

Go to the source code of this file.

Data Structures

struct  SpectrumSynthContext
 

Macros

#define OFFSET(x)   offsetof(SpectrumSynthContext, x)
 
#define A   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
 
#define V   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 

Enumerations

enum  MagnitudeScale { LINEAR, LOG, NB_SCALES }
 
enum  SlideMode {
  REPLACE, SCROLL, NB_SLIDES, SLIDE_REPLACE,
  SLIDE_SCROLL, SLIDE_FRAME, NB_SLIDE, REPLACE,
  SCROLL, FULLFRAME, RSCROLL, LREPLACE,
  NB_SLIDES, REPLACE, SCROLL, FULLFRAME,
  RSCROLL, NB_SLIDES
}
 
enum  Orientation {
  VERTICAL, HORIZONTAL, NB_ORIENTATIONS, VERTICAL,
  HORIZONTAL, NB_ORIENTATIONS
}
 

Functions

 AVFILTER_DEFINE_CLASS (spectrumsynth)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_output (AVFilterLink *outlink)
 
static void read16_fft_bin (SpectrumSynthContext *s, int x, int y, int f, int ch)
 
static void read8_fft_bin (SpectrumSynthContext *s, int x, int y, int f, int ch)
 
static void read_fft_data (AVFilterContext *ctx, int x, int h, int ch)
 
static void synth_window (AVFilterContext *ctx, int x)
 
static int try_push_frame (AVFilterContext *ctx, int x)
 
static int try_push_frames (AVFilterContext *ctx)
 
static int activate (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption spectrumsynth_options []
 
static const AVFilterPad spectrumsynth_inputs []
 
static const AVFilterPad spectrumsynth_outputs []
 
const AVFilter ff_vaf_spectrumsynth
 

Detailed Description

SpectrumSynth filter

Todo:
support float pixel format

Definition in file vaf_spectrumsynth.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 74 of file vaf_spectrumsynth.c.

◆ A

Definition at line 75 of file vaf_spectrumsynth.c.

◆ V

Definition at line 76 of file vaf_spectrumsynth.c.

Enumeration Type Documentation

◆ MagnitudeScale

Enumerator
LINEAR 
LOG 
NB_SCALES 

Definition at line 42 of file vaf_spectrumsynth.c.

◆ SlideMode

enum SlideMode
Enumerator
REPLACE 
SCROLL 
NB_SLIDES 
SLIDE_REPLACE 
SLIDE_SCROLL 
SLIDE_FRAME 
NB_SLIDE 
REPLACE 
SCROLL 
FULLFRAME 
RSCROLL 
LREPLACE 
NB_SLIDES 
REPLACE 
SCROLL 
FULLFRAME 
RSCROLL 
NB_SLIDES 

Definition at line 43 of file vaf_spectrumsynth.c.

◆ Orientation

Enumerator
VERTICAL 
HORIZONTAL 
NB_ORIENTATIONS 
VERTICAL 
HORIZONTAL 
NB_ORIENTATIONS 

Definition at line 44 of file vaf_spectrumsynth.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( spectrumsynth  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 99 of file vaf_spectrumsynth.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 141 of file vaf_spectrumsynth.c.

◆ read16_fft_bin()

static void read16_fft_bin ( SpectrumSynthContext s,
int  x,
int  y,
int  f,
int  ch 
)
static

Definition at line 229 of file vaf_spectrumsynth.c.

Referenced by read_fft_data().

◆ read8_fft_bin()

static void read8_fft_bin ( SpectrumSynthContext s,
int  x,
int  y,
int  f,
int  ch 
)
static

Definition at line 254 of file vaf_spectrumsynth.c.

Referenced by read_fft_data().

◆ read_fft_data()

static void read_fft_data ( AVFilterContext ctx,
int  x,
int  h,
int  ch 
)
static

Definition at line 279 of file vaf_spectrumsynth.c.

Referenced by synth_window().

◆ synth_window()

static void synth_window ( AVFilterContext ctx,
int  x 
)
static

Definition at line 325 of file vaf_spectrumsynth.c.

Referenced by try_push_frame().

◆ try_push_frame()

static int try_push_frame ( AVFilterContext ctx,
int  x 
)
static

Definition at line 349 of file vaf_spectrumsynth.c.

Referenced by try_push_frames().

◆ try_push_frames()

static int try_push_frames ( AVFilterContext ctx)
static

Definition at line 418 of file vaf_spectrumsynth.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 457 of file vaf_spectrumsynth.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 496 of file vaf_spectrumsynth.c.

Variable Documentation

◆ spectrumsynth_options

const AVOption spectrumsynth_options[]
static
Initial value:
= {
{ "sample_rate", "set sample rate", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = 44100}, 15, INT_MAX, A },
{ "channels", "set channels", OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = 1}, 1, 8, A },
{ "scale", "set input amplitude scale", OFFSET(scale), AV_OPT_TYPE_INT, {.i64 = LOG}, 0, NB_SCALES-1, V, .unit = "scale" },
{ "lin", "linear", 0, AV_OPT_TYPE_CONST, {.i64=LINEAR}, 0, 0, V, .unit = "scale" },
{ "log", "logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=LOG}, 0, 0, V, .unit = "scale" },
{ "slide", "set input sliding mode", OFFSET(sliding), AV_OPT_TYPE_INT, {.i64 = FULLFRAME}, 0, NB_SLIDES-1, V, .unit = "slide" },
{ "replace", "consume old columns with new", 0, AV_OPT_TYPE_CONST, {.i64=REPLACE}, 0, 0, V, .unit = "slide" },
{ "scroll", "consume only most right column", 0, AV_OPT_TYPE_CONST, {.i64=SCROLL}, 0, 0, V, .unit = "slide" },
{ "fullframe", "consume full frames", 0, AV_OPT_TYPE_CONST, {.i64=FULLFRAME}, 0, 0, V, .unit = "slide" },
{ "rscroll", "consume only most left column", 0, AV_OPT_TYPE_CONST, {.i64=RSCROLL}, 0, 0, V, .unit = "slide" },
WIN_FUNC_OPTION("win_func", OFFSET(win_func), A, 0),
{ "overlap", "set window overlap", OFFSET(overlap), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 1, A },
{ "orientation", "set orientation", OFFSET(orientation), AV_OPT_TYPE_INT, {.i64=VERTICAL}, 0, NB_ORIENTATIONS-1, V, .unit = "orientation" },
{ "vertical", NULL, 0, AV_OPT_TYPE_CONST, {.i64=VERTICAL}, 0, 0, V, .unit = "orientation" },
{ "horizontal", NULL, 0, AV_OPT_TYPE_CONST, {.i64=HORIZONTAL}, 0, 0, V, .unit = "orientation" },
{ NULL }
}

Definition at line 78 of file vaf_spectrumsynth.c.

◆ spectrumsynth_inputs

const AVFilterPad spectrumsynth_inputs[]
static
Initial value:
= {
{
.name = "magnitude",
},
{
.name = "phase",
},
}

Definition at line 520 of file vaf_spectrumsynth.c.

◆ spectrumsynth_outputs

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

Definition at line 531 of file vaf_spectrumsynth.c.

◆ ff_vaf_spectrumsynth

const AVFilter ff_vaf_spectrumsynth
Initial value:
= {
.name = "spectrumsynth",
.description = NULL_IF_CONFIG_SMALL("Convert input spectrum videos to audio output."),
.uninit = uninit,
.activate = activate,
.priv_size = sizeof(SpectrumSynthContext),
.priv_class = &spectrumsynth_class,
}

Definition at line 539 of file vaf_spectrumsynth.c.

SCROLL
@ SCROLL
Definition: vaf_spectrumsynth.c:43
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:159
WIN_FUNC_OPTION
#define WIN_FUNC_OPTION(win_func_opt_name, win_func_offset, flag, default_window_func)
Definition: window_func.h:37
SpectrumSynthContext
Definition: vaf_spectrumsynth.c:46
sample_rate
sample_rate
Definition: ffmpeg_filter.c:409
config_output
static int config_output(AVFilterLink *outlink)
Definition: vaf_spectrumsynth.c:141
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
NB_SLIDES
@ NB_SLIDES
Definition: vaf_spectrumsynth.c:43
channels
channels
Definition: aptx.h:31
A
#define A
Definition: vaf_spectrumsynth.c:75
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
OFFSET
#define OFFSET(x)
Definition: vaf_spectrumsynth.c:74
NULL
#define NULL
Definition: coverity.c:32
spectrumsynth_outputs
static const AVFilterPad spectrumsynth_outputs[]
Definition: vaf_spectrumsynth.c:531
VERTICAL
@ VERTICAL
Definition: vaf_spectrumsynth.c:44
scale
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition: vvc_intra.c:291
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:106
spectrumsynth_inputs
static const AVFilterPad spectrumsynth_inputs[]
Definition: vaf_spectrumsynth.c:520
NB_ORIENTATIONS
@ NB_ORIENTATIONS
Definition: vaf_spectrumsynth.c:44
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:238
HORIZONTAL
@ HORIZONTAL
Definition: vaf_spectrumsynth.c:44
FULLFRAME
@ FULLFRAME
Definition: vaf_spectrumsynth.c:43
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vaf_spectrumsynth.c:99
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
V
#define V
Definition: vaf_spectrumsynth.c:76
activate
static int activate(AVFilterContext *ctx)
Definition: vaf_spectrumsynth.c:457
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
LOG
@ LOG
Definition: vaf_spectrumsynth.c:42
LINEAR
@ LINEAR
Definition: vaf_spectrumsynth.c:42
REPLACE
@ REPLACE
Definition: vaf_spectrumsynth.c:43
RSCROLL
@ RSCROLL
Definition: vaf_spectrumsynth.c:43
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vaf_spectrumsynth.c:496
NB_SCALES
@ NB_SCALES
Definition: vaf_spectrumsynth.c:42