]> git.sesse.net Git - vlc/commitdiff
* ./plugins/mga/mga.c: MMX-accelerated version of the MGA plugin.
authorSam Hocevar <sam@videolan.org>
Sun, 6 Jan 2002 17:18:12 +0000 (17:18 +0000)
committerSam Hocevar <sam@videolan.org>
Sun, 6 Jan 2002 17:18:12 +0000 (17:18 +0000)
  * ./plugins/mpeg_vdec/Makefile: Little workaround for PA-Risc compilation.

Makefile
configure
configure.in
plugins/mga/Makefile
plugins/mga/mga.c
plugins/mpeg_vdec/Makefile

index 9d0effa21c06ff9b677e9135e57efc3ba2ce0ee2..0fa5b67b423e8f3e6b1396f44eac7325170d13ef 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -98,6 +98,7 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \
                memcpy/memcpymmxext \
                memcpy/memcpy3dn \
                mga/mga \
+               mga/mgammx \
                motion/motion \
                motion/motionmmx \
                motion/motionmmxext \
index 8bd134d4c1caa6c116a665cc37e80b82ffdf7de8..a826f6ffe58a63771af2c570492c9d03612b7a9b 100755 (executable)
--- a/configure
+++ b/configure
@@ -6440,6 +6440,9 @@ if test "${enable_mga+set}" = set; then
    if test x$enable_mga = xyes
     then
       PLUGINS="${PLUGINS} mga"
+      if test x"$ac_cv_mmx_inline" != x"no"; then
+        PLUGINS="${PLUGINS} mgammx"
+      fi    
     fi 
 fi
 
@@ -6481,7 +6484,7 @@ fi
   # Extract the first word of "sdl12-config", so it can be a program name with args.
 set dummy sdl12-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6485: checking for $ac_word" >&5
+echo "configure:6488: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_SDL12_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6521,7 +6524,7 @@ fi
     # Extract the first word of "sdl11-config", so it can be a program name with args.
 set dummy sdl11-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6525: checking for $ac_word" >&5
+echo "configure:6528: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_SDL11_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6562,7 +6565,7 @@ fi
     # Extract the first word of "sdl-config", so it can be a program name with args.
 set dummy sdl-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6566: checking for $ac_word" >&5
+echo "configure:6569: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_SDL_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6608,17 +6611,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6612: checking for $ac_hdr" >&5
+echo "configure:6615: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6617 "configure"
+#line 6620 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6622: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6625: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6688,17 +6691,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6692: checking for $ac_hdr" >&5
+echo "configure:6695: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6697 "configure"
+#line 6700 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6702: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6705: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6727,7 +6730,7 @@ done
 
     else
       echo $ac_n "checking for directX headers in ${withval}""... $ac_c" 1>&6
-echo "configure:6731: checking for directX headers in ${withval}" >&5
+echo "configure:6734: checking for directX headers in ${withval}" >&5
       if test -f ${withval}/include/directx.h
       then
         PLUGINS="${PLUGINS} directx"
@@ -6814,7 +6817,7 @@ if test "${enable_gnome+set}" = set; then
     # Extract the first word of "gnome-config", so it can be a program name with args.
 set dummy gnome-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6818: checking for $ac_word" >&5
+echo "configure:6821: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GNOME_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6859,17 +6862,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6863: checking for $ac_hdr" >&5
+echo "configure:6866: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6868 "configure"
+#line 6871 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6873: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6876: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6929,7 +6932,7 @@ fi
   # Extract the first word of "gtk-config", so it can be a program name with args.
 set dummy gtk-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6933: checking for $ac_word" >&5
