From 0d65984a11984b50f8a665d023fb9f468417a9fb Mon Sep 17 00:00:00 2001 From: Sam Hocevar <sam@videolan.org> Date: Sun, 6 Jan 2002 17:18:12 +0000 Subject: [PATCH] * ./plugins/mga/mga.c: MMX-accelerated version of the MGA plugin. * ./plugins/mpeg_vdec/Makefile: Little workaround for PA-Risc compilation. --- Makefile | 1 + configure | 63 ++++++++++++++++++++------------------ configure.in | 3 ++ plugins/mga/Makefile | 1 + plugins/mga/mga.c | 63 ++++++++++++++++++++++++++++++++------ plugins/mpeg_vdec/Makefile | 4 +++ 6 files changed, 95 insertions(+), 40 deletions(-) diff --git a/Makefile b/Makefile index 9d0effa21c..0fa5b67b42 100644 --- 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 \ diff --git a/configure b/configure index 8bd134d4c1..a826f6ffe5 100755 --- 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 diff --git a/configure.in b/configure.in index 362faf756c..0caff65ccf 100644 --- a/configure.in +++ b/configure.in @@ -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 diff --git a/plugins/mga/Makefile b/plugins/mga/Makefile index 630dfcad9f..cef0164a8b 100644 --- a/plugins/mga/Makefile +++ b/plugins/mga/Makefile @@ -1 +1,2 @@ mga_SOURCES = mga.c +mgammx_SOURCES = mga.c diff --git a/plugins/mga/mga.c b/plugins/mga/mga.c index 0f90946ab3..d34bc6b34f 100644 --- a/plugins/mga/mga.c +++ b/plugins/mga/mga.c @@ -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 } } } diff --git a/plugins/mpeg_vdec/Makefile b/plugins/mpeg_vdec/Makefile index 333394c472..6a6e3283bf 100644 --- a/plugins/mpeg_vdec/Makefile +++ b/plugins/mpeg_vdec/Makefile @@ -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 -- 2.25.4