[Mplayer-cvslog] CVS: main/liba52 parse.c,1.5,1.6

Dominik 'Rathann' Mierzejewski dominik at rangers.eu.org
Thu Apr 1 14:07:15 CEST 2004


On Thursday, 01 April 2004 at 12:35, Sascha Sommer CVS wrote:
> CVS change done by Sascha Sommer CVS
> 
> Update of /cvsroot/mplayer/main/liba52
> In directory mail:/var2/tmp/cvs-serv15799/liba52
> 
> Modified Files:
> 	parse.c 
> Log Message:
> although this SSE fix is an ugly hack it seems to work fine for me
> 
> Index: parse.c
> ===================================================================
> RCS file: /cvsroot/mplayer/main/liba52/parse.c,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -r1.5 -r1.6
> --- parse.c	12 May 2002 02:18:49 -0000	1.5
> +++ parse.c	1 Apr 2004 10:35:30 -0000	1.6
> @@ -57,6 +57,19 @@
>      downmix_accel_init(mm_accel);
>  
>      samples = memalign (16, 256 * 12 * sizeof (sample_t));
> +#if defined(__MINGW32__) && defined(HAVE_SSE) 
> +    for(i=0;i<10;i++){
> +      if((int)samples%16){
> +        sample_t* samplestmp=malloc(256 * 12 * sizeof (sample_t));   
> +        free(samples);
> +        samples = samplestmp;    
> +      }
> +      else break;
> +    }
> +    if((int)samples%16){
> +      printf("unable to get 16 bit aligned memory => expect crashes when using SSE instructions\n");
> +    }
> +#endif
>      if (samples == NULL)
>  	return NULL;
>  

memalign(2,...) doesn't work? Because that's what you should use to get 16
_bit_ (==2 byte) aligned memory. Besides, according to the manpage:

"GNU libc malloc() always returns 8-byte aligned memory addresses, so
these routines are only needed if you require larger alignment values."

Which I'd read as "malloc is equivalent to memalign(8,...)".
Why then would you need memalign(2,...)?
And why are you using memalign(16,...) to get 2-byte alignment? Not that
it won't be 2-byte aligned... ;)

You could also use posix_memalign, but that requires glibc >= 2.1.91.

-- 
MPlayer RPMs maintainer: http://greysector.rangers.eu.org/mplayer.html
"The Universe doesn't give you any points for doing things that are easy."
        -- Sheridan to Garibaldi in Babylon 5:"The Geometry of Shadows"




More information about the MPlayer-cvslog mailing list