+echo "configure:6936: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6979,17 +6982,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6983: checking for $ac_hdr" >&5
+echo "configure:6986: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6988 "configure"
+#line 6991 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6993: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6996: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -7046,17 +7049,17 @@ if test x$enable_x11 != xno &&
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:7050: checking for $ac_hdr" >&5
+echo "configure:7053: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7055 "configure"
+#line 7058 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7060: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7063: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -7109,17 +7112,17 @@ if test x$enable_xvideo != xno &&
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:7113: checking for $ac_hdr" >&5
+echo "configure:7116: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7118 "configure"
+#line 7121 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7123: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7126: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -7159,17 +7162,17 @@ if test "${enable_alsa+set}" = set; then
    then
      ac_safe=`echo "alsa/asoundlib.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for alsa/asoundlib.h""... $ac_c" 1>&6
-echo "configure:7163: checking for alsa/asoundlib.h" >&5
+echo "configure:7166: checking for alsa/asoundlib.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7168 "configure"
+#line 7171 "configure"
 #include "confdefs.h"
 #include <alsa/asoundlib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7173: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7176: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -7186,7 +7189,7 @@ fi
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6
-echo "configure:7190: checking for main in -lasound" >&5
+echo "configure:7193: checking for main in -lasound" >&5
 ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7194,14 +7197,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lasound  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7198 "configure"
+#line 7201 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:7205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7208: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
index 362faf756ca432858893e81a8cb82ed435d74e14..0caff65ccf28de03dc06ce7b0fac92264ea01f08 100644 (file)
@@ -949,6 +949,9 @@ AC_ARG_ENABLE(mga,
   [ if test x$enable_mga = xyes
     then
       PLUGINS="${PLUGINS} mga"
+      if test x"$ac_cv_mmx_inline" != x"no"; then
+        PLUGINS="${PLUGINS} mgammx"
+      fi    
     fi ])
 
 dnl
index 630dfcad9f3e8b5f3a2d8e837d073de38ee0c6a7..cef0164a8b1e28dd37aa57eb441159c985f058bf 100644 (file)
@@ -1 +1,2 @@
 mga_SOURCES = mga.c
+mgammx_SOURCES = mga.c
index 0f90946ab3248afd6fe6754c4666b16372c0e68a..d34bc6b34f2b2b4605531ba096702b8ba34302d9 100644 (file)
@@ -2,7 +2,7 @@
  * mga.c : Matrox Graphic Array plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: mga.c,v 1.12 2002/01/05 16:09:49 sam Exp $
+ * $Id: mga.c,v 1.13 2002/01/06 17:18:12 sam Exp $
  *
  * Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
  *          Samuel Hocevar <sam@zoy.org>
@@ -65,9 +65,15 @@ MODULE_CONFIG_START
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
+#ifdef MODULE_NAME_IS_mga
     SET_DESCRIPTION( "Matrox Graphic Array video module" )
     ADD_CAPABILITY( VOUT, 10 )
     ADD_SHORTCUT( "mga" )
+#else
+    SET_DESCRIPTION( "MMX-accelerated Matrox Graphic Array video module" )
+    ADD_CAPABILITY( VOUT, 11 )
+    ADD_SHORTCUT( "mgammx" )
+#endif
 MODULE_INIT_STOP
 
 MODULE_ACTIVATE_START
@@ -367,18 +373,55 @@ static void vout_Render( vout_thread_t *p_vout, picture_t *p_pic )
     {
         /* Grmbl, we have a G200 which mistakenly assumes 4:2:0 planar
          * has *packed* chroma information! Do some conversion... */
-        u8 *p_cr, *p_cb, *p_dest;
+        u8 *p_dest = p_pic->p_sys->p_chroma;
+        u8 *p_cr = p_pic->U_PIXELS;
+        u8 *p_cb = p_pic->V_PIXELS;
         int i;
 
-        /* TODO: optimize this a bit... */
-        p_dest = p_pic->p_sys->p_chroma;
-        p_cr = p_pic->U_PIXELS;
-        p_cb = p_pic->V_PIXELS;
-
-        for( i = p_vout->p_sys->mga.frame_size / 4; i--; )
+        /* frame_size is a multiple of 64 */
+        for( i = p_vout->p_sys->mga.frame_size / 64; i--; )
         {
-            *p_dest++ = *p_cr++;
-            *p_dest++ = *p_cb++;
+#ifdef MODULE_NAME_IS_mga
+            *p_dest++ = *p_cr++; *p_dest++ = *p_cb++;
+            *p_dest++ = *p_cr++; *p_dest++ = *p_cb++;
+            *p_dest++ = *p_cr++; *p_dest++ = *p_cb++;
+            *p_dest++ = *p_cr++; *p_dest++ = *p_cb++;
+            *p_dest++ = *p_cr++; *p_dest++ = *p_cb++;
+            *p_dest++ = *p_cr++; *p_dest++ = *p_cb++;
+            *p_dest++ = *p_cr++; *p_dest++ = *p_cb++;
+            *p_dest++ = *p_cr++; *p_dest++ = *p_cb++;
+            *p_dest++ = *p_cr++; *p_dest++ = *p_cb++;
+            *p_dest++ = *p_cr++; *p_dest++ = *p_cb++;
+            *p_dest++ = *p_cr++; *p_dest++ = *p_cb++;
+            *p_dest++ = *p_cr++; *p_dest++ = *p_cb++;
+            *p_dest++ = *p_cr++; *p_dest++ = *p_cb++;
+            *p_dest++ = *p_cr++; *p_dest++ = *p_cb++;
+            *p_dest++ = *p_cr++; *p_dest++ = *p_cb++;
+            *p_dest++ = *p_cr++; *p_dest++ = *p_cb++;
+#else
+
+#   define MMX_MERGECBCR "                                                \n\
+movd       (%0), %%mm0  # Load 4 Cr           00 00 00 00 v3 v2 v1 v0     \n\
+movd       (%1), %%mm1  # Load 4 Cb           00 00 00 00 u3 u2 u1 u0     \n\
+punpcklbw %%mm1, %%mm0  #                     u3 v3 u2 v2 u1 v1 u0 v0     \n\
+movq      %%mm0, (%2)   # Store CrCb                                      \n\
+movd      4(%0), %%mm0  # Load 4 Cr           00 00 00 00 v3 v2 v1 v0     \n\
+movd      4(%1), %%mm1  # Load 4 Cb           00 00 00 00 u3 u2 u1 u0     \n\
+punpcklbw %%mm1, %%mm0  #                     u3 v3 u2 v2 u1 v1 u0 v0     \n\
+movq      %%mm0, 8(%2)  # Store CrCb                                      \n\
+movd      8(%0), %%mm0  # Load 4 Cr           00 00 00 00 v3 v2 v1 v0     \n\
+movd      8(%1), %%mm1  # Load 4 Cb           00 00 00 00 u3 u2 u1 u0     \n\
+punpcklbw %%mm1, %%mm0  #                     u3 v3 u2 v2 u1 v1 u0 v0     \n\
+movq      %%mm0, 16(%2) # Store CrCb                                      \n\
+movd     16(%0), %%mm0  # Load 4 Cr           00 00 00 00 v3 v2 v1 v0     \n\
+movd     16(%1), %%mm1  # Load 4 Cb           00 00 00 00 u3 u2 u1 u0     \n\
+punpcklbw %%mm1, %%mm0  #                     u3 v3 u2 v2 u1 v1 u0 v0     \n\
+movq      %%mm0, 32(%2) # Store CrCb                                      \n\
+"
+            __asm__( ".align 8" MMX_MERGECBCR
+                     : : "r" (p_cr), "r" (p_cb), "r" (p_dest) );
+            p_cr += 16; p_cb += 16; p_dest += 32;
+#endif
         }
     }
 }
index 333394c4729f5807230ce9be14ecfc90943a84f0..6a6e3283bf0c35f782e79fb69d0e97f3300fa741 100644 (file)
@@ -1 +1,5 @@
+ifeq ($(ARCH),hppa64)
+CFLAGS += -ffunction-sections
+endif
+
 mpeg_vdec_SOURCES = video_parser.c vpar_headers.c vpar_blocks.c vpar_synchro.c vpar_pool.c video_decoder.c