summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2005-04-26 23:05:36 +0000
committerDavid Schleef <ds@schleef.org>2005-04-26 23:05:36 +0000
commitd580485d8c617dd469d127cc1bdbdc99f076d3e3 (patch)
tree48ab6c48475ef0043fb1e6c954c7e56df04e3abb
parente43f9e15aae422b71ce90ea15a05738cbab7c542 (diff)
downloadliboil-d580485d8c617dd469d127cc1bdbdc99f076d3e3.tar.gz
* configure.ac: version bump
* doc/xml/liboilfunction.xml: update * liboil/Makefile.am: install a few more headers * liboil/build_prototypes.c: (main): Make sure we print "void" for oil_null() function prototype. * liboil/dct/fdct8x8_f64.c: (fdct8x8_f64_1d): * liboil/dct/fdct8x8s_s16.c: * liboil/dct/idct8x8_c.c: (idct8x8_f64_ref), (idct8x8lim10_f64_ref), (idct8x8_s16_ref), (idct8x8lim10_s16_ref): * liboil/liboilcpu.c: (test_cpuid), (oil_cpu_i386_getflags_cpuid): remember to disable fault checking. * liboil/liboilfuncs.h: update * liboil/liboilfunction.c: (oil_class_optimize), (oil_class_register_impl_by_name), (oil_class_register_impl): Better error checking. Allow registration by class, since we allow unregistered classes. * liboil/liboilfunction.h: same * liboil/liboilmarshal.c: (_oil_test_marshal_function): update * liboil/liboiltest.c: (oil_test_check_ref): better error checking * liboil/simdpack/Makefile.am: add sad8x8_broken.c * liboil/simdpack/clip_ref.c: Add a test function to make sure low < high. * liboil/simdpack/sad8x8.c: (sad8x8_f64_2_ref), (sad8x8_s16_2_ref), (sad8x8_u8_ref): Deprecate old classes, because the prototypes are strangely wrong. Replace with new, correct class definitions. Add a new u8 class. * liboil/simdpack/sad8x8_broken.c: (sad8x8_f64_ref), (sad8x8_s16_ref): Move old classes here.
-rw-r--r--ChangeLog31
-rw-r--r--configure.ac2
-rw-r--r--doc/xml/liboilfunction.xml4
-rw-r--r--liboil/Makefile.am2
-rw-r--r--liboil/build_prototypes.c4
-rw-r--r--liboil/dct/fdct8x8_f64.c3
-rw-r--r--liboil/dct/fdct8x8s_s16.c2
-rw-r--r--liboil/dct/idct8x8_c.c68
-rw-r--r--liboil/liboilcpu.c8
-rw-r--r--liboil/liboilfuncs.h17
-rw-r--r--liboil/liboilfunction.c23
-rw-r--r--liboil/liboilfunction.h1
-rw-r--r--liboil/liboilmarshal.c6
-rw-r--r--liboil/liboiltest.c8
-rw-r--r--liboil/simdpack/Makefile.am1
-rw-r--r--liboil/simdpack/clip_ref.c19
-rw-r--r--liboil/simdpack/sad8x8.c81
-rw-r--r--liboil/simdpack/sad8x8_broken.c81
18 files changed, 314 insertions, 47 deletions
diff --git a/ChangeLog b/ChangeLog
index d820689..ed12680 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+2005-04-26 David Schleef <ds@schleef.org>
+
+ * configure.ac: version bump
+ * doc/xml/liboilfunction.xml: update
+ * liboil/Makefile.am: install a few more headers
+ * liboil/build_prototypes.c: (main): Make sure we print "void" for
+ oil_null() function prototype.
+ * liboil/dct/fdct8x8_f64.c: (fdct8x8_f64_1d):
+ * liboil/dct/fdct8x8s_s16.c:
+ * liboil/dct/idct8x8_c.c: (idct8x8_f64_ref),
+ (idct8x8lim10_f64_ref), (idct8x8_s16_ref), (idct8x8lim10_s16_ref):
+ * liboil/liboilcpu.c: (test_cpuid), (oil_cpu_i386_getflags_cpuid):
+ remember to disable fault checking.
+ * liboil/liboilfuncs.h: update
+ * liboil/liboilfunction.c: (oil_class_optimize),
+ (oil_class_register_impl_by_name), (oil_class_register_impl):
+ Better error checking. Allow registration by class, since we
+ allow unregistered classes.
+ * liboil/liboilfunction.h: same
+ * liboil/liboilmarshal.c: (_oil_test_marshal_function): update
+ * liboil/liboiltest.c: (oil_test_check_ref): better error checking
+ * liboil/simdpack/Makefile.am: add sad8x8_broken.c
+ * liboil/simdpack/clip_ref.c: Add a test function to make sure
+ low < high.
+ * liboil/simdpack/sad8x8.c: (sad8x8_f64_2_ref), (sad8x8_s16_2_ref),
+ (sad8x8_u8_ref): Deprecate old classes, because the prototypes are
+ strangely wrong. Replace with new, correct class definitions.
+ Add a new u8 class.
+ * liboil/simdpack/sad8x8_broken.c: (sad8x8_f64_ref),
+ (sad8x8_s16_ref): Move old classes here.
+
2005-03-24 David Schleef <ds@schleef.org>
* liboil/liboilcpu.c: (get_proc_cpuinfo),
diff --git a/configure.ac b/configure.ac
index 96bf7ef..cb4697b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ([2.58])
-AC_INIT(liboil,0.3.1)
+AC_INIT(liboil,0.3.1.1)
AS_NANO(LIBOIL_CVS=no,LIBOIL_CVS=yes)
diff --git a/doc/xml/liboilfunction.xml b/doc/xml/liboilfunction.xml
index 96aa676..7a7b026 100644
--- a/doc/xml/liboilfunction.xml
+++ b/doc/xml/liboilfunction.xml
@@ -544,12 +544,12 @@ not changed.</para>
<link linkend="OilFunctionImpl">OilFunctionImpl</link> *impl);</programlisting>
<para>
Adds <parameter>impl</parameter> to the list of implementations associated with
-the function class given by <parameter>klass_name</parameter>.</para>
+the function class given by <parameter>klass</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>klass_name</parameter>&nbsp;:</term>
-<listitem><simpara> the name of the class
+<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>impl</parameter>&nbsp;:</term>
<listitem><simpara> an implementation
diff --git a/liboil/Makefile.am b/liboil/Makefile.am
index d2d9f0d..d5e2de9 100644
--- a/liboil/Makefile.am
+++ b/liboil/Makefile.am
@@ -11,7 +11,7 @@ noinst_PROGRAMS = build_prototypes build_prototypes_doc build_marshal
pkginclude_HEADERS = liboil.h liboilfunction.h liboildebug.h liboilfuncs.h \
liboiltypes.h liboilcpu.h liboilprototype.h liboilparameter.h \
- liboilrandom.h liboilgcc.h
+ liboilrandom.h liboilgcc.h liboiltest.h liboilprofile.h
nodist_noinst_HEADERS = liboilfuncs-doc.h
diff --git a/liboil/build_prototypes.c b/liboil/build_prototypes.c
index 0cf8646..63e5187 100644
--- a/liboil/build_prototypes.c
+++ b/liboil/build_prototypes.c
@@ -57,6 +57,10 @@ int main (int argc, char *argv[])
proto = oil_prototype_from_string (klass->prototype);
if (proto) {
string = oil_prototype_to_string (proto);
+ if (strlen (string) == 0) {
+ free (string);
+ string = strdup("void");
+ }
printf ("extern OilFunctionClass *oil_function_class_ptr_%s;\n",
klass->name);
diff --git a/liboil/dct/fdct8x8_f64.c b/liboil/dct/fdct8x8_f64.c
index 4e4938d..d6f3b38 100644
--- a/liboil/dct/fdct8x8_f64.c
+++ b/liboil/dct/fdct8x8_f64.c
@@ -126,6 +126,7 @@ fdct8x8_f64_ref2(double *dest, int dstr, double *src, int sstr)
OIL_DEFINE_IMPL (fdct8x8_f64_ref2, fdct8x8_f64);
+#ifdef oil_fdct8_f64
static void
fdct8x8_f64_1d (double *dest, int dstr, double *src, int sstr)
{
@@ -142,7 +143,7 @@ fdct8x8_f64_1d (double *dest, int dstr, double *src, int sstr)
dstr, 8*sizeof(double));
}
}
-
OIL_DEFINE_IMPL (fdct8x8_f64_1d, fdct8x8_f64);
+#endif
diff --git a/liboil/dct/fdct8x8s_s16.c b/liboil/dct/fdct8x8s_s16.c
index cc6bb54..4e522b4 100644
--- a/liboil/dct/fdct8x8s_s16.c
+++ b/liboil/dct/fdct8x8s_s16.c
@@ -51,6 +51,7 @@ Alternate scaling used by RTjpeg.
OIL_DEFINE_CLASS(fdct8x8s_s16,
"int16_t *d_8x8, int ds, int16_t *s_8x8, int ss");
+#if defined(oil_fdct8x8_f64) && defined(oil_conv8x8_s16_f64)
static void
fdct8x8s_s16_ref (int16_t *dest, int dstr, int16_t *src, int sstr)
{
@@ -85,5 +86,6 @@ fdct8x8s_s16_ref (int16_t *dest, int dstr, int16_t *src, int sstr)
}
OIL_DEFINE_IMPL_REF (fdct8x8s_s16_ref, fdct8x8s_s16);
+#endif
diff --git a/liboil/dct/idct8x8_c.c b/liboil/dct/idct8x8_c.c
index bc490f9..96efe00 100644
--- a/liboil/dct/idct8x8_c.c
+++ b/liboil/dct/idct8x8_c.c
@@ -44,10 +44,12 @@
(*((int16_t *)((void *)ptr + stride*row) + column))
OIL_DEFINE_CLASS (idct8x8_f64, "double *d_8x8, int dstr, double *s_8x8, int sstr");
+OIL_DEFINE_CLASS (idct8x8lim10_f64, "double *d_8x8, int dstr, double *s_8x8, int sstr");
OIL_DEFINE_CLASS (idct8x8_s16, "int16_t *d_8x8, int dstr, int16_t *s_8x8, int sstr");
+OIL_DEFINE_CLASS (idct8x8lim10_s16, "int16_t *d_8x8, int dstr, int16_t *s_8x8, int sstr");
static void
-idct8x8_f64_slow (double *dest, int dstr, double *src, int sstr)
+idct8x8_f64_ref (double *dest, int dstr, double *src, int sstr)
{
static double idct_coeff[8][8];
static int idct_coeff_init = 0;
@@ -82,8 +84,45 @@ idct8x8_f64_slow (double *dest, int dstr, double *src, int sstr)
}
}
}
+OIL_DEFINE_IMPL_REF (idct8x8_f64_ref, idct8x8_f64);
-OIL_DEFINE_IMPL_REF (idct8x8_f64_slow, idct8x8_f64);
+static void
+idct8x8lim10_f64_ref (double *dest, int dstr, double *src, int sstr)
+{
+ static double idct_coeff[8][8];
+ static int idct_coeff_init = 0;
+ int i,j,k,l;
+ double tmp1,tmp2;
+
+ if(!idct_coeff_init){
+ double scale;
+
+ for(i=0;i<8;i++){
+ scale = (i==0) ? sqrt(0.125) : 0.5;
+ for(j=0;j<8;j++){
+ idct_coeff[j][i] = scale *
+ cos((M_PI/8)*i*(j+0.5));
+ }
+ }
+ idct_coeff_init = 1;
+ }
+
+ for(i=0;i<8;i++){
+ for(j=0;j<8;j++){
+ tmp1 = 0;
+ for(k=0;k<4;k++){
+ tmp2 = 0;
+ for(l=0;l<4;l++){
+ tmp2 += idct_coeff[j][l] *
+ BLOCK8x8_F64(src,sstr,k,l);
+ }
+ tmp1 += idct_coeff[i][k] * tmp2;
+ }
+ BLOCK8x8_F64(dest,dstr,i,j) = tmp1;
+ }
+ }
+}
+OIL_DEFINE_IMPL_REF (idct8x8lim10_f64_ref, idct8x8lim10_f64);
#if defined(oil_idct8_f64)
static void
@@ -111,7 +150,7 @@ OIL_DEFINE_IMPL_DEPENDS (idct8x8_f64_c, idct8x8_f64, idct8_f64);
#if defined(oil_conv8x8_f64_s16) && defined(oil_idct8x8_f64) && \
defined(oil_conv8x8_s16_f64)
static void
-idct8x8_s16_slow (int16_t *dest, int dstr, int16_t *src, int sstr)
+idct8x8_s16_ref (int16_t *dest, int dstr, int16_t *src, int sstr)
{
double s[64], d[64];
@@ -120,9 +159,28 @@ idct8x8_s16_slow (int16_t *dest, int dstr, int16_t *src, int sstr)
oil_conv8x8_s16_f64 (dest,dstr,d,8*sizeof(double));
}
-OIL_DEFINE_IMPL_REF (idct8x8_s16_slow, idct8x8_s16);
+OIL_DEFINE_IMPL_REF (idct8x8_s16_ref, idct8x8_s16);
+#if 0
+OIL_DEFINE_IMPL_DEPENDS (idct8x8_s16_ref, idct8x8_s16,
+ conv8x8_f64_s16, idct8x8_f64, conv8x8_s16_f64);
+#endif
+#endif
+
+#if defined(oil_conv8x8_f64_s16) && defined(oil_idct8x8lim10_f64) && \
+ defined(oil_conv8x8_s16_f64)
+static void
+idct8x8lim10_s16_ref (int16_t *dest, int dstr, int16_t *src, int sstr)
+{
+ double s[64], d[64];
+
+ oil_conv8x8_f64_s16 (s,8*sizeof(double),src,sstr);
+ oil_idct8x8lim10_f64 (d,8*sizeof(double),s,8*sizeof(double));
+ oil_conv8x8_s16_f64 (dest,dstr,d,8*sizeof(double));
+}
+
+OIL_DEFINE_IMPL_REF (idct8x8lim10_s16_ref, idct8x8lim10_s16);
#if 0
-OIL_DEFINE_IMPL_DEPENDS (idct8x8_s16_slow, idct8x8_s16,
+OIL_DEFINE_IMPL_DEPENDS (idct8x8_s16_ref, idct8x8_s16,
conv8x8_f64_s16, idct8x8_f64, conv8x8_s16_f64);
#endif
#endif
diff --git a/liboil/liboilcpu.c b/liboil/liboilcpu.c
index ddf4962..dcf53e6 100644
--- a/liboil/liboilcpu.c
+++ b/liboil/liboilcpu.c
@@ -134,7 +134,7 @@ get_cpuid (uint32_t op, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d)
}
static void
-test_cpuid (void)
+test_cpuid (void *ignored)
{
uint32_t eax, ebx, ecx, edx;
@@ -147,13 +147,15 @@ oil_cpu_i386_getflags_cpuid (void)
uint32_t eax, ebx, ecx, edx;
int level;
char vendor[13];
+ int ret;
oil_cpu_fault_check_enable ();
- if (!oil_cpu_fault_check_try(test_cpuid, NULL)) {
+ ret = oil_cpu_fault_check_try(test_cpuid, NULL);
+ oil_cpu_fault_check_disable ();
+ if (!ret) {
/* CPU thinks cpuid is an illegal instruction. */
return;
}
- oil_cpu_fault_check_disable ();
get_cpuid (0x00000000, &level, (uint32_t *)(vendor+0),
(uint32_t *)(vendor+8), (uint32_t *)(vendor+4));
diff --git a/liboil/liboilfuncs.h b/liboil/liboilfuncs.h
index dac4856..35d47a9 100644
--- a/liboil/liboilfuncs.h
+++ b/liboil/liboilfuncs.h
@@ -381,6 +381,12 @@ typedef void (*_oil_type_idct8x8_f64)(double * d_8x8, int dstr, const double * s
extern OilFunctionClass *oil_function_class_ptr_idct8x8_s16;
typedef void (*_oil_type_idct8x8_s16)(int16_t * d_8x8, int dstr, const int16_t * s_8x8, int sstr);
#define oil_idct8x8_s16 ((_oil_type_idct8x8_s16)(*(void **)oil_function_class_ptr_idct8x8_s16))
+extern OilFunctionClass *oil_function_class_ptr_idct8x8lim10_f64;
+typedef void (*_oil_type_idct8x8lim10_f64)(double * d_8x8, int dstr, const double * s_8x8, int sstr);
+#define oil_idct8x8lim10_f64 ((_oil_type_idct8x8lim10_f64)(*(void **)oil_function_class_ptr_idct8x8lim10_f64))
+extern OilFunctionClass *oil_function_class_ptr_idct8x8lim10_s16;
+typedef void (*_oil_type_idct8x8lim10_s16)(int16_t * d_8x8, int dstr, const int16_t * s_8x8, int sstr);
+#define oil_idct8x8lim10_s16 ((_oil_type_idct8x8lim10_s16)(*(void **)oil_function_class_ptr_idct8x8lim10_s16))
extern OilFunctionClass *oil_function_class_ptr_imdct12_f64;
typedef void (*_oil_type_imdct12_f64)(double * d_12, const double * s_6);
#define oil_imdct12_f64 ((_oil_type_imdct12_f64)(*(void **)oil_function_class_ptr_imdct12_f64))
@@ -412,7 +418,7 @@ extern OilFunctionClass *oil_function_class_ptr_multsum_f64;
typedef void (*_oil_type_multsum_f64)(double * dest, const double * src1, int sstr1, const double * src2, int sstr2, int n);
#define oil_multsum_f64 ((_oil_type_multsum_f64)(*(void **)oil_function_class_ptr_multsum_f64))
extern OilFunctionClass *oil_function_class_ptr_null;
-typedef void (*_oil_type_null)();
+typedef void (*_oil_type_null)(void);
#define oil_null ((_oil_type_null)(*(void **)oil_function_class_ptr_null))
extern OilFunctionClass *oil_function_class_ptr_permute_f32;
typedef void (*_oil_type_permute_f32)(float * dest, int dstr, const float * src1, int sstr1, const int32_t * src2, int sstr2, int n);
@@ -447,9 +453,18 @@ typedef void (*_oil_type_rgb2rgba)(uint8_t * d_4xn, const uint8_t * s_3xn, int n
extern OilFunctionClass *oil_function_class_ptr_sad8x8_f64;
typedef void (*_oil_type_sad8x8_f64)(double * d_8x8, int ds, const double * s1_8x8, int ss1, const double * s2_8x8, int ss2);
#define oil_sad8x8_f64 ((_oil_type_sad8x8_f64)(*(void **)oil_function_class_ptr_sad8x8_f64))
+extern OilFunctionClass *oil_function_class_ptr_sad8x8_f64_2;
+typedef void (*_oil_type_sad8x8_f64_2)(double * d_1, const double * s1_8x8, int ss1, const double * s2_8x8, int ss2);
+#define oil_sad8x8_f64_2 ((_oil_type_sad8x8_f64_2)(*(void **)oil_function_class_ptr_sad8x8_f64_2))
extern OilFunctionClass *oil_function_class_ptr_sad8x8_s16;
typedef void (*_oil_type_sad8x8_s16)(uint32_t * d_8x8, int ds, const int16_t * s1_8x8, int ss1, const int16_t * s2_8x8, int ss2);
#define oil_sad8x8_s16 ((_oil_type_sad8x8_s16)(*(void **)oil_function_class_ptr_sad8x8_s16))
+extern OilFunctionClass *oil_function_class_ptr_sad8x8_s16_2;
+typedef void (*_oil_type_sad8x8_s16_2)(uint32_t * d_1, const int16_t * s1_8x8, int ss1, const int16_t * s2_8x8, int ss2);
+#define oil_sad8x8_s16_2 ((_oil_type_sad8x8_s16_2)(*(void **)oil_function_class_ptr_sad8x8_s16_2))
+extern OilFunctionClass *oil_function_class_ptr_sad8x8_u8;
+typedef void (*_oil_type_sad8x8_u8)(uint32_t * d_1, const uint8_t * s1_8x8, int ss1, const uint8_t * s2_8x8, int ss2);
+#define oil_sad8x8_u8 ((_oil_type_sad8x8_u8)(*(void **)oil_function_class_ptr_sad8x8_u8))
extern OilFunctionClass *oil_function_class_ptr_scalaradd_f32;
typedef void (*_oil_type_scalaradd_f32)(float * dest, int dstr, const float * src, int sstr, const float * s2_1, int n);
#define oil_scalaradd_f32 ((_oil_type_scalaradd_f32)(*(void **)oil_function_class_ptr_scalaradd_f32))
diff --git a/liboil/liboilfunction.c b/liboil/liboilfunction.c
index 9245a97..11c4251 100644
--- a/liboil/liboilfunction.c
+++ b/liboil/liboilfunction.c
@@ -245,6 +245,10 @@ oil_class_optimize (OilFunctionClass * klass)
OIL_DEBUG ("optimizing class %s", klass->name);
+ if (klass->reference_impl == NULL) {
+ OIL_ERROR ("class %s has no reference implmentation", klass->name);
+ return;
+ }
if (klass->first_impl == NULL) {
OIL_ERROR ("class %s has no implmentations", klass->name);
return;
@@ -278,6 +282,11 @@ oil_class_optimize (OilFunctionClass * klass)
impl->flags |= OIL_IMPL_FLAG_DISABLED;
}
}
+ if (min_impl == NULL) {
+ OIL_ERROR ("failed to find optimal implementation for class %s",
+ klass->name);
+ return;
+ }
klass->chosen_impl = min_impl;
klass->func = min_impl->func;
@@ -340,6 +349,20 @@ oil_class_register_impl_by_name (const char *klass_name, OilFunctionImpl *impl)
klass = oil_class_get (klass_name);
if (klass == NULL) return;
+ oil_class_register_impl (klass, impl);
+}
+
+/**
+ * oil_class_register_impl_by_name:
+ * @klass: the class
+ * @impl: an implementation
+ *
+ * Adds @impl to the list of implementations associated with
+ * the function class given by @klass.
+ */
+void
+oil_class_register_impl (OilFunctionClass *klass, OilFunctionImpl *impl)
+{
impl->klass = klass;
impl->next = impl->klass->first_impl;
klass->first_impl = impl;
diff --git a/liboil/liboilfunction.h b/liboil/liboilfunction.h
index 6baacbe..4a1be76 100644
--- a/liboil/liboilfunction.h
+++ b/liboil/liboilfunction.h
@@ -154,6 +154,7 @@ int oil_impl_is_runnable (OilFunctionImpl *impl);
void oil_class_choose_by_name (OilFunctionClass * klass, const char *name);
+void oil_class_register_impl (OilFunctionClass * klass, OilFunctionImpl *impl);
void oil_class_register_impl_by_name (const char *klass_name,
OilFunctionImpl *impl);
diff --git a/liboil/liboilmarshal.c b/liboil/liboilmarshal.c
index 00956ad..3631aa6 100644
--- a/liboil/liboilmarshal.c
+++ b/liboil/liboilmarshal.c
@@ -118,6 +118,12 @@ _oil_test_marshal_function (void *func, unsigned long *args, int n_args,
();
oil_profile_stop (prof);
break;
+ case 0x003a:
+ oil_profile_start (prof);
+ ((void (*)(void *,void *,int,void *,int))func)
+ ((void *)args[0],(void *)args[1],(int)args[2],(void *)args[3],(int)args[4]);
+ oil_profile_stop (prof);
+ break;
case 0x003b:
oil_profile_start (prof);
((void (*)(void *,void *,int,void *,void *))func)
diff --git a/liboil/liboiltest.c b/liboil/liboiltest.c
index 7041b36..5e3d13d 100644
--- a/liboil/liboiltest.c
+++ b/liboil/liboiltest.c
@@ -186,7 +186,13 @@ oil_test_check_ref (OilTest *test)
int i;
if (test->proto->n_params > 10) {
- OIL_ERROR ("function has too many parameters");
+ OIL_ERROR ("function class %s has too many parameters",
+ test->klass->name);
+ return;
+ }
+ if (test->klass->reference_impl == NULL) {
+ OIL_ERROR ("function class %s has no reference implementation",
+ test->klass->name);
return;
}
diff --git a/liboil/simdpack/Makefile.am b/liboil/simdpack/Makefile.am
index f923315..573589a 100644
--- a/liboil/simdpack/Makefile.am
+++ b/liboil/simdpack/Makefile.am
@@ -18,6 +18,7 @@ c_sources = \
mult8x8_s16.c \
multsum.c \
sad8x8.c \
+ sad8x8_broken.c \
scalaradd.c \
scalarmult.c \
sincos_f64.c \
diff --git a/liboil/simdpack/clip_ref.c b/liboil/simdpack/clip_ref.c
index 461edaa..35e8f72 100644
--- a/liboil/simdpack/clip_ref.c
+++ b/liboil/simdpack/clip_ref.c
@@ -30,6 +30,7 @@
#endif
#include <liboil/liboilfunction.h>
+#include <liboil/liboiltest.h>
#define CLIP_DEFINE_REF(type) \
static void clip_ ## type ## _ref ( \
@@ -48,12 +49,26 @@ static void clip_ ## type ## _ref ( \
OIL_GET(dest,i*dstr,type_ ## type) = x; \
} \
} \
-OIL_DEFINE_CLASS(clip_ ## type, \
+static void clip_ ## type ## _test (OilTest *test) \
+{ \
+ type_ ## type *lo = (type_ ## type *) \
+ (test->params[OIL_ARG_SRC2].src_data + OIL_TEST_HEADER); \
+ type_ ## type *hi = (type_ ## type *) \
+ (test->params[OIL_ARG_SRC3].src_data + OIL_TEST_HEADER); \
+ if (*lo > *hi) { \
+ type_ ## type tmp; \
+ tmp = *lo; \
+ *lo = *hi; \
+ *hi = tmp; \
+ } \
+} \
+OIL_DEFINE_CLASS_FULL(clip_ ## type, \
"type_" #type " *dest, " \
"int dstr, " \
"type_" #type " *src, " \
"int sstr, int n, " \
- "type_" #type " *s2_1, type_" #type " *s3_1"); \
+ "type_" #type " *s2_1, type_" #type " *s3_1", \
+ clip_ ## type ## _test); \
OIL_DEFINE_IMPL_REF(clip_ ## type ## _ref, clip_ ## type)
CLIP_DEFINE_REF (s8);
diff --git a/liboil/simdpack/sad8x8.c b/liboil/simdpack/sad8x8.c
index b0b8a94..a8e1caf 100644
--- a/liboil/simdpack/sad8x8.c
+++ b/liboil/simdpack/sad8x8.c
@@ -34,48 +34,69 @@
#include <math.h>
-OIL_DEFINE_CLASS (sad8x8_s16,
- "uint32_t *d_8x8, int ds, int16_t *s1_8x8, int ss1, int16_t *s2_8x8, int ss2");
-OIL_DEFINE_CLASS (sad8x8_f64,
- "double *d_8x8, int ds, double *s1_8x8, int ss1, double *s2_8x8, int ss2");
+OIL_DEFINE_CLASS (sad8x8_u8,
+ "uint32_t *d_1, uint8_t *s1_8x8, int ss1, uint8_t *s2_8x8, int ss2");
+OIL_DEFINE_CLASS (sad8x8_s16_2,
+ "uint32_t *d_1, int16_t *s1_8x8, int ss1, int16_t *s2_8x8, int ss2");
+OIL_DEFINE_CLASS (sad8x8_f64_2,
+ "double *d_1, double *s1_8x8, int ss1, double *s2_8x8, int ss2");
static void
-sad8x8_f64_ref(double *dest, int dstr, double *src1, int sstr1, double *src2,
+sad8x8_f64_2_ref (double *dest, double *src1, int sstr1, double *src2,
int sstr2)
{
- int i,j;
- double sum;
+ int i, j;
+ double sum;
- sum = 0;
- for(i=0;i<8;i++){
- for(j=0;j<8;j++){
- sum += fabs(OIL_GET(src1,sstr1*i+j*sizeof(double), double) -
- OIL_GET(src2,sstr2*i+j*sizeof(double), double));
- }
- }
- *dest = sum;
+ sum = 0;
+ for (i = 0; i < 8; i++) {
+ for (j = 0; j < 8; j++) {
+ sum += fabs (OIL_GET (src1, sstr1 * i + j * sizeof (double), double) -
+ OIL_GET (src2, sstr2 * i + j * sizeof (double), double));
+ }
+ }
+ *dest = sum;
}
-OIL_DEFINE_IMPL_REF(sad8x8_f64_ref, sad8x8_f64);
+OIL_DEFINE_IMPL_REF (sad8x8_f64_2_ref, sad8x8_f64_2);
static void
-sad8x8_s16_ref(uint32_t *dest, int dstr, int16_t *src1, int sstr1, int16_t *src2,
+sad8x8_s16_2_ref (uint32_t * dest, int16_t * src1, int sstr1, int16_t * src2,
int sstr2)
{
- int i,j;
- int d;
- uint32_t sum;
+ int i, j;
+ int d;
+ uint32_t sum;
- sum = 0;
- for(i=0;i<8;i++){
- for(j=0;j<8;j++){
- d = ((int)OIL_GET(src1,sstr1*i+j*sizeof(int16_t), int16_t)) -
- ((int)OIL_GET(src2,sstr2*i+j*sizeof(int16_t), int16_t));
- sum += (d<0) ? -d : d;
- }
- }
- *dest = sum;
+ sum = 0;
+ for (i = 0; i < 8; i++) {
+ for (j = 0; j < 8; j++) {
+ d = ((int) OIL_GET (src1, sstr1 * i + j * sizeof (int16_t), int16_t)) -
+ ((int) OIL_GET (src2, sstr2 * i + j * sizeof (int16_t), int16_t));
+ sum += (d < 0) ? -d : d;
+ }
+ }
+ *dest = sum;
}
+OIL_DEFINE_IMPL_REF (sad8x8_s16_2_ref, sad8x8_s16_2);
-OIL_DEFINE_IMPL_REF(sad8x8_s16_ref, sad8x8_s16);
+static void
+sad8x8_u8_ref (uint32_t * dest, uint8_t * src1, int sstr1, uint8_t * src2,
+ int sstr2)
+{
+ int i, j;
+ int d;
+ uint32_t sum;
+
+ sum = 0;
+ for (i = 0; i < 8; i++) {
+ for (j = 0; j < 8; j++) {
+ d = ((int) OIL_GET (src1, sstr1 * i + j * sizeof (uint8_t), uint8_t)) -
+ ((int) OIL_GET (src2, sstr2 * i + j * sizeof (uint8_t), uint8_t));
+ sum += (d < 0) ? -d : d;
+ }
+ }
+ *dest = sum;
+}
+OIL_DEFINE_IMPL_REF (sad8x8_u8_ref, sad8x8_u8);
diff --git a/liboil/simdpack/sad8x8_broken.c b/liboil/simdpack/sad8x8_broken.c
new file mode 100644
index 0000000..b0b8a94
--- /dev/null
+++ b/liboil/simdpack/sad8x8_broken.c
@@ -0,0 +1,81 @@
+/*
+ * 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 (sad8x8_s16,
+ "uint32_t *d_8x8, int ds, int16_t *s1_8x8, int ss1, int16_t *s2_8x8, int ss2");
+OIL_DEFINE_CLASS (sad8x8_f64,
+ "double *d_8x8, int ds, double *s1_8x8, int ss1, double *s2_8x8, int ss2");
+
+static void
+sad8x8_f64_ref(double *dest, int dstr, double *src1, int sstr1, double *src2,
+ int sstr2)
+{
+ int i,j;
+ double sum;
+
+ sum = 0;
+ for(i=0;i<8;i++){
+ for(j=0;j<8;j++){
+ sum += fabs(OIL_GET(src1,sstr1*i+j*sizeof(double), double) -
+ OIL_GET(src2,sstr2*i+j*sizeof(double), double));
+ }
+ }
+ *dest = sum;
+}
+
+OIL_DEFINE_IMPL_REF(sad8x8_f64_ref, sad8x8_f64);
+
+static void
+sad8x8_s16_ref(uint32_t *dest, int dstr, int16_t *src1, int sstr1, int16_t *src2,
+ int sstr2)
+{
+ int i,j;
+ int d;
+ uint32_t sum;
+
+ sum = 0;
+ for(i=0;i<8;i++){
+ for(j=0;j<8;j++){
+ d = ((int)OIL_GET(src1,sstr1*i+j*sizeof(int16_t), int16_t)) -
+ ((int)OIL_GET(src2,sstr2*i+j*sizeof(int16_t), int16_t));
+ sum += (d<0) ? -d : d;
+ }
+ }
+ *dest = sum;
+}
+
+OIL_DEFINE_IMPL_REF(sad8x8_s16_ref, sad8x8_s16);
+