]> git.sesse.net Git - vlc/blobdiff - src/video_decoder/vdec_motion_inner.c
* Borrowed LiViD's MMX and MMX EXT IDCT.
[vlc] / src / video_decoder / vdec_motion_inner.c
index c46f26172976135eb0160891ce104d3e66d995bb..34105c7ce01e98681b4106d3872fc6c1360455ed 100644 (file)
@@ -2,8 +2,11 @@
  * vdec_motion_inner.c : motion compensation inner routines
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: vdec_motion_inner.c,v 1.12 2001/01/05 18:46:44 massiot Exp $
  *
- * Authors:
+ * Authors: Christophe Massiot <massiot@via.ecp.fr>
+ *          Jean-Marc Dressler <polux@via.ecp.fr>
+ *          Michel Lespinasse <walken@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
@@ -25,9 +28,6 @@
  *****************************************************************************/
 #include "defs.h"
 
-#include <sys/types.h>                        /* on BSD, uio.h needs types.h */
-#include <sys/uio.h>                                          /* for input.h */
-
 #include "config.h"
 #include "common.h"
 #include "threads.h"
@@ -36,8 +36,9 @@
 
 #include "intf_msg.h"
 
-#include "input.h"
-#include "decoder_fifo.h"
+#include "stream_control.h"
+#include "input_ext-dec.h"
+
 #include "video.h"
 #include "video_output.h"
 
 #include "video_parser.h"
 #include "video_fifo.h"
 
-#define __MotionComponent_x_y_copy(width,height)                       \
-void MotionComponent_x_y_copy_##width##_##height(yuv_data_t * p_src,   \
-                                                yuv_data_t * p_dest,   \
-                                                int i_stride)          \
-{                                                                      \
-    int i_x, i_y;                                                              \
-                                                                       \
-    for( i_y = 0; i_y < height; i_y ++ )                               \
-    {                                                                  \
-       for( i_x = 0; i_x < width; i_x++ )                              \
-       {                                                               \
-           p_dest[i_x] = p_src[i_x];                                   \
-       }                                                               \
-       p_dest += i_stride;                                             \
-       p_src += i_stride;                                              \
-    }                                                                  \
+#define __MotionComponent_x_y_copy(width,height)                        \
+void MotionComponent_x_y_copy_##width##_##height(yuv_data_t * p_src,    \
+                                                 yuv_data_t * p_dest,   \
+                                                 int i_stride)          \
+{                                                                       \
+    int i_x, i_y;                                                       \
+                                                                        \
+    for( i_y = 0; i_y < height; i_y ++ )                                \
+    {                                                                   \
+        for( i_x = 0; i_x < width; i_x++ )                              \
+        {                                                               \
+            p_dest[i_x] = p_src[i_x];                                   \
+        }                                                               \
+        p_dest += i_stride;                                             \
+        p_src += i_stride;                                              \
+    }                                                                   \
 }
 
-#define __MotionComponent_X_y_copy(width,height)                       \
-void MotionComponent_X_y_copy_##width##_##height(yuv_data_t * p_src,   \
-                                                yuv_data_t * p_dest,   \
-                                                int i_stride)          \
-{                                                                      \
-    int i_x, i_y;                                                              \
-                                                                       \
-    for( i_y = 0; i_y < height; i_y ++ )                               \
-    {                                                                  \
-       for( i_x = 0; i_x < width; i_x++ )                              \
-       {                                                               \
-           p_dest[i_x] = (unsigned int)(p_src[i_x]                     \
-                                        + p_src[i_x + 1]               \
-                                        + 1) >> 1;                     \
-       }                                                               \
-       p_dest += i_stride;                                             \
-       p_src += i_stride;                                              \
-    }                                                                  \
+#define __MotionComponent_X_y_copy(width,height)                        \
+void MotionComponent_X_y_copy_##width##_##height(yuv_data_t * p_src,    \
+                                                 yuv_data_t * p_dest,   \
+                                                 int i_stride)          \
+{                                                                       \
+    int i_x, i_y;                                                       \
+                                                                        \
+    for( i_y = 0; i_y < height; i_y ++ )                                \
+    {                                                                   \
+        for( i_x = 0; i_x < width; i_x++ )                              \
+        {                                                               \
+            p_dest[i_x] = (unsigned int)(p_src[i_x]                     \
+                                         + p_src[i_x + 1]               \
+                                         + 1) >> 1;                     \
+        }                                                               \
+        p_dest += i_stride;                                             \
+        p_src += i_stride;                                              \
+    }                                                                   \
 }
 
