Convert a few inner loops to use liboil. This is currently optional, and is only...
authorDavid Schleef <ds@schleef.org>
Thu, 12 Feb 2004 07:37:50 +0000 (07:37 +0000)
committerDavid Schleef <ds@schleef.org>
Thu, 12 Feb 2004 07:37:50 +0000 (07:37 +0000)
Original commit message from CVS:
Convert a few inner loops to use liboil.  This is currently
optional, and is only enabled if liboil is present (duh!).
* configure.ac: Check for liboil-0.1
* gst/intfloat/Makefile.am:
* gst/intfloat/gstint2float.c: (conv_f32_s16), (scalarmult_f32),
(gst_int2float_chain_gint16):
* gst/videofilter/Makefile.am:
* gst/videofilter/gstvideobalance.c: (gst_videobalance_class_init),
(tablelookup_u8), (gst_videobalance_planar411):
* gst/videotestsrc/Makefile.am:
* gst/videotestsrc/gstvideotestsrc.c: (plugin_init):
* gst/videotestsrc/videotestsrc.c: (splat_u8), (paint_hline_YUY2),
(paint_hline_IYU2), (paint_hline_str4), (paint_hline_str3),
(paint_hline_RGB565), (paint_hline_xRGB1555):

ChangeLog
configure.ac
gst/videotestsrc/Makefile.am
gst/videotestsrc/gstvideotestsrc.c
gst/videotestsrc/videotestsrc.c

index a2cb26f..a768df7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2004-02-11  David Schleef  <ds@schleef.org>
 
+       Convert a few inner loops to use liboil.  This is currently
+       optional, and is only enabled if liboil is present (duh!).
+       * configure.ac: Check for liboil-0.1
+       * gst/intfloat/Makefile.am:
+       * gst/intfloat/gstint2float.c: (conv_f32_s16), (scalarmult_f32),
+       (gst_int2float_chain_gint16):
+       * gst/videofilter/Makefile.am:
+       * gst/videofilter/gstvideobalance.c: (gst_videobalance_class_init),
+       (tablelookup_u8), (gst_videobalance_planar411):
+       * gst/videotestsrc/Makefile.am:
+       * gst/videotestsrc/gstvideotestsrc.c: (plugin_init):
+       * gst/videotestsrc/videotestsrc.c: (splat_u8), (paint_hline_YUY2),
+       (paint_hline_IYU2), (paint_hline_str4), (paint_hline_str3),
+       (paint_hline_RGB565), (paint_hline_xRGB1555):
+
+2004-02-11  David Schleef  <ds@schleef.org>
+
        * ext/lcs/gstcolorspace.c: (colorspace_find_lcs_format),
        (gst_colorspace_caps_get_fourcc), (colorspace_setup_converter),
        (gst_colorspace_getcaps), (gst_colorspace_link),
index db3448e..75bf8c7 100644 (file)
@@ -337,6 +337,14 @@ if test "x$HAVE_GDK_LOADERS" == "xyes"; then
 fi
 AM_CONDITIONAL(HAVE_GDK_LOADERS, test "x$HAVE_GDK_LOADERS" = "xyes")
 
+PKG_CHECK_MODULES(LIBOIL, liboil-0.1, HAVE_LIBOIL=yes, HAVE_LIBOIL=no)
+AC_SUBST(LIBOIL_CFLAGS)
+AC_SUBST(LIBOIL_LIBS)
+if test "x${HAVE_LIBOIL}" = xyes ; then
+  #AC_DEFINE_UNQUOTED(HAVE_LIBOIL, 1, [Define if liboil is being used])
+  true
+fi
+
 dnl ===========================================================================
 dnl ============================= gst plug-ins ================================
 dnl ===========================================================================
index d80a2e8..eb828bf 100644 (file)
@@ -5,8 +5,8 @@ libgstvideotestsrc_la_SOURCES = \
                        gstvideotestsrc.c \
                        videotestsrc.c
 
-libgstvideotestsrc_la_CFLAGS = $(GST_CFLAGS)
+libgstvideotestsrc_la_CFLAGS = $(GST_CFLAGS) $(LIBOIL_CFLAGS)
 libgstvideotestsrc_la_LIBADD =
-libgstvideotestsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstvideotestsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(LIBOIL_LIBS)
 
 noinst_HEADERS = gstvideotestsrc.h videotestsrc.h
index b21a1cd..b418dd5 100644 (file)
@@ -27,6 +27,9 @@
 
 #include <string.h>
 #include <stdlib.h>
+#ifdef HAVE_LIBOIL
+#include <liboil/liboil.h>
+#endif
 
 
 
@@ -512,6 +515,10 @@ gst_videotestsrc_get_property (GObject * object, guint prop_id, GValue * value,
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
+#ifdef HAVE_LIBOIL
+  oil_init();
+#endif
+
   return gst_element_register (plugin, "videotestsrc", GST_RANK_NONE, GST_TYPE_VIDEOTESTSRC);
 }
 
index d896236..54de063 100644 (file)
@@ -26,6 +26,9 @@
 /*#define DEBUG_ENABLED */
 #include <gstvideotestsrc.h>
 #include <videotestsrc.h>
+#ifdef HAVE_LIBOIL
+#include <liboil/liboil.h>
+#endif
 
 #include <string.h>
 #include <stdlib.h>
@@ -64,39 +67,6 @@ random_chars (unsigned char *dest, int nbytes)
 }
 #endif
 
