diff --git a/libavcodec/fft.c b/libavcodec/fft.c index 00c434a905..0768f23045 100644 --- a/libavcodec/fft.c +++ b/libavcodec/fft.c @@ -159,7 +159,7 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) #if CONFIG_FFT_FLOAT if (ARCH_ARM) ff_fft_init_arm(s); - if (HAVE_ALTIVEC) ff_fft_init_altivec(s); + if (ARCH_PPC) ff_fft_init_ppc(s); if (ARCH_X86) ff_fft_init_x86(s); if (CONFIG_MDCT) s->mdct_calcw = s->mdct_calc; if (HAVE_MIPSFPU) ff_fft_init_mips(s); diff --git a/libavcodec/fft.h b/libavcodec/fft.h index fc17d66ac0..910e143f5a 100644 --- a/libavcodec/fft.h +++ b/libavcodec/fft.h @@ -133,10 +133,10 @@ void ff_init_ff_cos_tabs(int index); */ int ff_fft_init(FFTContext *s, int nbits, int inverse); -void ff_fft_init_altivec(FFTContext *s); void ff_fft_init_x86(FFTContext *s); void ff_fft_init_arm(FFTContext *s); void ff_fft_init_mips(FFTContext *s); +void ff_fft_init_ppc(FFTContext *s); void ff_fft_fixed_init_arm(FFTContext *s); diff --git a/libavcodec/fmtconvert.c b/libavcodec/fmtconvert.c index 79e9645837..632c11d90e 100644 --- a/libavcodec/fmtconvert.c +++ b/libavcodec/fmtconvert.c @@ -84,7 +84,7 @@ av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx) c->float_interleave = ff_float_interleave_c; if (ARCH_ARM) ff_fmt_convert_init_arm(c, avctx); - if (HAVE_ALTIVEC) ff_fmt_convert_init_altivec(c, avctx); + if (ARCH_PPC) ff_fmt_convert_init_ppc(c, avctx); if (ARCH_X86) ff_fmt_convert_init_x86(c, avctx); if (HAVE_MIPSFPU) ff_fmt_convert_init_mips(c); } diff --git a/libavcodec/fmtconvert.h b/libavcodec/fmtconvert.h index 3fb9f4e46b..473a5868b9 100644 --- a/libavcodec/fmtconvert.h +++ b/libavcodec/fmtconvert.h @@ -90,7 +90,7 @@ void ff_float_interleave_c(float *dst, const float **src, unsigned int len, void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx); void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx); -void ff_fmt_convert_init_altivec(FmtConvertContext *c, AVCodecContext *avctx); +void ff_fmt_convert_init_ppc(FmtConvertContext *c, AVCodecContext *avctx); void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx); void ff_fmt_convert_init_mips(FmtConvertContext *c); diff --git a/libavcodec/h264dsp.c b/libavcodec/h264dsp.c index da9e417e8e..0082549d2d 100644 --- a/libavcodec/h264dsp.c +++ b/libavcodec/h264dsp.c @@ -148,6 +148,6 @@ void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, const int chroma_fo } if (ARCH_ARM) ff_h264dsp_init_arm(c, bit_depth, chroma_format_idc); - if (HAVE_ALTIVEC) ff_h264dsp_init_ppc(c, bit_depth, chroma_format_idc); + if (ARCH_PPC) ff_h264dsp_init_ppc(c, bit_depth, chroma_format_idc); if (ARCH_X86) ff_h264dsp_init_x86(c, bit_depth, chroma_format_idc); } diff --git a/libavcodec/mpegaudiodsp.c b/libavcodec/mpegaudiodsp.c index aadc747814..a3e6dd734b 100644 --- a/libavcodec/mpegaudiodsp.c +++ b/libavcodec/mpegaudiodsp.c @@ -41,8 +41,8 @@ void ff_mpadsp_init(MPADSPContext *s) s->imdct36_blocks_fixed = ff_imdct36_blocks_fixed; if (ARCH_ARM) ff_mpadsp_init_arm(s); + if (ARCH_PPC) ff_mpadsp_init_ppc(s); if (ARCH_X86) ff_mpadsp_init_x86(s); - if (HAVE_ALTIVEC) ff_mpadsp_init_altivec(s); if (HAVE_MIPSFPU) ff_mpadsp_init_mipsfpu(s); if (HAVE_MIPSDSPR1) ff_mpadsp_init_mipsdspr1(s); } diff --git a/libavcodec/mpegaudiodsp.h b/libavcodec/mpegaudiodsp.h index 623d2dfffb..8153cb18dc 100644 --- a/libavcodec/mpegaudiodsp.h +++ b/libavcodec/mpegaudiodsp.h @@ -56,8 +56,8 @@ void ff_mpa_synth_filter_float(MPADSPContext *s, float *sb_samples); void ff_mpadsp_init_arm(MPADSPContext *s); +void ff_mpadsp_init_ppc(MPADSPContext *s); void ff_mpadsp_init_x86(MPADSPContext *s); -void ff_mpadsp_init_altivec(MPADSPContext *s); void ff_mpadsp_init_mipsfpu(MPADSPContext *s); void ff_mpadsp_init_mipsdspr1(MPADSPContext *s); diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 69b10bb164..3f5af5cf53 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -179,10 +179,10 @@ av_cold int ff_dct_common_init(MpegEncContext *s) ff_MPV_common_init_axp(s); #elif ARCH_ARM ff_MPV_common_init_arm(s); -#elif HAVE_ALTIVEC - ff_MPV_common_init_altivec(s); #elif ARCH_BFIN ff_MPV_common_init_bfin(s); +#elif ARCH_PPC + ff_MPV_common_init_ppc(s); #endif /* load & permutate scantables diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 4fd01ae75e..9ede0961a8 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -804,8 +804,8 @@ void ff_dct_encode_init_x86(MpegEncContext *s); void ff_MPV_common_init_x86(MpegEncContext *s); void ff_MPV_common_init_axp(MpegEncContext *s); void ff_MPV_common_init_arm(MpegEncContext *s); -void ff_MPV_common_init_altivec(MpegEncContext *s); void ff_MPV_common_init_bfin(MpegEncContext *s); +void ff_MPV_common_init_ppc(MpegEncContext *s); void ff_clean_intra_table_entries(MpegEncContext *s); void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, Picture *last, int y, int h, int picture_structure, diff --git a/libavcodec/ppc/Makefile b/libavcodec/ppc/Makefile index a7e1c87456..c22a2bc1d3 100644 --- a/libavcodec/ppc/Makefile +++ b/libavcodec/ppc/Makefile @@ -1,24 +1,23 @@ OBJS += ppc/dsputil_ppc.o \ + ppc/fmtconvert_altivec.o \ ppc/videodsp_ppc.o \ +FFT-OBJS-$(HAVE_GNU_AS) += ppc/fft_altivec_s.o +OBJS-$(CONFIG_FFT) += ppc/fft_altivec.o \ + $(FFT-OBJS-yes) OBJS-$(CONFIG_H264CHROMA) += ppc/h264chroma_init.o +OBJS-$(CONFIG_H264DSP) += ppc/h264dsp.o OBJS-$(CONFIG_H264QPEL) += ppc/h264qpel.o OBJS-$(CONFIG_HPELDSP) += ppc/hpeldsp_altivec.o +OBJS-$(CONFIG_MPEGAUDIODSP) += ppc/mpegaudiodsp_altivec.o +OBJS-$(CONFIG_MPEGVIDEO) += ppc/mpegvideo_altivec.o +OBJS-$(CONFIG_VC1_DECODER) += ppc/vc1dsp_altivec.o OBJS-$(CONFIG_VORBIS_DECODER) += ppc/vorbisdsp_altivec.o OBJS-$(CONFIG_VP3DSP) += ppc/vp3dsp_altivec.o - -FFT-OBJS-$(HAVE_GNU_AS) += ppc/fft_altivec_s.o -ALTIVEC-OBJS-$(CONFIG_FFT) += ppc/fft_altivec.o \ - $(FFT-OBJS-yes) -ALTIVEC-OBJS-$(CONFIG_H264DSP) += ppc/h264dsp.o -ALTIVEC-OBJS-$(CONFIG_MPEGAUDIODSP) += ppc/mpegaudiodsp_altivec.o -ALTIVEC-OBJS-$(CONFIG_MPEGVIDEO) += ppc/mpegvideo_altivec.o -ALTIVEC-OBJS-$(CONFIG_VC1_DECODER) += ppc/vc1dsp_altivec.o -ALTIVEC-OBJS-$(CONFIG_VP8_DECODER) += ppc/vp8dsp_altivec.o +OBJS-$(CONFIG_VP8_DECODER) += ppc/vp8dsp_altivec.o ALTIVEC-OBJS += ppc/dsputil_altivec.o \ ppc/fdct_altivec.o \ - ppc/fmtconvert_altivec.o \ ppc/gmc_altivec.o \ ppc/idct_altivec.o \ ppc/int_altivec.o \ diff --git a/libavcodec/ppc/fft_altivec.c b/libavcodec/ppc/fft_altivec.c index 651ee2680f..657d4f844b 100644 --- a/libavcodec/ppc/fft_altivec.c +++ b/libavcodec/ppc/fft_altivec.c @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "config.h" #include "libavutil/ppc/types_altivec.h" #include "libavutil/ppc/util_altivec.h" #include "libavcodec/fft.h" @@ -36,7 +37,7 @@ void ff_fft_calc_altivec(FFTContext *s, FFTComplex *z); void ff_fft_calc_interleave_altivec(FFTContext *s, FFTComplex *z); -#if HAVE_GNU_AS +#if HAVE_GNU_AS && HAVE_ALTIVEC static void ff_imdct_half_altivec(FFTContext *s, FFTSample *output, const FFTSample *input) { int j, k; @@ -136,15 +137,15 @@ static void ff_imdct_calc_altivec(FFTContext *s, FFTSample *output, const FFTSam p1[k] = vec_perm(b, b, vcprm(3,2,1,0)); } } -#endif /* HAVE_GNU_AS */ +#endif /* HAVE_GNU_AS && HAVE_ALTIVEC */ -av_cold void ff_fft_init_altivec(FFTContext *s) +av_cold void ff_fft_init_ppc(FFTContext *s) { -#if HAVE_GNU_AS +#if HAVE_GNU_AS && HAVE_ALTIVEC s->fft_calc = ff_fft_calc_interleave_altivec; if (s->mdct_bits >= 5) { s->imdct_calc = ff_imdct_calc_altivec; s->imdct_half = ff_imdct_half_altivec; } -#endif +#endif /* HAVE_GNU_AS && HAVE_ALTIVEC */ } diff --git a/libavcodec/ppc/fmtconvert_altivec.c b/libavcodec/ppc/fmtconvert_altivec.c index b29c7d4d39..bf8ead450f 100644 --- a/libavcodec/ppc/fmtconvert_altivec.c +++ b/libavcodec/ppc/fmtconvert_altivec.c @@ -18,13 +18,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavcodec/fmtconvert.h" - -#include "libavutil/ppc/util_altivec.h" +#include "config.h" #include "libavutil/attributes.h" #include "libavutil/mem.h" +#include "libavutil/ppc/util_altivec.h" +#include "libavcodec/fmtconvert.h" #include "dsputil_altivec.h" +#if HAVE_ALTIVEC + static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src, float mul, int len) { @@ -156,11 +158,16 @@ static void float_to_int16_interleave_altivec(int16_t *dst, const float **src, } } -av_cold void ff_fmt_convert_init_altivec(FmtConvertContext *c, AVCodecContext *avctx) +#endif /* HAVE_ALTIVEC */ + +av_cold void ff_fmt_convert_init_ppc(FmtConvertContext *c, + AVCodecContext *avctx) { +#if HAVE_ALTIVEC c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_altivec; if (!(avctx->flags & CODEC_FLAG_BITEXACT)) { c->float_to_int16 = float_to_int16_altivec; c->float_to_int16_interleave = float_to_int16_interleave_altivec; } +#endif /* HAVE_ALTIVEC */ } diff --git a/libavcodec/ppc/h264dsp.c b/libavcodec/ppc/h264dsp.c index 3c2bb4d630..a675bcda3e 100644 --- a/libavcodec/ppc/h264dsp.c +++ b/libavcodec/ppc/h264dsp.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "config.h" #include "libavutil/attributes.h" #include "libavutil/cpu.h" #include "libavutil/intreadwrite.h" @@ -26,6 +27,8 @@ #include "libavcodec/h264data.h" #include "libavcodec/h264dsp.h" +#if HAVE_ALTIVEC + /**************************************************************************** * IDCT transform: ****************************************************************************/ @@ -721,10 +724,12 @@ static void ff_biweight_h264_pixels ## W ## _altivec(uint8_t *dst, uint8_t *src, H264_WEIGHT(16) H264_WEIGHT( 8) +#endif /* HAVE_ALTIVEC */ av_cold void ff_h264dsp_init_ppc(H264DSPContext *c, const int bit_depth, const int chroma_format_idc) { +#if HAVE_ALTIVEC if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) { if (bit_depth == 8) { c->h264_idct_add = ff_h264_idct_add_altivec; @@ -745,4 +750,5 @@ av_cold void ff_h264dsp_init_ppc(H264DSPContext *c, const int bit_depth, c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels8_altivec; } } +#endif /* HAVE_ALTIVEC */ } diff --git a/libavcodec/ppc/mpegaudiodsp_altivec.c b/libavcodec/ppc/mpegaudiodsp_altivec.c index 1152fd77ac..1d82f74828 100644 --- a/libavcodec/ppc/mpegaudiodsp_altivec.c +++ b/libavcodec/ppc/mpegaudiodsp_altivec.c @@ -19,11 +19,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "dsputil_altivec.h" +#include "config.h" #include "libavutil/attributes.h" #include "libavutil/internal.h" #include "libavutil/ppc/util_altivec.h" #include "libavcodec/mpegaudiodsp.h" +#include "dsputil_altivec.h" + +#if HAVE_ALTIVEC #define MACS(rt, ra, rb) rt+=(ra)*(rb) #define MLSS(rt, ra, rb) rt-=(ra)*(rb) @@ -124,7 +127,11 @@ static void apply_window_mp3(float *in, float *win, int *unused, float *out, *out = sum; } -av_cold void ff_mpadsp_init_altivec(MPADSPContext *s) +#endif /* HAVE_ALTIVEC */ + +av_cold void ff_mpadsp_init_ppc(MPADSPContext *s) { +#if HAVE_ALTIVEC s->apply_window_float = apply_window_mp3; +#endif /* HAVE_ALTIVEC */ } diff --git a/libavcodec/ppc/mpegvideo_altivec.c b/libavcodec/ppc/mpegvideo_altivec.c index bf490b04ea..4e80e3afb5 100644 --- a/libavcodec/ppc/mpegvideo_altivec.c +++ b/libavcodec/ppc/mpegvideo_altivec.c @@ -24,14 +24,16 @@ #include #include +#include "config.h" #include "libavutil/attributes.h" #include "libavutil/cpu.h" #include "libavutil/ppc/types_altivec.h" #include "libavutil/ppc/util_altivec.h" #include "libavcodec/mpegvideo.h" - #include "dsputil_altivec.h" +#if HAVE_ALTIVEC + /* AltiVec version of dct_unquantize_h263 this code assumes `block' is 16 bytes-aligned */ static void dct_unquantize_h263_altivec(MpegEncContext *s, @@ -111,9 +113,11 @@ static void dct_unquantize_h263_altivec(MpegEncContext *s, } } +#endif /* HAVE_ALTIVEC */ -av_cold void ff_MPV_common_init_altivec(MpegEncContext *s) +av_cold void ff_MPV_common_init_ppc(MpegEncContext *s) { +#if HAVE_ALTIVEC if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) return; if ((s->avctx->dct_algo == FF_DCT_AUTO) || @@ -121,4 +125,5 @@ av_cold void ff_MPV_common_init_altivec(MpegEncContext *s) s->dct_unquantize_h263_intra = dct_unquantize_h263_altivec; s->dct_unquantize_h263_inter = dct_unquantize_h263_altivec; } +#endif /* HAVE_ALTIVEC */ } diff --git a/libavcodec/ppc/vc1dsp_altivec.c b/libavcodec/ppc/vc1dsp_altivec.c index 9c2ad70b62..1b73dd03fa 100644 --- a/libavcodec/ppc/vc1dsp_altivec.c +++ b/libavcodec/ppc/vc1dsp_altivec.c @@ -19,11 +19,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "config.h" #include "libavutil/attributes.h" #include "libavutil/ppc/types_altivec.h" #include "libavutil/ppc/util_altivec.h" #include "libavcodec/vc1dsp.h" +#if HAVE_ALTIVEC + // main steps of 8x8 transform #define STEP8(s0, s1, s2, s3, s4, s5, s6, s7, vec_rnd) \ do { \ @@ -335,8 +338,11 @@ static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, int16_t *block) #undef OP_U8_ALTIVEC #undef PREFIX_no_rnd_vc1_chroma_mc8_altivec -av_cold void ff_vc1dsp_init_altivec(VC1DSPContext *dsp) +#endif /* HAVE_ALTIVEC */ + +av_cold void ff_vc1dsp_init_ppc(VC1DSPContext *dsp) { +#if HAVE_ALTIVEC if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) return; @@ -344,4 +350,5 @@ av_cold void ff_vc1dsp_init_altivec(VC1DSPContext *dsp) dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_altivec; dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec; dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec; +#endif /* HAVE_ALTIVEC */ } diff --git a/libavcodec/ppc/vp8dsp_altivec.c b/libavcodec/ppc/vp8dsp_altivec.c index 14d87845dc..2401d2a628 100644 --- a/libavcodec/ppc/vp8dsp_altivec.c +++ b/libavcodec/ppc/vp8dsp_altivec.c @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "config.h" #include "libavutil/cpu.h" #include "libavutil/mem.h" #include "libavutil/ppc/types_altivec.h" @@ -27,6 +28,7 @@ #include "libavcodec/vp8dsp.h" #include "dsputil_altivec.h" +#if HAVE_ALTIVEC #define REPT4(...) { __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__ } // h subpel filter uses msum to multiply+add 4 pixel taps at once @@ -272,8 +274,11 @@ static void put_vp8_pixels16_altivec(uint8_t *dst, ptrdiff_t stride, uint8_t *sr ff_put_pixels16_altivec(dst, src, stride, h); } -av_cold void ff_vp8dsp_init_altivec(VP8DSPContext *c) +#endif /* HAVE_ALTIVEC */ + +av_cold void ff_vp8dsp_init_ppc(VP8DSPContext *c) { +#if HAVE_ALTIVEC if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) return; @@ -301,4 +306,5 @@ av_cold void ff_vp8dsp_init_altivec(VP8DSPContext *c) c->put_vp8_epel_pixels_tab[2][1][1] = put_vp8_epel4_h4v4_altivec; c->put_vp8_epel_pixels_tab[2][1][2] = put_vp8_epel4_h6v4_altivec; c->put_vp8_epel_pixels_tab[2][2][1] = put_vp8_epel4_h4v6_altivec; +#endif /* HAVE_ALTIVEC */ } diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c index ae3f04ef85..39e94418fa 100644 --- a/libavcodec/vc1dsp.c +++ b/libavcodec/vc1dsp.c @@ -888,8 +888,8 @@ av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) { dsp->sprite_v_double_twoscale = sprite_v_double_twoscale_c; #endif - if (HAVE_ALTIVEC) - ff_vc1dsp_init_altivec(dsp); if (ARCH_X86) ff_vc1dsp_init_x86(dsp); + if (ARCH_PPC) + ff_vc1dsp_init_ppc(dsp); } diff --git a/libavcodec/vc1dsp.h b/libavcodec/vc1dsp.h index 5e332a0e4f..a0d6048054 100644 --- a/libavcodec/vc1dsp.h +++ b/libavcodec/vc1dsp.h @@ -77,7 +77,7 @@ typedef struct VC1DSPContext { } VC1DSPContext; void ff_vc1dsp_init(VC1DSPContext* c); -void ff_vc1dsp_init_altivec(VC1DSPContext* c); +void ff_vc1dsp_init_ppc(VC1DSPContext *c); void ff_vc1dsp_init_x86(VC1DSPContext* dsp); #endif /* AVCODEC_VC1DSP_H */ diff --git a/libavcodec/vp8dsp.c b/libavcodec/vp8dsp.c index a61a59eec4..39d8038155 100644 --- a/libavcodec/vp8dsp.c +++ b/libavcodec/vp8dsp.c @@ -523,8 +523,8 @@ av_cold void ff_vp8dsp_init(VP8DSPContext *dsp) if (ARCH_X86) ff_vp8dsp_init_x86(dsp); - if (HAVE_ALTIVEC) - ff_vp8dsp_init_altivec(dsp); if (ARCH_ARM) ff_vp8dsp_init_arm(dsp); + if (ARCH_PPC) + ff_vp8dsp_init_ppc(dsp); } diff --git a/libavcodec/vp8dsp.h b/libavcodec/vp8dsp.h index 6308ff46cf..58ec65a568 100644 --- a/libavcodec/vp8dsp.h +++ b/libavcodec/vp8dsp.h @@ -90,7 +90,7 @@ void ff_put_vp8_pixels4_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride, void ff_vp8dsp_init(VP8DSPContext *c); void ff_vp8dsp_init_x86(VP8DSPContext *c); -void ff_vp8dsp_init_altivec(VP8DSPContext *c); void ff_vp8dsp_init_arm(VP8DSPContext *c); +void ff_vp8dsp_init_ppc(VP8DSPContext *c); #endif /* AVCODEC_VP8DSP_H */