Commit 746e6074 authored by Christophe Massiot's avatar Christophe Massiot

Altivec IDCT and motion compensation, courtesy of Michel Lespinasse for

mpeg2dec (untested).
parent b0ef1133
......@@ -74,7 +74,6 @@ LIB_GGI = @LIB_GGI@
LIB_GLIDE = @LIB_GLIDE@
LIB_GNOME = @LIB_GNOME@
LIB_GTK = @LIB_GTK@
LIB_ALTIVEC = @LIB_ALTIVEC@
LIB_LIBDVDCSS = @LIB_LIBDVDCSS@
LIB_KDE = @LIB_KDE@
LIB_MACOSX = @LIB_MACOSX@
......@@ -237,7 +236,7 @@ endif
# Optimizations for PowerPC
ifneq (,$(findstring powerpc,$(ARCH)))
CFLAGS += -mmultiple -mhard-float -mstring
CFLAGS += -mmultiple -mhard-float -mstring -Wa,-m7400
endif
# Optimizations for Sparc
......
This diff is collapsed.
......@@ -56,6 +56,7 @@ AC_CHECK_FUNC(inet_aton,,[
])
AC_CHECK_FUNCS(vasprintf)
AC_CHECK_FUNCS(swab)
AC_CHECK_FUNCS(memalign)
AC_CHECK_FUNCS(sigrelse)
......@@ -619,14 +620,12 @@ 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
......@@ -959,7 +958,6 @@ AC_SUBST(LIB_GGI)
AC_SUBST(LIB_GLIDE)
AC_SUBST(LIB_GNOME)
AC_SUBST(LIB_GTK)
AC_SUBST(LIB_ALTIVEC)
AC_SUBST(LIB_LIBDVDCSS)
AC_SUBST(LIB_KDE)
AC_SUBST(LIB_MACOSX)
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.39 2001/08/22 17:21:45 massiot Exp $
* $Id: common.h,v 1.40 2001/09/25 11:46:13 massiot Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -199,6 +199,15 @@ struct pgrm_descriptor_s;
# define ATTR_ALIGN(align)
#endif
/* Alignment of critical dynamic data structure */
#ifdef HAVE_MEMALIGN
/* Some systems have memalign() but no declaration for it */
void * memalign( size_t align, size_t size );
#else
/* Assume malloc alignment is sufficient */
# define memalign(align,size) malloc(size)
#endif
/* win32, cl and icl support */
#if defined( _MSC_VER )
# define __attribute__(x)
......
......@@ -28,6 +28,9 @@
/* Define if you have the gettimeofday function. */
#undef HAVE_GETTIMEOFDAY
/* Define if you have the memalign function. */
#undef HAVE_MEMALIGN
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
......@@ -94,6 +97,9 @@
/* Define if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define if you have the <gnome.h> header file. */
#undef HAVE_GNOME_H
/* Define if you have the <gtk/gtk.h> header file. */
#undef HAVE_GTK_GTK_H
......
......@@ -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.4 2001/09/05 16:07:49 massiot Exp $
* $Id: vdec_ext-plugins.h,v 1.5 2001/09/25 11:46:13 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -27,7 +27,8 @@
*****************************************************************************/
typedef struct idct_inner_s
{
dctelem_t pi_block[64]; /* block */
/* Should be kept aligned ! */
dctelem_t * pi_block; /* block */
void ( * pf_idct ) ( dctelem_t *, yuv_data_t *, int,
void *, int );
/* sparse IDCT or not, add or copy ? */
......
......@@ -12,17 +12,15 @@ PLUGIN_IDCTCLASSIC = idctclassic.o
PLUGIN_IDCTMMX = idctmmx.o
PLUGIN_IDCTMMXEXT = idctmmxext.o
PLUGIN_IDCTALTIVEC = idctaltivec.o
PLUGIN_IDCTALTIVECASM = idctaltivecasm.o
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)
BUILTIN_IDCTALTIVECASM = $(PLUGIN_IDCTALTIVECASM:%.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)
PLUGIN_C = $(PLUGIN_IDCT) $(PLUGIN_IDCTCLASSIC) $(PLUGIN_IDCTMMX) $(PLUGIN_IDCTMMXEXT) $(PLUGIN_IDCTALTIVEC)
ALL_OBJ = $(PLUGIN_C) $(BUILTIN_IDCT) $(BUILTIN_IDCTCLASSIC) $(BUILTIN_IDCTMMX) $(BUILTIN_IDCTMMXEXT) $(BUILTIN_IDCTALTIVEC)
#
# Virtual targets
......@@ -30,13 +28,6 @@ ALL_OBJ = $(PLUGIN_C) $(PLUGIN_IDCTALTIVEC) $(BUILTIN_IDCT) $(BUILTIN_IDCTCLASSI
include ../../Makefile.modules
$(PLUGIN_IDCTALTIVEC): %.o: .dep/%.d
$(PLUGIN_IDCTALTIVEC): %.o: %.c
$(CC) $(CFLAGS) -DPLUGIN $(PCFLAGS) -faltivec -c -o $@ $<
$(PLUGIN_IDCTALTIVECASM): %.o: %.S
$(CC) $(CFLAGS) -DPLUGIN $(PCFLAGS) -faltivec -c -o $@ $<
$(BUILTIN_IDCT): BUILTIN_IDCT_%.o: .dep/%.d
$(BUILTIN_IDCT): BUILTIN_IDCT_%.o: %.c
$(CC) $(CFLAGS) -DBUILTIN -DMODULE_NAME=idct -c -o $@ $<
......@@ -55,10 +46,7 @@ $(BUILTIN_IDCTMMXEXT): BUILTIN_IDCTMMXEXT_%.o: %.c
$(BUILTIN_IDCTALTIVEC): BUILTIN_IDCTALTIVEC_%.o: .dep/%.d
$(BUILTIN_IDCTALTIVEC): BUILTIN_IDCTALTIVEC_%.o: %.c
$(CC) $(CFLAGS) -DBUILTIN -DMODULE_NAME=idctaltivec -faltivec -c -o $@ $<
$(BUILTIN_IDCTALTIVECASM): BUILTIN_IDCTALTIVEC_%.o: %.S
$(CC) $(CFLAGS) -DBUILTIN -DMODULE_NAME=idctaltivec -faltivec -c -o $@ $<
$(CC) $(CFLAGS) -DBUILTIN -DMODULE_NAME=idctaltivec -c -o $@ $<
#
# Real targets
......@@ -92,10 +80,10 @@ $(BUILTIN_IDCTALTIVECASM): BUILTIN_IDCTALTIVEC_%.o: %.S
ar r $@ $^
$(RANLIB) $@
../idctaltivec.so: $(PLUGIN_IDCTALTIVEC) $(PLUGIN_IDCTALTIVECASM)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_ALTIVEC)
../idctaltivec.so: $(PLUGIN_IDCTALTIVEC)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../idctaltivec.a: $(BUILTIN_IDCTALTIVEC) $(BUILTIN_IDCTALTIVECASM)
../idctaltivec.a: $(BUILTIN_IDCTALTIVEC)
ar r $@ $^
$(RANLIB) $@
This diff is collapsed.
This diff is collapsed.
......@@ -92,7 +92,7 @@ $(BUILTIN_MOTIONALTIVEC): BUILTIN_MOTIONALTIVEC_%.o: %.c
$(RANLIB) $@
../motionaltivec.so: $(PLUGIN_MOTIONALTIVEC)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) $(LIB_ALTIVEC)
$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS)
../motionaltivec.a: $(BUILTIN_MOTIONALTIVEC)
ar r $@ $^
......
This diff is collapsed.
......@@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: main.c,v 1.113 2001/09/05 16:07:50 massiot Exp $
* $Id: main.c,v 1.114 2001/09/25 11:46:14 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -1184,16 +1184,12 @@ static int CPUCapabilities( void )
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));
}
......@@ -1203,7 +1199,6 @@ static int CPUCapabilities( void )
}
signal( SIGILL, NULL );
# endif
return( i_capabilities );
......
......@@ -2,7 +2,7 @@
* vpar_pool.c : management of the pool of decoder threads
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: vpar_pool.c,v 1.2 2001/08/22 17:21:46 massiot Exp $
* $Id: vpar_pool.c,v 1.3 2001/09/25 11:46:14 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -64,6 +64,8 @@ static void DecodeMacroblockPool( vdec_pool_t * p_pool, macroblock_t * p_mb );
*****************************************************************************/
void vpar_InitPool( vpar_thread_t * p_vpar )
{
int j;
/* Initialize mutex and cond. */
vlc_mutex_init( &p_vpar->pool.lock );
vlc_cond_init( &p_vpar->pool.wait_empty );
......@@ -89,6 +91,12 @@ void vpar_InitPool( vpar_thread_t * p_vpar )
p_vpar->pool.p_vdec->b_die = 0;
p_vpar->pool.p_vdec->p_pool = &p_vpar->pool;
vdec_InitThread( p_vpar->pool.p_vdec );
for( j = 0; j < 6; j++ )
{
p_vpar->pool.mb.p_idcts[j].pi_block =
memalign( 16, 64 * sizeof(dctelem_t) );
}
}
/*****************************************************************************
......@@ -124,7 +132,14 @@ void vpar_SpawnPool( vpar_thread_t * p_vpar )
for( i = p_vpar->pool.i_smp - 1; i >= i_new_smp; i-- )
{
int j;
vdec_DestroyThread( p_vpar->pool.pp_vdec[i] );
for( j = 0; j < 6; j++ )
{
free( p_vpar->pool.p_macroblocks[i].p_idcts[j].pi_block );
}
}
p_vpar->pool.pp_vdec = realloc( p_vpar->pool.pp_vdec,
......@@ -155,6 +170,14 @@ void vpar_SpawnPool( vpar_thread_t * p_vpar )
for( i = p_vpar->pool.i_smp; i < i_new_smp ; i++ )
{
int j;
for( j = 0; j < 6; j++ )
{
p_vpar->pool.p_macroblocks[i].p_idcts[j].pi_block =
memalign( 16, 64 * sizeof(dctelem_t) );
}
p_vpar->pool.pp_vdec[i] = vdec_CreateThread( &p_vpar->pool );
}
......@@ -203,7 +226,14 @@ void vpar_EndPool( vpar_thread_t * p_vpar )
for( i = 0; i < p_vpar->pool.i_smp; i++ )
{
int j;
vdec_DestroyThread( p_vpar->pool.pp_vdec[i] );
for( j = 0; j < 6; j++ )
{
free( p_vpar->pool.p_macroblocks[i].p_idcts[j].pi_block );
}
}
if( p_vpar->pool.i_smp )
......
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: video_output.c,v 1.138 2001/08/22 21:18:43 gbazin Exp $
* $Id: video_output.c,v 1.139 2001/09/25 11:46:14 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -402,10 +402,10 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
switch( i_type )
{
case TEXT_SUBPICTURE: /* text subpicture */
p_free_subpic->p_data = malloc( i_size + 1 );
p_free_subpic->p_data = memalign( 16, i_size + 1 );
break;
case DVD_SUBPICTURE: /* DVD subpicture unit */
p_free_subpic->p_data = malloc( i_size );
p_free_subpic->p_data = memalign( 16, i_size );
break;
#ifdef DEBUG
default:
......@@ -623,21 +623,24 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
{
case YUV_420_PICTURE: /* YUV 420: 1,1/4,1/4 samples per pixel */
i_chroma_width = i_width / 2;
p_free_picture->p_data = malloc( i_height * i_chroma_width * 3 * sizeof( yuv_data_t ) );
p_free_picture->p_data = memalign( 16, i_height * i_chroma_width
* 3 * sizeof( yuv_data_t ) );
p_free_picture->p_y = (yuv_data_t *)p_free_picture->p_data;
p_free_picture->p_u = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width*4/2;
p_free_picture->p_v = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width*5/2;
break;
case YUV_422_PICTURE: /* YUV 422: 1,1/2,1/2 samples per pixel */
i_chroma_width = i_width / 2;
p_free_picture->p_data = malloc( i_height * i_chroma_width * 4 * sizeof( yuv_data_t ) );
p_free_picture->p_data = memalign( 16, i_height * i_chroma_width
* 4 * sizeof( yuv_data_t ) );
p_free_picture->p_y = (yuv_data_t *)p_free_picture->p_data;
p_free_picture->p_u = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width*2;
p_free_picture->p_v = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width*3;
break;
case YUV_444_PICTURE: /* YUV 444: 1,1,1 samples per pixel */
i_chroma_width = i_width;
p_free_picture->p_data = malloc( i_height * i_chroma_width * 3 * sizeof( yuv_data_t ) );
p_free_picture->p_data = memalign( 16, i_height * i_chroma_width
* 3 * sizeof( yuv_data_t ) );
p_free_picture->p_y = (yuv_data_t *)p_free_picture->p_data;
p_free_picture->p_u = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width;
p_free_picture->p_v = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width*2;
......
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