Commit b3b88076 authored by Christophe Massiot's avatar Christophe Massiot

* Altivec IDCT and motion compensation, based on Paul Mackerras's mpeg2dec

(untested !) ;
* Local minor optimizations in IDCT ;
* Removed a hopeless kludge in input_clock.c
parent 76c5e75c
......@@ -175,6 +175,10 @@ D: AC3 decoder
D: MPEG audio decoder
D: MPEG video decoder
N: Paul Mackerras
E: paulus@linuxcare.com.au
D: Altivec IDCT and motion
N: Wade Majors
E: guru@startrek.com
D: BeOS testing, icon integration, debugging and fixes
......
......@@ -74,7 +74,7 @@ LIB_GGI = @LIB_GGI@
LIB_GLIDE = @LIB_GLIDE@
LIB_GNOME = @LIB_GNOME@
LIB_GTK = @LIB_GTK@
LIB_IDCTALTIVEC = @LIB_IDCTALTIVEC@
LIB_ALTIVEC = @LIB_ALTIVEC@
LIB_LIBDVDCSS = @LIB_LIBDVDCSS@
LIB_KDE = @LIB_KDE@
LIB_MACOSX = @LIB_MACOSX@
......
This diff is collapsed.
......@@ -239,6 +239,11 @@ AC_TRY_COMPILE([void quux(){void *p;asm("xorps %%xmm1,%%xmm2"::"r"(p));}],,
ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
AC_MSG_CHECKING([if \$CC groks Altivec inline assembly])
AC_TRY_COMPILE([void quux(){void *p;asm("mtspr 256,%0"::"r"(-1));}],,
ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
dnl
dnl libdvdcss: check for DVD ioctls
dnl
......@@ -354,20 +359,19 @@ dnl
AC_ARG_ENABLE(mmx,
[ --disable-mmx Disable MMX optimizations (default enabled for x86)],
[ if test x$enableval = xyes; then ARCH="${ARCH} mmx";
BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
[ if test x${host_cpu} = xi686 -o x${host_cpu} = xi586 -o x${host_cpu} = xx86 -o x${host_cpu} = xi386; then ARCH="${ARCH} mmx";
BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
dnl
dnl AltiVec acceleration
dnl
AC_ARG_ENABLE(altivec,
[ --enable-altivec Enable altivec optimizations (default disabled since it is broken)],
[ if test x$enableval = xyes; then ARCH="${ARCH} altivec"
BUILTINS="${BUILTINS} idctaltivec"
LIB_IDCTALTIVEC="-framework vecLib"
fi ])
#[ if test -d /System/Library/Frameworks/vecLib.framework; then ARCH="${ARCH} altivec"; PLUGINS="${PLUGINS} idctaltivec"; fi ])
[ --disable-altivec Disable altivec optimizations (default enabled on PPC)],
[ if test x$enableval = xyes; then ARCH="${ARCH} altivec";
BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
[ if test x${host_cpu} = xpowerpc; then ARCH="${ARCH} altivec";
BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
dnl
dnl Debugging mode
......@@ -394,7 +398,7 @@ AC_ARG_ENABLE(trace,
[ if test x$enableval = xyes; then TRACE=1; fi ])
dnl
dnl Trace mode
dnl Profiling
dnl
GPROF=0
AC_ARG_ENABLE(gprof,
......@@ -601,12 +605,14 @@ AC_ARG_ENABLE(macosx,
LIB_MACOSX="-framework CoreAudio -framework Carbon -framework AGL"
LIB_TS="${LIB_TS} -framework AGL -framework Carbon"
LIB_SDL="${LIB_SDL} -framework AGL -framework Carbon"
LIB_ALTIVEC="-framework vecLib"
fi],
[AC_CHECK_HEADERS(Carbon/Carbon.h,
BUILTINS="${BUILTINS} macosx"
LIB_MACOSX="-framework CoreAudio -framework Carbon -framework AGL"
LIB_TS="${LIB_TS} -framework AGL -framework Carbon"
LIB_SDL="${LIB_SDL} -framework AGL -framework Carbon"
LIB_ALTIVEC="-framework vecLib"
)])
dnl
......@@ -921,7 +927,7 @@ AC_SUBST(LIB_GGI)
AC_SUBST(LIB_GLIDE)
AC_SUBST(LIB_GNOME)
AC_SUBST(LIB_GTK)
AC_SUBST(LIB_IDCTALTIVEC)
AC_SUBST(LIB_ALTIVEC)
AC_SUBST(LIB_LIBDVDCSS)
AC_SUBST(LIB_KDE)
AC_SUBST(LIB_MACOSX)
......
......@@ -4,7 +4,7 @@
* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-intf.h,v 1.41 2001/07/18 14:21:00 massiot Exp $
* $Id: input_ext-intf.h,v 1.42 2001/09/05 16:07:49 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -125,7 +125,6 @@ typedef struct pgrm_descriptor_s
mtime_t cr_ref, sysdate_ref;
mtime_t last_cr; /* reference to detect unexpected stream
* discontinuities */
mtime_t last_syscr;
count_t c_average_count;
/* counter used to compute dynamic average values */
int i_synchro_state;
......
......@@ -2,7 +2,7 @@
* modules.h : Module management functions.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.h,v 1.28 2001/08/22 17:21:45 massiot Exp $
* $Id: modules.h,v 1.29 2001/09/05 16:07:49 massiot Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -170,13 +170,15 @@ typedef struct function_list_s
struct
{
void ( * pf_idct_init ) ( void ** );
void ( * pf_sparse_idct ) ( void *, dctelem_t *, int );
void ( * pf_idct ) ( void *, dctelem_t *, int );
void ( * pf_sparse_idct_add )( dctelem_t *, yuv_data_t *, int,
void *, int );
void ( * pf_idct_add ) ( dctelem_t *, yuv_data_t *, int,
void *, int );
void ( * pf_sparse_idct_copy )( dctelem_t *, yuv_data_t *, int,
void *, int );
void ( * pf_idct_copy ) ( dctelem_t *, yuv_data_t *, int,
void *, int );
void ( * pf_norm_scan ) ( u8 ppi_scan[2][64] );
void ( * pf_decode_init ) ( );
void ( * pf_addblock ) ( dctelem_t *, yuv_data_t *, int );
void ( * pf_copyblock ) ( dctelem_t *, yuv_data_t *, int );
} idct;
/* YUV transformation plugin */
......
......@@ -2,7 +2,7 @@
* vdec_ext-plugins.h : structures from the video decoder exported to plug-ins
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vdec_ext-plugins.h,v 1.3 2001/08/22 17:21:45 massiot Exp $
* $Id: vdec_ext-plugins.h,v 1.4 2001/09/05 16:07:49 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -28,8 +28,9 @@
typedef struct idct_inner_s
{
dctelem_t pi_block[64]; /* block */
void ( * pf_idct ) ( void *, dctelem_t*, int );
/* sparse IDCT or not ? */
void ( * pf_idct ) ( dctelem_t *, yuv_data_t *, int,
void *, int );
/* sparse IDCT or not, add or copy ? */
int i_sparse_pos; /* position of the
* non-NULL coeff */
yuv_data_t * p_dct_data; /* pointer to the position
......
......@@ -12,27 +12,14 @@ PLUGIN_IDCTCLASSIC = idctclassic.o
PLUGIN_IDCTMMX = idctmmx.o
PLUGIN_IDCTMMXEXT = idctmmxext.o
PLUGIN_IDCTALTIVEC = idctaltivec.o
PLUGIN_IDCTCOMMON = vdec_idct.o
PLUGIN_VDECBLOCK_C = vdec_block_c.o
PLUGIN_VDECBLOCK_MMX = vdec_block_mmx.o
BUILTIN_IDCT = $(PLUGIN_IDCT:%.o=BUILTIN_IDCT_%.o) \
$(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCT_%.o) \
$(PLUGIN_VDECBLOCK_C:%.o=BUILTIN_IDCT_%.o)
BUILTIN_IDCTCLASSIC = $(PLUGIN_IDCTCLASSIC:%.o=BUILTIN_IDCTCLASSIC_%.o) \
$(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTCLASSIC_%.o) \
$(PLUGIN_VDECBLOCK_C:%.o=BUILTIN_IDCTCLASSIC_%.o)
BUILTIN_IDCTMMX = $(PLUGIN_IDCTMMX:%.o=BUILTIN_IDCTMMX_%.o) \
$(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTMMX_%.o) \
$(PLUGIN_VDECBLOCK_MMX:%.o=BUILTIN_IDCTMMX_%.o)
BUILTIN_IDCTMMXEXT = $(PLUGIN_IDCTMMXEXT:%.o=BUILTIN_IDCTMMXEXT_%.o) \
$(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTMMXEXT_%.o) \
$(PLUGIN_VDECBLOCK_MMX:%.o=BUILTIN_IDCTMMXEXT_%.o)
BUILTIN_IDCTALTIVEC = $(PLUGIN_IDCTALTIVEC:%.o=BUILTIN_IDCTALTIVEC_%.o) \
$(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTALTIVEC_%.o) \
$(PLUGIN_VDECBLOCK_C:%.o=BUILTIN_IDCTALTIVEC_%.o)
PLUGIN_C = $(PLUGIN_IDCT) $(PLUGIN_IDCTCLASSIC) $(PLUGIN_IDCTMMX) $(PLUGIN_IDCTMMXEXT) $(PLUGIN_IDCTCOMMON) $(PLUGIN_VDECBLOCK_C) $(PLUGIN_VDECBLOCK_MMX)
BUILTIN_IDCT = $(PLUGIN_IDCT:%.o=BUILTIN_IDCT_%.o)
BUILTIN_IDCTCLASSIC = $(PLUGIN_IDCTCLASSIC:%.o=BUILTIN_IDCTCLASSIC_%.o)
BUILTIN_IDCTMMX = $(PLUGIN_IDCTMMX:%.o=BUILTIN_IDCTMMX_%.o)
BUILTIN_IDCTMMXEXT = $(PLUGIN_IDCTMMXEXT:%.o=BUILTIN_IDCTMMXEXT_%.o)
BUILTIN_IDCTALTIVEC = $(PLUGIN_IDCTALTIVEC:%.o=BUILTIN_IDCTALTIVEC_%.o)
PLUGIN_C = $(PLUGIN_IDCT) $(PLUGIN_IDCTCLASSIC) $(PLUGIN_IDCTMMX) $(PLUGIN_IDCTMMXEXT)
ALL_OBJ = $(PLUGIN_C) $(PLUGIN_IDCTALTIVEC) $(BUILTIN_IDCT) $(BUILTIN_IDCTCLASSIC) $(BUILTIN_IDCTMMX) $(BUILTIN_IDCTMMXEXT) $(BUILTIN_IDCTALTIVEC)
#
......@@ -69,36 +56,36 @@ $(BUILTIN_IDCTALTIVEC): BUILTIN_IDCTALTIVEC_%.o: %.c
# Real targets
#
../idct.so: $(PLUGIN_IDCT) $(PLUGIN_IDCTCOMMON) $(PLUGIN_VDECBLOCK_C)
../idct.so: $(PLUGIN_IDCT)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../idct.a: $(BUILTIN_IDCT)
ar r $@ $^
$(RANLIB) $@
../idctclassic.so: $(PLUGIN_IDCTCLASSIC) $(PLUGIN_IDCTCOMMON) $(PLUGIN_VDECBLOCK_C)
../idctclassic.so: $(PLUGIN_IDCTCLASSIC)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../idctclassic.a: $(BUILTIN_IDCTCLASSIC)
ar r $@ $^
$(RANLIB) $@
../idctmmx.so: $(PLUGIN_IDCTMMX) $(PLUGIN_IDCTCOMMON) $(PLUGIN_VDECBLOCK_MMX)
../idctmmx.so: $(PLUGIN_IDCTMMX)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../idctmmx.a: $(BUILTIN_IDCTMMX)
ar r $@ $^
$(RANLIB) $@
../idctmmxext.so: $(PLUGIN_IDCTMMXEXT) $(PLUGIN_IDCTCOMMON) $(PLUGIN_VDECBLOCK_MMX)
../idctmmxext.so: $(PLUGIN_IDCTMMXEXT)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../idctmmxext.a: $(BUILTIN_IDCTMMXEXT)
ar r $@ $^
$(RANLIB) $@
../idctaltivec.so: $(PLUGIN_IDCTALTIVEC) $(PLUGIN_IDCTCOMMON) $(PLUGIN_VDECBLOCK_C)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_IDCTALTIVEC)
../idctaltivec.so: $(PLUGIN_IDCTALTIVEC)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_ALTIVEC)
../idctaltivec.a: $(BUILTIN_IDCTALTIVEC)
ar r $@ $^
......
/*****************************************************************************
* vdec_block_c.c: Macroblock copy functions in C
* block_c.h: Macroblock copy functions in C
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: vdec_block_c.c,v 1.6 2001/08/22 17:21:45 massiot Exp $
* $Id: block_c.h,v 1.1 2001/09/05 16:07:49 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -21,32 +21,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* MODULE_NAME defined in Makefile together with -DBUILTIN */
#ifdef BUILTIN
# include "modules_inner.h"
#else
# define _M( foo ) foo
#endif
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <string.h>
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "intf_msg.h"
#include "vdec_idct.h"
#include "modules.h"
#include "modules_export.h"
/*****************************************************************************
* Static variables
*****************************************************************************
......@@ -56,9 +30,9 @@ static u8 pi_crop_buf[VDEC_CROPRANGE];
static u8 *pi_crop;
/*****************************************************************************
* vdec_InitDecode: initialize video decoder thread
* InitBlock: initialize the crop table
*****************************************************************************/
void _M( vdec_InitDecode ) ( )
static void InitBlock ( )
{
int i_dummy;
......@@ -82,10 +56,10 @@ void _M( vdec_InitDecode ) ( )
}
/*****************************************************************************
* vdec_AddBlock : add a block
* AddBlock: add a block
*****************************************************************************/
void _M( vdec_AddBlock ) ( dctelem_t * p_block, yuv_data_t * p_data,
int i_incr )
static __inline__ void AddBlock( dctelem_t * p_block, yuv_data_t * p_data,
int i_incr )
{
int i = 8;
......@@ -105,10 +79,10 @@ void _M( vdec_AddBlock ) ( dctelem_t * p_block, yuv_data_t * p_data,
}
/*****************************************************************************
* vdec_CopyBlock : copy a block
* CopyBlock: copy a block
*****************************************************************************/
void _M( vdec_CopyBlock )( dctelem_t * p_block, yuv_data_t * p_data,
int i_incr )
static __inline__ void CopyBlock( dctelem_t * p_block, yuv_data_t * p_data,
int i_incr )
{
int i = 8;
......
/*****************************************************************************
* vdec_block_mmx.c: Macroblock copy functions in MMX assembly
* block_mmx.h: Macroblock copy functions in MMX assembly
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: vdec_block_mmx.c,v 1.6 2001/08/22 17:21:45 massiot Exp $
* $Id: block_mmx.h,v 1.1 2001/09/05 16:07:49 massiot Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
* Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
......@@ -22,49 +22,16 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* MODULE_NAME defined in Makefile together with -DBUILTIN */
#ifdef BUILTIN
# include "modules_inner.h"
#else
# define _M( foo ) foo
#endif
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <string.h>
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "intf_msg.h"
#include "input_ext-dec.h"
#include "video.h"
#include "video_output.h"
#include "vdec_idct.h"
#include "modules.h"
#include "modules_export.h"
#include "mmx.h"
/*****************************************************************************
* vdec_InitDecode: initialize video decoder thread
* InitBlock: placeholder because we don't need a crop table, MMX does it for us
*****************************************************************************/
void _M( vdec_InitDecode ) ( )
static __inline__ void InitBlock( )
{
;
}
/*****************************************************************************
* vdec_AddBlock : add a block
* AddBlock: add a block
*****************************************************************************/
#define ADD_MMX(offset,r1,r2,r3,r4) \
movq_m2r (*(p_data+2*i_incr), r1); \
......@@ -77,8 +44,8 @@ void _M( vdec_InitDecode ) ( )
punpckhbw_r2r (mm0, r2); \
paddsw_m2r (*(p_block+offset+4), r2);
void _M( vdec_AddBlock ) ( dctelem_t * p_block, yuv_data_t * p_data,
int i_incr )
static __inline__ void AddBlock( dctelem_t * p_block, yuv_data_t * p_data,
int i_incr )
{
movq_m2r (*p_data, mm1);
pxor_r2r (mm0, mm0);
......@@ -106,7 +73,7 @@ void _M( vdec_AddBlock ) ( dctelem_t * p_block, yuv_data_t * p_data,
}
/*****************************************************************************
* vdec_CopyBlock : copy a block
* CopyBlock: copy a block
*****************************************************************************/
#define COPY_MMX(offset,r0,r1,r2) \
movq_m2r (*(p_block+offset), r0); \
......@@ -115,8 +82,8 @@ void _M( vdec_AddBlock ) ( dctelem_t * p_block, yuv_data_t * p_data,
movq_r2m (r2, *p_data); \
packuswb_r2r (r1, r0);
void _M( vdec_CopyBlock ) ( dctelem_t * p_block, yuv_data_t * p_data,
int i_incr )
static __inline__ void CopyBlock( dctelem_t * p_block, yuv_data_t * p_data,
int i_incr )
{
movq_m2r (*(p_block+0*8), mm0);
movq_m2r (*(p_block+0*8+4), mm1);
......
/*****************************************************************************
* idct.c : IDCT module
* idct.c : C IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idct.c,v 1.14 2001/08/22 17:21:45 massiot Exp $
* $Id: idct.c,v 1.15 2001/09/05 16:07:49 massiot Exp $
*
* Authors: Gal Hendryckx <jimmy@via.ecp.fr>
* Author: Gal Hendryckx <jimmy@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
......@@ -37,7 +37,8 @@
#include "mtime.h"
#include "tests.h"
#include "vdec_idct.h"
#include "idct.h"
#include "block_c.h"
#include "modules.h"
#include "modules_export.h"
......@@ -46,8 +47,6 @@
* Local and extern prototypes.
*****************************************************************************/
static void idct_getfunctions( function_list_t * p_function_list );
static int idct_Probe ( probedata_t *p_data );
static void vdec_NormScan ( u8 ppi_scan[2][64] );
/*****************************************************************************
* Build configuration tree.
......@@ -72,24 +71,6 @@ 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 idct_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = idct_Probe;
#define F p_function_list->functions.idct
F.pf_idct_init = _M( vdec_InitIDCT );
F.pf_sparse_idct = _M( vdec_SparseIDCT );
F.pf_idct = _M( vdec_IDCT );
F.pf_norm_scan = vdec_NormScan;
F.pf_decode_init = _M( vdec_InitDecode );
F.pf_addblock = _M( vdec_AddBlock );
F.pf_copyblock = _M( vdec_CopyBlock );
#undef F
}
/*****************************************************************************
* idct_Probe: returns a preference score
*****************************************************************************/
......@@ -106,17 +87,16 @@ static int idct_Probe( probedata_t *p_data )
}
/*****************************************************************************
* vdec_NormScan : Unused in this IDCT
* NormScan : Unused in this IDCT
*****************************************************************************/
static void vdec_NormScan( u8 ppi_scan[2][64] )
static void NormScan( u8 ppi_scan[2][64] )
{
}
/*****************************************************************************
* vdec_IDCT : IDCT function for normal matrices
* IDCT : IDCT function for normal matrices
*****************************************************************************/
void _M( vdec_IDCT )( void * p_unused_data, dctelem_t * p_block,
int i_idontcare )
static __inline__ void IDCT( dctelem_t * p_block )
{
s32 tmp0, tmp1, tmp2, tmp3;
s32 tmp10, tmp11, tmp12, tmp13;
......@@ -1294,3 +1274,5 @@ void _M( vdec_IDCT )( void * p_unused_data, dctelem_t * p_block,
}
}
#include "idct_sparse.h"
#include "idct_decl.h"
/*****************************************************************************
* vdec_idct.h : macros for the inverse discrete cosine transform
* idct.h : macros for the inverse discrete cosine transform
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vdec_idct.h,v 1.3 2001/08/22 17:21:45 massiot Exp $
* $Id: idct.h,v 1.5 2001/09/05 16:07:49 massiot Exp $
*
* Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -140,14 +140,3 @@
#define MULTIPLY(var,const) ((var) * (const))
#endif
/*****************************************************************************
* Protoypes
*****************************************************************************/
void _M( vdec_SparseIDCT ) ( void *, dctelem_t * p_block, int i_sparse_pos );
void _M( vdec_InitIDCT ) ( void ** );
void _M( vdec_IDCT ) ( void *, dctelem_t * p_block, int i_idontcare );
void _M( vdec_InitDecode ) ( );
void _M( vdec_AddBlock ) ( dctelem_t * p_block, yuv_data_t * p_data,
int i_incr );
void _M( vdec_CopyBlock ) ( dctelem_t * p_block, yuv_data_t * p_data,
int i_incr );
/*****************************************************************************
* idct_decl.h : common declarations, must be included at the very end
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idct_decl.h,v 1.1 2001/09/05 16:07:49 massiot Exp $
*
* Author: Christophe Massiot <massiot@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
* 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.
*****************************************************************************/
/*****************************************************************************
* Final declarations
*****************************************************************************/
static void IDCTCopy( dctelem_t * p_block, yuv_data_t * p_dest,
int i_stride, void * p_unused, int i_unused )
{
IDCT( p_block );
CopyBlock( p_block, p_dest, i_stride );
}
static void IDCTAdd( dctelem_t * p_block, yuv_data_t * p_dest,
int i_stride, void * p_unused, int i_unused )
{
IDCT( p_block );
AddBlock( p_block, p_dest, i_stride );
}
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
static void idct_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = idct_Probe;
#define F p_function_list->functions.idct
F.pf_idct_init = InitIDCT;
F.pf_norm_scan = NormScan;
F.pf_sparse_idct_add = SparseIDCTAdd;
F.pf_sparse_idct_copy = SparseIDCTCopy;
F.pf_idct_add = IDCTAdd;
F.pf_idct_copy = IDCTCopy;
#undef F
}
/*****************************************************************************
* vdec_idct.c : common IDCT functions
* idct_sparse.h : Sparse IDCT functions (must be include at the end)
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vdec_idct.c,v 1.4 2001/08/22 17:21:45 massiot Exp $
* $Id: idct_sparse.h,v 1.1 2001/09/05 16:07:49 massiot Exp $
*
* Authors: Gal Hendryckx <jimmy@via.ecp.fr>
* Author: Gal Hendryckx <jimmy@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
......@@ -21,37 +21,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* MODULE_NAME defined in Makefile together with -DBUILTIN */
#ifdef BUILTIN
# include "modules_inner.h"
#else
# define _M( foo ) foo
#endif
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#include <stdlib.h> /* malloc() */
#include <string.h> /* memcpy(), memset() */
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include "video.h"
#include "video_output.h"
#include "modules.h"
#include "vdec_idct.h"
/*****************************************************************************
* vdec_InitIDCT : initialize datas for vdec_SparseIDCT
* InitIDCT : initialize data for SparseIDCT
*****************************************************************************/
void _M( vdec_InitIDCT ) ( void ** pp_idct_data )
static void InitIDCT ( void ** pp_idct_data )
{
int i;
dctelem_t * p_pre;
......@@ -63,16 +36,17 @@ void _M( vdec_InitIDCT ) ( void ** pp_idct_data )
for( i = 0 ; i < 64 ; i++ )
{
p_pre[i*64+i] = 1 << SPARSE_SCALE_FACTOR;
_M( vdec_IDCT )( NULL, &p_pre[i*64], 0) ;
IDCT( &p_pre[i*64] ) ;
}
return;
InitBlock();
}
/*****************************************************************************
* vdec_SparseIDCT : IDCT function for sparse matrices
* SparseIDCT : IDCT function for sparse matrices
*****************************************************************************/
void _M( vdec_SparseIDCT ) ( void * p_idct_data,
dctelem_t * p_block, int i_sparse_pos )
static __inline__ void SparseIDCT( dctelem_t * p_block, void * p_idct_data,
int i_sparse_pos )
{
short int val;
int * dp;
......@@ -124,6 +98,21 @@ void _M( vdec_SparseIDCT ) ( void * p_idct_data,
p_dest += 16;
p_source += 16;
}
return;
}
/*****************************************************************************
* Final declarations
*****************************************************************************/
static void SparseIDCTCopy( dctelem_t * p_block, yuv_data_t * p_dest,
int i_stride, void * p_idct_data, int i_sparse_pos )
{
SparseIDCT( p_block, p_idct_data, i_sparse_pos );
CopyBlock( p_block, p_dest, i_stride );
}
static void SparseIDCTAdd( dctelem_t * p_block, yuv_data_t * p_dest,
int i_stride, void * p_idct_data, int i_sparse_pos )
{
SparseIDCT( p_block, p_idct_data, i_sparse_pos );
AddBlock( p_block, p_dest, i_stride );
}
This diff is collapsed.
......@@ -2,7 +2,7 @@
* idctaltivec.c : Altivec IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idctaltivec.c,v 1.11 2001/08/22 17:21:45 massiot Exp $
* $Id: idctaltivec.c,v 1.12 2001/09/05 16:07:49 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -37,9 +37,7 @@
#include "mtime.h"
#include "tests.h" /* TestCPU() */
#include "vdec_idct.h"
#include "idctaltivec.h"
#include "idct.h"
#include "modules.h"
#include "modules_export.h"
......@@ -48,8 +46,8 @@
* Local prototypes.
*****************************************************************************/
static void idct_getfunctions( function_list_t * p_function_list );
static int idct_Probe ( probedata_t *p_data );
static void vdec_NormScan ( u8 ppi_scan[2][64] );
void idct_block_copy_altivec( dctelem_t *, yuv_data_t *, int, void *, int );
void idct_block_add_altivec( dctelem_t *, yuv_data_t *, int, void *, int );
/*****************************************************************************
* Build configuration tree.
......@@ -74,23 +72,6 @@ MODULE_DEACTIVATE_STOP
/* Following functions are local */
/*****************************************************************************
* Functions exported as capabilities.
*****************************************************************************/
static void idct_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = idct_Probe;
#define F p_function_list->functions.idct
F.pf_idct_init = _M( vdec_InitIDCT );
F.pf_sparse_idct = _M( vdec_SparseIDCT );
F.pf_idct = _M( vdec_IDCT );
F.pf_norm_scan = vdec_NormScan;
F.pf_decode_init = _M( vdec_InitDecode );
F.pf_addblock = _M( vdec_AddBlock );
F.pf_copyblock = _M( vdec_CopyBlock );
#undef F
}
/*****************************************************************************
* idct_Probe: return a preference score
*****************************************************************************/
......@@ -107,23 +88,36 @@ static int idct_Probe( probedata_t *p_data )
return( 999 );
}
/* The Altivec iDCT is deactivated until it really works */
return( 0 /* 200 */ );
return( 200 );
}
/*****************************************************************************
* vdec_NormScan : Soon, transpose
* Placeholders for unused functions
*****************************************************************************/
static void vdec_NormScan( u8 ppi_scan[2][64] )
static void NormScan( u8 ppi_scan[2][64] )
{
}
static void InitIDCT( void * p_idct_data )
{
}
/*****************************************************************************
* vdec_IDCT :
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
void _M( vdec_IDCT )( void * p_unused_data, dctelem_t * p_block,
int i_idontcare )
static void idct_getfunctions( function_list_t * p_function_list )
{
IDCT( p_block, p_block );
p_function_list->pf_probe = idct_Probe;
#define F p_function_list->functions.idct
F.pf_idct_init = InitIDCT;
F.pf_norm_scan = NormScan;
/* FIXME : it would be a nice idea to use sparse IDCT functions */
F.pf_sparse_idct_add = idct_block_add_altivec;
F.pf_sparse_idct_copy = idct_block_copy_altivec;
F.pf_idct_add = idct_block_add_altivec;
F.pf_idct_copy = idct_block_copy_altivec;
#undef F
}
This diff is collapsed.
......@@ -2,7 +2,7 @@
* idctclassic.c : Classic IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idctclassic.c,v 1.14 2001/08/22 17:21:45 massiot Exp $
* $Id: idctclassic.c,v 1.15 2001/09/05 16:07:49 massiot Exp $
*
* Authors: Gal Hendryckx <jimmy@via.ecp.fr>
*
......@@ -37,7 +37,8 @@
#include "mtime.h"
#include "tests.h"
#include "vdec_idct.h"
#include "idct.h"
#include "block_c.h"
#include "modules.h"
#include "modules_export.h"
......@@ -46,9 +47,6 @@
* Local and extern prototypes.
*****************************************************************************/
static void idct_getfunctions( function_list_t * p_function_list );
static int idct_Probe ( probedata_t *p_data );
static void vdec_NormScan ( u8 ppi_scan[2][64] );
/*****************************************************************************
* Build configuration tree.
......@@ -73,24 +71,6 @@ 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 idct_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = idct_Probe;
#define F p_function_list->functions.idct
F.pf_idct_init = _M( vdec_InitIDCT );
F.pf_sparse_idct = _M( vdec_SparseIDCT );
F.pf_idct = _M( vdec_IDCT );
F.pf_norm_scan = vdec_NormScan;
F.pf_decode_init = _M( vdec_InitDecode );
F.pf_addblock = _M( vdec_AddBlock );
F.pf_copyblock = _M( vdec_CopyBlock );
#undef F
}
/*****************************************************************************
* idct_Probe: returns a preference score
*****************************************************************************/
......@@ -107,20 +87,17 @@ static int idct_Probe( probedata_t *p_data )
}
/*****************************************************************************
* vdec_NormScan : Unused in this IDCT
* NormScan : Unused in this IDCT
*****************************************************************************/
static void vdec_NormScan( u8 ppi_scan[2][64] )
static void NormScan( u8 ppi_scan[2][64] )
{
}
/*****************************************************************************
* vdec_IDCT : IDCT function for normal matrices
* IDCT : IDCT function for normal matrices
*****************************************************************************/
void _M( vdec_IDCT )( void * p_unused_data, dctelem_t * p_block,
int i_idontcare )
static __inline__ void IDCT( dctelem_t * p_block )
{
/* dct classique: pour tester la meilleure entre la classique et la */
/* no classique */
s32 tmp0, tmp1, tmp2, tmp3;
s32 tmp10, tmp11, tmp12, tmp13;
s32 z1, z2, z3, z4, z5;
......@@ -337,3 +314,6 @@ void _M( vdec_IDCT )( void * p_unused_data, dctelem_t * p_block,
}
}
#include "idct_sparse.h"
#include "idct_decl.h"
......@@ -2,7 +2,7 @@
* idctmmx.c : MMX IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idctmmx.c,v 1.16 2001/08/22 17:21:45 massiot Exp $
* $Id: idctmmx.c,v 1.17 2001/09/05 16:07:49 massiot Exp $
*
* Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
* Michel Lespinasse <walken@zoy.org>
......@@ -41,10 +41,11 @@
#include "mtime.h"
#include "tests.h" /* TestCPU() */
#include "vdec_idct.h"
#include "mmx.h"
#include "idct.h"
#include "block_mmx.h"
#include "modules.h"
#include "modules_export.h"
......@@ -52,8 +53,6 @@
* Local prototypes.
*****************************************************************************/
static void idct_getfunctions( function_list_t * p_function_list );
static int idct_Probe ( probedata_t *p_data );
static void vdec_NormScan ( u8 ppi_scan[2][64] );
/*****************************************************************************
* Build configuration tree.
......@@ -78,23 +77,6 @@ MODULE_DEACTIVATE_STOP
/* Following functions are local */
/*****************************************************************************
* Functions exported as capabilities.
*****************************************************************************/
static void idct_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = idct_Probe;
#define F p_function_list->functions.idct
F.pf_idct_init = _M( vdec_InitIDCT );
F.pf_sparse_idct = _M( vdec_SparseIDCT );
F.pf_idct = _M( vdec_IDCT );
F.pf_norm_scan = vdec_NormScan;
F.pf_decode_init = _M( vdec_InitDecode );
F.pf_addblock = _M( vdec_AddBlock );
F.pf_copyblock = _M( vdec_CopyBlock );
#undef F
}
/*****************************************************************************
* idct_Probe: return a preference score
*****************************************************************************/
......@@ -115,9 +97,9 @@ static int idct_Probe( probedata_t *p_data )
}
/*****************************************************************************
* vdec_NormScan : This IDCT uses reordered coeffs, so we patch the scan table
* NormScan : This IDCT uses reordered coeffs, so we patch the scan table
*****************************************************************************/
static void vdec_NormScan( u8 ppi_scan[2][64] )
static void NormScan( u8 ppi_scan[2][64] )
{
int i, j;
......@@ -132,7 +114,7 @@ static void vdec_NormScan( u8 ppi_scan[2][64] )
}
/*****************************************************************************
* vdec_IDCT :
* IDCT :
*****************************************************************************/
#define ROW_SHIFT 11
#define COL_SHIFT 6
......@@ -426,8 +408,7 @@ static s32 rounder3[] ATTR_ALIGN(8) =
static s32 rounder5[] ATTR_ALIGN(8) =
rounder (-0.441341716183); // C3*(-C5/C4+C5-C3)/2
void _M( vdec_IDCT )( void * p_unused_data, dctelem_t * p_block,
int i_idontcare )
static __inline__ void IDCT( dctelem_t * p_block )
{
static dctelem_t table04[] ATTR_ALIGN(16) =
table (22725, 21407, 19266, 16384, 12873, 8867, 4520);
......@@ -460,3 +441,5 @@ void _M( vdec_IDCT )( void * p_unused_data, dctelem_t * p_block,
Col( p_block, 4 );
}
#include "idct_sparse.h"
#include "idct_decl.h"
......@@ -2,7 +2,7 @@
* idctmmxext.c : MMX EXT IDCT module
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: idctmmxext.c,v 1.13 2001/08/22 17:21:45 massiot Exp $
* $Id: idctmmxext.c,v 1.14 2001/09/05 16:07:49 massiot Exp $
*
* Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
* Michel Lespinasse <walken@zoy.org>
......@@ -41,10 +41,11 @@
#include "mtime.h"
#include "tests.h" /* TestCPU() */
#include "vdec_idct.h"
#include "mmx.h"
#include "idct.h"
#include "block_mmx.h"
#include "modules.h"
#include "modules_export.h"
......@@ -52,8 +53,6 @@
* Local prototypes.
*****************************************************************************/
static void idct_getfunctions( function_list_t * p_function_list );
static int idct_Probe ( probedata_t *p_data );
static void vdec_NormScan ( u8 ppi_scan[2][64] );
/*****************************************************************************
* Build configuration tree.
......@@ -78,23 +77,6 @@ MODULE_DEACTIVATE_STOP
/* Following functions are local */
/*****************************************************************************
* Functions exported as capabilities.
*****************************************************************************/
static void idct_getfunctions( function_list_t * p_function_list )
{
p_function_list->pf_probe = idct_Probe;
#define F p_function_list->functions.idct
F.pf_idct_init = _M( vdec_InitIDCT );
F.pf_sparse_idct = _M( vdec_SparseIDCT );
F.pf_idct = _M( vdec_IDCT );
F.pf_norm_scan = vdec_NormScan;
F.pf_decode_init = _M( vdec_InitDecode );
F.pf_addblock = _M( vdec_AddBlock );
F.pf_copyblock = _M( vdec_CopyBlock );
#undef F
}
/*****************************************************************************
* idct_Probe: return a preference score
*****************************************************************************/
......@@ -116,9 +98,9 @@ static int idct_Probe( probedata_t *p_data )
}
/*****************************************************************************
* vdec_NormScan : This IDCT uses reordered coeffs, so we patch the scan table
* NormScan : This IDCT uses reordered coeffs, so we patch the scan table
*****************************************************************************/
static void vdec_NormScan( u8 ppi_scan[2][64] )
static void NormScan( u8 ppi_scan[2][64] )
{
int i, j;
......@@ -133,7 +115,7 @@ static void vdec_NormScan( u8 ppi_scan[2][64] )
}
/*****************************************************************************
* vdec_IDCT :
* IDCT :
*****************************************************************************/
#define ROW_SHIFT 11
#define COL_SHIFT 6
......@@ -410,8 +392,7 @@ static s32 rounder3[] ATTR_ALIGN(8) =
static s32 rounder5[] ATTR_ALIGN(8) =
rounder (-0.441341716183); // C3*(-C5/C4+C5-C3)/2
void _M( vdec_IDCT )( void * p_unused_data, dctelem_t * p_block,
int i_idontcare )
static __inline__ void IDCT( dctelem_t * p_block )
{
static dctelem_t table04[] ATTR_ALIGN(16) =
table (22725, 21407, 19266, 16384, 12873, 8867, 4520);
......@@ -444,3 +425,5 @@ void _M( vdec_IDCT )( void * p_unused_data, dctelem_t * p_block,
Col( p_block, 4 );
}
#include "idct_sparse.h"
#include "idct_decl.h"
......@@ -11,14 +11,16 @@ PLUGIN_MOTION = motion.o
PLUGIN_MOTIONMMX = motionmmx.o
PLUGIN_MOTIONMMXEXT = motionmmxext.o
PLUGIN_MOTION3DNOW = motion3dnow.o
PLUGIN_MOTIONALTIVEC = motionaltivec.o
BUILTIN_MOTION = $(PLUGIN_MOTION:%.o=BUILTIN_MOTION_%.o)
BUILTIN_MOTIONMMX = $(PLUGIN_MOTIONMMX:%.o=BUILTIN_MOTIONMMX_%.o)
BUILTIN_MOTIONMMXEXT = $(PLUGIN_MOTIONMMXEXT:%.o=BUILTIN_MOTIONMMXEXT_%.o)
BUILTIN_MOTION3DNOW = $(PLUGIN_MOTION3DNOW:%.o=BUILTIN_MOTION3DNOW_%.o)
BUILTIN_MOTIONALTIVEC = $(PLUGIN_MOTIONALTIVEC:%.o=BUILTIN_MOTIONALTIVEC_%.o)
PLUGIN_C = $(PLUGIN_MOTION) $(PLUGIN_MOTIONMMX) $(PLUGIN_MOTIONMMXEXT) $(PLUGIN_MOTION3DNOW)
ALL_OBJ = $(PLUGIN_C) $(BUILTIN_MOTION) $(BUILTIN_MOTIONMMX) $(BUILTIN_MOTIONMMXEXT) $(BUILTIN_MOTION3DNOW)
ALL_OBJ = $(PLUGIN_C) $(PLUGIN_MOTIONALTIVEC) $(BUILTIN_MOTION) $(BUILTIN_MOTIONMMX) $(BUILTIN_MOTIONMMXEXT) $(BUILTIN_MOTION3DNOW)
#
# Virtual targets
......@@ -26,6 +28,10 @@ ALL_OBJ = $(PLUGIN_C) $(BUILTIN_MOTION) $(BUILTIN_MOTIONMMX) $(BUILTIN_MOTIONMMX
include ../../Makefile.modules
$(PLUGIN_MOTIONALTIVEC): %.o: .dep/%.d
$(PLUGIN_MOTIONALTIVEC): %.o: %.c
$(CC) $(CFLAGS) -DPLUGIN $(PCFLAGS) -faltivec -c -o $@ $<
$(BUILTIN_MOTION): BUILTIN_MOTION_%.o: .dep/%.d
$(BUILTIN_MOTION): BUILTIN_MOTION_%.o: %.c
$(CC) $(CFLAGS) -DBUILTIN -DMODULE_NAME=motion -c -o $@ $<
......@@ -42,6 +48,10 @@ $(BUILTIN_MOTION3DNOW): BUILTIN_MOTION3DNOW_%.o: .dep/%.d
$(BUILTIN_MOTION3DNOW): BUILTIN_MOTION3DNOW_%.o: %.c
$(CC) $(CFLAGS) -DBUILTIN -DMODULE_NAME=motion3dnow -c -o $@ $<
$(BUILTIN_MOTIONALTIVEC): BUILTIN_MOTIONALTIVEC_%.o: .dep/%.d
$(BUILTIN_MOTIONALTIVEC): BUILTIN_MOTIONALTIVEC_%.o: %.c
$(CC) $(CFLAGS) -DBUILTIN -DMODULE_NAME=motionaltivec -c -o $@ $<
#
# Real targets
#
......@@ -81,3 +91,9 @@ $(BUILTIN_MOTION3DNOW): BUILTIN_MOTION3DNOW_%.o: %.c
ar r $@ $^
$(RANLIB) $@
../motionaltivec.so: $(PLUGIN_MOTIONALTIVEC)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_ALTIVEC)
../motionaltivec.a: $(BUILTIN_MOTIONALTIVEC)
ar r $@ $^
$(RANLIB) $@
......@@ -2,7 +2,7 @@
* motion3dnow.c : 3DNow! motion compensation module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: motion3dnow.c,v 1.1 2001/08/22 17:21:45 massiot Exp $
* $Id: motion3dnow.c,v 1.2 2001/09/05 16:07:49 massiot Exp $
*
* Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
* Michel Lespinasse <walken@zoy.org>
......@@ -85,7 +85,7 @@ static int motion_Probe( probedata_t *p_data )
return( 999 );
}
return( 200 );
return( 250 );
}
/*****************************************************************************
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* input_clock.c: Clock/System date convertions, stream management
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_clock.c,v 1.21 2001/07/20 16:20:25 massiot Exp $
* $Id: input_clock.c,v 1.22 2001/09/05 16:07:50 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -84,6 +84,8 @@
/*****************************************************************************
* ClockToSysdate: converts a movie clock to system date
*****************************************************************************/
static void ClockNewRef( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm,
mtime_t i_clock, mtime_t i_sysdate );
static mtime_t ClockToSysdate( input_thread_t * p_input,
pgrm_descriptor_t * p_pgrm, mtime_t i_clock )
{
......@@ -93,10 +95,10 @@ static mtime_t ClockToSysdate( input_thread_t * p_input,
{
i_sysdate = (mtime_t)(i_clock - p_pgrm->cr_ref)
* (mtime_t)p_input->stream.control.i_rate
* (mtime_t)300
/ (mtime_t)27
/ (mtime_t)DEFAULT_RATE
+ (mtime_t)p_pgrm->sysdate_ref;
* (mtime_t)300;
i_sysdate /= 27;
i_sysdate /= 1000;
i_sysdate += (mtime_t)p_pgrm->sysdate_ref;
}
return( i_sysdate );
......@@ -122,7 +124,7 @@ static void ClockNewRef( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm,
mtime_t i_clock, mtime_t i_sysdate )
{
p_pgrm->cr_ref = i_clock;
p_pgrm->sysdate_ref = p_pgrm->last_syscr ? p_pgrm->last_syscr : i_sysdate;
p_pgrm->sysdate_ref = i_sysdate;
}
/*****************************************************************************
......@@ -132,7 +134,6 @@ static void ClockNewRef( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm,
void input_ClockInit( pgrm_descriptor_t * p_pgrm )
{
p_pgrm->last_cr = 0;
p_pgrm->last_syscr = 0;
p_pgrm->cr_ref = 0;
p_pgrm->sysdate_ref = 0;
p_pgrm->delta_cr = 0;
......@@ -160,7 +161,6 @@ int input_ClockManageControl( input_thread_t * p_input,
p_input->stream.control.i_status = PAUSE_S;
vlc_cond_wait( &p_input->stream.stream_wait,
&p_input->stream.stream_lock );
p_pgrm->last_syscr = 0;
ClockNewRef( p_input, p_pgrm, i_clock, mdate() );
if( p_input->stream.i_new_status == PAUSE_S )
......@@ -233,7 +233,6 @@ void input_ClockManageRef( input_thread_t * p_input,
else
{
p_pgrm->last_cr = 0;
p_pgrm->last_syscr = 0;
p_pgrm->delta_cr = 0;
p_pgrm->c_average_count = 0;
}
......@@ -261,8 +260,7 @@ void input_ClockManageRef( input_thread_t * p_input,
/* Wait a while before delivering the packets to the decoder.
* In case of multiple programs, we arbitrarily follow the
* clock of the first program. */
p_pgrm->last_syscr = ClockToSysdate( p_input, p_pgrm, i_clock );
mwait( p_pgrm->last_syscr );
mwait( ClockToSysdate( p_input, p_pgrm, i_clock ) );
/* Now take into account interface changes. */
input_ClockManageControl( p_input, p_pgrm, i_clock );
......
......@@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: main.c,v 1.112 2001/08/22 14:23:57 sam Exp $
* $Id: main.c,v 1.113 2001/09/05 16:07:50 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -1068,7 +1068,7 @@ static int CPUCapabilities( void )
slot_name( hi.cpu_type, hi.cpu_subtype, &psz_name, &psz_subname );
/* FIXME: need better way to detect newer proccessors.
* could do strncmp(a,b,5), but that's real ugly */
if( strcmp(psz_name, "ppc7400") || strcmp(psz_name, "ppc7450") )
if( !strcmp(psz_name, "ppc7400") || !strcmp(psz_name, "ppc7450") )
{
i_capabilities |= CPU_CAPABILITY_ALTIVEC;
}
......@@ -1183,6 +1183,30 @@ static int CPUCapabilities( void )
signal( SIGILL, NULL );
return( i_capabilities );
#elif defined( __powerpc__ )
# if defined( vector )
/* Test for Altivec */
signal( SIGILL, InstructionSignalHandler );
i_illegal = 0;
if( setjmp( env ) == 0 )
{
/* Set VSCR to 0 */
vec_mtvscr( (vector unsigned int)(0) );
/* Set the VRSAVE register in case the kernel looks at it */
asm volatile ("mtspr 256,%0" : : "r" (-1));
}
if( i_illegal == 0 )
{
i_capabilities |= CPU_CAPABILITY_ALTIVEC;
}
signal( SIGILL, NULL );
# endif
return( i_capabilities );
#else
/* default behaviour */
return( i_capabilities );
......
......@@ -2,7 +2,7 @@
* video_decoder.c : video decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_decoder.c,v 1.57 2001/08/22 17:21:45 massiot Exp $
* $Id: video_decoder.c,v 1.58 2001/09/05 16:07:50 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@zoy.org>
......@@ -150,7 +150,6 @@ void vdec_InitThread( vdec_thread_t * p_vdec )
p_vdec->p_idct_data = NULL;
p_vdec->p_pool->pf_decode_init( p_vdec );
p_vdec->p_pool->pf_idct_init( &p_vdec->p_idct_data );
/* Mark thread as running and return */
......@@ -259,18 +258,15 @@ void PSZ_NAME ( vdec_thread_t *p_vdec, macroblock_t * p_mb ) \
if( p_mb->i_coded_block_pattern & (1 << (5 - i)) ) \
{ \
/* \
* Inverse DCT (ISO/IEC 13818-2 section Annex A) \
*/ \
p_idct->pf_idct( p_vdec->p_idct_data, p_idct->pi_block, \
p_idct->i_sparse_pos ); \
\
/* \
* Adding prediction and coefficient data (ISO/IEC \
* Inverse DCT (ISO/IEC 13818-2 section Annex A) and \
* adding prediction and coefficient data (ISO/IEC \
* 13818-2 section 7.6.8) \
*/ \
p_pool->pf_addblock( p_idct->pi_block, p_idct->p_dct_data, \
i < 4 ? p_mb->i_lum_dct_stride : \
p_mb->i_chrom_dct_stride ); \
p_idct->pf_idct( p_idct->pi_block, p_idct->p_dct_data, \
i < 4 ? p_mb->i_lum_dct_stride : \
p_mb->i_chrom_dct_stride, \
p_vdec->p_idct_data, \
p_idct->i_sparse_pos ); \
} \
} \
} \
......@@ -280,11 +276,11 @@ void PSZ_NAME ( vdec_thread_t *p_vdec, macroblock_t * p_mb ) \
for( i = 0, p_idct = p_mb->p_idcts; i < 4 + 2 * B_COLOR; \
i++, p_idct++ ) \
{ \
p_idct->pf_idct( p_vdec->p_idct_data, p_idct->pi_block, \
p_idct->pf_idct( p_idct->pi_block, p_idct->p_dct_data, \
i < 4 ? p_mb->i_lum_dct_stride : \
p_mb->i_chrom_dct_stride, \
p_vdec->p_idct_data, \
p_idct->i_sparse_pos ); \
p_pool->pf_copyblock( p_idct->pi_block, p_idct->p_dct_data, \
i < 4 ? p_mb->i_lum_dct_stride : \
p_mb->i_chrom_dct_stride ); \
} \
} \
}
......
......@@ -2,7 +2,7 @@
* video_parser.c : video parser thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_parser.c,v 1.4 2001/08/22 17:21:45 massiot Exp $
* $Id: video_parser.c,v 1.5 2001/09/05 16:07:50 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -153,12 +153,11 @@ static int InitThread( vpar_thread_t *p_vpar )
#define f p_vpar->p_idct_module->p_functions->idct.functions.idct
p_vpar->pool.pf_idct_init = f.pf_idct_init;
p_vpar->pf_sparse_idct = f.pf_sparse_idct;
p_vpar->pf_idct = f.pf_idct;
p_vpar->pf_sparse_idct_add = f.pf_sparse_idct_add;
p_vpar->pf_idct_add = f.pf_idct_add;
p_vpar->pf_sparse_idct_copy = f.pf_sparse_idct_copy;
p_vpar->pf_idct_copy = f.pf_idct_copy;
p_vpar->pf_norm_scan = f.pf_norm_scan;
p_vpar->pool.pf_decode_init = f.pf_decode_init;
p_vpar->pool.pf_addblock = f.pf_addblock;
p_vpar->pool.pf_copyblock = f.pf_copyblock;
#undef f
/* Initialize input bitstream */
......
......@@ -2,7 +2,7 @@
* video_parser.h : video parser thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_parser.h,v 1.12 2001/08/22 17:21:45 massiot Exp $
* $Id: video_parser.h,v 1.13 2001/09/05 16:07:50 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Jean-Marc Dressler <polux@via.ecp.fr>
......@@ -330,11 +330,18 @@ typedef struct vpar_thread_s
/* Motion compensation plug-in used and shortcuts */
struct module_s * p_motion_module;
/* IDCT plugin used and shortcuts */
/* IDCT plug-in used and shortcuts */
struct module_s * p_idct_module;
void ( * pf_sparse_idct ) ( void *, dctelem_t*, int );
void ( * pf_idct ) ( void *, dctelem_t*, int );
void ( * pf_norm_scan ) ( u8 ppi_scan[2][64] );
void ( * pf_sparse_idct_add )( dctelem_t *, yuv_data_t *, int,
void *, int );
void ( * pf_idct_add ) ( dctelem_t *, yuv_data_t *, int,
void *, int );
void ( * pf_sparse_idct_copy )( dctelem_t *, yuv_data_t *, int,
void *, int );
void ( * pf_idct_copy ) ( dctelem_t *, yuv_data_t *, int,
void *, int );
void ( * pf_norm_scan ) ( u8 ppi_scan[2][64] );
#ifdef STATS
/* Statistics */
......
......@@ -2,7 +2,7 @@
* vpar_blocks.c : blocks parsing
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_blocks.c,v 1.8 2001/09/04 23:21:34 jlj Exp $
* $Id: vpar_blocks.c,v 1.9 2001/09/05 16:07:50 massiot Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
* Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
......@@ -304,23 +304,23 @@ store_coeff:
{
if( i_nc == 0 )
{
p_idct->pf_idct = p_vpar->pf_sparse_idct;
p_idct->pf_idct = p_vpar->pf_sparse_idct_copy;
p_idct->i_sparse_pos = 63;
}
else
{
p_idct->pf_idct = p_vpar->pf_idct;
p_idct->pf_idct = p_vpar->pf_idct_copy;
}
}
else
{
p_idct->pf_idct = p_vpar->pf_sparse_idct;
p_idct->pf_idct = p_vpar->pf_sparse_idct_copy;
p_idct->i_sparse_pos = i_coeff - p_tab->i_run;
}
}
else
{
p_idct->pf_idct = p_vpar->pf_idct;
p_idct->pf_idct = p_vpar->pf_idct_copy;
}
}
......@@ -448,23 +448,23 @@ store_coeff:
{
if( i_nc == 0 )
{
p_idct->pf_idct = p_vpar->pf_sparse_idct;
p_idct->pf_idct = p_vpar->pf_sparse_idct_copy;
p_idct->i_sparse_pos = 63;
}
else
{
p_idct->pf_idct = p_vpar->pf_idct;
p_idct->pf_idct = p_vpar->pf_idct_copy;
}
}
else
{
p_idct->pf_idct = p_vpar->pf_sparse_idct;
p_idct->pf_idct = p_vpar->pf_sparse_idct_copy;
p_idct->i_sparse_pos = i_coeff - p_tab->i_run;
}
}
else
{
p_idct->pf_idct = p_vpar->pf_idct;
p_idct->pf_idct = p_vpar->pf_idct_copy;
}
}
......@@ -614,17 +614,17 @@ coeff_2:
{
if( i_nc == 0 )
{
p_idct->pf_idct = p_vpar->pf_sparse_idct;
p_idct->pf_idct = p_vpar->pf_sparse_idct_add;
p_idct->i_sparse_pos = 63;
}
else
{
p_idct->pf_idct = p_vpar->pf_idct;
p_idct->pf_idct = p_vpar->pf_idct_add;
}
}
else
{
p_idct->pf_idct = p_vpar->pf_sparse_idct;
p_idct->pf_idct = p_vpar->pf_sparse_idct_add;
if( i_nc == 0 )
{
p_idct->i_sparse_pos = 0;
......@@ -637,7 +637,7 @@ coeff_2:
}
else
{
p_idct->pf_idct = p_vpar->pf_idct;
p_idct->pf_idct = p_vpar->pf_idct_add;
}
}
......@@ -775,12 +775,12 @@ store_coeff:
if( i_nc <= 1 )
{
p_idct->pf_idct = p_vpar->pf_sparse_idct;
p_idct->pf_idct = p_vpar->pf_sparse_idct_copy;
p_idct->i_sparse_pos = i_coeff - p_tab->i_run;
}
else
{
p_idct->pf_idct = p_vpar->pf_idct;
p_idct->pf_idct = p_vpar->pf_idct_copy;
}
}
......@@ -930,7 +930,7 @@ coeff_2:
if( i_nc <= 1 )
{
p_idct->pf_idct = p_vpar->pf_sparse_idct;
p_idct->pf_idct = p_vpar->pf_sparse_idct_add;
if( i_nc == 0 )
{
p_idct->i_sparse_pos = 0;
......@@ -942,7 +942,7 @@ coeff_2:
}
else
{
p_idct->pf_idct = p_vpar->pf_idct;
p_idct->pf_idct = p_vpar->pf_idct_add;
}
}
......
......@@ -2,7 +2,7 @@
* vpar_pool.h : video parser/video decoders communication
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_pool.h,v 1.2 2001/08/22 17:21:46 massiot Exp $
* $Id: vpar_pool.h,v 1.3 2001/09/05 16:07:50 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -74,10 +74,6 @@ typedef struct vdec_pool_s
/* Access to the plug-ins needed by the video decoder thread */
void ( * pf_idct_init ) ( void ** );
void ( * pf_decode_init ) ( );
void ( * pf_addblock ) ( dctelem_t *, yuv_data_t *, int );
void ( * pf_copyblock ) ( dctelem_t *, yuv_data_t *, int );
void ( * ppppf_motion[2][2][4] ) ( yuv_data_t *, yuv_data_t *,
int, int );
} vdec_pool_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment