changeset 11508:7be32921237f libavcodec

Replace remaining uses of ATTR_ALIGNED with DECLARE_ALIGNED
author mru
date Thu, 18 Mar 2010 15:00:17 +0000
parents 25e209f9153a
children 9adad5749f23
files sparc/dsputil_vis.c x86/fdct_mmx.c x86/idct_mmx.c
diffstat 3 files changed, 39 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/sparc/dsputil_vis.c	Thu Mar 18 00:23:02 2010 +0000
+++ b/sparc/dsputil_vis.c	Thu Mar 18 15:00:17 2010 +0000
@@ -51,20 +51,18 @@
  *      fpsub16         f12, f10, f10
  */
 
-#define ATTR_ALIGN(alignd) __attribute__ ((aligned(alignd)))
-
 #define DUP4(x) {x, x, x, x}
 #define DUP8(x) {x, x, x, x, x, x, x, x}
-static const int16_t constants1[] ATTR_ALIGN(8) = DUP4 (1);
-static const int16_t constants2[] ATTR_ALIGN(8) = DUP4 (2);
-static const int16_t constants3[] ATTR_ALIGN(8) = DUP4 (3);
-static const int16_t constants6[] ATTR_ALIGN(8) = DUP4 (6);
-static const int8_t constants_fe[] ATTR_ALIGN(8) = DUP8 (0xfe);
-static const int8_t constants_7f[] ATTR_ALIGN(8) = DUP8 (0x7f);
-static const int8_t constants128[] ATTR_ALIGN(8) = DUP8 (128);
-static const int16_t constants256_512[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int16_t, constants1)[] = DUP4 (1);
+DECLARE_ALIGNED(8, static const int16_t, constants2)[] = DUP4 (2);
+DECLARE_ALIGNED(8, static const int16_t, constants3)[] = DUP4 (3);
+DECLARE_ALIGNED(8, static const int16_t, constants6)[] = DUP4 (6);
+DECLARE_ALIGNED(8, static const int8_t, constants_fe)[] = DUP8 (0xfe);
+DECLARE_ALIGNED(8, static const int8_t, constants_7f)[] = DUP8 (0x7f);
+DECLARE_ALIGNED(8, static const int8_t, constants128)[] = DUP8 (128);
+DECLARE_ALIGNED(8, static const int16_t, constants256_512)[] =
         {256, 512, 256, 512};
-static const int16_t constants256_1024[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int16_t, constants256_1024)[] =
         {256, 1024, 256, 1024};
 
 #define REF_0           0
--- a/x86/fdct_mmx.c	Thu Mar 18 00:23:02 2010 +0000
+++ b/x86/fdct_mmx.c	Thu Mar 18 15:00:17 2010 +0000
@@ -33,8 +33,6 @@
 #include "libavutil/common.h"
 #include "libavcodec/dsputil.h"
 
-#define ATTR_ALIGN(align) __attribute__ ((__aligned__ (align)))
-
 //////////////////////////////////////////////////////////////////////
 //
 // constants for the forward DCT
@@ -55,30 +53,30 @@
 #define X8(x) x,x,x,x,x,x,x,x
 
 //concatenated table, for forward DCT transformation
