Commit cf5b3832 authored by Gildas Bazin's avatar Gildas Bazin

* introduced a memalign wrapper that will align the memory manually if
  memalign doesn't exist.

  void *vlc_memalign( size_t align, size_t size, void **pp_orig )
  where the return value is the aligned pointer and *pp_orig is the pointer
  that has to be freed afterwards.

  the arithmetic I'm doing on the pointer to align it is not portable to
  64bits architectures. If someone knows how to something portable, please
  tell me ( and no I don't want to do if(sizeof(void *) == blabla) ).

  Other little problem, I was planning to use posix_memalign by default in
  the wrapper implementation but it doesn't work (someone can tell me what
  I'm doing wrong ?)

* re-enabled the sse plugins on win32 as we don't have anymore alignment
  issues.

* fixed typo in vout_directx.c
parent a33d6acc
This diff is collapsed.
...@@ -88,7 +88,7 @@ case x"${target_os}" in ...@@ -88,7 +88,7 @@ case x"${target_os}" in
esac esac
dnl Check for system libs needed dnl Check for system libs needed
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty usleep vasprintf swab sigrelse getpwuid memalign valloc) AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty usleep vasprintf swab sigrelse getpwuid memalign posix_memalign)
AC_CHECK_FUNC(connect,,[ AC_CHECK_FUNC(connect,,[
AC_CHECK_LIB(socket,connect, AC_CHECK_LIB(socket,connect,
...@@ -377,9 +377,7 @@ dnl ...@@ -377,9 +377,7 @@ dnl
MMX_MODULES="memcpymmx idctmmx motionmmx chroma_i420_rgb_mmx chroma_i420_yuy2_mmx chroma_i422_yuy2_mmx chroma_i420_ymga_mmx" MMX_MODULES="memcpymmx idctmmx motionmmx chroma_i420_rgb_mmx chroma_i420_yuy2_mmx chroma_i422_yuy2_mmx chroma_i420_ymga_mmx"
MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext" MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn" THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn"
if test x$SYS != xmingw32; then SSE_MODULES="imdctsse downmixsse"
SSE_MODULES="imdctsse downmixsse"
fi
ALTIVEC_MODULES="idctaltivec motionaltivec" ALTIVEC_MODULES="idctaltivec motionaltivec"
AC_CACHE_CHECK([if \$CC groks MMX inline assembly], AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ac3_imdct.h : AC3 IMDCT types * ac3_imdct.h : AC3 IMDCT types
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_imdct.h,v 1.6 2001/10/30 19:34:53 reno Exp $ * $Id: ac3_imdct.h,v 1.7 2002/04/05 01:05:22 gbazin Exp $
* *
* Authors: Michel Kaempf <maxx@via.ecp.fr> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Renaud Dartus <reno@videolan.org> * Renaud Dartus <reno@videolan.org>
...@@ -32,26 +32,41 @@ typedef struct complex_s { ...@@ -32,26 +32,41 @@ typedef struct complex_s {
typedef struct imdct_s typedef struct imdct_s
{ {
complex_t * buf; complex_t * buf;
void * buf_orig; /* pointer before memalign */
/* Delay buffer for time domain interleaving */ /* Delay buffer for time domain interleaving */
float * delay; float * delay;
void * delay_orig; /* pointer before memalign */
float * delay1; float * delay1;
void * delay1_orig; /* pointer before memalign */
/* Twiddle factors for IMDCT */ /* Twiddle factors for IMDCT */
float * xcos1; float * xcos1;
void * xcos1_orig; /* pointer before memalign */
float * xsin1; float * xsin1;
void * xsin1_orig; /* pointer before memalign */
float * xcos2; float * xcos2;
void * xcos2_orig; /* pointer before memalign */
float * xsin2; float * xsin2;
void * xsin2_orig; /* pointer before memalign */
float * xcos_sin_sse; float * xcos_sin_sse;
void * xcos_sin_sse_orig; /* pointer before memalign */
/* Twiddle factor LUT */ /* Twiddle factor LUT */
complex_t * w_2; complex_t * w_2;
void * w_2_orig; /* pointer before memalign */
complex_t * w_4; complex_t * w_4;
void * w_4_orig; /* pointer before memalign */
complex_t * w_8; complex_t * w_8;
void * w_8_orig; /* pointer before memalign */
complex_t * w_16; complex_t * w_16;
void * w_16_orig; /* pointer before memalign */
complex_t * w_32; complex_t * w_32;
void * w_32_orig; /* pointer before memalign */
complex_t * w_64; complex_t * w_64;
void * w_64_orig; /* pointer before memalign */
complex_t * w_1; complex_t * w_1;
void * w_1_orig; /* pointer before memalign */
/* Module used and shortcuts */ /* Module used and shortcuts */
struct module_s * p_module; struct module_s * p_module;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions * Collection of useful common types and macros definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.91 2002/04/02 23:43:57 gbazin Exp $ * $Id: common.h,v 1.92 2002/04/05 01:05:22 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@via.ecp.fr> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -357,21 +357,33 @@ struct intf_subscription_s; ...@@ -357,21 +357,33 @@ struct intf_subscription_s;
# define ATTR_ALIGN(align) # define ATTR_ALIGN(align)
#endif #endif
/* Alignment of critical dynamic data structure */ /* Alignment of critical dynamic data structure
*
* Not all platforms support memalign so we provide a vlc_memalign wrapper
* void *vlc_memalign( size_t align, size_t size, void **pp_orig )
* *pp_orig is the pointer that has to be freed afterwards.
*/
#if 0
#ifdef HAVE_POSIX_MEMALIGN
# define vlc_memalign(align,size,pp_orig) \
( !posix_memalign( pp_orig, align, size ) ? *(pp_orig) : NULL )
#endif
#endif
#ifdef HAVE_MEMALIGN #ifdef HAVE_MEMALIGN
/* Some systems have memalign() but no declaration for it */ /* Some systems have memalign() but no declaration for it */
void * memalign( size_t align, size_t size ); void * memalign( size_t align, size_t size );
#else
# ifdef HAVE_VALLOC # define vlc_memalign(align,size,pp_orig) \
/* That's like using a hammer to kill a fly, but eh... */ ( *(pp_orig) = memalign( align, size ) )
# include <unistd.h>
# define memalign(align,size) valloc(size) #else /* We don't have any choice but to align manually */
# else # define vlc_memalign(align,size,pp_orig) \
/* Assume malloc alignment is sufficient */ (( *(pp_orig) = malloc( size + align - 1 )) ? \
# define memalign(align,size) malloc(size) (void *)( (((unsigned long)*(pp_orig)) + 15) & ~0xFUL ) : NULL )
# endif
#endif #endif
#define I64C(x) x##LL #define I64C(x) x##LL
......
/* include/defs.h.in. Generated automatically from configure.in by autoheader. */ /* include/defs.h.in. Generated automatically from configure.in by autoheader 2.13. */
/* Define if using alloca.c. */ /* Define if using alloca.c. */
#undef C_ALLOCA #undef C_ALLOCA
...@@ -100,6 +100,9 @@ ...@@ -100,6 +100,9 @@
/* Define if you have the munmap function. */ /* Define if you have the munmap function. */
#undef HAVE_MUNMAP #undef HAVE_MUNMAP
/* Define if you have the posix_memalign function. */
#undef HAVE_POSIX_MEMALIGN
/* Define if you have the putenv function. */ /* Define if you have the putenv function. */
#undef HAVE_PUTENV #undef HAVE_PUTENV
...@@ -148,9 +151,6 @@ ...@@ -148,9 +151,6 @@
/* Define if you have the usleep function. */ /* Define if you have the usleep function. */
#undef HAVE_USLEEP #undef HAVE_USLEEP
/* Define if you have the valloc function. */
#undef HAVE_VALLOC
/* Define if you have the vasprintf function. */ /* Define if you have the vasprintf function. */
#undef HAVE_VASPRINTF #undef HAVE_VASPRINTF
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vdec_ext-plugins.h : structures from the video decoder exported to plug-ins * vdec_ext-plugins.h : structures from the video decoder exported to plug-ins
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: vdec_ext-plugins.h,v 1.9 2002/01/04 14:01:34 sam Exp $ * $Id: vdec_ext-plugins.h,v 1.10 2002/04/05 01:05:22 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -29,6 +29,7 @@ typedef struct idct_inner_s ...@@ -29,6 +29,7 @@ typedef struct idct_inner_s
{ {
/* Should be kept aligned ! */ /* Should be kept aligned ! */
dctelem_t * pi_block; /* block */ dctelem_t * pi_block; /* block */
void * pi_block_orig; /* pointer before memalign */
void ( * pf_idct ) ( dctelem_t *, yuv_data_t *, int, void ( * pf_idct ) ( dctelem_t *, yuv_data_t *, int,
void *, int ); void *, int );
/* sparse IDCT or not, add or copy ? */ /* sparse IDCT or not, add or copy ? */
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* includes all common video types and constants. * includes all common video types and constants.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: video.h,v 1.47 2002/03/17 17:00:38 sam Exp $ * $Id: video.h,v 1.48 2002/04/05 01:05:22 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -60,6 +60,7 @@ typedef struct picture_s ...@@ -60,6 +60,7 @@ typedef struct picture_s
* NEVER be modified. A direct buffer can be handled as the plugin * NEVER be modified. A direct buffer can be handled as the plugin
* wishes, it can even swap p_pixels buffers. */ * wishes, it can even swap p_pixels buffers. */
u8 *p_data; u8 *p_data;
void *p_data_orig; /* pointer before memalign */
plane_t p[ VOUT_MAX_PLANES ]; /* description of the planes */ plane_t p[ VOUT_MAX_PLANES ]; /* description of the planes */
int i_planes; /* number of allocated planes */ int i_planes; /* number of allocated planes */
...@@ -351,6 +352,7 @@ typedef struct subpicture_s ...@@ -351,6 +352,7 @@ typedef struct subpicture_s
/* Private data - the subtitle plugin might want to put stuff here to /* Private data - the subtitle plugin might want to put stuff here to
* keep track of the subpicture */ * keep track of the subpicture */
struct subpicture_sys_s *p_sys; /* subpicture data */ struct subpicture_sys_s *p_sys; /* subpicture data */
void *p_sys_orig; /* pointer before memalign */
} subpicture_t; } subpicture_t;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ac3_adec.c: ac3 decoder module main file * ac3_adec.c: ac3 decoder module main file
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: ac3_adec.c,v 1.23 2002/03/12 18:37:46 stef Exp $ * $Id: ac3_adec.c,v 1.24 2002/04/05 01:05:22 gbazin Exp $
* *
* Authors: Michel Lespinasse <walken@zoy.org> * Authors: Michel Lespinasse <walken@zoy.org>
* *
...@@ -119,7 +119,8 @@ static int InitThread( ac3dec_thread_t * p_ac3thread ) ...@@ -119,7 +119,8 @@ static int InitThread( ac3dec_thread_t * p_ac3thread )
* Thread properties * Thread properties
*/ */
p_ac3thread->p_fifo = p_ac3thread->p_config->p_decoder_fifo; p_ac3thread->p_fifo = p_ac3thread->p_config->p_decoder_fifo;
p_ac3thread->ac3_decoder = memalign( 16, sizeof(ac3dec_t) ); p_ac3thread->ac3_decoder =
vlc_memalign( 16, sizeof(ac3dec_t), &p_ac3thread->ac3_decoder_orig );
/* /*
* Choose the best downmix module * Choose the best downmix module
...@@ -133,7 +134,7 @@ static int InitThread( ac3dec_thread_t * p_ac3thread ) ...@@ -133,7 +134,7 @@ static int InitThread( ac3dec_thread_t * p_ac3thread )
if( DOWNMIX.p_module == NULL ) if( DOWNMIX.p_module == NULL )
{ {
intf_ErrMsg( "ac3dec error: no suitable downmix module" ); intf_ErrMsg( "ac3dec error: no suitable downmix module" );
free( p_ac3thread->ac3_decoder ); free( p_ac3thread->ac3_decoder_orig );
return( -1 ); return( -1 );
} }
...@@ -151,7 +152,8 @@ static int InitThread( ac3dec_thread_t * p_ac3thread ) ...@@ -151,7 +152,8 @@ static int InitThread( ac3dec_thread_t * p_ac3thread )
/* /*
* Choose the best IMDCT module * Choose the best IMDCT module
*/ */
p_ac3thread->ac3_decoder->imdct = memalign(16, sizeof(imdct_t)); p_ac3thread->ac3_decoder->imdct =
vlc_memalign( 16, sizeof(imdct_t), &p_ac3thread->ac3_decoder->imdct_orig );
#define IMDCT p_ac3thread->ac3_decoder->imdct #define IMDCT p_ac3thread->ac3_decoder->imdct
psz_name = config_GetPszVariable( IMDCT_METHOD_VAR ); psz_name = config_GetPszVariable( IMDCT_METHOD_VAR );
...@@ -163,8 +165,8 @@ static int InitThread( ac3dec_thread_t * p_ac3thread ) ...@@ -163,8 +165,8 @@ static int InitThread( ac3dec_thread_t * p_ac3thread )
{ {
intf_ErrMsg( "ac3dec error: no suitable IMDCT module" ); intf_ErrMsg( "ac3dec error: no suitable IMDCT module" );
module_Unneed( p_ac3thread->ac3_decoder->downmix.p_module ); module_Unneed( p_ac3thread->ac3_decoder->downmix.p_module );
free( p_ac3thread->ac3_decoder->imdct ); free( p_ac3thread->ac3_decoder->imdct_orig );
free( p_ac3thread->ac3_decoder ); free( p_ac3thread->ac3_decoder_orig );
return( -1 ); return( -1 );
} }
...@@ -177,23 +179,40 @@ static int InitThread( ac3dec_thread_t * p_ac3thread ) ...@@ -177,23 +179,40 @@ static int InitThread( ac3dec_thread_t * p_ac3thread )
#undef F #undef F
/* Initialize the ac3 decoder structures */ /* Initialize the ac3 decoder structures */
p_ac3thread->ac3_decoder->samples = memalign( 16, 6 * 256 * sizeof(float) ); p_ac3thread->ac3_decoder->samples =
vlc_memalign( 16, 6 * 256 * sizeof(float),
IMDCT->buf = memalign( 16, N/4 * sizeof(complex_t) ); &p_ac3thread->ac3_decoder->samples_orig );
IMDCT->delay = memalign( 16, 6 * 256 * sizeof(float) );
IMDCT->delay1 = memalign( 16, 6 * 256 * sizeof(float) ); IMDCT->buf = vlc_memalign( 16, N/4 * sizeof(complex_t),
IMDCT->xcos1 = memalign( 16, N/4 * sizeof(float) ); &IMDCT->buf_orig );
IMDCT->xsin1 = memalign( 16, N/4 * sizeof(float) ); IMDCT->delay = vlc_memalign( 16, 6 * 256 * sizeof(float),
IMDCT->xcos2 = memalign( 16, N/8 * sizeof(float) ); &IMDCT->delay_orig );
IMDCT->xsin2 = memalign( 16, N/8 * sizeof(float) ); IMDCT->delay1 = vlc_memalign( 16, 6 * 256 * sizeof(float),
IMDCT->xcos_sin_sse = memalign( 16, 128 * 4 * sizeof(float) ); &IMDCT->delay1_orig );
IMDCT->w_1 = memalign( 16, 1 * sizeof(complex_t) ); IMDCT->xcos1 = vlc_memalign( 16, N/4 * sizeof(float),
IMDCT->w_2 = memalign( 16, 2 * sizeof(complex_t) ); &IMDCT->xcos1_orig );
IMDCT->w_4 = memalign( 16, 4 * sizeof(complex_t) ); IMDCT->xsin1 = vlc_memalign( 16, N/4 * sizeof(float),
IMDCT->w_8 = memalign( 16, 8 * sizeof(complex_t) ); &IMDCT->xsin1_orig );
IMDCT->w_16 = memalign( 16, 16 * sizeof(complex_t) ); IMDCT->xcos2 = vlc_memalign( 16, N/8 * sizeof(float),
IMDCT->w_32 = memalign( 16, 32 * sizeof(complex_t) ); &IMDCT->xcos2_orig );
IMDCT->w_64 = memalign( 16, 64 * sizeof(complex_t) ); IMDCT->xsin2 = vlc_memalign( 16, N/8 * sizeof(float),
&IMDCT->xsin2_orig );
IMDCT->xcos_sin_sse = vlc_memalign( 16, 128 * 4 * sizeof(float),
&IMDCT->xcos_sin_sse_orig );
IMDCT->w_1 = vlc_memalign( 16, 1 * sizeof(complex_t),
&IMDCT->w_1_orig );
IMDCT->w_2 = vlc_memalign( 16, 2 * sizeof(complex_t),
&IMDCT->w_2_orig );
IMDCT->w_4 = vlc_memalign( 16, 4 * sizeof(complex_t),
&IMDCT->w_4_orig );
IMDCT->w_8 = vlc_memalign( 16, 8 * sizeof(complex_t),
&IMDCT->w_8_orig );
IMDCT->w_16 = vlc_memalign( 16, 16 * sizeof(complex_t),
&IMDCT->w_16_orig );
IMDCT->w_32 = vlc_memalign( 16, 32 * sizeof(complex_t),
&IMDCT->w_32_orig );
IMDCT->w_64 = vlc_memalign( 16, 64 * sizeof(complex_t),
&IMDCT->w_64_orig );
ac3_init( p_ac3thread->ac3_decoder ); ac3_init( p_ac3thread->ac3_decoder );
...@@ -218,10 +237,12 @@ static int InitThread( ac3dec_thread_t * p_ac3thread ) ...@@ -218,10 +237,12 @@ static int InitThread( ac3dec_thread_t * p_ac3thread )
static int decoder_Run ( decoder_config_t * p_config ) static int decoder_Run ( decoder_config_t * p_config )
{ {
ac3dec_thread_t * p_ac3thread; ac3dec_thread_t * p_ac3thread;
void * p_ac3thread_orig; /* pointer before memalign */
boolean_t b_sync = 0; boolean_t b_sync = 0;
/* Allocate the memory needed to store the thread's structure */ /* Allocate the memory needed to store the thread's structure */
p_ac3thread = (ac3dec_thread_t *)memalign(16, sizeof(ac3dec_thread_t)); p_ac3thread = (ac3dec_thread_t *)vlc_memalign( 16,
sizeof(ac3dec_thread_t), &p_ac3thread_orig );
if( p_ac3thread == NULL ) if( p_ac3thread == NULL )
{ {
...@@ -239,7 +260,7 @@ static int decoder_Run ( decoder_config_t * p_config ) ...@@ -239,7 +260,7 @@ static int decoder_Run ( decoder_config_t * p_config )
{ {
intf_ErrMsg( "ac3_adec error: could not initialize thread" ); intf_ErrMsg( "ac3_adec error: could not initialize thread" );
DecoderError( p_config->p_decoder_fifo ); DecoderError( p_config->p_decoder_fifo );
free( p_ac3thread ); free( p_ac3thread_orig );
return( -1 ); return( -1 );
} }
...@@ -298,30 +319,30 @@ static int decoder_Run ( decoder_config_t * p_config ) ...@@ -298,30 +319,30 @@ static int decoder_Run ( decoder_config_t * p_config )
sync_info.sample_rate, AC3DEC_FRAME_SIZE, NULL ); sync_info.sample_rate, AC3DEC_FRAME_SIZE, NULL );
if ( p_ac3thread->p_aout_fifo == NULL ) if ( p_ac3thread->p_aout_fifo == NULL )
{ {
free( IMDCT->w_1 ); free( IMDCT->w_1_orig );
free( IMDCT->w_64 ); free( IMDCT->w_64_orig );
free( IMDCT->w_32 ); free( IMDCT->w_32_orig );
free( IMDCT->w_16 ); free( IMDCT->w_16_orig );
free( IMDCT->w_8 ); free( IMDCT->w_8_orig );
free( IMDCT->w_4 ); free( IMDCT->w_4_orig );
free( IMDCT->w_2 ); free( IMDCT->w_2_orig );
free( IMDCT->xcos_sin_sse ); free( IMDCT->xcos_sin_sse_orig );
free( IMDCT->xsin2 ); free( IMDCT->xsin2_orig );
free( IMDCT->xcos2 ); free( IMDCT->xcos2_orig );
free( IMDCT->xsin1 ); free( IMDCT->xsin1_orig );
free( IMDCT->xcos1 ); free( IMDCT->xcos1_orig );
free( IMDCT->delay1 ); free( IMDCT->delay1_orig );
free( IMDCT->delay ); free( IMDCT->delay_orig );
free( IMDCT->buf ); free( IMDCT->buf_orig );
#undef IMDCT #undef IMDCT
free( p_ac3thread->ac3_decoder->samples ); free( p_ac3thread->ac3_decoder->samples_orig );
module_Unneed( p_ac3thread->ac3_decoder->imdct->p_module ); module_Unneed( p_ac3thread->ac3_decoder->imdct->p_module );
module_Unneed( p_ac3thread->ac3_decoder->downmix.p_module ); module_Unneed( p_ac3thread->ac3_decoder->downmix.p_module );
free( p_ac3thread->ac3_decoder->imdct ); free( p_ac3thread->ac3_decoder->imdct_orig );
free( p_ac3thread->ac3_decoder ); free( p_ac3thread->ac3_decoder_orig );
return( -1 ); return( -1 );
} }
...@@ -364,7 +385,7 @@ static int decoder_Run ( decoder_config_t * p_config ) ...@@ -364,7 +385,7 @@ static int decoder_Run ( decoder_config_t * p_config )
/* End of the ac3 decoder thread */ /* End of the ac3 decoder thread */
EndThread (p_ac3thread); EndThread (p_ac3thread);
free( p_ac3thread ); free( p_ac3thread_orig );
return( 0 ); return( 0 );
} }
...@@ -388,32 +409,32 @@ static void EndThread (ac3dec_thread_t * p_ac3thread) ...@@ -388,32 +409,32 @@ static void EndThread (ac3dec_thread_t * p_ac3thread)
/* Free allocated structures */ /* Free allocated structures */
#define IMDCT p_ac3thread->ac3_decoder->imdct #define IMDCT p_ac3thread->ac3_decoder->imdct
free( IMDCT->w_1 ); free( IMDCT->w_1_orig );
free( IMDCT->w_64 ); free( IMDCT->w_64_orig );
free( IMDCT->w_32 ); free( IMDCT->w_32_orig );
free( IMDCT->w_16 ); free( IMDCT->w_16_orig );
free( IMDCT->w_8 ); free( IMDCT->w_8_orig );
free( IMDCT->w_4 ); free( IMDCT->w_4_orig );
free( IMDCT->w_2 ); free( IMDCT->w_2_orig );
free( IMDCT->xcos_sin_sse ); free( IMDCT->xcos_sin_sse_orig );
free( IMDCT->xsin2 ); free( IMDCT->xsin2_orig );
free( IMDCT->xcos2 ); free( IMDCT->xcos2_orig );
free( IMDCT->xsin1 ); free( IMDCT->xsin1_orig );
free( IMDCT->xcos1 ); free( IMDCT->xcos1_orig );
free( IMDCT->delay1 ); free( IMDCT->delay1_orig );
free( IMDCT->delay ); free( IMDCT->delay_orig );
free( IMDCT->buf ); free( IMDCT->buf_orig );
#undef IMDCT #undef IMDCT
free( p_ac3thread->ac3_decoder->samples ); free( p_ac3thread->ac3_decoder->samples_orig );
/* Unlock the modules */ /* Unlock the modules */
module_Unneed( p_ac3thread->ac3_decoder->downmix.p_module ); module_Unneed( p_ac3thread->ac3_decoder->downmix.p_module );
module_Unneed( p_ac3thread->ac3_decoder->imdct->p_module ); module_Unneed( p_ac3thread->ac3_decoder->imdct->p_module );
/* Free what's left of the decoder */ /* Free what's left of the decoder */
free( p_ac3thread->ac3_decoder->imdct ); free( p_ac3thread->ac3_decoder->imdct_orig );
free( p_ac3thread->ac3_decoder ); free( p_ac3thread->ac3_decoder_orig );
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ac3_adec.h : ac3 decoder thread interface * ac3_adec.h : ac3 decoder thread interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_adec.h,v 1.2 2002/01/22 23:14:26 massiot Exp $ * $Id: ac3_adec.h,v 1.3 2002/04/05 01:05:22 gbazin Exp $
* *
* Authors: Michel Kaempf <maxx@via.ecp.fr> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* *
...@@ -31,6 +31,7 @@ typedef struct ac3dec_thread_s ...@@ -31,6 +31,7 @@ typedef struct ac3dec_thread_s
* Decoder properties * Decoder properties
*/ */
ac3dec_t * ac3_decoder; ac3dec_t * ac3_decoder;
void * ac3_decoder_orig; /* pointer before memalign */
/* /*
* Thread properties * Thread properties
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ac3_decoder.h : ac3 decoder interface * ac3_decoder.h : ac3 decoder interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_decoder.h,v 1.2 2002/02/24 20:51:09 gbazin Exp $ * $Id: ac3_decoder.h,v 1.3 2002/04/05 01:05:22 gbazin Exp $
* *
* Authors: Michel Kaempf <maxx@via.ecp.fr> * Authors: Michel Kaempf <maxx@via.ecp.fr>
* Renaud Dartus <reno@videolan.org> * Renaud Dartus <reno@videolan.org>
...@@ -355,7 +355,9 @@ typedef struct mantissa_s ...@@ -355,7 +355,9 @@ typedef struct mantissa_s
struct ac3dec_s struct ac3dec_s
{ {
float * samples; float * samples;
void * samples_orig; /* pointer before memalign */
imdct_t * imdct; imdct_t * imdct;
void * imdct_orig; /* pointer before memalign */
/* /*
* Input properties * Input properties
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_directx.c: Windows DirectX video output display method * vout_directx.c: Windows DirectX video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: vout_directx.c,v 1.29 2002/04/01 16:08:23 gbazin Exp $ * $Id: vout_directx.c,v 1.30 2002/04/05 01:05:22 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -284,7 +284,7 @@ static void vout_Destroy( vout_thread_t *p_vout ) ...@@ -284,7 +284,7 @@ static void vout_Destroy( vout_thread_t *p_vout )
if( p_vout->p_sys->i_event_thread_status == THREAD_READY && if( p_vout->p_sys->i_event_thread_status == THREAD_READY &&
p_vout->p_sys->hwnd ) p_vout->p_sys->hwnd )
{ {
PostMessage( p_vout->p_sys->hwnd, WM_CHAR, (WPARAM)'q', 0); PostMessage( p_vout->p_sys->hwnd, WM_CHAR, (WPARAM)'^', 0);
vlc_thread_join( p_vout->p_sys->event_thread_id ); vlc_thread_join( p_vout->p_sys->event_thread_id );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_dummy.c: Dummy video output display method for testing purposes * vout_dummy.c: Dummy video output display method for testing purposes
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: vout_dummy.c,v 1.20 2002/03/26 23:08:40 gbazin Exp $ * $Id: vout_dummy.c,v 1.21 2002/04/05 01:05:22 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -174,7 +174,7 @@ static void vout_End( vout_thread_t *p_vout ) ...@@ -174,7 +174,7 @@ static void vout_End( vout_thread_t *p_vout )
for( i_index = I_OUTPUTPICTURES ; i_index ; ) for( i_index = I_OUTPUTPICTURES ; i_index ; )
{ {
i_index--; i_index--;
free( PP_OUTPUTPICTURE[ i_index ]->p_data ); free( PP_OUTPUTPICTURE[ i_index ]->p_data_orig );
} }
} }
...@@ -234,7 +234,8 @@ static int DummyNewPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -234,7 +234,8 @@ static int DummyNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
case FOURCC_YV12: case FOURCC_YV12:
/* Allocate the memory buffer */ /* Allocate the memory buffer */
p_pic->p_data = memalign( 16, i_width * i_height * 3 / 2 ); p_pic->p_data = vlc_memalign( 16, i_width * i_height * 3 / 2,
&p_pic->p_data_orig );
/* Y buffer */ /* Y buffer */
p_pic->Y_PIXELS = p_pic->p_data; p_pic->Y_PIXELS = p_pic->p_data;
...@@ -268,7 +269,8 @@ static int DummyNewPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -268,7 +269,8 @@ static int DummyNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
case FOURCC_RV16: case FOURCC_RV16:
/* Allocate the memory buffer */ /* Allocate the memory buffer */
p_pic->p_data = memalign( 16, i_width * i_height * 2 ); p_pic->p_data = vlc_memalign( 16, i_width * i_height * 2,
&p_pic->p_data_orig );
/* Fill important structures */ /* Fill important structures */
p_pic->p->p_pixels = p_pic->p_data; p_pic->p->p_pixels = p_pic->p_data;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vpar_pool.c : management of the pool of decoder threads * vpar_pool.c : management of the pool of decoder threads
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: vpar_pool.c,v 1.6 2002/03/19 12:48:01 gbazin Exp $ * $Id: vpar_pool.c,v 1.7 2002/04/05 01:05:22 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -89,7 +89,8 @@ void vpar_InitPool( vpar_thread_t * p_vpar ) ...@@ -89,7 +89,8 @@ void vpar_InitPool( vpar_thread_t * p_vpar )
for( j = 0; j < 12; j++ ) for( j = 0; j < 12; j++ )
{ {
p_vpar->pool.mb.p_idcts[j].pi_block = p_vpar->pool.mb.p_idcts[j].pi_block =
memalign( 16, 64 * sizeof(dctelem_t) ); vlc_memalign( 16, 64 * sizeof(dctelem_t),
&p_vpar->pool.mb.p_idcts[j].pi_block_orig );
} }
} }
...@@ -130,7 +131,7 @@ void vpar_SpawnPool( vpar_thread_t * p_vpar ) ...@@ -130,7 +131,7 @@ void vpar_SpawnPool( vpar_thread_t * p_vpar )
for( j = 0; j < 12; j++ ) for( j = 0; j < 12; j++ )
{ {
free( p_vpar->pool.p_macroblocks[i].p_idcts[j].pi_block ); free( p_vpar->pool.p_macroblocks[i].p_idcts[j].pi_block_orig );
} }
} }
...@@ -167,7 +168,8 @@ void vpar_SpawnPool( vpar_thread_t * p_vpar ) ...@@ -167,7 +168,8 @@ void vpar_SpawnPool( vpar_thread_t * p_vpar )
for( j = 0; j < 12; j++ ) for( j = 0; j < 12; j++ )
{ {
p_vpar->pool.p_macroblocks[i].p_idcts[j].pi_block = p_vpar->pool.p_macroblocks[i].p_idcts[j].pi_block =
memalign( 16, 64 * sizeof(dctelem_t) ); vlc_memalign( 16, 64 * sizeof(dctelem_t),
&p_vpar->pool.p_macroblocks[i].p_idcts[j].pi_block_orig );
} }
p_vpar->pool.pp_vdec[i] = vdec_CreateThread( &p_vpar->pool ); p_vpar->pool.pp_vdec[i] = vdec_CreateThread( &p_vpar->pool );
...@@ -209,7 +211,7 @@ void vpar_EndPool( vpar_thread_t * p_vpar ) ...@@ -209,7 +211,7 @@ void vpar_EndPool( vpar_thread_t * p_vpar )
for( i = 0; i < 12; i++ ) for( i = 0; i < 12; i++ )
{ {
free( p_vpar->pool.mb.p_idcts[i].pi_block ); free( p_vpar->pool.mb.p_idcts[i].pi_block_orig );
} }
for( i = 0; i < p_vpar->pool.i_smp; i++ ) for( i = 0; i < p_vpar->pool.i_smp; i++ )
...@@ -220,7 +222,7 @@ void vpar_EndPool( vpar_thread_t * p_vpar ) ...@@ -220,7 +222,7 @@ void vpar_EndPool( vpar_thread_t * p_vpar )
for( j = 0; j < 12; j++ ) for( j = 0; j < 12; j++ )
{ {
free( p_vpar->pool.p_macroblocks[i].p_idcts[j].pi_block ); free( p_vpar->pool.p_macroblocks[i].p_idcts[j].pi_block_orig );
} }
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread. * thread, and destroy a previously oppened video output thread.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.170 2002/04/04 05:08:05 sam Exp $ * $Id: video_output.c,v 1.171 2002/04/05 01:05:22 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -674,7 +674,7 @@ static void EndThread( vout_thread_t *p_vout ) ...@@ -674,7 +674,7 @@ static void EndThread( vout_thread_t *p_vout )
{ {
if ( p_vout->p_picture[i_index].i_type == MEMORY_PICTURE ) if ( p_vout->p_picture[i_index].i_type == MEMORY_PICTURE )
{ {
free( p_vout->p_picture[i_index].p_data ); free( p_vout->p_picture[i_index].p_data_orig );
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_pictures.c : picture management functions * vout_pictures.c : picture management functions
***************************************************************************** *****************************************************************************
* Copyright (C) 2000 VideoLAN * Copyright (C) 2000 VideoLAN
* $Id: vout_pictures.c,v 1.19 2002/03/16 23:03:19 sam Exp $ * $Id: vout_pictures.c,v 1.20 2002/04/05 01:05:22 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -504,7 +504,7 @@ void vout_AllocatePicture( picture_t *p_pic, ...@@ -504,7 +504,7 @@ void vout_AllocatePicture( picture_t *p_pic,
i_bytes += p_pic->p[ i_index ].i_lines * p_pic->p[ i_index ].i_pitch; i_bytes += p_pic->p[ i_index ].i_lines * p_pic->p[ i_index ].i_pitch;
} }
p_pic->p_data = memalign( 16, i_bytes ); p_pic->p_data = vlc_memalign( 16, i_bytes, &p_pic->p_data_orig );
if( p_pic->p_data == NULL ) if( p_pic->p_data == NULL )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_subpictures.c : subpicture management functions * vout_subpictures.c : subpicture management functions
***************************************************************************** *****************************************************************************
* Copyright (C) 2000 VideoLAN * Copyright (C) 2000 VideoLAN
* $Id: vout_subpictures.c,v 1.11 2002/03/15 04:41:54 sam Exp $ * $Id: vout_subpictures.c,v 1.12 2002/04/05 01:05:22 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -125,8 +125,8 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type, ...@@ -125,8 +125,8 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
if( (p_free_subpic == NULL) && (p_destroyed_subpic != NULL ) ) if( (p_free_subpic == NULL) && (p_destroyed_subpic != NULL ) )
{ {
/* No free subpicture or matching destroyed subpictures have been /* No free subpicture or matching destroyed subpictures have been
* found, but a destroyed subpicture is still avalaible */ * found, but a destroyed subpicture is still available */
free( p_destroyed_subpic->p_sys ); free( p_destroyed_subpic->p_sys_orig );
p_free_subpic = p_destroyed_subpic; p_free_subpic = p_destroyed_subpic;
} }
...@@ -138,7 +138,8 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type, ...@@ -138,7 +138,8 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
return( NULL ); return( NULL );
} }
p_free_subpic->p_sys = memalign( 16, i_size ); p_free_subpic->p_sys =
vlc_memalign( 16, i_size, &p_free_subpic->p_sys_orig );
if( p_free_subpic->p_sys != NULL ) if( p_free_subpic->p_sys != NULL )
{ {
......
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