* Borrowed MPlayer's fast memcpy() routines. Best is autodetected, choose

"--memcpy <whatever>" to choose one from c, mmx, mmxext or 3dn.
    Please test! Especially Athlon users.
  * Added versioned build-dep to libasound2-dev (Closes Debian bug #121057).
  * Updated Gtk/GNOME interfaces to use "udpstream" instead of "ts".
  * Unrolled ChangeLog.
This commit is contained in:
Sam Hocevar 2001-12-03 16:18:37 +00:00
parent c4535c4ce3
commit 95a333bf0a
39 changed files with 1315 additions and 294 deletions

View File

@ -4,6 +4,79 @@
HEAD
* Borrowed MPlayer's fast memcpy() routines. Best is autodetected, choose
"--memcpy <whatever>" to choose one from c, mmx, mmxext or 3dn.
* Added versioned build-dep to libasound2-dev (Closes Debian bug #121057).
* Updated Gtk/GNOME interfaces to use "udpstream" instead of "ts".
* More checks for GTK headers.
* Fixed a crash when pausing.
* Fixed numerous bugs in ES selection.
* Fixed stupid bug in vout_Manage. It sometimes called SetDSequenceMatrix
when there was no valid sequence.
* Hopeless fix for the input netlist corruption bug.
* Implemented simple BDirectWindow (DMA) support.
* DeleteDecoderConfig wasn't freeing (anymore) the packets left in the
decoder fifo. This bug was creating an io_vec starving on title change
when playing DVDs.
* Removed a bug in the Makefile that made the CVS-snapshots building fail.
* Added "#include <string.>" to include/threads.h.
* Removed the mutex the vout and intf thread (were supposed to use)
for syncronizing acces to the p_vout->p_sys structure.
* Added error checking in pthread wrapper; as a result, intf_msg.h must
now be included *before* threads.h.
* Changed all files to include intf_msg.h before threads.h; while I was
at it, I update the copyright notices.
* Removed the obsolete darwin plug-in.
* Fixed a deadlock (bug reported by marcari).
* Various (sometimes hopeless) fixes to try to improve xvideo stability.
* Documentation updates.
* Updated man page.
* dvd:<device>[@<raw device>] to avoid device namespace collision under
win32.
* Fixed a compilation issue under Win32.
* Fixed a potential packet corruption in the DVD input.
* Changed the protocol version for communication between vlc and vlcs
from 12 to 13 (due to change from ts:// to udpstream://)
* Big clean-up to allow compiling every module as plugins.
* Added bytes_swap.h to provide ntoh() and htol() on Win32. With this
change we don't have to link winsock2 with every plugin anymore. This
should also give us a slight speed increase.
* Added #define WIN32_LEAN_AND_MEAN in threads.h to speed-up compilation
on Win32.
* Modified ac_downmix_3dn and sse so they compile with the latest gcc for
Win32.
* Support for libdvdread.
* Added "Video" menu hint to debian/*menu (Closes Debian bug #121036).
* Major rewrite of the network layer. only supported syntax is:
udp[stream]:[//][serveraddr:[serverport]][@[bindaddr][:bindport]]
* Don`t use long long, use u64/s64 (int_types.h).
* Fixed a stale pointer in mpeg_vdec_Run().
* (Hopefully) fixed the network connect() bug under UNIX.
* aRts audio output courtesy of Emmanuel Blindauer <manu@agat.net>.
* Fix to the esd plugin when esd-config --cflags is nonempty.
* --channels puts gtk/gnome in multi-channel network mode.
* The network window of the interface reports the values of the environment
variables.
* Channels mode excludes vls configuration.
* The vlc does not try to bind vls.via.ecp.fr by default when you select
channels mode.
* Fixed MacOS X 10.1 network input, thanks to Mathias Kretschmer
<mathias@research.att.com>.
* Fixed a few crashes due to race conditions in the decoder spawning.
* Removed unused code here and there.
* Fixed a bug in altivec detection on MacOS X.
* It seems that the 'focus' bug under WinME is solved.
* Updated the INSTALL-win32.txt file.
* The ./configure script is more friendly for Win32 users.
* Moved warning message to debug message in spdif pass-through plugin.
* Changed a bit the wait time. It works better here, please test.
* The default file-translation mode was not being set under win32.
* Fixed heap corruption issues in ac3dec (thanks reno).
* Fixed a crash when using `--input dvd /dev/dvd' instead of `dvd:/dev/dvd'.
* configure should no longer assume AltiVec is supported when it actually
isn't with buggy compilers and/or pre-set $CFLAGS.
* Commited my little release-howto (only useful to core vlc developers).
* Closing Debian bug #119369 which was fixed a while ago.
* Decoder modularization.
0.2.91

View File

@ -4,7 +4,10 @@
HEAD
* Nothing yet.
* Update for libdvdcss documentation.
* Reworked Keith Packard's raw device patch. The name of the raw device
is in the environment variable DVDCSS_RAW_DEVICE.
* Fixed a bug in libdvdcss: the key wasn't searched when it had to.
1.0.0
Mon, 12 Nov 2001 17:14:29 +0100

View File

@ -34,6 +34,7 @@ PLUGINS_DIR := ac3_adec \
kde \
lpcm_adec \
macosx \
memcpy \
mga \
motion \
mpeg \
@ -78,6 +79,10 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \
kde/kde \
lpcm_adec/lpcm_adec \
macosx/macosx \
memcpy/memcpy \
memcpy/memcpymmx \
memcpy/memcpymmxext \
memcpy/memcpy3dn \
mga/mga \
motion/motion \
motion/motionmmx \

411
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -295,15 +295,15 @@ ARCH=${target_cpu}
dnl
dnl default modules
dnl
BUILTINS="${BUILTINS} es ps ts yuv idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
BUILTINS="${BUILTINS} es ps ts memcpy yuv idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
PLUGINS="${PLUGINS} ac3_spdif spu_dec"
dnl
dnl Accelerated modules
dnl
MMX_MODULES="yuvmmx idctmmx motionmmx"
MMXEXT_MODULES="idctmmxext motionmmxext"
THREEDNOW_MODULES="imdct3dn downmix3dn"
MMX_MODULES="memcpymmx yuvmmx idctmmx motionmmx"
MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn"
SSE_MODULES="imdctsse downmixsse"
ALTIVEC_MODULES="idctaltivec motionaltivec"
@ -328,7 +328,7 @@ AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
[AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
if test x"$ac_cv_3dnow_inline" != x"no"; then
AC_DEFINE(HAVE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
fi
@ -337,7 +337,7 @@ AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
[AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
if test x"$ac_cv_sse_inline" != x"no"; then
AC_DEFINE(HAVE_SSE, 1, Define if \$CC groks SSE inline assembly.)
AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
fi
@ -353,7 +353,7 @@ AC_CACHE_CHECK([if \$CC groks Altivec inline assembly],
CFLAGS=$save_CFLAGS
])])
if test x"$ac_cv_altivec_inline" != x"no"; then
AC_DEFINE(HAVE_ALTIVEC, 1, Define if \$CC groks ALTIVEC inline assembly.)
AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks ALTIVEC inline assembly.)
ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
fi
@ -372,7 +372,7 @@ AC_CACHE_CHECK([if \$CC groks Altivec C extensions],
CFLAGS=$save_CFLAGS
])
if test x"$ac_cv_c_altivec" != x"no"; then
AC_DEFINE(HAVE_C_ALTIVEC, 1, Define if your compiler groks C altivec extensions.)
AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C altivec extensions.)
CFLAGS_ALTIVEC="$CFLAGS_ALTIVEC $ac_cv_c_altivec"
ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
fi
@ -1129,7 +1129,7 @@ AC_ARG_ENABLE(alsa,
(default disabled)],
[if test x$enable_alsa = xyes
then
AC_CHECK_HEADER(sys/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
if test x$have_alsa = xtrue
then
PLUGINS="${PLUGINS} alsa"

1
debian/changelog vendored
View File

@ -1,5 +1,6 @@
vlc (0.2.91-2) unstable; urgency=low
* Added versioned build-dep to libasound2-dev (Closes: #121057).
* Added "Video" menu hints (Closes: #121036).
-- Samuel Hocevar <sam@zoy.org> Sun, 25 Nov 2001 02:25:34 +0100

2
debian/control vendored
View File

@ -2,7 +2,7 @@ Source: vlc
Section: graphics
Priority: optional
Maintainer: Samuel Hocevar <sam@zoy.org>
Build-Depends: debhelper (>=2.2.0), xlibs-dev, libgnome-dev, libggi2-dev, libglide2-dev [i386], libesd0-dev, libsdl1.2-dev, libqt-dev, libasound2-dev [alpha i386 ia64 m68k powerpc]
Build-Depends: debhelper (>=2.2.0), xlibs-dev, libgnome-dev, libggi2-dev, libglide2-dev [i386], libesd0-dev, libsdl1.2-dev, libqt-dev, libasound2-dev [alpha i386 ia64 m68k powerpc] (>=0.9.0beta7)
Standards-Version: 3.0.1
Package: vlc

View File

@ -1,2 +1,2 @@
usr/lib
usr/share/doc/libdvdcss0
usr/share/doc/libdvdcss1

3
debian/rules vendored
View File

@ -94,8 +94,7 @@ install: build
# libdvdcss start
mv debian/vlc/usr/include/videolan/dvdcss.h \
debian/libdvdcss$(major)-dev/usr/include/videolan
rmdir debian/vlc/usr/include/videolan
rmdir debian/vlc/usr/include
rm -Rf debian/vlc/usr/include
mv debian/vlc/usr/lib/*.a debian/libdvdcss$(major)-dev/usr/lib
mv debian/vlc/usr/lib/*.so debian/libdvdcss$(major)-dev/usr/lib
mv debian/vlc/usr/lib/*.so.* debian/libdvdcss$(major)/usr/lib

View File

@ -27,8 +27,8 @@ The input thread spawns the appropriate decoder modules from <filename>
src/input/input_dec.c</filename>. The <function>Dec_CreateThread</funcion>
function selects the more accurate decoder module. Each decoder module
looks at decoder_config.i_type and returns a score [ see the modules
section ]. It then launches <function> module.pf_RunThread()</function>,
with an <type>decoder_config_t</type>, described in <filename>
section ]. It then launches <function> module.pf_run()</function>,
with a <type>decoder_config_t</type>, described in <filename>
include/input_ext-dec.h</filename>.
</para>

View File

@ -66,6 +66,9 @@ Set
.B vlc
verbosity. This command is cumulative, you can use "-vv" or "-vvvv" for increased verbosity.
.TP
.B \-\-memcpy <module>
Specify a module for performing heavy memory copies: "memcpy", "sse" for instance.
.TP
.B \-\-noaudio
Disable audio output.
.TP

View File

@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.51 2001/11/28 15:08:04 massiot Exp $
* $Id: common.h,v 1.52 2001/12/03 16:18:37 sam Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
@ -237,6 +237,8 @@ struct decoder_fifo_s;
#define I64C(x) x##LL
/* Pointer to the fast memcpy plugin function */
extern void* ( * pf_fast_memcpy ) ( void *, const void *, size_t );
/* The win32 specific stuff was getting really big so it has been moved */
#if defined( WIN32 )
@ -282,6 +284,8 @@ typedef struct module_symbols_s
void ( * intf_PlaylistJumpto ) ( struct playlist_s *, int );
void ( * intf_UrlDecode ) ( char * );
void* ( * pf_fast_memcpy ) ( void *, const void *, size_t );
void ( * msleep ) ( mtime_t );
mtime_t ( * mdate ) ( void );

View File

@ -90,6 +90,9 @@
* outputting an error message (in second) */
#define THREAD_COND_TIMEOUT 5
/* Environment variable containing the memcpy method */
#define MEMCPY_METHOD_VAR "vlc_memcpy"
/*
* Decoders FIFO configuration
*/
@ -326,16 +329,11 @@
/* Default dimensions for display window - these dimensions are enough for the
* standard width and height broadcasted MPEG-2 streams or DVDs */
#define VOUT_WIDTH_VAR "vlc_width"
#define VOUT_HEIGHT_VAR "vlc_height"
#define VOUT_WIDTH_DEFAULT 720
#define VOUT_HEIGHT_VAR "vlc_height"
#define VOUT_HEIGHT_DEFAULT 576
#define VOUT_DEPTH_VAR "vlc_depth"
#define VOUT_DEPTH_DEFAULT 15
#define VOUT_FULLSCREEN_VAR "vlc_fullscreen"
#define VOUT_FULLSCREEN_DEFAULT 0
#define VOUT_FULLSCREEN_DEPTH_VAR "vlc_fullscreen_depth"
#define VOUT_FULLSCREEN_DEPTH_DEFAULT 32

View File

@ -97,9 +97,15 @@
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <gdk/gdk.h> header file. */
#undef HAVE_GDK_GDK_H
/* Define if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define if you have the <glib.h> header file. */
#undef HAVE_GLIB_H
/* Define if you have the <gnome.h> header file. */
#undef HAVE_GNOME_H
@ -203,16 +209,16 @@
#undef BOOLEAN_T_IN_CTHREADS_H
/* Define if $CC groks 3D Now! inline assembly. */
#undef HAVE_3DNOW
#undef CAN_COMPILE_3DNOW
/* Define if $CC groks SSE inline assembly. */
#undef HAVE_SSE
#undef CAN_COMPILE_SSE
/* Define if $CC groks ALTIVEC inline assembly. */
#undef HAVE_ALTIVEC
#undef CAN_COMPILE_ALTIVEC
/* Define if your compiler groks C altivec extensions. */
#undef HAVE_C_ALTIVEC
#undef CAN_COMPILE_C_ALTIVEC
/* Define if <sys/cdio.h> defines dvd_struct. */
#undef DVD_STRUCT_IN_SYS_CDIO_H

View File

@ -2,7 +2,7 @@
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-dec.h,v 1.39 2001/11/15 17:39:12 sam Exp $
* $Id: input_ext-dec.h,v 1.40 2001/12/03 16:18:37 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
@ -479,14 +479,14 @@ static __inline__ void GetChunk( bit_stream_t * p_bit_stream,
if( (i_available = p_bit_stream->p_end - p_bit_stream->p_byte)
>= i_buf_len )
{
memcpy( p_buffer, p_bit_stream->p_byte, i_buf_len );
pf_fast_memcpy( p_buffer, p_bit_stream->p_byte, i_buf_len );
p_bit_stream->p_byte += i_buf_len;
}
else
{
do
{
memcpy( p_buffer, p_bit_stream->p_byte, i_available );
pf_fast_memcpy( p_buffer, p_bit_stream->p_byte, i_available );
p_bit_stream->p_byte = p_bit_stream->p_end;
p_buffer += i_available;
i_buf_len -= i_available;
@ -497,7 +497,7 @@ static __inline__ void GetChunk( bit_stream_t * p_bit_stream,
if( i_buf_len )
{
memcpy( p_buffer, p_bit_stream->p_byte, i_buf_len );
pf_fast_memcpy( p_buffer, p_bit_stream->p_byte, i_buf_len );
p_bit_stream->p_byte += i_buf_len;
}
}

View File

@ -3,7 +3,7 @@
* Declaration and extern access to global program object.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: main.h,v 1.22 2001/10/01 16:18:48 massiot Exp $
* $Id: main.h,v 1.23 2001/12/03 16:18:37 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
@ -50,6 +50,9 @@ typedef struct main_s
boolean_t b_video; /* is video output allowed ? */
boolean_t b_ac3;
/* memcpy plugin used */
struct module_s * p_memcpy_module;
/* Unique threads */
p_intf_thread_t p_intf; /* main interface thread */

View File

@ -2,7 +2,7 @@
* modules.h : Module management functions.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.h,v 1.32 2001/11/13 18:10:38 sam Exp $
* $Id: modules.h,v 1.33 2001/12/03 16:18:37 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
@ -67,6 +67,7 @@ typedef void * module_handle_t;
#define MODULE_CAPABILITY_YUV 1 << 9 /* YUV colorspace conversion */
#define MODULE_CAPABILITY_IMDCT 1 << 10 /* IMDCT transformation */
#define MODULE_CAPABILITY_DOWNMIX 1 << 11 /* AC3 downmix */
#define MODULE_CAPABILITY_MEMCPY 1 << 12 /* memcpy */
/* FIXME: kludge */
struct input_area_s;
@ -219,9 +220,15 @@ typedef struct function_list_s
/* Decoder plugins */
struct
{
int ( * pf_RunThread ) ( struct decoder_config_s * p_config );
int ( * pf_run ) ( struct decoder_config_s * p_config );
} dec;
/* memcpy plugins */
struct
{
void* ( * pf_fast_memcpy ) ( void *, const void *, size_t );
} memcpy;
} functions;
} function_list_t;
@ -241,6 +248,7 @@ typedef struct module_functions_s
function_list_t yuv;
function_list_t imdct;
function_list_t downmix;
function_list_t memcpy;
} module_functions_t;

View File

@ -45,6 +45,7 @@
(p_symbols)->intf_PlaylistDestroy = intf_PlaylistDestroy; \
(p_symbols)->intf_PlaylistJumpto = intf_PlaylistJumpto; \
(p_symbols)->intf_UrlDecode = intf_UrlDecode; \
(p_symbols)->pf_fast_memcpy = pf_fast_memcpy; \
(p_symbols)->msleep = msleep; \
(p_symbols)->mdate = mdate; \
(p_symbols)->network_ChannelCreate = network_ChannelCreate; \
@ -149,6 +150,8 @@
# define intf_PlaylistJumpto(a,b) p_symbols->intf_PlaylistJumpto(a,b)
# define intf_UrlDecode(a) p_symbols->intf_UrlDecode(a)
# define pf_fast_memcpy p_symbols->pf_fast_memcpy
# define msleep(a) p_symbols->msleep(a)
# define mdate() p_symbols->mdate()

View File

@ -2,7 +2,7 @@
* ac3_adec.c: ac3 decoder module main file
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ac3_adec.c,v 1.4 2001/11/28 15:08:04 massiot Exp $
* $Id: ac3_adec.c,v 1.5 2001/12/03 16:18:37 sam Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
*
@ -75,7 +75,7 @@ static void BitstreamCallback ( bit_stream_t *p_bit_stream,
void _M( adec_getfunctions )( function_list_t * p_function_list )
{
p_function_list->pf_probe = ac3_adec_Probe;
p_function_list->functions.dec.pf_RunThread = ac3_adec_Run;
p_function_list->functions.dec.pf_run = ac3_adec_Run;
}
/*****************************************************************************

View File

@ -2,7 +2,7 @@
* ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: ac3_spdif.c,v 1.4 2001/11/28 15:08:05 massiot Exp $
* $Id: ac3_spdif.c,v 1.5 2001/12/03 16:18:37 sam Exp $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
* Juha Yrjola <jyrjola@cc.hut.fi>
@ -75,7 +75,7 @@ static void BitstreamCallback( bit_stream_t *, boolean_t );
void _M( adec_getfunctions )( function_list_t * p_function_list )
{
p_function_list->pf_probe = ac3_spdif_Probe;
p_function_list->functions.dec.pf_RunThread = ac3_spdif_Run;
p_function_list->functions.dec.pf_run = ac3_spdif_Run;
}
/*****************************************************************************

View File

@ -2,7 +2,7 @@
* aout_alsa.c : Alsa functions library
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: aout_alsa.c,v 1.20 2001/11/28 15:08:05 massiot Exp $
* $Id: aout_alsa.c,v 1.21 2001/12/03 16:18:37 sam Exp $
*
* Authors: Henri Fallon <henri@videolan.org> - Original Author
* Jeffrey Baker <jwbaker@acm.org> - Port to ALSA 1.0 API
@ -36,7 +36,7 @@
#include <stdio.h> /* "intf_msg.h" */
#include <stdlib.h> /* calloc(), malloc(), free() */
#include <sys/asoundlib.h>
#include <alsa/asoundlib.h>
#include "config.h"
#include "common.h" /* boolean_t, byte_t */

View File

@ -2,7 +2,7 @@
* gtk_open.c : functions to handle file/disc/network open widgets.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_open.c,v 1.9 2001/11/28 15:08:05 massiot Exp $
* $Id: gtk_open.c,v 1.10 2001/12/03 16:18:37 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
@ -336,7 +336,7 @@ void GtkNetworkOpenOk( GtkButton *button, gpointer user_data )
if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
"network_ts" ) )->active )
{
psz_protocol = "ts";
psz_protocol = "udpstream";
}
else if( GTK_TOGGLE_BUTTON( lookup_widget( GTK_WIDGET(button),
"network_rtp" ) )->active )

View File

@ -2,7 +2,7 @@
* lpcm_decoder_thread.c: lpcm decoder thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: lpcm_adec.c,v 1.2 2001/11/28 15:08:05 massiot Exp $
* $Id: lpcm_adec.c,v 1.3 2001/12/03 16:18:37 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Henri Fallon <henri@videolan.org>
@ -71,7 +71,7 @@ static void lpcm_adec_EndThread ( lpcmdec_thread_t * );
void _M( adec_getfunctions )( function_list_t * p_function_list )
{
p_function_list->pf_probe = lpcm_adec_Probe;
p_function_list->functions.dec.pf_RunThread = lpcm_adec_Run;
p_function_list->functions.dec.pf_run = lpcm_adec_Run;
}
/*****************************************************************************

View File

@ -0,0 +1 @@
.dep

61
plugins/memcpy/Makefile Normal file
View File

@ -0,0 +1,61 @@
###############################################################################
# vlc (VideoLAN Client) memcpy module makefile
# (c)2001 VideoLAN
###############################################################################
#
# Objects
#
PLUGIN_MEMCPY = memcpy.o
PLUGIN_MEMCPYMMX = memcpymmx.o
PLUGIN_MEMCPYMMXEXT = memcpymmxext.o
PLUGIN_MEMCPY3DN = memcpy3dn.o
BUILTIN_MEMCPY = $(PLUGIN_MEMCPY:%.o=BUILTIN_%.o)
BUILTIN_MEMCPYMMX = $(PLUGIN_MEMCPYMMX:%.o=BUILTIN_%.o)
BUILTIN_MEMCPYMMXEXT = $(PLUGIN_MEMCPYMMXEXT:%.o=BUILTIN_%.o)
BUILTIN_MEMCPY3DN = $(PLUGIN_MEMCPY3DN:%.o=BUILTIN_%.o)
PLUGIN_C = $(PLUGIN_MEMCPY) $(PLUGIN_MEMCPYMMX) $(PLUGIN_MEMCPYMMXEXT) $(PLUGIN_MEMCPY3DN)
BUILTIN_C = $(BUILTIN_MEMCPY) $(BUILTIN_MEMCPYMMX) $(BUILTIN_MEMCPYMMXEXT) $(BUILTIN_MEMCPY3DN)
ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
#
# Virtual targets
#
include ../../Makefile.modules
#
# Real targets
#
../memcpy.so: $(PLUGIN_MEMCPY)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../memcpy.a: $(BUILTIN_MEMCPY)
ar r $@ $^
$(RANLIB) $@
../memcpymmx.so: $(PLUGIN_MEMCPYMMX)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../memcpymmx.a: $(BUILTIN_MEMCPYMMX)
ar r $@ $^
$(RANLIB) $@
../memcpymmxext.so: $(PLUGIN_MEMCPYMMXEXT)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../memcpymmxext.a: $(BUILTIN_MEMCPYMMXEXT)
ar r $@ $^
$(RANLIB) $@
../memcpy3dn.so: $(PLUGIN_MEMCPY3DN)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../memcpy3dn.a: $(BUILTIN_MEMCPY3DN)
ar r $@ $^
$(RANLIB) $@

384
plugins/memcpy/fastmemcpy.h Normal file
View File

@ -0,0 +1,384 @@
/*****************************************************************************
* fastmemcpy.h : fast memcpy routines
*****************************************************************************
* $Id: fastmemcpy.h,v 1.1 2001/12/03 16:18:37 sam Exp $
*
* Authors: various Linux kernel hackers
* various MPlayer hackers
* Nick Kurshev <nickols_k@mail.ru>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
/*
aclib - advanced C library ;)
This file contains functions which improve and expand standard C-library
*/
#define BLOCK_SIZE 4096
#define CONFUSION_FACTOR 0
//Feel free to fine-tune the above 2, it might be possible to get some speedup with them :)
//#define STATISTICS
#ifndef HAVE_SSE2
/*
P3 processor has only one SSE decoder so can execute only 1 sse insn per
cpu clock, but it has 3 mmx decoders (include load/store unit)
and executes 3 mmx insns per cpu clock.
P4 processor has some chances, but after reading:
http://www.emulators.com/pentium4.htm
I have doubts. Anyway SSE2 version of this code can be written better.
*/
#undef HAVE_SSE
#endif
/*
This part of code was taken by me from Linux-2.4.3 and slightly modified
for MMX, MMX2, SSE instruction set. I have done it since linux uses page aligned
blocks but mplayer uses weakly ordered data and original sources can not
speedup them. Only using PREFETCHNTA and MOVNTQ together have effect!
>From IA-32 Intel Architecture Software Developer's Manual Volume 1,
Order Number 245470:
"10.4.6. Cacheability Control, Prefetch, and Memory Ordering Instructions"
Data referenced by a program can be temporal (data will be used again) or
non-temporal (data will be referenced once and not reused in the immediate
future). To make efficient use of the processor's caches, it is generally
desirable to cache temporal data and not cache non-temporal data. Overloading
the processor's caches with non-temporal data is sometimes referred to as
"polluting the caches".
The non-temporal data is written to memory with Write-Combining semantics.
The PREFETCHh instructions permits a program to load data into the processor
at a suggested cache level, so that it is closer to the processors load and
store unit when it is needed. If the data is already present in a level of
the cache hierarchy that is closer to the processor, the PREFETCHh instruction
will not result in any data movement.
But we should you PREFETCHNTA: Non-temporal data fetch data into location
close to the processor, minimizing cache pollution.
The MOVNTQ (store quadword using non-temporal hint) instruction stores
packed integer data from an MMX register to memory, using a non-temporal hint.
The MOVNTPS (store packed single-precision floating-point values using
non-temporal hint) instruction stores packed floating-point data from an
XMM register to memory, using a non-temporal hint.
The SFENCE (Store Fence) instruction controls write ordering by creating a
fence for memory store operations. This instruction guarantees that the results
of every store instruction that precedes the store fence in program order is
globally visible before any store instruction that follows the fence. The
SFENCE instruction provides an efficient way of ensuring ordering between
procedures that produce weakly-ordered data and procedures that consume that
data.
If you have questions please contact with me: Nick Kurshev: nickols_k@mail.ru.
*/
// 3dnow memcpy support from kernel 2.4.2
// by Pontscho/fresh!mindworkz
#if defined( HAVE_MMX2 ) || defined( HAVE_3DNOW ) || defined( HAVE_MMX )
#undef HAVE_MMX1
#if defined(HAVE_MMX) && !defined(HAVE_MMX2) && !defined(HAVE_3DNOW) && !defined(HAVE_SSE)
/* means: mmx v.1. Note: Since we added alignment of destinition it speedups
of memory copying on PentMMX, Celeron-1 and P2 upto 12% versus
standard (non MMX-optimized) version.
Note: on K6-2+ it speedups memory copying upto 25% and
on K7 and P3 about 500% (5 times). */
#define HAVE_MMX1
#endif
#undef HAVE_K6_2PLUS
#if !defined( HAVE_MMX2) && defined( HAVE_3DNOW)
#define HAVE_K6_2PLUS
#endif
/* for small memory blocks (<256 bytes) this version is faster */
#define small_memcpy(to,from,n)\
{\
register unsigned long int dummy;\
__asm__ __volatile__(\
"rep; movsb"\
:"=&D"(to), "=&S"(from), "=&c"(dummy)\
/* It's most portable way to notify compiler */\
/* that edi, esi and ecx are clobbered in asm block. */\
/* Thanks to A'rpi for hint!!! */\
:"0" (to), "1" (from),"2" (n)\
: "memory");\
}
#ifdef HAVE_SSE
#define MMREG_SIZE 16
#else
#define MMREG_SIZE 64 //8
#endif
/* Small defines (for readability only) ;) */
#ifdef HAVE_K6_2PLUS
#define PREFETCH "prefetch"
/* On K6 femms is faster of emms. On K7 femms is directly mapped on emms. */
#define EMMS "femms"
#else
#define PREFETCH "prefetchnta"
#define EMMS "emms"
#endif
#ifdef HAVE_MMX2
#define MOVNTQ "movntq"
#else
#define MOVNTQ "movq"
#endif
#ifdef HAVE_MMX1
#define MIN_LEN 0x800 /* 2K blocks */
#else
#define MIN_LEN 0x40 /* 64-byte blocks */
#endif
void * _M( fast_memcpy )(void * to, const void * from, size_t len)
{
void *retval;
size_t i;
retval = to;
#ifdef STATISTICS
{
static int freq[33];
static int t=0;
int i;
for(i=0; len>(1<<i); i++);
freq[i]++;
t++;
if(1024*1024*1024 % t == 0)
for(i=0; i<32; i++)
printf("freq < %8d %4d\n", 1<<i, freq[i]);
}
#endif
#ifndef HAVE_MMX1
/* PREFETCH has effect even for MOVSB instruction ;) */
__asm__ __volatile__ (
PREFETCH" (%0)\n"
PREFETCH" 64(%0)\n"
PREFETCH" 128(%0)\n"
PREFETCH" 192(%0)\n"
PREFETCH" 256(%0)\n"
: : "r" (from) );
#endif
if(len >= MIN_LEN)
{
register unsigned long int delta;
/* Align destinition to MMREG_SIZE -boundary */
delta = ((unsigned long int)to)&(MMREG_SIZE-1);
if(delta)
{
delta=MMREG_SIZE-delta;
len -= delta;
small_memcpy(to, from, delta);
}
i = len >> 6; /* len/64 */
len&=63;
/*
This algorithm is top effective when the code consequently
reads and writes blocks which have size of cache line.
Size of cache line is processor-dependent.
It will, however, be a minimum of 32 bytes on any processors.
It would be better to have a number of instructions which
perform reading and writing to be multiple to a number of
processor's decoders, but it's not always possible.
*/
#ifdef HAVE_SSE /* Only P3 (may be Cyrix3) */
if(((unsigned long)from) & 15)
/* if SRC is misaligned */
for(; i>0; i--)
{
__asm__ __volatile__ (
PREFETCH" 320(%0)\n"
"movups (%0), %%xmm0\n"
"movups 16(%0), %%xmm1\n"
"movups 32(%0), %%xmm2\n"
"movups 48(%0), %%xmm3\n"
"movntps %%xmm0, (%1)\n"
"movntps %%xmm1, 16(%1)\n"
"movntps %%xmm2, 32(%1)\n"
"movntps %%xmm3, 48(%1)\n"
:: "r" (from), "r" (to) : "memory");
((const unsigned char *)from)+=64;
((unsigned char *)to)+=64;
}
else
/*
Only if SRC is aligned on 16-byte boundary.
It allows to use movaps instead of movups, which required data
to be aligned or a general-protection exception (#GP) is generated.
*/
for(; i>0; i--)
{
__asm__ __volatile__ (
PREFETCH" 320(%0)\n"
"movaps (%0), %%xmm0\n"
"movaps 16(%0), %%xmm1\n"
"movaps 32(%0), %%xmm2\n"
"movaps 48(%0), %%xmm3\n"
"movntps %%xmm0, (%1)\n"
"movntps %%xmm1, 16(%1)\n"
"movntps %%xmm2, 32(%1)\n"
"movntps %%xmm3, 48(%1)\n"
:: "r" (from), "r" (to) : "memory");
((const unsigned char *)from)+=64;
((unsigned char *)to)+=64;
}
#else
// Align destination at BLOCK_SIZE boundary
for(; ((int)to & (BLOCK_SIZE-1)) && i>0; i--)
{
__asm__ __volatile__ (
#ifndef HAVE_MMX1
PREFETCH" 320(%0)\n"
#endif
"movq (%0), %%mm0\n"
"movq 8(%0), %%mm1\n"
"movq 16(%0), %%mm2\n"
"movq 24(%0), %%mm3\n"
"movq 32(%0), %%mm4\n"
"movq 40(%0), %%mm5\n"
"movq 48(%0), %%mm6\n"
"movq 56(%0), %%mm7\n"
MOVNTQ" %%mm0, (%1)\n"
MOVNTQ" %%mm1, 8(%1)\n"
MOVNTQ" %%mm2, 16(%1)\n"
MOVNTQ" %%mm3, 24(%1)\n"
MOVNTQ" %%mm4, 32(%1)\n"
MOVNTQ" %%mm5, 40(%1)\n"
MOVNTQ" %%mm6, 48(%1)\n"
MOVNTQ" %%mm7, 56(%1)\n"
:: "r" (from), "r" (to) : "memory");
((const unsigned char *)from)+=64;
((unsigned char *)to)+=64;
}
// printf(" %d %d\n", (int)from&1023, (int)to&1023);
// Pure Assembly cuz gcc is a bit unpredictable ;)
if(i>=BLOCK_SIZE/64)
asm volatile(
"xorl %%eax, %%eax \n\t"
".balign 16 \n\t"
"1: \n\t"
"movl (%0, %%eax), %%ebx \n\t"
"movl 32(%0, %%eax), %%ebx \n\t"
"movl 64(%0, %%eax), %%ebx \n\t"
"movl 96(%0, %%eax), %%ebx \n\t"
"addl $128, %%eax \n\t"
"cmpl %3, %%eax \n\t"
" jb 1b \n\t"
"xorl %%eax, %%eax \n\t"
".balign 16 \n\t"
"2: \n\t"
"movq (%0, %%eax), %%mm0\n"
"movq 8(%0, %%eax), %%mm1\n"
"movq 16(%0, %%eax), %%mm2\n"
"movq 24(%0, %%eax), %%mm3\n"
"movq 32(%0, %%eax), %%mm4\n"
"movq 40(%0, %%eax), %%mm5\n"
"movq 48(%0, %%eax), %%mm6\n"
"movq 56(%0, %%eax), %%mm7\n"
MOVNTQ" %%mm0, (%1, %%eax)\n"
MOVNTQ" %%mm1, 8(%1, %%eax)\n"
MOVNTQ" %%mm2, 16(%1, %%eax)\n"
MOVNTQ" %%mm3, 24(%1, %%eax)\n"
MOVNTQ" %%mm4, 32(%1, %%eax)\n"
MOVNTQ" %%mm5, 40(%1, %%eax)\n"
MOVNTQ" %%mm6, 48(%1, %%eax)\n"
MOVNTQ" %%mm7, 56(%1, %%eax)\n"
"addl $64, %%eax \n\t"
"cmpl %3, %%eax \n\t"
"jb 2b \n\t"
#if CONFUSION_FACTOR > 0
// a few percent speedup on out of order executing CPUs
"movl %5, %%eax \n\t"
"2: \n\t"
"movl (%0), %%ebx \n\t"
"movl (%0), %%ebx \n\t"
"movl (%0), %%ebx \n\t"
"movl (%0), %%ebx \n\t"
"decl %%eax \n\t"
" jnz 2b \n\t"
#endif
"xorl %%eax, %%eax \n\t"
"addl %3, %0 \n\t"
"addl %3, %1 \n\t"
"subl %4, %2 \n\t"
"cmpl %4, %2 \n\t"
" jae 1b \n\t"
: "+r" (from), "+r" (to), "+r" (i)
: "r" (BLOCK_SIZE), "i" (BLOCK_SIZE/64), "i" (CONFUSION_FACTOR)
: "%eax", "%ebx"
);
for(; i>0; i--)
{
__asm__ __volatile__ (
#ifndef HAVE_MMX1
PREFETCH" 320(%0)\n"
#endif
"movq (%0), %%mm0\n"
"movq 8(%0), %%mm1\n"
"movq 16(%0), %%mm2\n"
"movq 24(%0), %%mm3\n"
"movq 32(%0), %%mm4\n"
"movq 40(%0), %%mm5\n"
"movq 48(%0), %%mm6\n"
"movq 56(%0), %%mm7\n"
MOVNTQ" %%mm0, (%1)\n"
MOVNTQ" %%mm1, 8(%1)\n"
MOVNTQ" %%mm2, 16(%1)\n"
MOVNTQ" %%mm3, 24(%1)\n"
MOVNTQ" %%mm4, 32(%1)\n"
MOVNTQ" %%mm5, 40(%1)\n"
MOVNTQ" %%mm6, 48(%1)\n"
MOVNTQ" %%mm7, 56(%1)\n"
:: "r" (from), "r" (to) : "memory");
((const unsigned char *)from)+=64;
((unsigned char *)to)+=64;
}
#endif /* Have SSE */
#ifdef HAVE_MMX2
/* since movntq is weakly-ordered, a "sfence"
* is needed to become ordered again. */
__asm__ __volatile__ ("sfence":::"memory");
#endif
#ifndef HAVE_SSE
/* enables to use FPU */
__asm__ __volatile__ (EMMS:::"memory");
#endif
}
/*
* Now do the tail of the block
*/
if(len) small_memcpy(to, from, len);
return retval;
}
#endif /* #if defined( HAVE_MMX2 ) || defined( HAVE_3DNOW ) || defined( HAVE_MMX ) */

100
plugins/memcpy/memcpy.c Normal file
View File

@ -0,0 +1,100 @@
/*****************************************************************************
* memcpy.c : classic memcpy module
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: memcpy.c,v 1.1 2001/12/03 16:18:37 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
#define MODULE_NAME memcpy
#include "modules_inner.h"
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "common.h"
#include "intf_msg.h"
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "modules.h"
#include "modules_export.h"
/*****************************************************************************
* Local and extern prototypes.
*****************************************************************************/
static void memcpy_getfunctions( function_list_t * p_function_list );
static int memcpy_Probe ( probedata_t *p_data );
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for C memcpy module" )
ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
MODULE_CONFIG_STOP
MODULE_INIT_START
p_module->i_capabilities = MODULE_CAPABILITY_NULL
| MODULE_CAPABILITY_MEMCPY;
p_module->psz_longname = "libc memcpy module";
MODULE_INIT_STOP
MODULE_ACTIVATE_START
memcpy_getfunctions( &p_module->p_functions->memcpy );
MODULE_ACTIVATE_STOP
MODULE_DEACTIVATE_START
MODULE_DEACTIVATE_STOP
/* Following functions are local */
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
static void memcpy_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = memcpy_Probe;
#define F p_function_list->functions.memcpy
F.pf_fast_memcpy = memcpy;
#undef F
}
/*****************************************************************************
* memcpy_Probe: returns a preference score
*****************************************************************************/
static int memcpy_Probe( probedata_t *p_data )
{
if( TestMethod( MEMCPY_METHOD_VAR, "memcpy" )
|| TestMethod( MEMCPY_METHOD_VAR, "c" ) )
{
return( 999 );
}
/* This plugin always works */
return( 50 );
}

