diff options
author | Daniel Kolesa <daniel@octaforge.org> | 2019-08-07 19:39:06 +0200 |
---|---|---|
committer | Lauri Kasanen <cand@gmx.com> | 2019-10-04 08:58:17 +0300 |
commit | 1bdb47b73484dd21ee1bf493d79ac26384eda05e (patch) | |
tree | 197235255d7b34aba7f1a6ce76a33c5c1db03197 /libswscale/ppc/swscale_altivec.c | |
parent | 581419ea39de6619c3389b8d10ac2cbe212c62a0 (diff) |
swscale: Replace illegal vector keyword usage in altivec code
While this technically compiles in current ffmpeg, this is only
because ffmpeg is compiled in strict ISO C mode, which disables
the builtin 'vector' keyword for AltiVec/VSX. Instead this gets
replaced with a macro inside altivec.h, which defines vector to
be actually __vector, which accepts random types.
Normally, the vector keyword should be used only with plain
scalar non-typedef types, such as unsigned int. But we have the
vec_(s|u)(8|16|32) macros, which can be used in a portable manner,
in util_altivec.h in libavutil.
This is also consistent with other AltiVec/VSX code elsewhere in
the tree.
Fixes #7861.
Signed-off-by: Daniel Kolesa <daniel@octaforge.org>
Signed-off-by: Lauri Kasanen <cand@gmx.com>
Diffstat (limited to 'libswscale/ppc/swscale_altivec.c')
-rw-r--r-- | libswscale/ppc/swscale_altivec.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/libswscale/ppc/swscale_altivec.c b/libswscale/ppc/swscale_altivec.c index 6b8cc2c194..1630355f51 100644 --- a/libswscale/ppc/swscale_altivec.c +++ b/libswscale/ppc/swscale_altivec.c @@ -153,13 +153,13 @@ static void yuv2plane1_float_altivec(const int32_t *src, float *dest, int dstW) const int add = (1 << (shift - 1)); const int clip = (1 << 16) - 1; const float fmult = 1.0f / 65535.0f; - const vector uint32_t vadd = (vector uint32_t) {add, add, add, add}; - const vector uint32_t vshift = (vector uint32_t) vec_splat_u32(shift); - const vector uint32_t vlargest = (vector uint32_t) {clip, clip, clip, clip}; - const vector float vmul = (vector float) {fmult, fmult, fmult, fmult}; - const vector float vzero = (vector float) {0, 0, 0, 0}; - vector uint32_t v; - vector float vd; + const vec_u32 vadd = (vec_u32) {add, add, add, add}; + const vec_u32 vshift = (vec_u32) vec_splat_u32(shift); + const vec_u32 vlargest = (vec_u32) {clip, clip, clip, clip}; + const vec_f vmul = (vec_f) {fmult, fmult, fmult, fmult}; + const vec_f vzero = (vec_f) {0, 0, 0, 0}; + vec_u32 v; + vec_f vd; int i; yuv2plane1_float_u(src, dest, dst_u, 0); @@ -186,15 +186,15 @@ static void yuv2plane1_float_bswap_altivec(const int32_t *src, uint32_t *dest, i const int add = (1 << (shift - 1)); const int clip = (1 << 16) - 1; const float fmult = 1.0f / 65535.0f; - const vector uint32_t vadd = (vector uint32_t) {add, add, add, add}; - const vector uint32_t vshift = (vector uint32_t) vec_splat_u32(shift); - const vector uint32_t vlargest = (vector uint32_t) {clip, clip, clip, clip}; - const vector float vmul = (vector float) {fmult, fmult, fmult, fmult}; - const vector float vzero = (vector float) {0, 0, 0, 0}; - const vector uint32_t vswapbig = (vector uint32_t) {16, 16, 16, 16}; - const vector uint16_t vswapsmall = vec_splat_u16(8); - vector uint32_t v; - vector float vd; + const vec_u32 vadd = (vec_u32) {add, add, add, add}; + const vec_u32 vshift = (vec_u32) vec_splat_u32(shift); + const vec_u32 vlargest = (vec_u32) {clip, clip, clip, clip}; + const vec_f vmul = (vec_f) {fmult, fmult, fmult, fmult}; + const vec_f vzero = (vec_f) {0, 0, 0, 0}; + const vec_u32 vswapbig = (vec_u32) {16, 16, 16, 16}; + const vec_u16 vswapsmall = vec_splat_u16(8); + vec_u32 v; + vec_f vd; int i; yuv2plane1_float_bswap_u(src, dest, dst_u, 0); @@ -208,8 +208,8 @@ static void yuv2plane1_float_bswap_altivec(const int32_t *src, uint32_t *dest, i vd = vec_ctf(v, 0); vd = vec_madd(vd, vmul, vzero); - vd = (vector float) vec_rl((vector uint32_t) vd, vswapbig); - vd = (vector float) vec_rl((vector uint16_t) vd, vswapsmall); + vd = (vec_f) vec_rl((vec_u32) vd, vswapbig); + vd = (vec_f) vec_rl((vec_u16) vd, vswapsmall); vec_st(vd, 0, (float *) &dest[i]); } |