diff options
author | Diego Biurrun <diego@biurrun.de> | 2013-04-14 14:47:30 +0200 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2013-04-30 12:19:45 +0200 |
commit | 38282149b6ce8f4b8361e3b84542ba9aa8a1f32f (patch) | |
tree | 028b5282288a6849233274851112fff4e2d0d25b /libavcodec/ppc | |
parent | 42b9150b0d4f0a130c1d93dc991fd5412743a8cf (diff) | |
download | ffmpeg-38282149b6ce8f4b8361e3b84542ba9aa8a1f32f.tar.gz |
ppc: More consistent arch initialization
Diffstat (limited to 'libavcodec/ppc')
-rw-r--r-- | libavcodec/ppc/Makefile | 19 | ||||
-rw-r--r-- | libavcodec/ppc/fft_altivec.c | 11 | ||||
-rw-r--r-- | libavcodec/ppc/fmtconvert_altivec.c | 15 | ||||
-rw-r--r-- | libavcodec/ppc/h264dsp.c | 6 | ||||
-rw-r--r-- | libavcodec/ppc/mpegaudiodsp_altivec.c | 11 | ||||
-rw-r--r-- | libavcodec/ppc/mpegvideo_altivec.c | 9 | ||||
-rw-r--r-- | libavcodec/ppc/vc1dsp_altivec.c | 9 | ||||
-rw-r--r-- | libavcodec/ppc/vp8dsp_altivec.c | 8 |
8 files changed, 63 insertions, 25 deletions
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 c85d04ff79..e3c848213d 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 78386f6c8c..c72d0a4cd7 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 20549c5b6d..49ca03ee4e 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 7965183999..64a6d03d6d 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 f6c85fdb71..4ad24b98d8 100644 --- a/libavcodec/ppc/mpegvideo_altivec.c +++ b/libavcodec/ppc/mpegvideo_altivec.c @@ -24,14 +24,16 @@ #include <stdlib.h> #include <stdio.h> +#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 07bacb1bc9..4695b1c3bc 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 4336453f50..504139da97 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 */ } |