median: remove now that it is in videofilter

This commit is contained in:
Wim Taymans 2012-10-16 13:56:19 +02:00
parent 3c09306358
commit 0e21e80e9b
6 changed files with 2 additions and 589 deletions

View file

@ -77,6 +77,7 @@ include $(top_srcdir)/common/coverage/lcov.mak
CRUFT_FILES = \ CRUFT_FILES = \
$(top_builddir)/common/shave \ $(top_builddir)/common/shave \
$(top_builddir)/common/shave-libtool \ $(top_builddir)/common/shave-libtool \
$(top_builddir)/gst/median/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/qtdemux/.libs/*.{so,dll,DLL,dylib} \ $(top_builddir)/gst/qtdemux/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/quicktime/.libs/*.{so,dll,DLL,dylib} \ $(top_builddir)/gst/quicktime/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/videofilter/.libs/*videoflip.{so,dll,DLL,dylib} \ $(top_builddir)/gst/videofilter/.libs/*videoflip.{so,dll,DLL,dylib} \
@ -84,6 +85,7 @@ CRUFT_FILES = \
$(top_builddir)/gst/videofilter/.libs/*gamma.{so,dll,DLL,dylib} $(top_builddir)/gst/videofilter/.libs/*gamma.{so,dll,DLL,dylib}
CRUFT_DIRS = \ CRUFT_DIRS = \
$(top_srcdir)/gst/median \
$(top_srcdir)/gst/qtdemux \ $(top_srcdir)/gst/qtdemux \
$(top_srcdir)/gst/quicktime \ $(top_srcdir)/gst/quicktime \
$(top_srcdir)/ext/annodex $(top_srcdir)/ext/annodex

View file

@ -1,7 +0,0 @@
Makefile
Makefile.in
*.o
*.lo
*.la
.deps
.libs

View file

@ -1,25 +0,0 @@
plugin_LTLIBRARIES = libgstmedian.la
libgstmedian_la_SOURCES = gstmedian.c
libgstmedian_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstmedian_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
$(GST_BASE_LIBS) $(GST_LIBS) $(LIBM)
libgstmedian_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstmedian_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = gstmedian.h
Android.mk: Makefile.am $(BUILT_SOURCES)
androgenizer \
-:PROJECT libgstmedian -:SHARED libgstmedian \
-:TAGS eng debug \
-:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
-:SOURCES $(libgstmedian_la_SOURCES) \
-:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstmedian_la_CFLAGS) \
-:LDFLAGS $(libgstmedian_la_LDFLAGS) \
$(libgstmedian_la_LIBADD) \
-ldl \
-:PASSTHROUGH LOCAL_ARM_MODE:=arm \
LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-1.0' \
> $@

View file

@ -1,341 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include "gstmedian.h"
#include <gst/video/video.h>
static GstStaticPadTemplate median_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420"))
);
static GstStaticPadTemplate median_sink_factory =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420"))
);
/* Median signals and args */
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum
{
PROP_0,
PROP_ACTIVE,
PROP_FILTERSIZE,
PROP_LUM_ONLY
};
#define gst_median_parent_class parent_class
G_DEFINE_TYPE (GstMedian, gst_median, GST_TYPE_VIDEO_FILTER);
static void median_5 (guint8 * src, gint sstride, const guint8 * dest,
gint dstride, gint width, gint height);
#if 0
static void median_9 (unsigned char *src, unsigned char *dest, int height,
int width);
#endif
static GstFlowReturn gst_median_transform_frame (GstVideoFilter * filter,
GstVideoFrame * in_frame, GstVideoFrame * out_frame);
static void gst_median_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_median_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void
gst_median_class_init (GstMedianClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstVideoFilterClass *vfilter_class;
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
vfilter_class = (GstVideoFilterClass *) klass;
gobject_class->set_property = gst_median_set_property;
gobject_class->get_property = gst_median_get_property;
/* FIXME: add long property descriptions */
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_ACTIVE,
g_param_spec_boolean ("active", "active", "active", TRUE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_FILTERSIZE,
g_param_spec_int ("filtersize", "filtersize", "filtersize", G_MININT,
G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_LUM_ONLY,
g_param_spec_boolean ("lum-only", "lum-only", "lum-only", TRUE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&median_sink_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&median_src_factory));
gst_element_class_set_static_metadata (gstelement_class, "Median effect",
"Filter/Effect/Video",
"Apply a median filter to an image",
"Wim Taymans <wim.taymans@gmail.com>");
vfilter_class->transform_frame =
GST_DEBUG_FUNCPTR (gst_median_transform_frame);
}
void
gst_median_init (GstMedian * median)
{
median->filtersize = 5;
median->lum_only = TRUE;
median->active = TRUE;
}
#define PIX_SORT(a,b) { if ((a)>(b)) PIX_SWAP((a),(b)); }
#define PIX_SWAP(a,b) { unsigned char temp=(a);(a)=(b);(b)=temp; }
static void
median_5 (guint8 * dest, gint dstride, const guint8 * src, gint sstride,
gint width, gint height)
{
unsigned char p[5];
int i, j, k;
/* copy the top and bottom rows into the result array */
for (i = 0; i < width; i++) {
dest[i] = src[i];
dest[(height - 1) * dstride + i] = src[(height - 1) * sstride + i];
}
/* process the interior pixels */
for (k = 2; k < height; k++) {
dest += dstride;
src += sstride;
dest[0] = src[0];
for (j = 2, i = 1; j < width; j++, i++) {
p[0] = src[i - sstride];
p[1] = src[i - 1];
p[2] = src[i];
p[3] = src[i + 1];
p[4] = src[i + sstride];
PIX_SORT (p[0], p[1]);
PIX_SORT (p[3], p[4]);
PIX_SORT (p[0], p[3]);
PIX_SORT (p[1], p[4]);
PIX_SORT (p[1], p[2]);
PIX_SORT (p[2], p[3]);
PIX_SORT (p[1], p[2]);
dest[i] = p[2];
}
dest[i] = src[i];
}
}
static void
median_9 (guint8 * dest, gint dstride, const guint8 * src, gint sstride,
gint width, gint height)
{
unsigned char p[9];
int i, j, k;
/*copy the top and bottom rows into the result array */
for (i = 0; i < width; i++) {
dest[i] = src[i];
dest[(height - 1) * dstride + i] = src[(height - 1) * sstride + i];
}
/* process the interior pixels */
for (k = 2; k < height; k++) {
dest += dstride;
src += sstride;
dest[0] = src[0];
for (j = 2, i = 1; j < width; j++, i++) {
p[0] = src[i - sstride - 1];
p[1] = src[i - sstride];
p[2] = src[i - sstride + 1];
p[3] = src[i - 1];
p[4] = src[i];
p[5] = src[i + 1];
p[6] = src[i + sstride - 1];
p[7] = src[i + sstride];
p[8] = src[i + sstride + 1];
PIX_SORT (p[1], p[2]);
PIX_SORT (p[4], p[5]);
PIX_SORT (p[7], p[8]);
PIX_SORT (p[0], p[1]);
PIX_SORT (p[3], p[4]);
PIX_SORT (p[6], p[7]);
PIX_SORT (p[1], p[2]);
PIX_SORT (p[4], p[5]);
PIX_SORT (p[7], p[8]);
PIX_SORT (p[0], p[3]);
PIX_SORT (p[5], p[8]);
PIX_SORT (p[4], p[7]);
PIX_SORT (p[3], p[6]);
PIX_SORT (p[1], p[4]);
PIX_SORT (p[2], p[5]);
PIX_SORT (p[4], p[7]);
PIX_SORT (p[4], p[2]);
PIX_SORT (p[6], p[4]);
PIX_SORT (p[4], p[2]);
dest[i] = p[4];
}
dest[i] = src[i];
}
}
static GstFlowReturn
gst_median_transform_frame (GstVideoFilter * filter, GstVideoFrame * in_frame,
GstVideoFrame * out_frame)
{
GstMedian *median = GST_MEDIAN (filter);
if (median->filtersize == 5) {
median_5 (GST_VIDEO_FRAME_PLANE_DATA (out_frame, 0),
GST_VIDEO_FRAME_PLANE_STRIDE (out_frame, 0),
GST_VIDEO_FRAME_PLANE_DATA (in_frame, 0),
GST_VIDEO_FRAME_PLANE_STRIDE (in_frame, 0),
GST_VIDEO_FRAME_WIDTH (in_frame), GST_VIDEO_FRAME_HEIGHT (in_frame));
if (median->lum_only) {
gst_video_frame_copy_plane (out_frame, in_frame, 1);
gst_video_frame_copy_plane (out_frame, in_frame, 2);
} else {
median_5 (GST_VIDEO_FRAME_PLANE_DATA (out_frame, 1),
GST_VIDEO_FRAME_PLANE_STRIDE (out_frame, 1),
GST_VIDEO_FRAME_PLANE_DATA (in_frame, 1),
GST_VIDEO_FRAME_PLANE_STRIDE (in_frame, 1),
GST_VIDEO_FRAME_WIDTH (in_frame) / 2,
GST_VIDEO_FRAME_HEIGHT (in_frame) / 2);
median_5 (GST_VIDEO_FRAME_PLANE_DATA (out_frame, 2),
GST_VIDEO_FRAME_PLANE_STRIDE (out_frame, 2),
GST_VIDEO_FRAME_PLANE_DATA (in_frame, 2),
GST_VIDEO_FRAME_PLANE_STRIDE (in_frame, 2),
GST_VIDEO_FRAME_WIDTH (in_frame) / 2,
GST_VIDEO_FRAME_HEIGHT (in_frame) / 2);
}
} else {
median_9 (GST_VIDEO_FRAME_PLANE_DATA (out_frame, 0),
GST_VIDEO_FRAME_PLANE_STRIDE (out_frame, 0),
GST_VIDEO_FRAME_PLANE_DATA (in_frame, 0),
GST_VIDEO_FRAME_PLANE_STRIDE (in_frame, 0),
GST_VIDEO_FRAME_WIDTH (in_frame), GST_VIDEO_FRAME_HEIGHT (in_frame));
if (median->lum_only) {
gst_video_frame_copy_plane (out_frame, in_frame, 1);
gst_video_frame_copy_plane (out_frame, in_frame, 2);
} else {
median_9 (GST_VIDEO_FRAME_PLANE_DATA (out_frame, 1),
GST_VIDEO_FRAME_PLANE_STRIDE (out_frame, 1),
GST_VIDEO_FRAME_PLANE_DATA (in_frame, 1),
GST_VIDEO_FRAME_PLANE_STRIDE (in_frame, 1),
GST_VIDEO_FRAME_WIDTH (in_frame) / 2,
GST_VIDEO_FRAME_HEIGHT (in_frame) / 2);
median_9 (GST_VIDEO_FRAME_PLANE_DATA (out_frame, 2),
GST_VIDEO_FRAME_PLANE_STRIDE (out_frame, 2),
GST_VIDEO_FRAME_PLANE_DATA (in_frame, 2),
GST_VIDEO_FRAME_PLANE_STRIDE (in_frame, 2),
GST_VIDEO_FRAME_WIDTH (in_frame) / 2,
GST_VIDEO_FRAME_HEIGHT (in_frame) / 2);
}
}
return GST_FLOW_OK;
}
static void
gst_median_set_property (GObject * object, guint prop_id, const GValue * value,
GParamSpec * pspec)
{
GstMedian *median;
gint argvalue;
g_return_if_fail (GST_IS_MEDIAN (object));
median = GST_MEDIAN (object);
switch (prop_id) {
case PROP_FILTERSIZE:
argvalue = g_value_get_int (value);
if (argvalue != 5 && argvalue != 9) {
g_warning ("median: invalid filtersize (%d), must be 5 or 9\n",
argvalue);
} else {
median->filtersize = argvalue;
}
break;
case PROP_ACTIVE:
median->active = g_value_get_boolean (value);
break;
case PROP_LUM_ONLY:
median->lum_only = g_value_get_boolean (value);
break;
default:
break;
}
}
static void
gst_median_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstMedian *median;
g_return_if_fail (GST_IS_MEDIAN (object));
median = GST_MEDIAN (object);
switch (prop_id) {
case PROP_FILTERSIZE:
g_value_set_int (value, median->filtersize);
break;
case PROP_ACTIVE:
g_value_set_boolean (value, median->active);
break;
case PROP_LUM_ONLY:
g_value_set_boolean (value, median->lum_only);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static gboolean
plugin_init (GstPlugin * plugin)
{
return gst_element_register (plugin, "median",
GST_RANK_NONE, GST_TYPE_MEDIAN);
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
median,
"Video median filter",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)

View file

@ -1,68 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_MEDIAN_H__
#define __GST_MEDIAN_H__
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/video/gstvideofilter.h>
G_BEGIN_DECLS
#define GST_TYPE_MEDIAN \
(gst_median_get_type())
#define GST_MEDIAN(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MEDIAN,GstMedian))
#define GST_MEDIAN_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MEDIAN,GstMedianClass))
#define GST_IS_MEDIAN(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MEDIAN))
#define GST_IS_MEDIAN_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MEDIAN))
typedef struct _GstMedian GstMedian;
typedef struct _GstMedianClass GstMedianClass;
struct _GstMedian {
GstVideoFilter parent;
int format;
int width;
int height;
int filtersize;
gboolean active;
gboolean lum_only;
GstPad *sinkpad,*srcpad;
};
struct _GstMedianClass {
GstVideoFilterClass parent_class;
};
GType gst_median_get_type (void);
G_END_DECLS
#endif /* __GST_MEDIAN_H__ */

View file

@ -1,148 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="median"
ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678B9}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../win32/Debug"
IntermediateDirectory="../../win32/Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;median_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstmedian.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../gstreamer/win32/Debug;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/median.pdb"
SubSystem="2"
OptimizeReferences="2"
ImportLibrary="$(OutDir)/gstmedian.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../win32/Release"
IntermediateDirectory="../../win32/Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;median_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstmedian.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../gstreamer/win32/Release;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/gstmedian.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\gstmedian.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\gstmedian.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>