diff options
author | Mans Rullgard <mans@mansr.com> | 2012-07-17 16:47:43 +0100 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2012-07-18 10:32:19 +0100 |
commit | 28f9ab7029bd1a02f659995919f899f84ee7361b (patch) | |
tree | cc5544768e088acef9f18e0c8038f72bd1a91b9d /libavcodec/ppc | |
parent | ab9f9876615fd856184912cf3863a80cf3a721b6 (diff) | |
download | ffmpeg-28f9ab7029bd1a02f659995919f899f84ee7361b.tar.gz |
vp3: move idct and loop filter pointers to new vp3dsp context
This moves all VP3-specific function pointers from dsputil to a
new vp3dsp context. There is no reason to ever use the VP3 IDCT
where an MPEG2 IDCT is expected or vice versa.
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavcodec/ppc')
-rw-r--r-- | libavcodec/ppc/Makefile | 5 | ||||
-rw-r--r-- | libavcodec/ppc/dsputil_altivec.h | 4 | ||||
-rw-r--r-- | libavcodec/ppc/dsputil_ppc.c | 6 | ||||
-rw-r--r-- | libavcodec/ppc/vp3dsp_altivec.c | 40 |
4 files changed, 22 insertions, 33 deletions
diff --git a/libavcodec/ppc/Makefile b/libavcodec/ppc/Makefile index 31f4fb8ecd..e5d1d39d43 100644 --- a/libavcodec/ppc/Makefile +++ b/libavcodec/ppc/Makefile @@ -1,14 +1,13 @@ OBJS += ppc/dsputil_ppc.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/h264_altivec.o ALTIVEC-OBJS-$(CONFIG_MPEGAUDIODSP) += ppc/mpegaudiodec_altivec.o ALTIVEC-OBJS-$(CONFIG_VC1_DECODER) += ppc/vc1dsp_altivec.o -ALTIVEC-OBJS-$(CONFIG_VP3_DECODER) += ppc/vp3dsp_altivec.o -ALTIVEC-OBJS-$(CONFIG_VP5_DECODER) += ppc/vp3dsp_altivec.o -ALTIVEC-OBJS-$(CONFIG_VP6_DECODER) += ppc/vp3dsp_altivec.o ALTIVEC-OBJS-$(CONFIG_VP8_DECODER) += ppc/vp8dsp_altivec.o ALTIVEC-OBJS += ppc/dsputil_altivec.o \ diff --git a/libavcodec/ppc/dsputil_altivec.h b/libavcodec/ppc/dsputil_altivec.h index 63bb7602f8..7cbda36988 100644 --- a/libavcodec/ppc/dsputil_altivec.h +++ b/libavcodec/ppc/dsputil_altivec.h @@ -36,10 +36,6 @@ void ff_gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h, void ff_idct_put_altivec(uint8_t *dest, int line_size, int16_t *block); void ff_idct_add_altivec(uint8_t *dest, int line_size, int16_t *block); -void ff_vp3_idct_altivec(DCTELEM *block); -void ff_vp3_idct_put_altivec(uint8_t *dest, int line_size, DCTELEM *block); -void ff_vp3_idct_add_altivec(uint8_t *dest, int line_size, DCTELEM *block); - void ff_dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx); void ff_dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx); diff --git a/libavcodec/ppc/dsputil_ppc.c b/libavcodec/ppc/dsputil_ppc.c index de347835e6..df70b015c8 100644 --- a/libavcodec/ppc/dsputil_ppc.c +++ b/libavcodec/ppc/dsputil_ppc.c @@ -185,12 +185,6 @@ void ff_dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx) c->idct_put = ff_idct_put_altivec; c->idct_add = ff_idct_add_altivec; c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; - }else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER) && - avctx->idct_algo==FF_IDCT_VP3){ - c->idct_put = ff_vp3_idct_put_altivec; - c->idct_add = ff_vp3_idct_add_altivec; - c->idct = ff_vp3_idct_altivec; - c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; } } diff --git a/libavcodec/ppc/vp3dsp_altivec.c b/libavcodec/ppc/vp3dsp_altivec.c index 938502e8bd..0c493e98cd 100644 --- a/libavcodec/ppc/vp3dsp_altivec.c +++ b/libavcodec/ppc/vp3dsp_altivec.c @@ -18,6 +18,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "config.h" +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavcodec/vp3dsp.h" + +#if HAVE_ALTIVEC + #include "libavutil/ppc/types_altivec.h" #include "libavutil/ppc/util_altivec.h" #include "libavcodec/dsputil.h" @@ -107,25 +114,7 @@ static inline vec_s16 M16(vec_s16 a, vec_s16 C) #define ADD8(a) vec_add(a, eight) #define SHIFT4(a) vec_sra(a, four) -void ff_vp3_idct_altivec(DCTELEM block[64]) -{ - IDCT_START - - IDCT_1D(NOP, NOP) - TRANSPOSE8(b0, b1, b2, b3, b4, b5, b6, b7); - IDCT_1D(ADD8, SHIFT4) - - vec_st(b0, 0x00, block); - vec_st(b1, 0x10, block); - vec_st(b2, 0x20, block); - vec_st(b3, 0x30, block); - vec_st(b4, 0x40, block); - vec_st(b5, 0x50, block); - vec_st(b6, 0x60, block); - vec_st(b7, 0x70, block); -} - -void ff_vp3_idct_put_altivec(uint8_t *dst, int stride, DCTELEM block[64]) +static void vp3_idct_put_altivec(uint8_t *dst, int stride, DCTELEM block[64]) { vec_u8 t; IDCT_START @@ -153,7 +142,7 @@ void ff_vp3_idct_put_altivec(uint8_t *dst, int stride, DCTELEM block[64]) PUT(b7) } -void ff_vp3_idct_add_altivec(uint8_t *dst, int stride, DCTELEM block[64]) +static void vp3_idct_add_altivec(uint8_t *dst, int stride, DCTELEM block[64]) { LOAD_ZERO; vec_u8 t, vdst; @@ -183,3 +172,14 @@ void ff_vp3_idct_add_altivec(uint8_t *dst, int stride, DCTELEM block[64]) ADD(b6) dst += stride; ADD(b7) } + +#endif /* HAVE_ALTIVEC */ + +av_cold void ff_vp3dsp_init_ppc(VP3DSPContext *c, int flags) +{ + if (HAVE_ALTIVEC && av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) { + c->idct_put = vp3_idct_put_altivec; + c->idct_add = vp3_idct_add_altivec; + c->idct_perm = FF_TRANSPOSE_IDCT_PERM; + } +} |