-#define __MotionComponent_x_Y_copy(width,height)                       \
-void MotionComponent_x_Y_copy_##width##_##height(yuv_data_t * p_src,   \
-                                                yuv_data_t * p_dest,   \
-                                                int i_stride,          \
-                                                int i_step)            \
-{                                                                      \
-    int i_x, i_y;                                                              \
-                                                                       \
-    for( i_y = 0; i_y < height; i_y ++ )                               \
-    {                                                                  \
-       for( i_x = 0; i_x < width; i_x++ )                              \
-       {                                                               \
-           p_dest[i_x] = (unsigned int)(p_src[i_x]                     \
-                                        + p_src[i_x + i_step]          \
-                                        + 1) >> 1;                     \
-       }                                                               \
-       p_dest += i_stride;                                             \
-       p_src += i_stride;                                              \
-    }                                                                  \
+#define __MotionComponent_x_Y_copy(width,height)                        \
+void MotionComponent_x_Y_copy_##width##_##height(yuv_data_t * p_src,    \
+                                                 yuv_data_t * p_dest,   \
+                                                 int i_stride)          \
+{                                                                       \
+    int i_x, i_y;                                                       \
+                                                                        \
+    for( i_y = 0; i_y < height; i_y ++ )                                \
+    {                                                                   \
+        for( i_x = 0; i_x < width; i_x++ )                              \
+        {                                                               \
+            p_dest[i_x] = (unsigned int)(p_src[i_x]                     \
+                                         + p_src[i_x + i_stride]        \
+                                         + 1) >> 1;                     \
+        }                                                               \
+        p_dest += i_stride;                                             \
+        p_src += i_stride;                                              \
+    }                                                                   \
 }
 
-#define __MotionComponent_X_Y_copy(width,height)                       \
-void MotionComponent_X_Y_copy_##width##_##height(yuv_data_t * p_src,   \
-                                                yuv_data_t * p_dest,   \
-                                                int i_stride,          \
-                                                int i_step)            \
-{                                                                      \
-    int i_x, i_y;                                                              \
-                                                                       \
-    for( i_y = 0; i_y < height; i_y ++ )                               \
-    {                                                                  \
-       for( i_x = 0; i_x < width; i_x++ )                              \
-       {                                                               \
-           p_dest[i_x] = (unsigned int)(p_src[i_x]                     \
-                                        + p_src[i_x + 1]               \
-                                        + p_src[i_x + i_step]          \
-                                        + p_src[i_x + i_step + 1]      \
-                                        + 2) >> 2;                     \
-       }                                                               \
-       p_dest += i_stride;                                             \
-       p_src += i_stride;                                              \
-    }                                                                  \
+#define __MotionComponent_X_Y_copy(width,height)                        \
+void MotionComponent_X_Y_copy_##width##_##height(yuv_data_t * p_src,    \
+                                                 yuv_data_t * p_dest,   \
+                                                 int i_stride)          \
+{                                                                       \
+    int i_x, i_y;                                                       \
+                                                                        \
+    for( i_y = 0; i_y < height; i_y ++ )                                \
+    {                                                                   \
+        for( i_x = 0; i_x < width; i_x++ )                              \
+        {                                                               \
+            p_dest[i_x] = (unsigned int)(p_src[i_x]                     \
+                                         + p_src[i_x + 1]               \
+                                         + p_src[i_x + i_stride]        \
+                                         + p_src[i_x + i_stride + 1]    \
+                                         + 2) >> 2;                     \
+        }                                                               \
+        p_dest += i_stride;                                             \
+        p_src += i_stride;                                              \
+    }                                                                   \
 }
 