114
plugins/memcpy/memcpy3dn.c Normal file
View File

@ -0,0 +1,114 @@
/*****************************************************************************
* memcpy3dn.c : 3D Now! memcpy module
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: memcpy3dn.c,v 1.1 2001/12/03 16:18:37 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
#define MODULE_NAME memcpy3dn
#include "modules_inner.h"
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "common.h"
#include "intf_msg.h"
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "modules.h"
#include "modules_export.h"
/*****************************************************************************
* Local and extern prototypes.
*****************************************************************************/
static void memcpy_getfunctions( function_list_t * p_function_list );
static int memcpy_Probe ( probedata_t *p_data );
void * _M( fast_memcpy ) ( void * to, const void * from, size_t len );
#undef HAVE_MMX
#undef HAVE_MMX2
#undef HAVE_SSE
#undef HAVE_SSE2
#define HAVE_3DNOW
#include "fastmemcpy.h"
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for 3D Now! memcpy module" )
ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
MODULE_CONFIG_STOP
MODULE_INIT_START
p_module->i_capabilities = MODULE_CAPABILITY_NULL
| MODULE_CAPABILITY_MEMCPY;
p_module->psz_longname = "3D Now! memcpy module";
MODULE_INIT_STOP
MODULE_ACTIVATE_START
memcpy_getfunctions( &p_module->p_functions->memcpy );
MODULE_ACTIVATE_STOP
MODULE_DEACTIVATE_START
MODULE_DEACTIVATE_STOP
/* Following functions are local */
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
static void memcpy_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = memcpy_Probe;
#define F p_function_list->functions.memcpy
F.pf_fast_memcpy = _M( fast_memcpy );
#undef F
}
/*****************************************************************************
* memcpy_Probe: returns a preference score
*****************************************************************************/
static int memcpy_Probe( probedata_t *p_data )
{
/* Test for 3D Now! support in the CPU */
if( !TestCPU( CPU_CAPABILITY_3DNOW ) )
{
return( 0 );
}
if( TestMethod( MEMCPY_METHOD_VAR, "memcpy3dn" )
|| TestMethod( MEMCPY_METHOD_VAR, "3dn" ) )
{
return( 999 );
}
/* This plugin always works */
return( 100 );
}

