From 241807f32d88b672fc8bdd95cb91debc93bde8e1 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Mon, 14 Aug 2006 22:55:11 +0000 Subject: [PATCH] altivec float optimizations Originally committed as revision 5999 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/Makefile | 3 +- libavcodec/ppc/dsputil_ppc.c | 3 +- libavcodec/ppc/float_altivec.c | 192 +++++++++++++++++++++++++++++++++ 3 files changed, 196 insertions(+), 2 deletions(-) create mode 100644 libavcodec/ppc/float_altivec.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index f1c5c032f0..80f2201c14 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -351,7 +351,8 @@ OBJS-$(TARGET_ALTIVEC) += ppc/dsputil_altivec.o \ ppc/fdct_altivec.o \ ppc/h264_altivec.o \ ppc/snow_altivec.o \ - ppc/vc1dsp_altivec.o + ppc/vc1dsp_altivec.o \ + ppc/float_altivec.o CFLAGS += $(CFLAGS-yes) OBJS += $(OBJS-yes) diff --git a/libavcodec/ppc/dsputil_ppc.c b/libavcodec/ppc/dsputil_ppc.c index 156d9c7ab4..f022153866 100644 --- a/libavcodec/ppc/dsputil_ppc.c +++ b/libavcodec/ppc/dsputil_ppc.c @@ -36,6 +36,7 @@ void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx); void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx); void vc1dsp_init_altivec(DSPContext* c, AVCodecContext *avctx); void snow_init_altivec(DSPContext* c, AVCodecContext *avctx); +void float_init_altivec(DSPContext* c, AVCodecContext *avctx); #endif @@ -270,7 +271,7 @@ void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx) dsputil_init_altivec(c, avctx); snow_init_altivec(c, avctx); vc1dsp_init_altivec(c, avctx); - + float_init_altivec(c, avctx); c->gmc1 = gmc1_altivec; #ifdef CONFIG_ENCODERS diff --git a/libavcodec/ppc/float_altivec.c b/libavcodec/ppc/float_altivec.c new file mode 100644 index 0000000000..89d3ccb5f3 --- /dev/null +++ b/libavcodec/ppc/float_altivec.c @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2006 Luca Barbato + * + * This library 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 of the License, or (at your option) any later version. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "../dsputil.h" + +#include "gcc_fixes.h" + +#include "dsputil_altivec.h" + +static void vector_fmul_altivec(float *dst, const float *src, int len) +{ + int i; + vector float d0, d1, s, zero = (vector float)vec_splat_u32(0); + for(i=0; ivector_fmul = vector_fmul_altivec; + c->vector_fmul_reverse = vector_fmul_reverse_altivec; + c->vector_fmul_add_add = vector_fmul_add_add_altivec; + if(!(avctx->flags & CODEC_FLAG_BITEXACT)) + c->float_to_int16 = float_to_int16_altivec; +}