-#define __MotionComponent_x_y_avg(width,height)                                \
-void MotionComponent_x_y_avg_##width##_##height(yuv_data_t * p_src,    \
-                                               yuv_data_t * p_dest,    \
-                                               int i_stride)           \
-{                                                                      \
-    int i_x, i_y;                                                              \
-    unsigned int i_dummy;                                              \
-                                                                       \
-    for( i_y = 0; i_y < height; i_y ++ )                               \
-    {                                                                  \
-       for( i_x = 0; i_x < width; i_x++ )                              \
-       {                                                               \
-           i_dummy = p_dest[i_x] + p_src[i_x];                         \
-           p_dest[i_x] = (i_dummy + 1) >> 1;                           \
-       }                                                               \
-       p_dest += i_stride;                                             \
-       p_src += i_stride;                                              \
-    }                                                                  \
+#define __MotionComponent_x_y_avg(width,height)                         \
+void MotionComponent_x_y_avg_##width##_##height(yuv_data_t * p_src,     \
+                                                yuv_data_t * p_dest,    \
+                                                int i_stride)           \
+{                                                                       \
+    int i_x, i_y;                                                       \
+    unsigned int i_dummy;                                               \
+                                                                        \
+    for( i_y = 0; i_y < height; i_y ++ )                                \
+    {                                                                   \
+        for( i_x = 0; i_x < width; i_x++ )                              \
+        {                                                               \
+            i_dummy = p_dest[i_x] + p_src[i_x];                         \
+            p_dest[i_x] = (i_dummy + 1) >> 1;                           \
+        }                                                               \
+        p_dest += i_stride;                                             \
+        p_src += i_stride;                                              \
+    }                                                                   \
 }
 
-#define __MotionComponent_X_y_avg(width,height)                                \
-void MotionComponent_X_y_avg_##width##_##height(yuv_data_t * p_src,    \
-                                               yuv_data_t * p_dest,    \
-                                               int i_stride)           \
-{                                                                      \
-    int i_x, i_y;                                                              \
-    unsigned int i_dummy;                                              \
-                                                                       \
-    for( i_y = 0; i_y < height; i_y ++ )                               \
-    {                                                                  \
-       for( i_x = 0; i_x < width; i_x++ )                              \
-       {                                                               \
-           i_dummy = p_dest[i_x] + ((unsigned int)(p_src[i_x]          \
-                                                   + p_src[i_x + 1]    \
-                                                   + 1) >> 1);         \
-           p_dest[i_x] = (i_dummy + 1) >> 1;                           \
-       }                                                               \
-       p_dest += i_stride;                                             \
-       p_src += i_stride;                                              \
-    }                                                                  \
+#define __MotionComponent_X_y_avg(width,height)                         \
+void MotionComponent_X_y_avg_##width##_##height(yuv_data_t * p_src,     \
+                                                yuv_data_t * p_dest,    \
+                                                int i_stride)           \
+{                                                                       \
+    int i_x, i_y;                                                       \
+    unsigned int i_dummy;                                               \
+                                                                        \
+    for( i_y = 0; i_y < height; i_y ++ )                                \
+    {                                                                   \
+        for( i_x = 0; i_x < width; i_x++ )                              \
+        {                                                               \
+            i_dummy = p_dest[i_x] + ((unsigned int)(p_src[i_x]          \
+                                                    + p_src[i_x + 1]    \
+                                                    + 1) >> 1);         \
+            p_dest[i_x] = (i_dummy + 1) >> 1;                           \
+        }                                                               \
+        p_dest += i_stride;                                             \
+        p_src += i_stride;                                              \
+    }                                                                   \
 }
 
-#define __MotionComponent_x_Y_avg(width,height)                                \
-void MotionComponent_x_Y_avg_##width##_##height(yuv_data_t * p_src,    \
-                                               yuv_data_t * p_dest,    \
-                                               int i_stride,           \
-                                               int i_step)             \
-{                                                                      \
-    int i_x, i_y;                                                              \
-    unsigned int i_dummy;                                              \
-                                                                       \
-    for( i_y = 0; i_y < height; i_y ++ )                               \
-    {                                                                  \
-       for( i_x = 0; i_x < width; i_x++ )                              \
-       {                                                               \
-           i_dummy =                                                   \
-               p_dest[i_x] + ((unsigned int)(p_src[i_x]                \
-                                             + p_src[i_x + i_step]     \
-                                             + 1) >> 1);               \
-           p_dest[i_x] = (i_dummy + 1) >> 1;                           \
-       }                                                               \
-       p_dest += i_stride;                                             \
-       p_src += i_stride;                                              \
-    }                                                                  \
+#define __MotionComponent_x_Y_avg(width,height)                         \
+void MotionComponent_x_Y_avg_##width##_##height(yuv_data_t * p_src,     \
+                                                yuv_data_t * p_dest,    \
+                                                int i_stride)           \
+{                                                                       \
+    int i_x, i_y;                                                       \
+    unsigned int i_dummy;                                               \
+                                                                        \
+    for( i_y = 0; i_y < height; i_y ++ )                                \
+    {                                                                   \
+        for( i_x = 0; i_x < width; i_x++ )                              \
+        {                                                               \
+            i_dummy =                                                   \
+                p_dest[i_x] + ((unsigned int)(p_src[i_x]                \
+                                              + p_src[i_x + i_stride]   \
+                                              + 1) >> 1);               \
+            p_dest[i_x] = (i_dummy + 1) >> 1;                           \
+        }                                                               \
+        p_dest += i_stride;                                             \
+        p_src += i_stride;                                              \
+    }                                                                   \
 }
 
