Commit 88bcb6c2 authored by Guillaume Poirier's avatar Guillaume Poirier

use macro Use DECLARE_ALIGNED_16 to align stack-allocated variables

instead of compiler-dependent  __attribute__((aligned(16)))
Origiginal thread:
Date: May 17, 2007 12:30 AM
Subject: [PATCH] Use DECLARE_ALIGNED_16 in libavcodec/ppc/

Originally committed as revision 9047 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 78a010fb
...@@ -56,7 +56,7 @@ static void sigill_handler (int sig) ...@@ -56,7 +56,7 @@ static void sigill_handler (int sig)
int sad16_x2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) int sad16_x2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
{ {
int i; int i;
int s __attribute__((aligned(16))); DECLARE_ALIGNED_16(int, s);
const_vector unsigned char zero = (const_vector unsigned char)vec_splat_u8(0); const_vector unsigned char zero = (const_vector unsigned char)vec_splat_u8(0);
vector unsigned char *tv; vector unsigned char *tv;
vector unsigned char pix1v, pix2v, pix2iv, avgv, t5; vector unsigned char pix1v, pix2v, pix2iv, avgv, t5;
...@@ -103,7 +103,7 @@ int sad16_x2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h ...@@ -103,7 +103,7 @@ int sad16_x2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h
int sad16_y2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) int sad16_y2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
{ {
int i; int i;
int s __attribute__((aligned(16))); DECLARE_ALIGNED_16(int, s);
const_vector unsigned char zero = (const_vector unsigned char)vec_splat_u8(0); const_vector unsigned char zero = (const_vector unsigned char)vec_splat_u8(0);
vector unsigned char *tv; vector unsigned char *tv;
vector unsigned char pix1v, pix2v, pix3v, avgv, t5; vector unsigned char pix1v, pix2v, pix3v, avgv, t5;
...@@ -163,7 +163,7 @@ int sad16_y2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h ...@@ -163,7 +163,7 @@ int sad16_y2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h
int sad16_xy2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) int sad16_xy2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
{ {
int i; int i;
int s __attribute__((aligned(16))); DECLARE_ALIGNED_16(int, s);
uint8_t *pix3 = pix2 + line_size; uint8_t *pix3 = pix2 + line_size;
const_vector unsigned char zero = (const_vector unsigned char)vec_splat_u8(0); const_vector unsigned char zero = (const_vector unsigned char)vec_splat_u8(0);
const_vector unsigned short two = (const_vector unsigned short)vec_splat_u16(2); const_vector unsigned short two = (const_vector unsigned short)vec_splat_u16(2);
...@@ -264,7 +264,7 @@ int sad16_xy2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int ...@@ -264,7 +264,7 @@ int sad16_xy2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int
int sad16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) int sad16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
{ {
int i; int i;
int s __attribute__((aligned(16))); DECLARE_ALIGNED_16(int, s);
const_vector unsigned int zero = (const_vector unsigned int)vec_splat_u32(0); const_vector unsigned int zero = (const_vector unsigned int)vec_splat_u32(0);
vector unsigned char perm1, perm2, *pix1v, *pix2v; vector unsigned char perm1, perm2, *pix1v, *pix2v;
vector unsigned char t1, t2, t3,t4, t5; vector unsigned char t1, t2, t3,t4, t5;
...@@ -306,7 +306,7 @@ int sad16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) ...@@ -306,7 +306,7 @@ int sad16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
int sad8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) int sad8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
{ {
int i; int i;
int s __attribute__((aligned(16))); DECLARE_ALIGNED_16(int, s);;
const_vector unsigned int zero = (const_vector unsigned int)vec_splat_u32(0); const_vector unsigned int zero = (const_vector unsigned int)vec_splat_u32(0);
vector unsigned char perm1, perm2, permclear, *pix1v, *pix2v; vector unsigned char perm1, perm2, permclear, *pix1v, *pix2v;
vector unsigned char t1, t2, t3,t4, t5; vector unsigned char t1, t2, t3,t4, t5;
...@@ -351,7 +351,7 @@ int sad8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) ...@@ -351,7 +351,7 @@ int sad8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
int pix_norm1_altivec(uint8_t *pix, int line_size) int pix_norm1_altivec(uint8_t *pix, int line_size)
{ {
int i; int i;
int s __attribute__((aligned(16))); DECLARE_ALIGNED_16(int, s);
const_vector unsigned int zero = (const_vector unsigned int)vec_splat_u32(0); const_vector unsigned int zero = (const_vector unsigned int)vec_splat_u32(0);
vector unsigned char *tv; vector unsigned char *tv;
vector unsigned char pixv; vector unsigned char pixv;
...@@ -387,7 +387,7 @@ int pix_norm1_altivec(uint8_t *pix, int line_size) ...@@ -387,7 +387,7 @@ int pix_norm1_altivec(uint8_t *pix, int line_size)
int sse8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) int sse8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
{ {
int i; int i;
int s __attribute__((aligned(16))); DECLARE_ALIGNED_16(int, s);
const_vector unsigned int zero = (const_vector unsigned int)vec_splat_u32(0); const_vector unsigned int zero = (const_vector unsigned int)vec_splat_u32(0);
vector unsigned char perm1, perm2, permclear, *pix1v, *pix2v; vector unsigned char perm1, perm2, permclear, *pix1v, *pix2v;
vector unsigned char t1, t2, t3,t4, t5; vector unsigned char t1, t2, t3,t4, t5;
...@@ -443,7 +443,7 @@ int sse8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) ...@@ -443,7 +443,7 @@ int sse8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
int sse16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) int sse16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
{ {
int i; int i;
int s __attribute__((aligned(16))); DECLARE_ALIGNED_16(int, s);
const_vector unsigned int zero = (const_vector unsigned int)vec_splat_u32(0); const_vector unsigned int zero = (const_vector unsigned int)vec_splat_u32(0);
vector unsigned char perm1, perm2, *pix1v, *pix2v; vector unsigned char perm1, perm2, *pix1v, *pix2v;
vector unsigned char t1, t2, t3,t4, t5; vector unsigned char t1, t2, t3,t4, t5;
...@@ -495,7 +495,7 @@ int pix_sum_altivec(uint8_t * pix, int line_size) ...@@ -495,7 +495,7 @@ int pix_sum_altivec(uint8_t * pix, int line_size)
vector signed int sumdiffs; vector signed int sumdiffs;
int i; int i;
int s __attribute__((aligned(16))); DECLARE_ALIGNED_16(int, s);
sad = (vector unsigned int)vec_splat_u32(0); sad = (vector unsigned int)vec_splat_u32(0);
......
...@@ -34,10 +34,10 @@ ...@@ -34,10 +34,10 @@
void gmc1_altivec(uint8_t *dst /* align 8 */, uint8_t *src /* align1 */, int stride, int h, int x16, int y16, int rounder) void gmc1_altivec(uint8_t *dst /* align 8 */, uint8_t *src /* align1 */, int stride, int h, int x16, int y16, int rounder)
{ {
POWERPC_PERF_DECLARE(altivec_gmc1_num, GMC1_PERF_COND); POWERPC_PERF_DECLARE(altivec_gmc1_num, GMC1_PERF_COND);
const unsigned short __attribute__ ((aligned(16))) rounder_a[8] = const DECLARE_ALIGNED_16(unsigned short, rounder_a[8]) =
{rounder, rounder, rounder, rounder, {rounder, rounder, rounder, rounder,
rounder, rounder, rounder, rounder}; rounder, rounder, rounder, rounder};
const unsigned short __attribute__ ((aligned(16))) ABCD[8] = const DECLARE_ALIGNED_16(unsigned short, ABCD[8]) =
{ {
(16-x16)*(16-y16), /* A */ (16-x16)*(16-y16), /* A */
( x16)*(16-y16), /* B */ ( x16)*(16-y16), /* B */
......
...@@ -180,7 +180,7 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## CODETYPE(uint8_t *dst, uint ...@@ -180,7 +180,7 @@ static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## CODETYPE(uint8_t *dst, uint
/* this code assume that stride % 16 == 0 */ /* this code assume that stride % 16 == 0 */
void put_no_rnd_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) { void put_no_rnd_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) {
signed int ABCD[4] __attribute__((aligned(16))) = DECLARE_ALIGNED_16(signed int, ABCD[4]) =
{((8 - x) * (8 - y)), {((8 - x) * (8 - y)),
((x) * (8 - y)), ((x) * (8 - y)),
((8 - x) * (y)), ((8 - x) * (y)),
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/* this code assume that stride % 16 == 0 */ /* this code assume that stride % 16 == 0 */
void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) { void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) {
POWERPC_PERF_DECLARE(PREFIX_h264_chroma_mc8_num, 1); POWERPC_PERF_DECLARE(PREFIX_h264_chroma_mc8_num, 1);
signed int ABCD[4] __attribute__((aligned(16))) = DECLARE_ALIGNED_16(signed int, ABCD[4]) =
{((8 - x) * (8 - y)), {((8 - x) * (8 - y)),
((x) * (8 - y)), ((x) * (8 - y)),
((8 - x) * (y)), ((8 - x) * (y)),
......
...@@ -523,17 +523,17 @@ POWERPC_PERF_START_COUNT(altivec_dct_unquantize_h263_num, 1); ...@@ -523,17 +523,17 @@ POWERPC_PERF_START_COUNT(altivec_dct_unquantize_h263_num, 1);
{ {
register const_vector signed short vczero = (const_vector signed short)vec_splat_s16(0); register const_vector signed short vczero = (const_vector signed short)vec_splat_s16(0);
short __attribute__ ((aligned(16))) qmul8[] = DECLARE_ALIGNED_16(short, qmul8[]) =
{ {
qmul, qmul, qmul, qmul, qmul, qmul, qmul, qmul,
qmul, qmul, qmul, qmul qmul, qmul, qmul, qmul
}; };
short __attribute__ ((aligned(16))) qadd8[] = DECLARE_ALIGNED_16(short, qadd8[]) =
{ {
qadd, qadd, qadd, qadd, qadd, qadd, qadd, qadd,
qadd, qadd, qadd, qadd qadd, qadd, qadd, qadd
}; };
short __attribute__ ((aligned(16))) nqadd8[] = DECLARE_ALIGNED_16(short, nqadd8[]) =
{ {
-qadd, -qadd, -qadd, -qadd, -qadd, -qadd, -qadd, -qadd,
-qadd, -qadd, -qadd, -qadd -qadd, -qadd, -qadd, -qadd
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment