neon: add INIT_VECTOR3

used to initialize NxMx3 vector types
replaces initialization via '{{ }}' gnu-ism.

Change-Id: Idad2f278ab104cf2cc650517194258ce3cfb37b4
This commit is contained in:
James Zern 2014-06-29 13:40:45 -07:00
parent dc7687e51b
commit 6c1c632b03
3 changed files with 15 additions and 8 deletions

View File

@ -327,12 +327,11 @@ static WEBP_INLINE void Store6x8x2(const uint8x16_t p2, const uint8x16_t p1,
const uint8x16_t q1, const uint8x16_t q2, const uint8x16_t q1, const uint8x16_t q2,
uint8_t* u, uint8_t* v, uint8_t* u, uint8_t* v,
int stride) { int stride) {
const uint8x8x3_t u0 = {{vget_low_u8(p2), vget_low_u8(p1), vget_low_u8(p0)}}; uint8x8x3_t u0, u1, v0, v1;
const uint8x8x3_t u1 = {{vget_low_u8(q0), vget_low_u8(q1), vget_low_u8(q2)}}; INIT_VECTOR3(u0, vget_low_u8(p2), vget_low_u8(p1), vget_low_u8(p0));
const uint8x8x3_t v0 = INIT_VECTOR3(u1, vget_low_u8(q0), vget_low_u8(q1), vget_low_u8(q2));
{{vget_high_u8(p2), vget_high_u8(p1), vget_high_u8(p0)}}; INIT_VECTOR3(v0, vget_high_u8(p2), vget_high_u8(p1), vget_high_u8(p0));
const uint8x8x3_t v1 = INIT_VECTOR3(v1, vget_high_u8(q0), vget_high_u8(q1), vget_high_u8(q2));
{{vget_high_u8(q0), vget_high_u8(q1), vget_high_u8(q2)}};
STORE6_LANE(u, u0, u1, 0); STORE6_LANE(u, u0, u1, 0);
STORE6_LANE(u, u0, u1, 1); STORE6_LANE(u, u0, u1, 1);
STORE6_LANE(u, u0, u1, 2); STORE6_LANE(u, u0, u1, 2);

View File

@ -27,6 +27,12 @@
v.val[1] = b; \ v.val[1] = b; \
} while (0) } while (0)
#define INIT_VECTOR3(v, a, b, c) do { \
v.val[0] = a; \
v.val[1] = b; \
v.val[2] = c; \
} while (0)
// if using intrinsics, this flag avoids some functions that make gcc-4.6.3 // 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."). // crash ("internal compiler error: in immed_double_const, at emit-rtl.").
// (probably similar to gcc.gnu.org/bugzilla/show_bug.cgi?id=48183) // (probably similar to gcc.gnu.org/bugzilla/show_bug.cgi?id=48183)

View File

@ -94,12 +94,14 @@ static const int16_t kCoeffs[4] = { kYScale, kVToR, kUToG, kVToG };
#define v255 vmov_n_u8(255) #define v255 vmov_n_u8(255)
#define STORE_Rgb(out, r, g, b) do { \ #define STORE_Rgb(out, r, g, b) do { \
const uint8x8x3_t r_g_b = {{ r, g, b }}; \ uint8x8x3_t r_g_b; \
INIT_VECTOR3(r_g_b, r, g, b); \
vst3_u8(out, r_g_b); \ vst3_u8(out, r_g_b); \
} while (0) } while (0)
#define STORE_Bgr(out, r, g, b) do { \ #define STORE_Bgr(out, r, g, b) do { \
const uint8x8x3_t b_g_r = {{ b, g, r }}; \ uint8x8x3_t b_g_r; \
INIT_VECTOR3(b_g_r, b, g, r); \
vst3_u8(out, b_g_r); \ vst3_u8(out, b_g_r); \
} while (0) } while (0)