From: Laurent Aimar Date: Wed, 20 Jul 2005 15:27:18 +0000 (+0000) Subject: * all: "8x8 SAD written in Sparc Assembly using VIS." Patch by Phil Jensen. X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=300e93ef08f5b389da3942474da8ec6fb9c62fda;p=x264.git * all: "8x8 SAD written in Sparc Assembly using VIS." Patch by Phil Jensen. git-svn-id: svn://svn.videolan.org/x264/trunk@276 df754926-b1dd-0310-bc7b-ec298dee348c --- diff --git a/Makefile b/Makefile index a4d8ef1b..b80570e1 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,12 @@ ifeq ($(ARCH),PPC) SRCS += common/ppc/mc.c common/ppc/pixel.c common/ppc/dct.c endif +# VIS optims +ifeq ($(ARCH),UltraSparc) +ASMSRC += common/sparc/pixel.asm +OBJASM = $(ASMSRC:%.asm=%.o) +endif + ifneq ($(HAVE_GETOPT_LONG),1) SRCS += extras/getopt.c CFLAGS += -DHAVE_GETOPT_LONG=0 diff --git a/common/pixel.c b/common/pixel.c index ff38a73f..793675c8 100644 --- a/common/pixel.c +++ b/common/pixel.c @@ -40,6 +40,9 @@ #ifdef ARCH_PPC # include "ppc/pixel.h" #endif +#ifdef ARCH_UltraSparc +# include "sparc/pixel.h" +#endif /**************************************************************************** @@ -434,5 +437,8 @@ void x264_pixel_init( int cpu, x264_pixel_function_t *pixf ) x264_pixel_altivec_init( pixf ); } #endif +#ifdef ARCH_UltraSparc + pixf->sad[PIXEL_8x8] = x264_pixel_sad_8x8_vis; +#endif } diff --git a/common/sparc/pixel.asm b/common/sparc/pixel.asm new file mode 100755 index 00000000..38cf056d --- /dev/null +++ b/common/sparc/pixel.asm @@ -0,0 +1,150 @@ +/***************************************************************************** + * pixel.asm: h264 encoder library + ***************************************************************************** + * Copyright (C) 2005 x264 project + * $Id: $ + * + * Authors: Phil Jensen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +! VIS optimized SAD for UltraSPARC + +.text +.align 4 +.global x264_pixel_sad_8x8_vis +x264_pixel_sad_8x8_vis: + save %sp, -120, %sp + + fzero %f12 + + alignaddr %i0, %g0, %l0 + ldd [%l0], %f0 + ldd [%l0+8], %f2 + faligndata %f0, %f2, %f4 + + alignaddr %i2, %g0, %l2 + ldd [%l2], %f6 + ldd [%l2+8], %f8 + faligndata %f6, %f8, %f10 + + add %i0, %i1, %i0 + add %i2, %i3, %i2 + pdist %f4, %f10, %f12 + + alignaddr %i0, %g0, %l0 + ldd [%l0], %f0 + ldd [%l0+8], %f2 + faligndata %f0, %f2, %f4 + + alignaddr %i2, %g0, %l2 + ldd [%l2], %f6 + ldd [%l2+8], %f8 + faligndata %f6, %f8, %f10 + + add %i0, %i1, %i0 + add %i2, %i3, %i2 + pdist %f4, %f10, %f12 + + alignaddr %i0, %g0, %l0 + ldd [%l0], %f0 + ldd [%l0+8], %f2 + faligndata %f0, %f2, %f4 + + alignaddr %i2, %g0, %l2 + ldd [%l2], %f6 + ldd [%l2+8], %f8 + faligndata %f6, %f8, %f10 + + add %i0, %i1, %i0 + add %i2, %i3, %i2 + pdist %f4, %f10, %f12 + + alignaddr %i0, %g0, %l0 + ldd [%l0], %f0 + ldd [%l0+8], %f2 + faligndata %f0, %f2, %f4 + + alignaddr %i2, %g0, %l2 + ldd [%l2], %f6 + ldd [%l2+8], %f8 + faligndata %f6, %f8, %f10 + + add %i0, %i1, %i0 + add %i2, %i3, %i2 + pdist %f4, %f10, %f12 + + alignaddr %i0, %g0, %l0 + ldd [%l0], %f0 + ldd [%l0+8], %f2 + faligndata %f0, %f2, %f4 + + alignaddr %i2, %g0, %l2 + ldd [%l2], %f6 + ldd [%l2+8], %f8 + faligndata %f6, %f8, %f10 + + add %i0, %i1, %i0 + add %i2, %i3, %i2 + pdist %f4, %f10, %f12 + + alignaddr %i0, %g0, %l0 + ldd [%l0], %f0 + ldd [%l0+8], %f2 + faligndata %f0, %f2, %f4 + + alignaddr %i2, %g0, %l2 + ldd [%l2], %f6 + ldd [%l2+8], %f8 + faligndata %f6, %f8, %f10 + + add %i0, %i1, %i0 + add %i2, %i3, %i2 + pdist %f4, %f10, %f12 + + alignaddr %i0, %g0, %l0 + ldd [%l0], %f0 + ldd [%l0+8], %f2 + faligndata %f0, %f2, %f4 + + alignaddr %i2, %g0, %l2 + ldd [%l2], %f6 + ldd [%l2+8], %f8 + faligndata %f6, %f8, %f10 + + add %i0, %i1, %i0 + add %i2, %i3, %i2 + pdist %f4, %f10, %f12 + + alignaddr %i0, %g0, %l0 + ldd [%l0], %f0 + ldd [%l0+8], %f2 + faligndata %f0, %f2, %f4 + + alignaddr %i2, %g0, %l2 + ldd [%l2], %f6 + ldd [%l2+8], %f8 + faligndata %f6, %f8, %f10 + + add %i0, %i1, %i0 + add %i2, %i3, %i2 + pdist %f4, %f10, %f12 + + std %f12, [%fp-24] + ld [%fp-20], %i0 + + ret + restore diff --git a/common/sparc/pixel.h b/common/sparc/pixel.h new file mode 100755 index 00000000..d9683a5b --- /dev/null +++ b/common/sparc/pixel.h @@ -0,0 +1,29 @@ +/***************************************************************************** + * pixel.h: h264 encoder library + ***************************************************************************** + * Copyright (C) 2005 x264 project + * $Id: pixel.h,v 1.1 2004/06/03 19:27:07 fenrir Exp $ + * + * Authors: Phil Jensen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +#ifndef _SPARC_PIXEL_H +#define _SPARC_PIXEL_H 1 + +int x264_pixel_sad_8x8_vis( uint8_t *, int, uint8_t *, int ); + +#endif diff --git a/configure b/configure index f4eb03bd..58e7df94 100755 --- a/configure +++ b/configure @@ -107,9 +107,16 @@ case "$UNAMEM" in CFLAGS="$CFLAGS -maltivec -mabi=altivec" fi ;; - sun*) + sun4m|sun4d) ARCH="Sparc" ;; + sun4u) + ARCH="UltraSparc" + CFLAGS="$CFLAGS -mcpu=ultrasparc" + LDFLAGS="$LDFLAGS -mcpu=ultrasparc" + AS="as" + ASFLAGS="-xarch=v8plusa" + ;; *) echo "Unknown platform $UNAMEM, edit the configure" exit 1