]> git.sesse.net Git - x264/blobdiff - encoder/me.h
Clean up header includes
[x264] / encoder / me.h
index bc639a3ed8c1106f82bd69cd7d07fefe3bb4ecc0..06a542750996a2da2f465cc552ea8dc3969c2276 100644 (file)
@@ -1,10 +1,10 @@
 /*****************************************************************************
- * me.h: h264 encoder library (Motion Estimation)
+ * me.h: motion estimation
  *****************************************************************************
- * Copyright (C) 2003 Laurent Aimar
- * $Id: me.h,v 1.1 2004/06/03 19:27:08 fenrir Exp $
+ * Copyright (C) 2003-2016 x264 project
  *
- * Authors: Laurent Aimar <fenrir@via.ecp.fr>
+ * Authors: Loren Merritt <lorenm@u.washington.edu>
+ *          Laurent Aimar <fenrir@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing@x264.com.
  *****************************************************************************/
 
-#ifndef _ME_H
-#define _ME_H 1
+#ifndef X264_ME_H
+#define X264_ME_H
+
+#define COST_MAX (1<<28)
+#define COST_MAX64 (1ULL<<60)
 
 typedef struct
 {
+    /* aligning the first member is a gcc hack to force the struct to be
+     * 16 byte aligned, as well as force sizeof(struct) to be a multiple of 16 */
     /* input */
-    int      i_pixel;   /* PIXEL_WxH */
-    int      lm;        /* lambda motion */
-
-    uint8_t *p_fref;
-    uint8_t *p_fenc;
-    int      i_stride;
+    ALIGNED_16( int i_pixel );   /* PIXEL_WxH */
+    uint16_t *p_cost_mv; /* lambda * nbits for each possible mv */
+    int      i_ref_cost;
+    int      i_ref;
+    const x264_weight_t *weight;
 
-    int i_mv_range;
+    pixel *p_fref[12];
+    pixel *p_fref_w;
+    pixel *p_fenc[3];
+    uint16_t *integral;
+    int      i_stride[3];
 
-    int mvp[2];
-
-    int b_mvc;
-    int mvc[2];
+    ALIGNED_4( int16_t mvp[2] );
 
     /* output */
-    int cost;           /* satd + lm * nbits */
-    int mv[2];
-} x264_me_t;
+    int cost_mv;        /* lambda * nbits for the chosen mv */
+    int cost;           /* satd + lambda * nbits */
+    ALIGNED_4( int16_t mv[2] );
+} ALIGNED_16( x264_me_t );
+
+void x264_me_search_ref( x264_t *h, x264_me_t *m, int16_t (*mvc)[2], int i_mvc, int *p_fullpel_thresh );
+#define x264_me_search( h, m, mvc, i_mvc )\
+    x264_me_search_ref( h, m, mvc, i_mvc, NULL )
 
-void x264_me_search( x264_t *h, x264_me_t *m );
 void x264_me_refine_qpel( x264_t *h, x264_me_t *m );
+void x264_me_refine_qpel_refdupe( x264_t *h, x264_me_t *m, int *p_halfpel_thresh );
+void x264_me_refine_qpel_rd( x264_t *h, x264_me_t *m, int i_lambda2, int i4, int i_list );
+void x264_me_refine_bidir_rd( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight, int i8, int i_lambda2 );
+void x264_me_refine_bidir_satd( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight );
+uint64_t x264_rd_cost_part( x264_t *h, int i_lambda2, int i8, int i_pixel );
+
+extern uint16_t *x264_cost_mv_fpel[QP_MAX+1][4];
+
+#define COPY1_IF_LT(x,y)\
+if((y)<(x))\
+    (x)=(y);
+
+#define COPY2_IF_LT(x,y,a,b)\
+if((y)<(x))\
+{\
+    (x)=(y);\
+    (a)=(b);\
+}
+
+#define COPY3_IF_LT(x,y,a,b,c,d)\
+if((y)<(x))\
+{\
+    (x)=(y);\
+    (a)=(b);\
+    (c)=(d);\
+}
+
+#define COPY4_IF_LT(x,y,a,b,c,d,e,f)\
+if((y)<(x))\
+{\
+    (x)=(y);\
+    (a)=(b);\
+    (c)=(d);\
+    (e)=(f);\
+}
+
+#define COPY2_IF_GT(x,y,a,b)\
+if((y)>(x))\
+{\
+    (x)=(y);\
+    (a)=(b);\
+}
 
 #endif