FFmpeg
Data Structures | Macros | Functions | Variables
vf_mestimate.c File Reference
#include "motion_estimation.h"
#include "libavcodec/mathops.h"
#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/motion_vector.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  MEContext
 Copyright (c) 2016 Davinder Singh (DSM_) <ds.mudhar<@gmail.com> More...
 

Macros

#define OFFSET(x)   offsetof(MEContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define CONST(name, help, val, unit)   { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, 0, 0, FLAGS, unit }
 
#define SEARCH_MV(method)
 
#define ADD_PRED(preds, px, py)
 

Functions

 AVFILTER_DEFINE_CLASS (mestimate)
 
static int config_input (AVFilterLink *inlink)
 
static void add_mv_data (AVMotionVector *mv, int mb_size, int x, int y, int x_mv, int y_mv, int dir)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *frame)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption mestimate_options []
 
static enum AVPixelFormat pix_fmts []
 
static const AVFilterPad mestimate_inputs []
 
static const AVFilterPad mestimate_outputs []
 
const AVFilter ff_vf_mestimate
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 48 of file vf_mestimate.c.

◆ FLAGS

Definition at line 49 of file vf_mestimate.c.

◆ CONST

#define CONST (   name,
  help,
  val,
  unit 
)    { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, 0, 0, FLAGS, unit }

Definition at line 50 of file vf_mestimate.c.

◆ SEARCH_MV

#define SEARCH_MV (   method)
Value:
do {\
for (mb_y = 0; mb_y < s->b_height; mb_y++)\
for (mb_x = 0; mb_x < s->b_width; mb_x++) {\
const int x_mb = mb_x << s->log2_mb_size;\
const int y_mb = mb_y << s->log2_mb_size;\
int mv[2] = {x_mb, y_mb};\
ff_me_search_##method(me_ctx, x_mb, y_mb, mv);\
add_mv_data(((AVMotionVector *) sd->data) + mv_count++, me_ctx->mb_size, x_mb, y_mb, mv[0], mv[1], dir);\
}\
} while (0)

Definition at line 121 of file vf_mestimate.c.

◆ ADD_PRED

#define ADD_PRED (   preds,
  px,
  py 
)
Value:
do {\
preds.mvs[preds.nb][0] = px;\
preds.mvs[preds.nb][1] = py;\
preds.nb++;\
} while(0)

Definition at line 133 of file vf_mestimate.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( mestimate  )

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 82 of file vf_mestimate.c.

◆ add_mv_data()

static void add_mv_data ( AVMotionVector mv,
int  mb_size,
int  x,
int  y,
int  x_mv,
int  y_mv,
int  dir 
)
static

Definition at line 108 of file vf_mestimate.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 140 of file vf_mestimate.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 331 of file vf_mestimate.c.

Variable Documentation

◆ mestimate_options

const AVOption mestimate_options[]
static
Initial value:
= {
{ "method", "motion estimation method", OFFSET(method), AV_OPT_TYPE_INT, {.i64 = AV_ME_METHOD_ESA}, AV_ME_METHOD_ESA, AV_ME_METHOD_UMH, FLAGS, "method" },
CONST("esa", "exhaustive search", AV_ME_METHOD_ESA, "method"),
CONST("tss", "three step search", AV_ME_METHOD_TSS, "method"),
CONST("tdls", "two dimensional logarithmic search", AV_ME_METHOD_TDLS, "method"),
CONST("ntss", "new three step search", AV_ME_METHOD_NTSS, "method"),
CONST("fss", "four step search", AV_ME_METHOD_FSS, "method"),
CONST("ds", "diamond search", AV_ME_METHOD_DS, "method"),
CONST("hexbs", "hexagon-based search", AV_ME_METHOD_HEXBS, "method"),
CONST("epzs", "enhanced predictive zonal search", AV_ME_METHOD_EPZS, "method"),
CONST("umh", "uneven multi-hexagon search", AV_ME_METHOD_UMH, "method"),
{ "mb_size", "macroblock size", OFFSET(mb_size), AV_OPT_TYPE_INT, {.i64 = 16}, 8, INT_MAX, FLAGS },
{ "search_param", "search parameter", OFFSET(search_param), AV_OPT_TYPE_INT, {.i64 = 7}, 4, INT_MAX, FLAGS },
{ NULL }
}

Definition at line 52 of file vf_mestimate.c.

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static

◆ mestimate_inputs

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

Definition at line 344 of file vf_mestimate.c.

◆ mestimate_outputs

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

Definition at line 353 of file vf_mestimate.c.

◆ ff_vf_mestimate

const AVFilter ff_vf_mestimate
Initial value:
= {
.name = "mestimate",
.description = NULL_IF_CONFIG_SMALL("Generate motion vectors."),
.priv_size = sizeof(MEContext),
.priv_class = &mestimate_class,
}

Definition at line 360 of file vf_mestimate.c.

AVMotionVector
Definition: motion_vector.h:24
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:170
mv
static const int8_t mv[256][2]
Definition: 4xm.c:80
mestimate_outputs
static const AVFilterPad mestimate_outputs[]
Definition: vf_mestimate.c:353
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
MEContext
Copyright (c) 2016 Davinder Singh (DSM_) <ds.mudhar<@gmail.com>
Definition: vf_mestimate.c:33
AV_ME_METHOD_FSS
#define AV_ME_METHOD_FSS
Definition: motion_estimation.h:30
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_mestimate.c:82
AV_ME_METHOD_ESA
#define AV_ME_METHOD_ESA
Copyright (c) 2016 Davinder Singh (DSM_) <ds.mudhar<@gmail.com>
Definition: motion_estimation.h:26
AV_PIX_FMT_YUVJ411P
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:248
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
AV_ME_METHOD_TSS
#define AV_ME_METHOD_TSS
Definition: motion_estimation.h:27
s
#define s(width, name)
Definition: cbs_vp9.c:256
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
CONST
#define CONST(name, help, val, unit)
Definition: vf_mestimate.c:50
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:190
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
mestimate_inputs
static const AVFilterPad mestimate_inputs[]
Definition: vf_mestimate.c:344
NULL
#define NULL
Definition: coverity.c:32
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
OFFSET
#define OFFSET(x)
Definition: vf_mestimate.c:48
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:117
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:167
AV_ME_METHOD_EPZS
#define AV_ME_METHOD_EPZS
Definition: motion_estimation.h:33
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_mestimate.c:70
AV_ME_METHOD_DS
#define AV_ME_METHOD_DS
Definition: motion_estimation.h:31
AV_ME_METHOD_HEXBS
#define AV_ME_METHOD_HEXBS
Definition: motion_estimation.h:32
AV_PIX_FMT_YUVJ440P
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition: pixfmt.h:100
FLAGS
#define FLAGS
Definition: vf_mestimate.c:49
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_mestimate.c:331
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AVFILTER_FLAG_METADATA_ONLY
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
Definition: avfilter.h:143
AV_ME_METHOD_UMH
#define AV_ME_METHOD_UMH
Definition: motion_estimation.h:34
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
AV_ME_METHOD_NTSS
#define AV_ME_METHOD_NTSS
Definition: motion_estimation.h:29
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:191
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
AV_ME_METHOD_TDLS
#define AV_ME_METHOD_TDLS
Definition: motion_estimation.h:28
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
Definition: vf_mestimate.c:140
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:166