This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit fa32b71a249a090be759d917ea130c56a3bc6a9a Author: Kacper Michajłow <[email protected]> AuthorDate: Mon Oct 26 16:07:20 2026 +0100 Commit: Kacper Michajłow <[email protected]> CommitDate: Mon Nov 2 07:24:04 2026 +0000 avcodec/ppc: move the VSX code to *_vsx.c The VSX functions of audiodsp and pixblockdsp are in the AltiVec files, which without VSX build ff_audiodsp_init_vsx() and ff_pixblockdsp_init_vsx() with empty bodies that are never called. Move the VSX functions and their init functions to *_vsx.c files built as VSX-OBJS, like libavutil/ppc/float_dsp_vsx.c. Signed-off-by: Kacper Michajłow <[email protected]> --- libavcodec/ppc/Makefile | 5 ++ libavcodec/ppc/audiodsp_altivec.c | 32 ---------- libavcodec/ppc/audiodsp_altivec.h | 1 - libavcodec/ppc/audiodsp_init.c | 1 + .../ppc/{audiodsp_altivec.c => audiodsp_vsx.c} | 40 +----------- .../{arm/audiodsp_arm.h => ppc/audiodsp_vsx.h} | 8 +-- libavcodec/ppc/pixblockdsp_altivec.c | 45 -------------- libavcodec/ppc/pixblockdsp_altivec.h | 2 - libavcodec/ppc/pixblockdsp_init.c | 1 + libavcodec/ppc/pixblockdsp_vsx.c | 71 ++++++++++++++++++++++ .../{pixblockdsp_altivec.h => pixblockdsp_vsx.h} | 8 +-- 11 files changed, 86 insertions(+), 128 deletions(-) diff --git a/libavcodec/ppc/Makefile b/libavcodec/ppc/Makefile index ce2c2a4c8a..cb37f29f69 100644 --- a/libavcodec/ppc/Makefile +++ b/libavcodec/ppc/Makefile @@ -51,3 +51,8 @@ ALTIVEC-OBJS-$(CONFIG_MPEG4_DECODER) += ppc/mpeg4videodsp_altivec.o ALTIVEC-OBJS-$(CONFIG_SVQ1_ENCODER) += ppc/svq1enc_altivec.o ALTIVEC-OBJS-$(CONFIG_VORBIS_DECODER) += ppc/vorbisdsp_altivec.o ALTIVEC-OBJS-$(CONFIG_VP7_DECODER) += ppc/vp8dsp_altivec.o + +# VSX optimizations +# subsystems +VSX-OBJS-$(CONFIG_AUDIODSP) += ppc/audiodsp_vsx.o +VSX-OBJS-$(CONFIG_PIXBLOCKDSP) += ppc/pixblockdsp_vsx.o diff --git a/libavcodec/ppc/audiodsp_altivec.c b/libavcodec/ppc/audiodsp_altivec.c index 45c537af63..c6878bb973 100644 --- a/libavcodec/ppc/audiodsp_altivec.c +++ b/libavcodec/ppc/audiodsp_altivec.c @@ -54,39 +54,7 @@ static int32_t scalarproduct_int16_altivec(const int16_t *v1, const int16_t *v2, return ires; } -#if HAVE_VSX - -static int32_t scalarproduct_int16_vsx(const int16_t *v1, const int16_t *v2, int order) -{ - int i; - LOAD_ZERO; - register vec_s16 vec1; - register vec_s32 res = vec_splat_s32(0), t; - int32_t ires; - - for (i = 0; i < order; i += 8) { - vec1 = vec_vsx_ld(0, v1); - t = vec_msum(vec1, vec_ld(0, v2), zero_s32v); - res = vec_sums(t, res); - v1 += 8; - v2 += 8; - } - res = vec_splat(res, 3); - vec_ste(res, 0, &ires); - - return ires; -} - -#endif /* HAVE_VSX */ - av_cold void ff_audiodsp_init_altivec(AudioDSPContext *c) { c->scalarproduct_int16 = scalarproduct_int16_altivec; } - -av_cold void ff_audiodsp_init_vsx(AudioDSPContext *c) -{ -#if HAVE_VSX - c->scalarproduct_int16 = scalarproduct_int16_vsx; -#endif /* HAVE_VSX */ -} diff --git a/libavcodec/ppc/audiodsp_altivec.h b/libavcodec/ppc/audiodsp_altivec.h index e97c50142a..3613459b35 100644 --- a/libavcodec/ppc/audiodsp_altivec.h +++ b/libavcodec/ppc/audiodsp_altivec.h @@ -22,6 +22,5 @@ #include "libavcodec/audiodsp.h" void ff_audiodsp_init_altivec(AudioDSPContext *c); -void ff_audiodsp_init_vsx(AudioDSPContext *c); #endif /* AVCODEC_PPC_AUDIODSP_ALTIVEC_H */ diff --git a/libavcodec/ppc/audiodsp_init.c b/libavcodec/ppc/audiodsp_init.c index 5de463128a..b2df5bb447 100644 --- a/libavcodec/ppc/audiodsp_init.c +++ b/libavcodec/ppc/audiodsp_init.c @@ -23,6 +23,7 @@ #include "libavcodec/audiodsp.h" #include "audiodsp_altivec.h" +#include "audiodsp_vsx.h" av_cold void ff_audiodsp_init_ppc(AudioDSPContext *c) { diff --git a/libavcodec/ppc/audiodsp_altivec.c b/libavcodec/ppc/audiodsp_vsx.c similarity index 65% copy from libavcodec/ppc/audiodsp_altivec.c copy to libavcodec/ppc/audiodsp_vsx.c index 45c537af63..e6972dc610 100644 --- a/libavcodec/ppc/audiodsp_altivec.c +++ b/libavcodec/ppc/audiodsp_vsx.c @@ -18,11 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -/** - * @file - * miscellaneous audio operations - */ - #include "config.h" #include "libavutil/attributes.h" @@ -30,31 +25,7 @@ #include "libavcodec/audiodsp.h" -#include "audiodsp_altivec.h" - -static int32_t scalarproduct_int16_altivec(const int16_t *v1, const int16_t *v2, - int order) -{ - int i; - LOAD_ZERO; - register vec_s16 vec1; - register vec_s32 res = vec_splat_s32(0), t; - int32_t ires; - - for (i = 0; i < order; i += 8) { - vec1 = vec_unaligned_load(v1); - t = vec_msum(vec1, vec_ld(0, v2), zero_s32v); - res = vec_sums(t, res); - v1 += 8; - v2 += 8; - } - res = vec_splat(res, 3); - vec_ste(res, 0, &ires); - - return ires; -} - -#if HAVE_VSX +#include "audiodsp_vsx.h" static int32_t scalarproduct_int16_vsx(const int16_t *v1, const int16_t *v2, int order) { @@ -77,16 +48,7 @@ static int32_t scalarproduct_int16_vsx(const int16_t *v1, const int16_t *v2, int return ires; } -#endif /* HAVE_VSX */ - -av_cold void ff_audiodsp_init_altivec(AudioDSPContext *c) -{ - c->scalarproduct_int16 = scalarproduct_int16_altivec; -} - av_cold void ff_audiodsp_init_vsx(AudioDSPContext *c) { -#if HAVE_VSX c->scalarproduct_int16 = scalarproduct_int16_vsx; -#endif /* HAVE_VSX */ } diff --git a/libavcodec/arm/audiodsp_arm.h b/libavcodec/ppc/audiodsp_vsx.h similarity index 83% copy from libavcodec/arm/audiodsp_arm.h copy to libavcodec/ppc/audiodsp_vsx.h index 213660dae7..cee6c359af 100644 --- a/libavcodec/arm/audiodsp_arm.h +++ b/libavcodec/ppc/audiodsp_vsx.h @@ -16,11 +16,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCODEC_ARM_AUDIODSP_ARM_H -#define AVCODEC_ARM_AUDIODSP_ARM_H +#ifndef AVCODEC_PPC_AUDIODSP_VSX_H +#define AVCODEC_PPC_AUDIODSP_VSX_H #include "libavcodec/audiodsp.h" -void ff_audiodsp_init_neon(AudioDSPContext *c); +void ff_audiodsp_init_vsx(AudioDSPContext *c); -#endif /* AVCODEC_ARM_AUDIODSP_ARM_H */ +#endif /* AVCODEC_PPC_AUDIODSP_VSX_H */ diff --git a/libavcodec/ppc/pixblockdsp_altivec.c b/libavcodec/ppc/pixblockdsp_altivec.c index d78a5d45aa..893220e8af 100644 --- a/libavcodec/ppc/pixblockdsp_altivec.c +++ b/libavcodec/ppc/pixblockdsp_altivec.c @@ -223,40 +223,6 @@ static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1, #endif /* HAVE_VSX */ -#if HAVE_VSX -static void get_pixels_vsx(int16_t *restrict block, const uint8_t *pixels, - ptrdiff_t stride) -{ - int i; - for (i = 0; i < 8; i++) { - vec_s16 shorts = vsx_ld_u8_s16(0, pixels); - - vec_vsx_st(shorts, i * 16, block); - - pixels += stride; - } -} - -static void diff_pixels_vsx(int16_t *restrict block, const uint8_t *s1, - const uint8_t *s2, ptrdiff_t stride) -{ - int i; - vec_s16 shorts1, shorts2; - for (i = 0; i < 8; i++) { - shorts1 = vsx_ld_u8_s16(0, s1); - shorts2 = vsx_ld_u8_s16(0, s2); - - shorts1 = vec_sub(shorts1, shorts2); - - vec_vsx_st(shorts1, 0, block); - - s1 += stride; - s2 += stride; - block += 8; - } -} -#endif /* HAVE_VSX */ - av_cold void ff_pixblockdsp_init_altivec(PixblockDSPContext *c, unsigned high_bit_depth) { @@ -266,14 +232,3 @@ av_cold void ff_pixblockdsp_init_altivec(PixblockDSPContext *c, c->get_pixels = get_pixels_altivec; } } - -av_cold void ff_pixblockdsp_init_vsx(PixblockDSPContext *c, - unsigned high_bit_depth) -{ -#if HAVE_VSX - c->diff_pixels = diff_pixels_vsx; - - if (!high_bit_depth) - c->get_pixels = get_pixels_vsx; -#endif /* HAVE_VSX */ -} diff --git a/libavcodec/ppc/pixblockdsp_altivec.h b/libavcodec/ppc/pixblockdsp_altivec.h index 5717ab6a08..4df5101a22 100644 --- a/libavcodec/ppc/pixblockdsp_altivec.h +++ b/libavcodec/ppc/pixblockdsp_altivec.h @@ -23,7 +23,5 @@ void ff_pixblockdsp_init_altivec(PixblockDSPContext *c, unsigned high_bit_depth); -void ff_pixblockdsp_init_vsx(PixblockDSPContext *c, - unsigned high_bit_depth); #endif /* AVCODEC_PPC_PIXBLOCKDSP_ALTIVEC_H */ diff --git a/libavcodec/ppc/pixblockdsp_init.c b/libavcodec/ppc/pixblockdsp_init.c index c87c96dd1a..8027ab1269 100644 --- a/libavcodec/ppc/pixblockdsp_init.c +++ b/libavcodec/ppc/pixblockdsp_init.c @@ -23,6 +23,7 @@ #include "libavcodec/pixblockdsp.h" #include "pixblockdsp_altivec.h" +#include "pixblockdsp_vsx.h" av_cold void ff_pixblockdsp_init_ppc(PixblockDSPContext *c, unsigned high_bit_depth) diff --git a/libavcodec/ppc/pixblockdsp_vsx.c b/libavcodec/ppc/pixblockdsp_vsx.c new file mode 100644 index 0000000000..fd3c112d09 --- /dev/null +++ b/libavcodec/ppc/pixblockdsp_vsx.c @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2002 Brian Foley + * Copyright (c) 2002 Dieter Shirley + * Copyright (c) 2003-2004 Romain Dolbeau <[email protected]> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "libavutil/attributes.h" +#include "libavutil/ppc/util_altivec.h" + +#include "libavcodec/pixblockdsp.h" + +#include "pixblockdsp_vsx.h" + +static void get_pixels_vsx(int16_t *restrict block, const uint8_t *pixels, + ptrdiff_t stride) +{ + int i; + for (i = 0; i < 8; i++) { + vec_s16 shorts = vsx_ld_u8_s16(0, pixels); + + vec_vsx_st(shorts, i * 16, block); + + pixels += stride; + } +} + +static void diff_pixels_vsx(int16_t *restrict block, const uint8_t *s1, + const uint8_t *s2, ptrdiff_t stride) +{ + int i; + vec_s16 shorts1, shorts2; + for (i = 0; i < 8; i++) { + shorts1 = vsx_ld_u8_s16(0, s1); + shorts2 = vsx_ld_u8_s16(0, s2); + + shorts1 = vec_sub(shorts1, shorts2); + + vec_vsx_st(shorts1, 0, block); + + s1 += stride; + s2 += stride; + block += 8; + } +} + +av_cold void ff_pixblockdsp_init_vsx(PixblockDSPContext *c, + unsigned high_bit_depth) +{ + c->diff_pixels = diff_pixels_vsx; + + if (!high_bit_depth) + c->get_pixels = get_pixels_vsx; +} diff --git a/libavcodec/ppc/pixblockdsp_altivec.h b/libavcodec/ppc/pixblockdsp_vsx.h similarity index 78% copy from libavcodec/ppc/pixblockdsp_altivec.h copy to libavcodec/ppc/pixblockdsp_vsx.h index 5717ab6a08..60d38fd747 100644 --- a/libavcodec/ppc/pixblockdsp_altivec.h +++ b/libavcodec/ppc/pixblockdsp_vsx.h @@ -16,14 +16,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVCODEC_PPC_PIXBLOCKDSP_ALTIVEC_H -#define AVCODEC_PPC_PIXBLOCKDSP_ALTIVEC_H +#ifndef AVCODEC_PPC_PIXBLOCKDSP_VSX_H +#define AVCODEC_PPC_PIXBLOCKDSP_VSX_H #include "libavcodec/pixblockdsp.h" -void ff_pixblockdsp_init_altivec(PixblockDSPContext *c, - unsigned high_bit_depth); void ff_pixblockdsp_init_vsx(PixblockDSPContext *c, unsigned high_bit_depth); -#endif /* AVCODEC_PPC_PIXBLOCKDSP_ALTIVEC_H */ +#endif /* AVCODEC_PPC_PIXBLOCKDSP_VSX_H */ -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
