summaryrefslogtreecommitdiff
path: root/gst/gaudieffects
diff options
context:
space:
mode:
authorLuis de Bethencourt <luis@debethencourt.com>2012-05-16 17:49:12 +0100
committerLuis de Bethencourt <luis@debethencourt.com>2012-05-16 17:56:58 +0100
commitad4ffc446f06b2a387bbf2c15d0f1a8841e98b0d (patch)
treefe6a47d4966c8c8c76d4f022fcaaa6bb2e4d2014 /gst/gaudieffects
parent6a0afdca9634831fde1bc98625a4847c88da10b9 (diff)
downloadgstreamer-plugins-bad-ad4ffc446f06b2a387bbf2c15d0f1a8841e98b0d.tar.gz
gaudieffects: orc-ify burn filter
Diffstat (limited to 'gst/gaudieffects')
-rw-r--r--gst/gaudieffects/Makefile.am41
-rw-r--r--gst/gaudieffects/gstburn.c40
-rw-r--r--gst/gaudieffects/gstgaudieffectsorc.orc26
3 files changed, 64 insertions, 43 deletions
diff --git a/gst/gaudieffects/Makefile.am b/gst/gaudieffects/Makefile.am
index 84d9fbe28..6396e043d 100644
--- a/gst/gaudieffects/Makefile.am
+++ b/gst/gaudieffects/Makefile.am
@@ -1,18 +1,45 @@
plugin_LTLIBRARIES = libgstgaudieffects.la
-libgstgaudieffects_la_SOURCES = gstburn.c gstchromium.c gstdilate.c \
- gstdodge.c gstexclusion.c gstgaussblur.c gstsolarize.c gstplugin.c
-libgstgaudieffects_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-libgstgaudieffects_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_API_VERSION@ $(GST_LIBS) $(LIBM)
+ORC_SOURCE=gstgaudieffectsorc
+include $(top_srcdir)/common/orc.mak
+
+libgstgaudieffects_la_SOURCES = \
+ gstburn.c \
+ gstchromium.c \
+ gstdilate.c \
+ gstdodge.c \
+ gstexclusion.c \
+ gstgaussblur.c \
+ gstsolarize.c \
+ gstplugin.c
+nodist_libgstgaudieffects_la_SOURCES = $(ORC_NODIST_SOURCES)
+
+libgstgaudieffects_la_CFLAGS = \
+ $(GST_PLUGINS_BASE_CFLAGS) \
+ $(GST_CFLAGS) \
+ $(ORC_CFLAGS)
+
+libgstgaudieffects_la_LIBADD = \
+ $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_API_VERSION@ \
+ $(GST_BASE_LIBS) \
+ $(GST_LIBS) \
+ $(LIBM) \
+ $(ORC_LIBS)
libgstgaudieffects_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstgaudieffects_la_LIBTOOLFLAGS = --tag=disable-static
# headers we need but don't want installed
noinst_HEADERS = \
- gstburn.h gstchromium.h gstdilate.h gstdodge.h \
- gstexclusion.h gstgaussblur.h gstplugin.h gstsolarize.h
+ gstburn.h \
+ gstchromium.h \
+ gstdilate.h \
+ gstdodge.h \
+ gstexclusion.h \
+ gstgaussblur.h \
+ gstplugin.h \
+ gstsolarize.h
-EXTRA_DIST = blur-example.py burn-example.py
+EXTRA_PROGRAMS = blur-example.py burn-example.py
Android.mk: Makefile.am $(BUILT_SOURCES)
androgenizer \
diff --git a/gst/gaudieffects/gstburn.c b/gst/gaudieffects/gstburn.c
index fb982c6ec..c7950eecf 100644
--- a/gst/gaudieffects/gstburn.c
+++ b/gst/gaudieffects/gstburn.c
@@ -67,6 +67,8 @@
#include "gstplugin.h"
#include "gstburn.h"
+#include "gstgaudieffectsorc.h"
+
#define gst_burn_parent_class parent_class
G_DEFINE_TYPE (GstBurn, gst_burn, GST_TYPE_VIDEO_FILTER);
@@ -96,9 +98,6 @@ enum
#define DEFAULT_ADJUSTMENT 175
-static void transform (guint32 * src, guint32 * dest, gint video_area,
- gint adjustment);
-
/* The capabilities of the inputs and outputs. */
static GstStaticPadTemplate gst_burn_sink_template =
@@ -256,7 +255,8 @@ gst_burn_transform_frame (GstVideoFilter * vfilter,
adjustment = filter->adjustment;
GST_OBJECT_UNLOCK (filter);
- transform (src, dest, video_size, adjustment);
+ /*** Now the image processing work.... ***/
+ orc_gaudi_burn (dest, src, adjustment, video_size);
return GST_FLOW_OK;
}
@@ -271,35 +271,3 @@ gst_burn_plugin_init (GstPlugin * burn)
return gst_element_register (burn, "burn", GST_RANK_NONE, GST_TYPE_BURN);
}
-
-/*** Now the image processing work.... ***/
-
-/* Transform processes each frame. */
-static void
-transform (guint32 * src, guint32 * dest, gint video_area, gint adjustment)
-{
- guint32 in;
- gint red, green, blue, c;
- gint x;
-
- for (x = 0; x < video_area; x++) {
- in = *src++;
-
- red = (in >> 16) & 0xff;
- green = (in >> 8) & 0xff;
- blue = (in) & 0xff;
-
- c = (red + adjustment);
- red = c ? (256 - (256 * (255 - red) / c)) : 0;
- c = (green + adjustment);
- green = c ? (256 - (256 * (255 - green) / c)) : 0;
- c = (blue + adjustment);
- blue = c ? (256 - (256 * (255 - blue) / c)) : 0;
-
- red = CLAMP (red, 0, 255);
- green = CLAMP (green, 0, 255);
- blue = CLAMP (blue, 0, 255);
-
- *dest++ = (red << 16) | (green << 8) | blue;
- }
-}
diff --git a/gst/gaudieffects/gstgaudieffectsorc.orc b/gst/gaudieffects/gstgaudieffectsorc.orc
new file mode 100644
index 000000000..5cc74544a
--- /dev/null
+++ b/gst/gaudieffects/gstgaudieffectsorc.orc
@@ -0,0 +1,26 @@
+
+.function orc_gaudi_burn
+.dest 4 dest guint32
+.source 4 src guint32
+.param 4 adj gint
+.const 1 c255 255
+.const 1 c7 7
+.const 1 c1 1
+.temp 4 tmp guint32
+.temp 8 tmp2 guint32
+.temp 8 a2 gint
+
+x4 copyb tmp, src # tmp <- src
+x4 convubw tmp2, tmp # convert from size 1 to 2
+
+x4 addw a2, tmp2, adj # a = tmp + adjustment
+x4 shruw a2, a2, c1 # a = a / 2
+x4 subb tmp, c255, tmp # tmp = 255 - tmp
+#x4 mulubw tmp2, tmp, c127 # tmp = tmp * 127
+x4 convubw tmp2, tmp # convert from size 1 to 2
+x4 shlw tmp2, tmp2, c7 # tmp = tmp * 128
+x4 divluw tmp2, tmp2, a2 # tmp = tmp / a
+x4 subw tmp2, c255, tmp2 # tmp = 255 - tmp
+
+x4 convwb tmp, tmp2 # convert from size 2 to 1
+storel dest, tmp \ No newline at end of file