-#define __MotionComponent_X_Y_avg(width,height)                                \
-void MotionComponent_X_Y_avg_##width##_##height(yuv_data_t * p_src,    \
-                                               yuv_data_t * p_dest,    \
-                                               int i_stride,           \
-                                               int i_step)             \
-{                                                                      \
-    int i_x, i_y;                                                              \
-    unsigned int i_dummy;                                              \
-                                                                       \
-    for( i_y = 0; i_y < height; i_y ++ )                               \
-    {                                                                  \
-       for( i_x = 0; i_x < width; i_x++ )                              \
-       {                                                               \
-           i_dummy =                                                   \
-               p_dest[i_x] + ((unsigned int)(p_src[i_x]                \
-                                             + p_src[i_x + 1]          \
-                                             + p_src[i_x + i_step]     \
-                                             + p_src[i_x + i_step + 1] \
-                                             + 2) >> 2);               \
-           p_dest[i_x] = (i_dummy + 1) >> 1;                           \
-       }                                                               \
-       p_dest += i_stride;                                             \
-       p_src += i_stride;                                              \
-    }                                                                  \
+#define __MotionComponent_X_Y_avg(width,height)                         \
+void MotionComponent_X_Y_avg_##width##_##height(yuv_data_t * p_src,     \
+                                                yuv_data_t * p_dest,    \
+                                                int i_stride)           \
+{                                                                       \
+    int i_x, i_y;                                                       \
+    unsigned int i_dummy;                                               \
+                                                                        \
+    for( i_y = 0; i_y < height; i_y ++ )                                \
+    {                                                                   \
+        for( i_x = 0; i_x < width; i_x++ )                              \
+        {                                                               \
+            i_dummy =                                                   \
+                p_dest[i_x] + ((unsigned int)(p_src[i_x]                \
+                                            + p_src[i_x + 1]            \
+                                            + p_src[i_x + i_stride]     \
+                                            + p_src[i_x + i_stride + 1] \
+                                            + 2) >> 2);                 \
+            p_dest[i_x] = (i_dummy + 1) >> 1;                           \
+        }                                                               \
+        p_dest += i_stride;                                             \
+        p_src += i_stride;                                              \
+    }                                                                   \
 }
 
-#define __MotionComponents(width,height)       \
-__MotionComponent_x_y_copy(width,height)       \
-__MotionComponent_X_y_copy(width,height)       \
-__MotionComponent_x_Y_copy(width,height)       \
-__MotionComponent_X_Y_copy(width,height)       \
-__MotionComponent_x_y_avg(width,height)                \
-__MotionComponent_X_y_avg(width,height)                \
-__MotionComponent_x_Y_avg(width,height)                \
+#define __MotionComponents(width,height)        \
+__MotionComponent_x_y_copy(width,height)        \
+__MotionComponent_X_y_copy(width,height)        \
+__MotionComponent_x_Y_copy(width,height)        \
+__MotionComponent_X_Y_copy(width,height)        \
+__MotionComponent_x_y_avg(width,height)         \
+__MotionComponent_X_y_avg(width,height)         \
+__MotionComponent_x_Y_avg(width,height)         \
 __MotionComponent_X_Y_avg(width,height)
 
-__MotionComponents (16,16)     /* 444, 422, 420 */
-__MotionComponents (16,8)      /* 444, 422, 420 */
-__MotionComponents (8,8)       /* 422, 420 */
-__MotionComponents (8,4)       /* 420 */
+__MotionComponents (16,16)      /* 444, 422, 420 */
+__MotionComponents (16,8)       /* 444, 422, 420 */
+__MotionComponents (8,8)        /* 422, 420 */
+__MotionComponents (8,4)        /* 420 */
 #if 0
-__MotionComponents (8,16)      /* 422 */
+__MotionComponents (8,16)       /* 422 */
 #endif