-static void
-memset_str2 (unsigned char *dest, unsigned char val, int n)
-{
-  int i;
-
-  for (i = 0; i < n; i++) {
-    *dest = val;
-    dest += 2;
-  }
-}
-
-static void
-memset_str3 (unsigned char *dest, unsigned char val, int n)
-{
-  int i;
-
-  for (i = 0; i < n; i++) {
-    *dest = val;
-    dest += 3;
-  }
-}
-
-static void
-memset_str4 (unsigned char *dest, unsigned char val, int n)
-{
-  int i;
-
-  for (i = 0; i < n; i++) {
-    *dest = val;
-    dest += 4;
-  }
-}
-
 #if 0
 static void
 paint_rect_random (unsigned char *dest, int stride, int x, int y, int w, int h)
@@ -768,6 +738,17 @@ paint_setup_YVYU (paintinfo * p, char *dest)
   p->endptr = dest + p->ystride * p->height;
 }
 
+#ifndef HAVE_LIBOIL
+void splat_u8 (guint8 *dest, int dstr, guint8 val, int n)
+{
+  int i;
+  for(i=0;i<n;i++){
+    *dest = val;
+    dest += dstr;
+  }
+}
+#endif
+
 static void
 paint_hline_YUY2 (paintinfo * p, int x, int y, int w)
 {
@@ -776,9 +757,9 @@ paint_hline_YUY2 (paintinfo * p, int x, int y, int w)
   int offset;
 
   offset = y * p->ystride;
-  memset_str2 (p->yp + offset + x * 2, p->color->Y, w);
-  memset_str4 (p->up + offset + x1 * 4, p->color->U, x2 - x1);
-  memset_str4 (p->vp + offset + x1 * 4, p->color->V, x2 - x1);
+  splat_u8 (p->yp + offset + x * 2, 2, p->color->Y, w);
+  splat_u8 (p->up + offset + x1 * 4, 4, p->color->U, x2 - x1);
+  splat_u8 (p->vp + offset + x1 * 4, 4, p->color->V, x2 - x1);
 }
 
 static void
@@ -798,9 +779,9 @@ paint_hline_IYU2 (paintinfo * p, int x, int y, int w)
   int offset;
 
   offset = y * p->ystride;
-  memset_str3 (p->yp + offset + x * 3, p->color->Y, w);
-  memset_str3 (p->up + offset + x * 3, p->color->U, w);
-  memset_str3 (p->vp + offset + x * 3, p->color->V, w);
+  splat_u8 (p->yp + offset + x * 3, 3, p->color->Y, w);
+  splat_u8 (p->up + offset + x * 3, 3, p->color->U, w);
+  splat_u8 (p->vp + offset + x * 3, 3, p->color->V, w);
 }
 
 static void
@@ -972,9 +953,9 @@ paint_hline_str4 (paintinfo * p, int x, int y, int w)
 {
   int offset = y * p->ystride;
 
-  memset_str4 (p->yp + offset + x * 4, p->color->R, w);
-  memset_str4 (p->up + offset + x * 4, p->color->G, w);
-  memset_str4 (p->vp + offset + x * 4, p->color->B, w);
+  splat_u8 (p->yp + offset + x * 4, 4, p->color->R, w);
+  splat_u8 (p->up + offset + x * 4, 4, p->color->G, w);
+  splat_u8 (p->vp + offset + x * 4, 4, p->color->B, w);
 }
 
 static void
@@ -982,9 +963,9 @@ paint_hline_str3 (paintinfo * p, int x, int y, int w)
 {
   int offset = y * p->ystride;
 
-  memset_str3 (p->yp + offset + x * 3, p->color->R, w);
-  memset_str3 (p->up + offset + x * 3, p->color->G, w);
-  memset_str3 (p->vp + offset + x * 3, p->color->B, w);
+  splat_u8 (p->yp + offset + x * 3, 3, p->color->R, w);
+  splat_u8 (p->up + offset + x * 3, 3, p->color->G, w);
+  splat_u8 (p->vp + offset + x * 3, 3, p->color->B, w);
 }
 
 static void
@@ -1005,11 +986,11 @@ paint_hline_RGB565 (paintinfo * p, int x, int y, int w)
   b = ((p->color->G<<3)&0xe0) | (p->color->B>>3);
 
 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
-  memset_str2 (p->yp + offset + x * 2 + 0, b, w);
-  memset_str2 (p->yp + offset + x * 2 + 1, a, w);
+  splat_u8 (p->yp + offset + x * 2 + 0, 2, b, w);
+  splat_u8 (p->yp + offset + x * 2 + 1, 2, a, w);
 #else
-  memset_str2 (p->yp + offset + x * 2 + 0, a, w);
-  memset_str2 (p->yp + offset + x * 2 + 1, b, w);
+  splat_u8 (p->yp + offset + x * 2 + 0, 2, a, w);
+  splat_u8 (p->yp + offset + x * 2 + 1, 2, b, w);
 #endif
 }
 
@@ -1031,11 +1012,11 @@ paint_hline_xRGB1555 (paintinfo * p, int x, int y, int w)
   b = ((p->color->G<<2)&0xe0) | (p->color->B>>3);
 
 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
-  memset_str2 (p->yp + offset + x * 2 + 0, b, w);
-  memset_str2 (p->yp + offset + x * 2 + 1, a, w);
+  splat_u8 (p->yp + offset + x * 2 + 0, 2, b, w);
+  splat_u8 (p->yp + offset + x * 2 + 1, 2, a, w);
 #else
-  memset_str2 (p->yp + offset + x * 2 + 0, a, w);
-  memset_str2 (p->yp + offset + x * 2 + 1, b, w);
+  splat_u8 (p->yp + offset + x * 2 + 0, 2, a, w);
+  splat_u8 (p->yp + offset + x * 2 + 1, 2, b, w);
 #endif
 }