FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
vf_signalstats.c File Reference
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  SignalstatsContext
 

Macros

#define OFFSET(x)   offsetof(SignalstatsContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define FILTER(i, j)
 
#define FILTER3(j)   (FILTER(-1, j) && FILTER(0, j) && FILTER(1, j))
 
#define VREP_START   4
 
#define DEPTH   256
 
#define SET_META(key, fmt, val)
 

Enumerations

enum  FilterMode {
  FILTER_8TAP_SMOOTH, FILTER_8TAP_REGULAR, FILTER_8TAP_SHARP, FILTER_BILINEAR,
  FILTER_SWITCHABLE, MODE_WIRES, MODE_COLORMIX, NB_MODE,
  MODE_NONE, MODE_INTERLEAVE, MODE_DEINTERLEAVE, FILTER_NONE = -1,
  FILTER_TOUT, FILTER_VREP, FILTER_BRNG, FILT_NUMB
}
 

Functions

 AVFILTER_DEFINE_CLASS (signalstats)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_props (AVFilterLink *outlink)
 
static void burn_frame (SignalstatsContext *s, AVFrame *f, int x, int y)
 
static int filter_brng (SignalstatsContext *s, const AVFrame *in, AVFrame *out, int y, int w, int h)
 
static int filter_tout_outlier (uint8_t x, uint8_t y, uint8_t z)
 
static int filter_tout (SignalstatsContext *s, const AVFrame *in, AVFrame *out, int y, int w, int h)
 
static void filter_init_vrep (SignalstatsContext *s, const AVFrame *p, int w, int h)
 
static int filter_vrep (SignalstatsContext *s, const AVFrame *in, AVFrame *out, int y, int w, int h)
 
static int filter_frame (AVFilterLink *link, AVFrame *in)
 

Variables

static const AVOption signalstats_options []
 
struct {
   const char *   name
 
   void(*   init )(SignalstatsContext *s, const
      AVFrame *p, int w, int h)
 
   int(*   process )(SignalstatsContext *s, const
      AVFrame *in, AVFrame *out, int
      y, int w, int h)
 
filters_def []
 
static const AVFilterPad signalstats_inputs []
 
static const AVFilterPad signalstats_outputs []
 
AVFilter ff_vf_signalstats
 

Macro Definition Documentation

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

Definition at line 51 of file vf_signalstats.c.

Definition at line 52 of file vf_signalstats.c.

#define FILTER (   i,
 
)
Value:
filter_tout_outlier(p[(y-j) * lw + x + i], \
p[ y * lw + x + i], \
p[(y+j) * lw + x + i])
#define FILTER3 (   j)    (FILTER(-1, j) && FILTER(0, j) && FILTER(1, j))

Referenced by filter_tout().

#define VREP_START   4

Definition at line 207 of file vf_signalstats.c.

Referenced by filter_init_vrep(), and filter_vrep().

#define DEPTH   256

Definition at line 255 of file vf_signalstats.c.

Referenced by filter_frame().

#define SET_META (   key,
  fmt,
  val 
)
Value:
do { \
snprintf(metabuf, sizeof(metabuf), fmt, val); \
av_dict_set(&out->metadata, "lavfi.signalstats." key, metabuf, 0); \
} while (0)

Enumeration Type Documentation

enum FilterMode
Enumerator:
FILTER_8TAP_SMOOTH 
FILTER_8TAP_REGULAR 
FILTER_8TAP_SHARP 
FILTER_BILINEAR 
FILTER_SWITCHABLE 
MODE_WIRES 
MODE_COLORMIX 
NB_MODE 
MODE_NONE 
MODE_INTERLEAVE 
MODE_DEINTERLEAVE 
FILTER_NONE 
FILTER_TOUT 
FILTER_VREP 
FILTER_BRNG 
FILT_NUMB 

Definition at line 27 of file vf_signalstats.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( signalstats  )
static av_cold int init ( AVFilterContext ctx)
static

Definition at line 70 of file vf_signalstats.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 87 of file vf_signalstats.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 94 of file vf_signalstats.c.

static int config_props ( AVFilterLink outlink)
static

Definition at line 106 of file vf_signalstats.c.

