summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2005-10-11 05:28:01 +0000
committerDavid Schleef <ds@schleef.org>2005-10-11 05:28:01 +0000
commit662216678ddda92b48506618688b533d5a4e5a23 (patch)
treef059478bd374b5a1c9700ab97b48ff188cbb09d7
parentfd993618f9348055b91bbf84d6840c61bc00589c (diff)
downloadliboil-662216678ddda92b48506618688b533d5a4e5a23.tar.gz
* liboil/powerpc/clip.c: Move more files around
* liboil/ref/Makefile.am: * liboil/ref/abs.c: * liboil/ref/average2_u8.c: * liboil/ref/clip_ref.c: * liboil/ref/diffsquaresum_f64.c: * liboil/ref/mix_u8.c: * liboil/ref/mult8x8_s16.c: * liboil/ref/multsum.c: * liboil/ref/sad8x8.c: * liboil/ref/sad8x8_broken.c: * liboil/ref/scalaradd.c: * liboil/ref/scalarmult.c: * liboil/ref/sincos_f64.c: * liboil/ref/squaresum_f64.c: * liboil/ref/sum_f64.c: * liboil/ref/vectoradd_f64.c: * liboil/ref/vectoradd_s.c: * liboil/simdpack/Makefile.am: * liboil/simdpack/abs.c: * liboil/simdpack/average2_u8.c: * liboil/simdpack/clip_ref.c: * liboil/simdpack/diffsquaresum_f64.c: * liboil/simdpack/mix_u8.c: * liboil/simdpack/mult8x8_s16.c: * liboil/simdpack/multsum.c: * liboil/simdpack/sad8x8.c: * liboil/simdpack/sad8x8_broken.c: * liboil/simdpack/scalaradd.c: * liboil/simdpack/scalarmult.c: * liboil/simdpack/sincos_f64.c: * liboil/simdpack/squaresum_f64.c: * liboil/simdpack/sum_f64.c: * liboil/simdpack/vectoradd_f64.c: * liboil/simdpack/vectoradd_s.c:
-rw-r--r--ChangeLog38
-rw-r--r--liboil/powerpc/clip.c24
-rw-r--r--liboil/ref/Makefile.am16
-rw-r--r--liboil/ref/abs.c (renamed from liboil/simdpack/abs.c)0
-rw-r--r--liboil/ref/average2_u8.c53
-rw-r--r--liboil/ref/clip_ref.c (renamed from liboil/simdpack/clip_ref.c)0
-rw-r--r--liboil/ref/diffsquaresum_f64.c63
-rw-r--r--liboil/ref/mix_u8.c49
-rw-r--r--liboil/ref/mult8x8_s16.c (renamed from liboil/simdpack/mult8x8_s16.c)0
-rw-r--r--liboil/ref/multsum.c66
-rw-r--r--liboil/ref/sad8x8.c (renamed from liboil/simdpack/sad8x8.c)0
-rw-r--r--liboil/ref/sad8x8_broken.c (renamed from liboil/simdpack/sad8x8_broken.c)0
-rw-r--r--liboil/ref/scalaradd.c63
-rw-r--r--liboil/ref/scalarmult.c61
-rw-r--r--liboil/ref/sincos_f64.c52
-rw-r--r--liboil/ref/squaresum_f64.c58
-rw-r--r--liboil/ref/sum_f64.c57
-rw-r--r--liboil/ref/vectoradd_f64.c (renamed from liboil/simdpack/vectoradd_f64.c)18
-rw-r--r--liboil/ref/vectoradd_s.c69
-rw-r--r--liboil/simdpack/Makefile.am8
-rw-r--r--liboil/simdpack/average2_u8.c17
-rw-r--r--liboil/simdpack/diffsquaresum_f64.c27
-rw-r--r--liboil/simdpack/mix_u8.c14
-rw-r--r--liboil/simdpack/multsum.c31
-rw-r--r--liboil/simdpack/scalaradd.c28
-rw-r--r--liboil/simdpack/scalarmult.c27
-rw-r--r--liboil/simdpack/sincos_f64.c21
-rw-r--r--liboil/simdpack/squaresum_f64.c23
-rw-r--r--liboil/simdpack/sum_f64.c21
-rw-r--r--liboil/simdpack/vectoradd_s.c43
30 files changed, 681 insertions, 266 deletions
diff --git a/ChangeLog b/ChangeLog
index 9838716..5a79c48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,43 @@
2005-10-10 David Schleef <ds@schleef.org>
+ * liboil/powerpc/clip.c: Move more files around
+ * liboil/ref/Makefile.am:
+ * liboil/ref/abs.c:
+ * liboil/ref/average2_u8.c:
+ * liboil/ref/clip_ref.c:
+ * liboil/ref/diffsquaresum_f64.c:
+ * liboil/ref/mix_u8.c:
+ * liboil/ref/mult8x8_s16.c:
+ * liboil/ref/multsum.c:
+ * liboil/ref/sad8x8.c:
+ * liboil/ref/sad8x8_broken.c:
+ * liboil/ref/scalaradd.c:
+ * liboil/ref/scalarmult.c:
+ * liboil/ref/sincos_f64.c:
+ * liboil/ref/squaresum_f64.c:
+ * liboil/ref/sum_f64.c:
+ * liboil/ref/vectoradd_f64.c:
+ * liboil/ref/vectoradd_s.c:
+ * liboil/simdpack/Makefile.am:
+ * liboil/simdpack/abs.c:
+ * liboil/simdpack/average2_u8.c:
+ * liboil/simdpack/clip_ref.c:
+ * liboil/simdpack/diffsquaresum_f64.c:
+ * liboil/simdpack/mix_u8.c:
+ * liboil/simdpack/mult8x8_s16.c:
+ * liboil/simdpack/multsum.c:
+ * liboil/simdpack/sad8x8.c:
+ * liboil/simdpack/sad8x8_broken.c:
+ * liboil/simdpack/scalaradd.c:
+ * liboil/simdpack/scalarmult.c:
+ * liboil/simdpack/sincos_f64.c:
+ * liboil/simdpack/squaresum_f64.c:
+ * liboil/simdpack/sum_f64.c:
+ * liboil/simdpack/vectoradd_f64.c:
+ * liboil/simdpack/vectoradd_s.c:
+
+2005-10-10 David Schleef <ds@schleef.org>
+
* m4/ltdl.m4: Seems Debian's new libtool package doesn't
have a good definition of AC_LTDL_SYMBOL_USCORE
diff --git a/liboil/powerpc/clip.c b/liboil/powerpc/clip.c
index 052c9bd..7becb75 100644
--- a/liboil/powerpc/clip.c
+++ b/liboil/powerpc/clip.c
@@ -129,3 +129,27 @@ OIL_DEFINE_IMPL_ASM (clip_s16_ppcasm3, clip_s16);
#endif
+#ifdef ENABLE_BROKEN_IMPLS
+static void
+clip_f64_ppcasm(f64 *dest, f64 *src, f64 low, f64 hi, int n)
+{
+ f64 ftmp;
+
+ dest--;
+ src--;
+ __asm__ __volatile__("\n"
+ "1: lfdu 0,8(%1)\n"
+ " addic. %2,%2,-1\n"
+ " fsub 1,0,%3\n"
+ " fsel 0,1,0,%3\n"
+ " fsub 1,0,%4\n"
+ " fsel 0,1,%4,0\n"
+ " stfdu 0,8(%0)\n"
+ " bge 1b\n"
+ : "+b" (dest), "+b" (src), "+r" (n)
+ : "f" (low), "f" (hi), "b" (&ftmp)
+ : "32", "33", "11" );
+}
+#endif
+
+
diff --git a/liboil/ref/Makefile.am b/liboil/ref/Makefile.am
index 93e1401..cede104 100644
--- a/liboil/ref/Makefile.am
+++ b/liboil/ref/Makefile.am
@@ -8,23 +8,39 @@ endif
noinst_LTLIBRARIES = libref.la $(opt_libs)
c_sources = \
+ abs.c \
argb_paint.c \
+ average2_u8.c \
ayuv2argb.c \
+ clip_ref.c \
composite.c \
conv.c \
copy.c \
copy8x8.c \
diff8x8.c \
+ diffsquaresum_f64.c \
error8x8.c \
+ mix_u8.c \
+ mult8x8_s16.c \
+ multsum.c \
permute.c \
recon8x8.c \
resample.c \
rgb.c \
rowcolsad8x8.c \
+ sad8x8.c \
+ sad8x8_broken.c \
sad8x8avg.c \
+ scalaradd.c \
+ scalarmult.c \
+ sincos_f64.c \
splat.c \
+ squaresum_f64.c \
+ sum_f64.c \
tablelookup.c \
trans8x8.c \
+ vectoradd_f64.c \
+ vectoradd_s.c \
yuv.c
libref_la_SOURCES = \
diff --git a/liboil/simdpack/abs.c b/liboil/ref/abs.c
index 6cbfbbd..6cbfbbd 100644
--- a/liboil/simdpack/abs.c
+++ b/liboil/ref/abs.c
diff --git a/liboil/ref/average2_u8.c b/liboil/ref/average2_u8.c
new file mode 100644
index 0000000..a636521
--- /dev/null
+++ b/liboil/ref/average2_u8.c
@@ -0,0 +1,53 @@
+/*
+ * LIBOIL - Library of Optimized Inner Loops
+ * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <liboil/liboilfunction.h>
+#include <liboil/simdpack/simdpack.h>
+
+#include <math.h>
+
+OIL_DEFINE_CLASS (average2_u8,
+ "uint8_t * dest, int dstr, uint8_t *src1, int sstr1, "
+ "uint8_t *src2, int sstr2, int n");
+
+static void
+average2_u8_ref (uint8_t * dest, int dstr, uint8_t *src1, int sstr1,
+ uint8_t *src2, int sstr2, int n)
+{
+ int i;
+
+ for (i = 0; i < n; i++) {
+ dest[dstr * i] = (src1[sstr1 * i] + src2[sstr2 * i]) >> 1;
+ }
+}
+
+OIL_DEFINE_IMPL_REF (average2_u8_ref, average2_u8);
+
diff --git a/liboil/simdpack/clip_ref.c b/liboil/ref/clip_ref.c
index 35e8f72..35e8f72 100644
--- a/liboil/simdpack/clip_ref.c
+++ b/liboil/ref/clip_ref.c
diff --git a/liboil/ref/diffsquaresum_f64.c b/liboil/ref/diffsquaresum_f64.c
new file mode 100644
index 0000000..427f413
--- /dev/null
+++ b/liboil/ref/diffsquaresum_f64.c
@@ -0,0 +1,63 @@
+/*
+ * LIBOIL - Library of Optimized Inner Loops
+ * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <liboil/liboilfunction.h>
+#include <liboil/simdpack/simdpack.h>
+#include <math.h>
+
+OIL_DEFINE_CLASS (diffsquaresum_f64,
+ "double *d_1, double *src1, int sstr1, double *src2, int sstr2, int n");
+
+static void
+diffsquaresum_f64_ref(double *dest, double *src1, int sstr1, double *src2,
+ int sstr2, int n)
+{
+ double sum = 0;
+ double errsum = 0;
+ double tmp;
+ double x;
+ int i;
+
+ for(i=0;i<n;i++){
+ x = OIL_GET(src1, i*sstr1, double) -
+ OIL_GET(src2, i*sstr2, double);
+ x = x*x;
+ tmp = sum;
+ sum += x;
+ errsum += (tmp - sum) + x;
+ }
+
+ *dest = sum + errsum;
+}
+
+OIL_DEFINE_IMPL_REF (diffsquaresum_f64_ref, diffsquaresum_f64);
+
+
diff --git a/liboil/ref/mix_u8.c b/liboil/ref/mix_u8.c
new file mode 100644
index 0000000..43fc5a4
--- /dev/null
+++ b/liboil/ref/mix_u8.c
@@ -0,0 +1,49 @@
+/*
+ * LIBOIL - Library of Optimized Inner Loops
+ * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <liboil/liboilfunction.h>
+#include <liboil/simdpack/simdpack.h>
+#include <math.h>
+
+OIL_DEFINE_CLASS (mix_u8,
+ "uint8_t *dest, uint8_t *src1, uint8_t *src2, uint8_t *src3, int n");
+
+static void mix_u8_ref(uint8_t *dest, uint8_t *src1, uint8_t *src2, uint8_t *scale, int n)
+{
+ int i;
+
+ for(i=0;i<n;i++){
+ dest[i] = (src1[i]*scale[i] + src2[i]*(255-scale[i]))>>8;
+ }
+}
+
+OIL_DEFINE_IMPL_REF (mix_u8_ref, mix_u8);
+
diff --git a/liboil/simdpack/mult8x8_s16.c b/liboil/ref/mult8x8_s16.c
index 4d129b9..4d129b9 100644
--- a/liboil/simdpack/mult8x8_s16.c
+++ b/liboil/ref/mult8x8_s16.c
diff --git a/liboil/ref/multsum.c b/liboil/ref/multsum.c
new file mode 100644
index 0000000..9b637f5
--- /dev/null
+++ b/liboil/ref/multsum.c
@@ -0,0 +1,66 @@
+/*
+ * LIBOIL - Library of Optimized Inner Loops
+ * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <liboil/liboilfunction.h>
+#include <liboil/simdpack/simdpack.h>
+#include <math.h>
+
+
+#define MULTSUM_DEFINE_REF(type) \
+static void multsum_ ## type ## _ref( \
+ type_ ## type *dest, \
+ type_ ## type *src1, int sstr1, \
+ type_ ## type *src2, int sstr2, \
+ int n) \
+{ \
+ int i; \
+ double sum = 0; \
+ double errsum = 0; \
+ for(i=0;i<n;i++){ \
+ type_ ## type x; \
+ type_ ## type tmp; \
+ x = OIL_GET(src1,sstr1*i,type_ ## type) * OIL_GET(src2,sstr2*i,type_ ## type); \
+ tmp = sum; \
+ sum += x; \
+ errsum += (tmp - sum) + x; \
+ } \
+ *dest = sum + errsum; \
+} \
+OIL_DEFINE_IMPL_REF (multsum_ ## type ## _ref, multsum_ ## type); \
+OIL_DEFINE_CLASS (multsum_ ## type, \
+ "type_" #type " *dest, " \
+ "type_" #type " *src1, int sstr1, " \
+ "type_" #type " *src2, int sstr2, " \
+ "int n")
+
+MULTSUM_DEFINE_REF(f32);
+MULTSUM_DEFINE_REF(f64);
+
diff --git a/liboil/simdpack/sad8x8.c b/liboil/ref/sad8x8.c
index a8e1caf..a8e1caf 100644
--- a/liboil/simdpack/sad8x8.c
+++ b/liboil/ref/sad8x8.c
diff --git a/liboil/simdpack/sad8x8_broken.c b/liboil/ref/sad8x8_broken.c
index b0b8a94..b0b8a94 100644
--- a/liboil/simdpack/sad8x8_broken.c
+++ b/liboil/ref/sad8x8_broken.c
diff --git a/liboil/ref/scalaradd.c b/liboil/ref/scalaradd.c
new file mode 100644
index 0000000..33d8d52
--- /dev/null
+++ b/liboil/ref/scalaradd.c
@@ -0,0 +1,63 @@
+/*
+ * LIBOIL - Library of Optimized Inner Loops
+ * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <liboil/liboilfunction.h>
+#include <liboil/simdpack/simdpack.h>
+
+#define SCALARADD_DEFINE_REF(type) \
+static void scalaradd_ ## type ## _ref( \
+ type_ ## type *dest, int dstr, \
+ type_ ## type *src, int sstr, \
+ type_ ## type *val, int n) \
+{ \
+ int i; \
+ for(i=0;i<n;i++){ \
+ OIL_GET(dest,dstr*i, type_ ## type) = \
+ OIL_GET(src,sstr*i, type_ ## type) + *val; \
+ } \
+} \
+OIL_DEFINE_CLASS (scalaradd_ ## type, \
+ "type_" #type " *dest, int dstr, " \
+ "type_" #type " *src, int sstr, " \
+ "type_" #type " *s2_1 int n"); \
+OIL_DEFINE_IMPL_REF (scalaradd_ ## type ## _ref, scalaradd_ ## type);
+
+
+SCALARADD_DEFINE_REF (s8);
+SCALARADD_DEFINE_REF (u8);
+SCALARADD_DEFINE_REF (s16);
+SCALARADD_DEFINE_REF (u16);
+SCALARADD_DEFINE_REF (s32);
+SCALARADD_DEFINE_REF (u32);
+SCALARADD_DEFINE_REF (f32);
+SCALARADD_DEFINE_REF (f64);
+
+
diff --git a/liboil/ref/scalarmult.c b/liboil/ref/scalarmult.c
new file mode 100644
index 0000000..b779244
--- /dev/null
+++ b/liboil/ref/scalarmult.c
@@ -0,0 +1,61 @@
+/*
+ * LIBOIL - Library of Optimized Inner Loops
+ * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <liboil/liboilfunction.h>
+#include <liboil/simdpack/simdpack.h>
+
+#define SCALARMULT_DEFINE_REF(type) \
+static void scalarmult_ ## type ## _ref( \
+ type_ ## type *dest, int dstr, \
+ type_ ## type *src, int sstr, \
+ type_ ## type *val, int n) \
+{ \
+ int i; \
+ for(i=0;i<n;i++){ \
+ OIL_GET(dest,dstr*i,type_ ## type) = OIL_GET(src,sstr*i,type_ ## type) * *val; \
+ } \
+} \
+OIL_DEFINE_CLASS(scalarmult_ ## type, \
+ "type_" #type " *dest, int dstr, " \
+ "type_" #type " *src, int sstr, " \
+ "type_" #type " *s2_1, int n"); \
+OIL_DEFINE_IMPL_REF (scalarmult_ ## type ## _ref, scalarmult_ ## type);
+
+
+SCALARMULT_DEFINE_REF (s8);
+SCALARMULT_DEFINE_REF (u8);
+SCALARMULT_DEFINE_REF (s16);
+SCALARMULT_DEFINE_REF (u16);
+SCALARMULT_DEFINE_REF (s32);
+SCALARMULT_DEFINE_REF (u32);
+SCALARMULT_DEFINE_REF (f32);
+SCALARMULT_DEFINE_REF (f64);
+
diff --git a/liboil/ref/sincos_f64.c b/liboil/ref/sincos_f64.c
new file mode 100644
index 0000000..7c59b78
--- /dev/null
+++ b/liboil/ref/sincos_f64.c
@@ -0,0 +1,52 @@
+/*
+ * LIBOIL - Library of Optimized Inner Loops
+ * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <liboil/liboilfunction.h>
+#include <math.h>
+
+OIL_DEFINE_CLASS (sincos_f64,
+ "double *dest1, double *dest2, int n, double *s1_1, double *s2_1");
+
+static void
+sincos_f64_ref (double *dest_sin, double *dest_cos, int n, double *offset,
+ double *interval)
+{
+ int i;
+ double x;
+
+ for(i=0;i<n;i++){
+ x = *offset + *interval * i;
+ dest_sin[i] = sin(x);
+ dest_cos[i] = cos(x);
+ }
+}
+OIL_DEFINE_IMPL_REF (sincos_f64_ref, sincos_f64);
+
diff --git a/liboil/ref/squaresum_f64.c b/liboil/ref/squaresum_f64.c
new file mode 100644
index 0000000..d7ede50
--- /dev/null
+++ b/liboil/ref/squaresum_f64.c
@@ -0,0 +1,58 @@
+/*
+ * LIBOIL - Library of Optimized Inner Loops
+ * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <liboil/liboilfunction.h>
+#include <liboil/simdpack/simdpack.h>
+#include <math.h>
+
+
+OIL_DEFINE_CLASS (squaresum_f64, "double *dest, double *src, int n");
+
+static void
+squaresum_f64_ref(double *dest, double *src, int n)
+{
+ double sum2 = 0;
+ double errsum = 0;
+ double tmp;
+ double x;
+ int i;
+
+ for(i=0;i<n;i++){
+ tmp = sum2;
+ x = src[i]*src[i];
+ sum2 += x;
+ errsum += (tmp - sum2) + x;
+ }
+
+ *dest = sum2 + errsum;
+}
+OIL_DEFINE_IMPL_REF (squaresum_f64_ref, squaresum_f64);
+
diff --git a/liboil/ref/sum_f64.c b/liboil/ref/sum_f64.c
new file mode 100644
index 0000000..2b665ac
--- /dev/null
+++ b/liboil/ref/sum_f64.c
@@ -0,0 +1,57 @@
+/*
+ * LIBOIL - Library of Optimized Inner Loops
+ * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <liboil/liboilfunction.h>
+#include <liboil/simdpack/simdpack.h>
+#include <math.h>
+
+OIL_DEFINE_CLASS (sum_f64, "double *dest, double *src, int sstr, int n");
+//OIL_DEFINE_CLASS (sum_f64_i10, "double *dest, double *src, int sstr, int n");
+
+static void
+sum_f64_ref (double *dest, double *src, int sstr, int n)
+{
+ double sum = 0;
+ double errsum = 0;
+ double tmp;
+ int i;
+
+ for(i=0;i<n;i++){
+ tmp = sum;
+ sum += OIL_GET(src, sstr*i, double);
+ errsum += (tmp - sum) + OIL_GET(src, sstr*i, double);
+ }
+
+ *dest = sum + errsum;
+}
+OIL_DEFINE_IMPL_REF (sum_f64_ref, sum_f64);
+
+
diff --git a/liboil/simdpack/vectoradd_f64.c b/liboil/ref/vectoradd_f64.c
index 71d2367..2b2a092 100644
--- a/liboil/simdpack/vectoradd_f64.c
+++ b/liboil/ref/vectoradd_f64.c
@@ -33,7 +33,7 @@
#include <liboil/simdpack/simdpack.h>
-#define VECTORADD_DEFINE_IMPL(type) \
+#define VECTORADD_DEFINE(type) \
static void vectoradd_ ## type ## _ref ( \
type_ ## type *dest, int dstr, \
type_ ## type *src1, int sstr1, \
@@ -53,14 +53,14 @@ OIL_DEFINE_CLASS (vectoradd_ ## type, \
"int n, type_" #type " *s3_1, type_" #type " *s4_1"); \
OIL_DEFINE_IMPL_REF (vectoradd_ ## type ## _ref, vectoradd_ ## type);
-VECTORADD_DEFINE_IMPL (s8);
-VECTORADD_DEFINE_IMPL (u8);
-VECTORADD_DEFINE_IMPL (s16);
-VECTORADD_DEFINE_IMPL (u16);
-VECTORADD_DEFINE_IMPL (s32);
-VECTORADD_DEFINE_IMPL (u32);
-VECTORADD_DEFINE_IMPL (f32);
-VECTORADD_DEFINE_IMPL (f64);
+VECTORADD_DEFINE (s8);
+VECTORADD_DEFINE (u8);
+VECTORADD_DEFINE (s16);
+VECTORADD_DEFINE (u16);
+VECTORADD_DEFINE (s32);
+VECTORADD_DEFINE (u32);
+VECTORADD_DEFINE (f32);
+VECTORADD_DEFINE (f64);
diff --git a/liboil/ref/vectoradd_s.c b/liboil/ref/vectoradd_s.c
new file mode 100644
index 0000000..15fe654
--- /dev/null
+++ b/liboil/ref/vectoradd_s.c
@@ -0,0 +1,69 @@
+/*
+ * LIBOIL - Library of Optimized Inner Loops
+ * Copyright (c) 2005 David A. Schleef <ds@schleef.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <liboil/liboilfunction.h>
+#include <liboil/simdpack/simdpack.h>
+
+#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
+#define type_min_f32 -1.0
+#define type_max_f32 1.0
+#define type_min_f64 -1.0
+#define type_max_f64 1.0
+
+#define VECTORADD_S_DEFINE_IMPL(type,bigger) \
+static void vectoradd_s_ ## type ## _ref ( \
+ type_ ## type *dest, int dstr, \
+ type_ ## type *src1, int sstr1, \
+ type_ ## type *src2, int sstr2, \
+ int n) \
+{ \
+ int i; \
+ for(i=0;i<n;i++) { \
+ OIL_GET(dest,i*dstr, type_ ## type) = CLAMP((type_ ## bigger)OIL_GET(src1,i*sstr1, type_ ## type) + \
+ (type_ ## bigger)OIL_GET(src2,i*sstr2, type_ ## type),type_min_ ## type, type_max_ ## type); \
+ } \
+} \
+OIL_DEFINE_CLASS (vectoradd_s_ ## type, \
+ "type_" #type " *dest, int dstr, " \
+ "type_" #type " *src1, int sstr1, " \
+ "type_" #type " *src2, int sstr2, " \
+ "int n"); \
+OIL_DEFINE_IMPL_REF (vectoradd_s_ ## type ## _ref, vectoradd_s_ ## type);
+
+VECTORADD_S_DEFINE_IMPL (s8,s16);
+VECTORADD_S_DEFINE_IMPL (u8,u16);
+VECTORADD_S_DEFINE_IMPL (s16,s32);
+VECTORADD_S_DEFINE_IMPL (u16,u32);
+//VECTORADD_S_DEFINE_IMPL (s32,s64);
+//VECTORADD_S_DEFINE_IMPL (u32,u64);
+VECTORADD_S_DEFINE_IMPL (f32,f32);
+VECTORADD_S_DEFINE_IMPL (f64,f64);
+
diff --git a/liboil/simdpack/Makefile.am b/liboil/simdpack/Makefile.am
index 852e076..2496f0c 100644
--- a/liboil/simdpack/Makefile.am
+++ b/liboil/simdpack/Makefile.am
@@ -8,23 +8,17 @@ endif
noinst_LTLIBRARIES = libsimdpack.la $(opt_libs)
c_sources = \
- abs.c \
abs_misc.c \
average2_u8.c \
- clip_ref.c \
clip_fast.c \
diffsquaresum_f64.c \
mix_u8.c \
- mult8x8_s16.c \
multsum.c \
- sad8x8.c \
- sad8x8_broken.c \
scalaradd.c \
scalarmult.c \
sincos_f64.c \
squaresum_f64.c \
- sum_f64.c \
- vectoradd_f64.c
+ sum_f64.c
libsimdpack_la_SOURCES = \
$(c_sources) $(i386_sources) $(powerpc_sources) $(amd64_sources)
diff --git a/liboil/simdpack/average2_u8.c b/liboil/simdpack/average2_u8.c
index 3ac8c6a..3fb992f 100644
--- a/liboil/simdpack/average2_u8.c
+++ b/liboil/simdpack/average2_u8.c
@@ -34,23 +34,6 @@
#include <math.h>
-OIL_DEFINE_CLASS (average2_u8,
- "uint8_t * dest, int dstr, uint8_t *src1, int sstr1, "
- "uint8_t *src2, int sstr2, int n");
-
-static void
-average2_u8_ref (uint8_t * dest, int dstr, uint8_t *src1, int sstr1,
- uint8_t *src2, int sstr2, int n)
-{
- int i;
-
- for (i = 0; i < n; i++) {
- dest[dstr * i] = (src1[sstr1 * i] + src2[sstr2 * i]) >> 1;
- }
-}
-
-OIL_DEFINE_IMPL_REF (average2_u8_ref, average2_u8);
-
static void
average2_u8_trick (uint8_t * dest, int dstr, uint8_t *src1, int sstr1,
uint8_t *src2, int sstr2, int n)
diff --git a/liboil/simdpack/diffsquaresum_f64.c b/liboil/simdpack/diffsquaresum_f64.c
index f503ccf..84b7208 100644
--- a/liboil/simdpack/diffsquaresum_f64.c
+++ b/liboil/simdpack/diffsquaresum_f64.c
@@ -33,33 +33,6 @@
#include <liboil/simdpack/simdpack.h>
#include <math.h>
-OIL_DEFINE_CLASS (diffsquaresum_f64,
- "double *d_1, double *src1, int sstr1, double *src2, int sstr2, int n");
-
-static void
-diffsquaresum_f64_ref(double *dest, double *src1, int sstr1, double *src2,
- int sstr2, int n)
-{
- double sum = 0;
- double errsum = 0;
- double tmp;
- double x;
- int i;
-
- for(i=0;i<n;i++){
- x = OIL_GET(src1, i*sstr1, double) -
- OIL_GET(src2, i*sstr2, double);
- x = x*x;
- tmp = sum;
- sum += x;
- errsum += (tmp - sum) + x;
- }
-
- *dest = sum + errsum;
-}
-
-OIL_DEFINE_IMPL_REF (diffsquaresum_f64_ref, diffsquaresum_f64);
-
static void
diffsquaresum_f64_i10_simple(double *dest, double *src1, int sstr1, double *src2,
int sstr2, int n)
diff --git a/liboil/simdpack/mix_u8.c b/liboil/simdpack/mix_u8.c
index 18a1c87..9be3284 100644
--- a/liboil/simdpack/mix_u8.c
+++ b/liboil/simdpack/mix_u8.c
@@ -33,20 +33,6 @@
#include <liboil/simdpack/simdpack.h>
#include <math.h>
-OIL_DEFINE_CLASS (mix_u8,
- "uint8_t *dest, uint8_t *src1, uint8_t *src2, uint8_t *src3, int n");
-
-static void mix_u8_ref(uint8_t *dest, uint8_t *src1, uint8_t *src2, uint8_t *scale, int n)
-{
- int i;
-
- for(i=0;i<n;i++){
- dest[i] = (src1[i]*scale[i] + src2[i]*(255-scale[i]))>>8;
- }
-}
-
-OIL_DEFINE_IMPL_REF (mix_u8_ref, mix_u8);
-
static void mix_u8_fast(uint8_t *dest, uint8_t *src1, uint8_t *src2, uint8_t *scale, int n)
{
while(n>0){
diff --git a/liboil/simdpack/multsum.c b/liboil/simdpack/multsum.c
index 3f6ec9a..89a7c18 100644
--- a/liboil/simdpack/multsum.c
+++ b/liboil/simdpack/multsum.c
@@ -34,37 +34,6 @@
#include <math.h>
-#define MULTSUM_DEFINE_REF(type) \
-static void multsum_ ## type ## _ref( \
- type_ ## type *dest, \
- type_ ## type *src1, int sstr1, \
- type_ ## type *src2, int sstr2, \
- int n) \
-{ \
- int i; \
- double sum = 0; \
- double errsum = 0; \
- for(i=0;i<n;i++){ \
- type_ ## type x; \
- type_ ## type tmp; \
- x = OIL_GET(src1,sstr1*i,type_ ## type) * OIL_GET(src2,sstr2*i,type_ ## type); \
- tmp = sum; \
- sum += x; \
- errsum += (tmp - sum) + x; \
- } \
- *dest = sum + errsum; \
-} \
-OIL_DEFINE_IMPL_REF (multsum_ ## type ## _ref, multsum_ ## type); \
-OIL_DEFINE_CLASS (multsum_ ## type, \
- "type_" #type " *dest, " \
- "type_" #type " *src1, int sstr1, " \
- "type_" #type " *src2, int sstr2, " \
- "int n")
-
-MULTSUM_DEFINE_REF(f32);
-MULTSUM_DEFINE_REF(f64);
-
-
static void multsum_f32_unroll2 (float *dest, float *src1, int sstr1,
float *src2, int sstr2, int n)
{
diff --git a/liboil/simdpack/scalaradd.c b/liboil/simdpack/scalaradd.c
index f5f8857..2aca691 100644
--- a/liboil/simdpack/scalaradd.c
+++ b/liboil/simdpack/scalaradd.c
@@ -32,34 +32,6 @@
#include <liboil/liboilfunction.h>
#include <liboil/simdpack/simdpack.h>
-#define SCALARADD_DEFINE_REF(type) \
-static void scalaradd_ ## type ## _ref( \
- type_ ## type *dest, int dstr, \
- type_ ## type *src, int sstr, \
- type_ ## type *val, int n) \
-{ \
- int i; \
- for(i=0;i<n;i++){ \
- OIL_GET(dest,dstr*i, type_ ## type) = \
- OIL_GET(src,sstr*i, type_ ## type) + *val; \
- } \
-} \
-OIL_DEFINE_CLASS (scalaradd_ ## type, \
- "type_" #type " *dest, int dstr, " \
- "type_" #type " *src, int sstr, " \
- "type_" #type " *s2_1 int n"); \
-OIL_DEFINE_IMPL_REF (scalaradd_ ## type ## _ref, scalaradd_ ## type);
-
-
-SCALARADD_DEFINE_REF (s8);
-SCALARADD_DEFINE_REF (u8);
-SCALARADD_DEFINE_REF (s16);
-SCALARADD_DEFINE_REF (u16);
-SCALARADD_DEFINE_REF (s32);
-SCALARADD_DEFINE_REF (u32);
-SCALARADD_DEFINE_REF (f32);
-SCALARADD_DEFINE_REF (f64);
-
#define SCALARADD_DEFINE_UNROLL2(type) \
static void scalaradd_ ## type ## _unroll2( \
type_ ## type *dest, int dstr, \
diff --git a/liboil/simdpack/scalarmult.c b/liboil/simdpack/scalarmult.c
index 130fdb0..255b2ee 100644
--- a/liboil/simdpack/scalarmult.c
+++ b/liboil/simdpack/scalarmult.c
@@ -32,33 +32,6 @@
#include <liboil/liboilfunction.h>
#include <liboil/simdpack/simdpack.h>
-#define SCALARMULT_DEFINE_REF(type) \
-static void scalarmult_ ## type ## _ref( \
- type_ ## type *dest, int dstr, \
- type_ ## type *src, int sstr, \
- type_ ## type *val, int n) \
-{ \
- int i; \
- for(i=0;i<n;i++){ \
- OIL_GET(dest,dstr*i,type_ ## type) = OIL_GET(src,sstr*i,type_ ## type) * *val; \
- } \
-} \
-OIL_DEFINE_CLASS(scalarmult_ ## type, \
- "type_" #type " *dest, int dstr, " \
- "type_" #type " *src, int sstr, " \
- "type_" #type " *s2_1, int n"); \
-OIL_DEFINE_IMPL_REF (scalarmult_ ## type ## _ref, scalarmult_ ## type);
-
-
-SCALARMULT_DEFINE_REF (s8);
-SCALARMULT_DEFINE_REF (u8);
-SCALARMULT_DEFINE_REF (s16);
-SCALARMULT_DEFINE_REF (u16);
-SCALARMULT_DEFINE_REF (s32);
-SCALARMULT_DEFINE_REF (u32);
-SCALARMULT_DEFINE_REF (f32);
-SCALARMULT_DEFINE_REF (f64);
-
#define SCALARMULT_DEFINE_UNROLL2(type) \
static void scalarmult_ ## type ## _unroll2( \
type_ ## type *dest, int dstr, \
diff --git a/liboil/simdpack/sincos_f64.c b/liboil/simdpack/sincos_f64.c
index d76839b..7ada598 100644
--- a/liboil/simdpack/sincos_f64.c
+++ b/liboil/simdpack/sincos_f64.c
@@ -30,26 +30,9 @@
#endif
#include <liboil/liboilfunction.h>
+#include <liboil/liboilclasses.h>
#include <math.h>
-OIL_DEFINE_CLASS (sincos_f64,
- "double *dest1, double *dest2, int n, double *s1_1, double *s2_1");
-
-static void
-sincos_f64_ref (double *dest_sin, double *dest_cos, int n, double *offset,
- double *interval)
-{
- int i;
- double x;
-
- for(i=0;i<n;i++){
- x = *offset + *interval * i;
- dest_sin[i] = sin(x);
- dest_cos[i] = cos(x);
- }
-}
-OIL_DEFINE_IMPL_REF (sincos_f64_ref, sincos_f64);
-
/* XXX This gets more inaccurate as N increases */
static void
sincos_f64_i20_fast(double *dest_sin, double *dest_cos, int n, double *offset,
@@ -71,7 +54,7 @@ sincos_f64_i20_fast(double *dest_sin, double *dest_cos, int n, double *offset,
}
OIL_DEFINE_IMPL (sincos_f64_i20_fast, sincos_f64);
-#ifdef _GNU_SOURCE
+#ifdef HAVE_SINCOS
static void
sincos_f64_sincos (double *dest_sin, double *dest_cos, int n, double *offset,
double *interval)
diff --git a/liboil/simdpack/squaresum_f64.c b/liboil/simdpack/squaresum_f64.c
index a1cd6f0..d6ce38b 100644
--- a/liboil/simdpack/squaresum_f64.c
+++ b/liboil/simdpack/squaresum_f64.c
@@ -33,29 +33,6 @@
#include <liboil/simdpack/simdpack.h>
#include <math.h>
-
-OIL_DEFINE_CLASS (squaresum_f64, "double *dest, double *src, int n");
-
-static void
-squaresum_f64_ref(double *dest, double *src, int n)
-{
- double sum2 = 0;
- double errsum = 0;
- double tmp;
- double x;
- int i;
-
- for(i=0;i<n;i++){
- tmp = sum2;
- x = src[i]*src[i];
- sum2 += x;
- errsum += (tmp - sum2) + x;
- }
-
- *dest = sum2 + errsum;
-}
-OIL_DEFINE_IMPL_REF (squaresum_f64_ref, squaresum_f64);
-
static void
squaresum_f64_i10_simple(double *dest, double *src, int n)
{
diff --git a/liboil/simdpack/sum_f64.c b/liboil/simdpack/sum_f64.c
index 078f466..77db52c 100644
--- a/liboil/simdpack/sum_f64.c
+++ b/liboil/simdpack/sum_f64.c
@@ -33,27 +33,6 @@
#include <liboil/simdpack/simdpack.h>
#include <math.h>
-OIL_DEFINE_CLASS (sum_f64, "double *dest, double *src, int sstr, int n");
-//OIL_DEFINE_CLASS (sum_f64_i10, "double *dest, double *src, int sstr, int n");
-
-static void
-sum_f64_ref (double *dest, double *src, int sstr, int n)
-{
- double sum = 0;
- double errsum = 0;
- double tmp;
- int i;
-
- for(i=0;i<n;i++){
- tmp = sum;
- sum += OIL_GET(src, sstr*i, double);
- errsum += (tmp - sum) + OIL_GET(src, sstr*i, double);
- }
-
- *dest = sum + errsum;
-}
-OIL_DEFINE_IMPL_REF (sum_f64_ref, sum_f64);
-
static void
sum_f64_i10_simple (double *dest, double *src, int sstr, int n)
{
diff --git a/liboil/simdpack/vectoradd_s.c b/liboil/simdpack/vectoradd_s.c
deleted file mode 100644
index 2c45b5b..0000000
--- a/liboil/simdpack/vectoradd_s.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <liboil/liboilfunction.h>
-#include <liboil/simdpack/simdpack.h>
-#include <liboil/liboilgcc.h>
-
-#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
-#define type_min_f32 -1.0
-#define type_max_f32 1.0
-#define type_min_f64 -1.0
-#define type_max_f64 1.0
-
-#define VECTORADD_S_DEFINE_IMPL(type,bigger) \
-static void vectoradd_s_ ## type ## _ref ( \
- type_ ## type *dest, int dstr, \
- type_ ## type *src1, int sstr1, \
- type_ ## type *src2, int sstr2, \
- int n) \
-{ \
- int i; \
- for(i=0;i<n;i++) { \
- OIL_GET(dest,i*dstr, type_ ## type) = CLAMP((type_ ## bigger)OIL_GET(src1,i*sstr1, type_ ## type) + \
- (type_ ## bigger)OIL_GET(src2,i*sstr2, type_ ## type),type_min_ ## type, type_max_ ## type); \
- } \
-} \
-OIL_DEFINE_CLASS (vectoradd_s_ ## type, \
- "type_" #type " *dest, int dstr, " \
- "type_" #type " *src1, int sstr1, " \
- "type_" #type " *src2, int sstr2, " \
- "int n"); \
-OIL_DEFINE_IMPL_REF (vectoradd_s_ ## type ## _ref, vectoradd_s_ ## type);
-
-VECTORADD_S_DEFINE_IMPL (s8,s16);
-VECTORADD_S_DEFINE_IMPL (u8,u16);
-VECTORADD_S_DEFINE_IMPL (s16,s32);
-VECTORADD_S_DEFINE_IMPL (u16,u32);
-//VECTORADD_S_DEFINE_IMPL (s32,s64);
-//VECTORADD_S_DEFINE_IMPL (u32,u64);
-VECTORADD_S_DEFINE_IMPL (f32,f32);
-VECTORADD_S_DEFINE_IMPL (f64,f64);
-