[FFmpeg-cvslog] swscale/ppc/swscale_altivec: Fix build with -O0

Andreas Rheinhardt git at videolan.org
Sun Mar 31 02:05:21 EET 2024


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Mar 28 05:54:43 2024 +0100| [72f4f1dafbddb266b53695e4c8b5e2df4927c1ba] | committer: Andreas Rheinhardt

swscale/ppc/swscale_altivec: Fix build with -O0

In this case GCC does not treat a const variable initialized
to the compile-time constant "3" as a compile-time constant
and errors out because the argument is not a literal value.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=72f4f1dafbddb266b53695e4c8b5e2df4927c1ba
---

 libswscale/ppc/swscale_altivec.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libswscale/ppc/swscale_altivec.c b/libswscale/ppc/swscale_altivec.c
index 1630355f51..8e35e0372f 100644
--- a/libswscale/ppc/swscale_altivec.c
+++ b/libswscale/ppc/swscale_altivec.c
@@ -107,6 +107,8 @@
 
 #endif /* HAVE_BIGENDIAN */
 
+#define SHIFT  3
+
 #define output_pixel(pos, val, bias, signedness) \
     if (big_endian) { \
         AV_WB16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
@@ -149,12 +151,11 @@ yuv2plane1_float_bswap_u(const int32_t *src, uint32_t *dest, int dstW, int start
 static void yuv2plane1_float_altivec(const int32_t *src, float *dest, int dstW)
 {
     const int dst_u = -(uintptr_t)dest & 3;
-    const int shift = 3;
-    const int add = (1 << (shift - 1));
+    const int add = (1 << (SHIFT - 1));
     const int clip = (1 << 16) - 1;
     const float fmult = 1.0f / 65535.0f;
     const vec_u32 vadd = (vec_u32) {add, add, add, add};
-    const vec_u32 vshift = (vec_u32) vec_splat_u32(shift);
+    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};
@@ -182,12 +183,11 @@ static void yuv2plane1_float_altivec(const int32_t *src, float *dest, int dstW)
 static void yuv2plane1_float_bswap_altivec(const int32_t *src, uint32_t *dest, int dstW)
 {
     const int dst_u = -(uintptr_t)dest & 3;
-    const int shift = 3;
-    const int add = (1 << (shift - 1));
+    const int add = (1 << (SHIFT - 1));
     const int clip = (1 << 16) - 1;
     const float fmult = 1.0f / 65535.0f;
     const vec_u32 vadd = (vec_u32) {add, add, add, add};
-    const vec_u32 vshift = (vec_u32) vec_splat_u32(shift);
+    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};



More information about the ffmpeg-cvslog mailing list