-static const int16_t fdct_tg_all_16[24] ATTR_ALIGN(16) = {
+DECLARE_ALIGNED(16, static const int16_t, fdct_tg_all_16)[24] = {
     X8(13036),  // tg * (2<<16) + 0.5
     X8(27146),  // tg * (2<<16) + 0.5
     X8(-21746)  // tg * (2<<16) + 0.5
 };
 
-static const int16_t ocos_4_16[8] ATTR_ALIGN(16) = {
+DECLARE_ALIGNED(16, static const int16_t, ocos_4_16)[8] = {
     X8(23170)   //cos * (2<<15) + 0.5
 };
 
-static const int16_t fdct_one_corr[8] ATTR_ALIGN(16) = { X8(1) };
+DECLARE_ALIGNED(16, static const int16_t, fdct_one_corr)[8] = { X8(1) };
 
-static const int32_t fdct_r_row[2] ATTR_ALIGN(8) = {RND_FRW_ROW, RND_FRW_ROW };
+DECLARE_ALIGNED(8, static const int32_t, fdct_r_row)[2] = {RND_FRW_ROW, RND_FRW_ROW };
 
 static struct
 {
- const int32_t fdct_r_row_sse2[4] ATTR_ALIGN(16);
-} fdct_r_row_sse2 ATTR_ALIGN(16)=
+ DECLARE_ALIGNED(16, const int32_t, fdct_r_row_sse2)[4];
+} fdct_r_row_sse2 =
 {{
  RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW
 }};
-//static const long fdct_r_row_sse2[4] ATTR_ALIGN(16) = {RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW};
+//DECLARE_ALIGNED(16, static const long, fdct_r_row_sse2)[4] = {RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW};
 
-static const int16_t tab_frw_01234567[] ATTR_ALIGN(8) = {  // forward_dct coeff table
+DECLARE_ALIGNED(8, static const int16_t, tab_frw_01234567)[] = {  // forward_dct coeff table
   16384,   16384,   22725,   19266,
   16384,   16384,   12873,    4520,
   21407,    8867,   19266,   -4520,
@@ -154,10 +152,10 @@
 
 static struct
 {
- const int16_t tab_frw_01234567_sse2[256] ATTR_ALIGN(16);
-} tab_frw_01234567_sse2 ATTR_ALIGN(16) =
+ DECLARE_ALIGNED(16, const int16_t, tab_frw_01234567_sse2)[256];
+} tab_frw_01234567_sse2 =
 {{
-//static const int16_t tab_frw_01234567_sse2[] ATTR_ALIGN(16) = {  // forward_dct coeff table
+//DECLARE_ALIGNED(16, static const int16_t, tab_frw_01234567_sse2)[] = {  // forward_dct coeff table
 #define TABLE_SSE2 C4,  C4,  C1,  C3, -C6, -C2, -C1, -C5, \
                    C4,  C4,  C5,  C7,  C2,  C6,  C3, -C7, \
                   -C4,  C4,  C7,  C3,  C6, -C2,  C7, -C5, \
@@ -535,7 +533,7 @@
 
 void ff_fdct_mmx(int16_t *block)
 {
-    int64_t align_tmp[16] ATTR_ALIGN(8);
+    DECLARE_ALIGNED(8, int64_t, align_tmp)[16];
     int16_t * block1= (int16_t*)align_tmp;
     const int16_t *table= tab_frw_01234567;
     int i;
@@ -553,7 +551,7 @@
 
 void ff_fdct_mmx2(int16_t *block)
 {
-    int64_t align_tmp[16] ATTR_ALIGN(8);
+    DECLARE_ALIGNED(8, int64_t, align_tmp)[16];
     int16_t *block1= (int16_t*)align_tmp;
     const int16_t *table= tab_frw_01234567;
     int i;
@@ -571,7 +569,7 @@
 
 void ff_fdct_sse2(int16_t *block)
 {
-    int64_t align_tmp[16] ATTR_ALIGN(16);
+    DECLARE_ALIGNED(16, int64_t, align_tmp)[16];
     int16_t * const block1= (int16_t*)align_tmp;
 
     fdct_col_sse2(block, block1, 0);
--- a/x86/idct_mmx.c	Thu Mar 18 00:23:02 2010 +0000
+++ b/x86/idct_mmx.c	Thu Mar 18 15:00:17 2010 +0000
@@ -26,8 +26,6 @@
 #include "dsputil_mmx.h"
 #include "mmx.h"
 
-#define ATTR_ALIGN(align) __attribute__ ((__aligned__ (align)))
-
 #define ROW_SHIFT 11
 #define COL_SHIFT 6
 
@@ -400,10 +398,10 @@
 #define T3 43790
 #define C4 23170
 
-    static const short t1_vector[] ATTR_ALIGN(8) = {T1,T1,T1,T1};
-    static const short t2_vector[] ATTR_ALIGN(8) = {T2,T2,T2,T2};
-    static const short t3_vector[] ATTR_ALIGN(8) = {T3,T3,T3,T3};
-    static const short c4_vector[] ATTR_ALIGN(8) = {C4,C4,C4,C4};
+    DECLARE_ALIGNED(8, static const short, t1_vector)[] = {T1,T1,T1,T1};
+    DECLARE_ALIGNED(8, static const short, t2_vector)[] = {T2,T2,T2,T2};
+    DECLARE_ALIGNED(8, static const short, t3_vector)[] = {T3,T3,T3,T3};
+    DECLARE_ALIGNED(8, static const short, c4_vector)[] = {C4,C4,C4,C4};
 
     /* column code adapted from Peter Gubanov */
     /* http://www.elecard.com/peter/idct.shtml */
@@ -542,20 +540,20 @@
 }
 
 
-static const int32_t rounder0[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int32_t, rounder0)[] =
     rounder ((1 << (COL_SHIFT - 1)) - 0.5);
-static const int32_t rounder4[] ATTR_ALIGN(8) = rounder (0);
-static const int32_t rounder1[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int32_t, rounder4)[] = rounder (0);
+DECLARE_ALIGNED(8, static const int32_t, rounder1)[] =
     rounder (1.25683487303);        /* C1*(C1/C4+C1+C7)/2 */
-static const int32_t rounder7[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int32_t, rounder7)[] =
     rounder (-0.25);                /* C1*(C7/C4+C7-C1)/2 */
-static const int32_t rounder2[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int32_t, rounder2)[] =
     rounder (0.60355339059);        /* C2 * (C6+C2)/2 */
-static const int32_t rounder6[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int32_t, rounder6)[] =
     rounder (-0.25);                /* C2 * (C6-C2)/2 */
-static const int32_t rounder3[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int32_t, rounder3)[] =
     rounder (0.087788325588);       /* C3*(-C3/C4+C3+C5)/2 */
-static const int32_t rounder5[] ATTR_ALIGN(8) =
+DECLARE_ALIGNED(8, static const int32_t, rounder5)[] =
     rounder (-0.441341716183);      /* C3*(-C5/C4+C5-C3)/2 */
 
 #undef COL_SHIFT
@@ -564,13 +562,13 @@
 #define declare_idct(idct,table,idct_row_head,idct_row,idct_row_tail,idct_row_mid) \
 void idct (int16_t * const block)                                       \
 {                                                                       \
-    static const int16_t table04[] ATTR_ALIGN(16) =                     \
+    DECLARE_ALIGNED(16, static const int16_t, table04)[] =              \
         table (22725, 21407, 19266, 16384, 12873,  8867, 4520);         \
-    static const int16_t table17[] ATTR_ALIGN(16) =                     \
+    DECLARE_ALIGNED(16, static const int16_t, table17)[] =              \
         table (31521, 29692, 26722, 22725, 17855, 12299, 6270);         \
-    static const int16_t table26[] ATTR_ALIGN(16) =                     \
+    DECLARE_ALIGNED(16, static const int16_t, table26)[] =              \
         table (29692, 27969, 25172, 21407, 16819, 11585, 5906);         \
-    static const int16_t table35[] ATTR_ALIGN(16) =                     \
+    DECLARE_ALIGNED(16, static const int16_t, table35)[] =              \
         table (26722, 25172, 22654, 19266, 15137, 10426, 5315);         \
                                                                         \
     idct_row_head (block, 0*8, table04);                                \