Commit 6a6c16cb authored by Rong Yan's avatar Rong Yan Committed by Michael Niedermayer

libavutil/ppc/util_altivec.h : fix unaligned_load() vec_unaligned_load() add...

libavutil/ppc/util_altivec.h : fix unaligned_load() vec_unaligned_load() add macros VEC_LD() VEC_MERGEH() VEC_MERGEL() VEC_ST() for POWER LE
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent c11f7317
...@@ -85,8 +85,17 @@ do { \ ...@@ -85,8 +85,17 @@ do { \
} while (0) } while (0)
#if HAVE_BIGENDIAN
#define VEC_LD(offset,b) \
vec_perm(vec_ld(offset, b), vec_ld(offset+15, b), vec_lvsl(offset, b))
#else
#define VEC_LD(offset,b) \
vec_vsx_ld(offset, b)
#endif
/** @brief loads unaligned vector @a *src with offset @a offset /** @brief loads unaligned vector @a *src with offset @a offset
and returns it */ and returns it */
#if HAVE_BIGENDIAN
static inline vector unsigned char unaligned_load(int offset, uint8_t *src) static inline vector unsigned char unaligned_load(int offset, uint8_t *src)
{ {
register vector unsigned char first = vec_ld(offset, src); register vector unsigned char first = vec_ld(offset, src);
...@@ -94,6 +103,10 @@ static inline vector unsigned char unaligned_load(int offset, uint8_t *src) ...@@ -94,6 +103,10 @@ static inline vector unsigned char unaligned_load(int offset, uint8_t *src)
register vector unsigned char mask = vec_lvsl(offset, src); register vector unsigned char mask = vec_lvsl(offset, src);
return vec_perm(first, second, mask); return vec_perm(first, second, mask);
} }
#else
#define unaligned_load(a,b) VEC_LD(a,b)
#endif
/** /**
* loads vector known misalignment * loads vector known misalignment
...@@ -106,8 +119,22 @@ static inline vec_u8 load_with_perm_vec(int offset, uint8_t *src, vec_u8 perm_ve ...@@ -106,8 +119,22 @@ static inline vec_u8 load_with_perm_vec(int offset, uint8_t *src, vec_u8 perm_ve
return vec_perm(a, b, perm_vec); return vec_perm(a, b, perm_vec);
} }
#define vec_unaligned_load(b) \ #define vec_unaligned_load(b) VEC_LD(0, b)
vec_perm(vec_ld(0, b), vec_ld(15, b), vec_lvsl(0, b));
#if HAVE_BIGENDIAN
#define VEC_MERGEH(a, b) vec_mergeh(a, b)
#define VEC_MERGEL(a, b) vec_mergel(a, b)
#else
#define VEC_MERGEH(a, b) vec_mergeh(b, a)
#define VEC_MERGEL(a, b) vec_mergel(b, a)
#endif
#if HAVE_BIGENDIAN
#define VEC_ST(a,b,c) vec_st(a,b,c)
#else
#define VEC_ST(a,b,c) vec_vsx_st(a,b,c)
#endif
#endif /* HAVE_ALTIVEC */ #endif /* HAVE_ALTIVEC */
......
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