114
plugins/memcpy/memcpymmx.c Normal file
View File

@ -0,0 +1,114 @@
/*****************************************************************************
* memcpymmx.c : MMX memcpy module
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: memcpymmx.c,v 1.1 2001/12/03 16:18:37 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
#define MODULE_NAME memcpymmx
#include "modules_inner.h"
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "common.h"
#include "intf_msg.h"
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "modules.h"
#include "modules_export.h"
/*****************************************************************************
* Local and extern prototypes.
*****************************************************************************/
static void memcpy_getfunctions( function_list_t * p_function_list );
static int memcpy_Probe ( probedata_t *p_data );
void * _M( fast_memcpy ) ( void * to, const void * from, size_t len );
#define HAVE_MMX
#undef HAVE_MMX2
#undef HAVE_SSE
#undef HAVE_SSE2
#undef HAVE_3DNOW
#include "fastmemcpy.h"
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for MMX memcpy module" )
ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
MODULE_CONFIG_STOP
MODULE_INIT_START
p_module->i_capabilities = MODULE_CAPABILITY_NULL
| MODULE_CAPABILITY_MEMCPY;
p_module->psz_longname = "MMX memcpy module";
MODULE_INIT_STOP
MODULE_ACTIVATE_START
memcpy_getfunctions( &p_module->p_functions->memcpy );
MODULE_ACTIVATE_STOP
MODULE_DEACTIVATE_START
MODULE_DEACTIVATE_STOP
/* Following functions are local */
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
static void memcpy_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = memcpy_Probe;
#define F p_function_list->functions.memcpy
F.pf_fast_memcpy = _M( fast_memcpy );
#undef F
}
/*****************************************************************************
* memcpy_Probe: returns a preference score
*****************************************************************************/
static int memcpy_Probe( probedata_t *p_data )
{
/* Test for MMX support in the CPU */
if( !TestCPU( CPU_CAPABILITY_MMX ) )
{
return( 0 );
}
if( TestMethod( MEMCPY_METHOD_VAR, "memcpymmx" )
|| TestMethod( MEMCPY_METHOD_VAR, "mmx" ) )
{
return( 999 );
}
/* This plugin always works */
return( 100 );
}

