FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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

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

Definition at line 55 of file vf_datascope.c.

Definition at line 56 of file vf_datascope.c.

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

Definition at line 450 of file vf_datascope.c.

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

Definition at line 720 of file vf_datascope.c.

Function Documentation

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

Definition at line 74 of file vf_datascope.c.

static void draw_text ( FFDrawContext draw,
AVFrame frame,
FFDrawColor color,
int  x0,
int  y0,
const uint8_t text,
int  vertical 
)
static
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.

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.

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

Definition at line 138 of file vf_datascope.c.

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

Definition at line 150 of file vf_datascope.c.

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

Definition at line 170 of file vf_datascope.c.

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

Definition at line 212 of file vf_datascope.c.

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

Definition at line 250 of file vf_datascope.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 287 of file vf_datascope.c.

static int config_input ( AVFilterLink inlink)
static

Definition at line 351 of file vf_datascope.c.

static int config_output ( AVFilterLink outlink)
static

Definition at line 382 of file vf_datascope.c.

AVFILTER_DEFINE_CLASS ( pixscope  )
static int pixscope_config_input ( AVFilterLink inlink)
static

Definition at line 465 of file vf_datascope.c.

static int pixscope_filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 521 of file vf_datascope.c.

AVFILTER_DEFINE_CLASS ( oscilloscope  )
static void oscilloscope_uninit ( AVFilterContext ctx)
static

Definition at line 741 of file vf_datascope.c.

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().

static void draw_trace8 ( OscilloscopeContext s,
AVFrame frame 
)
static

Definition at line 796 of file vf_datascope.c.

static void draw_trace16 ( OscilloscopeContext s,
AVFrame frame 
)
static

Definition at line 815 of file vf_datascope.c.

static int oscilloscope_config_input ( AVFilterLink inlink)
static

Definition at line 833 of file vf_datascope.c.

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().

static int oscilloscope_filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 960 of file vf_datascope.c.

Variable Documentation

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 }
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
Definition: vf_datascope.c:55
#define FLAGS
Definition: vf_datascope.c:56
offset must point to two consecutive integers
Definition: opt.h:233
mode
Use these values in ebur128_init (or'ed).
Definition: ebur128.h:83

Definition at line 58 of file vf_datascope.c.

const AVFilterPad inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_datascope.c:287
static int config_input(AVFilterLink *inlink)
Definition: vf_datascope.c:351

Definition at line 393 of file vf_datascope.c.

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

Definition at line 403 of file vf_datascope.c.

AVFilter ff_vf_datascope
Initial value:
= {
.name = "datascope",
.description = NULL_IF_CONFIG_SMALL("Video data analysis."),
.priv_size = sizeof(DatascopeContext),
.priv_class = &datascope_class,
}
static const AVFilterPad inputs[]
Definition: vf_datascope.c:393
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:116
static int query_formats(AVFilterContext *ctx)
Definition: vf_datascope.c:74
static const AVFilterPad outputs[]
Definition: vf_datascope.c:403
#define flags(name, subs,...)
Definition: cbs_av1.c:596

Definition at line 412 of file vf_datascope.c.

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 }
}
#define NULL
Definition: coverity.c:32
#define POFFSET(x)
Definition: vf_datascope.c:450
uint8_t w
Definition: llviddspenc.c:38
#define FLAGS
Definition: vf_datascope.c:56

Definition at line 452 of file vf_datascope.c.

const AVFilterPad pixscope_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = pixscope_filter_frame,
.config_props = pixscope_config_input,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_datascope.c:521
static int pixscope_config_input(AVFilterLink *inlink)
Definition: vf_datascope.c:465

Definition at line 645 of file vf_datascope.c.

const AVFilterPad pixscope_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 655 of file vf_datascope.c.

AVFilter ff_vf_pixscope
Initial value:
= {
.name = "pixscope",
.description = NULL_IF_CONFIG_SMALL("Pixel data analysis."),
.priv_size = sizeof(PixscopeContext),
.priv_class = &pixscope_class,
}
#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
static const AVFilterPad inputs[]
Definition: vf_datascope.c:393
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static int query_formats(AVFilterContext *ctx)
Definition: vf_datascope.c:74
static const AVFilterPad outputs[]
Definition: vf_datascope.c:403
#define flags(name, subs,...)
Definition: cbs_av1.c:596
static const AVFilterPad pixscope_outputs[]
Definition: vf_datascope.c:655
static const AVFilterPad pixscope_inputs[]
Definition: vf_datascope.c:645

Definition at line 663 of file vf_datascope.c.

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 }
}
#define NULL
Definition: coverity.c:32
#define OOFFSET(x)
Definition: vf_datascope.c:720
ptrdiff_t size
Definition: opengl_enc.c:101
#define FLAGS
Definition: vf_datascope.c:56

Definition at line 722 of file vf_datascope.c.

const AVFilterPad oscilloscope_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = oscilloscope_filter_frame,
.config_props = oscilloscope_config_input,
.needs_writable = 1,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int oscilloscope_filter_frame(AVFilterLink *inlink, AVFrame *frame)
Definition: vf_datascope.c:960
static int oscilloscope_config_input(AVFilterLink *inlink)
Definition: vf_datascope.c:833

Definition at line 1025 of file vf_datascope.c.

const AVFilterPad oscilloscope_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 1036 of file vf_datascope.c.

AVFilter ff_vf_oscilloscope
Initial value:
= {
.name = "oscilloscope",
.description = NULL_IF_CONFIG_SMALL("2D Video Oscilloscope."),
.priv_size = sizeof(OscilloscopeContext),
.priv_class = &oscilloscope_class,
}
#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
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:279
static const AVFilterPad inputs[]
Definition: vf_datascope.c:393
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static const AVFilterPad oscilloscope_inputs[]
static const AVFilterPad oscilloscope_outputs[]
static void oscilloscope_uninit(AVFilterContext *ctx)
Definition: vf_datascope.c:741
static int query_formats(AVFilterContext *ctx)
Definition: vf_datascope.c:74
static const AVFilterPad outputs[]
Definition: vf_datascope.c:403
#define flags(name, subs,...)
Definition: cbs_av1.c:596

Definition at line 1044 of file vf_datascope.c.