]> git.sesse.net Git - x264/blobdiff - encoder/me.h
Fix float-cast-overflow in x264_ratecontrol_end function
[x264] / encoder / me.h
index 8bdee2e55f28a4d8fb9f522c323c654447e9a3a8..ce041aa66a50af9bb1b701be385067103fd8efea 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
- * me.h: h264 encoder library (Motion Estimation)
+ * me.h: motion estimation
  *****************************************************************************
- * Copyright (C) 2003-2008 x264 project
+ * Copyright (C) 2003-2016 x264 project
  *
  * Authors: Loren Merritt <lorenm@u.washington.edu>
  *          Laurent Aimar <fenrir@via.ecp.fr>
@@ -19,6 +19,9 @@
  * 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., 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 X264_ME_H
 
 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 */
-    int16_t *p_cost_mv; /* lambda * nbits for each possible mv */
+    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;
 
-    uint8_t *p_fref[6];
-    uint8_t *p_fenc[3];
+    pixel *p_fref[12];
+    pixel *p_fref_w;
+    pixel *p_fenc[3];
     uint16_t *integral;
-    int      i_stride[2];
+    int      i_stride[3];
 
     ALIGNED_4( int16_t mvp[2] );
 
@@ -48,22 +55,24 @@ typedef struct
     ALIGNED_4( int16_t mv[2] );
 } ALIGNED_16( x264_me_t );
 
-typedef struct {
+typedef struct
+{
     int sad;
-    int16_t mx, my;
+    int16_t mv[2];
 } mvsad_t;
 
 void x264_me_search_ref( x264_t *h, x264_me_t *m, int16_t (*mvc)[2], int i_mvc, int *p_fullpel_thresh );
-static inline void x264_me_search( x264_t *h, x264_me_t *m, int16_t (*mvc)[2], int i_mvc )
-    { x264_me_search_ref( h, m, mvc, i_mvc, NULL ); }
+#define x264_me_search( h, m, mvc, i_mvc )\
+    x264_me_search_ref( h, m, mvc, i_mvc, NULL )
 
 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[92][4];
+extern uint16_t *x264_cost_mv_fpel[QP_MAX+1][4];
 
 #define COPY1_IF_LT(x,y)\
 if((y)<(x))\
@@ -84,13 +93,13 @@ if((y)<(x))\
     (c)=(d);\
 }
 
-#define COPY4_IF_LT(x,y,a,b,c,d,f,e)\
+#define COPY4_IF_LT(x,y,a,b,c,d,e,f)\
 if((y)<(x))\
 {\
     (x)=(y);\
     (a)=(b);\
     (c)=(d);\
-    (f)=(e);\
+    (e)=(f);\
 }
 
 #define COPY2_IF_GT(x,y,a,b)\