mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
gaudieffects: orc-ify burn filter
This commit is contained in:
parent
6a0afdca96
commit
ad4ffc446f
3 changed files with 64 additions and 43 deletions
|
@ -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 \
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
26
gst/gaudieffects/gstgaudieffectsorc.orc
Normal file
26
gst/gaudieffects/gstgaudieffectsorc.orc
Normal file
|
@ -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
|
Loading…
Reference in a new issue