View File

@ -0,0 +1,114 @@
/*****************************************************************************
* memcpymmxext.c : MMX EXT memcpy module
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: memcpymmxext.c,v 1.1 2001/12/03 16:18:37 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
#define MODULE_NAME memcpymmxext
#include "modules_inner.h"
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "common.h"
#include "intf_msg.h"
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "modules.h"
#include "modules_export.h"
/*****************************************************************************
* Local and extern prototypes.
*****************************************************************************/
static void memcpy_getfunctions( function_list_t * p_function_list );
static int memcpy_Probe ( probedata_t *p_data );
void * _M( fast_memcpy ) ( void * to, const void * from, size_t len );
#undef HAVE_MMX
#define HAVE_MMX2
#undef HAVE_SSE
#undef HAVE_SSE2
#undef HAVE_3DNOW
#include "fastmemcpy.h"
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for MMX EXT memcpy module" )
ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
MODULE_CONFIG_STOP
MODULE_INIT_START
p_module->i_capabilities = MODULE_CAPABILITY_NULL
| MODULE_CAPABILITY_MEMCPY;
p_module->psz_longname = "MMX EXT memcpy module";
MODULE_INIT_STOP
MODULE_ACTIVATE_START
memcpy_getfunctions( &p_module->p_functions->memcpy );
MODULE_ACTIVATE_STOP
MODULE_DEACTIVATE_START
MODULE_DEACTIVATE_STOP
/* Following functions are local */
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
static void memcpy_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = memcpy_Probe;
#define F p_function_list->functions.memcpy
F.pf_fast_memcpy = _M( fast_memcpy );
#undef F
}
/*****************************************************************************
* memcpy_Probe: returns a preference score
*****************************************************************************/
static int memcpy_Probe( probedata_t *p_data )
{
/* Test for MMX EXT support in the CPU */
if( !TestCPU( CPU_CAPABILITY_MMXEXT ) )
{
return( 0 );
}
if( TestMethod( MEMCPY_METHOD_VAR, "memcpymmxext" )
|| TestMethod( MEMCPY_METHOD_VAR, "mmxext" ) )
{
return( 999 );
}
/* This plugin always works */
return( 200 );
}

