[FFmpeg-cvslog] ac3enc: use LOCAL_ALIGNED macro

Mans Rullgard git at videolan.org
Sun May 29 03:46:44 CEST 2011


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Fri May 27 20:31:57 2011 +0100| [7f7726c7a23f8ca9d8cd5d2511356d724d4284a3] | committer: Mans Rullgard

ac3enc: use LOCAL_ALIGNED macro

Aligned local variables must use the LOCAL_ALIGNED macro to ensure
correct alignment on all systems.  The unusual size argument to
memset is required since the implementation of LOCAL_ALIGNED may
use a pointer to an array.

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7f7726c7a23f8ca9d8cd5d2511356d724d4284a3
---

 libavcodec/ac3enc.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index 5285874..c85c69d 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -546,12 +546,15 @@ static inline float calc_cpl_coord(float energy_ch, float energy_cpl)
 static void apply_channel_coupling(AC3EncodeContext *s)
 {
 #if CONFIG_AC3ENC_FLOAT
-    DECLARE_ALIGNED(16, float,   cpl_coords)      [AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16] = {{{0}}};
-    DECLARE_ALIGNED(16, int32_t, fixed_cpl_coords)[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16] = {{{0}}};
+    LOCAL_ALIGNED_16(float,   cpl_coords,       [AC3_MAX_BLOCKS], [AC3_MAX_CHANNELS][16]);
+    LOCAL_ALIGNED_16(int32_t, fixed_cpl_coords, [AC3_MAX_BLOCKS], [AC3_MAX_CHANNELS][16]);
     int blk, ch, bnd, i, j;
     CoefSumType energy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16] = {{{0}}};
     int num_cpl_coefs = s->num_cpl_subbands * 12;
 
+    memset(cpl_coords,       0, AC3_MAX_BLOCKS * sizeof(*cpl_coords));
+    memset(fixed_cpl_coords, 0, AC3_MAX_BLOCKS * sizeof(*fixed_cpl_coords));
+
     /* calculate coupling channel from fbw channels */
     for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
         AC3Block *block = &s->blocks[blk];



More information about the ffmpeg-cvslog mailing list