[x264-devel] ppc: Fix hadamard for little-endian

Luca Barbato git at videolan.org
Thu Dec 1 21:01:43 CET 2016


x264 | branch: master | Luca Barbato <lu_zero at gentoo.org> | Tue Nov  1 23:16:18 2016 +0100| [1eab3b402e1d7729da295024fa7eec8b09e30c20] | committer: Henrik Gramner

ppc: Fix hadamard for little-endian

Extending to 16-bit works with flipped bytes.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=1eab3b402e1d7729da295024fa7eec8b09e30c20
---

 common/ppc/pixel.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/common/ppc/pixel.c b/common/ppc/pixel.c
index 5ace725..baebb53 100644
--- a/common/ppc/pixel.c
+++ b/common/ppc/pixel.c
@@ -1812,9 +1812,15 @@ static int pixel_sa8d_16x16_altivec( uint8_t *pix1, intptr_t i_pix1,
     d3 = vec_sub(t1, t3);                           \
 }
 
+#ifdef WORDS_BIGENDIAN
+#define vec_perm_extend_s16(val, perm) (vec_s16_t)vec_perm(val, zero_u8v, perm)
+#else
+#define vec_perm_extend_s16(val, perm) (vec_s16_t)vec_perm(zero_u8v, val, perm)
+#endif
+
 #define VEC_LOAD_HIGH( p, num )                                    \
     vec_u8_t pix8_##num = vec_ld( stride*num, p );                 \
-    vec_s16_t pix16_s##num = (vec_s16_t)vec_perm(pix8_##num, zero_u8v, perm); \
+    vec_s16_t pix16_s##num = vec_perm_extend_s16( pix8_##num, perm ); \
     vec_s16_t pix16_d##num;
 
 static uint64_t pixel_hadamard_ac_altivec( uint8_t *pix, intptr_t stride, const vec_u8_t perm )



More information about the x264-devel mailing list