gamma: Stop using liboil
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Sun, 18 Apr 2010 07:33:49 +0000 (09:33 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 29 Apr 2010 17:28:19 +0000 (19:28 +0200)
The used liboil function is deprecated, only has a reference implementation
and is more complex than what's needed here.

gst/videofilter/Makefile.am
gst/videofilter/gstgamma.c

index 32fd41c..409affb 100644 (file)
@@ -35,12 +35,10 @@ libgstvideobalance_la_LIBTOOLFLAGS = --tag=disable-static
 libgstgamma_la_SOURCES = gstgamma.c
 libgstgamma_la_CFLAGS = $(GST_CFLAGS) $(GST_CONTROLLER_CFLAGS) \
                        $(GST_BASE_CFLAGS) \
-                       $(GST_PLUGINS_BASE_CFLAGS) \
-                       $(LIBOIL_CFLAGS)
+                       $(GST_PLUGINS_BASE_CFLAGS)
 libgstgamma_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_MAJORMINOR@ \
                        $(GST_CONTROLLER_LIBS) \
-                       $(GST_BASE_LIBS) $(GST_LIBS) \
-                       $(LIBOIL_LIBS)
+                       $(GST_BASE_LIBS) $(GST_LIBS)
 libgstgamma_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(LIBM)
 libgstgamma_la_LIBTOOLFLAGS = --tag=disable-static
 
index 5446014..e7306d2 100644 (file)
@@ -45,7 +45,6 @@
 #endif
 
 #include "gstgamma.h"
-#include <liboil/liboil.h>
 #include <string.h>
 #include <math.h>
 
@@ -199,17 +198,27 @@ gst_gamma_calculate_tables (GstGamma * gamma)
 static void
 gst_gamma_planar_ip (GstGamma * gamma, guint8 * data)
 {
-  gint size;
+  gint i, j, height;
+  gint width, row_stride, row_wrap;
+  const guint8 *table = gamma->gamma_table;
 
   data =
       data + gst_video_format_get_component_offset (gamma->format, 0,
       gamma->width, gamma->height);
-  size =
-      gst_video_format_get_row_stride (gamma->format, 0,
-      gamma->width) * gst_video_format_get_component_height (gamma->format, 0,
+
+  width = gst_video_format_get_component_width (gamma->format, 0, gamma->width);
+  height = gst_video_format_get_component_height (gamma->format, 0,
       gamma->height);
+  row_stride = gst_video_format_get_row_stride (gamma->format, 0, gamma->width);
+  row_wrap = row_stride - width;
 
-  oil_tablelookup_u8 (data, 1, data, 1, gamma->gamma_table, 1, size);
+  for (i = 0; i < height; i++) {
+    for (j = 0; j < width; j++) {
+      *data = table[*data];
+      data++;
+    }
+    data += row_wrap;
+  }
 }
 
 static gboolean
@@ -302,7 +311,6 @@ plugin_init (GstPlugin * plugin)
 {
   GST_DEBUG_CATEGORY_INIT (gamma_debug, "gamma", 0, "gamma");
 
-  oil_init ();
   gst_controller_init (NULL, NULL);
 
   return gst_element_register (plugin, "gamma", GST_RANK_NONE, GST_TYPE_GAMMA);