• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef AVFILTER_MOTION_ESTIMATION_H
22 #define AVFILTER_MOTION_ESTIMATION_H
23 
24 #include "libavutil/avutil.h"
25 
26 #define AV_ME_METHOD_ESA        1
27 #define AV_ME_METHOD_TSS        2
28 #define AV_ME_METHOD_TDLS       3
29 #define AV_ME_METHOD_NTSS       4
30 #define AV_ME_METHOD_FSS        5
31 #define AV_ME_METHOD_DS         6
32 #define AV_ME_METHOD_HEXBS      7
33 #define AV_ME_METHOD_EPZS       8
34 #define AV_ME_METHOD_UMH        9
35 
36 typedef struct AVMotionEstPredictor {
37     int mvs[10][2];
38     int nb;
39 } AVMotionEstPredictor;
40 
41 typedef struct AVMotionEstContext {
42     uint8_t *data_cur, *data_ref;
43     int linesize;
44 
45     int mb_size;
46     int search_param;
47 
48     int width;
49     int height;
50 
51     int x_min;
52     int x_max;
53     int y_min;
54     int y_max;
55 
56     int pred_x;     ///< median predictor x
57     int pred_y;     ///< median predictor y
58     AVMotionEstPredictor preds[2];
59 
60     uint64_t (*get_cost)(struct AVMotionEstContext *me_ctx, int x_mb, int y_mb,
61                          int mv_x, int mv_y);
62 } AVMotionEstContext;
63 
64 void ff_me_init_context(AVMotionEstContext *me_ctx, int mb_size, int search_param,
65                         int width, int height, int x_min, int x_max, int y_min, int y_max);
66 
67 uint64_t ff_me_cmp_sad(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int x_mv, int y_mv);
68 
69 uint64_t ff_me_search_esa(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
70 
71 uint64_t ff_me_search_tss(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
72 
73 uint64_t ff_me_search_tdls(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
74 
75 uint64_t ff_me_search_ntss(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
76 
77 uint64_t ff_me_search_fss(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
78 
79 uint64_t ff_me_search_ds(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
80 
81 uint64_t ff_me_search_hexbs(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
82 
83 uint64_t ff_me_search_epzs(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
84 
85 uint64_t ff_me_search_umh(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv);
86 
87 #endif /* AVFILTER_MOTION_ESTIMATION_H */
88