Mercurial > libavcodec.hg
comparison x86/fdct_mmx.c @ 11508:7be32921237f libavcodec
Replace remaining uses of ATTR_ALIGNED with DECLARE_ALIGNED
author | mru |
---|---|
date | Thu, 18 Mar 2010 15:00:17 +0000 |
parents | 7768bdfd4f7b |
children |
comparison
equal
deleted
inserted
replaced
11507:25e209f9153a | 11508:7be32921237f |
---|---|
30 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 30 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
31 */ | 31 */ |
32 | 32 |
33 #include "libavutil/common.h" | 33 #include "libavutil/common.h" |
34 #include "libavcodec/dsputil.h" | 34 #include "libavcodec/dsputil.h" |
35 | |
36 #define ATTR_ALIGN(align) __attribute__ ((__aligned__ (align))) | |
37 | 35 |
38 ////////////////////////////////////////////////////////////////////// | 36 ////////////////////////////////////////////////////////////////////// |
39 // | 37 // |
40 // constants for the forward DCT | 38 // constants for the forward DCT |
41 // ----------------------------- | 39 // ----------------------------- |
53 //#define RND_FRW_COL (1 << (SHIFT_FRW_COL-1)) | 51 //#define RND_FRW_COL (1 << (SHIFT_FRW_COL-1)) |
54 | 52 |
55 #define X8(x) x,x,x,x,x,x,x,x | 53 #define X8(x) x,x,x,x,x,x,x,x |
56 | 54 |
57 //concatenated table, for forward DCT transformation | 55 //concatenated table, for forward DCT transformation |
58 static const int16_t fdct_tg_all_16[24] ATTR_ALIGN(16) = { | 56 DECLARE_ALIGNED(16, static const int16_t, fdct_tg_all_16)[24] = { |
59 X8(13036), // tg * (2<<16) + 0.5 | 57 X8(13036), // tg * (2<<16) + 0.5 |
60 X8(27146), // tg * (2<<16) + 0.5 | 58 X8(27146), // tg * (2<<16) + 0.5 |
61 X8(-21746) // tg * (2<<16) + 0.5 | 59 X8(-21746) // tg * (2<<16) + 0.5 |
62 }; | 60 }; |
63 | 61 |
64 static const int16_t ocos_4_16[8] ATTR_ALIGN(16) = { | 62 DECLARE_ALIGNED(16, static const int16_t, ocos_4_16)[8] = { |
65 X8(23170) //cos * (2<<15) + 0.5 | 63 X8(23170) //cos * (2<<15) + 0.5 |
66 }; | 64 }; |
67 | 65 |
68 static const int16_t fdct_one_corr[8] ATTR_ALIGN(16) = { X8(1) }; | 66 DECLARE_ALIGNED(16, static const int16_t, fdct_one_corr)[8] = { X8(1) }; |
69 | 67 |
70 static const int32_t fdct_r_row[2] ATTR_ALIGN(8) = {RND_FRW_ROW, RND_FRW_ROW }; | 68 DECLARE_ALIGNED(8, static const int32_t, fdct_r_row)[2] = {RND_FRW_ROW, RND_FRW_ROW }; |
71 | 69 |
72 static struct | 70 static struct |
73 { | 71 { |
74 const int32_t fdct_r_row_sse2[4] ATTR_ALIGN(16); | 72 DECLARE_ALIGNED(16, const int32_t, fdct_r_row_sse2)[4]; |
75 } fdct_r_row_sse2 ATTR_ALIGN(16)= | 73 } fdct_r_row_sse2 = |
76 {{ | 74 {{ |
77 RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW | 75 RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW |
78 }}; | 76 }}; |
79 //static const long fdct_r_row_sse2[4] ATTR_ALIGN(16) = {RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW}; | 77 //DECLARE_ALIGNED(16, static const long, fdct_r_row_sse2)[4] = {RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW}; |
80 | 78 |
81 static const int16_t tab_frw_01234567[] ATTR_ALIGN(8) = { // forward_dct coeff table | 79 DECLARE_ALIGNED(8, static const int16_t, tab_frw_01234567)[] = { // forward_dct coeff table |
82 16384, 16384, 22725, 19266, | 80 16384, 16384, 22725, 19266, |
83 16384, 16384, 12873, 4520, | 81 16384, 16384, 12873, 4520, |
84 21407, 8867, 19266, -4520, | 82 21407, 8867, 19266, -4520, |
85 -8867, -21407, -22725, -12873, | 83 -8867, -21407, -22725, -12873, |
86 16384, -16384, 12873, -22725, | 84 16384, -16384, 12873, -22725, |
152 29692, -12299, 26722, -31521, | 150 29692, -12299, 26722, -31521, |
153 }; | 151 }; |
154 | 152 |
155 static struct | 153 static struct |
156 { | 154 { |
157 const int16_t tab_frw_01234567_sse2[256] ATTR_ALIGN(16); | 155 DECLARE_ALIGNED(16, const int16_t, tab_frw_01234567_sse2)[256]; |
158 } tab_frw_01234567_sse2 ATTR_ALIGN(16) = | 156 } tab_frw_01234567_sse2 = |
159 {{ | 157 {{ |
160 //static const int16_t tab_frw_01234567_sse2[] ATTR_ALIGN(16) = { // forward_dct coeff table | 158 //DECLARE_ALIGNED(16, static const int16_t, tab_frw_01234567_sse2)[] = { // forward_dct coeff table |
161 #define TABLE_SSE2 C4, C4, C1, C3, -C6, -C2, -C1, -C5, \ | 159 #define TABLE_SSE2 C4, C4, C1, C3, -C6, -C2, -C1, -C5, \ |
162 C4, C4, C5, C7, C2, C6, C3, -C7, \ | 160 C4, C4, C5, C7, C2, C6, C3, -C7, \ |
163 -C4, C4, C7, C3, C6, -C2, C7, -C5, \ | 161 -C4, C4, C7, C3, C6, -C2, C7, -C5, \ |
164 C4, -C4, C5, -C1, C2, -C6, C3, -C1, | 162 C4, -C4, C5, -C1, C2, -C6, C3, -C1, |
165 // c1..c7 * cos(pi/4) * 2^15 | 163 // c1..c7 * cos(pi/4) * 2^15 |
533 : "r" (in), "r" (table), "r" (fdct_r_row), "r" (out)); | 531 : "r" (in), "r" (table), "r" (fdct_r_row), "r" (out)); |
534 } | 532 } |
535 | 533 |
536 void ff_fdct_mmx(int16_t *block) | 534 void ff_fdct_mmx(int16_t *block) |
537 { | 535 { |
538 int64_t align_tmp[16] ATTR_ALIGN(8); | 536 DECLARE_ALIGNED(8, int64_t, align_tmp)[16]; |
539 int16_t * block1= (int16_t*)align_tmp; | 537 int16_t * block1= (int16_t*)align_tmp; |
540 const int16_t *table= tab_frw_01234567; | 538 const int16_t *table= tab_frw_01234567; |
541 int i; | 539 int i; |
542 | 540 |
543 fdct_col_mmx(block, block1, 0); | 541 fdct_col_mmx(block, block1, 0); |
551 } | 549 } |
552 } | 550 } |
553 | 551 |
554 void ff_fdct_mmx2(int16_t *block) | 552 void ff_fdct_mmx2(int16_t *block) |
555 { | 553 { |
556 int64_t align_tmp[16] ATTR_ALIGN(8); | 554 DECLARE_ALIGNED(8, int64_t, align_tmp)[16]; |
557 int16_t *block1= (int16_t*)align_tmp; | 555 int16_t *block1= (int16_t*)align_tmp; |
558 const int16_t *table= tab_frw_01234567; | 556 const int16_t *table= tab_frw_01234567; |
559 int i; | 557 int i; |
560 | 558 |
561 fdct_col_mmx(block, block1, 0); | 559 fdct_col_mmx(block, block1, 0); |
569 } | 567 } |
570 } | 568 } |
571 | 569 |
572 void ff_fdct_sse2(int16_t *block) | 570 void ff_fdct_sse2(int16_t *block) |
573 { | 571 { |
574 int64_t align_tmp[16] ATTR_ALIGN(16); | 572 DECLARE_ALIGNED(16, int64_t, align_tmp)[16]; |
575 int16_t * const block1= (int16_t*)align_tmp; | 573 int16_t * const block1= (int16_t*)align_tmp; |
576 | 574 |
577 fdct_col_sse2(block, block1, 0); | 575 fdct_col_sse2(block, block1, 0); |
578 fdct_row_sse2(block1, block); | 576 fdct_row_sse2(block1, block); |
579 } | 577 } |