FFmpeg
Loading...
Searching...
No Matches
vf_codecview.c File Reference

Codec debug viewer filter. More...

#include "libavutil/mem.h"
#include "libavutil/motion_vector.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/video_enc_params.h"
#include "avfilter.h"
#include "filters.h"
#include "qp_table.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  CodecViewContext
 

Macros

#define MV_P_FOR   (1<<0)
 
#define MV_B_FOR   (1<<1)
 
#define MV_B_BACK   (1<<2)
 
#define MV_TYPE_FOR   (1<<0)
 
#define MV_TYPE_BACK   (1<<1)
 
#define FRAME_TYPE_I   (1<<0)
 
#define FRAME_TYPE_P   (1<<1)
 
#define FRAME_TYPE_B   (1<<2)
 
#define OFFSET(x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define CONST(name, help, val, u)
 

Functions

 AVFILTER_DEFINE_CLASS (codecview)
 
static int clip_line (int *sx, int *sy, int *ex, int *ey, int maxx)
 
static void draw_line (uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, ptrdiff_t stride, int color)
 Draw a line from (ex, ey) -> (sx, sy).
 
static void draw_arrow (uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, ptrdiff_t stride, int color, int tail, int direction)
 Draw an arrow from (ex, ey) -> (sx, sy).
 
static void draw_block_rectangle (uint8_t *buf, int sx, int sy, int w, int h, ptrdiff_t stride, int color)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *frame)
 
static int config_input (AVFilterLink *inlink)
 

Variables

static const AVOption codecview_options []
 
static const AVFilterPad codecview_inputs []
 
const FFFilter ff_vf_codecview
 

Detailed Description

Codec debug viewer filter.

All the MV drawing code from Michael Niedermayer is extracted from libavcodec/mpegvideo.c.

TODO: segmentation

Definition in file vf_codecview.c.

Macro Definition Documentation

◆ MV_P_FOR

#define MV_P_FOR   (1<<0)

Definition at line 42 of file vf_codecview.c.

Referenced by filter_frame().

◆ MV_B_FOR

#define MV_B_FOR   (1<<1)

Definition at line 43 of file vf_codecview.c.

Referenced by filter_frame().

◆ MV_B_BACK

#define MV_B_BACK   (1<<2)

Definition at line 44 of file vf_codecview.c.

Referenced by filter_frame().

◆ MV_TYPE_FOR

#define MV_TYPE_FOR   (1<<0)

Definition at line 45 of file vf_codecview.c.

Referenced by filter_frame().

◆ MV_TYPE_BACK

#define MV_TYPE_BACK   (1<<1)

Definition at line 46 of file vf_codecview.c.

Referenced by filter_frame().

◆ FRAME_TYPE_I

#define FRAME_TYPE_I   (1<<0)

Definition at line 47 of file vf_codecview.c.

Referenced by filter_frame().

◆ FRAME_TYPE_P

#define FRAME_TYPE_P   (1<<1)

Definition at line 48 of file vf_codecview.c.

Referenced by filter_frame().

◆ FRAME_TYPE_B

#define FRAME_TYPE_B   (1<<2)

Definition at line 49 of file vf_codecview.c.

Referenced by filter_frame().

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 61 of file vf_codecview.c.

◆ FLAGS

Definition at line 62 of file vf_codecview.c.

◆ CONST

#define CONST ( name,
help,
val,
u )
Value:
{ name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, 0, 0, FLAGS, .unit = u }
static double val(void *priv, double ch)
Definition aeval.c:77
#define FLAGS
Definition cmdutils.c:598
static void help(void)
Definition dct.c:457
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
#define u(width, name, range_min, range_max)
Definition cbs_apv.c:68
const char * name
Definition qsvenc.c:142

Definition at line 63 of file vf_codecview.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( codecview )

◆ clip_line()

static int clip_line ( int * sx,
int * sy,
int * ex,
int * ey,
int maxx )
static

Definition at line 86 of file vf_codecview.c.

Referenced by clip_line(), and draw_line().

◆ draw_line()

static void draw_line ( uint8_t * buf,
int sx,
int sy,
int ex,
int ey,
int w,
int h,
ptrdiff_t stride,
int color )
static

Draw a line from (ex, ey) -> (sx, sy).

Parameters
wwidth of the image
hheight of the image
stridestride/linesize of the image
colorcolor of the arrow

Definition at line 114 of file vf_codecview.c.

