[Liboil] [Patch] C++ patch, portability,..

Stephane Fillod f8cfe at free.fr
Tue Mar 21 14:32:59 PST 2006


Hi,

Please find attached a patch to allow the call of oil_init() from C++
code and some misc fixes. Please consider commiting to CVS.
Here's the ChangeLog entry:

2006-03-21  Stephane Fillod  <f8cfe at free.fr>
	* HACKING: precision on accuracy definition
	* liboil/liboil.h: allow usage of oil_init by C++ programs
	* liboil/c/swab.c: missing header and cast to compile cleanly 
	  on some systems.
	* m4/as-libtool.m4: put to silence an automake warning
	* liboil/liboilprofile.c: compiler warning fix when we don't
	  HAVE_GETTIMEOFDAY.

About the file liboil/liboilprofile.c, have you heard about this file
http://fftw.org/cycle.h from the http://FFTW.org project ? This header
contains cycle-counter functions for many many systems, a counter that
is not broken for PowerPC, etc.

Regards,
-- 
Stephane
-------------- next part --------------
Index: HACKING
===================================================================
RCS file: /cvs/liboil/liboil/HACKING,v
retrieving revision 1.1
diff -u -b -B -w -p -r1.1 HACKING
--- HACKING	3 Aug 2005 03:33:47 -0000	1.1
+++ HACKING	21 Mar 2006 20:48:37 -0000
@@ -70,12 +70,30 @@ New Classes
   for the type ("_f64", "_u8"), or to indicate inaccuracies or
   limitations in implementations ("_i10", "_l10").
 
+  _i10 stands for "inaccurate by a factor of 10", where the baseline
+  accuracy is 2^-52 for doubles and 2^-24 (I think).  It's a decilog
+  scale, so _i20 is a factor of 100, etc.  The baseline accuracy comes
+  from the least expressible number greater than 1.0.
+
+  _l10 stands for "something is limited to 10".  Sometimes this means
+  input range, e.g., _l15 is (was?) used for some function class that
+  could only handle input values in the range [-1<<14, 1<<14-1].
+  Another class uses this to mean that only 10 of the input values
+  can be non-zero (oil_idct8x8theora_l10).
+
+  These modifiers are obviously not well-thought-out.  In order to
+  be useful, applications need to be able to make predictions about
+  accuracy based on value of n, input values, etc.  I also don't
+  think that simply defining new classes is a maintainable solution.
+
   Use of underscores in the base part of the class name is arbitrary.
   This may change in the future.
 
   New classes should not use the modifier "_ns", since non-strided
   arrays are the default.  
 
+  What about _sat and _mod ?
+
   Parameters should generally follow the order:
 
     i1, is1, i2, is2, ..., d1, ds1, ..., s1, ss1, ..., n, m
Index: liboil/liboil.h
===================================================================
RCS file: /cvs/liboil/liboil/liboil/liboil.h,v
retrieving revision 1.12
diff -u -b -B -w -p -r1.12 liboil.h
--- liboil/liboil.h	10 Dec 2005 19:35:11 -0000	1.12
+++ liboil/liboil.h	21 Mar 2006 20:48:38 -0000
@@ -32,8 +32,16 @@
 
 #include <liboil/liboilfuncs.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void oil_init (void);
 
+#ifdef __cplusplus
+}
+#endif
+
 /**
  * oil_memcpy:
  * @dest:
Index: liboil/c/swab.c
===================================================================
RCS file: /cvs/liboil/liboil/liboil/c/swab.c,v
retrieving revision 1.4
diff -u -b -B -w -p -r1.4 swab.c
--- liboil/c/swab.c	22 Dec 2005 03:13:52 -0000	1.4
+++ liboil/c/swab.c	21 Mar 2006 20:49:12 -0000
@@ -34,12 +34,13 @@
 #include <liboil/liboilclasses.h>
 
 #include <unistd.h>
+#include <string.h>
 
 
 static void
 swab_u16_libc (uint16_t *d, const uint16_t *s, int n)
 {
-  swab (s, d, n*2);
+  swab ((const void*)s, (void*)d, n*2);
 }
 OIL_DEFINE_IMPL (swab_u16_libc, swab_u16);
 
Index: m4/as-libtool.m4
===================================================================
RCS file: /cvs/liboil/liboil/m4/as-libtool.m4,v
retrieving revision 1.1
diff -u -b -B -w -p -r1.1 as-libtool.m4
--- m4/as-libtool.m4	7 Jan 2004 10:54:49 -0000	1.1
+++ m4/as-libtool.m4	21 Mar 2006 20:49:14 -0000
@@ -16,7 +16,7 @@ dnl if USE_RELEASE is used, then add a -
 dnl with the given release version
 dnl then use [$PREFIX]_LT_LDFLAGS in the relevant Makefile.am's
 
-AC_DEFUN(AS_LIBTOOL,
+AC_DEFUN([AS_LIBTOOL],
 [
   [$1]_CURRENT=[$2]
   [$1]_REVISION=[$3]
Index: liboil/liboilprofile.c
===================================================================
RCS file: /cvs/liboil/liboil/liboil/liboilprofile.c,v
retrieving revision 1.9
diff -u -b -B -w -p -r1.9 liboilprofile.c
--- liboil/liboilprofile.c	20 Mar 2006 22:23:53 -0000	1.9
+++ liboil/liboilprofile.c	21 Mar 2006 21:37:26 -0000
@@ -263,7 +263,9 @@ oil_profile_stamp (void)
 void
 _oil_profile_init (void)
 {
+#ifdef HAVE_GETTIMEOFDAY
   int gtod_warn = 1;
+#endif
 
 #if defined(__i386__)
 #define have_tsc 1


More information about the Liboil mailing list