View File

@ -2,7 +2,7 @@
* input_ts.h: structures of the input not exported to other modules
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ts.h,v 1.10 2001/07/12 23:06:54 gbazin Exp $
* $Id: input_ts.h,v 1.11 2001/12/03 16:18:37 sam Exp $
*
* Authors: Henri Fallon <henri@via.ecp.fr>
* Boris Dorès <babal@via.ecp.fr>
@ -71,7 +71,7 @@ static __inline__ int read_network( int i_fd, char * p_base,
i_bytes = p_sys->i_length - p_sys->i_offset;
}
memcpy( p_base, p_sys->p_buffer + p_sys->i_offset, i_bytes );
pf_fast_memcpy( p_base, p_sys->p_buffer + p_sys->i_offset, i_bytes );
p_sys->i_offset += i_bytes;
return i_bytes;

View File

@ -2,7 +2,7 @@
* mpeg_adec.c: MPEG audio decoder thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: mpeg_adec.c,v 1.3 2001/11/28 15:08:05 massiot Exp $
* $Id: mpeg_adec.c,v 1.4 2001/12/03 16:18:37 sam Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
@ -69,7 +69,7 @@ static void adec_Decode( adec_thread_t * );
void _M( adec_getfunctions )( function_list_t * p_function_list )
{
p_function_list->pf_probe = adec_Probe;
p_function_list->functions.dec.pf_RunThread = adec_RunThread;
p_function_list->functions.dec.pf_run = adec_RunThread;
}
/*****************************************************************************

View File

@ -2,7 +2,7 @@
* video_parser.c : video parser thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: video_parser.c,v 1.4 2001/11/28 15:08:05 massiot Exp $
* $Id: video_parser.c,v 1.5 2001/12/03 16:18:37 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
@ -80,7 +80,7 @@ static void BitstreamCallback ( bit_stream_t *, boolean_t );
void _M( vdec_getfunctions )( function_list_t * p_function_list )
{
p_function_list->pf_probe = mpeg_vdec_Probe;
p_function_list->functions.dec.pf_RunThread = mpeg_vdec_Run;
p_function_list->functions.dec.pf_run = mpeg_vdec_Run;
}
/*****************************************************************************

View File

@ -2,7 +2,7 @@
* vout_sdl.c: SDL video output display method
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: vout_sdl.c,v 1.65 2001/11/28 15:08:05 massiot Exp $
* $Id: vout_sdl.c,v 1.66 2001/12/03 16:18:37 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Pierre Baillet <oct@zoy.org>
@ -594,20 +594,20 @@ static void vout_Display( vout_thread_t *p_vout )
SDL_LockYUVOverlay( p_vout->p_sys->p_overlay );
/* copy the data into video buffers */
/* Y first */
memcpy( p_vout->p_sys->p_overlay->pixels[0],
p_vout->p_rendered_pic->p_y,
p_vout->p_sys->p_overlay->h *
p_vout->p_sys->p_overlay->pitches[0] );
pf_fast_memcpy( p_vout->p_sys->p_overlay->pixels[0],
p_vout->p_rendered_pic->p_y,
p_vout->p_sys->p_overlay->h *
p_vout->p_sys->p_overlay->pitches[0] );
/* then V */
memcpy( p_vout->p_sys->p_overlay->pixels[1],
p_vout->p_rendered_pic->p_v,
p_vout->p_sys->p_overlay->h *
p_vout->p_sys->p_overlay->pitches[1] / 2 );
pf_fast_memcpy( p_vout->p_sys->p_overlay->pixels[1],
p_vout->p_rendered_pic->p_v,
p_vout->p_sys->p_overlay->h *
p_vout->p_sys->p_overlay->pitches[1] / 2 );
/* and U */
memcpy( p_vout->p_sys->p_overlay->pixels[2],
p_vout->p_rendered_pic->p_u,
p_vout->p_sys->p_overlay->h *
p_vout->p_sys->p_overlay->pitches[2] / 2 );
pf_fast_memcpy( p_vout->p_sys->p_overlay->pixels[2],
p_vout->p_rendered_pic->p_u,
p_vout->p_sys->p_overlay->h *
p_vout->p_sys->p_overlay->pitches[2] / 2 );
OutputCoords( p_vout->p_rendered_pic, 1,
p_vout->p_sys->i_width,

View File

@ -2,7 +2,7 @@
* spu_decoder.c : spu decoder thread
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: spu_decoder.c,v 1.4 2001/11/28 15:08:06 massiot Exp $
* $Id: spu_decoder.c,v 1.5 2001/12/03 16:18:37 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
@ -76,7 +76,7 @@ static int ParseRLE ( spudec_thread_t *, subpicture_t *, u8 * );
void _M( spu_dec_getfunctions )( function_list_t * p_function_list )
{
p_function_list->pf_probe = spu_dec_Probe;
p_function_list->functions.dec.pf_RunThread = spu_dec_Run;
p_function_list->functions.dec.pf_run = spu_dec_Run;
}
/*****************************************************************************

View File

@ -585,8 +585,8 @@ static int VCDRead( input_thread_t * p_input,
if( U32_AT(p_buffer) != 0x1B9 )
{
memcpy( p_data->p_buffer, p_buffer + i_index,
6 + i_packet_size );
pf_fast_memcpy( p_data->p_buffer, p_buffer + i_index,
6 + i_packet_size );
i_index += ( 6 + i_packet_size );
}

View File

@ -2,7 +2,7 @@
* vout_xvideo.c: Xvideo video output display method
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: vout_xvideo.c,v 1.33 2001/12/03 13:58:59 massiot Exp $
* $Id: vout_xvideo.c,v 1.34 2001/12/03 16:18:37 sam Exp $
*
* Authors: Shane Harper <shanegh@optusnet.com.au>
* Vincent Seguin <seguin@via.ecp.fr>
@ -677,12 +677,12 @@ static void vout_Display( vout_thread_t *p_vout )
break;
case YUV_420_PICTURE:
memcpy( p_vout->p_sys->p_xvimage->data,
p_vout->p_rendered_pic->p_y, i_size );
memcpy( p_vout->p_sys->p_xvimage->data + ( i_size ),
p_vout->p_rendered_pic->p_v, i_size / 4 );
memcpy( p_vout->p_sys->p_xvimage->data + ( i_size ) + ( i_size / 4 ),
p_vout->p_rendered_pic->p_u, i_size / 4 );
pf_fast_memcpy( p_vout->p_sys->p_xvimage->data,
p_vout->p_rendered_pic->p_y, i_size );
pf_fast_memcpy( p_vout->p_sys->p_xvimage->data + ( i_size ),
p_vout->p_rendered_pic->p_v, i_size / 4 );
pf_fast_memcpy( p_vout->p_sys->p_xvimage->data + ( i_size ) + ( i_size / 4 ),
p_vout->p_rendered_pic->p_u, i_size / 4 );
break;
}

View File

@ -2,7 +2,7 @@
* input_dec.c: Functions for the management of decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_dec.c,v 1.18 2001/11/30 22:52:40 gbazin Exp $
* $Id: input_dec.c,v 1.19 2001/12/03 16:18:37 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
@ -80,7 +80,7 @@ vlc_thread_t input_RunDecoder( input_thread_t * p_input,
/* Spawn the decoder thread */
if ( vlc_thread_create( &thread_id, "decoder",
(vlc_thread_func_t)p_es->p_module->
p_functions->dec.functions.dec.pf_RunThread,
p_functions->dec.functions.dec.pf_run,
(void *)p_es->p_config) )
{
intf_ErrMsg( "input error: can't spawn decoder thread \"%s\"",

View File

@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: main.c,v 1.127 2001/11/28 15:08:06 massiot Exp $
* $Id: main.c,v 1.128 2001/12/03 16:18:37 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
@ -135,8 +135,9 @@
#define OPT_YUV 183
#define OPT_DOWNMIX 184
#define OPT_IMDCT 185
#define OPT_DVDCSS_METHOD 186
#define OPT_DVDCSS_VERBOSE 187
#define OPT_MEMCPY 186
#define OPT_DVDCSS_METHOD 187
#define OPT_DVDCSS_VERBOSE 188
#define OPT_SYNCHRO 190
#define OPT_WARNING 191
@ -216,8 +217,9 @@ static const struct option longopts[] =
{ "channels", 0, 0, OPT_CHANNELS },
{ "channelserver", 1, 0, OPT_CHANNELSERVER },
/* Synchro options */
/* Misc options */
{ "synchro", 1, 0, OPT_SYNCHRO },
{ "memcpy", 1, 0, OPT_MEMCPY },
{ 0, 0, 0, 0 }
};
@ -225,13 +227,13 @@ static const struct option longopts[] =
static const char *psz_shortopts = "hHvgt:T:u:a:s:c:I:A:V:";
/*****************************************************************************
* Global variable program_data - these are the only ones, see main.h and
* modules.h
* Global variables - these are the only ones, see main.h and modules.h
*****************************************************************************/
main_t *p_main;
module_bank_t *p_module_bank;
aout_bank_t *p_aout_bank;
vout_bank_t *p_vout_bank;
void* ( *pf_fast_memcpy ) ( void *, const void *, size_t );
/*****************************************************************************
* Local prototypes
@ -375,6 +377,24 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
aout_InitBank();
vout_InitBank();
/*
* Choose the best memcpy module
*/
p_main->p_memcpy_module = module_Need( MODULE_CAPABILITY_MEMCPY, NULL );
if( p_main->p_memcpy_module == NULL )
{
intf_ErrMsg( "intf error: no suitable memcpy module, "
"using libc default" );
pf_fast_memcpy = memcpy;
}
else
{
#define f p_main->p_memcpy_module->p_functions->memcpy.functions.memcpy
pf_fast_memcpy = f.pf_fast_memcpy;
#undef f
}
/*
* Initialize shared resources and libraries
*/
@ -423,6 +443,11 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
}
}
/*
* Free memcpy module
*/
module_Unneed( p_main->p_memcpy_module );
/*
* Free module, aout and vout banks
*/
@ -790,10 +815,13 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
main_PutPszVariable( INPUT_CHANNEL_SERVER_VAR, optarg );
break;
/* Synchro options */
/* Misc options */
case OPT_SYNCHRO:
main_PutPszVariable( VPAR_SYNCHRO_VAR, optarg );
break;
case OPT_MEMCPY:
main_PutPszVariable( MEMCPY_METHOD_VAR, optarg );
break;
/* Internal error: unknown option */
case '?':
@ -867,6 +895,7 @@ static void Usage( int i_fashion )
"\n -I, --intf <module> \tinterface method"
"\n -v, --verbose \tverbose mode (cumulative)"
"\n --stdout <filename> \tredirect console stdout"
"\n --memcpy <module> \tmemcpy method"
"\n"
"\n --noaudio \tdisable audio"
"\n -A, --aout <module> \taudio output method"
@ -916,7 +945,8 @@ static void Usage( int i_fashion )
"\n " INTF_METHOD_VAR "=<method name> \tinterface method"
"\n " INTF_INIT_SCRIPT_VAR "=<filename> \tinitialization script"
"\n " INTF_CHANNELS_VAR "=<filename> \tchannels list"
"\n " INTF_STDOUT_VAR "=<filename> \tredirect console stdout" );
"\n " INTF_STDOUT_VAR "=<filename> \tredirect console stdout"
"\n " MEMCPY_METHOD_VAR "=<method name> \tmemcpy method" );
/* Audio parameters */
intf_MsgImm( "\nAudio parameters:"
@ -1164,7 +1194,7 @@ static int CPUCapabilities( void )
{
i_capabilities |= CPU_CAPABILITY_MMXEXT;
#ifdef HAVE_SSE
#ifdef CAN_COMPILE_SSE
/* We test if OS support the SSE instructions */
i_illegal = 0;
if( setjmp( env ) == 0 )
@ -1201,7 +1231,7 @@ static int CPUCapabilities( void )
/* list these additional capabilities */
cpuid( 0x80000001 );
#ifdef HAVE_3DNOW
#ifdef CAN_COMPILE_3DNOW
if( i_edx & 0x80000000 )
{
i_illegal = 0;
@ -1231,7 +1261,7 @@ static int CPUCapabilities( void )
/* Test for Altivec */
signal( SIGILL, InstructionSignalHandler );
#ifdef HAVE_ALTIVEC
#ifdef CAN_COMPILE_ALTIVEC
i_illegal = 0;
if( setjmp( env ) == 0 )
{