mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 12:41:05 +00:00
filter: remove filter plugin
We don't build it anyway and we have audioiirfilter in good.
This commit is contained in:
parent
d1578f042a
commit
931f7b2c59
8 changed files with 0 additions and 979 deletions
|
@ -1,17 +0,0 @@
|
||||||
|
|
||||||
plugin_LTLIBRARIES = libgstfilter.la
|
|
||||||
|
|
||||||
libgstfilter_la_SOURCES = gstfilter.c gstiir.c iir.c
|
|
||||||
libgstfilter_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GST_CONTROLLER_CFLAGS)
|
|
||||||
libgstfilter_la_LIBADD = \
|
|
||||||
$(GST_BASE_LIBS) \
|
|
||||||
$(GST_LIBS) \
|
|
||||||
$(GST_CONTROLLER_LIBS) \
|
|
||||||
$(GST_PLUGINS_BASE_LIBS) \
|
|
||||||
-lgstaudio-$(GST_MAJORMINOR) \
|
|
||||||
$(LIBM)
|
|
||||||
|
|
||||||
libgstfilter_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
|
||||||
libgstfilter_la_LIBTOOLFLAGS = --tag=disable-static
|
|
||||||
|
|
||||||
noinst_HEADERS = gstfilter.h gstiir.h iir.h
|
|
|
@ -1,157 +0,0 @@
|
||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="7.10"
|
|
||||||
Name="filter"
|
|
||||||
ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678B2}"
|
|
||||||
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;"../../gst-libs";../../../popt/include;../../../libxml2/include/libxml2"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;filter_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)/gstfilter.dll"
|
|
||||||
LinkIncremental="2"
|
|
||||||
AdditionalLibraryDirectories="../../../gstreamer/win32/Debug;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
|
|
||||||
ModuleDefinitionFile=""
|
|
||||||
GenerateDebugInformation="TRUE"
|
|
||||||
ProgramDatabaseFile="$(OutDir)/filter.pdb"
|
|
||||||
SubSystem="2"
|
|
||||||
OptimizeReferences="2"
|
|
||||||
ImportLibrary="$(OutDir)/gstfilter.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;"../../gst-libs";../../../popt/include;../../../libxml2/include/libxml2"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;filter_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)/gstfilter.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)/gstfilter.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=".\gstfilter.c">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\gstiir.c">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\iir.c">
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
|
||||||
Name="Header Files"
|
|
||||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
|
||||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
|
||||||
<File
|
|
||||||
RelativePath=".\iir.h">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\gstfilter.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>
|
|
|
@ -1,67 +0,0 @@
|
||||||
/* -*- c-basic-offset: 2 -*-
|
|
||||||
*
|
|
||||||
* GStreamer
|
|
||||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
||||||
* 2000 Wim Taymans <wtay@chello.be>
|
|
||||||
* 2006 Dreamlab Technologies Ltd. <mathis.hofer@dreamlab.net>
|
|
||||||
*
|
|
||||||
* gstfilter.c: element for filter plug-ins
|
|
||||||
*
|
|
||||||
* 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 "gstfilter.h"
|
|
||||||
#include <gst/audio/audio.h>
|
|
||||||
#include <gst/controller/gstcontroller.h>
|
|
||||||
|
|
||||||
struct _elements_entry
|
|
||||||
{
|
|
||||||
gchar *name;
|
|
||||||
GType (*type) (void);
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct _elements_entry _elements[] = {
|
|
||||||
{"iir", gst_iir_get_type},
|
|
||||||
{NULL, 0},
|
|
||||||
};
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
plugin_init (GstPlugin * plugin)
|
|
||||||
{
|
|
||||||
gint i = 0;
|
|
||||||
|
|
||||||
/* initialize gst controller library */
|
|
||||||
gst_controller_init (NULL, NULL);
|
|
||||||
|
|
||||||
while (_elements[i].name) {
|
|
||||||
if (!gst_element_register (plugin, _elements[i].name, GST_RANK_NONE,
|
|
||||||
_elements[i].type ()))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
||||||
GST_VERSION_MINOR,
|
|
||||||
"filter",
|
|
||||||
"IIR audio filter element",
|
|
||||||
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
|
|
|
@ -1,33 +0,0 @@
|
||||||
/* -*- c-basic-offset: 2 -*-
|
|
||||||
*
|
|
||||||
* GStreamer
|
|
||||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
||||||
* 2000 Wim Taymans <wtay@chello.be>
|
|
||||||
* 2006 Dreamlab Technologies Ltd. <mathis.hofer@dreamlab.net>
|
|
||||||
*
|
|
||||||
* gstfilter.h: element for filter plug-ins
|
|
||||||
*
|
|
||||||
* 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_FILTER_H__
|
|
||||||
#define __GST_FILTER_H__
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
GType gst_iir_get_type (void);
|
|
||||||
|
|
||||||
#endif /* __GST_FILTER_H__ */
|
|
|
@ -1,253 +0,0 @@
|
||||||
/* -*- c-basic-offset: 2 -*-
|
|
||||||
*
|
|
||||||
* GStreamer
|
|
||||||
* Copyright (C) 1999-2001 Erik Walthinsen <omega@cse.ogi.edu>
|
|
||||||
* 2006 Dreamlab Technologies Ltd. <mathis.hofer@dreamlab.net>
|
|
||||||
*
|
|
||||||
* 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 <math.h>
|
|
||||||
#include <gst/gst.h>
|
|
||||||
#include <gst/base/gstbasetransform.h>
|
|
||||||
#include <gst/controller/gstcontroller.h>
|
|
||||||
|
|
||||||
#include "gstiir.h"
|
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT gst_iir_debug
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
|
||||||
|
|
||||||
/* Filter signals and args */
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
/* FILL ME */
|
|
||||||
LAST_SIGNAL
|
|
||||||
};
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
PROP_0,
|
|
||||||
PROP_A,
|
|
||||||
PROP_B,
|
|
||||||
PROP_GAIN,
|
|
||||||
PROP_STAGES
|
|
||||||
};
|
|
||||||
|
|
||||||
static GstStaticPadTemplate iir_sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
||||||
GST_PAD_SINK,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_STATIC_CAPS ("audio/x-raw-float, "
|
|
||||||
"rate = (int) [ 1, MAX ], "
|
|
||||||
"channels = (int) [ 1, MAX ], "
|
|
||||||
"endianness = (int) BYTE_ORDER, " "width = (int) 32")
|
|
||||||
);
|
|
||||||
|
|
||||||
static GstStaticPadTemplate iir_src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
|
||||||
GST_PAD_SRC,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_STATIC_CAPS ("audio/x-raw-float, "
|
|
||||||
"rate = (int) [ 1, MAX ], "
|
|
||||||
"channels = (int) [ 1, MAX ], "
|
|
||||||
"endianness = (int) BYTE_ORDER, " "width = (int) 32")
|
|
||||||
);
|
|
||||||
|
|
||||||
#define DEBUG_INIT(bla) \
|
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_iir_debug, "iir", 0, "Infinite Impulse Response (IIR) filter plugin");
|
|
||||||
|
|
||||||
GST_BOILERPLATE_FULL (GstIIR, gst_iir, GstBaseTransform,
|
|
||||||
GST_TYPE_BASE_TRANSFORM, DEBUG_INIT);
|
|
||||||
|
|
||||||
static void iir_set_property (GObject * object, guint prop_id,
|
|
||||||
const GValue * value, GParamSpec * pspec);
|
|
||||||
static void iir_get_property (GObject * object, guint prop_id,
|
|
||||||
GValue * value, GParamSpec * pspec);
|
|
||||||
|
|
||||||
static GstFlowReturn iir_transform_ip (GstBaseTransform * base,
|
|
||||||
GstBuffer * outbuf);
|
|
||||||
static gboolean iir_set_caps (GstBaseTransform * base, GstCaps * incaps,
|
|
||||||
GstCaps * outcaps);
|
|
||||||
|
|
||||||
/* Element class */
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_iir_dispose (GObject * object)
|
|
||||||
{
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_iir_base_init (gpointer g_class)
|
|
||||||
{
|
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
||||||
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&iir_src_template));
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&iir_sink_template));
|
|
||||||
gst_element_class_set_details_simple (element_class,
|
|
||||||
"Infinite Impulse Response (IIR) filter", "Filter/Effect/Audio",
|
|
||||||
"IIR filter based on vorbis code",
|
|
||||||
"Monty <monty@xiph.org>, "
|
|
||||||
"Thomas Vander Stichele <thomas at apestaart dot org>, "
|
|
||||||
"Dreamlab Technologies Ltd. <mathis.hofer@dreamlab.net>");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_iir_class_init (GstIIRClass * klass)
|
|
||||||
{
|
|
||||||
GObjectClass *gobject_class;
|
|
||||||
GstBaseTransformClass *trans_class;
|
|
||||||
|
|
||||||
gobject_class = (GObjectClass *) klass;
|
|
||||||
trans_class = (GstBaseTransformClass *) klass;
|
|
||||||
|
|
||||||
gobject_class->set_property = iir_set_property;
|
|
||||||
gobject_class->get_property = iir_get_property;
|
|
||||||
gobject_class->dispose = gst_iir_dispose;
|
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_A,
|
|
||||||
g_param_spec_double ("A", "A", "A filter coefficient",
|
|
||||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
||||||
g_object_class_install_property (gobject_class, PROP_B,
|
|
||||||
g_param_spec_double ("B", "B", "B filter coefficient",
|
|
||||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
||||||
g_object_class_install_property (gobject_class, PROP_GAIN,
|
|
||||||
g_param_spec_double ("gain", "Gain", "Filter gain",
|
|
||||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
||||||
g_object_class_install_property (gobject_class, PROP_STAGES,
|
|
||||||
g_param_spec_int ("stages", "Stages", "Number of filter stages",
|
|
||||||
1, G_MAXINT, 1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
trans_class->transform_ip = GST_DEBUG_FUNCPTR (iir_transform_ip);
|
|
||||||
trans_class->set_caps = GST_DEBUG_FUNCPTR (iir_set_caps);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_iir_init (GstIIR * this, GstIIRClass * g_class)
|
|
||||||
{
|
|
||||||
this->A = 0.0;
|
|
||||||
this->B = 0.0;
|
|
||||||
this->gain = 1.0; /* unity gain as default */
|
|
||||||
this->stages = 1;
|
|
||||||
this->state = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* GstBaseTransform vmethod implementations */
|
|
||||||
|
|
||||||
/* get notified of caps and plug in the correct process function */
|
|
||||||
static gboolean
|
|
||||||
iir_set_caps (GstBaseTransform * base, GstCaps * incaps, GstCaps * outcaps)
|
|
||||||
{
|
|
||||||
GstIIR *this = GST_IIR (base);
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (this,
|
|
||||||
"set_caps: in %" GST_PTR_FORMAT " out %" GST_PTR_FORMAT, incaps, outcaps);
|
|
||||||
|
|
||||||
/* FIXME: remember to free it */
|
|
||||||
this->state = (IIR_state *) g_malloc (sizeof (IIR_state));
|
|
||||||
IIR_init (this->state, this->stages, this->gain, &(this->A), &(this->B));
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstFlowReturn
|
|
||||||
iir_transform_ip (GstBaseTransform * base, GstBuffer * outbuf)
|
|
||||||
{
|
|
||||||
GstIIR *this = GST_IIR (base);
|
|
||||||
GstClockTime timestamp;
|
|
||||||
|
|
||||||
gfloat *src;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* don't process data in passthrough-mode */
|
|
||||||
if (gst_base_transform_is_passthrough (base))
|
|
||||||
return GST_FLOW_OK;
|
|
||||||
|
|
||||||
/* FIXME: subdivide GST_BUFFER_SIZE into small chunks for smooth fades */
|
|
||||||
timestamp = GST_BUFFER_TIMESTAMP (outbuf);
|
|
||||||
|
|
||||||
if (GST_CLOCK_TIME_IS_VALID (timestamp))
|
|
||||||
gst_object_sync_values (G_OBJECT (this), timestamp);
|
|
||||||
|
|
||||||
src = (gfloat *) GST_BUFFER_DATA (outbuf);
|
|
||||||
|
|
||||||
/* do an in-place edit */
|
|
||||||
for (i = 0; i < GST_BUFFER_SIZE (outbuf) / sizeof (gfloat); ++i)
|
|
||||||
*(src + i) = (gfloat) IIR_filter (this->state, (double) *(src + i));
|
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
iir_set_property (GObject * object, guint prop_id, const GValue * value,
|
|
||||||
GParamSpec * pspec)
|
|
||||||
{
|
|
||||||
GstIIR *this = GST_IIR (object);
|
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_IIR (this));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_A:
|
|
||||||
this->A = g_value_get_double (value);
|
|
||||||
break;
|
|
||||||
case PROP_B:
|
|
||||||
this->B = g_value_get_double (value);
|
|
||||||
break;
|
|
||||||
case PROP_GAIN:
|
|
||||||
this->gain = g_value_get_double (value);
|
|
||||||
break;
|
|
||||||
case PROP_STAGES:
|
|
||||||
this->stages = g_value_get_int (value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
iir_get_property (GObject * object, guint prop_id, GValue * value,
|
|
||||||
GParamSpec * pspec)
|
|
||||||
{
|
|
||||||
GstIIR *this = GST_IIR (object);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_A:
|
|
||||||
g_value_set_double (value, this->A);
|
|
||||||
break;
|
|
||||||
case PROP_B:
|
|
||||||
g_value_set_double (value, this->B);
|
|
||||||
break;
|
|
||||||
case PROP_GAIN:
|
|
||||||
g_value_set_double (value, this->gain);
|
|
||||||
break;
|
|
||||||
case PROP_STAGES:
|
|
||||||
g_value_set_int (value, this->stages);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,67 +0,0 @@
|
||||||
/* -*- c-basic-offset: 2 -*-
|
|
||||||
*
|
|
||||||
* GStreamer
|
|
||||||
* Copyright (C) 1999-2001 Erik Walthinsen <omega@cse.ogi.edu>
|
|
||||||
* 2006 Dreamlab Technologies Ltd. <mathis.hofer@dreamlab.net>
|
|
||||||
*
|
|
||||||
* 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_IIR_H__
|
|
||||||
#define __GST_IIR_H__
|
|
||||||
|
|
||||||
#include "gstfilter.h"
|
|
||||||
#include "iir.h"
|
|
||||||
#include <gst/gst.h>
|
|
||||||
#include <gst/base/gstbasetransform.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define GST_TYPE_IIR \
|
|
||||||
(gst_iir_get_type())
|
|
||||||
#define GST_IIR(obj) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_IIR,GstIIR))
|
|
||||||
#define GST_IIR_CLASS(klass) \
|
|
||||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_IIR,GstIIRClass))
|
|
||||||
#define GST_IS_IIR(obj) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_IIR))
|
|
||||||
#define GST_IS_IIR_CLASS(klass) \
|
|
||||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_IIR))
|
|
||||||
|
|
||||||
typedef struct _GstIIR GstIIR;
|
|
||||||
typedef struct _GstIIRClass GstIIRClass;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GstIIR:
|
|
||||||
*
|
|
||||||
* Opaque data structure.
|
|
||||||
*/
|
|
||||||
struct _GstIIR {
|
|
||||||
GstBaseTransform element;
|
|
||||||
|
|
||||||
double A, B;
|
|
||||||
double gain;
|
|
||||||
int stages;
|
|
||||||
IIR_state *state;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GstIIRClass {
|
|
||||||
GstBaseTransformClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __GST_IIR_H__ */
|
|
348
gst/filter/iir.c
348
gst/filter/iir.c
|
@ -1,348 +0,0 @@
|
||||||
/********************************************************************
|
|
||||||
* *
|
|
||||||
* THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
|
|
||||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
|
|
||||||
* THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
|
|
||||||
* PLEASE READ THESE TERMS DISTRIBUTING. *
|
|
||||||
* *
|
|
||||||
* THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
|
|
||||||
* by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
|
|
||||||
* http://www.xiph.org/ *
|
|
||||||
* *
|
|
||||||
********************************************************************
|
|
||||||
|
|
||||||
function: Direct Form I, II IIR filters, plus some specializations
|
|
||||||
last mod: $Id$
|
|
||||||
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
/* LPC is actually a degenerate case of form I/II filters, but we need
|
|
||||||
both */
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <math.h>
|
|
||||||
#include "iir.h"
|
|
||||||
|
|
||||||
void
|
|
||||||
IIR_init (IIR_state * s, int stages, double gain, double *A, double *B)
|
|
||||||
{
|
|
||||||
memset (s, 0, sizeof (IIR_state));
|
|
||||||
s->stages = stages;
|
|
||||||
s->gain = gain;
|
|
||||||
s->coeff_A = malloc (stages * sizeof (double));
|
|
||||||
s->coeff_B = malloc ((stages + 1) * sizeof (double));
|
|
||||||
s->z_A = calloc (stages * 2, sizeof (double));
|
|
||||||
s->z_B = calloc (stages * 2, sizeof (double));
|
|
||||||
|
|
||||||
memcpy (s->coeff_A, A, stages * sizeof (double));
|
|
||||||
memcpy (s->coeff_B, B, (stages + 1) * sizeof (double));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
IIR_clear (IIR_state * s)
|
|
||||||
{
|
|
||||||
if (s) {
|
|
||||||
free (s->coeff_A);
|
|
||||||
free (s->coeff_B);
|
|
||||||
free (s->z_A);
|
|
||||||
free (s->z_B);
|
|
||||||
memset (s, 0, sizeof (IIR_state));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
double
|
|
||||||
IIR_filter (IIR_state * s, double in)
|
|
||||||
{
|
|
||||||
int stages = s->stages, i;
|
|
||||||
double newA;
|
|
||||||
double newB = 0;
|
|
||||||
double *zA = s->z_A + s->ring;
|
|
||||||
|
|
||||||
newA = in /= s->gain;
|
|
||||||
for (i = 0; i < stages; i++) {
|
|
||||||
newA += s->coeff_A[i] * zA[i];
|
|
||||||
newB += s->coeff_B[i] * zA[i];
|
|
||||||
}
|
|
||||||
newB += newA * s->coeff_B[stages];
|
|
||||||
|
|
||||||
zA[0] = zA[stages] = newA;
|
|
||||||
if (++s->ring >= stages)
|
|
||||||
s->ring = 0;
|
|
||||||
|
|
||||||
return (newB);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* this assumes the symmetrical structure of the feed-forward stage of
|
|
||||||
a Chebyshev bandpass to save multiplies */
|
|
||||||
double
|
|
||||||
IIR_filter_ChebBand (IIR_state * s, double in)
|
|
||||||
{
|
|
||||||
int stages = s->stages, i;
|
|
||||||
double newA;
|
|
||||||
double newB = 0;
|
|
||||||
double *zA = s->z_A + s->ring;
|
|
||||||
|
|
||||||
newA = in /= s->gain;
|
|
||||||
|
|
||||||
newA += s->coeff_A[0] * zA[0];
|
|
||||||
for (i = 1; i < (stages >> 1); i++) {
|
|
||||||
newA += s->coeff_A[i] * zA[i];
|
|
||||||
newB += s->coeff_B[i] * (zA[i] - zA[stages - i]);
|
|
||||||
}
|
|
||||||
newB += s->coeff_B[i] * zA[i];
|
|
||||||
for (; i < stages; i++)
|
|
||||||
newA += s->coeff_A[i] * zA[i];
|
|
||||||
|
|
||||||
newB += newA - zA[0];
|
|
||||||
|
|
||||||
zA[0] = zA[stages] = newA;
|
|
||||||
if (++s->ring >= stages)
|
|
||||||
s->ring = 0;
|
|
||||||
|
|
||||||
return (newB);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _V_SELFTEST
|
|
||||||
|
|
||||||
/* z^-stage, z^-stage+1... */
|
|
||||||
static double cheb_bandpass_B[] =
|
|
||||||
{ -1., 0., 5., 0., -10., 0., 10., 0., -5., 0., 1 };
|
|
||||||
static double cheb_bandpass_A[] = { -0.6665900311,
|
|
||||||
1.0070146601,
|
|
||||||
-3.1262875409,
|
|
||||||
3.5017171569,
|
|
||||||
-6.2779211945,
|
|
||||||
5.2966481740,
|
|
||||||
-6.7570216587,
|
|
||||||
4.0760335768,
|
|
||||||
-3.9134284363,
|
|
||||||
1.3997338886
|
|
||||||
};
|
|
||||||
|
|
||||||
static double data[128] = {
|
|
||||||
0.0426331,
|
|
||||||
0.0384521,
|
|
||||||
0.0345764,
|
|
||||||
0.0346069,
|
|
||||||
0.0314636,
|
|
||||||
0.0310059,
|
|
||||||
0.0318604,
|
|
||||||
0.0336304,
|
|
||||||
0.036438,
|
|
||||||
0.0348511,
|
|
||||||
0.0354919,
|
|
||||||
0.0343628,
|
|
||||||
0.0325623,
|
|
||||||
0.0318909,
|
|
||||||
0.0263367,
|
|
||||||
0.0225525,
|
|
||||||
0.0195618,
|
|
||||||
0.0160828,
|
|
||||||
0.0168762,
|
|
||||||
0.0145569,
|
|
||||||
0.0126343,
|
|
||||||
0.0127258,
|
|
||||||
0.00820923,
|
|
||||||
0.00787354,
|
|
||||||
0.00558472,
|
|
||||||
0.00204468,
|
|
||||||
3.05176e-05,
|
|
||||||
-0.00357056,
|
|
||||||
-0.00570679,
|
|
||||||
-0.00991821,
|
|
||||||
-0.0101013,
|
|
||||||
-0.00881958,
|
|
||||||
-0.0108948,
|
|
||||||
-0.0110168,
|
|
||||||
-0.0119324,
|
|
||||||
-0.0161438,
|
|
||||||
-0.0194702,
|
|
||||||
-0.0229187,
|
|
||||||
-0.0260315,
|
|
||||||
-0.0282288,
|
|
||||||
-0.0306091,
|
|
||||||
-0.0330505,
|
|
||||||
-0.0364685,
|
|
||||||
-0.0385742,
|
|
||||||
-0.0428772,
|
|
||||||
-0.043457,
|
|
||||||
-0.0425415,
|
|
||||||
-0.0462341,
|
|
||||||
-0.0467529,
|
|
||||||
-0.0489807,
|
|
||||||
-0.0520325,
|
|
||||||
-0.0558167,
|
|
||||||
-0.0596924,
|
|
||||||
-0.0591431,
|
|
||||||
-0.0612793,
|
|
||||||
-0.0618591,
|
|
||||||
-0.0615845,
|
|
||||||
-0.0634155,
|
|
||||||
-0.0639648,
|
|
||||||
-0.0683594,
|
|
||||||
-0.0718079,
|
|
||||||
-0.0729675,
|
|
||||||
-0.0791931,
|
|
||||||
-0.0860901,
|
|
||||||
-0.0885315,
|
|
||||||
-0.088623,
|
|
||||||
-0.089386,
|
|
||||||
-0.0899353,
|
|
||||||
-0.0886841,
|
|
||||||
-0.0910645,
|
|
||||||
-0.0948181,
|
|
||||||
-0.0919495,
|
|
||||||
-0.0891418,
|
|
||||||
-0.0916443,
|
|
||||||
-0.096344,
|
|
||||||
-0.100464,
|
|
||||||
-0.105499,
|
|
||||||
-0.108612,
|
|
||||||
-0.112213,
|
|
||||||
-0.117676,
|
|
||||||
-0.120911,
|
|
||||||
-0.124329,
|
|
||||||
-0.122162,
|
|
||||||
-0.120605,
|
|
||||||
-0.12326,
|
|
||||||
-0.12619,
|
|
||||||
-0.128998,
|
|
||||||
-0.13205,
|
|
||||||
-0.134247,
|
|
||||||
-0.137939,
|
|
||||||
-0.143555,
|
|
||||||
-0.14389,
|
|
||||||
-0.14859,
|
|
||||||
-0.153717,
|
|
||||||
-0.159851,
|
|
||||||
-0.164551,
|
|
||||||
-0.162811,
|
|
||||||
-0.164276,
|
|
||||||
-0.156952,
|
|
||||||
-0.140564,
|
|
||||||
-0.123291,
|
|
||||||
-0.10321,
|
|
||||||
-0.0827637,
|
|
||||||
-0.0652466,
|
|
||||||
-0.053772,
|
|
||||||
-0.0509949,
|
|
||||||
-0.0577698,
|
|
||||||
-0.0818176,
|
|
||||||
-0.114929,
|
|
||||||
-0.148895,
|
|
||||||
-0.181122,
|
|
||||||
-0.200714,
|
|
||||||
-0.21048,
|
|
||||||
-0.203644,
|
|
||||||
-0.179413,
|
|
||||||
-0.145325,
|
|
||||||
-0.104492,
|
|
||||||
-0.0658264,
|
|
||||||
-0.0332031,
|
|
||||||
-0.0106201,
|
|
||||||
-0.00363159,
|
|
||||||
-0.00909424,
|
|
||||||
-0.0244141,
|
|
||||||
-0.0422058,
|
|
||||||
-0.0537415,
|
|
||||||
-0.0610046,
|
|
||||||
-0.0609741,
|
|
||||||
-0.0547791
|
|
||||||
};
|
|
||||||
|
|
||||||
/* comparison test code from http://www-users.cs.york.ac.uk/~fisher/mkfilter/
|
|
||||||
(the above page kicks ass, BTW)*/
|
|
||||||
|
|
||||||
#define NZEROS 10
|
|
||||||
#define NPOLES 10
|
|
||||||
#define GAIN 4.599477515e+02
|
|
||||||
|
|
||||||
static float xv[NZEROS + 1], yv[NPOLES + 1];
|
|
||||||
|
|
||||||
static double
|
|
||||||
filterloop (double next)
|
|
||||||
{
|
|
||||||
xv[0] = xv[1];
|
|
||||||
xv[1] = xv[2];
|
|
||||||
xv[2] = xv[3];
|
|
||||||
xv[3] = xv[4];
|
|
||||||
xv[4] = xv[5];
|
|
||||||
xv[5] = xv[6];
|
|
||||||
xv[6] = xv[7];
|
|
||||||
xv[7] = xv[8];
|
|
||||||
xv[8] = xv[9];
|
|
||||||
xv[9] = xv[10];
|
|
||||||
xv[10] = next / GAIN;
|
|
||||||
yv[0] = yv[1];
|
|
||||||
yv[1] = yv[2];
|
|
||||||
yv[2] = yv[3];
|
|
||||||
yv[3] = yv[4];
|
|
||||||
yv[4] = yv[5];
|
|
||||||
yv[5] = yv[6];
|
|
||||||
yv[6] = yv[7];
|
|
||||||
yv[7] = yv[8];
|
|
||||||
yv[8] = yv[9];
|
|
||||||
yv[9] = yv[10];
|
|
||||||
yv[10] = (xv[10] - xv[0]) + 5 * (xv[2] - xv[8]) + 10 * (xv[6] - xv[4])
|
|
||||||
+ (-0.6665900311 * yv[0]) + (1.0070146601 * yv[1])
|
|
||||||
+ (-3.1262875409 * yv[2]) + (3.5017171569 * yv[3])
|
|
||||||
+ (-6.2779211945 * yv[4]) + (5.2966481740 * yv[5])
|
|
||||||
+ (-6.7570216587 * yv[6]) + (4.0760335768 * yv[7])
|
|
||||||
+ (-3.9134284363 * yv[8]) + (1.3997338886 * yv[9]);
|
|
||||||
return (yv[10]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
|
|
||||||
/* run the pregenerated Chebyshev filter, then our own distillation
|
|
||||||
through the generic and specialized code */
|
|
||||||
double *work = malloc (128 * sizeof (double));
|
|
||||||
IIR_state iir;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < 128; i++)
|
|
||||||
work[i] = filterloop (data[i]);
|
|
||||||
{
|
|
||||||
FILE *out = fopen ("IIR_ref.m", "w");
|
|
||||||
|
|
||||||
for (i = 0; i < 128; i++)
|
|
||||||
fprintf (out, "%g\n", work[i]);
|
|
||||||
fclose (out);
|
|
||||||
}
|
|
||||||
|
|
||||||
IIR_init (&iir, NPOLES, GAIN, cheb_bandpass_A, cheb_bandpass_B);
|
|
||||||
for (i = 0; i < 128; i++)
|
|
||||||
work[i] = IIR_filter (&iir, data[i]);
|
|
||||||
{
|
|
||||||
FILE *out = fopen ("IIR_gen.m", "w");
|
|
||||||
|
|
||||||
for (i = 0; i < 128; i++)
|
|
||||||
fprintf (out, "%g\n", work[i]);
|
|
||||||
fclose (out);
|
|
||||||
}
|
|
||||||
IIR_clear (&iir);
|
|
||||||
|
|
||||||
IIR_init (&iir, NPOLES, GAIN, cheb_bandpass_A, cheb_bandpass_B);
|
|
||||||
for (i = 0; i < 128; i++)
|
|
||||||
work[i] = IIR_filter_ChebBand (&iir, data[i]);
|
|
||||||
{
|
|
||||||
FILE *out = fopen ("IIR_cheb.m", "w");
|
|
||||||
|
|
||||||
for (i = 0; i < 128; i++)
|
|
||||||
fprintf (out, "%g\n", work[i]);
|
|
||||||
fclose (out);
|
|
||||||
}
|
|
||||||
IIR_clear (&iir);
|
|
||||||
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,37 +0,0 @@
|
||||||
/********************************************************************
|
|
||||||
* *
|
|
||||||
* THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
|
|
||||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
|
|
||||||
* THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
|
|
||||||
* PLEASE READ THESE TERMS DISTRIBUTING. *
|
|
||||||
* *
|
|
||||||
* THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
|
|
||||||
* by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
|
|
||||||
* http://www.xiph.org/ *
|
|
||||||
* *
|
|
||||||
********************************************************************
|
|
||||||
|
|
||||||
function: Direct Form I, II IIR filters, plus some specializations
|
|
||||||
last mod: $Id$
|
|
||||||
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
#ifndef _V_IIR_H_
|
|
||||||
#define _V_IIR_H_
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int stages;
|
|
||||||
double *coeff_A;
|
|
||||||
double *coeff_B;
|
|
||||||
double *z_A;
|
|
||||||
double *z_B;
|
|
||||||
int ring;
|
|
||||||
double gain;
|
|
||||||
} IIR_state;
|
|
||||||
|
|
||||||
void IIR_init(IIR_state *s,int stages,double gain, double *A, double *B);
|
|
||||||
void IIR_clear(IIR_state *s);
|
|
||||||
double IIR_filter(IIR_state *s,double in);
|
|
||||||
double IIR_filter_ChebBand(IIR_state *s,double in);
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in a new issue