Referenced by draw_arrow().

◆ draw_arrow()

static void draw_arrow ( uint8_t * buf,
int sx,
int sy,
int ex,
int ey,
int w,
int h,
ptrdiff_t stride,
int color,
int tail,
int direction )
static

Draw an arrow from (ex, ey) -> (sx, sy).

Parameters
wwidth of the image
hheight of the image
stridestride/linesize of the image
colorcolor of the arrow

Definition at line 172 of file vf_codecview.c.

Referenced by filter_frame().

◆ draw_block_rectangle()

static void draw_block_rectangle ( uint8_t * buf,
int sx,
int sy,
int w,
int h,
ptrdiff_t stride,
int color )
static

Definition at line 210 of file vf_codecview.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink * inlink,
AVFrame * frame )
static

Definition at line 222 of file vf_codecview.c.

◆ config_input()

static int config_input ( AVFilterLink * inlink)
static

Definition at line 328 of file vf_codecview.c.

Variable Documentation

◆ codecview_options

const AVOption codecview_options[]
static
Initial value:
= {
{ "mv", "set motion vectors to visualize", OFFSET(mv), AV_OPT_TYPE_FLAGS, {.i64=0}, 0, INT_MAX, FLAGS, .unit = "mv" },
CONST("pf", "forward predicted MVs of P-frames", MV_P_FOR, "mv"),
CONST("bf", "forward predicted MVs of B-frames", MV_B_FOR, "mv"),
CONST("bb", "backward predicted MVs of B-frames", MV_B_BACK, "mv"),
{ "qp", NULL, OFFSET(qp), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, .flags = FLAGS },
{ "mv_type", "set motion vectors type", OFFSET(mv_type), AV_OPT_TYPE_FLAGS, {.i64=0}, 0, INT_MAX, FLAGS, .unit = "mv_type" },
{ "mvt", "set motion vectors type", OFFSET(mv_type), AV_OPT_TYPE_FLAGS, {.i64=0}, 0, INT_MAX, FLAGS, .unit = "mv_type" },
CONST("fp", "forward predicted MVs", MV_TYPE_FOR, "mv_type"),
CONST("bp", "backward predicted MVs", MV_TYPE_BACK, "mv_type"),
{ "frame_type", "set frame types to visualize motion vectors of", OFFSET(frame_type), AV_OPT_TYPE_FLAGS, {.i64=0}, 0, INT_MAX, FLAGS, .unit = "frame_type" },
{ "ft", "set frame types to visualize motion vectors of", OFFSET(frame_type), AV_OPT_TYPE_FLAGS, {.i64=0}, 0, INT_MAX, FLAGS, .unit = "frame_type" },
CONST("if", "I-frames", FRAME_TYPE_I, "frame_type"),
CONST("pf", "P-frames", FRAME_TYPE_P, "frame_type"),
CONST("bf", "B-frames", FRAME_TYPE_B, "frame_type"),
{ "block", "set block partitioning structure to visualize", OFFSET(block), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
{ NULL }
}
#define NULL
Definition coverity.c:32
static int16_t block[64]
Definition dct.c:125
#define OFFSET(x)
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
Definition opt.h:254
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
frame_type
static const int8_t mv[256][2]
Definition 4xm.c:81
#define CONST(name, help, val, u)
Definition vf_bwdif.c:189
#define MV_B_BACK
#define MV_TYPE_BACK
#define MV_TYPE_FOR
#define FRAME_TYPE_B
#define MV_P_FOR
#define FRAME_TYPE_I
#define MV_B_FOR
#define FRAME_TYPE_P

Definition at line 65 of file vf_codecview.c.

◆ codecview_inputs

const AVFilterPad codecview_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
}
static int config_input(AVFilterLink *inlink)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
#define AVFILTERPAD_FLAG_NEEDS_WRITABLE
The filter expects writable frames from its input link, duplicating data buffers if needed.
Definition filters.h:59

Definition at line 339 of file vf_codecview.c.

◆ ff_vf_codecview

const FFFilter ff_vf_codecview
Initial value:
= {
.p.name = "codecview",
.p.description = NULL_IF_CONFIG_SMALL("Visualize information about some codecs."),
.p.priv_class = &codecview_class,
.priv_size = sizeof(CodecViewContext),
}
#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:196
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition filters.h:254
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
static const AVFilterPad codecview_inputs[]
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition video.c:37

Definition at line 349 of file vf_codecview.c.