[libav-commits] flacdec: allocate sample buffers with av_malloc

Mans Rullgard git at libav.org
Wed Jul 4 04:38:11 CEST 2012


Module: libav
Branch: master
Commit: 93e7ef9a2472d64d550ba1cf0e7a6f206fbc8dfd

Author:    Mans Rullgard <mans at mansr.com>
Committer: Mans Rullgard <mans at mansr.com>
Date:      Mon Jul  2 23:16:30 2012 +0100

flacdec: allocate sample buffers with av_malloc

The buffers are only allocated once, although it can happen from
any of a few different places, so there is no need to use realloc.
Using av_malloc() ensures they are aligned suitably for SIMD
optimisations.

Signed-off-by: Mans Rullgard <mans at mansr.com>

---

 libavcodec/flacdec.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index da2202a..4b62ea8 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -149,8 +149,7 @@ static void allocate_buffers(FLACContext *s)
     assert(s->max_blocksize);
 
     for (i = 0; i < s->channels; i++) {
-        s->decoded[i] = av_realloc(s->decoded[i],
-                                   sizeof(int32_t)*s->max_blocksize);
+        s->decoded[i] = av_malloc(sizeof(int32_t)*s->max_blocksize);
     }
 }
 



More information about the libav-commits mailing list