From dc7687e51b8821b9cfe5d3b90a004a7872810407 Mon Sep 17 00:00:00 2001 From: James Zern Date: Sun, 29 Jun 2014 13:40:45 -0700 Subject: [PATCH] neon: add INIT_VECTOR2 used to initialize NxMx2 vector types replaces initialization via '{{ }}' gnu-ism. Change-Id: I4accc305c7dd4c886b63c22e38890b629bffb139 --- src/dsp/dec_neon.c | 3 ++- src/dsp/enc_neon.c | 3 ++- src/dsp/neon.h | 5 +++++ src/dsp/upsampling_neon.c | 6 ++++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/dsp/dec_neon.c b/src/dsp/dec_neon.c index 64d2b647..8efe7d0e 100644 --- a/src/dsp/dec_neon.c +++ b/src/dsp/dec_neon.c @@ -1014,7 +1014,8 @@ static WEBP_INLINE void TransformPass(int16x8x2_t* const rows) { } static void TransformOne(const int16_t* in, uint8_t* dst) { - int16x8x2_t rows = {{ vld1q_s16(in + 0), vld1q_s16(in + 8) }}; + int16x8x2_t rows; + INIT_VECTOR2(rows, vld1q_s16(in + 0), vld1q_s16(in + 8)); TransformPass(&rows); TransformPass(&rows); Add4x4(rows.val[0], rows.val[1], dst); diff --git a/src/dsp/enc_neon.c b/src/dsp/enc_neon.c index be7a1178..53e0a6c8 100644 --- a/src/dsp/enc_neon.c +++ b/src/dsp/enc_neon.c @@ -118,7 +118,8 @@ static WEBP_INLINE void TransformPass(int16x8x2_t* const rows) { static void ITransformOne(const uint8_t* ref, const int16_t* in, uint8_t* dst) { - int16x8x2_t rows = {{ vld1q_s16(in + 0), vld1q_s16(in + 8) }}; + int16x8x2_t rows; + INIT_VECTOR2(rows, vld1q_s16(in + 0), vld1q_s16(in + 8)); TransformPass(&rows); TransformPass(&rows); Add4x4(rows.val[0], rows.val[1], ref, dst); diff --git a/src/dsp/neon.h b/src/dsp/neon.h index 9be03639..59b784b8 100644 --- a/src/dsp/neon.h +++ b/src/dsp/neon.h @@ -22,6 +22,11 @@ #define USE_INTRINSICS // use intrinsics when possible #endif +#define INIT_VECTOR2(v, a, b) do { \ + v.val[0] = a; \ + v.val[1] = b; \ +} while (0) + // if using intrinsics, this flag avoids some functions that make gcc-4.6.3 // crash ("internal compiler error: in immed_double_const, at emit-rtl."). // (probably similar to gcc.gnu.org/bugzilla/show_bug.cgi?id=48183) diff --git a/src/dsp/upsampling_neon.c b/src/dsp/upsampling_neon.c index ce27f494..74906a4b 100644 --- a/src/dsp/upsampling_neon.c +++ b/src/dsp/upsampling_neon.c @@ -19,6 +19,7 @@ #include #include #include +#include "./neon.h" #include "./yuv.h" #ifdef FANCY_UPSAMPLING @@ -61,8 +62,9 @@ d = vrhadd_u8(d, diag1); \ \ { \ - const uint8x8x2_t a_b = {{ a, b }}; \ - const uint8x8x2_t c_d = {{ c, d }}; \ + uint8x8x2_t a_b, c_d; \ + INIT_VECTOR2(a_b, a, b); \ + INIT_VECTOR2(c_d, c, d); \ vst2_u8(out, a_b); \ vst2_u8(out + 32, c_d); \ } \