FFmpeg
Data Structures | Macros | Functions | Variables
vf_datascope.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/xga_font_data.h"
#include "avfilter.h"
#include "drawutils.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  DatascopeContext
 
struct  ThreadData
 Used for passing data between threads. More...
 
struct  PixscopeContext
 
struct  PixelValues
 
struct  OscilloscopeContext
 

Macros

#define OFFSET(x)   offsetof(DatascopeContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define POFFSET(x)   offsetof(PixscopeContext, x)
 
#define OOFFSET(x)   offsetof(OscilloscopeContext, x)
 

Functions

 AVFILTER_DEFINE_CLASS (datascope)
 
static int query_formats (AVFilterContext *ctx)
 
static void draw_text (FFDrawContext *draw, AVFrame *frame, FFDrawColor *color, int x0, int y0, const uint8_t *text, int vertical)
 
static void pick_color8 (FFDrawContext *draw, FFDrawColor *color, AVFrame *in, int x, int y, int *value)
 
static void pick_color16 (FFDrawContext *draw, FFDrawColor *color, AVFrame *in, int x, int y, int *value)
 
static void reverse_color8 (FFDrawContext *draw, FFDrawColor *color, FFDrawColor *reverse)
 
static void reverse_color16 (FFDrawContext *draw, FFDrawColor *color, FFDrawColor *reverse)
 
