[FFmpeg-cvslog] swscale/ppc/swscale_altivec: Simplify macro

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


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Mar 28 05:59:08 2024 +0100| [b49e621c83209a4f3d2c525a4ce33bd87aa02a84] | committer: Andreas Rheinhardt

swscale/ppc/swscale_altivec: Simplify macro

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

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

 libswscale/ppc/swscale_altivec.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/libswscale/ppc/swscale_altivec.c b/libswscale/ppc/swscale_altivec.c
index 8e35e0372f..9bf72738df 100644
--- a/libswscale/ppc/swscale_altivec.c
+++ b/libswscale/ppc/swscale_altivec.c
@@ -109,17 +109,12 @@
 
 #define SHIFT  3
 
-#define output_pixel(pos, val, bias, signedness) \
-    if (big_endian) { \
-        AV_WB16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
-    } else { \
-        AV_WL16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \
-    }
+#define get_pixel(val, bias, signedness) \
+    (bias + av_clip_ ## signedness ## 16(val >> shift))
 
 static void
 yuv2plane1_float_u(const int32_t *src, float *dest, int dstW, int start)
 {
-    static const int big_endian = HAVE_BIGENDIAN;
     static const int shift = 3;
     static const float float_mult = 1.0f / 65535.0f;
     int i, val;
@@ -127,7 +122,7 @@ yuv2plane1_float_u(const int32_t *src, float *dest, int dstW, int start)
 
     for (i = start; i < dstW; ++i){
         val = src[i] + (1 << (shift - 1));
-        output_pixel(&val_uint, val, 0, uint);
+        val_uint = get_pixel(val, 0, uint);
         dest[i] = float_mult * (float)val_uint;
     }
 }
@@ -135,7 +130,6 @@ yuv2plane1_float_u(const int32_t *src, float *dest, int dstW, int start)
 static void
 yuv2plane1_float_bswap_u(const int32_t *src, uint32_t *dest, int dstW, int start)
 {
-    static const int big_endian = HAVE_BIGENDIAN;
     static const int shift = 3;
     static const float float_mult = 1.0f / 65535.0f;
     int i, val;
@@ -143,7 +137,7 @@ yuv2plane1_float_bswap_u(const int32_t *src, uint32_t *dest, int dstW, int start
 
     for (i = start; i < dstW; ++i){
         val = src[i] + (1 << (shift - 1));
-        output_pixel(&val_uint, val, 0, uint);
+        val_uint = get_pixel(val, 0, uint);
         dest[i] = av_bswap32(av_float2int(float_mult * (float)val_uint));
     }
 }



More information about the ffmpeg-cvslog mailing list