FFmpeg
Loading...
Searching...
No Matches
vf_mestimate.c File Reference
#include "motion_estimation.h"
#include "libavcodec/mathops.h"
#include "libavutil/common.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/motion_vector.h"
#include "avfilter.h"
#include "filters.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)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define CONST(name, help, val, u)
 
#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 []
 
const FFFilter ff_vf_mestimate
 

Macro Definition Documentation

◆ OFFSET

#define OFFSET ( x)
Value:
offsetof(MEContext, x)
Copyright (c) 2016 Davinder Singh (DSM_) <ds.mudhar<@gmail.com>

Definition at line 46 of file vf_mestimate.c.

◆ FLAGS

Definition at line 47 of file vf_mestimate.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 48 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)
#define s(width, name)
Definition cbs_vp9.c:198
static const int8_t mv[256][2]
Definition 4xm.c:81

Definition at line 119 of file vf_mestimate.c.

Referenced by filter_frame().

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

Referenced by filter_frame().

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( mestimate )

◆ config_input()

static int config_input ( AVFilterLink * inlink)
static

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

Referenced by filter_frame().

◆ filter_frame()

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

Definition at line 138 of file vf_mestimate.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext * ctx)
static

Definition at line 329 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, .unit = "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 }
}
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
#define CONST(name, help, val, u)
Definition vf_bwdif.c:189
#define AV_ME_METHOD_UMH
#define AV_ME_METHOD_NTSS
#define AV_ME_METHOD_FSS
#define AV_ME_METHOD_DS
#define AV_ME_METHOD_HEXBS
#define AV_ME_METHOD_EPZS
#define AV_ME_METHOD_ESA
Copyright (c) 2016 Davinder Singh (DSM_) <ds.mudhar<@gmail.com>
#define AV_ME_METHOD_TDLS
#define AV_ME_METHOD_TSS

Definition at line 50 of file vf_mestimate.c.

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static
Initial value:
= {
}
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition pixfmt.h:106
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition pixfmt.h:77
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition pixfmt.h:81
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition pixfmt.h:108
@ 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:107
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition pixfmt.h:79
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition pixfmt.h:80
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition pixfmt.h:78
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition pixfmt.h:174
@ 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:283
@ 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:86
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition pixfmt.h:173
@ 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:87
@ 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:85

Definition at line 68 of file vf_mestimate.c.

◆ mestimate_inputs

const AVFilterPad mestimate_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

Definition at line 342 of file vf_mestimate.c.

◆ ff_vf_mestimate

const FFFilter ff_vf_mestimate
Initial value:
= {
.p.name = "mestimate",
.p.description = NULL_IF_CONFIG_SMALL("Generate motion vectors."),
.p.priv_class = &mestimate_class,
.priv_size = sizeof(MEContext),
}
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
Definition avfilter.h:182
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_PIXFMTS_ARRAY(array)
Definition filters.h:244
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static enum AVPixelFormat pix_fmts[]
Definition libkvazaar.c:296
static const AVFilterPad mestimate_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 351 of file vf_mestimate.c.