static int filter_color2 (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_color (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_mono (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int config_input (AVFilterLink *inlink)
 
static int config_output (AVFilterLink *outlink)
 
 AVFILTER_DEFINE_CLASS (pixscope)
 
static int pixscope_config_input (AVFilterLink *inlink)
 
static int pixscope_filter_frame (AVFilterLink *inlink, AVFrame *in)
 
 AVFILTER_DEFINE_CLASS (oscilloscope)
 
static void oscilloscope_uninit (AVFilterContext *ctx)
 
static void draw_line (FFDrawContext *draw, int x0, int y0, int x1, int y1, AVFrame *out, FFDrawColor *color)
 
static void draw_trace8 (OscilloscopeContext *s, AVFrame *frame)
 
static void draw_trace16 (OscilloscopeContext *s, AVFrame *frame)
 
static int oscilloscope_config_input (AVFilterLink *inlink)
 
static void draw_scope (OscilloscopeContext *s, int x0, int y0, int x1, int y1, AVFrame *out, PixelValues *p, int state)
 
static int oscilloscope_filter_frame (AVFilterLink *inlink, AVFrame *frame)
 

Variables

static const AVOption datascope_options []
 
static const AVFilterPad inputs []
 
static const AVFilterPad outputs []
 
AVFilter ff_vf_datascope
 
static const AVOption pixscope_options []
 
static const AVFilterPad pixscope_inputs []
 
static const AVFilterPad pixscope_outputs []
 
AVFilter ff_vf_pixscope
 
static const AVOption oscilloscope_options []
 
static const AVFilterPad oscilloscope_inputs []
 
static const AVFilterPad oscilloscope_outputs []
 
AVFilter ff_vf_oscilloscope
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 55 of file vf_datascope.c.

◆ FLAGS

Definition at line 56 of file vf_datascope.c.

◆ POFFSET

#define POFFSET (   x)    offsetof(PixscopeContext, x)

Definition at line 450 of file vf_datascope.c.

◆ OOFFSET

#define OOFFSET (   x)    offsetof(OscilloscopeContext, x)

Definition at line 720 of file vf_datascope.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS() [1/3]

AVFILTER_DEFINE_CLASS ( datascope  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 74 of file vf_datascope.c.

◆ draw_text()

static void draw_text ( FFDrawContext draw,
AVFrame frame,
FFDrawColor color,
int  x0,
int  y0,
const uint8_t text,
int  vertical 
)
static

◆ pick_color8()

static void pick_color8 ( FFDrawContext draw,
FFDrawColor color,
AVFrame in,
int  x,
int  y,
int value 
)
static

Definition at line 102 of file vf_datascope.c.

Referenced by config_input(), oscilloscope_config_input(), and pixscope_config_input().

◆ pick_color16()

static void pick_color16 ( FFDrawContext draw,
FFDrawColor color,
AVFrame in,
int  x,
int  y,
int value 
)
static

Definition at line 120 of file vf_datascope.c.

Referenced by config_input(), oscilloscope_config_input(), and pixscope_config_input().

◆ reverse_color8()

static void reverse_color8 ( FFDrawContext draw,
FFDrawColor color,
FFDrawColor reverse 
)
static

Definition at line 138 of file vf_datascope.c.

Referenced by config_input().

◆ reverse_color16()

static void reverse_color16 ( FFDrawContext draw,
FFDrawColor color,
FFDrawColor reverse 
)
static

Definition at line 150 of file vf_datascope.c.

Referenced by config_input().

◆ filter_color2()

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

Definition at line 170 of file vf_datascope.c.

Referenced by config_input().

◆ filter_color()

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

Definition at line 212 of file vf_datascope.c.

Referenced by config_input().

◆ filter_mono()

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

Definition at line 250 of file vf_datascope.c.

Referenced by config_input().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 287 of file vf_datascope.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 351 of file vf_datascope.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 382 of file vf_datascope.c.

◆ AVFILTER_DEFINE_CLASS() [2/3]

AVFILTER_DEFINE_CLASS ( pixscope  )

◆ pixscope_config_input()

static int pixscope_config_input ( AVFilterLink inlink)
static

Definition at line 465 of file vf_datascope.c.

◆ pixscope_filter_frame()

static int pixscope_filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 521 of file vf_datascope.c.

◆ AVFILTER_DEFINE_CLASS() [3/3]

AVFILTER_DEFINE_CLASS ( oscilloscope  )

◆ oscilloscope_uninit()

static void oscilloscope_uninit ( AVFilterContext ctx)
static

Definition at line 741 of file vf_datascope.c.

◆ draw_line()

static void draw_line ( FFDrawContext draw,
int  x0,
int  y0,
int  x1,
int  y1,
AVFrame out,
FFDrawColor color 
)
static

Definition at line 748 of file vf_datascope.c.

Referenced by draw_trace16(), and draw_trace8().

◆ draw_trace8()

static void draw_trace8 ( OscilloscopeContext s,
AVFrame frame 
)
static

Definition at line 796 of file vf_datascope.c.

Referenced by oscilloscope_config_input().

◆ draw_trace16()

static void draw_trace16 ( OscilloscopeContext s,
AVFrame frame 
)
static

Definition at line 815 of file vf_datascope.c.

Referenced by oscilloscope_config_input().

◆ oscilloscope_config_input()

static int oscilloscope_config_input ( AVFilterLink inlink)
static

Definition at line 833 of file vf_datascope.c.

◆ draw_scope()

static void draw_scope ( OscilloscopeContext s,
int  x0,
int  y0,
int  x1,
int  y1,
AVFrame out,
PixelValues p,
int  state 
)
static

Definition at line 901 of file vf_datascope.c.

Referenced by oscilloscope_filter_frame().

◆ oscilloscope_filter_frame()

static int oscilloscope_filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 960 of file vf_datascope.c.

Variable Documentation

◆ datascope_options

const AVOption datascope_options[]
static
Initial value:
= {
{ "size", "set output size", OFFSET(ow), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, 0, 0, FLAGS },
{ "s", "set output size", OFFSET(ow), AV_OPT_TYPE_IMAGE_SIZE, {.str="hd720"}, 0, 0, FLAGS },
{ "x", "set x offset", OFFSET(x), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
{ "y", "set y offset", OFFSET(y), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
{ "mode", "set scope mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, "mode" },
{ "mono", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "mode" },
{ "color", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "mode" },
{ "color2", NULL, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "mode" },
{ "axis", "draw column/row numbers", OFFSET(axis), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
{ "opacity", "set background opacity", OFFSET(opacity), AV_OPT_TYPE_FLOAT, {.dbl=0.75}, 0, 1, FLAGS },
{ NULL }
}

Definition at line 58 of file vf_datascope.c.

◆ inputs

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

Definition at line 393 of file vf_datascope.c.

◆ outputs

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

Definition at line 403 of file vf_datascope.c.

◆ ff_vf_datascope

AVFilter ff_vf_datascope
Initial value:
= {
.name = "datascope",
.description = NULL_IF_CONFIG_SMALL("Video data analysis."),
.priv_size = sizeof(DatascopeContext),
.priv_class = &datascope_class,
}

Definition at line 412 of file vf_datascope.c.

◆ pixscope_options

const AVOption pixscope_options[]
static
Initial value:
= {
{ "x", "set scope x offset", POFFSET(xpos), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS },
{ "y", "set scope y offset", POFFSET(ypos), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS },
{ "w", "set scope width", POFFSET(w), AV_OPT_TYPE_INT, {.i64=7}, 1, 80, FLAGS },
{ "h", "set scope height", POFFSET(h), AV_OPT_TYPE_INT, {.i64=7}, 1, 80, FLAGS },
{ "o", "set window opacity", POFFSET(o), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS },
{ "wx", "set window x offset", POFFSET(wx), AV_OPT_TYPE_FLOAT, {.dbl=-1}, -1, 1, FLAGS },
{ "wy", "set window y offset", POFFSET(wy), AV_OPT_TYPE_FLOAT, {.dbl=-1}, -1, 1, FLAGS },
{ NULL }
}

Definition at line 452 of file vf_datascope.c.

◆ pixscope_inputs

const AVFilterPad pixscope_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = pixscope_filter_frame,
.config_props = pixscope_config_input,
},
{ NULL }
}

Definition at line 645 of file vf_datascope.c.

◆ pixscope_outputs

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

Definition at line 655 of file vf_datascope.c.

◆ ff_vf_pixscope

AVFilter ff_vf_pixscope
Initial value:
= {
.name = "pixscope",
.description = NULL_IF_CONFIG_SMALL("Pixel data analysis."),
.priv_size = sizeof(PixscopeContext),
.priv_class = &pixscope_class,
}

Definition at line 663 of file vf_datascope.c.

◆ oscilloscope_options

const AVOption oscilloscope_options[]
static
Initial value:
= {
{ "x", "set scope x position", OOFFSET(xpos), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS },
{ "y", "set scope y position", OOFFSET(ypos), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS },
{ "s", "set scope size", OOFFSET(size), AV_OPT_TYPE_FLOAT, {.dbl=0.8}, 0, 1, FLAGS },
{ "t", "set scope tilt", OOFFSET(tilt), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS },
{ "o", "set trace opacity", OOFFSET(o), AV_OPT_TYPE_FLOAT, {.dbl=0.8}, 0, 1, FLAGS },
{ "tx", "set trace x position", OOFFSET(tx), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS },
{ "ty", "set trace y position", OOFFSET(ty), AV_OPT_TYPE_FLOAT, {.dbl=0.9}, 0, 1, FLAGS },
{ "tw", "set trace width", OOFFSET(twidth), AV_OPT_TYPE_FLOAT, {.dbl=0.8},.1, 1, FLAGS },
{ "th", "set trace height", OOFFSET(theight), AV_OPT_TYPE_FLOAT, {.dbl=0.3},.1, 1, FLAGS },
{ "c", "set components to trace", OOFFSET(components), AV_OPT_TYPE_INT, {.i64=7}, 0, 15, FLAGS },
{ "g", "draw trace grid", OOFFSET(grid), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
{ "st", "draw statistics", OOFFSET(statistics), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
{ "sc", "draw scope", OOFFSET(scope), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1, FLAGS },
{ NULL }
}

Definition at line 722 of file vf_datascope.c.

◆ oscilloscope_inputs

const AVFilterPad oscilloscope_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = oscilloscope_filter_frame,
.config_props = oscilloscope_config_input,
.needs_writable = 1,
},
{ NULL }
}

Definition at line 1025 of file vf_datascope.c.

◆ oscilloscope_outputs

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

Definition at line 1036 of file vf_datascope.c.

◆ ff_vf_oscilloscope

AVFilter ff_vf_oscilloscope
Initial value:
= {
.name = "oscilloscope",
.description = NULL_IF_CONFIG_SMALL("2D Video Oscilloscope."),
.priv_size = sizeof(OscilloscopeContext),
.priv_class = &oscilloscope_class,
}

Definition at line 1044 of file vf_datascope.c.

pixscope_inputs
static const AVFilterPad pixscope_inputs[]
Definition: vf_datascope.c:645
pixscope_outputs
static const AVFilterPad pixscope_outputs[]
Definition: vf_datascope.c:655
w
uint8_t w
Definition: llviddspenc.c:38
OFFSET
#define OFFSET(x)
Definition: vf_datascope.c:55
OOFFSET
#define OOFFSET(x)
Definition: vf_datascope.c:720
oscilloscope_uninit
static void oscilloscope_uninit(AVFilterContext *ctx)
Definition: vf_datascope.c:741
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_datascope.c:351
inputs
static const AVFilterPad inputs[]
Definition: vf_datascope.c:393
oscilloscope_outputs
static const AVFilterPad oscilloscope_outputs[]
Definition: vf_datascope.c:1036
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_datascope.c:74
POFFSET
#define POFFSET(x)
Definition: vf_datascope.c:450
NULL
#define NULL
Definition: coverity.c:32
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:233
DatascopeContext
Definition: vf_datascope.c:33
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:188
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_datascope.c:287
FLAGS
#define FLAGS
Definition: vf_datascope.c:56
outputs
static const AVFilterPad outputs[]
Definition: vf_datascope.c:403
size
int size
Definition: twinvq_data.h:11134
oscilloscope_inputs
static const AVFilterPad oscilloscope_inputs[]
Definition: vf_datascope.c:1025
pixscope_filter_frame
static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_datascope.c:521
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:125
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:226
OscilloscopeContext
Definition: vf_datascope.c:678
PixscopeContext
Definition: vf_datascope.c:423
mode
mode
Definition: ebur128.h:83
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
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:116
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_datascope.c:382
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:240
pixscope_config_input
static int pixscope_config_input(AVFilterLink *inlink)
Definition: vf_datascope.c:465
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565
uninit
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:279
h
h
Definition: vp9dsp_template.c:2038
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232
oscilloscope_filter_frame
static int oscilloscope_filter_frame(AVFilterLink *inlink, AVFrame *frame)
Definition: vf_datascope.c:960
oscilloscope_config_input
static int oscilloscope_config_input(AVFilterLink *inlink)
Definition: vf_datascope.c:833