static void burn_frame ( SignalstatsContext s,
AVFrame f,
int  x,
int  y 
)
static

Definition at line 133 of file vf_signalstats.c.

Referenced by filter_brng(), filter_tout(), and filter_vrep().

static int filter_brng ( SignalstatsContext s,
const AVFrame in,
AVFrame out,
int  y,
int  w,
int  h 
)
static

Definition at line 142 of file vf_signalstats.c.

static int filter_tout_outlier ( uint8_t  x,
uint8_t  y,
uint8_t  z 
)
static

Definition at line 165 of file vf_signalstats.c.

static int filter_tout ( SignalstatsContext s,
const AVFrame in,
AVFrame out,
int  y,
int  w,
int  h 
)
static

Definition at line 170 of file vf_signalstats.c.

static void filter_init_vrep ( SignalstatsContext s,
const AVFrame p,
int  w,
int  h 
)
static

Definition at line 209 of file vf_signalstats.c.

static int filter_vrep ( SignalstatsContext s,
const AVFrame in,
AVFrame out,
int  y,
int  w,
int  h 
)
static

Definition at line 227 of file vf_signalstats.c.

static int filter_frame ( AVFilterLink link,
AVFrame in 
)
static

Definition at line 257 of file vf_signalstats.c.

Variable Documentation

const AVOption signalstats_options[]
static
Initial value:
= {
{"stat", "set statistics filters", OFFSET(filters), AV_OPT_TYPE_FLAGS, {.i64=0}, 0, INT_MAX, FLAGS, "filters"},
{"tout", "analyze pixels for temporal outliers", 0, AV_OPT_TYPE_CONST, {.i64=1<<FILTER_TOUT}, 0, 0, FLAGS, "filters"},
{"vrep", "analyze video lines for vertical line repitition", 0, AV_OPT_TYPE_CONST, {.i64=1<<FILTER_VREP}, 0, 0, FLAGS, "filters"},
{"brng", "analyze for pixels outside of broadcast range", 0, AV_OPT_TYPE_CONST, {.i64=1<<FILTER_BRNG}, 0, 0, FLAGS, "filters"},
{"out", "set video filter", OFFSET(outfilter), AV_OPT_TYPE_INT, {.i64=FILTER_NONE}, -1, FILT_NUMB-1, FLAGS, "out"},
{"tout", "highlight pixels that depict temporal outliers", 0, AV_OPT_TYPE_CONST, {.i64=FILTER_TOUT}, 0, 0, FLAGS, "out"},
{"vrep", "highlight video lines that depict vertical line repitition", 0, AV_OPT_TYPE_CONST, {.i64=FILTER_VREP}, 0, 0, FLAGS, "out"},
{"brng", "highlight pixels that are outside of broadcast range", 0, AV_OPT_TYPE_CONST, {.i64=FILTER_BRNG}, 0, 0, FLAGS, "out"},
{"c", "set highlight color", OFFSET(rgba_color), AV_OPT_TYPE_COLOR, {.str="yellow"}, .flags=FLAGS},
{"color", "set highlight color", OFFSET(rgba_color), AV_OPT_TYPE_COLOR, {.str="yellow"}, .flags=FLAGS},
{NULL}
}

Definition at line 54 of file vf_signalstats.c.

const char* name

Definition at line 245 of file vf_signalstats.c.

void(* init)(SignalstatsContext *s, const AVFrame *p, int w, int h)
int(* process)(SignalstatsContext *s, const AVFrame *in, AVFrame *out, int y, int w, int h)

Definition at line 247 of file vf_signalstats.c.

struct { ... } filters_def[]
Initial value:
= {
{"TOUT", NULL, filter_tout},
{"BRNG", NULL, filter_brng},
{NULL}
}

Referenced by filter_frame().

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

Definition at line 450 of file vf_signalstats.c.

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

Definition at line 459 of file vf_signalstats.c.

AVFilter ff_vf_signalstats
Initial value:
= {
.name = "signalstats",
.description = "Generate statistics from video analysis.",
.init = init,
.uninit = uninit,
.query_formats = query_formats,
.priv_size = sizeof(SignalstatsContext),
.priv_class = &signalstats_class,
}

Definition at line 468 of file vf_signalstats.c.