diff options
author | gpoirier <gpoirier@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-11-08 14:48:36 +0000 |
---|---|---|
committer | gpoirier <gpoirier@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-11-08 14:48:36 +0000 |
commit | 7c9d04f18b713aaa0923dd40a36ab794f8f41491 (patch) | |
tree | db5310164a116cbb2e46b9d92ceb63c4041cba77 | |
parent | cb2b207948a02beb6fffac32016de4c25825bccd (diff) |
symplify aligned memory allocation on mingw32 by using ffmpeg's av_malloc/av_free
Patch by Emanuele Giaquinta % e P giaquinta A glauco P it %
Original thread:
Subject: [MPlayer-dev-eng] [PATCH] liba52/parse.c: avoid dirty hack on mingw32
Date: 10/25/2006 03:19 AM
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20779 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | liba52/parse.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/liba52/parse.c b/liba52/parse.c index 974e12ae0e..92d38b482f 100644 --- a/liba52/parse.c +++ b/liba52/parse.c @@ -37,6 +37,7 @@ #include "bitstream.h" #include "tables.h" #include "mm_accel.h" +#include "libavutil/avutil.h" #ifdef HAVE_MEMALIGN /* some systems have memalign() but no declaration for it */ @@ -63,16 +64,10 @@ a52_state_t * a52_init (uint32_t mm_accel) if (state == NULL) return NULL; - state->samples = memalign (16, 256 * 12 * sizeof (sample_t)); #if defined(__MINGW32__) && defined(HAVE_SSE) - for(i=0;i<10;i++){ - if((int)state->samples%16){ - sample_t* samplestmp=malloc(256 * 12 * sizeof (sample_t)); - free(state->samples); - state->samples = samplestmp; - } - else break; - } + state->samples = av_malloc(256 * 12 * sizeof (sample_t)); +#else + state->samples = memalign (16, 256 * 12 * sizeof (sample_t)); #endif if(((int)state->samples%16) && (mm_accel&MM_ACCEL_X86_SSE)){ mm_accel &=~MM_ACCEL_X86_SSE; @@ -915,6 +910,10 @@ int a52_block (a52_state_t * state) void a52_free (a52_state_t * state) { - free (state->samples); +#if defined(__MINGW32__) && defined(HAVE_SSE) + av_free (state->samples); +#else + free (state->samples); +#endif free (state); } |