FFmpeg
vf_mestimate.c
Go to the documentation of this file.
1 /**
2  * Copyright (c) 2016 Davinder Singh (DSM_) <ds.mudhar<@gmail.com>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "motion_estimation.h"
22 #include "libavcodec/mathops.h"
23 #include "libavutil/common.h"
24 #include "libavutil/opt.h"
26 #include "avfilter.h"
27 #include "internal.h"
28 #include "video.h"
29 
30 typedef struct MEContext {
31  const AVClass *class;
33  int method; ///< motion estimation method
34 
35  int mb_size; ///< macroblock size
36  int search_param; ///< search parameter
39 
41 
42  int (*mv_table[3])[2][2]; ///< motion vectors of current & prev 2 frames
43 } MEContext;
44 
45 #define OFFSET(x) offsetof(MEContext, x)
46 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
47 #define CONST(name, help, val, unit) { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, 0, 0, FLAGS, unit }
48 
49 static const AVOption mestimate_options[] = {
50  { "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" },
51  CONST("esa", "exhaustive search", AV_ME_METHOD_ESA, "method"),
52  CONST("tss", "three step search", AV_ME_METHOD_TSS, "method"),
53  CONST("tdls", "two dimensional logarithmic search", AV_ME_METHOD_TDLS, "method"),
54  CONST("ntss", "new three step search", AV_ME_METHOD_NTSS, "method"),
55  CONST("fss", "four step search", AV_ME_METHOD_FSS, "method"),
56  CONST("ds", "diamond search", AV_ME_METHOD_DS, "method"),
57  CONST("hexbs", "hexagon-based search", AV_ME_METHOD_HEXBS, "method"),
58  CONST("epzs", "enhanced predictive zonal search", AV_ME_METHOD_EPZS, "method"),
59  CONST("umh", "uneven multi-hexagon search", AV_ME_METHOD_UMH, "method"),
60  { "mb_size", "macroblock size", OFFSET(mb_size), AV_OPT_TYPE_INT, {.i64 = 16}, 8, INT_MAX, FLAGS },
61  { "search_param", "search parameter", OFFSET(search_param), AV_OPT_TYPE_INT, {.i64 = 7}, 4, INT_MAX, FLAGS },
62  { NULL }
63 };
64 
65 AVFILTER_DEFINE_CLASS(mestimate);
66 
67 static const enum AVPixelFormat pix_fmts[] = {
77 };
78 
80 {
81  MEContext *s = inlink->dst->priv;
82  int i;
83 
84  s->log2_mb_size = av_ceil_log2_c(s->mb_size);
85  s->mb_size = 1 << s->log2_mb_size;
86 
87  s->b_width = inlink->w >> s->log2_mb_size;
88  s->b_height = inlink->h >> s->log2_mb_size;
89  s->b_count = s->b_width * s->b_height;
90 
91  if (s->b_count == 0)
92  return AVERROR(EINVAL);
93 
94  for (i = 0; i < 3; i++) {
95  s->mv_table[i] = av_calloc(s->b_count, sizeof(*s->mv_table[0]));
96  if (!s->mv_table[i])
97  return AVERROR(ENOMEM);
98  }
99 
100  ff_me_init_context(&s->me_ctx, s->mb_size, s->search_param, inlink->w, inlink->h, 0, (s->b_width - 1) << s->log2_mb_size, 0, (s->b_height - 1) << s->log2_mb_size);
101 
102  return 0;
103 }
104 
105 static void add_mv_data(AVMotionVector *mv, int mb_size,
106  int x, int y, int x_mv, int y_mv, int dir)
107 {
108  mv->w = mb_size;
109  mv->h = mb_size;
110  mv->dst_x = x + (mb_size >> 1);
111  mv->dst_y = y + (mb_size >> 1);
112  mv->src_x = x_mv + (mb_size >> 1);
113  mv->src_y = y_mv + (mb_size >> 1);
114  mv->source = dir ? 1 : -1;
115  mv->flags = 0;
116 }
117 
118 #define SEARCH_MV(method)\
119  do {\
120  for (mb_y = 0; mb_y < s->b_height; mb_y++)\
121  for (mb_x = 0; mb_x < s->b_width; mb_x++) {\
122  const int x_mb = mb_x << s->log2_mb_size;\
123  const int y_mb = mb_y << s->log2_mb_size;\
124  int mv[2] = {x_mb, y_mb};\
125  ff_me_search_##method(me_ctx, x_mb, y_mb, mv);\
126  add_mv_data(((AVMotionVector *) sd->data) + mv_count++, me_ctx->mb_size, x_mb, y_mb, mv[0], mv[1], dir);\
127  }\
128  } while (0)
129 
130 #define ADD_PRED(preds, px, py)\
131  do {\
132  preds.mvs[preds.nb][0] = px;\
133  preds.mvs[preds.nb][1] = py;\
134  preds.nb++;\
135  } while(0)
136 
138 {
139  AVFilterContext *ctx = inlink->dst;
140  MEContext *s = ctx->priv;
141  AVMotionEstContext *me_ctx = &s->me_ctx;
142  AVFrameSideData *sd;
143  AVFrame *out;
144  int mb_x, mb_y, dir;
145  int32_t mv_count = 0;
146  int ret;
147 
148  if (frame->pts == AV_NOPTS_VALUE) {
149  ret = ff_filter_frame(ctx->outputs[0], frame);
150  return ret;
151  }
152 
153  av_frame_free(&s->prev);
154  s->prev = s->cur;
155  s->cur = s->next;
156  s->next = frame;
157 
158  s->mv_table[2] = memcpy(s->mv_table[2], s->mv_table[1], sizeof(*s->mv_table[1]) * s->b_count);
159  s->mv_table[1] = memcpy(s->mv_table[1], s->mv_table[0], sizeof(*s->mv_table[0]) * s->b_count);
160 
161  if (!s->cur) {
162  s->cur = av_frame_clone(frame);
163  if (!s->cur)
164  return AVERROR(ENOMEM);
165  }
166 
167  if (!s->prev)
168  return 0;
169 
170  out = av_frame_clone(s->cur);
171  if (!out)
172  return AVERROR(ENOMEM);
173 
175  if (!sd) {
176  av_frame_free(&out);
177  return AVERROR(ENOMEM);
178  }
179 
180  me_ctx->data_cur = s->cur->data[0];
181  me_ctx->linesize = s->cur->linesize[0];
182 
183  for (dir = 0; dir < 2; dir++) {
184  me_ctx->data_ref = (dir ? s->next : s->prev)->data[0];
185 
186  if (s->method == AV_ME_METHOD_DS)
187  SEARCH_MV(ds);
188  else if (s->method == AV_ME_METHOD_ESA)
189  SEARCH_MV(esa);
190  else if (s->method == AV_ME_METHOD_FSS)
191  SEARCH_MV(fss);
192  else if (s->method == AV_ME_METHOD_NTSS)
193  SEARCH_MV(ntss);
194  else if (s->method == AV_ME_METHOD_TDLS)
195  SEARCH_MV(tdls);
196  else if (s->method == AV_ME_METHOD_TSS)
197  SEARCH_MV(tss);
198  else if (s->method == AV_ME_METHOD_HEXBS)
199  SEARCH_MV(hexbs);
200  else if (s->method == AV_ME_METHOD_UMH) {
201  for (mb_y = 0; mb_y < s->b_height; mb_y++)
202  for (mb_x = 0; mb_x < s->b_width; mb_x++) {
203  const int mb_i = mb_x + mb_y * s->b_width;
204  const int x_mb = mb_x << s->log2_mb_size;
205  const int y_mb = mb_y << s->log2_mb_size;
206  int mv[2] = {x_mb, y_mb};
207 
208  AVMotionEstPredictor *preds = me_ctx->preds;
209  preds[0].nb = 0;
210 
211  ADD_PRED(preds[0], 0, 0);
212 
213  //left mb in current frame
214  if (mb_x > 0)
215  ADD_PRED(preds[0], s->mv_table[0][mb_i - 1][dir][0], s->mv_table[0][mb_i - 1][dir][1]);
216 
217  if (mb_y > 0) {
218  //top mb in current frame
219  ADD_PRED(preds[0], s->mv_table[0][mb_i - s->b_width][dir][0], s->mv_table[0][mb_i - s->b_width][dir][1]);
220 
221  //top-right mb in current frame
222  if (mb_x + 1 < s->b_width)
223  ADD_PRED(preds[0], s->mv_table[0][mb_i - s->b_width + 1][dir][0], s->mv_table[0][mb_i - s->b_width + 1][dir][1]);
224  //top-left mb in current frame
225  else if (mb_x > 0)
226  ADD_PRED(preds[0], s->mv_table[0][mb_i - s->b_width - 1][dir][0], s->mv_table[0][mb_i - s->b_width - 1][dir][1]);
227  }
228 
229  //median predictor
230  if (preds[0].nb == 4) {
231  me_ctx->pred_x = mid_pred(preds[0].mvs[1][0], preds[0].mvs[2][0], preds[0].mvs[3][0]);
232  me_ctx->pred_y = mid_pred(preds[0].mvs[1][1], preds[0].mvs[2][1], preds[0].mvs[3][1]);
233  } else if (preds[0].nb == 3) {
234  me_ctx->pred_x = mid_pred(0, preds[0].mvs[1][0], preds[0].mvs[2][0]);
235  me_ctx->pred_y = mid_pred(0, preds[0].mvs[1][1], preds[0].mvs[2][1]);
236  } else if (preds[0].nb == 2) {
237  me_ctx->pred_x = preds[0].mvs[1][0];
238  me_ctx->pred_y = preds[0].mvs[1][1];
239  } else {
240  me_ctx->pred_x = 0;
241  me_ctx->pred_y = 0;
242  }
243 
244  ff_me_search_umh(me_ctx, x_mb, y_mb, mv);
245 
246  s->mv_table[0][mb_i][dir][0] = mv[0] - x_mb;
247  s->mv_table[0][mb_i][dir][1] = mv[1] - y_mb;
248  add_mv_data(((AVMotionVector *) sd->data) + mv_count++, me_ctx->mb_size, x_mb, y_mb, mv[0], mv[1], dir);
249  }
250 
251  } else if (s->method == AV_ME_METHOD_EPZS) {
252 
253  for (mb_y = 0; mb_y < s->b_height; mb_y++)
254  for (mb_x = 0; mb_x < s->b_width; mb_x++) {
255  const int mb_i = mb_x + mb_y * s->b_width;
256  const int x_mb = mb_x << s->log2_mb_size;
257  const int y_mb = mb_y << s->log2_mb_size;
258  int mv[2] = {x_mb, y_mb};
259 
260  AVMotionEstPredictor *preds = me_ctx->preds;
261  preds[0].nb = 0;
262  preds[1].nb = 0;
263 
264  ADD_PRED(preds[0], 0, 0);
265 
266  //left mb in current frame
267  if (mb_x > 0)
268  ADD_PRED(preds[0], s->mv_table[0][mb_i - 1][dir][0], s->mv_table[0][mb_i - 1][dir][1]);
269 
270  //top mb in current frame
271  if (mb_y > 0)
272  ADD_PRED(preds[0], s->mv_table[0][mb_i - s->b_width][dir][0], s->mv_table[0][mb_i - s->b_width][dir][1]);
273 
274  //top-right mb in current frame
275  if (mb_y > 0 && mb_x + 1 < s->b_width)
276  ADD_PRED(preds[0], s->mv_table[0][mb_i - s->b_width + 1][dir][0], s->mv_table[0][mb_i - s->b_width + 1][dir][1]);
277 
278  //median predictor
279  if (preds[0].nb == 4) {
280  me_ctx->pred_x = mid_pred(preds[0].mvs[1][0], preds[0].mvs[2][0], preds[0].mvs[3][0]);
281  me_ctx->pred_y = mid_pred(preds[0].mvs[1][1], preds[0].mvs[2][1], preds[0].mvs[3][1]);
282  } else if (preds[0].nb == 3) {
283  me_ctx->pred_x = mid_pred(0, preds[0].mvs[1][0], preds[0].mvs[2][0]);
284  me_ctx->pred_y = mid_pred(0, preds[0].mvs[1][1], preds[0].mvs[2][1]);
285  } else if (preds[0].nb == 2) {
286  me_ctx->pred_x = preds[0].mvs[1][0];
287  me_ctx->pred_y = preds[0].mvs[1][1];
288  } else {
289  me_ctx->pred_x = 0;
290  me_ctx->pred_y = 0;
291  }
292 
293  //collocated mb in prev frame
294  ADD_PRED(preds[0], s->mv_table[1][mb_i][dir][0], s->mv_table[1][mb_i][dir][1]);
295 
296  //accelerator motion vector of collocated block in prev frame
297  ADD_PRED(preds[1], s->mv_table[1][mb_i][dir][0] + (s->mv_table[1][mb_i][dir][0] - s->mv_table[2][mb_i][dir][0]),
298  s->mv_table[1][mb_i][dir][1] + (s->mv_table[1][mb_i][dir][1] - s->mv_table[2][mb_i][dir][1]));
299 
300  //left mb in prev frame
301  if (mb_x > 0)
302  ADD_PRED(preds[1], s->mv_table[1][mb_i - 1][dir][0], s->mv_table[1][mb_i - 1][dir][1]);
303 
304  //top mb in prev frame
305  if (mb_y > 0)
306  ADD_PRED(preds[1], s->mv_table[1][mb_i - s->b_width][dir][0], s->mv_table[1][mb_i - s->b_width][dir][1]);
307 
308  //right mb in prev frame
309  if (mb_x + 1 < s->b_width)
310  ADD_PRED(preds[1], s->mv_table[1][mb_i + 1][dir][0], s->mv_table[1][mb_i + 1][dir][1]);
311 
312  //bottom mb in prev frame
313  if (mb_y + 1 < s->b_height)
314  ADD_PRED(preds[1], s->mv_table[1][mb_i + s->b_width][dir][0], s->mv_table[1][mb_i + s->b_width][dir][1]);
315 
316  ff_me_search_epzs(me_ctx, x_mb, y_mb, mv);
317 
318  s->mv_table[0][mb_i][dir][0] = mv[0] - x_mb;
319  s->mv_table[0][mb_i][dir][1] = mv[1] - y_mb;
320  add_mv_data(((AVMotionVector *) sd->data) + mv_count++, s->mb_size, x_mb, y_mb, mv[0], mv[1], dir);
321  }
322  }
323  }
324 
325  return ff_filter_frame(ctx->outputs[0], out);
326 }
327 
329 {
330  MEContext *s = ctx->priv;
331  int i;
332 
333  av_frame_free(&s->prev);
334  av_frame_free(&s->cur);
335  av_frame_free(&s->next);
336 
337  for (i = 0; i < 3; i++)
338  av_freep(&s->mv_table[i]);
339 }
340 
341 static const AVFilterPad mestimate_inputs[] = {
342  {
343  .name = "default",
344  .type = AVMEDIA_TYPE_VIDEO,
345  .filter_frame = filter_frame,
346  .config_props = config_input,
347  },
348 };
349 
351  .name = "mestimate",
352  .description = NULL_IF_CONFIG_SMALL("Generate motion vectors."),
353  .priv_size = sizeof(MEContext),
354  .priv_class = &mestimate_class,
355  .uninit = uninit,
360 };
AVMotionEstPredictor::nb
int nb
Definition: motion_estimation.h:38
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
AVMotionEstContext::data_ref
uint8_t * data_ref
Definition: motion_estimation.h:42
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
AVMotionEstPredictor
Definition: motion_estimation.h:36
out
FILE * out
Definition: movenc.c:54
av_frame_new_side_data
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, size_t size)
Add a new side data to a frame.
Definition: frame.c:812
AVMotionVector
Definition: motion_vector.h:24
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:978
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:172
MEContext::mv_table
int(*[3] mv_table)[2][2]
motion vectors of current & prev 2 frames
Definition: vf_mestimate.c:42
mv
static const int8_t mv[256][2]
Definition: 4xm.c:80
inlink
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
Definition: filter_design.txt:212
MEContext::b_height
int b_height
Definition: vf_mestimate.c:37
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:100
AVMotionEstContext::data_cur
uint8_t * data_cur
Definition: motion_estimation.h:42
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:340
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:452
AVOption
AVOption.
Definition: opt.h:251
MEContext::next
AVFrame * next
Definition: vf_mestimate.c:40
data
const char data[16]
Definition: mxf.c:148
MEContext::prev
AVFrame * prev
Definition: vf_mestimate.c:40
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
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:170
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)
Definition: vf_mestimate.c:105
MEContext::me_ctx
AVMotionEstContext me_ctx
Definition: vf_mestimate.c:32
MEContext::method
int method
motion estimation method
Definition: vf_mestimate.c:33
video.h
MEContext
Copyright (c) 2016 Davinder Singh (DSM_) <ds.mudhar<@gmail.com>
Definition: vf_mestimate.c:30
AV_ME_METHOD_FSS
#define AV_ME_METHOD_FSS
Definition: motion_estimation.h:30
AVMotionEstContext::pred_x
int pred_x
median predictor x
Definition: motion_estimation.h:56
SEARCH_MV
#define SEARCH_MV(method)
Definition: vf_mestimate.c:118
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_mestimate.c:79
AV_ME_METHOD_ESA
#define AV_ME_METHOD_ESA
Copyright (c) 2016 Davinder Singh (DSM_) <ds.mudhar<@gmail.com>
Definition: motion_estimation.h:26
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:47
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:276
av_cold
#define av_cold
Definition: attributes.h:90
ff_video_default_filterpad
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:36
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
motion_vector.h
AV_ME_METHOD_TSS
#define AV_ME_METHOD_TSS
Definition: motion_estimation.h:27
s
#define s(width, name)
Definition: cbs_vp9.c:198
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
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(mestimate)
ctx
AVFormatContext * ctx
Definition: movenc.c:48
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:609
CONST
#define CONST(name, help, val, unit)
Definition: vf_mestimate.c:47
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
AVMotionEstContext
Definition: motion_estimation.h:41
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:192
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
frame
static AVFrame * frame
Definition: demux_decode.c:54
mestimate_inputs
static const AVFilterPad mestimate_inputs[]
Definition: vf_mestimate.c:341
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
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
ADD_PRED
#define ADD_PRED(preds, px, py)
Definition: vf_mestimate.c:130
motion_estimation.h
mathops.h
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
OFFSET
#define OFFSET(x)
Definition: vf_mestimate.c:45
ff_vf_mestimate
const AVFilter ff_vf_mestimate
Definition: vf_mestimate.c:350
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:106
ff_me_search_epzs
uint64_t ff_me_search_epzs(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv)
Definition: motion_estimation.c:333
MEContext::log2_mb_size
int log2_mb_size
Definition: vf_mestimate.c:38
mestimate_options
static const AVOption mestimate_options[]
Definition: vf_mestimate.c:49
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
AVFrameSideData::data
uint8_t * data
Definition: frame.h:248
MEContext::b_width
int b_width
Definition: vf_mestimate.c:37
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
internal.h
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_mestimate.c:67
MEContext::cur
AVFrame * cur
Definition: vf_mestimate.c:40
AV_ME_METHOD_DS
#define AV_ME_METHOD_DS
Definition: motion_estimation.h:31
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
AV_ME_METHOD_HEXBS
#define AV_ME_METHOD_HEXBS
Definition: motion_estimation.h:32
common.h
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
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:53
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:262
AVFilter
Filter definition.
Definition: avfilter.h:166
mid_pred
#define mid_pred
Definition: mathops.h:98
ret
ret
Definition: filter_design.txt:187
FLAGS
#define FLAGS
Definition: vf_mestimate.c:46
ff_me_init_context
void ff_me_init_context(AVMotionEstContext *me_ctx, int mb_size, int search_param, int width, int height, int x_min, int x_max, int y_min, int y_max)
Definition: motion_estimation.c:46
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_mestimate.c:328
MEContext::search_param
int search_param
search parameter
Definition: vf_mestimate.c:36
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.h
MEContext::b_count
int b_count
Definition: vf_mestimate.c:37
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:133
AV_ME_METHOD_UMH
#define AV_ME_METHOD_UMH
Definition: motion_estimation.h:34
MEContext::mb_size
int mb_size
macroblock size
Definition: vf_mestimate.c:35
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
AVFilterContext
An instance of a filter.
Definition: avfilter.h:397
AVMotionEstContext::pred_y
int pred_y
median predictor y
Definition: motion_estimation.h:57
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
AVMotionEstContext::linesize
int linesize
Definition: motion_estimation.h:43
AVFrameSideData
Structure to hold side data for an AVFrame.
Definition: frame.h:246
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:193
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
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
int32_t
int32_t
Definition: audioconvert.c:56
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:474
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_FRAME_DATA_MOTION_VECTORS
@ AV_FRAME_DATA_MOTION_VECTORS
Motion vectors exported by some codecs (on demand through the export_mvs flag set in the libavcodec A...
Definition: frame.h:97
ff_me_search_umh
uint64_t ff_me_search_umh(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv)
Definition: motion_estimation.c:374
AVMotionEstPredictor::mvs
int mvs[10][2]
Definition: motion_estimation.h:37
AV_ME_METHOD_TDLS
#define AV_ME_METHOD_TDLS
Definition: motion_estimation.h:28
int
int
Definition: ffmpeg_filter.c:368
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
Definition: vf_mestimate.c:137
AVMotionEstContext::preds
AVMotionEstPredictor preds[2]
Definition: motion_estimation.h:58
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
AVMotionEstContext::mb_size
int mb_size
Definition: motion_estimation.h:45
av_ceil_log2_c
static av_always_inline av_const int av_ceil_log2_c(int x)
Compute ceil(log2(x)).
Definition: common.h:418