Commit 29c5dba781 for ffmpeg
commit 29c5dba7811338dff4d67d0f6c52ce34e6a476d3
Author: Kacper Michajłow <kasper93@gmail.com>
Date: Mon Oct 26 16:08:23 2026 +0100
swscale/ppc: build the AltiVec and VSX files only when enabled
Without AltiVec and VSX the *_altivec.c and swscale_vsx.c files only
build init functions with empty bodies that are never called. Build
them as ALTIVEC-OBJS and VSX-OBJS and drop their HAVE_ALTIVEC and
HAVE_VSX checks.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
diff --git a/libswscale/ppc/Makefile b/libswscale/ppc/Makefile
index fa786e05a6..87b0e6d707 100644
--- a/libswscale/ppc/Makefile
+++ b/libswscale/ppc/Makefile
@@ -1,7 +1,9 @@
OBJS += ppc/swscale.o \
- ppc/swscale_altivec.o \
ppc/yuv2rgb.o \
- ppc/yuv2rgb_altivec.o \
- ppc/yuv2yuv.o \
- ppc/yuv2yuv_altivec.o \
- ppc/swscale_vsx.o
+ ppc/yuv2yuv.o
+
+ALTIVEC-OBJS += ppc/swscale_altivec.o \
+ ppc/yuv2rgb_altivec.o \
+ ppc/yuv2yuv_altivec.o
+
+VSX-OBJS += ppc/swscale_vsx.o
diff --git a/libswscale/ppc/swscale_altivec.c b/libswscale/ppc/swscale_altivec.c
index 2838641755..0eb155bde0 100644
--- a/libswscale/ppc/swscale_altivec.c
+++ b/libswscale/ppc/swscale_altivec.c
@@ -31,7 +31,6 @@
#include "yuv2rgb_altivec.h"
#include "libavutil/ppc/util_altivec.h"
-#if HAVE_ALTIVEC
#if HAVE_BIGENDIAN
#define vzero vec_splat_s32(0)
@@ -227,11 +226,8 @@ yuv2plane1_float(yuv2plane1_float_altivec, float, LE)
yuv2plane1_float(yuv2plane1_float_bswap_altivec, uint32_t, BE)
#endif
-#endif /* HAVE_ALTIVEC */
-
av_cold void ff_sws_init_swscale_altivec(SwsInternal *c)
{
-#if HAVE_ALTIVEC
enum AVPixelFormat dstFormat = c->opts.dst_format;
#if HAVE_BIGENDIAN
@@ -275,5 +271,4 @@ av_cold void ff_sws_init_swscale_altivec(SwsInternal *c)
break;
}
}
-#endif /* HAVE_ALTIVEC */
}
diff --git a/libswscale/ppc/swscale_vsx.c b/libswscale/ppc/swscale_vsx.c
index e8c797c3fc..35c0032b47 100644
--- a/libswscale/ppc/swscale_vsx.c
+++ b/libswscale/ppc/swscale_vsx.c
@@ -32,7 +32,6 @@
#include "yuv2rgb_altivec.h"
#include "libavutil/ppc/util_altivec.h"
-#if HAVE_VSX
#define vzero vec_splat_s32(0)
#if !HAVE_BIGENDIAN
@@ -2014,11 +2013,8 @@ static void hScale16To15_vsx(SwsInternal *c, int16_t *dst, int dstW,
#endif /* !HAVE_BIGENDIAN */
-#endif /* HAVE_VSX */
-
av_cold void ff_sws_init_swscale_vsx(SwsInternal *c)
{
-#if HAVE_VSX
enum AVPixelFormat dstFormat = c->opts.dst_format;
const int cpu_flags = av_get_cpu_flags();
const unsigned char power8 = HAVE_POWER8 && cpu_flags & AV_CPU_FLAG_POWER8;
@@ -2200,6 +2196,4 @@ av_cold void ff_sws_init_swscale_vsx(SwsInternal *c)
}
}
#endif /* !HAVE_BIGENDIAN */
-
-#endif /* HAVE_VSX */
}
diff --git a/libswscale/ppc/yuv2rgb_altivec.c b/libswscale/ppc/yuv2rgb_altivec.c
index c75f8833a0..6f6294b0fc 100644
--- a/libswscale/ppc/yuv2rgb_altivec.c
+++ b/libswscale/ppc/yuv2rgb_altivec.c
@@ -99,7 +99,6 @@
#include "libavutil/pixdesc.h"
#include "yuv2rgb_altivec.h"
-#if HAVE_ALTIVEC
// util_altivec.h includes the system header altivec.h which redefines bool,
// making it incompatible with stdbool.h. It therefore must not be included
// before another one of our headers that may use bool.
@@ -552,8 +551,6 @@ static int altivec_uyvy_rgb32(SwsInternal *c, const unsigned char *const *in,
return srcSliceH;
}
-#endif /* HAVE_ALTIVEC */
-
/* Ok currently the acceleration routine only supports
* inputs of widths a multiple of 16
* and heights a multiple 2
@@ -562,7 +559,6 @@ static int altivec_uyvy_rgb32(SwsInternal *c, const unsigned char *const *in,
*/
av_cold SwsFunc ff_yuv2rgb_init_altivec(SwsInternal *c)
{
-#if HAVE_ALTIVEC
/*
* and this seems not to matter too much I tried a bunch of
* videos with abnormal widths and MPlayer crashes elsewhere.
@@ -623,7 +619,6 @@ av_cold SwsFunc ff_yuv2rgb_init_altivec(SwsInternal *c)
}
break;
}
-#endif /* HAVE_ALTIVEC */
return NULL;
}
@@ -634,7 +629,6 @@ av_cold void ff_yuv2rgb_init_tables_altivec(SwsInternal *c,
int contrast,
int saturation)
{
-#if HAVE_ALTIVEC
SwsInternalAltivec *const a = sws_internal_altivec(c);
union {
@@ -657,11 +651,8 @@ av_cold void ff_yuv2rgb_init_tables_altivec(SwsInternal *c,
a->CGU = vec_splat((vector signed short) buf.vec, 4);
a->CGV = vec_splat((vector signed short) buf.vec, 5);
return;
-#endif /* HAVE_ALTIVEC */
}
-#if HAVE_ALTIVEC
-
static av_always_inline void yuv2packedX_altivec(SwsInternal *c,
const int16_t *lumFilter,
const int16_t **lumSrc,
@@ -893,4 +884,3 @@ YUV2PACKEDX_WRAPPER(argb, AV_PIX_FMT_ARGB);
YUV2PACKEDX_WRAPPER(rgba, AV_PIX_FMT_RGBA);
YUV2PACKEDX_WRAPPER(rgb24, AV_PIX_FMT_RGB24);
YUV2PACKEDX_WRAPPER(bgr24, AV_PIX_FMT_BGR24);
-#endif /* HAVE_ALTIVEC */
diff --git a/libswscale/ppc/yuv2yuv_altivec.c b/libswscale/ppc/yuv2yuv_altivec.c
index 6fa94f5add..b8e17e3fbd 100644
--- a/libswscale/ppc/yuv2yuv_altivec.c
+++ b/libswscale/ppc/yuv2yuv_altivec.c
@@ -28,7 +28,6 @@
#include "libswscale/swscale.h"
#include "libswscale/swscale_internal.h"
-#if HAVE_ALTIVEC
#include "libavutil/ppc/util_altivec.h"
static int yv12toyuy2_unscaled_altivec(SwsInternal *c, const uint8_t *const src[],
@@ -182,11 +181,8 @@ static int yv12touyvy_unscaled_altivec(SwsInternal *c, const uint8_t *const src[
return srcSliceH;
}
-#endif /* HAVE_ALTIVEC */
-
av_cold void ff_get_unscaled_swscale_altivec(SwsInternal *c)
{
-#if HAVE_ALTIVEC
if (!(c->opts.src_w & 15) && !(c->opts.flags & SWS_BITEXACT) &&
c->opts.src_format == AV_PIX_FMT_YUV420P) {
enum AVPixelFormat dstFormat = c->opts.dst_format;
@@ -197,5 +193,4 @@ av_cold void ff_get_unscaled_swscale_altivec(SwsInternal *c)
else if (dstFormat == AV_PIX_FMT_UYVY422)
c->convert_unscaled = yv12touyvy_unscaled_altivec;
}
-#endif /* HAVE_ALTIVEC */
}