FFmpeg
Data Structures | Macros | Functions | Variables
vf_mestimate.c File Reference
#include "motion_estimation.h"
#include "libavcodec/mathops.h"
#include "libavutil/avassert.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 query_formats (AVFilterContext *ctx)
 
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 const AVFilterPad mestimate_inputs []
 
static const AVFilterPad mestimate_outputs []
 
AVFilter ff_vf_mestimate
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 49 of file vf_mestimate.c.

◆ FLAGS

Definition at line 50 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 51 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 130 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 142 of file vf_mestimate.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( mestimate  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 71 of file vf_mestimate.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 91 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 117 of file vf_mestimate.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 149 of file vf_mestimate.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 340 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 53 of file vf_mestimate.c.

◆ mestimate_inputs

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

Definition at line 353 of file vf_mestimate.c.

◆ mestimate_outputs

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

Definition at line 363 of file vf_mestimate.c.

◆ ff_vf_mestimate

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 371 of file vf_mestimate.c.

query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_mestimate.c:71
AVMotionVector
Definition: motion_vector.h:24
mv
static const int8_t mv[256][2]
Definition: 4xm.c:78
mestimate_outputs
static const AVFilterPad mestimate_outputs[]
Definition: vf_mestimate.c:363
MEContext
Copyright (c) 2016 Davinder Singh (DSM_) <ds.mudhar<@gmail.com>
Definition: vf_mestimate.c:34
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:91
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_ME_METHOD_TSS
#define AV_ME_METHOD_TSS
Definition: motion_estimation.h:27
s
#define s(width, name)
Definition: cbs_vp9.c:257
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
CONST
#define CONST(name, help, val, unit)
Definition: vf_mestimate.c:51
mestimate_inputs
static const AVFilterPad mestimate_inputs[]
Definition: vf_mestimate.c:353
NULL
#define NULL
Definition: coverity.c:32
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
OFFSET
#define OFFSET(x)
Definition: vf_mestimate.c:49
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_ME_METHOD_EPZS
#define AV_ME_METHOD_EPZS
Definition: motion_estimation.h:33
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
FLAGS
#define FLAGS
Definition: vf_mestimate.c:50
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_mestimate.c:340
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AV_ME_METHOD_UMH
#define AV_ME_METHOD_UMH
Definition: motion_estimation.h:34
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_ME_METHOD_NTSS
#define AV_ME_METHOD_NTSS
Definition: motion_estimation.h:29
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:149