FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
vaf_spectrumsynth.c File Reference

SpectrumSynth filter. More...

#include "libavcodec/avfft.h"
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.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 "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, REPLACE,
  SCROLL, FULLFRAME, RSCROLL, 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 int request_frame (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 filter_frame_magnitude (AVFilterLink *inlink, AVFrame *magnitude)
 
static int filter_frame_phase (AVFilterLink *inlink, AVFrame *phase)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

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

Detailed Description

SpectrumSynth filter.

Todo:
support float pixel format

Definition in file vaf_spectrumsynth.c.

Macro Definition Documentation

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

Definition at line 71 of file vaf_spectrumsynth.c.

Definition at line 72 of file vaf_spectrumsynth.c.

Definition at line 73 of file vaf_spectrumsynth.c.

Enumeration Type Documentation

Enumerator
LINEAR 
LOG 
NB_SCALES 

Definition at line 40 of file vaf_spectrumsynth.c.

enum SlideMode
Enumerator
REPLACE 
SCROLL 
NB_SLIDES 
REPLACE 
SCROLL 
FULLFRAME 
RSCROLL 
NB_SLIDES 
REPLACE 
SCROLL 
FULLFRAME 
RSCROLL 
NB_SLIDES 

Definition at line 41 of file vaf_spectrumsynth.c.

Enumerator
VERTICAL 
HORIZONTAL 
NB_ORIENTATIONS 
VERTICAL 
HORIZONTAL 
NB_ORIENTATIONS 

Definition at line 42 of file vaf_spectrumsynth.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( spectrumsynth  )
static int query_formats ( AVFilterContext ctx)
static

Definition at line 102 of file vaf_spectrumsynth.c.

static int config_output ( AVFilterLink outlink)
static

Definition at line 144 of file vaf_spectrumsynth.c.

static int request_frame ( AVFilterLink outlink)
static

Definition at line 225 of file vaf_spectrumsynth.c.

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

Definition at line 244 of file vaf_spectrumsynth.c.

Referenced by read_fft_data().

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

Definition at line 269 of file vaf_spectrumsynth.c.

Referenced by read_fft_data().

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

Definition at line 294 of file vaf_spectrumsynth.c.

Referenced by synth_window().

static void synth_window ( AVFilterContext ctx,
int  x 
)
static

Definition at line 340 of file vaf_spectrumsynth.c.

Referenced by try_push_frame().

static int try_push_frame ( AVFilterContext ctx,
int  x 
)
static

Definition at line 365 of file vaf_spectrumsynth.c.

Referenced by try_push_frames().

static int try_push_frames ( AVFilterContext ctx)
static

Definition at line 434 of file vaf_spectrumsynth.c.

Referenced by filter_frame_magnitude(), and filter_frame_phase().

static int filter_frame_magnitude ( AVFilterLink inlink,
AVFrame magnitude 
)
static

Definition at line 473 of file vaf_spectrumsynth.c.

static int filter_frame_phase ( AVFilterLink inlink,
AVFrame phase 
)
static

Definition at line 482 of file vaf_spectrumsynth.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 491 of file vaf_spectrumsynth.c.

Variable Documentation

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, "scale" },
{ "lin", "linear", 0, AV_OPT_TYPE_CONST, {.i64=LINEAR}, 0, 0, V, "scale" },
{ "log", "logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=LOG}, 0, 0, V, "scale" },
{ "slide", "set input sliding mode", OFFSET(sliding), AV_OPT_TYPE_INT, {.i64 = FULLFRAME}, 0, NB_SLIDES-1, V, "slide" },
{ "replace", "consume old columns with new", 0, AV_OPT_TYPE_CONST, {.i64=REPLACE}, 0, 0, V, "slide" },
{ "scroll", "consume only most right column", 0, AV_OPT_TYPE_CONST, {.i64=SCROLL}, 0, 0, V, "slide" },
{ "fullframe", "consume full frames", 0, AV_OPT_TYPE_CONST, {.i64=FULLFRAME}, 0, 0, V, "slide" },
{ "rscroll", "consume only most left column", 0, AV_OPT_TYPE_CONST, {.i64=RSCROLL}, 0, 0, V, "slide" },
{ "win_func", "set window function", OFFSET(win_func), AV_OPT_TYPE_INT, {.i64 = 0}, 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" },
{ "sine", "Sine", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_SINE}, 0, 0, A, "win_func" },
{ "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, "orientation" },
{ "vertical", NULL, 0, AV_OPT_TYPE_CONST, {.i64=VERTICAL}, 0, 0, V, "orientation" },
{ "horizontal", NULL, 0, AV_OPT_TYPE_CONST, {.i64=HORIZONTAL}, 0, 0, V, "orientation" },
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define V
sample_rate
#define A
#define OFFSET(x)

Definition at line 75 of file vaf_spectrumsynth.c.

const AVFilterPad spectrumsynth_inputs[]
static
Initial value:
= {
{
.name = "magnitude",
.filter_frame = filter_frame_magnitude,
.needs_fifo = 1,
},
{
.name = "phase",
.filter_frame = filter_frame_phase,
.needs_fifo = 1,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int filter_frame_magnitude(AVFilterLink *inlink, AVFrame *magnitude)
static int filter_frame_phase(AVFilterLink *inlink, AVFrame *phase)

Definition at line 508 of file vaf_spectrumsynth.c.

const AVFilterPad spectrumsynth_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
.request_frame = request_frame,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int request_frame(AVFilterLink *outlink)
static int config_output(AVFilterLink *outlink)

Definition at line 524 of file vaf_spectrumsynth.c.

AVFilter ff_vaf_spectrumsynth
Initial value:
= {
.name = "spectrumsynth",
.description = NULL_IF_CONFIG_SMALL("Convert input spectrum videos to audio output."),
.uninit = uninit,
.query_formats = query_formats,
.priv_size = sizeof(SpectrumSynthContext),
.priv_class = &spectrumsynth_class,
}
static int query_formats(AVFilterContext *ctx)
static const AVFilterPad spectrumsynth_outputs[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
static const AVFilterPad spectrumsynth_inputs[]
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:386
static av_cold void uninit(AVFilterContext *ctx)
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:376

Definition at line 534 of file vaf_spectrumsynth.c.