]> granicus.if.org Git - libx264/commitdiff
* all: "8x8 SAD written in Sparc Assembly using VIS." Patch by Phil Jensen.
authorLaurent Aimar <fenrir@videolan.org>
Wed, 20 Jul 2005 15:27:18 +0000 (15:27 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Wed, 20 Jul 2005 15:27:18 +0000 (15:27 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@276 df754926-b1dd-0310-bc7b-ec298dee348c

Makefile
common/pixel.c
common/sparc/pixel.asm [new file with mode: 0755]
common/sparc/pixel.h [new file with mode: 0755]
configure

index a4d8ef1bf263446cf0380a6cc9b3bda0b526db8f..b80570e1f2f785e160e3751533b01d56eef22139 100644 (file)
--- 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
index ff38a73f9e58e22b140702c96bea1df8a69b84c5..793675c8d6458657162f10098ec4eac5e7007d4c 100644 (file)
@@ -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 (executable)
index 0000000..38cf056
--- /dev/null
@@ -0,0 +1,150 @@
+/*****************************************************************************
+ * pixel.asm: h264 encoder library
+ *****************************************************************************
+ * Copyright (C) 2005 x264 project
+ * $Id: $
+ *
+ * Authors: Phil Jensen <philj@csufresno.edu>
+ *
+ * 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 (executable)
index 0000000..d9683a5
--- /dev/null
@@ -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 <philj@csufresno.edu>
+ *
+ * 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
index f4eb03bdd852312f4d1e057498d5ccd3c52d3fe1..58e7df943e6ba61cb191c80cdaa7e51bbf433d12 100755 (executable)
--- 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