Commit cae8f469 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '38282149'

* commit '38282149':
  ppc: More consistent arch initialization

Conflicts:
	libavcodec/fft.h
	libavcodec/mpegaudiodsp.c
	libavcodec/mpegaudiodsp.h
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents ebd99ff1 38282149
......@@ -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);
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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);
}
......@@ -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);
}
......@@ -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);
......
......@@ -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
......
......@@ -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,
......
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 \
......@@ -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 */
}
......@@ -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 */
}
......@@ -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 */
}
......@@ -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 */
}
......@@ -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 */
}
......@@ -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 */
}
......@@ -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 */
}
......@@ -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);
}
......@@ -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 */
......@@ -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);
}
......@@ -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 */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment