x264-dsp
me.h
1 /*****************************************************************************
2  * me.h: motion estimation
3  *****************************************************************************/
4 
5 #ifndef X264_ME_H
6 #define X264_ME_H
7 
8 #define COST_MAX (1 << 28)
9 
10 typedef struct
11 {
12  /* aligning the first member is a gcc hack to force the struct to be
13  * 16 byte aligned, as well as force sizeof(struct) to be a multiple of 16 */
14  /* input */
15  ALIGNED_16(int i_pixel); /* PIXEL_WxH */
16  uint16_t *p_cost_mv; /* lambda * nbits for each possible mv */
17  int i_ref_cost; /* cost of reference number */
18  int i_ref; /* reference number */
19  const x264_weight_t *weight;
20 
21  pixel *p_fref[12]; /* refer to x264_t.mb.pic.p_fref */
22  pixel *p_fref_w; /* refer to x264_t.mb.pic.p_fref_w */
23  pixel *p_fenc[3];
24  int i_stride[3];
25 
26  ALIGNED_4(int16_t mvp[2]); /* mv predict x/y */
27 
28  /* output */
29  int cost_mv; /* lambda * nbits for the chosen mv */
30  int cost; /* satd + lambda * nbits */
31  ALIGNED_4(int16_t mv[2]); /* chosen mv x/y */
32 } ALIGNED_16(x264_me_t);
33 
34 typedef struct
35 {
36  int sad;
37  int16_t mv[2];
38 } mvsad_t;
39 
40 void x264_me_search_ref(x264_t *h, x264_me_t *m, int16_t (*mvc)[2], int i_mvc, int *p_fullpel_thresh);
41 #define x264_me_search(h, m, mvc, i_mvc) x264_me_search_ref(h, m, mvc, i_mvc, NULL)
42 
43 void x264_me_refine_qpel(x264_t *h, x264_me_t *m);
44 void x264_me_refine_qpel_refdupe(x264_t *h, x264_me_t *m, int *p_halfpel_thresh);
45 
46 #define COPY1_IF_LT(x, y) \
47  if ((y) < (x)) \
48  (x) = (y);
49 
50 #define COPY2_IF_LT(x, y, a, b) \
51  if ((y) < (x)) { \
52  (x) = (y); \
53  (a) = (b); \
54  }
55 
56 #define COPY3_IF_LT(x, y, a, b, c, d) \
57  if ((y) < (x)) { \
58  (x) = (y); \
59  (a) = (b); \
60  (c) = (d); \
61  }
62 
63 #define COPY4_IF_LT(x, y, a, b, c, d, e, f) \
64  if ((y) < (x)) { \
65  (x) = (y); \
66  (a) = (b); \
67  (c) = (d); \
68  (e) = (f); \
69  }
70 
71 #define COPY2_IF_GT(x, y, a, b) \
72  if ((y) > (x)) { \
73  (x) = (y); \
74  (a) = (b); \
75  }
76 
77 #endif
Definition: me.h:11
Definition: me.h:35
Definition: common.h:499
Definition: mc.h:10