summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog30
m---------common0
-rw-r--r--docs/plugins/Makefile.am4
-rw-r--r--docs/plugins/gst-plugins-good-plugins-docs.sgml4
-rw-r--r--docs/plugins/gst-plugins-good-plugins-sections.txt58
-rw-r--r--docs/plugins/gst-plugins-good-plugins.args26
-rw-r--r--docs/plugins/inspect/plugin-audiofx.xml70
-rw-r--r--gst/audiofx/Makefile.am8
-rw-r--r--gst/audiofx/audiochebband.c114
-rw-r--r--gst/audiofx/audiochebband.h36
-rw-r--r--gst/audiofx/audiocheblimit.c120
-rw-r--r--gst/audiofx/audiocheblimit.h36
-rw-r--r--gst/audiofx/audiochebyshevfreqband.c922
-rw-r--r--gst/audiofx/audiochebyshevfreqband.h79
-rw-r--r--gst/audiofx/audiochebyshevfreqlimit.c823
-rw-r--r--gst/audiofx/audiochebyshevfreqlimit.h78
-rw-r--r--gst/audiofx/audiofx.c12
-rw-r--r--tests/check/Makefile.am4
-rw-r--r--tests/check/elements/.gitignore4
-rw-r--r--tests/check/elements/audiochebband.c516
-rw-r--r--tests/check/elements/audiocheblimit.c340
-rw-r--r--tests/check/elements/audiochebyshevfreqband.c1540
-rw-r--r--tests/check/elements/audiochebyshevfreqlimit.c1020
23 files changed, 691 insertions, 5153 deletions
diff --git a/ChangeLog b/ChangeLog
index ac6cd5d9..417e1442 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2008-02-06 Jan Schmidt <jan.schmidt@sun.com>
+
+ * docs/plugins/Makefile.am:
+ * docs/plugins/gst-plugins-good-plugins-docs.sgml:
+ * docs/plugins/gst-plugins-good-plugins-sections.txt:
+ * docs/plugins/gst-plugins-good-plugins.args:
+ * docs/plugins/inspect/plugin-audiofx.xml:
+ * gst/audiofx/Makefile.am:
+ * gst/audiofx/audiochebband.c:
+ * gst/audiofx/audiochebband.h:
+ * gst/audiofx/audiocheblimit.c:
+ * gst/audiofx/audiocheblimit.h:
+ * gst/audiofx/audiochebyshevfreqband.c:
+ * gst/audiofx/audiochebyshevfreqband.h:
+ * gst/audiofx/audiochebyshevfreqlimit.c:
+ * gst/audiofx/audiochebyshevfreqlimit.h:
+ * gst/audiofx/audiofx.c:
+ * tests/check/Makefile.am:
+ * tests/check/elements/.cvsignore:
+ * tests/check/elements/audiochebband.c:
+ * tests/check/elements/audiocheblimit.c:
+ * tests/check/elements/audiochebyshevfreqband.c:
+ * tests/check/elements/audiochebyshevfreqlimit.c:
+
+ Rename audiochebyshevfreqband -> audiochebband and
+ audiochebyshevfreqlimit -> audiocheblimit and do the requisite CVS
+ surgery.
+
+ Closes: #491811
+
2008-02-05 Wim Taymans <wim.taymans@collabora.co.uk>
Patch by: orjan <orjanf at axis dot com>
diff --git a/common b/common
-Subproject 3c5473161ce19a3530bad279b842d542895b150
+Subproject 8b37d7ee833fab1d25b484d8574df3dae231b5f
diff --git a/docs/plugins/Makefile.am b/docs/plugins/Makefile.am
index ab6654c6..1b044ec5 100644
--- a/docs/plugins/Makefile.am
+++ b/docs/plugins/Makefile.am
@@ -100,8 +100,8 @@ EXTRA_HFILES = \
$(top_srcdir)/gst/audiofx/audiodynamic.h \
$(top_srcdir)/gst/audiofx/audioinvert.h \
$(top_srcdir)/gst/audiofx/audiopanorama.h \
- $(top_srcdir)/gst/audiofx/audiochebyshevfreqlimit.h \
- $(top_srcdir)/gst/audiofx/audiochebyshevfreqband.h \
+ $(top_srcdir)/gst/audiofx/audiocheblimit.h \
+ $(top_srcdir)/gst/audiofx/audiochebband.h \
$(top_srcdir)/gst/autodetect/gstautoaudiosink.h \
$(top_srcdir)/gst/autodetect/gstautovideosink.h \
$(top_srcdir)/gst/avi/gstavidemux.h \
diff --git a/docs/plugins/gst-plugins-good-plugins-docs.sgml b/docs/plugins/gst-plugins-good-plugins-docs.sgml
index 1e8394ac..c921b64f 100644
--- a/docs/plugins/gst-plugins-good-plugins-docs.sgml
+++ b/docs/plugins/gst-plugins-good-plugins-docs.sgml
@@ -16,8 +16,8 @@
<xi:include href="xml/element-apedemux.xml" />
<xi:include href="xml/element-apev2mux.xml" />
<xi:include href="xml/element-audioamplify.xml" />
- <xi:include href="xml/element-audiochebyshevfreqband.xml" />
- <xi:include href="xml/element-audiochebyshevfreqlimit.xml" />
+ <xi:include href="xml/element-audiochebband.xml" />
+ <xi:include href="xml/element-audiocheblimit.xml" />
<xi:include href="xml/element-audiodynamic.xml" />
<xi:include href="xml/element-audioinvert.xml" />
<xi:include href="xml/element-audiopanorama.xml" />
diff --git a/docs/plugins/gst-plugins-good-plugins-sections.txt b/docs/plugins/gst-plugins-good-plugins-sections.txt
index 06897f78..94613289 100644
--- a/docs/plugins/gst-plugins-good-plugins-sections.txt
+++ b/docs/plugins/gst-plugins-good-plugins-sections.txt
@@ -58,35 +58,35 @@ gst_audio_amplify_get_type
</SECTION>
<SECTION>
-<FILE>element-audiochebyshevfreqband</FILE>
-<TITLE>audiochebyshevfreqband</TITLE>
-GstAudioChebyshevFreqBand
-<SUBSECTION Standard>
-GstAudioChebyshevFreqBandClass
-GstAudioChebyshevFreqBandProcessFunc
-GST_AUDIO_CHEBYSHEV_FREQ_BAND
-GST_AUDIO_CHEBYSHEV_FREQ_BAND_CLASS
-GST_AUDIO_CHEBYSHEV_FREQ_BAND_GET_CLASS
-GST_IS_AUDIO_CHEBYSHEV_FREQ_BAND
-GST_IS_AUDIO_CHEBYSHEV_FREQ_BAND_CLASS
-GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND
-gst_audio_chebyshev_freq_band_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-audiochebyshevfreqlimit</FILE>
-<TITLE>audiochebyshevfreqlimit</TITLE>
-GstAudioChebyshevFreqLimit
-<SUBSECTION Standard>
-GstAudioChebyshevFreqLimitClass
-GstAudioChebyshevFreqLimitProcessFunc
-GST_AUDIO_CHEBYSHEV_FREQ_LIMIT
-GST_AUDIO_CHEBYSHEV_FREQ_LIMIT_CLASS
-GST_AUDIO_CHEBYSHEV_FREQ_LIMIT_GET_CLASS
-GST_IS_AUDIO_CHEBYSHEV_FREQ_LIMIT
-GST_IS_AUDIO_CHEBYSHEV_FREQ_LIMIT_CLASS
-GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT
-gst_audio_chebyshev_freq_limit_get_type
+<FILE>element-audiochebband</FILE>
+<TITLE>audiochebband</TITLE>
+GstAudioChebBand
+<SUBSECTION Standard>
+GstAudioChebBandClass
+GstAudioChebBandProcessFunc
+GST_AUDIO_CHEB_BAND
+GST_AUDIO_CHEB_BAND_CLASS
+GST_AUDIO_CHEB_BAND_GET_CLASS
+GST_IS_AUDIO_CHEB_BAND
+GST_IS_AUDIO_CHEB_BAND_CLASS
+GST_TYPE_AUDIO_CHEB_BAND
+gst_audio_cheb_band_get_type
+</SECTION>
+
+<SECTION>
+<FILE>element-audiocheblimit</FILE>
+<TITLE>audiocheblimit</TITLE>
+GstAudioChebLimit
+<SUBSECTION Standard>
+GstAudioChebLimitClass
+GstAudioChebLimitProcessFunc
+GST_AUDIO_CHEB_LIMIT
+GST_AUDIO_CHEB_LIMIT_CLASS
+GST_AUDIO_CHEB_LIMIT_GET_CLASS
+GST_IS_AUDIO_CHEB_LIMIT
+GST_IS_AUDIO_CHEB_LIMIT_CLASS
+GST_TYPE_AUDIO_CHEB_LIMIT
+gst_audio_cheb_limit_get_type
</SECTION>
<SECTION>
diff --git a/docs/plugins/gst-plugins-good-plugins.args b/docs/plugins/gst-plugins-good-plugins.args
index 8ff67565..03f31a98 100644
--- a/docs/plugins/gst-plugins-good-plugins.args
+++ b/docs/plugins/gst-plugins-good-plugins.args
@@ -17399,7 +17399,7 @@
</ARG>
<ARG>
-<NAME>GstAudioChebyshevFreqBand::lower-frequency</NAME>
+<NAME>GstAudioChebBand::lower-frequency</NAME>
<TYPE>gfloat</TYPE>
<RANGE>[0,100000]</RANGE>
<FLAGS>rw</FLAGS>
@@ -17409,8 +17409,8 @@
</ARG>
<ARG>
-<NAME>GstAudioChebyshevFreqBand::mode</NAME>
-<TYPE>GstAudioChebyshevFreqBandMode</TYPE>
+<NAME>GstAudioChebBand::mode</NAME>
+<TYPE>GstAudioChebBandMode</TYPE>
<RANGE></RANGE>
<FLAGS>rw</FLAGS>
<NICK>Mode</NICK>
@@ -17419,7 +17419,7 @@
</ARG>
<ARG>
-<NAME>GstAudioChebyshevFreqBand::poles</NAME>
+<NAME>GstAudioChebBand::poles</NAME>
<TYPE>gint</TYPE>
<RANGE>[4,32]</RANGE>
<FLAGS>rw</FLAGS>
@@ -17429,7 +17429,7 @@
</ARG>
<ARG>
-<NAME>GstAudioChebyshevFreqBand::ripple</NAME>
+<NAME>GstAudioChebBand::ripple</NAME>
<TYPE>gfloat</TYPE>
<RANGE>[0,200]</RANGE>
<FLAGS>rw</FLAGS>
@@ -17439,7 +17439,7 @@
</ARG>
<ARG>
-<NAME>GstAudioChebyshevFreqBand::type</NAME>
+<NAME>GstAudioChebBand::type</NAME>
<TYPE>gint</TYPE>
<RANGE>[1,2]</RANGE>
<FLAGS>rw</FLAGS>
@@ -17449,7 +17449,7 @@
</ARG>
<ARG>
-<NAME>GstAudioChebyshevFreqBand::upper-frequency</NAME>
+<NAME>GstAudioChebBand::upper-frequency</NAME>
<TYPE>gfloat</TYPE>
<RANGE>[0,100000]</RANGE>
<FLAGS>rw</FLAGS>
@@ -17459,7 +17459,7 @@
</ARG>
<ARG>
-<NAME>GstAudioChebyshevFreqLimit::cutoff</NAME>
+<NAME>GstAudioChebLimit::cutoff</NAME>
<TYPE>gfloat</TYPE>
<RANGE>[0,100000]</RANGE>
<FLAGS>rw</FLAGS>
@@ -17469,8 +17469,8 @@
</ARG>
<ARG>
-<NAME>GstAudioChebyshevFreqLimit::mode</NAME>
-<TYPE>GstAudioChebyshevFreqLimitMode</TYPE>
+<NAME>GstAudioChebLimit::mode</NAME>
+<TYPE>GstAudioChebLimitMode</TYPE>
<RANGE></RANGE>
<FLAGS>rw</FLAGS>
<NICK>Mode</NICK>
@@ -17479,7 +17479,7 @@
</ARG>
<ARG>
-<NAME>GstAudioChebyshevFreqLimit::poles</NAME>
+<NAME>GstAudioChebLimit::poles</NAME>
<TYPE>gint</TYPE>
<RANGE>[2,32]</RANGE>
<FLAGS>rw</FLAGS>
@@ -17489,7 +17489,7 @@
</ARG>
<ARG>
-<NAME>GstAudioChebyshevFreqLimit::ripple</NAME>
+<NAME>GstAudioChebLimit::ripple</NAME>
<TYPE>gfloat</TYPE>
<RANGE>[0,200]</RANGE>
<FLAGS>rw</FLAGS>
@@ -17499,7 +17499,7 @@
</ARG>
<ARG>
-<NAME>GstAudioChebyshevFreqLimit::type</NAME>
+<NAME>GstAudioChebLimit::type</NAME>
<TYPE>gint</TYPE>
<RANGE>[1,2]</RANGE>
<FLAGS>rw</FLAGS>
diff --git a/docs/plugins/inspect/plugin-audiofx.xml b/docs/plugins/inspect/plugin-audiofx.xml
index 88d04ed5..8853eb61 100644
--- a/docs/plugins/inspect/plugin-audiofx.xml
+++ b/docs/plugins/inspect/plugin-audiofx.xml
@@ -14,59 +14,59 @@
<longname>AudioAmplify</longname>
<class>Filter/Effect/Audio</class>
<description>Amplifies an audio stream by a given factor</description>
- <author>Sebastian Dr303266ge &lt;slomo@circular-chaos.org&gt;</author>
+ <author>Sebastian Dröge &lt;slomo@circular-chaos.org&gt;</author>
<pads>
<caps>
- <name>sink</name>
- <direction>sink</direction>
+ <name>src</name>
+ <direction>source</direction>
<presence>always</presence>
<details>audio/x-raw-int, depth=(int)16, width=(int)16, endianness=(int)1234, signed=(boolean)true, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]; audio/x-raw-float, width=(int)32, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]</details>
</caps>
<caps>
- <name>src</name>
- <direction>source</direction>
+ <name>sink</name>
+ <direction>sink</direction>
<presence>always</presence>
<details>audio/x-raw-int, depth=(int)16, width=(int)16, endianness=(int)1234, signed=(boolean)true, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]; audio/x-raw-float, width=(int)32, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]</details>
</caps>
</pads>
</element>
<element>
- <name>audiochebyshevfreqband</name>
- <longname>AudioChebyshevFreqBand</longname>
+ <name>audiochebband</name>
+ <longname>AudioChebBand</longname>
<class>Filter/Effect/Audio</class>
<description>Chebyshev band pass and band reject filter</description>
- <author>Sebastian Dr303266ge &lt;slomo@circular-chaos.org&gt;</author>
+ <author>Sebastian Dröge &lt;slomo@circular-chaos.org&gt;</author>
<pads>
<caps>
- <name>sink</name>
- <direction>sink</direction>
+ <name>src</name>
+ <direction>source</direction>
<presence>always</presence>
<details>audio/x-raw-float, width=(int){ 32, 64 }, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]</details>
</caps>
<caps>
- <name>src</name>
- <direction>source</direction>
+ <name>sink</name>
+ <direction>sink</direction>
<presence>always</presence>
<details>audio/x-raw-float, width=(int){ 32, 64 }, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]</details>
</caps>
</pads>
</element>
<element>
- <name>audiochebyshevfreqlimit</name>
- <longname>AudioChebyshevFreqLimit</longname>
+ <name>audiocheblimit</name>
+ <longname>AudioChebLimit</longname>
<class>Filter/Effect/Audio</class>
<description>Chebyshev low pass and high pass filter</description>
- <author>Sebastian Dr303266ge &lt;slomo@circular-chaos.org&gt;</author>
+ <author>Sebastian Dröge &lt;slomo@circular-chaos.org&gt;</author>
<pads>
<caps>
- <name>sink</name>
- <direction>sink</direction>
+ <name>src</name>
+ <direction>source</direction>
<presence>always</presence>
<details>audio/x-raw-float, width=(int){ 32, 64 }, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]</details>
</caps>
<caps>
- <name>src</name>
- <direction>source</direction>
+ <name>sink</name>
+ <direction>sink</direction>
<presence>always</presence>
<details>audio/x-raw-float, width=(int){ 32, 64 }, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]</details>
</caps>
@@ -77,17 +77,17 @@
<longname>AudioDynamic</longname>
<class>Filter/Effect/Audio</class>
<description>Compressor and Expander</description>
- <author>Sebastian Dr303266ge &lt;slomo@circular-chaos.org&gt;</author>
+ <author>Sebastian Dröge &lt;slomo@circular-chaos.org&gt;</author>
<pads>
<caps>
- <name>sink</name>
- <direction>sink</direction>
+ <name>src</name>
+ <direction>source</direction>
<presence>always</presence>
<details>audio/x-raw-int, depth=(int)16, width=(int)16, endianness=(int)1234, signed=(boolean)true, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]; audio/x-raw-float, width=(int)32, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]</details>
</caps>
<caps>
- <name>src</name>
- <direction>source</direction>
+ <name>sink</name>
+ <direction>sink</direction>
<presence>always</presence>
<details>audio/x-raw-int, depth=(int)16, width=(int)16, endianness=(int)1234, signed=(boolean)true, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]; audio/x-raw-float, width=(int)32, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]</details>
</caps>
@@ -98,17 +98,17 @@
<longname>AudioInvert</longname>
<class>Filter/Effect/Audio</class>
<description>Swaps upper and lower half of audio samples</description>
- <author>Sebastian Dr303266ge &lt;slomo@circular-chaos.org&gt;</author>
+ <author>Sebastian Dröge &lt;slomo@circular-chaos.org&gt;</author>
<pads>
<caps>
- <name>sink</name>
- <direction>sink</direction>
+ <name>src</name>
+ <direction>source</direction>
<presence>always</presence>
<details>audio/x-raw-int, depth=(int)16, width=(int)16, endianness=(int)1234, signed=(boolean)true, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]; audio/x-raw-float, width=(int)32, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]</details>
</caps>
<caps>
- <name>src</name>
- <direction>source</direction>
+ <name>sink</name>
+ <direction>sink</direction>
<presence>always</presence>
<details>audio/x-raw-int, depth=(int)16, width=(int)16, endianness=(int)1234, signed=(boolean)true, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]; audio/x-raw-float, width=(int)32, endianness=(int)1234, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]</details>
</caps>
@@ -122,17 +122,17 @@
<author>Stefan Kost &lt;ensonic@users.sf.net&gt;</author>
<pads>
<caps>
- <name>sink</name>
- <direction>sink</direction>
- <presence>always</presence>
- <details>audio/x-raw-float, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ], endianness=(int)1234, width=(int)32; audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ], endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean)true</details>
- </caps>
- <caps>
<name>src</name>
<direction>source</direction>
<presence>always</presence>
<details>audio/x-raw-float, rate=(int)[ 1, 2147483647 ], channels=(int)2, endianness=(int)1234, width=(int)32; audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)2, endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean)true</details>
</caps>
+ <caps>
+ <name>sink</name>
+ <direction>sink</direction>
+ <presence>always</presence>
+ <details>audio/x-raw-float, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ], endianness=(int)1234, width=(int)32; audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2 ], endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean)true</details>
+ </caps>
</pads>
</element>
</elements>
diff --git a/gst/audiofx/Makefile.am b/gst/audiofx/Makefile.am
index 458fadb7..02b85bec 100644
--- a/gst/audiofx/Makefile.am
+++ b/gst/audiofx/Makefile.am
@@ -8,8 +8,8 @@ libgstaudiofx_la_SOURCES = audiofx.c\
audioinvert.c \
audioamplify.c \
audiodynamic.c \
- audiochebyshevfreqlimit.c \
- audiochebyshevfreqband.c
+ audiocheblimit.c \
+ audiochebband.c
# flags used to compile this plugin
libgstaudiofx_la_CFLAGS = $(GST_CFLAGS) \
@@ -29,6 +29,6 @@ noinst_HEADERS = audiopanorama.h \
audioinvert.h \
audioamplify.h \
audiodynamic.h \
- audiochebyshevfreqlimit.h \
- audiochebyshevfreqband.h
+ audiocheblimit.h \
+ audiochebband.h
diff --git a/gst/audiofx/audiochebband.c b/gst/audiofx/audiochebband.c
index 03978a79..e0fe9492 100644
--- a/gst/audiofx/audiochebband.c
+++ b/gst/audiofx/audiochebband.c
@@ -33,7 +33,7 @@
*/
/**
- * SECTION:element-audiochebyshevfreqband
+ * SECTION:element-audiochebband
* @short_description: Chebyshev band pass and band reject filter
*
* <refsect2>
@@ -65,9 +65,9 @@
* <title>Example launch line</title>
* <para>
* <programlisting>
- * gst-launch audiotestsrc freq=1500 ! audioconvert ! audiochebyshevfreqband mode=band-pass lower-frequency=1000 upper-frequenc=6000 poles=4 ! audioconvert ! alsasink
- * gst-launch filesrc location="melo1.ogg" ! oggdemux ! vorbisdec ! audioconvert ! audiochebyshevfreqband mode=band-reject lower-frequency=1000 upper-frequency=4000 ripple=0.2 ! audioconvert ! alsasink
- * gst-launch audiotestsrc wave=white-noise ! audioconvert ! audiochebyshevfreqband mode=band-pass lower-frequency=1000 upper-frequency=4000 type=2 ! audioconvert ! alsasink
+ * gst-launch audiotestsrc freq=1500 ! audioconvert ! audiochebband mode=band-pass lower-frequency=1000 upper-frequenc=6000 poles=4 ! audioconvert ! alsasink
+ * gst-launch filesrc location="melo1.ogg" ! oggdemux ! vorbisdec ! audioconvert ! audiochebband mode=band-reject lower-frequency=1000 upper-frequency=4000 ripple=0.2 ! audioconvert ! alsasink
+ * gst-launch audiotestsrc wave=white-noise ! audioconvert ! audiochebband mode=band-pass lower-frequency=1000 upper-frequency=4000 type=2 ! audioconvert ! alsasink
* </programlisting>
* </para>
* </refsect2>
@@ -85,13 +85,13 @@
#include <math.h>
-#include "audiochebyshevfreqband.h"
+#include "audiochebband.h"
-#define GST_CAT_DEFAULT gst_audio_chebyshev_freq_band_debug
+#define GST_CAT_DEFAULT gst_audio_cheb_band_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
static const GstElementDetails element_details =
-GST_ELEMENT_DETAILS ("AudioChebyshevFreqBand",
+GST_ELEMENT_DETAILS ("AudioChebBand",
"Filter/Effect/Audio",
"Chebyshev band pass and band reject filter",
"Sebastian Dröge <slomo@circular-chaos.org>");
@@ -122,26 +122,25 @@ enum
" channels = (int) [ 1, MAX ]"
#define DEBUG_INIT(bla) \
- GST_DEBUG_CATEGORY_INIT (gst_audio_chebyshev_freq_band_debug, "audiochebyshevfreqband", 0, "audiochebyshevfreqband element");
+ GST_DEBUG_CATEGORY_INIT (gst_audio_cheb_band_debug, "audiochebband", 0, "audiochebband element");
-GST_BOILERPLATE_FULL (GstAudioChebyshevFreqBand, gst_audio_chebyshev_freq_band,
+GST_BOILERPLATE_FULL (GstAudioChebBand, gst_audio_cheb_band,
GstAudioFilter, GST_TYPE_AUDIO_FILTER, DEBUG_INIT);
-static void gst_audio_chebyshev_freq_band_set_property (GObject * object,
+static void gst_audio_cheb_band_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_audio_chebyshev_freq_band_get_property (GObject * object,
+static void gst_audio_cheb_band_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
-static gboolean gst_audio_chebyshev_freq_band_setup (GstAudioFilter * filter,
+static gboolean gst_audio_cheb_band_setup (GstAudioFilter * filter,
GstRingBufferSpec * format);
static GstFlowReturn
-gst_audio_chebyshev_freq_band_transform_ip (GstBaseTransform * base,
- GstBuffer * buf);
-static gboolean gst_audio_chebyshev_freq_band_start (GstBaseTransform * base);
+gst_audio_cheb_band_transform_ip (GstBaseTransform * base, GstBuffer * buf);
+static gboolean gst_audio_cheb_band_start (GstBaseTransform * base);
-static void process_64 (GstAudioChebyshevFreqBand * filter,
+static void process_64 (GstAudioChebBand * filter,
gdouble * data, guint num_samples);
-static void process_32 (GstAudioChebyshevFreqBand * filter,
+static void process_32 (GstAudioChebBand * filter,
gfloat * data, guint num_samples);
enum
@@ -150,9 +149,9 @@ enum
MODE_BAND_REJECT
};
-#define GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND_MODE (gst_audio_chebyshev_freq_band_mode_get_type ())
+#define GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND_MODE (gst_audio_cheb_band_mode_get_type ())
static GType
-gst_audio_chebyshev_freq_band_mode_get_type (void)
+gst_audio_cheb_band_mode_get_type (void)
{
static GType gtype = 0;
@@ -165,7 +164,7 @@ gst_audio_chebyshev_freq_band_mode_get_type (void)
{0, NULL, NULL}
};
- gtype = g_enum_register_static ("GstAudioChebyshevFreqBandMode", values);
+ gtype = g_enum_register_static ("GstAudioChebBandMode", values);
}
return gtype;
}
@@ -173,7 +172,7 @@ gst_audio_chebyshev_freq_band_mode_get_type (void)
/* GObject vmethod implementations */
static void
-gst_audio_chebyshev_freq_band_base_init (gpointer klass)
+gst_audio_cheb_band_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstCaps *caps;
@@ -187,9 +186,9 @@ gst_audio_chebyshev_freq_band_base_init (gpointer klass)
}
static void
-gst_audio_chebyshev_freq_band_dispose (GObject * object)
+gst_audio_cheb_band_dispose (GObject * object)
{
- GstAudioChebyshevFreqBand *filter = GST_AUDIO_CHEBYSHEV_FREQ_BAND (object);
+ GstAudioChebBand *filter = GST_AUDIO_CHEB_BAND (object);
if (filter->a) {
g_free (filter->a);
@@ -202,7 +201,7 @@ gst_audio_chebyshev_freq_band_dispose (GObject * object)
}
if (filter->channels) {
- GstAudioChebyshevFreqBandChannelCtx *ctx;
+ GstAudioChebBandChannelCtx *ctx;
gint i, channels = GST_AUDIO_FILTER (filter)->format.channels;
for (i = 0; i < channels; i++) {
@@ -219,8 +218,7 @@ gst_audio_chebyshev_freq_band_dispose (GObject * object)
}
static void
-gst_audio_chebyshev_freq_band_class_init (GstAudioChebyshevFreqBandClass *
- klass)
+gst_audio_cheb_band_class_init (GstAudioChebBandClass * klass)
{
GObjectClass *gobject_class;
GstBaseTransformClass *trans_class;
@@ -230,9 +228,9 @@ gst_audio_chebyshev_freq_band_class_init (GstAudioChebyshevFreqBandClass *
trans_class = (GstBaseTransformClass *) klass;
filter_class = (GstAudioFilterClass *) klass;
- gobject_class->set_property = gst_audio_chebyshev_freq_band_set_property;
- gobject_class->get_property = gst_audio_chebyshev_freq_band_get_property;
- gobject_class->dispose = gst_audio_chebyshev_freq_band_dispose;
+ gobject_class->set_property = gst_audio_cheb_band_set_property;
+ gobject_class->get_property = gst_audio_cheb_band_get_property;
+ gobject_class->dispose = gst_audio_cheb_band_dispose;
g_object_class_install_property (gobject_class, PROP_MODE,
g_param_spec_enum ("mode", "Mode",
@@ -265,15 +263,15 @@ gst_audio_chebyshev_freq_band_class_init (GstAudioChebyshevFreqBandClass *
"Number of poles to use, will be rounded up to the next multiply of four",
4, 32, 4, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
- filter_class->setup = GST_DEBUG_FUNCPTR (gst_audio_chebyshev_freq_band_setup);
+ filter_class->setup = GST_DEBUG_FUNCPTR (gst_audio_cheb_band_setup);
trans_class->transform_ip =
- GST_DEBUG_FUNCPTR (gst_audio_chebyshev_freq_band_transform_ip);
- trans_class->start = GST_DEBUG_FUNCPTR (gst_audio_chebyshev_freq_band_start);
+ GST_DEBUG_FUNCPTR (gst_audio_cheb_band_transform_ip);
+ trans_class->start = GST_DEBUG_FUNCPTR (gst_audio_cheb_band_start);
}
static void
-gst_audio_chebyshev_freq_band_init (GstAudioChebyshevFreqBand * filter,
- GstAudioChebyshevFreqBandClass * klass)
+gst_audio_cheb_band_init (GstAudioChebBand * filter,
+ GstAudioChebBandClass * klass)
{
filter->lower_frequency = filter->upper_frequency = 0.0;
filter->mode = MODE_BAND_PASS;
@@ -289,7 +287,7 @@ gst_audio_chebyshev_freq_band_init (GstAudioChebyshevFreqBand * filter,
}
static void
-generate_biquad_coefficients (GstAudioChebyshevFreqBand * filter,
+generate_biquad_coefficients (GstAudioChebBand * filter,
gint p, gdouble * a0, gdouble * a1, gdouble * a2, gdouble * a3,
gdouble * a4, gdouble * b1, gdouble * b2, gdouble * b3, gdouble * b4)
{
@@ -520,7 +518,7 @@ calculate_gain (gdouble * a, gdouble * b, gint num_a, gint num_b, gdouble zr,
}
static void
-generate_coefficients (GstAudioChebyshevFreqBand * filter)
+generate_coefficients (GstAudioChebBand * filter)
{
gint channels = GST_AUDIO_FILTER (filter)->format.channels;
@@ -535,7 +533,7 @@ generate_coefficients (GstAudioChebyshevFreqBand * filter)
}
if (filter->channels) {
- GstAudioChebyshevFreqBandChannelCtx *ctx;
+ GstAudioChebBandChannelCtx *ctx;
gint i;
for (i = 0; i < channels; i++) {
@@ -553,7 +551,7 @@ generate_coefficients (GstAudioChebyshevFreqBand * filter)
filter->a = g_new0 (gdouble, 1);
filter->a[0] = 1.0;
filter->num_b = 0;
- filter->channels = g_new0 (GstAudioChebyshevFreqBandChannelCtx, channels);
+ filter->channels = g_new0 (GstAudioChebBandChannelCtx, channels);
GST_LOG_OBJECT (filter, "rate was not set yet");
return;
}
@@ -565,7 +563,7 @@ generate_coefficients (GstAudioChebyshevFreqBand * filter)
filter->a = g_new0 (gdouble, 1);
filter->a[0] = (filter->mode == MODE_BAND_PASS) ? 0.0 : 1.0;
filter->num_b = 0;
- filter->channels = g_new0 (GstAudioChebyshevFreqBandChannelCtx, channels);
+ filter->channels = g_new0 (GstAudioChebBandChannelCtx, channels);
GST_LOG_OBJECT (filter, "frequency band had no or negative dimension");
return;
}
@@ -591,9 +589,9 @@ generate_coefficients (GstAudioChebyshevFreqBand * filter)
filter->num_b = np + 1;
filter->b = b = g_new0 (gdouble, np + 5);
- filter->channels = g_new0 (GstAudioChebyshevFreqBandChannelCtx, channels);
+ filter->channels = g_new0 (GstAudioChebBandChannelCtx, channels);
for (i = 0; i < channels; i++) {
- GstAudioChebyshevFreqBandChannelCtx *ctx = &filter->channels[i];
+ GstAudioChebBandChannelCtx *ctx = &filter->channels[i];
ctx->x = g_new0 (gdouble, np + 1);
ctx->y = g_new0 (gdouble, np + 1);
@@ -714,10 +712,10 @@ generate_coefficients (GstAudioChebyshevFreqBand * filter)
}
static void
-gst_audio_chebyshev_freq_band_set_property (GObject * object, guint prop_id,
+gst_audio_cheb_band_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
- GstAudioChebyshevFreqBand *filter = GST_AUDIO_CHEBYSHEV_FREQ_BAND (object);
+ GstAudioChebBand *filter = GST_AUDIO_CHEB_BAND (object);
switch (prop_id) {
case PROP_MODE:
@@ -763,10 +761,10 @@ gst_audio_chebyshev_freq_band_set_property (GObject * object, guint prop_id,
}
static void
-gst_audio_chebyshev_freq_band_get_property (GObject * object, guint prop_id,
+gst_audio_cheb_band_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
- GstAudioChebyshevFreqBand *filter = GST_AUDIO_CHEBYSHEV_FREQ_BAND (object);
+ GstAudioChebBand *filter = GST_AUDIO_CHEB_BAND (object);
switch (prop_id) {
case PROP_MODE:
@@ -796,17 +794,16 @@ gst_audio_chebyshev_freq_band_get_property (GObject * object, guint prop_id,
/* GstAudioFilter vmethod implementations */
static gboolean
-gst_audio_chebyshev_freq_band_setup (GstAudioFilter * base,
- GstRingBufferSpec * format)
+gst_audio_cheb_band_setup (GstAudioFilter * base, GstRingBufferSpec * format)
{
- GstAudioChebyshevFreqBand *filter = GST_AUDIO_CHEBYSHEV_FREQ_BAND (base);
+ GstAudioChebBand *filter = GST_AUDIO_CHEB_BAND (base);
gboolean ret = TRUE;
if (format->width == 32)
- filter->process = (GstAudioChebyshevFreqBandProcessFunc)
+ filter->process = (GstAudioChebBandProcessFunc)
process_32;
else if (format->width == 64)
- filter->process = (GstAudioChebyshevFreqBandProcessFunc)
+ filter->process = (GstAudioChebBandProcessFunc)
process_64;
else
ret = FALSE;
@@ -817,8 +814,8 @@ gst_audio_chebyshev_freq_band_setup (GstAudioFilter * base,
}
static inline gdouble
-process (GstAudioChebyshevFreqBand * filter,
- GstAudioChebyshevFreqBandChannelCtx * ctx, gdouble x0)
+process (GstAudioChebBand * filter,
+ GstAudioChebBandChannelCtx * ctx, gdouble x0)
{
gdouble val = filter->a[0] * x0;
gint i, j;
@@ -857,7 +854,7 @@ process (GstAudioChebyshevFreqBand * filter,
#define DEFINE_PROCESS_FUNC(width,ctype) \
static void \
-process_##width (GstAudioChebyshevFreqBand * filter, \
+process_##width (GstAudioChebBand * filter, \
g##ctype * data, guint num_samples) \
{ \
gint i, j, channels = GST_AUDIO_FILTER (filter)->format.channels; \
@@ -878,10 +875,9 @@ DEFINE_PROCESS_FUNC (64, double);
/* GstBaseTransform vmethod implementations */
static GstFlowReturn
-gst_audio_chebyshev_freq_band_transform_ip (GstBaseTransform * base,
- GstBuffer * buf)
+gst_audio_cheb_band_transform_ip (GstBaseTransform * base, GstBuffer * buf)
{
- GstAudioChebyshevFreqBand *filter = GST_AUDIO_CHEBYSHEV_FREQ_BAND (base);
+ GstAudioChebBand *filter = GST_AUDIO_CHEB_BAND (base);
guint num_samples =
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (filter)->format.width / 8);
@@ -900,11 +896,11 @@ gst_audio_chebyshev_freq_band_transform_ip (GstBaseTransform * base,
}
static gboolean
-gst_audio_chebyshev_freq_band_start (GstBaseTransform * base)
+gst_audio_cheb_band_start (GstBaseTransform * base)
{
- GstAudioChebyshevFreqBand *filter = GST_AUDIO_CHEBYSHEV_FREQ_BAND (base);
+ GstAudioChebBand *filter = GST_AUDIO_CHEB_BAND (base);
gint channels = GST_AUDIO_FILTER (filter)->format.channels;
- GstAudioChebyshevFreqBandChannelCtx *ctx;
+ GstAudioChebBandChannelCtx *ctx;
gint i;
/* Reset the history of input and output values if
diff --git a/gst/audiofx/audiochebband.h b/gst/audiofx/audiochebband.h
index e8c58074..ece011ab 100644
--- a/gst/audiofx/audiochebband.h
+++ b/gst/audiofx/audiochebband.h
@@ -18,8 +18,8 @@
* Boston, MA 02111-1307, USA.
*/
-#ifndef __GST_AUDIO_CHEBYSHEV_FREQ_BAND_H__
-#define __GST_AUDIO_CHEBYSHEV_FREQ_BAND_H__
+#ifndef __GST_AUDIO_CHEB_BAND_H__
+#define __GST_AUDIO_CHEB_BAND_H__
#include <gst/gst.h>
#include <gst/base/gstbasetransform.h>
@@ -27,16 +27,16 @@
#include <gst/audio/gstaudiofilter.h>
G_BEGIN_DECLS
-#define GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND (gst_audio_chebyshev_freq_band_get_type())
-#define GST_AUDIO_CHEBYSHEV_FREQ_BAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND,GstAudioChebyshevFreqBand))
-#define GST_IS_AUDIO_CHEBYSHEV_FREQ_BAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND))
-#define GST_AUDIO_CHEBYSHEV_FREQ_BAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND,GstAudioChebyshevFreqBandClass))
-#define GST_IS_AUDIO_CHEBYSHEV_FREQ_BAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND))
-#define GST_AUDIO_CHEBYSHEV_FREQ_BAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND,GstAudioChebyshevFreqBandClass))
-typedef struct _GstAudioChebyshevFreqBand GstAudioChebyshevFreqBand;
-typedef struct _GstAudioChebyshevFreqBandClass GstAudioChebyshevFreqBandClass;
+#define GST_TYPE_AUDIO_CHEB_BAND (gst_audio_cheb_band_get_type())
+#define GST_AUDIO_CHEB_BAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_CHEB_BAND,GstAudioChebBand))
+#define GST_IS_AUDIO_CHEB_BAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_CHEB_BAND))
+#define GST_AUDIO_CHEB_BAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_AUDIO_CHEB_BAND,GstAudioChebBandClass))
+#define GST_IS_AUDIO_CHEB_BAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_AUDIO_CHEB_BAND))
+#define GST_AUDIO_CHEB_BAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_AUDIO_CHEB_BAND,GstAudioChebBandClass))
+typedef struct _GstAudioChebBand GstAudioChebBand;
+typedef struct _GstAudioChebBandClass GstAudioChebBandClass;
-typedef void (*GstAudioChebyshevFreqBandProcessFunc) (GstAudioChebyshevFreqBand *, guint8 *, guint);
+typedef void (*GstAudioChebBandProcessFunc) (GstAudioChebBand *, guint8 *, guint);
typedef struct
{
@@ -44,9 +44,9 @@ typedef struct
gint x_pos;
gdouble *y;
gint y_pos;
-} GstAudioChebyshevFreqBandChannelCtx;
+} GstAudioChebBandChannelCtx;
-struct _GstAudioChebyshevFreqBand
+struct _GstAudioChebBand
{
GstAudioFilter audiofilter;
@@ -58,22 +58,22 @@ struct _GstAudioChebyshevFreqBand
gfloat ripple;
/* < private > */
- GstAudioChebyshevFreqBandProcessFunc process;
+ GstAudioChebBandProcessFunc process;
gboolean have_coeffs;
gdouble *a;
gint num_a;
gdouble *b;
gint num_b;
- GstAudioChebyshevFreqBandChannelCtx *channels;
+ GstAudioChebBandChannelCtx *channels;
};
-struct _GstAudioChebyshevFreqBandClass
+struct _GstAudioChebBandClass
{
GstAudioFilterClass parent;
};
-GType gst_audio_chebyshev_freq_band_get_type (void);
+GType gst_audio_cheb_band_get_type (void);
G_END_DECLS
-#endif /* __GST_AUDIO_CHEBYSHEV_FREQ_BAND_H__ */
+#endif /* __GST_AUDIO_CHEB_BAND_H__ */
diff --git a/gst/audiofx/audiocheblimit.c b/gst/audiofx/audiocheblimit.c
index 344db9f1..1374faf9 100644
--- a/gst/audiofx/audiocheblimit.c
+++ b/gst/audiofx/audiocheblimit.c
@@ -29,7 +29,7 @@
*/
/**
- * SECTION:element-audiochebyshevfreqlimit
+ * SECTION:element-audiocheblimit
* @short_description: Chebyshev low pass and high pass filter
*
* <refsect2>
@@ -61,9 +61,9 @@
* <title>Example launch line</title>
* <para>
* <programlisting>
- * gst-launch audiotestsrc freq=1500 ! audioconvert ! audiochebyshevfreqlimit mode=low-pass cutoff=1000 poles=4 ! audioconvert ! alsasink
- * gst-launch filesrc location="melo1.ogg" ! oggdemux ! vorbisdec ! audioconvert ! audiochebyshevfreqlimit mode=high-pass cutoff=400 ripple=0.2 ! audioconvert ! alsasink
- * gst-launch audiotestsrc wave=white-noise ! audioconvert ! audiochebyshevfreqlimit mode=low-pass cutoff=800 type=2 ! audioconvert ! alsasink
+ * gst-launch audiotestsrc freq=1500 ! audioconvert ! audiocheblimit mode=low-pass cutoff=1000 poles=4 ! audioconvert ! alsasink
+ * gst-launch filesrc location="melo1.ogg" ! oggdemux ! vorbisdec ! audioconvert ! audiocheblimit mode=high-pass cutoff=400 ripple=0.2 ! audioconvert ! alsasink
+ * gst-launch audiotestsrc wave=white-noise ! audioconvert ! audiocheblimit mode=low-pass cutoff=800 type=2 ! audioconvert ! alsasink
* </programlisting>
* </para>
* </refsect2>
@@ -81,13 +81,13 @@
#include <math.h>
-#include "audiochebyshevfreqlimit.h"
+#include "audiocheblimit.h"
-#define GST_CAT_DEFAULT gst_audio_chebyshev_freq_limit_debug
+#define GST_CAT_DEFAULT gst_audio_cheb_limit_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
static const GstElementDetails element_details =
-GST_ELEMENT_DETAILS ("AudioChebyshevFreqLimit",
+GST_ELEMENT_DETAILS ("AudioChebLimit",
"Filter/Effect/Audio",
"Chebyshev low pass and high pass filter",
"Sebastian Dröge <slomo@circular-chaos.org>");
@@ -117,27 +117,25 @@ enum
" channels = (int) [ 1, MAX ]"
#define DEBUG_INIT(bla) \
- GST_DEBUG_CATEGORY_INIT (gst_audio_chebyshev_freq_limit_debug, "audiochebyshevfreqlimit", 0, "audiochebyshevfreqlimit element");
+ GST_DEBUG_CATEGORY_INIT (gst_audio_cheb_limit_debug, "audiocheblimit", 0, "audiocheblimit element");
-GST_BOILERPLATE_FULL (GstAudioChebyshevFreqLimit,
- gst_audio_chebyshev_freq_limit, GstAudioFilter, GST_TYPE_AUDIO_FILTER,
- DEBUG_INIT);
+GST_BOILERPLATE_FULL (GstAudioChebLimit,
+ gst_audio_cheb_limit, GstAudioFilter, GST_TYPE_AUDIO_FILTER, DEBUG_INIT);
-static void gst_audio_chebyshev_freq_limit_set_property (GObject * object,
+static void gst_audio_cheb_limit_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_audio_chebyshev_freq_limit_get_property (GObject * object,
+static void gst_audio_cheb_limit_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
-static gboolean gst_audio_chebyshev_freq_limit_setup (GstAudioFilter * filter,
+static gboolean gst_audio_cheb_limit_setup (GstAudioFilter * filter,
GstRingBufferSpec * format);
static GstFlowReturn
-gst_audio_chebyshev_freq_limit_transform_ip (GstBaseTransform * base,
- GstBuffer * buf);
-static gboolean gst_audio_chebyshev_freq_limit_start (GstBaseTransform * base);
+gst_audio_cheb_limit_transform_ip (GstBaseTransform * base, GstBuffer * buf);
+static gboolean gst_audio_cheb_limit_start (GstBaseTransform * base);
-static void process_64 (GstAudioChebyshevFreqLimit * filter,
+static void process_64 (GstAudioChebLimit * filter,
gdouble * data, guint num_samples);
-static void process_32 (GstAudioChebyshevFreqLimit * filter,
+static void process_32 (GstAudioChebLimit * filter,
gfloat * data, guint num_samples);
enum
@@ -146,9 +144,9 @@ enum
MODE_HIGH_PASS
};
-#define GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT_MODE (gst_audio_chebyshev_freq_limit_mode_get_type ())
+#define GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT_MODE (gst_audio_cheb_limit_mode_get_type ())
static GType
-gst_audio_chebyshev_freq_limit_mode_get_type (void)
+gst_audio_cheb_limit_mode_get_type (void)
{
static GType gtype = 0;
@@ -161,7 +159,7 @@ gst_audio_chebyshev_freq_limit_mode_get_type (void)
{0, NULL, NULL}
};
- gtype = g_enum_register_static ("GstAudioChebyshevFreqLimitMode", values);
+ gtype = g_enum_register_static ("GstAudioChebLimitMode", values);
}
return gtype;
}
@@ -169,7 +167,7 @@ gst_audio_chebyshev_freq_limit_mode_get_type (void)
/* GObject vmethod implementations */
static void
-gst_audio_chebyshev_freq_limit_base_init (gpointer klass)
+gst_audio_cheb_limit_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstCaps *caps;
@@ -183,9 +181,9 @@ gst_audio_chebyshev_freq_limit_base_init (gpointer klass)
}
static void
-gst_audio_chebyshev_freq_limit_dispose (GObject * object)
+gst_audio_cheb_limit_dispose (GObject * object)
{
- GstAudioChebyshevFreqLimit *filter = GST_AUDIO_CHEBYSHEV_FREQ_LIMIT (object);
+ GstAudioChebLimit *filter = GST_AUDIO_CHEB_LIMIT (object);
if (filter->a) {
g_free (filter->a);
@@ -198,7 +196,7 @@ gst_audio_chebyshev_freq_limit_dispose (GObject * object)
}
if (filter->channels) {
- GstAudioChebyshevFreqLimitChannelCtx *ctx;
+ GstAudioChebLimitChannelCtx *ctx;
gint i, channels = GST_AUDIO_FILTER (filter)->format.channels;
for (i = 0; i < channels; i++) {
@@ -215,8 +213,7 @@ gst_audio_chebyshev_freq_limit_dispose (GObject * object)
}
static void
-gst_audio_chebyshev_freq_limit_class_init (GstAudioChebyshevFreqLimitClass *
- klass)
+gst_audio_cheb_limit_class_init (GstAudioChebLimitClass * klass)
{
GObjectClass *gobject_class;
GstBaseTransformClass *trans_class;
@@ -226,9 +223,9 @@ gst_audio_chebyshev_freq_limit_class_init (GstAudioChebyshevFreqLimitClass *
trans_class = (GstBaseTransformClass *) klass;
filter_class = (GstAudioFilterClass *) klass;
- gobject_class->set_property = gst_audio_chebyshev_freq_limit_set_property;
- gobject_class->get_property = gst_audio_chebyshev_freq_limit_get_property;
- gobject_class->dispose = gst_audio_chebyshev_freq_limit_dispose;
+ gobject_class->set_property = gst_audio_cheb_limit_set_property;
+ gobject_class->get_property = gst_audio_cheb_limit_get_property;
+ gobject_class->dispose = gst_audio_cheb_limit_dispose;
g_object_class_install_property (gobject_class, PROP_MODE,
g_param_spec_enum ("mode", "Mode",
@@ -256,16 +253,15 @@ gst_audio_chebyshev_freq_limit_class_init (GstAudioChebyshevFreqLimitClass *
"Number of poles to use, will be rounded up to the next even number",
2, 32, 4, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
- filter_class->setup =
- GST_DEBUG_FUNCPTR (gst_audio_chebyshev_freq_limit_setup);
+ filter_class->setup = GST_DEBUG_FUNCPTR (gst_audio_cheb_limit_setup);
trans_class->transform_ip =
- GST_DEBUG_FUNCPTR (gst_audio_chebyshev_freq_limit_transform_ip);
- trans_class->start = GST_DEBUG_FUNCPTR (gst_audio_chebyshev_freq_limit_start);
+ GST_DEBUG_FUNCPTR (gst_audio_cheb_limit_transform_ip);
+ trans_class->start = GST_DEBUG_FUNCPTR (gst_audio_cheb_limit_start);
}
static void
-gst_audio_chebyshev_freq_limit_init (GstAudioChebyshevFreqLimit * filter,
- GstAudioChebyshevFreqLimitClass * klass)
+gst_audio_cheb_limit_init (GstAudioChebLimit * filter,
+ GstAudioChebLimitClass * klass)
{
filter->cutoff = 0.0;
filter->mode = MODE_LOW_PASS;
@@ -281,7 +277,7 @@ gst_audio_chebyshev_freq_limit_init (GstAudioChebyshevFreqLimit * filter,
}
static void
-generate_biquad_coefficients (GstAudioChebyshevFreqLimit * filter,
+generate_biquad_coefficients (GstAudioChebLimit * filter,
gint p, gdouble * a0, gdouble * a1, gdouble * a2,
gdouble * b1, gdouble * b2)
{
@@ -471,7 +467,7 @@ calculate_gain (gdouble * a, gdouble * b, gint num_a, gint num_b, gdouble zr,
}
static void
-generate_coefficients (GstAudioChebyshevFreqLimit * filter)
+generate_coefficients (GstAudioChebLimit * filter)
{
gint channels = GST_AUDIO_FILTER (filter)->format.channels;
@@ -486,7 +482,7 @@ generate_coefficients (GstAudioChebyshevFreqLimit * filter)
}
if (filter->channels) {
- GstAudioChebyshevFreqLimitChannelCtx *ctx;
+ GstAudioChebLimitChannelCtx *ctx;
gint i;
for (i = 0; i < channels; i++) {
@@ -504,7 +500,7 @@ generate_coefficients (GstAudioChebyshevFreqLimit * filter)
filter->a = g_new0 (gdouble, 1);
filter->a[0] = 1.0;
filter->num_b = 0;
- filter->channels = g_new0 (GstAudioChebyshevFreqLimitChannelCtx, channels);
+ filter->channels = g_new0 (GstAudioChebLimitChannelCtx, channels);
GST_LOG_OBJECT (filter, "rate was not set yet");
return;
}
@@ -516,7 +512,7 @@ generate_coefficients (GstAudioChebyshevFreqLimit * filter)
filter->a = g_new0 (gdouble, 1);
filter->a[0] = (filter->mode == MODE_LOW_PASS) ? 1.0 : 0.0;
filter->num_b = 0;
- filter->channels = g_new0 (GstAudioChebyshevFreqLimitChannelCtx, channels);
+ filter->channels = g_new0 (GstAudioChebLimitChannelCtx, channels);
GST_LOG_OBJECT (filter, "cutoff was higher than nyquist frequency");
return;
} else if (filter->cutoff <= 0.0) {
@@ -524,7 +520,7 @@ generate_coefficients (GstAudioChebyshevFreqLimit * filter)
filter->a = g_new0 (gdouble, 1);
filter->a[0] = (filter->mode == MODE_LOW_PASS) ? 0.0 : 1.0;
filter->num_b = 0;
- filter->channels = g_new0 (GstAudioChebyshevFreqLimitChannelCtx, channels);
+ filter->channels = g_new0 (GstAudioChebLimitChannelCtx, channels);
GST_LOG_OBJECT (filter, "cutoff is lower than zero");
return;
}
@@ -540,9 +536,9 @@ generate_coefficients (GstAudioChebyshevFreqLimit * filter)
filter->num_b = np + 1;
filter->b = b = g_new0 (gdouble, np + 3);
- filter->channels = g_new0 (GstAudioChebyshevFreqLimitChannelCtx, channels);
+ filter->channels = g_new0 (GstAudioChebLimitChannelCtx, channels);
for (i = 0; i < channels; i++) {
- GstAudioChebyshevFreqLimitChannelCtx *ctx = &filter->channels[i];
+ GstAudioChebLimitChannelCtx *ctx = &filter->channels[i];
ctx->x = g_new0 (gdouble, np + 1);
ctx->y = g_new0 (gdouble, np + 1);
@@ -623,10 +619,10 @@ generate_coefficients (GstAudioChebyshevFreqLimit * filter)
}
static void
-gst_audio_chebyshev_freq_limit_set_property (GObject * object, guint prop_id,
+gst_audio_cheb_limit_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
- GstAudioChebyshevFreqLimit *filter = GST_AUDIO_CHEBYSHEV_FREQ_LIMIT (object);
+ GstAudioChebLimit *filter = GST_AUDIO_CHEB_LIMIT (object);
switch (prop_id) {
case PROP_MODE:
@@ -666,10 +662,10 @@ gst_audio_chebyshev_freq_limit_set_property (GObject * object, guint prop_id,
}
static void
-gst_audio_chebyshev_freq_limit_get_property (GObject * object, guint prop_id,
+gst_audio_cheb_limit_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
- GstAudioChebyshevFreqLimit *filter = GST_AUDIO_CHEBYSHEV_FREQ_LIMIT (object);
+ GstAudioChebLimit *filter = GST_AUDIO_CHEB_LIMIT (object);
switch (prop_id) {
case PROP_MODE:
@@ -696,17 +692,16 @@ gst_audio_chebyshev_freq_limit_get_property (GObject * object, guint prop_id,
/* GstAudioFilter vmethod implementations */
static gboolean
-gst_audio_chebyshev_freq_limit_setup (GstAudioFilter * base,
- GstRingBufferSpec * format)
+gst_audio_cheb_limit_setup (GstAudioFilter * base, GstRingBufferSpec * format)
{
- GstAudioChebyshevFreqLimit *filter = GST_AUDIO_CHEBYSHEV_FREQ_LIMIT (base);
+ GstAudioChebLimit *filter = GST_AUDIO_CHEB_LIMIT (base);
gboolean ret = TRUE;
if (format->width == 32)
- filter->process = (GstAudioChebyshevFreqLimitProcessFunc)
+ filter->process = (GstAudioChebLimitProcessFunc)
process_32;
else if (format->width == 64)
- filter->process = (GstAudioChebyshevFreqLimitProcessFunc)
+ filter->process = (GstAudioChebLimitProcessFunc)
process_64;
else
ret = FALSE;
@@ -717,8 +712,8 @@ gst_audio_chebyshev_freq_limit_setup (GstAudioFilter * base,
}
static inline gdouble
-process (GstAudioChebyshevFreqLimit * filter,
- GstAudioChebyshevFreqLimitChannelCtx * ctx, gdouble x0)
+process (GstAudioChebLimit * filter,
+ GstAudioChebLimitChannelCtx * ctx, gdouble x0)
{
gdouble val = filter->a[0] * x0;
gint i, j;
@@ -757,7 +752,7 @@ process (GstAudioChebyshevFreqLimit * filter,
#define DEFINE_PROCESS_FUNC(width,ctype) \
static void \
-process_##width (GstAudioChebyshevFreqLimit * filter, \
+process_##width (GstAudioChebLimit * filter, \
g##ctype * data, guint num_samples) \
{ \
gint i, j, channels = GST_AUDIO_FILTER (filter)->format.channels; \
@@ -778,10 +773,9 @@ DEFINE_PROCESS_FUNC (64, double);
/* GstBaseTransform vmethod implementations */
static GstFlowReturn
-gst_audio_chebyshev_freq_limit_transform_ip (GstBaseTransform * base,
- GstBuffer * buf)
+gst_audio_cheb_limit_transform_ip (GstBaseTransform * base, GstBuffer * buf)
{
- GstAudioChebyshevFreqLimit *filter = GST_AUDIO_CHEBYSHEV_FREQ_LIMIT (base);
+ GstAudioChebLimit *filter = GST_AUDIO_CHEB_LIMIT (base);
guint num_samples =
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (filter)->format.width / 8);
@@ -801,11 +795,11 @@ gst_audio_chebyshev_freq_limit_transform_ip (GstBaseTransform * base,
static gboolean
-gst_audio_chebyshev_freq_limit_start (GstBaseTransform * base)
+gst_audio_cheb_limit_start (GstBaseTransform * base)
{
- GstAudioChebyshevFreqLimit *filter = GST_AUDIO_CHEBYSHEV_FREQ_LIMIT (base);
+ GstAudioChebLimit *filter = GST_AUDIO_CHEB_LIMIT (base);
gint channels = GST_AUDIO_FILTER (filter)->format.channels;
- GstAudioChebyshevFreqLimitChannelCtx *ctx;
+ GstAudioChebLimitChannelCtx *ctx;
gint i;
/* Reset the history of input and output values if
diff --git a/gst/audiofx/audiocheblimit.h b/gst/audiofx/audiocheblimit.h
index 4c87ba8e..c2fe6c2e 100644
--- a/gst/audiofx/audiocheblimit.h
+++ b/gst/audiofx/audiocheblimit.h
@@ -18,8 +18,8 @@
* Boston, MA 02111-1307, USA.
*/
-#ifndef __GST_AUDIO_CHEBYSHEV_FREQ_LIMIT_H__
-#define __GST_AUDIO_CHEBYSHEV_FREQ_LIMIT_H__
+#ifndef __GST_AUDIO_CHEB_LIMIT_H__
+#define __GST_AUDIO_CHEB_LIMIT_H__
#include <gst/gst.h>
#include <gst/base/gstbasetransform.h>
@@ -27,16 +27,16 @@
#include <gst/audio/gstaudiofilter.h>
G_BEGIN_DECLS
-#define GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT (gst_audio_chebyshev_freq_limit_get_type())
-#define GST_AUDIO_CHEBYSHEV_FREQ_LIMIT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT,GstAudioChebyshevFreqLimit))
-#define GST_IS_AUDIO_CHEBYSHEV_FREQ_LIMIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT))
-#define GST_AUDIO_CHEBYSHEV_FREQ_LIMIT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT,GstAudioChebyshevFreqLimitClass))
-#define GST_IS_AUDIO_CHEBYSHEV_FREQ_LIMIT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT))
-#define GST_AUDIO_CHEBYSHEV_FREQ_LIMIT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT,GstAudioChebyshevFreqLimitClass))
-typedef struct _GstAudioChebyshevFreqLimit GstAudioChebyshevFreqLimit;
-typedef struct _GstAudioChebyshevFreqLimitClass GstAudioChebyshevFreqLimitClass;
+#define GST_TYPE_AUDIO_CHEB_LIMIT (gst_audio_cheb_limit_get_type())
+#define GST_AUDIO_CHEB_LIMIT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_CHEB_LIMIT,GstAudioChebLimit))
+#define GST_IS_AUDIO_CHEB_LIMIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_CHEB_LIMIT))
+#define GST_AUDIO_CHEB_LIMIT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_AUDIO_CHEB_LIMIT,GstAudioChebLimitClass))
+#define GST_IS_AUDIO_CHEB_LIMIT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_AUDIO_CHEB_LIMIT))
+#define GST_AUDIO_CHEB_LIMIT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_AUDIO_CHEB_LIMIT,GstAudioChebLimitClass))
+typedef struct _GstAudioChebLimit GstAudioChebLimit;
+typedef struct _GstAudioChebLimitClass GstAudioChebLimitClass;
-typedef void (*GstAudioChebyshevFreqLimitProcessFunc) (GstAudioChebyshevFreqLimit *, guint8 *, guint);
+typedef void (*GstAudioChebLimitProcessFunc) (GstAudioChebLimit *, guint8 *, guint);
typedef struct
{
@@ -44,9 +44,9 @@ typedef struct
gint x_pos;
gdouble *y;
gint y_pos;
-} GstAudioChebyshevFreqLimitChannelCtx;
+} GstAudioChebLimitChannelCtx;
-struct _GstAudioChebyshevFreqLimit
+struct _GstAudioChebLimit
{
GstAudioFilter audiofilter;
@@ -57,22 +57,22 @@ struct _GstAudioChebyshevFreqLimit
gfloat ripple;
/* < private > */
- GstAudioChebyshevFreqLimitProcessFunc process;
+ GstAudioChebLimitProcessFunc process;
gboolean have_coeffs;
gdouble *a;
gint num_a;
gdouble *b;
gint num_b;
- GstAudioChebyshevFreqLimitChannelCtx *channels;
+ GstAudioChebLimitChannelCtx *channels;
};
-struct _GstAudioChebyshevFreqLimitClass
+struct _GstAudioChebLimitClass
{
GstAudioFilterClass parent;
};
-GType gst_audio_chebyshev_freq_limit_get_type (void);
+GType gst_audio_cheb_limit_get_type (void);
G_END_DECLS
-#endif /* __GST_AUDIO_CHEBYSHEV_FREQ_LIMIT_H__ */
+#endif /* __GST_AUDIO_CHEB_LIMIT_H__ */
diff --git a/gst/audiofx/audiochebyshevfreqband.c b/gst/audiofx/audiochebyshevfreqband.c
deleted file mode 100644
index 03978a79..00000000
--- a/gst/audiofx/audiochebyshevfreqband.c
+++ /dev/null
@@ -1,922 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
- *
- * 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.
- */
-
-/*
- * Chebyshev type 1 filter design based on
- * "The Scientist and Engineer's Guide to DSP", Chapter 20.
- * http://www.dspguide.com/
- *
- * For type 2 and Chebyshev filters in general read
- * http://en.wikipedia.org/wiki/Chebyshev_filter
- *
- * Transformation from lowpass to bandpass/bandreject:
- * http://docs.dewresearch.com/DspHelp/html/IDH_LinearSystems_LowpassToBandPassZ.htm
- * http://docs.dewresearch.com/DspHelp/html/IDH_LinearSystems_LowpassToBandStopZ.htm
- *
- */
-
-/**
- * SECTION:element-audiochebyshevfreqband
- * @short_description: Chebyshev band pass and band reject filter
- *
- * <refsect2>
- * <para>
- * Attenuates all frequencies outside (bandpass) or inside (bandreject) of a frequency
- * band. The number of poles and the ripple parameter control the rolloff.
- * </para>
- * <para>
- * This element has the advantage over the windowed sinc bandpass and bandreject filter that it is
- * much faster and produces almost as good results. It's only disadvantages are the highly
- * non-linear phase and the slower rolloff compared to a windowed sinc filter with a large kernel.
- * </para>
- * <para>
- * For type 1 the ripple parameter specifies how much ripple in dB is allowed in the passband, i.e.
- * some frequencies in the passband will be amplified by that value. A higher ripple value will allow
- * a faster rolloff.
- * </para>
- * <para>
- * For type 2 the ripple parameter specifies the stopband attenuation. In the stopband the gain will
- * be at most this value. A lower ripple value will allow a faster rolloff.
- * </para>
- * <para>
- * As a special case, a Chebyshev type 1 filter with no ripple is a Butterworth filter.
- * </para>
- * <para><note>
- * Be warned that a too large number of poles can produce noise. The most poles are possible with
- * a cutoff frequency at a quarter of the sampling rate.
- * </note></para>
- * <title>Example launch line</title>
- * <para>
- * <programlisting>
- * gst-launch audiotestsrc freq=1500 ! audioconvert ! audiochebyshevfreqband mode=band-pass lower-frequency=1000 upper-frequenc=6000 poles=4 ! audioconvert ! alsasink
- * gst-launch filesrc location="melo1.ogg" ! oggdemux ! vorbisdec ! audioconvert ! audiochebyshevfreqband mode=band-reject lower-frequency=1000 upper-frequency=4000 ripple=0.2 ! audioconvert ! alsasink
- * gst-launch audiotestsrc wave=white-noise ! audioconvert ! audiochebyshevfreqband mode=band-pass lower-frequency=1000 upper-frequency=4000 type=2 ! audioconvert ! alsasink
- * </programlisting>
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-#include <gst/audio/audio.h>
-#include <gst/audio/gstaudiofilter.h>
-#include <gst/controller/gstcontroller.h>
-
-#include <math.h>
-
-#include "audiochebyshevfreqband.h"
-
-#define GST_CAT_DEFAULT gst_audio_chebyshev_freq_band_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-static const GstElementDetails element_details =
-GST_ELEMENT_DETAILS ("AudioChebyshevFreqBand",
- "Filter/Effect/Audio",
- "Chebyshev band pass and band reject filter",
- "Sebastian Dröge <slomo@circular-chaos.org>");
-
-/* Filter signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- PROP_0,
- PROP_MODE,
- PROP_TYPE,
- PROP_LOWER_FREQUENCY,
- PROP_UPPER_FREQUENCY,
- PROP_RIPPLE,
- PROP_POLES
-};
-
-#define ALLOWED_CAPS \
- "audio/x-raw-float," \
- " width = (int) { 32, 64 }, " \
- " endianness = (int) BYTE_ORDER," \
- " rate = (int) [ 1, MAX ]," \
- " channels = (int) [ 1, MAX ]"
-
-#define DEBUG_INIT(bla) \
- GST_DEBUG_CATEGORY_INIT (gst_audio_chebyshev_freq_band_debug, "audiochebyshevfreqband", 0, "audiochebyshevfreqband element");
-
-GST_BOILERPLATE_FULL (GstAudioChebyshevFreqBand, gst_audio_chebyshev_freq_band,
- GstAudioFilter, GST_TYPE_AUDIO_FILTER, DEBUG_INIT);
-
-static void gst_audio_chebyshev_freq_band_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_audio_chebyshev_freq_band_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static gboolean gst_audio_chebyshev_freq_band_setup (GstAudioFilter * filter,
- GstRingBufferSpec * format);
-static GstFlowReturn
-gst_audio_chebyshev_freq_band_transform_ip (GstBaseTransform * base,
- GstBuffer * buf);
-static gboolean gst_audio_chebyshev_freq_band_start (GstBaseTransform * base);
-
-static void process_64 (GstAudioChebyshevFreqBand * filter,
- gdouble * data, guint num_samples);
-static void process_32 (GstAudioChebyshevFreqBand * filter,
- gfloat * data, guint num_samples);
-
-enum
-{
- MODE_BAND_PASS = 0,
- MODE_BAND_REJECT
-};
-
-#define GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND_MODE (gst_audio_chebyshev_freq_band_mode_get_type ())
-static GType
-gst_audio_chebyshev_freq_band_mode_get_type (void)
-{
- static GType gtype = 0;
-
- if (gtype == 0) {
- static const GEnumValue values[] = {
- {MODE_BAND_PASS, "Band pass (default)",
- "band-pass"},
- {MODE_BAND_REJECT, "Band reject",
- "band-reject"},
- {0, NULL, NULL}
- };
-
- gtype = g_enum_register_static ("GstAudioChebyshevFreqBandMode", values);
- }
- return gtype;
-}
-
-/* GObject vmethod implementations */
-
-static void
-gst_audio_chebyshev_freq_band_base_init (gpointer klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- GstCaps *caps;
-
- gst_element_class_set_details (element_class, &element_details);
-
- caps = gst_caps_from_string (ALLOWED_CAPS);
- gst_audio_filter_class_add_pad_templates (GST_AUDIO_FILTER_CLASS (klass),
- caps);
- gst_caps_unref (caps);
-}
-
-static void
-gst_audio_chebyshev_freq_band_dispose (GObject * object)
-{
- GstAudioChebyshevFreqBand *filter = GST_AUDIO_CHEBYSHEV_FREQ_BAND (object);
-
- if (filter->a) {
- g_free (filter->a);
- filter->a = NULL;
- }
-
- if (filter->b) {
- g_free (filter->b);
- filter->b = NULL;
- }
-
- if (filter->channels) {
- GstAudioChebyshevFreqBandChannelCtx *ctx;
- gint i, channels = GST_AUDIO_FILTER (filter)->format.channels;
-
- for (i = 0; i < channels; i++) {
- ctx = &filter->channels[i];
- g_free (ctx->x);
- g_free (ctx->y);
- }
-
- g_free (filter->channels);
- filter->channels = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_audio_chebyshev_freq_band_class_init (GstAudioChebyshevFreqBandClass *
- klass)
-{
- GObjectClass *gobject_class;
- GstBaseTransformClass *trans_class;
- GstAudioFilterClass *filter_class;
-
- gobject_class = (GObjectClass *) klass;
- trans_class = (GstBaseTransformClass *) klass;
- filter_class = (GstAudioFilterClass *) klass;
-
- gobject_class->set_property = gst_audio_chebyshev_freq_band_set_property;
- gobject_class->get_property = gst_audio_chebyshev_freq_band_get_property;
- gobject_class->dispose = gst_audio_chebyshev_freq_band_dispose;
-
- g_object_class_install_property (gobject_class, PROP_MODE,
- g_param_spec_enum ("mode", "Mode",
- "Low pass or high pass mode", GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND_MODE,
- MODE_BAND_PASS, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
- g_object_class_install_property (gobject_class, PROP_TYPE,
- g_param_spec_int ("type", "Type",
- "Type of the chebychev filter", 1, 2,
- 1, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
-
- /* FIXME: Don't use the complete possible range but restrict the upper boundary
- * so automatically generated UIs can use a slider without */
- g_object_class_install_property (gobject_class, PROP_LOWER_FREQUENCY,
- g_param_spec_float ("lower-frequency", "Lower frequency",
- "Start frequency of the band (Hz)", 0.0, 100000.0,
- 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
- g_object_class_install_property (gobject_class, PROP_UPPER_FREQUENCY,
- g_param_spec_float ("upper-frequency", "Upper frequency",
- "Stop frequency of the band (Hz)", 0.0, 100000.0,
- 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
- g_object_class_install_property (gobject_class, PROP_RIPPLE,
- g_param_spec_float ("ripple", "Ripple",
- "Amount of ripple (dB)", 0.0, 200.0,
- 0.25, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
- /* FIXME: What to do about this upper boundary? With a frequencies near
- * rate/4 32 poles are completely possible, with frequencies very low
- * or very high 16 poles already produces only noise */
- g_object_class_install_property (gobject_class, PROP_POLES,
- g_param_spec_int ("poles", "Poles",
- "Number of poles to use, will be rounded up to the next multiply of four",
- 4, 32, 4, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
-
- filter_class->setup = GST_DEBUG_FUNCPTR (gst_audio_chebyshev_freq_band_setup);
- trans_class->transform_ip =
- GST_DEBUG_FUNCPTR (gst_audio_chebyshev_freq_band_transform_ip);
- trans_class->start = GST_DEBUG_FUNCPTR (gst_audio_chebyshev_freq_band_start);
-}
-
-static void
-gst_audio_chebyshev_freq_band_init (GstAudioChebyshevFreqBand * filter,
- GstAudioChebyshevFreqBandClass * klass)
-{
- filter->lower_frequency = filter->upper_frequency = 0.0;
- filter->mode = MODE_BAND_PASS;
- filter->type = 1;
- filter->poles = 4;
- filter->ripple = 0.25;
- gst_base_transform_set_in_place (GST_BASE_TRANSFORM (filter), TRUE);
-
- filter->have_coeffs = FALSE;
- filter->num_a = 0;
- filter->num_b = 0;
- filter->channels = NULL;
-}
-
-static void
-generate_biquad_coefficients (GstAudioChebyshevFreqBand * filter,
- gint p, gdouble * a0, gdouble * a1, gdouble * a2, gdouble * a3,
- gdouble * a4, gdouble * b1, gdouble * b2, gdouble * b3, gdouble * b4)
-{
- gint np = filter->poles / 2;
- gdouble ripple = filter->ripple;
-
- /* pole location in s-plane */
- gdouble rp, ip;
-
- /* zero location in s-plane */
- gdouble rz = 0.0, iz = 0.0;
-
- /* transfer function coefficients for the z-plane */
- gdouble x0, x1, x2, y1, y2;
- gint type = filter->type;
-
- /* Calculate pole location for lowpass at frequency 1 */
- {
- gdouble angle = (M_PI / 2.0) * (2.0 * p - 1) / np;
-
- rp = -sin (angle);
- ip = cos (angle);
- }
-
- /* If we allow ripple, move the pole from the unit
- * circle to an ellipse and keep cutoff at frequency 1 */
- if (ripple > 0 && type == 1) {
- gdouble es, vx;
-
- es = sqrt (pow (10.0, ripple / 10.0) - 1.0);
-
- vx = (1.0 / np) * asinh (1.0 / es);
- rp = rp * sinh (vx);
- ip = ip * cosh (vx);
- } else if (type == 2) {
- gdouble es, vx;
-
- es = sqrt (pow (10.0, ripple / 10.0) - 1.0);
- vx = (1.0 / np) * asinh (es);
- rp = rp * sinh (vx);
- ip = ip * cosh (vx);
- }
-
- /* Calculate inverse of the pole location to move from
- * type I to type II */
- if (type == 2) {
- gdouble mag2 = rp * rp + ip * ip;
-
- rp /= mag2;
- ip /= mag2;
- }
-
- /* Calculate zero location for frequency 1 on the
- * unit circle for type 2 */
- if (type == 2) {
- gdouble angle = M_PI / (np * 2.0) + ((p - 1) * M_PI) / (np);
- gdouble mag2;
-
- rz = 0.0;
- iz = cos (angle);
- mag2 = rz * rz + iz * iz;
- rz /= mag2;
- iz /= mag2;
- }
-
- /* Convert from s-domain to z-domain by
- * using the bilinear Z-transform, i.e.
- * substitute s by (2/t)*((z-1)/(z+1))
- * with t = 2 * tan(0.5).
- */
- if (type == 1) {
- gdouble t, m, d;
-
- t = 2.0 * tan (0.5);
- m = rp * rp + ip * ip;
- d = 4.0 - 4.0 * rp * t + m * t * t;
-
- x0 = (t * t) / d;
- x1 = 2.0 * x0;
- x2 = x0;
- y1 = (8.0 - 2.0 * m * t * t) / d;
- y2 = (-4.0 - 4.0 * rp * t - m * t * t) / d;
- } else {
- gdouble t, m, d;
-
- t = 2.0 * tan (0.5);
- m = rp * rp + ip * ip;
- d = 4.0 - 4.0 * rp * t + m * t * t;
-
- x0 = (t * t * iz * iz + 4.0) / d;
- x1 = (-8.0 + 2.0 * iz * iz * t * t) / d;
- x2 = x0;
- y1 = (8.0 - 2.0 * m * t * t) / d;
- y2 = (-4.0 - 4.0 * rp * t - m * t * t) / d;
- }
-
- /* Convert from lowpass at frequency 1 to either bandpass
- * or band reject.
- *
- * For bandpass substitute z^(-1) with:
- *
- * -2 -1
- * -z + alpha * z - beta
- * ----------------------------
- * -2 -1
- * beta * z - alpha * z + 1
- *
- * alpha = (2*a*b)/(1+b)
- * beta = (b-1)/(b+1)
- * a = cos((w1 + w0)/2) / cos((w1 - w0)/2)
- * b = tan(1/2) * cot((w1 - w0)/2)
- *
- * For bandreject substitute z^(-1) with:
- *
- * -2 -1
- * z - alpha * z + beta
- * ----------------------------
- * -2 -1
- * beta * z - alpha * z + 1
- *
- * alpha = (2*a)/(1+b)
- * beta = (1-b)/(1+b)
- * a = cos((w1 + w0)/2) / cos((w1 - w0)/2)
- * b = tan(1/2) * tan((w1 - w0)/2)
- *
- */
- {
- gdouble a, b, d;
- gdouble alpha, beta;
- gdouble w0 =
- 2.0 * M_PI * (filter->lower_frequency /
- GST_AUDIO_FILTER (filter)->format.rate);
- gdouble w1 =
- 2.0 * M_PI * (filter->upper_frequency /
- GST_AUDIO_FILTER (filter)->format.rate);
-
- if (filter->mode == MODE_BAND_PASS) {
- a = cos ((w1 + w0) / 2.0) / cos ((w1 - w0) / 2.0);
- b = tan (1.0 / 2.0) / tan ((w1 - w0) / 2.0);
-
- alpha = (2.0 * a * b) / (1.0 + b);
- beta = (b - 1.0) / (b + 1.0);
-
- d = 1.0 + beta * (y1 - beta * y2);
-
- *a0 = (x0 + beta * (-x1 + beta * x2)) / d;
- *a1 = (alpha * (-2.0 * x0 + x1 + beta * x1 - 2.0 * beta * x2)) / d;
- *a2 =
- (-x1 - beta * beta * x1 + 2.0 * beta * (x0 + x2) +
- alpha * alpha * (x0 - x1 + x2)) / d;
- *a3 = (alpha * (x1 + beta * (-2.0 * x0 + x1) - 2.0 * x2)) / d;
- *a4 = (beta * (beta * x0 - x1) + x2) / d;
- *b1 = (alpha * (2.0 + y1 + beta * y1 - 2.0 * beta * y2)) / d;
- *b2 =
- (-y1 - beta * beta * y1 - alpha * alpha * (1.0 + y1 - y2) +
- 2.0 * beta * (-1.0 + y2)) / d;
- *b3 = (alpha * (y1 + beta * (2.0 + y1) - 2.0 * y2)) / d;
- *b4 = (-beta * beta - beta * y1 + y2) / d;
- } else {
- a = cos ((w1 + w0) / 2.0) / cos ((w1 - w0) / 2.0);
- b = tan (1.0 / 2.0) * tan ((w1 - w0) / 2.0);
-
- alpha = (2.0 * a) / (1.0 + b);
- beta = (1.0 - b) / (1.0 + b);
-
- d = -1.0 + beta * (beta * y2 + y1);
-
- *a0 = (-x0 - beta * x1 - beta * beta * x2) / d;
- *a1 = (alpha * (2.0 * x0 + x1 + beta * x1 + 2.0 * beta * x2)) / d;
- *a2 =
- (-x1 - beta * beta * x1 - 2.0 * beta * (x0 + x2) -
- alpha * alpha * (x0 + x1 + x2)) / d;
- *a3 = (alpha * (x1 + beta * (2.0 * x0 + x1) + 2.0 * x2)) / d;
- *a4 = (-beta * beta * x0 - beta * x1 - x2) / d;
- *b1 = (alpha * (-2.0 + y1 + beta * y1 + 2.0 * beta * y2)) / d;
- *b2 =
- -(y1 + beta * beta * y1 + 2.0 * beta * (-1.0 + y2) +
- alpha * alpha * (-1.0 + y1 + y2)) / d;
- *b3 = (alpha * (beta * (-2.0 + y1) + y1 + 2.0 * y2)) / d;
- *b4 = -(-beta * beta + beta * y1 + y2) / d;
- }
- }
-}
-
-/* Evaluate the transfer function that corresponds to the IIR
- * coefficients at zr + zi*I and return the magnitude */
-static gdouble
-calculate_gain (gdouble * a, gdouble * b, gint num_a, gint num_b, gdouble zr,
- gdouble zi)
-{
- gdouble sum_ar, sum_ai;
- gdouble sum_br, sum_bi;
- gdouble gain_r, gain_i;
-
- gdouble sum_r_old;
- gdouble sum_i_old;
-
- gint i;
-
- sum_ar = 0.0;
- sum_ai = 0.0;
- for (i = num_a; i >= 0; i--) {
- sum_r_old = sum_ar;
- sum_i_old = sum_ai;
-
- sum_ar = (sum_r_old * zr - sum_i_old * zi) + a[i];
- sum_ai = (sum_r_old * zi + sum_i_old * zr) + 0.0;
- }
-
- sum_br = 0.0;
- sum_bi = 0.0;
- for (i = num_b; i >= 0; i--) {
- sum_r_old = sum_br;
- sum_i_old = sum_bi;
-
- sum_br = (sum_r_old * zr - sum_i_old * zi) - b[i];
- sum_bi = (sum_r_old * zi + sum_i_old * zr) - 0.0;
- }
- sum_br += 1.0;
- sum_bi += 0.0;
-
- gain_r =
- (sum_ar * sum_br + sum_ai * sum_bi) / (sum_br * sum_br + sum_bi * sum_bi);
- gain_i =
- (sum_ai * sum_br - sum_ar * sum_bi) / (sum_br * sum_br + sum_bi * sum_bi);
-
- return (sqrt (gain_r * gain_r + gain_i * gain_i));
-}
-
-static void
-generate_coefficients (GstAudioChebyshevFreqBand * filter)
-{
- gint channels = GST_AUDIO_FILTER (filter)->format.channels;
-
- if (filter->a) {
- g_free (filter->a);
- filter->a = NULL;
- }
-
- if (filter->b) {
- g_free (filter->b);
- filter->b = NULL;
- }
-
- if (filter->channels) {
- GstAudioChebyshevFreqBandChannelCtx *ctx;
- gint i;
-
- for (i = 0; i < channels; i++) {
- ctx = &filter->channels[i];
- g_free (ctx->x);
- g_free (ctx->y);
- }
-
- g_free (filter->channels);
- filter->channels = NULL;
- }
-
- if (GST_AUDIO_FILTER (filter)->format.rate == 0) {
- filter->num_a = 1;
- filter->a = g_new0 (gdouble, 1);
- filter->a[0] = 1.0;
- filter->num_b = 0;
- filter->channels = g_new0 (GstAudioChebyshevFreqBandChannelCtx, channels);
- GST_LOG_OBJECT (filter, "rate was not set yet");
- return;
- }
-
- filter->have_coeffs = TRUE;
-
- if (filter->upper_frequency <= filter->lower_frequency) {
- filter->num_a = 1;
- filter->a = g_new0 (gdouble, 1);
- filter->a[0] = (filter->mode == MODE_BAND_PASS) ? 0.0 : 1.0;
- filter->num_b = 0;
- filter->channels = g_new0 (GstAudioChebyshevFreqBandChannelCtx, channels);
- GST_LOG_OBJECT (filter, "frequency band had no or negative dimension");
- return;
- }
-
- if (filter->upper_frequency > GST_AUDIO_FILTER (filter)->format.rate / 2) {
- filter->upper_frequency = GST_AUDIO_FILTER (filter)->format.rate / 2;
- GST_LOG_OBJECT (filter, "clipped upper frequency to nyquist frequency");
- }
-
- if (filter->lower_frequency < 0.0) {
- filter->lower_frequency = 0.0;
- GST_LOG_OBJECT (filter, "clipped lower frequency to 0.0");
- }
-
- /* Calculate coefficients for the chebyshev filter */
- {
- gint np = filter->poles;
- gdouble *a, *b;
- gint i, p;
-
- filter->num_a = np + 1;
- filter->a = a = g_new0 (gdouble, np + 5);
- filter->num_b = np + 1;
- filter->b = b = g_new0 (gdouble, np + 5);
-
- filter->channels = g_new0 (GstAudioChebyshevFreqBandChannelCtx, channels);
- for (i = 0; i < channels; i++) {
- GstAudioChebyshevFreqBandChannelCtx *ctx = &filter->channels[i];
-
- ctx->x = g_new0 (gdouble, np + 1);
- ctx->y = g_new0 (gdouble, np + 1);
- }
-
- /* Calculate transfer function coefficients */
- a[4] = 1.0;
- b[4] = 1.0;
-
- for (p = 1; p <= np / 4; p++) {
- gdouble a0, a1, a2, a3, a4, b1, b2, b3, b4;
- gdouble *ta = g_new0 (gdouble, np + 5);
- gdouble *tb = g_new0 (gdouble, np + 5);
-
- generate_biquad_coefficients (filter, p, &a0, &a1, &a2, &a3, &a4, &b1,
- &b2, &b3, &b4);
-
- memcpy (ta, a, sizeof (gdouble) * (np + 5));
- memcpy (tb, b, sizeof (gdouble) * (np + 5));
-
- /* add the new coefficients for the new two poles
- * to the cascade by multiplication of the transfer
- * functions */
- for (i = 4; i < np + 5; i++) {
- a[i] =
- a0 * ta[i] + a1 * ta[i - 1] + a2 * ta[i - 2] + a3 * ta[i - 3] +
- a4 * ta[i - 4];
- b[i] =
- tb[i] - b1 * tb[i - 1] - b2 * tb[i - 2] - b3 * tb[i - 3] -
- b4 * tb[i - 4];
- }
- g_free (ta);
- g_free (tb);
- }
-
- /* Move coefficients to the beginning of the array
- * and multiply the b coefficients with -1 to move from
- * the transfer function's coefficients to the difference
- * equation's coefficients */
- b[4] = 0.0;
- for (i = 0; i <= np; i++) {
- a[i] = a[i + 4];
- b[i] = -b[i + 4];
- }
-
- /* Normalize to unity gain at frequency 0 and frequency
- * 0.5 for bandreject and unity gain at band center frequency
- * for bandpass */
- if (filter->mode == MODE_BAND_REJECT) {
- /* gain is sqrt(H(0)*H(0.5)) */
-
- gdouble gain1 = calculate_gain (a, b, np, np, 1.0, 0.0);
- gdouble gain2 = calculate_gain (a, b, np, np, -1.0, 0.0);
-
- gain1 = sqrt (gain1 * gain2);
-
- for (i = 0; i <= np; i++) {
- a[i] /= gain1;
- }
- } else {
- /* gain is H(wc), wc = center frequency */
-
- gdouble w1 =
- 2.0 * M_PI * (filter->lower_frequency /
- GST_AUDIO_FILTER (filter)->format.rate);
- gdouble w2 =
- 2.0 * M_PI * (filter->upper_frequency /
- GST_AUDIO_FILTER (filter)->format.rate);
- gdouble w0 = (w2 + w1) / 2.0;
- gdouble zr = cos (w0), zi = sin (w0);
- gdouble gain = calculate_gain (a, b, np, np, zr, zi);
-
- for (i = 0; i <= np; i++) {
- a[i] /= gain;
- }
- }
-
- GST_LOG_OBJECT (filter,
- "Generated IIR coefficients for the Chebyshev filter");
- GST_LOG_OBJECT (filter,
- "mode: %s, type: %d, poles: %d, lower-frequency: %.2f Hz, upper-frequency: %.2f Hz, ripple: %.2f dB",
- (filter->mode == MODE_BAND_PASS) ? "band-pass" : "band-reject",
- filter->type, filter->poles, filter->lower_frequency,
- filter->upper_frequency, filter->ripple);
-
- GST_LOG_OBJECT (filter, "%.2f dB gain @ 0Hz",
- 20.0 * log10 (calculate_gain (a, b, np, np, 1.0, 0.0)));
- {
- gdouble w1 =
- 2.0 * M_PI * (filter->lower_frequency /
- GST_AUDIO_FILTER (filter)->format.rate);
- gdouble w2 =
- 2.0 * M_PI * (filter->upper_frequency /
- GST_AUDIO_FILTER (filter)->format.rate);
- gdouble w0 = (w2 + w1) / 2.0;
- gdouble zr, zi;
-
- zr = cos (w1);
- zi = sin (w1);
- GST_LOG_OBJECT (filter, "%.2f dB gain @ %dHz",
- 20.0 * log10 (calculate_gain (a, b, np, np, zr, zi)),
- (int) filter->lower_frequency);
- zr = cos (w0);
- zi = sin (w0);
- GST_LOG_OBJECT (filter, "%.2f dB gain @ %dHz",
- 20.0 * log10 (calculate_gain (a, b, np, np, zr, zi)),
- (int) ((filter->lower_frequency + filter->upper_frequency) / 2.0));
- zr = cos (w2);
- zi = sin (w2);
- GST_LOG_OBJECT (filter, "%.2f dB gain @ %dHz",
- 20.0 * log10 (calculate_gain (a, b, np, np, zr, zi)),
- (int) filter->upper_frequency);
- }
- GST_LOG_OBJECT (filter, "%.2f dB gain @ %dHz",
- 20.0 * log10 (calculate_gain (a, b, np, np, -1.0, 0.0)),
- GST_AUDIO_FILTER (filter)->format.rate / 2);
- }
-}
-
-static void
-gst_audio_chebyshev_freq_band_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstAudioChebyshevFreqBand *filter = GST_AUDIO_CHEBYSHEV_FREQ_BAND (object);
-
- switch (prop_id) {
- case PROP_MODE:
- GST_BASE_TRANSFORM_LOCK (filter);
- filter->mode = g_value_get_enum (value);
- generate_coefficients (filter);
- GST_BASE_TRANSFORM_UNLOCK (filter);
- break;
- case PROP_TYPE:
- GST_BASE_TRANSFORM_LOCK (filter);
- filter->type = g_value_get_int (value);
- generate_coefficients (filter);
- GST_BASE_TRANSFORM_UNLOCK (filter);
- break;
- case PROP_LOWER_FREQUENCY:
- GST_BASE_TRANSFORM_LOCK (filter);
- filter->lower_frequency = g_value_get_float (value);
- generate_coefficients (filter);
- GST_BASE_TRANSFORM_UNLOCK (filter);
- break;
- case PROP_UPPER_FREQUENCY:
- GST_BASE_TRANSFORM_LOCK (filter);
- filter->upper_frequency = g_value_get_float (value);
- generate_coefficients (filter);
- GST_BASE_TRANSFORM_UNLOCK (filter);
- break;
- case PROP_RIPPLE:
- GST_BASE_TRANSFORM_LOCK (filter);
- filter->ripple = g_value_get_float (value);
- generate_coefficients (filter);
- GST_BASE_TRANSFORM_UNLOCK (filter);
- break;
- case PROP_POLES:
- GST_BASE_TRANSFORM_LOCK (filter);
- filter->poles = GST_ROUND_UP_4 (g_value_get_int (value));
- generate_coefficients (filter);
- GST_BASE_TRANSFORM_UNLOCK (filter);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_audio_chebyshev_freq_band_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstAudioChebyshevFreqBand *filter = GST_AUDIO_CHEBYSHEV_FREQ_BAND (object);
-
- switch (prop_id) {
- case PROP_MODE:
- g_value_set_enum (value, filter->mode);
- break;
- case PROP_TYPE:
- g_value_set_int (value, filter->type);
- break;
- case PROP_LOWER_FREQUENCY:
- g_value_set_float (value, filter->lower_frequency);
- break;
- case PROP_UPPER_FREQUENCY:
- g_value_set_float (value, filter->upper_frequency);
- break;
- case PROP_RIPPLE:
- g_value_set_float (value, filter->ripple);
- break;
- case PROP_POLES:
- g_value_set_int (value, filter->poles);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/* GstAudioFilter vmethod implementations */
-
-static gboolean
-gst_audio_chebyshev_freq_band_setup (GstAudioFilter * base,
- GstRingBufferSpec * format)
-{
- GstAudioChebyshevFreqBand *filter = GST_AUDIO_CHEBYSHEV_FREQ_BAND (base);
- gboolean ret = TRUE;
-
- if (format->width == 32)
- filter->process = (GstAudioChebyshevFreqBandProcessFunc)
- process_32;
- else if (format->width == 64)
- filter->process = (GstAudioChebyshevFreqBandProcessFunc)
- process_64;
- else
- ret = FALSE;
-
- filter->have_coeffs = FALSE;
-
- return ret;
-}
-
-static inline gdouble
-process (GstAudioChebyshevFreqBand * filter,
- GstAudioChebyshevFreqBandChannelCtx * ctx, gdouble x0)
-{
- gdouble val = filter->a[0] * x0;
- gint i, j;
-
- for (i = 1, j = ctx->x_pos; i < filter->num_a; i++) {
- val += filter->a[i] * ctx->x[j];
- j--;
- if (j < 0)
- j = filter->num_a - 1;
- }
-
- for (i = 1, j = ctx->y_pos; i < filter->num_b; i++) {
- val += filter->b[i] * ctx->y[j];
- j--;
- if (j < 0)
- j = filter->num_b - 1;
- }
-
- if (ctx->x) {
- ctx->x_pos++;
- if (ctx->x_pos > filter->num_a - 1)
- ctx->x_pos = 0;
- ctx->x[ctx->x_pos] = x0;
- }
-
- if (ctx->y) {
- ctx->y_pos++;
- if (ctx->y_pos > filter->num_b - 1)
- ctx->y_pos = 0;
-
- ctx->y[ctx->y_pos] = val;
- }
-
- return val;
-}
-
-#define DEFINE_PROCESS_FUNC(width,ctype) \
-static void \
-process_##width (GstAudioChebyshevFreqBand * filter, \
- g##ctype * data, guint num_samples) \
-{ \
- gint i, j, channels = GST_AUDIO_FILTER (filter)->format.channels; \
- gdouble val; \
- \
- for (i = 0; i < num_samples / channels; i++) { \
- for (j = 0; j < channels; j++) { \
- val = process (filter, &filter->channels[j], *data); \
- *data++ = val; \
- } \
- } \
-}
-
-DEFINE_PROCESS_FUNC (32, float);
-DEFINE_PROCESS_FUNC (64, double);
-
-#undef DEFINE_PROCESS_FUNC
-
-/* GstBaseTransform vmethod implementations */
-static GstFlowReturn
-gst_audio_chebyshev_freq_band_transform_ip (GstBaseTransform * base,
- GstBuffer * buf)
-{
- GstAudioChebyshevFreqBand *filter = GST_AUDIO_CHEBYSHEV_FREQ_BAND (base);
- guint num_samples =
- GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (filter)->format.width / 8);
-
- if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buf)))
- gst_object_sync_values (G_OBJECT (filter), GST_BUFFER_TIMESTAMP (buf));
-
- if (gst_base_transform_is_passthrough (base))
- return GST_FLOW_OK;
-
- if (!filter->have_coeffs)
- generate_coefficients (filter);
-
- filter->process (filter, GST_BUFFER_DATA (buf), num_samples);
-
- return GST_FLOW_OK;
-}
-
-static gboolean
-gst_audio_chebyshev_freq_band_start (GstBaseTransform * base)
-{
- GstAudioChebyshevFreqBand *filter = GST_AUDIO_CHEBYSHEV_FREQ_BAND (base);
- gint channels = GST_AUDIO_FILTER (filter)->format.channels;
- GstAudioChebyshevFreqBandChannelCtx *ctx;
- gint i;
-
- /* Reset the history of input and output values if
- * already existing */
- if (channels && filter->channels) {
- for (i = 0; i < channels; i++) {
- ctx = &filter->channels[i];
- if (ctx->x)
- memset (ctx->x, 0, (filter->poles + 1) * sizeof (gdouble));
- if (ctx->y)
- memset (ctx->y, 0, (filter->poles + 1) * sizeof (gdouble));
- }
- }
- return TRUE;
-}
diff --git a/gst/audiofx/audiochebyshevfreqband.h b/gst/audiofx/audiochebyshevfreqband.h
deleted file mode 100644
index e8c58074..00000000
--- a/gst/audiofx/audiochebyshevfreqband.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
- *
- * 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_AUDIO_CHEBYSHEV_FREQ_BAND_H__
-#define __GST_AUDIO_CHEBYSHEV_FREQ_BAND_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-#include <gst/audio/audio.h>
-#include <gst/audio/gstaudiofilter.h>
-
-G_BEGIN_DECLS
-#define GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND (gst_audio_chebyshev_freq_band_get_type())
-#define GST_AUDIO_CHEBYSHEV_FREQ_BAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND,GstAudioChebyshevFreqBand))
-#define GST_IS_AUDIO_CHEBYSHEV_FREQ_BAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND))
-#define GST_AUDIO_CHEBYSHEV_FREQ_BAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND,GstAudioChebyshevFreqBandClass))
-#define GST_IS_AUDIO_CHEBYSHEV_FREQ_BAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND))
-#define GST_AUDIO_CHEBYSHEV_FREQ_BAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND,GstAudioChebyshevFreqBandClass))
-typedef struct _GstAudioChebyshevFreqBand GstAudioChebyshevFreqBand;
-typedef struct _GstAudioChebyshevFreqBandClass GstAudioChebyshevFreqBandClass;
-
-typedef void (*GstAudioChebyshevFreqBandProcessFunc) (GstAudioChebyshevFreqBand *, guint8 *, guint);
-
-typedef struct
-{
- gdouble *x;
- gint x_pos;
- gdouble *y;
- gint y_pos;
-} GstAudioChebyshevFreqBandChannelCtx;
-
-struct _GstAudioChebyshevFreqBand
-{
- GstAudioFilter audiofilter;
-
- gint mode;
- gint type;
- gint poles;
- gfloat lower_frequency;
- gfloat upper_frequency;
- gfloat ripple;
-
- /* < private > */
- GstAudioChebyshevFreqBandProcessFunc process;
-
- gboolean have_coeffs;
- gdouble *a;
- gint num_a;
- gdouble *b;
- gint num_b;
- GstAudioChebyshevFreqBandChannelCtx *channels;
-};
-
-struct _GstAudioChebyshevFreqBandClass
-{
- GstAudioFilterClass parent;
-};
-
-GType gst_audio_chebyshev_freq_band_get_type (void);
-
-G_END_DECLS
-#endif /* __GST_AUDIO_CHEBYSHEV_FREQ_BAND_H__ */
diff --git a/gst/audiofx/audiochebyshevfreqlimit.c b/gst/audiofx/audiochebyshevfreqlimit.c
deleted file mode 100644
index 344db9f1..00000000
--- a/gst/audiofx/audiochebyshevfreqlimit.c
+++ /dev/null
@@ -1,823 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
- *
- * 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.
- */
-
-/*
- * Chebyshev type 1 filter design based on
- * "The Scientist and Engineer's Guide to DSP", Chapter 20.
- * http://www.dspguide.com/
- *
- * For type 2 and Chebyshev filters in general read
- * http://en.wikipedia.org/wiki/Chebyshev_filter
- *
- */
-
-/**
- * SECTION:element-audiochebyshevfreqlimit
- * @short_description: Chebyshev low pass and high pass filter
- *
- * <refsect2>
- * <para>
- * Attenuates all frequencies above the cutoff frequency (low-pass) or all frequencies below the
- * cutoff frequency (high-pass). The number of poles and the ripple parameter control the rolloff.
- * </para>
- * <para>
- * This element has the advantage over the windowed sinc lowpass and highpass filter that it is
- * much faster and produces almost as good results. It's only disadvantages are the highly
- * non-linear phase and the slower rolloff compared to a windowed sinc filter with a large kernel.
- * </para>
- * <para>
- * For type 1 the ripple parameter specifies how much ripple in dB is allowed in the passband, i.e.
- * some frequencies in the passband will be amplified by that value. A higher ripple value will allow
- * a faster rolloff.
- * </para>
- * <para>
- * For type 2 the ripple parameter specifies the stopband attenuation. In the stopband the gain will
- * be at most this value. A lower ripple value will allow a faster rolloff.
- * </para>
- * <para>
- * As a special case, a Chebyshev type 1 filter with no ripple is a Butterworth filter.
- * </para>
- * <para><note>
- * Be warned that a too large number of poles can produce noise. The most poles are possible with
- * a cutoff frequency at a quarter of the sampling rate.
- * </note></para>
- * <title>Example launch line</title>
- * <para>
- * <programlisting>
- * gst-launch audiotestsrc freq=1500 ! audioconvert ! audiochebyshevfreqlimit mode=low-pass cutoff=1000 poles=4 ! audioconvert ! alsasink
- * gst-launch filesrc location="melo1.ogg" ! oggdemux ! vorbisdec ! audioconvert ! audiochebyshevfreqlimit mode=high-pass cutoff=400 ripple=0.2 ! audioconvert ! alsasink
- * gst-launch audiotestsrc wave=white-noise ! audioconvert ! audiochebyshevfreqlimit mode=low-pass cutoff=800 type=2 ! audioconvert ! alsasink
- * </programlisting>
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-#include <gst/audio/audio.h>
-#include <gst/audio/gstaudiofilter.h>
-#include <gst/controller/gstcontroller.h>
-
-#include <math.h>
-
-#include "audiochebyshevfreqlimit.h"
-
-#define GST_CAT_DEFAULT gst_audio_chebyshev_freq_limit_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-static const GstElementDetails element_details =
-GST_ELEMENT_DETAILS ("AudioChebyshevFreqLimit",
- "Filter/Effect/Audio",
- "Chebyshev low pass and high pass filter",
- "Sebastian Dröge <slomo@circular-chaos.org>");
-
-/* Filter signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- PROP_0,
- PROP_MODE,
- PROP_TYPE,
- PROP_CUTOFF,
- PROP_RIPPLE,
- PROP_POLES
-};
-
-#define ALLOWED_CAPS \
- "audio/x-raw-float," \
- " width = (int) { 32, 64 }, " \
- " endianness = (int) BYTE_ORDER," \
- " rate = (int) [ 1, MAX ]," \
- " channels = (int) [ 1, MAX ]"
-
-#define DEBUG_INIT(bla) \
- GST_DEBUG_CATEGORY_INIT (gst_audio_chebyshev_freq_limit_debug, "audiochebyshevfreqlimit", 0, "audiochebyshevfreqlimit element");
-
-GST_BOILERPLATE_FULL (GstAudioChebyshevFreqLimit,
- gst_audio_chebyshev_freq_limit, GstAudioFilter, GST_TYPE_AUDIO_FILTER,
- DEBUG_INIT);
-
-static void gst_audio_chebyshev_freq_limit_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_audio_chebyshev_freq_limit_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static gboolean gst_audio_chebyshev_freq_limit_setup (GstAudioFilter * filter,
- GstRingBufferSpec * format);
-static GstFlowReturn
-gst_audio_chebyshev_freq_limit_transform_ip (GstBaseTransform * base,
- GstBuffer * buf);
-static gboolean gst_audio_chebyshev_freq_limit_start (GstBaseTransform * base);
-
-static void process_64 (GstAudioChebyshevFreqLimit * filter,
- gdouble * data, guint num_samples);
-static void process_32 (GstAudioChebyshevFreqLimit * filter,
- gfloat * data, guint num_samples);
-
-enum
-{
- MODE_LOW_PASS = 0,
- MODE_HIGH_PASS
-};
-
-#define GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT_MODE (gst_audio_chebyshev_freq_limit_mode_get_type ())
-static GType
-gst_audio_chebyshev_freq_limit_mode_get_type (void)
-{
- static GType gtype = 0;
-
- if (gtype == 0) {
- static const GEnumValue values[] = {
- {MODE_LOW_PASS, "Low pass (default)",
- "low-pass"},
- {MODE_HIGH_PASS, "High pass",
- "high-pass"},
- {0, NULL, NULL}
- };
-
- gtype = g_enum_register_static ("GstAudioChebyshevFreqLimitMode", values);
- }
- return gtype;
-}
-
-/* GObject vmethod implementations */
-
-static void
-gst_audio_chebyshev_freq_limit_base_init (gpointer klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- GstCaps *caps;
-
- gst_element_class_set_details (element_class, &element_details);
-
- caps = gst_caps_from_string (ALLOWED_CAPS);
- gst_audio_filter_class_add_pad_templates (GST_AUDIO_FILTER_CLASS (klass),
- caps);
- gst_caps_unref (caps);
-}
-
-static void
-gst_audio_chebyshev_freq_limit_dispose (GObject * object)
-{
- GstAudioChebyshevFreqLimit *filter = GST_AUDIO_CHEBYSHEV_FREQ_LIMIT (object);
-
- if (filter->a) {
- g_free (filter->a);
- filter->a = NULL;
- }
-
- if (filter->b) {
- g_free (filter->b);
- filter->b = NULL;
- }
-
- if (filter->channels) {
- GstAudioChebyshevFreqLimitChannelCtx *ctx;
- gint i, channels = GST_AUDIO_FILTER (filter)->format.channels;
-
- for (i = 0; i < channels; i++) {
- ctx = &filter->channels[i];
- g_free (ctx->x);
- g_free (ctx->y);
- }
-
- g_free (filter->channels);
- filter->channels = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_audio_chebyshev_freq_limit_class_init (GstAudioChebyshevFreqLimitClass *
- klass)
-{
- GObjectClass *gobject_class;
- GstBaseTransformClass *trans_class;
- GstAudioFilterClass *filter_class;
-
- gobject_class = (GObjectClass *) klass;
- trans_class = (GstBaseTransformClass *) klass;
- filter_class = (GstAudioFilterClass *) klass;
-
- gobject_class->set_property = gst_audio_chebyshev_freq_limit_set_property;
- gobject_class->get_property = gst_audio_chebyshev_freq_limit_get_property;
- gobject_class->dispose = gst_audio_chebyshev_freq_limit_dispose;
-
- g_object_class_install_property (gobject_class, PROP_MODE,
- g_param_spec_enum ("mode", "Mode",
- "Low pass or high pass mode",
- GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT_MODE, MODE_LOW_PASS,
- G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
- g_object_class_install_property (gobject_class, PROP_TYPE,
- g_param_spec_int ("type", "Type", "Type of the chebychev filter", 1, 2, 1,
- G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
-
- /* FIXME: Don't use the complete possible range but restrict the upper boundary
- * so automatically generated UIs can use a slider without */
- g_object_class_install_property (gobject_class, PROP_CUTOFF,
- g_param_spec_float ("cutoff", "Cutoff", "Cut off frequency (Hz)", 0.0,
- 100000.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
- g_object_class_install_property (gobject_class, PROP_RIPPLE,
- g_param_spec_float ("ripple", "Ripple", "Amount of ripple (dB)", 0.0,
- 200.0, 0.25, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
-
- /* FIXME: What to do about this upper boundary? With a cutoff frequency of
- * rate/4 32 poles are completely possible, with a cutoff frequency very low
- * or very high 16 poles already produces only noise */
- g_object_class_install_property (gobject_class, PROP_POLES,
- g_param_spec_int ("poles", "Poles",
- "Number of poles to use, will be rounded up to the next even number",
- 2, 32, 4, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
-
- filter_class->setup =
- GST_DEBUG_FUNCPTR (gst_audio_chebyshev_freq_limit_setup);
- trans_class->transform_ip =
- GST_DEBUG_FUNCPTR (gst_audio_chebyshev_freq_limit_transform_ip);
- trans_class->start = GST_DEBUG_FUNCPTR (gst_audio_chebyshev_freq_limit_start);
-}
-
-static void
-gst_audio_chebyshev_freq_limit_init (GstAudioChebyshevFreqLimit * filter,
- GstAudioChebyshevFreqLimitClass * klass)
-{
- filter->cutoff = 0.0;
- filter->mode = MODE_LOW_PASS;
- filter->type = 1;
- filter->poles = 4;
- filter->ripple = 0.25;
- gst_base_transform_set_in_place (GST_BASE_TRANSFORM (filter), TRUE);
-
- filter->have_coeffs = FALSE;
- filter->num_a = 0;
- filter->num_b = 0;
- filter->channels = NULL;
-}
-
-static void
-generate_biquad_coefficients (GstAudioChebyshevFreqLimit * filter,
- gint p, gdouble * a0, gdouble * a1, gdouble * a2,
- gdouble * b1, gdouble * b2)
-{
- gint np = filter->poles;
- gdouble ripple = filter->ripple;
-
- /* pole location in s-plane */
- gdouble rp, ip;
-
- /* zero location in s-plane */
- gdouble rz = 0.0, iz = 0.0;
-
- /* transfer function coefficients for the z-plane */
- gdouble x0, x1, x2, y1, y2;
- gint type = filter->type;
-
- /* Calculate pole location for lowpass at frequency 1 */
- {
- gdouble angle = (M_PI / 2.0) * (2.0 * p - 1) / np;
-
- rp = -sin (angle);
- ip = cos (angle);
- }
-
- /* If we allow ripple, move the pole from the unit
- * circle to an ellipse and keep cutoff at frequency 1 */
- if (ripple > 0 && type == 1) {
- gdouble es, vx;
-
- es = sqrt (pow (10.0, ripple / 10.0) - 1.0);
-
- vx = (1.0 / np) * asinh (1.0 / es);
- rp = rp * sinh (vx);
- ip = ip * cosh (vx);
- } else if (type == 2) {
- gdouble es, vx;
-
- es = sqrt (pow (10.0, ripple / 10.0) - 1.0);
- vx = (1.0 / np) * asinh (es);
- rp = rp * sinh (vx);
- ip = ip * cosh (vx);
- }
-
- /* Calculate inverse of the pole location to convert from
- * type I to type II */
- if (type == 2) {
- gdouble mag2 = rp * rp + ip * ip;
-
- rp /= mag2;
- ip /= mag2;
- }
-
- /* Calculate zero location for frequency 1 on the
- * unit circle for type 2 */
- if (type == 2) {
- gdouble angle = M_PI / (np * 2.0) + ((p - 1) * M_PI) / (np);
- gdouble mag2;
-
- rz = 0.0;
- iz = cos (angle);
- mag2 = rz * rz + iz * iz;
- rz /= mag2;
- iz /= mag2;
- }
-
- /* Convert from s-domain to z-domain by
- * using the bilinear Z-transform, i.e.
- * substitute s by (2/t)*((z-1)/(z+1))
- * with t = 2 * tan(0.5).
- */
- if (type == 1) {
- gdouble t, m, d;
-
- t = 2.0 * tan (0.5);
- m = rp * rp + ip * ip;
- d = 4.0 - 4.0 * rp * t + m * t * t;
-
- x0 = (t * t) / d;
- x1 = 2.0 * x0;
- x2 = x0;
- y1 = (8.0 - 2.0 * m * t * t) / d;
- y2 = (-4.0 - 4.0 * rp * t - m * t * t) / d;
- } else {
- gdouble t, m, d;
-
- t = 2.0 * tan (0.5);
- m = rp * rp + ip * ip;
- d = 4.0 - 4.0 * rp * t + m * t * t;
-
- x0 = (t * t * iz * iz + 4.0) / d;
- x1 = (-8.0 + 2.0 * iz * iz * t * t) / d;
- x2 = x0;
- y1 = (8.0 - 2.0 * m * t * t) / d;
- y2 = (-4.0 - 4.0 * rp * t - m * t * t) / d;
- }
-
- /* Convert from lowpass at frequency 1 to either lowpass
- * or highpass.
- *
- * For lowpass substitute z^(-1) with:
- * -1
- * z - k
- * ------------
- * -1
- * 1 - k * z
- *
- * k = sin((1-w)/2) / sin((1+w)/2)
- *
- * For highpass substitute z^(-1) with:
- *
- * -1
- * -z - k
- * ------------
- * -1
- * 1 + k * z
- *
- * k = -cos((1+w)/2) / cos((1-w)/2)
- *
- */
- {
- gdouble k, d;
- gdouble omega =
- 2.0 * M_PI * (filter->cutoff / GST_AUDIO_FILTER (filter)->format.rate);
-
- if (filter->mode == MODE_LOW_PASS)
- k = sin ((1.0 - omega) / 2.0) / sin ((1.0 + omega) / 2.0);
- else
- k = -cos ((omega + 1.0) / 2.0) / cos ((omega - 1.0) / 2.0);
-
- d = 1.0 + y1 * k - y2 * k * k;
- *a0 = (x0 + k * (-x1 + k * x2)) / d;
- *a1 = (x1 + k * k * x1 - 2.0 * k * (x0 + x2)) / d;
- *a2 = (x0 * k * k - x1 * k + x2) / d;
- *b1 = (2.0 * k + y1 + y1 * k * k - 2.0 * y2 * k) / d;
- *b2 = (-k * k - y1 * k + y2) / d;
-
- if (filter->mode == MODE_HIGH_PASS) {
- *a1 = -*a1;
- *b1 = -*b1;
- }
- }
-}
-
-/* Evaluate the transfer function that corresponds to the IIR
- * coefficients at zr + zi*I and return the magnitude */
-static gdouble
-calculate_gain (gdouble * a, gdouble * b, gint num_a, gint num_b, gdouble zr,
- gdouble zi)
-{
- gdouble sum_ar, sum_ai;
- gdouble sum_br, sum_bi;
- gdouble gain_r, gain_i;
-
- gdouble sum_r_old;
- gdouble sum_i_old;
-
- gint i;
-
- sum_ar = 0.0;
- sum_ai = 0.0;
- for (i = num_a; i >= 0; i--) {
- sum_r_old = sum_ar;
- sum_i_old = sum_ai;
-
- sum_ar = (sum_r_old * zr - sum_i_old * zi) + a[i];
- sum_ai = (sum_r_old * zi + sum_i_old * zr) + 0.0;
- }
-
- sum_br = 0.0;
- sum_bi = 0.0;
- for (i = num_b; i >= 0; i--) {
- sum_r_old = sum_br;
- sum_i_old = sum_bi;
-
- sum_br = (sum_r_old * zr - sum_i_old * zi) - b[i];
- sum_bi = (sum_r_old * zi + sum_i_old * zr) - 0.0;
- }
- sum_br += 1.0;
- sum_bi += 0.0;
-
- gain_r =
- (sum_ar * sum_br + sum_ai * sum_bi) / (sum_br * sum_br + sum_bi * sum_bi);
- gain_i =
- (sum_ai * sum_br - sum_ar * sum_bi) / (sum_br * sum_br + sum_bi * sum_bi);
-
- return (sqrt (gain_r * gain_r + gain_i * gain_i));
-}
-
-static void
-generate_coefficients (GstAudioChebyshevFreqLimit * filter)
-{
- gint channels = GST_AUDIO_FILTER (filter)->format.channels;
-
- if (filter->a) {
- g_free (filter->a);
- filter->a = NULL;
- }
-
- if (filter->b) {
- g_free (filter->b);
- filter->b = NULL;
- }
-
- if (filter->channels) {
- GstAudioChebyshevFreqLimitChannelCtx *ctx;
- gint i;
-
- for (i = 0; i < channels; i++) {
- ctx = &filter->channels[i];
- g_free (ctx->x);
- g_free (ctx->y);
- }
-
- g_free (filter->channels);
- filter->channels = NULL;
- }
-
- if (GST_AUDIO_FILTER (filter)->format.rate == 0) {
- filter->num_a = 1;
- filter->a = g_new0 (gdouble, 1);
- filter->a[0] = 1.0;
- filter->num_b = 0;
- filter->channels = g_new0 (GstAudioChebyshevFreqLimitChannelCtx, channels);
- GST_LOG_OBJECT (filter, "rate was not set yet");
- return;
- }
-
- filter->have_coeffs = TRUE;
-
- if (filter->cutoff >= GST_AUDIO_FILTER (filter)->format.rate / 2.0) {
- filter->num_a = 1;
- filter->a = g_new0 (gdouble, 1);
- filter->a[0] = (filter->mode == MODE_LOW_PASS) ? 1.0 : 0.0;
- filter->num_b = 0;
- filter->channels = g_new0 (GstAudioChebyshevFreqLimitChannelCtx, channels);
- GST_LOG_OBJECT (filter, "cutoff was higher than nyquist frequency");
- return;
- } else if (filter->cutoff <= 0.0) {
- filter->num_a = 1;
- filter->a = g_new0 (gdouble, 1);
- filter->a[0] = (filter->mode == MODE_LOW_PASS) ? 0.0 : 1.0;
- filter->num_b = 0;
- filter->channels = g_new0 (GstAudioChebyshevFreqLimitChannelCtx, channels);
- GST_LOG_OBJECT (filter, "cutoff is lower than zero");
- return;
- }
-
- /* Calculate coefficients for the chebyshev filter */
- {
- gint np = filter->poles;
- gdouble *a, *b;
- gint i, p;
-
- filter->num_a = np + 1;
- filter->a = a = g_new0 (gdouble, np + 3);
- filter->num_b = np + 1;
- filter->b = b = g_new0 (gdouble, np + 3);
-
- filter->channels = g_new0 (GstAudioChebyshevFreqLimitChannelCtx, channels);
- for (i = 0; i < channels; i++) {
- GstAudioChebyshevFreqLimitChannelCtx *ctx = &filter->channels[i];
-
- ctx->x = g_new0 (gdouble, np + 1);
- ctx->y = g_new0 (gdouble, np + 1);
- }
-
- /* Calculate transfer function coefficients */
- a[2] = 1.0;
- b[2] = 1.0;
-
- for (p = 1; p <= np / 2; p++) {
- gdouble a0, a1, a2, b1, b2;
- gdouble *ta = g_new0 (gdouble, np + 3);
- gdouble *tb = g_new0 (gdouble, np + 3);
-
- generate_biquad_coefficients (filter, p, &a0, &a1, &a2, &b1, &b2);
-
- memcpy (ta, a, sizeof (gdouble) * (np + 3));
- memcpy (tb, b, sizeof (gdouble) * (np + 3));
-
- /* add the new coefficients for the new two poles
- * to the cascade by multiplication of the transfer
- * functions */
- for (i = 2; i < np + 3; i++) {
- a[i] = a0 * ta[i] + a1 * ta[i - 1] + a2 * ta[i - 2];
- b[i] = tb[i] - b1 * tb[i - 1] - b2 * tb[i - 2];
- }
- g_free (ta);
- g_free (tb);
- }
-
- /* Move coefficients to the beginning of the array
- * and multiply the b coefficients with -1 to move from
- * the transfer function's coefficients to the difference
- * equation's coefficients */
- b[2] = 0.0;
- for (i = 0; i <= np; i++) {
- a[i] = a[i + 2];
- b[i] = -b[i + 2];
- }
-
- /* Normalize to unity gain at frequency 0 for lowpass
- * and frequency 0.5 for highpass */
- {
- gdouble gain;
-
- if (filter->mode == MODE_LOW_PASS)
- gain = calculate_gain (a, b, np, np, 1.0, 0.0);
- else
- gain = calculate_gain (a, b, np, np, -1.0, 0.0);
-
- for (i = 0; i <= np; i++) {
- a[i] /= gain;
- }
- }
-
- GST_LOG_OBJECT (filter,
- "Generated IIR coefficients for the Chebyshev filter");
- GST_LOG_OBJECT (filter,
- "mode: %s, type: %d, poles: %d, cutoff: %.2f Hz, ripple: %.2f dB",
- (filter->mode == MODE_LOW_PASS) ? "low-pass" : "high-pass",
- filter->type, filter->poles, filter->cutoff, filter->ripple);
- GST_LOG_OBJECT (filter, "%.2f dB gain @ 0 Hz",
- 20.0 * log10 (calculate_gain (a, b, np, np, 1.0, 0.0)));
- {
- gdouble wc =
- 2.0 * M_PI * (filter->cutoff /
- GST_AUDIO_FILTER (filter)->format.rate);
- gdouble zr = cos (wc), zi = sin (wc);
-
- GST_LOG_OBJECT (filter, "%.2f dB gain @ %d Hz",
- 20.0 * log10 (calculate_gain (a, b, np, np, zr, zi)),
- (int) filter->cutoff);
- }
- GST_LOG_OBJECT (filter, "%.2f dB gain @ %d Hz",
- 20.0 * log10 (calculate_gain (a, b, np, np, -1.0, 0.0)),
- GST_AUDIO_FILTER (filter)->format.rate / 2);
- }
-}
-
-static void
-gst_audio_chebyshev_freq_limit_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstAudioChebyshevFreqLimit *filter = GST_AUDIO_CHEBYSHEV_FREQ_LIMIT (object);
-
- switch (prop_id) {
- case PROP_MODE:
- GST_BASE_TRANSFORM_LOCK (filter);
- filter->mode = g_value_get_enum (value);
- generate_coefficients (filter);
- GST_BASE_TRANSFORM_UNLOCK (filter);
- break;
- case PROP_TYPE:
- GST_BASE_TRANSFORM_LOCK (filter);
- filter->type = g_value_get_int (value);
- generate_coefficients (filter);
- GST_BASE_TRANSFORM_UNLOCK (filter);
- break;
- case PROP_CUTOFF:
- GST_BASE_TRANSFORM_LOCK (filter);
- filter->cutoff = g_value_get_float (value);
- generate_coefficients (filter);
- GST_BASE_TRANSFORM_UNLOCK (filter);
- break;
- case PROP_RIPPLE:
- GST_BASE_TRANSFORM_LOCK (filter);
- filter->ripple = g_value_get_float (value);
- generate_coefficients (filter);
- GST_BASE_TRANSFORM_UNLOCK (filter);
- break;
- case PROP_POLES:
- GST_BASE_TRANSFORM_LOCK (filter);
- filter->poles = GST_ROUND_UP_2 (g_value_get_int (value));
- generate_coefficients (filter);
- GST_BASE_TRANSFORM_UNLOCK (filter);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_audio_chebyshev_freq_limit_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstAudioChebyshevFreqLimit *filter = GST_AUDIO_CHEBYSHEV_FREQ_LIMIT (object);
-
- switch (prop_id) {
- case PROP_MODE:
- g_value_set_enum (value, filter->mode);
- break;
- case PROP_TYPE:
- g_value_set_int (value, filter->type);
- break;
- case PROP_CUTOFF:
- g_value_set_float (value, filter->cutoff);
- break;
- case PROP_RIPPLE:
- g_value_set_float (value, filter->ripple);
- break;
- case PROP_POLES:
- g_value_set_int (value, filter->poles);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/* GstAudioFilter vmethod implementations */
-
-static gboolean
-gst_audio_chebyshev_freq_limit_setup (GstAudioFilter * base,
- GstRingBufferSpec * format)
-{
- GstAudioChebyshevFreqLimit *filter = GST_AUDIO_CHEBYSHEV_FREQ_LIMIT (base);
- gboolean ret = TRUE;
-
- if (format->width == 32)
- filter->process = (GstAudioChebyshevFreqLimitProcessFunc)
- process_32;
- else if (format->width == 64)
- filter->process = (GstAudioChebyshevFreqLimitProcessFunc)
- process_64;
- else
- ret = FALSE;
-
- filter->have_coeffs = FALSE;
-
- return ret;
-}
-
-static inline gdouble
-process (GstAudioChebyshevFreqLimit * filter,
- GstAudioChebyshevFreqLimitChannelCtx * ctx, gdouble x0)
-{
- gdouble val = filter->a[0] * x0;
- gint i, j;
-
- for (i = 1, j = ctx->x_pos; i < filter->num_a; i++) {
- val += filter->a[i] * ctx->x[j];
- j--;
- if (j < 0)
- j = filter->num_a - 1;
- }
-
- for (i = 1, j = ctx->y_pos; i < filter->num_b; i++) {
- val += filter->b[i] * ctx->y[j];
- j--;
- if (j < 0)
- j = filter->num_b - 1;
- }
-
- if (ctx->x) {
- ctx->x_pos++;
- if (ctx->x_pos > filter->num_a - 1)
- ctx->x_pos = 0;
- ctx->x[ctx->x_pos] = x0;
- }
-
- if (ctx->y) {
- ctx->y_pos++;
- if (ctx->y_pos > filter->num_b - 1)
- ctx->y_pos = 0;
-
- ctx->y[ctx->y_pos] = val;
- }
-
- return val;
-}
-
-#define DEFINE_PROCESS_FUNC(width,ctype) \
-static void \
-process_##width (GstAudioChebyshevFreqLimit * filter, \
- g##ctype * data, guint num_samples) \
-{ \
- gint i, j, channels = GST_AUDIO_FILTER (filter)->format.channels; \
- gdouble val; \
- \
- for (i = 0; i < num_samples / channels; i++) { \
- for (j = 0; j < channels; j++) { \
- val = process (filter, &filter->channels[j], *data); \
- *data++ = val; \
- } \
- } \
-}
-
-DEFINE_PROCESS_FUNC (32, float);
-DEFINE_PROCESS_FUNC (64, double);
-
-#undef DEFINE_PROCESS_FUNC
-
-/* GstBaseTransform vmethod implementations */
-static GstFlowReturn
-gst_audio_chebyshev_freq_limit_transform_ip (GstBaseTransform * base,
- GstBuffer * buf)
-{
- GstAudioChebyshevFreqLimit *filter = GST_AUDIO_CHEBYSHEV_FREQ_LIMIT (base);
- guint num_samples =
- GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (filter)->format.width / 8);
-
- if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buf)))
- gst_object_sync_values (G_OBJECT (filter), GST_BUFFER_TIMESTAMP (buf));
-
- if (gst_base_transform_is_passthrough (base))
- return GST_FLOW_OK;
-
- if (!filter->have_coeffs)
- generate_coefficients (filter);
-
- filter->process (filter, GST_BUFFER_DATA (buf), num_samples);
-
- return GST_FLOW_OK;
-}
-
-
-static gboolean
-gst_audio_chebyshev_freq_limit_start (GstBaseTransform * base)
-{
- GstAudioChebyshevFreqLimit *filter = GST_AUDIO_CHEBYSHEV_FREQ_LIMIT (base);
- gint channels = GST_AUDIO_FILTER (filter)->format.channels;
- GstAudioChebyshevFreqLimitChannelCtx *ctx;
- gint i;
-
- /* Reset the history of input and output values if
- * already existing */
- if (channels && filter->channels) {
- for (i = 0; i < channels; i++) {
- ctx = &filter->channels[i];
- if (ctx->x)
- memset (ctx->x, 0, (filter->poles + 1) * sizeof (gdouble));
- if (ctx->y)
- memset (ctx->y, 0, (filter->poles + 1) * sizeof (gdouble));
- }
- }
- return TRUE;
-}
diff --git a/gst/audiofx/audiochebyshevfreqlimit.h b/gst/audiofx/audiochebyshevfreqlimit.h
deleted file mode 100644
index 4c87ba8e..00000000
--- a/gst/audiofx/audiochebyshevfreqlimit.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
- *
- * 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_AUDIO_CHEBYSHEV_FREQ_LIMIT_H__
-#define __GST_AUDIO_CHEBYSHEV_FREQ_LIMIT_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-#include <gst/audio/audio.h>
-#include <gst/audio/gstaudiofilter.h>
-
-G_BEGIN_DECLS
-#define GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT (gst_audio_chebyshev_freq_limit_get_type())
-#define GST_AUDIO_CHEBYSHEV_FREQ_LIMIT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT,GstAudioChebyshevFreqLimit))
-#define GST_IS_AUDIO_CHEBYSHEV_FREQ_LIMIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT))
-#define GST_AUDIO_CHEBYSHEV_FREQ_LIMIT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT,GstAudioChebyshevFreqLimitClass))
-#define GST_IS_AUDIO_CHEBYSHEV_FREQ_LIMIT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT))
-#define GST_AUDIO_CHEBYSHEV_FREQ_LIMIT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT,GstAudioChebyshevFreqLimitClass))
-typedef struct _GstAudioChebyshevFreqLimit GstAudioChebyshevFreqLimit;
-typedef struct _GstAudioChebyshevFreqLimitClass GstAudioChebyshevFreqLimitClass;
-
-typedef void (*GstAudioChebyshevFreqLimitProcessFunc) (GstAudioChebyshevFreqLimit *, guint8 *, guint);
-
-typedef struct
-{
- gdouble *x;
- gint x_pos;
- gdouble *y;
- gint y_pos;
-} GstAudioChebyshevFreqLimitChannelCtx;
-
-struct _GstAudioChebyshevFreqLimit
-{
- GstAudioFilter audiofilter;
-
- gint mode;
- gint type;
- gint poles;
- gfloat cutoff;
- gfloat ripple;
-
- /* < private > */
- GstAudioChebyshevFreqLimitProcessFunc process;
-
- gboolean have_coeffs;
- gdouble *a;
- gint num_a;
- gdouble *b;
- gint num_b;
- GstAudioChebyshevFreqLimitChannelCtx *channels;
-};
-
-struct _GstAudioChebyshevFreqLimitClass
-{
- GstAudioFilterClass parent;
-};
-
-GType gst_audio_chebyshev_freq_limit_get_type (void);
-
-G_END_DECLS
-#endif /* __GST_AUDIO_CHEBYSHEV_FREQ_LIMIT_H__ */
diff --git a/gst/audiofx/audiofx.c b/gst/audiofx/audiofx.c
index 2c198f32..e5087a4c 100644
--- a/gst/audiofx/audiofx.c
+++ b/gst/audiofx/audiofx.c
@@ -29,8 +29,8 @@
#include "audioinvert.h"
#include "audioamplify.h"
#include "audiodynamic.h"
-#include "audiochebyshevfreqlimit.h"
-#include "audiochebyshevfreqband.h"
+#include "audiocheblimit.h"
+#include "audiochebband.h"
/* entry point to initialize the plug-in
* initialize the plug-in itself
@@ -51,10 +51,10 @@ plugin_init (GstPlugin * plugin)
GST_TYPE_AUDIO_AMPLIFY) &&
gst_element_register (plugin, "audiodynamic", GST_RANK_NONE,
GST_TYPE_AUDIO_DYNAMIC) &&
- gst_element_register (plugin, "audiochebyshevfreqlimit", GST_RANK_NONE,
- GST_TYPE_AUDIO_CHEBYSHEV_FREQ_LIMIT) &&
- gst_element_register (plugin, "audiochebyshevfreqband", GST_RANK_NONE,
- GST_TYPE_AUDIO_CHEBYSHEV_FREQ_BAND));
+ gst_element_register (plugin, "audiocheblimit", GST_RANK_NONE,
+ GST_TYPE_AUDIO_CHEB_LIMIT) &&
+ gst_element_register (plugin, "audiochebband", GST_RANK_NONE,
+ GST_TYPE_AUDIO_CHEB_BAND));
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am
index 9c663355..dac5d16c 100644
--- a/tests/check/Makefile.am
+++ b/tests/check/Makefile.am
@@ -55,8 +55,8 @@ check_PROGRAMS = \
elements/alphacolor \
elements/audiopanorama \
elements/audioinvert \
- elements/audiochebyshevfreqband \
- elements/audiochebyshevfreqlimit \
+ elements/audiochebband \
+ elements/audiocheblimit \
elements/audioamplify \
elements/audiodynamic \
elements/avimux \
diff --git a/tests/check/elements/.gitignore b/tests/check/elements/.gitignore
index a9d5dc1d..33fe1701 100644
--- a/tests/check/elements/.gitignore
+++ b/tests/check/elements/.gitignore
@@ -2,8 +2,8 @@
alphacolor
apev2mux
audioamplify
-audiochebyshevfreqband
-audiochebyshevfreqlimit
+audiochebband
+audiocheblimit
audiodynamic
audioinvert
audiopanorama
diff --git a/tests/check/elements/audiochebband.c b/tests/check/elements/audiochebband.c
index f4602e2c..13ffa5fe 100644
--- a/tests/check/elements/audiochebband.c
+++ b/tests/check/elements/audiochebband.c
@@ -2,7 +2,7 @@
*
* Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
*
- * audiochebyshevfreqband.c: Unit test for the audiochebyshevfreqband element
+ * audiochebband.c: Unit test for the audiochebband element
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -63,26 +63,24 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
);
GstElement *
-setup_audiochebyshevfreqband ()
+setup_audiochebband ()
{
- GstElement *audiochebyshevfreqband;
-
- GST_DEBUG ("setup_audiochebyshevfreqband");
- audiochebyshevfreqband = gst_check_setup_element ("audiochebyshevfreqband");
- mysrcpad =
- gst_check_setup_src_pad (audiochebyshevfreqband, &srctemplate, NULL);
- mysinkpad =
- gst_check_setup_sink_pad (audiochebyshevfreqband, &sinktemplate, NULL);
+ GstElement *audiochebband;
+
+ GST_DEBUG ("setup_audiochebband");
+ audiochebband = gst_check_setup_element ("audiochebband");
+ mysrcpad = gst_check_setup_src_pad (audiochebband, &srctemplate, NULL);
+ mysinkpad = gst_check_setup_sink_pad (audiochebband, &sinktemplate, NULL);
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_active (mysinkpad, TRUE);
- return audiochebyshevfreqband;
+ return audiochebband;
}
void
-cleanup_audiochebyshevfreqband (GstElement * audiochebyshevfreqband)
+cleanup_audiochebband (GstElement * audiochebband)
{
- GST_DEBUG ("cleanup_audiochebyshevfreqband");
+ GST_DEBUG ("cleanup_audiochebband");
g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
g_list_free (buffers);
@@ -90,9 +88,9 @@ cleanup_audiochebyshevfreqband (GstElement * audiochebyshevfreqband)
gst_pad_set_active (mysrcpad, FALSE);
gst_pad_set_active (mysinkpad, FALSE);
- gst_check_teardown_src_pad (audiochebyshevfreqband);
- gst_check_teardown_sink_pad (audiochebyshevfreqband);
- gst_check_teardown_element (audiochebyshevfreqband);
+ gst_check_teardown_src_pad (audiochebband);
+ gst_check_teardown_sink_pad (audiochebband);
+ gst_check_teardown_element (audiochebband);
}
/* Test if data containing only one frequency component
@@ -100,26 +98,26 @@ cleanup_audiochebyshevfreqband (GstElement * audiochebyshevfreqband)
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type1_32_bp_0hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
@@ -146,7 +144,7 @@ GST_START_TEST (test_type1_32_bp_0hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -156,26 +154,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type1_32_bp_11025hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
@@ -206,7 +204,7 @@ GST_START_TEST (test_type1_32_bp_11025hz)
fail_unless (rms >= 0.6);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -216,26 +214,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type1_32_bp_22050hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
@@ -264,7 +262,7 @@ GST_START_TEST (test_type1_32_bp_22050hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -274,26 +272,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type1_32_br_0hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
@@ -320,7 +318,7 @@ GST_START_TEST (test_type1_32_br_0hz)
fail_unless (rms >= 0.9);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -330,26 +328,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type1_32_br_11025hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
@@ -380,7 +378,7 @@ GST_START_TEST (test_type1_32_br_11025hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -390,26 +388,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type1_32_br_22050hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
@@ -438,7 +436,7 @@ GST_START_TEST (test_type1_32_br_22050hz)
fail_unless (rms >= 0.9);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -448,26 +446,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type1_64_bp_0hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
@@ -494,7 +492,7 @@ GST_START_TEST (test_type1_64_bp_0hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -504,26 +502,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type1_64_bp_11025hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
@@ -554,7 +552,7 @@ GST_START_TEST (test_type1_64_bp_11025hz)
fail_unless (rms >= 0.6);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -564,26 +562,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type1_64_bp_22050hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
@@ -612,7 +610,7 @@ GST_START_TEST (test_type1_64_bp_22050hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -622,26 +620,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type1_64_br_0hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
@@ -668,7 +666,7 @@ GST_START_TEST (test_type1_64_br_0hz)
fail_unless (rms >= 0.9);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -678,26 +676,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type1_64_br_11025hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
@@ -728,7 +726,7 @@ GST_START_TEST (test_type1_64_br_11025hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -738,26 +736,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type1_64_br_22050hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
@@ -786,7 +784,7 @@ GST_START_TEST (test_type1_64_br_22050hz)
fail_unless (rms >= 0.9);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -796,26 +794,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type2_32_bp_0hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
@@ -842,7 +840,7 @@ GST_START_TEST (test_type2_32_bp_0hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -852,26 +850,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type2_32_bp_11025hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
@@ -902,7 +900,7 @@ GST_START_TEST (test_type2_32_bp_11025hz)
fail_unless (rms >= 0.6);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -912,26 +910,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type2_32_bp_22050hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
@@ -960,7 +958,7 @@ GST_START_TEST (test_type2_32_bp_22050hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -970,26 +968,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type2_32_br_0hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
@@ -1016,7 +1014,7 @@ GST_START_TEST (test_type2_32_br_0hz)
fail_unless (rms >= 0.9);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -1026,26 +1024,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type2_32_br_11025hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
@@ -1076,7 +1074,7 @@ GST_START_TEST (test_type2_32_br_11025hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -1086,26 +1084,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type2_32_br_22050hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
@@ -1134,7 +1132,7 @@ GST_START_TEST (test_type2_32_br_22050hz)
fail_unless (rms >= 0.9);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -1144,26 +1142,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type2_64_bp_0hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
@@ -1190,7 +1188,7 @@ GST_START_TEST (test_type2_64_bp_0hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -1200,26 +1198,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type2_64_bp_11025hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
@@ -1250,7 +1248,7 @@ GST_START_TEST (test_type2_64_bp_11025hz)
fail_unless (rms >= 0.6);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -1260,26 +1258,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type2_64_bp_22050hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
@@ -1308,7 +1306,7 @@ GST_START_TEST (test_type2_64_bp_22050hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -1318,26 +1316,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type2_64_br_0hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
@@ -1364,7 +1362,7 @@ GST_START_TEST (test_type2_64_br_0hz)
fail_unless (rms >= 0.9);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -1374,26 +1372,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type2_64_br_11025hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
@@ -1424,7 +1422,7 @@ GST_START_TEST (test_type2_64_br_11025hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
@@ -1434,26 +1432,26 @@ GST_END_TEST;
* 2000Hz frequency band around rate/4 */
GST_START_TEST (test_type2_64_br_22050hz)
{
- GstElement *audiochebyshevfreqband;
+ GstElement *audiochebband;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
+ audiochebband = setup_audiochebband ();
/* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiochebband), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
+ fail_unless (gst_element_set_state (audiochebband,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
+ g_object_set (G_OBJECT (audiochebband), "lower-frequency",
44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
+ g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
@@ -1482,15 +1480,15 @@ GST_START_TEST (test_type2_64_br_22050hz)
fail_unless (rms >= 0.9);
/* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
+ cleanup_audiochebband (audiochebband);
}
GST_END_TEST;
Suite *
-audiochebyshevfreqband_suite (void)
+audiochebband_suite (void)
{
- Suite *s = suite_create ("audiochebyshevfreqband");
+ Suite *s = suite_create ("audiochebband");
TCase *tc_chain = tcase_create ("general");
suite_add_tcase (s, tc_chain);
@@ -1527,7 +1525,7 @@ main (int argc, char **argv)
{
int nf;
- Suite *s = audiochebyshevfreqband_suite ();
+ Suite *s = audiochebband_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
diff --git a/tests/check/elements/audiocheblimit.c b/tests/check/elements/audiocheblimit.c
index bf7ad09e..70645b98 100644
--- a/tests/check/elements/audiocheblimit.c
+++ b/tests/check/elements/audiocheblimit.c
@@ -2,7 +2,7 @@
*
* Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
*
- * audiochebyshevfreqlimit.c: Unit test for the audiochebyshevfreqlimit element
+ * audiocheblimit.c: Unit test for the audiocheblimit element
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -63,26 +63,24 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
);
GstElement *
-setup_audiochebyshevfreqlimit ()
+setup_audiocheblimit ()
{
- GstElement *audiochebyshevfreqlimit;
-
- GST_DEBUG ("setup_audiochebyshevfreqlimit");
- audiochebyshevfreqlimit = gst_check_setup_element ("audiochebyshevfreqlimit");
- mysrcpad =
- gst_check_setup_src_pad (audiochebyshevfreqlimit, &srctemplate, NULL);
- mysinkpad =
- gst_check_setup_sink_pad (audiochebyshevfreqlimit, &sinktemplate, NULL);
+ GstElement *audiocheblimit;
+
+ GST_DEBUG ("setup_audiocheblimit");
+ audiocheblimit = gst_check_setup_element ("audiocheblimit");
+ mysrcpad = gst_check_setup_src_pad (audiocheblimit, &srctemplate, NULL);
+ mysinkpad = gst_check_setup_sink_pad (audiocheblimit, &sinktemplate, NULL);
gst_pad_set_active (mysrcpad, TRUE);
gst_pad_set_active (mysinkpad, TRUE);
- return audiochebyshevfreqlimit;
+ return audiocheblimit;
}
void
-cleanup_audiochebyshevfreqlimit (GstElement * audiochebyshevfreqlimit)
+cleanup_audiocheblimit (GstElement * audiocheblimit)
{
- GST_DEBUG ("cleanup_audiochebyshevfreqlimit");
+ GST_DEBUG ("cleanup_audiocheblimit");
g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
g_list_free (buffers);
@@ -90,9 +88,9 @@ cleanup_audiochebyshevfreqlimit (GstElement * audiochebyshevfreqlimit)
gst_pad_set_active (mysrcpad, FALSE);
gst_pad_set_active (mysinkpad, FALSE);
- gst_check_teardown_src_pad (audiochebyshevfreqlimit);
- gst_check_teardown_sink_pad (audiochebyshevfreqlimit);
- gst_check_teardown_element (audiochebyshevfreqlimit);
+ gst_check_teardown_src_pad (audiocheblimit);
+ gst_check_teardown_sink_pad (audiocheblimit);
+ gst_check_teardown_element (audiocheblimit);
}
/* Test if data containing only one frequency component
@@ -100,25 +98,24 @@ cleanup_audiochebyshevfreqlimit (GstElement * audiochebyshevfreqlimit)
* at rate/4 */
GST_START_TEST (test_type1_32_lp_0hz)
{
- GstElement *audiochebyshevfreqlimit;
+ GstElement *audiocheblimit;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
+ audiocheblimit = setup_audiocheblimit ();
/* Set to lowpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
+ fail_unless (gst_element_set_state (audiocheblimit,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
for (i = 0; i < 128; i++)
@@ -144,7 +141,7 @@ GST_START_TEST (test_type1_32_lp_0hz)
fail_unless (rms >= 0.9);
/* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
+ cleanup_audiocheblimit (audiocheblimit);
}
GST_END_TEST;
@@ -154,25 +151,24 @@ GST_END_TEST;
* at rate/4 */
GST_START_TEST (test_type1_32_lp_22050hz)
{
- GstElement *audiochebyshevfreqlimit;
+ GstElement *audiocheblimit;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
+ audiocheblimit = setup_audiocheblimit ();
/* Set to lowpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
+ fail_unless (gst_element_set_state (audiocheblimit,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
for (i = 0; i < 128; i += 2) {
@@ -200,7 +196,7 @@ GST_START_TEST (test_type1_32_lp_22050hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
+ cleanup_audiocheblimit (audiocheblimit);
}
GST_END_TEST;
@@ -210,25 +206,24 @@ GST_END_TEST;
* at rate/4 */
GST_START_TEST (test_type1_32_hp_0hz)
{
- GstElement *audiochebyshevfreqlimit;
+ GstElement *audiocheblimit;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
+ audiocheblimit = setup_audiocheblimit ();
/* Set to highpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
+ fail_unless (gst_element_set_state (audiocheblimit,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
for (i = 0; i < 128; i++)
@@ -254,7 +249,7 @@ GST_START_TEST (test_type1_32_hp_0hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
+ cleanup_audiocheblimit (audiocheblimit);
}
GST_END_TEST;
@@ -264,25 +259,24 @@ GST_END_TEST;
* at rate/4 */
GST_START_TEST (test_type1_32_hp_22050hz)
{
- GstElement *audiochebyshevfreqlimit;
+ GstElement *audiocheblimit;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
+ audiocheblimit = setup_audiocheblimit ();
/* Set to highpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
+ fail_unless (gst_element_set_state (audiocheblimit,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
for (i = 0; i < 128; i += 2) {
@@ -310,7 +304,7 @@ GST_START_TEST (test_type1_32_hp_22050hz)
fail_unless (rms >= 0.9);
/* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
+ cleanup_audiocheblimit (audiocheblimit);
}
GST_END_TEST;
@@ -320,25 +314,24 @@ GST_END_TEST;
* at rate/4 */
GST_START_TEST (test_type1_64_lp_0hz)
{
- GstElement *audiochebyshevfreqlimit;
+ GstElement *audiocheblimit;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
+ audiocheblimit = setup_audiocheblimit ();
/* Set to lowpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
+ fail_unless (gst_element_set_state (audiocheblimit,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
for (i = 0; i < 128; i++)
@@ -364,7 +357,7 @@ GST_START_TEST (test_type1_64_lp_0hz)
fail_unless (rms >= 0.9);
/* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
+ cleanup_audiocheblimit (audiocheblimit);
}
GST_END_TEST;
@@ -374,25 +367,24 @@ GST_END_TEST;
* at rate/4 */
GST_START_TEST (test_type1_64_lp_22050hz)
{
- GstElement *audiochebyshevfreqlimit;
+ GstElement *audiocheblimit;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
+ audiocheblimit = setup_audiocheblimit ();
/* Set to lowpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
+ fail_unless (gst_element_set_state (audiocheblimit,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
for (i = 0; i < 128; i += 2) {
@@ -420,7 +412,7 @@ GST_START_TEST (test_type1_64_lp_22050hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
+ cleanup_audiocheblimit (audiocheblimit);
}
GST_END_TEST;
@@ -430,25 +422,24 @@ GST_END_TEST;
* at rate/4 */
GST_START_TEST (test_type1_64_hp_0hz)
{
- GstElement *audiochebyshevfreqlimit;
+ GstElement *audiocheblimit;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
+ audiocheblimit = setup_audiocheblimit ();
/* Set to highpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
+ fail_unless (gst_element_set_state (audiocheblimit,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
for (i = 0; i < 128; i++)
@@ -474,7 +465,7 @@ GST_START_TEST (test_type1_64_hp_0hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
+ cleanup_audiocheblimit (audiocheblimit);
}
GST_END_TEST;
@@ -484,25 +475,24 @@ GST_END_TEST;
* at rate/4 */
GST_START_TEST (test_type1_64_hp_22050hz)
{
- GstElement *audiochebyshevfreqlimit;
+ GstElement *audiocheblimit;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
+ audiocheblimit = setup_audiocheblimit ();
/* Set to highpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
+ fail_unless (gst_element_set_state (audiocheblimit,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
for (i = 0; i < 128; i += 2) {
@@ -530,7 +520,7 @@ GST_START_TEST (test_type1_64_hp_22050hz)
fail_unless (rms >= 0.9);
/* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
+ cleanup_audiocheblimit (audiocheblimit);
}
GST_END_TEST;
@@ -540,25 +530,24 @@ GST_END_TEST;
* at rate/4 */
GST_START_TEST (test_type2_32_lp_0hz)
{
- GstElement *audiochebyshevfreqlimit;
+ GstElement *audiocheblimit;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
+ audiocheblimit = setup_audiocheblimit ();
/* Set to lowpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
+ fail_unless (gst_element_set_state (audiocheblimit,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
for (i = 0; i < 128; i++)
@@ -584,7 +573,7 @@ GST_START_TEST (test_type2_32_lp_0hz)
fail_unless (rms >= 0.9);
/* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
+ cleanup_audiocheblimit (audiocheblimit);
}
GST_END_TEST;
@@ -594,25 +583,24 @@ GST_END_TEST;
* at rate/4 */
GST_START_TEST (test_type2_32_lp_22050hz)
{
- GstElement *audiochebyshevfreqlimit;
+ GstElement *audiocheblimit;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
+ audiocheblimit = setup_audiocheblimit ();
/* Set to lowpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
+ fail_unless (gst_element_set_state (audiocheblimit,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
for (i = 0; i < 128; i += 2) {
@@ -640,7 +628,7 @@ GST_START_TEST (test_type2_32_lp_22050hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
+ cleanup_audiocheblimit (audiocheblimit);
}
GST_END_TEST;
@@ -650,25 +638,24 @@ GST_END_TEST;
* at rate/4 */
GST_START_TEST (test_type2_32_hp_0hz)
{
- GstElement *audiochebyshevfreqlimit;
+ GstElement *audiocheblimit;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
+ audiocheblimit = setup_audiocheblimit ();
/* Set to highpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
+ fail_unless (gst_element_set_state (audiocheblimit,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
for (i = 0; i < 128; i++)
@@ -694,7 +681,7 @@ GST_START_TEST (test_type2_32_hp_0hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
+ cleanup_audiocheblimit (audiocheblimit);
}
GST_END_TEST;
@@ -704,25 +691,24 @@ GST_END_TEST;
* at rate/4 */
GST_START_TEST (test_type2_32_hp_22050hz)
{
- GstElement *audiochebyshevfreqlimit;
+ GstElement *audiocheblimit;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gfloat *in, *res, rms;
gint i;
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
+ audiocheblimit = setup_audiocheblimit ();
/* Set to highpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
+ fail_unless (gst_element_set_state (audiocheblimit,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
for (i = 0; i < 128; i += 2) {
@@ -750,7 +736,7 @@ GST_START_TEST (test_type2_32_hp_22050hz)
fail_unless (rms >= 0.9);
/* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
+ cleanup_audiocheblimit (audiocheblimit);
}
GST_END_TEST;
@@ -760,25 +746,24 @@ GST_END_TEST;
* at rate/4 */
GST_START_TEST (test_type2_64_lp_0hz)
{
- GstElement *audiochebyshevfreqlimit;
+ GstElement *audiocheblimit;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
+ audiocheblimit = setup_audiocheblimit ();
/* Set to lowpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
+ fail_unless (gst_element_set_state (audiocheblimit,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
for (i = 0; i < 128; i++)
@@ -804,7 +789,7 @@ GST_START_TEST (test_type2_64_lp_0hz)
fail_unless (rms >= 0.9);
/* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
+ cleanup_audiocheblimit (audiocheblimit);
}
GST_END_TEST;
@@ -814,25 +799,24 @@ GST_END_TEST;
* at rate/4 */
GST_START_TEST (test_type2_64_lp_22050hz)
{
- GstElement *audiochebyshevfreqlimit;
+ GstElement *audiocheblimit;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
+ audiocheblimit = setup_audiocheblimit ();
/* Set to lowpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
+ fail_unless (gst_element_set_state (audiocheblimit,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
for (i = 0; i < 128; i += 2) {
@@ -860,7 +844,7 @@ GST_START_TEST (test_type2_64_lp_22050hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
+ cleanup_audiocheblimit (audiocheblimit);
}
GST_END_TEST;
@@ -870,25 +854,24 @@ GST_END_TEST;
* at rate/4 */
GST_START_TEST (test_type2_64_hp_0hz)
{
- GstElement *audiochebyshevfreqlimit;
+ GstElement *audiocheblimit;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
+ audiocheblimit = setup_audiocheblimit ();
/* Set to highpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
+ fail_unless (gst_element_set_state (audiocheblimit,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
for (i = 0; i < 128; i++)
@@ -914,7 +897,7 @@ GST_START_TEST (test_type2_64_hp_0hz)
fail_unless (rms <= 0.1);
/* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
+ cleanup_audiocheblimit (audiocheblimit);
}
GST_END_TEST;
@@ -924,25 +907,24 @@ GST_END_TEST;
* at rate/4 */
GST_START_TEST (test_type2_64_hp_22050hz)
{
- GstElement *audiochebyshevfreqlimit;
+ GstElement *audiocheblimit;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble *in, *res, rms;
gint i;
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
+ audiocheblimit = setup_audiocheblimit ();
/* Set to highpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL);
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
+ fail_unless (gst_element_set_state (audiocheblimit,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
+ g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
for (i = 0; i < 128; i += 2) {
@@ -970,16 +952,16 @@ GST_START_TEST (test_type2_64_hp_22050hz)
fail_unless (rms >= 0.9);
/* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
+ cleanup_audiocheblimit (audiocheblimit);
}
GST_END_TEST;
Suite *
-audiochebyshevfreqlimit_suite (void)
+audiocheblimit_suite (void)
{
- Suite *s = suite_create ("audiochebyshevfreqlimit");
+ Suite *s = suite_create ("audiocheblimit");
TCase *tc_chain = tcase_create ("general");
suite_add_tcase (s, tc_chain);
@@ -1007,7 +989,7 @@ main (int argc, char **argv)
{
int nf;
- Suite *s = audiochebyshevfreqlimit_suite ();
+ Suite *s = audiocheblimit_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
diff --git a/tests/check/elements/audiochebyshevfreqband.c b/tests/check/elements/audiochebyshevfreqband.c
deleted file mode 100644
index f4602e2c..00000000
--- a/tests/check/elements/audiochebyshevfreqband.c
+++ /dev/null
@@ -1,1540 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
- *
- * audiochebyshevfreqband.c: Unit test for the audiochebyshevfreqband element
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-#include <gst/check/gstcheck.h>
-
-#include <math.h>
-
-/* For ease of programming we use globals to keep refs for our floating
- * src and sink pads we create; otherwise we always have to do get_pad,
- * get_peer, and then remove references in every test function */
-GstPad *mysrcpad, *mysinkpad;
-
-#define BUFFER_CAPS_STRING_32 \
- "audio/x-raw-float, " \
- "channels = (int) 1, " \
- "rate = (int) 44100, " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 32" \
-
-#define BUFFER_CAPS_STRING_64 \
- "audio/x-raw-float, " \
- "channels = (int) 1, " \
- "rate = (int) 44100, " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 64" \
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-float, "
- "channels = (int) 1, "
- "rate = (int) 44100, "
- "endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 }")
- );
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-float, "
- "channels = (int) 1, "
- "rate = (int) 44100, "
- "endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 }")
- );
-
-GstElement *
-setup_audiochebyshevfreqband ()
-{
- GstElement *audiochebyshevfreqband;
-
- GST_DEBUG ("setup_audiochebyshevfreqband");
- audiochebyshevfreqband = gst_check_setup_element ("audiochebyshevfreqband");
- mysrcpad =
- gst_check_setup_src_pad (audiochebyshevfreqband, &srctemplate, NULL);
- mysinkpad =
- gst_check_setup_sink_pad (audiochebyshevfreqband, &sinktemplate, NULL);
- gst_pad_set_active (mysrcpad, TRUE);
- gst_pad_set_active (mysinkpad, TRUE);
-
- return audiochebyshevfreqband;
-}
-
-void
-cleanup_audiochebyshevfreqband (GstElement * audiochebyshevfreqband)
-{
- GST_DEBUG ("cleanup_audiochebyshevfreqband");
-
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
-
- gst_pad_set_active (mysrcpad, FALSE);
- gst_pad_set_active (mysinkpad, FALSE);
- gst_check_teardown_src_pad (audiochebyshevfreqband);
- gst_check_teardown_sink_pad (audiochebyshevfreqband);
- gst_check_teardown_element (audiochebyshevfreqband);
-}
-
-/* Test if data containing only one frequency component
- * at 0 is erased with bandpass mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type1_32_bp_0hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i++)
- in[i] = 1.0;
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at band center is preserved with bandpass mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type1_32_bp_11025hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i += 4) {
- in[i] = 0.0;
- in[i + 1] = 1.0;
- in[i + 2] = 0.0;
- in[i + 3] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms >= 0.6);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at rate/2 is erased with bandpass mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type1_32_bp_22050hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at 0 is preserved with bandreject mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type1_32_br_0hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i++)
- in[i] = 1.0;
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms >= 0.9);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at band center is erased with bandreject mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type1_32_br_11025hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i += 4) {
- in[i] = 0.0;
- in[i + 1] = 1.0;
- in[i + 2] = 0.0;
- in[i + 3] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at rate/2 is preserved with bandreject mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type1_32_br_22050hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms >= 0.9);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at 0 is erased with bandpass mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type1_64_bp_0hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i++)
- in[i] = 1.0;
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at band center is preserved with bandpass mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type1_64_bp_11025hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i += 4) {
- in[i] = 0.0;
- in[i + 1] = 1.0;
- in[i + 2] = 0.0;
- in[i + 3] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms >= 0.6);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at rate/2 is erased with bandpass mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type1_64_bp_22050hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at 0 is preserved with bandreject mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type1_64_br_0hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i++)
- in[i] = 1.0;
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms >= 0.9);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at band center is erased with bandreject mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type1_64_br_11025hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i += 4) {
- in[i] = 0.0;
- in[i + 1] = 1.0;
- in[i + 2] = 0.0;
- in[i + 3] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at rate/2 is preserved with bandreject mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type1_64_br_22050hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms >= 0.9);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at 0 is erased with bandpass mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type2_32_bp_0hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i++)
- in[i] = 1.0;
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at band center is preserved with bandpass mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type2_32_bp_11025hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i += 4) {
- in[i] = 0.0;
- in[i + 1] = 1.0;
- in[i + 2] = 0.0;
- in[i + 3] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms >= 0.6);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at rate/2 is erased with bandpass mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type2_32_bp_22050hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at 0 is preserved with bandreject mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type2_32_br_0hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i++)
- in[i] = 1.0;
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms >= 0.9);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at band center is erased with bandreject mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type2_32_br_11025hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i += 4) {
- in[i] = 0.0;
- in[i + 1] = 1.0;
- in[i + 2] = 0.0;
- in[i + 3] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at rate/2 is preserved with bandreject mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type2_32_br_22050hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms >= 0.9);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at 0 is erased with bandpass mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type2_64_bp_0hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i++)
- in[i] = 1.0;
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at band center is preserved with bandpass mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type2_64_bp_11025hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i += 4) {
- in[i] = 0.0;
- in[i + 1] = 1.0;
- in[i + 2] = 0.0;
- in[i + 3] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms >= 0.6);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at rate/2 is erased with bandpass mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type2_64_bp_22050hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandpass */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at 0 is preserved with bandreject mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type2_64_br_0hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i++)
- in[i] = 1.0;
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms >= 0.9);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at band center is erased with bandreject mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type2_64_br_11025hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i += 4) {
- in[i] = 0.0;
- in[i + 1] = 1.0;
- in[i + 2] = 0.0;
- in[i + 3] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at rate/2 is preserved with bandreject mode and a
- * 2000Hz frequency band around rate/4 */
-GST_START_TEST (test_type2_64_br_22050hz)
-{
- GstElement *audiochebyshevfreqband;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqband = setup_audiochebyshevfreqband ();
- /* Set to bandreject */
- g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqband,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency",
- 44100 / 4.0 - 1000, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency",
- 44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 1024; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 1024; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 1024.0);
- fail_unless (rms >= 0.9);
-
- /* cleanup */
- cleanup_audiochebyshevfreqband (audiochebyshevfreqband);
-}
-
-GST_END_TEST;
-
-Suite *
-audiochebyshevfreqband_suite (void)
-{
- Suite *s = suite_create ("audiochebyshevfreqband");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_type1_32_bp_0hz);
- tcase_add_test (tc_chain, test_type1_32_bp_11025hz);
- tcase_add_test (tc_chain, test_type1_32_bp_22050hz);
- tcase_add_test (tc_chain, test_type1_32_br_0hz);
- tcase_add_test (tc_chain, test_type1_32_br_11025hz);
- tcase_add_test (tc_chain, test_type1_32_br_22050hz);
- tcase_add_test (tc_chain, test_type1_64_bp_0hz);
- tcase_add_test (tc_chain, test_type1_64_bp_11025hz);
- tcase_add_test (tc_chain, test_type1_64_bp_22050hz);
- tcase_add_test (tc_chain, test_type1_64_br_0hz);
- tcase_add_test (tc_chain, test_type1_64_br_11025hz);
- tcase_add_test (tc_chain, test_type1_64_br_22050hz);
- tcase_add_test (tc_chain, test_type2_32_bp_0hz);
- tcase_add_test (tc_chain, test_type2_32_bp_11025hz);
- tcase_add_test (tc_chain, test_type2_32_bp_22050hz);
- tcase_add_test (tc_chain, test_type2_32_br_0hz);
- tcase_add_test (tc_chain, test_type2_32_br_11025hz);
- tcase_add_test (tc_chain, test_type2_32_br_22050hz);
- tcase_add_test (tc_chain, test_type2_64_bp_0hz);
- tcase_add_test (tc_chain, test_type2_64_bp_11025hz);
- tcase_add_test (tc_chain, test_type2_64_bp_22050hz);
- tcase_add_test (tc_chain, test_type2_64_br_0hz);
- tcase_add_test (tc_chain, test_type2_64_br_11025hz);
- tcase_add_test (tc_chain, test_type2_64_br_22050hz);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = audiochebyshevfreqband_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
diff --git a/tests/check/elements/audiochebyshevfreqlimit.c b/tests/check/elements/audiochebyshevfreqlimit.c
deleted file mode 100644
index bf7ad09e..00000000
--- a/tests/check/elements/audiochebyshevfreqlimit.c
+++ /dev/null
@@ -1,1020 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
- *
- * audiochebyshevfreqlimit.c: Unit test for the audiochebyshevfreqlimit element
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-#include <gst/check/gstcheck.h>
-
-#include <math.h>
-
-/* For ease of programming we use globals to keep refs for our floating
- * src and sink pads we create; otherwise we always have to do get_pad,
- * get_peer, and then remove references in every test function */
-GstPad *mysrcpad, *mysinkpad;
-
-#define BUFFER_CAPS_STRING_32 \
- "audio/x-raw-float, " \
- "channels = (int) 1, " \
- "rate = (int) 44100, " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 32" \
-
-#define BUFFER_CAPS_STRING_64 \
- "audio/x-raw-float, " \
- "channels = (int) 1, " \
- "rate = (int) 44100, " \
- "endianness = (int) BYTE_ORDER, " \
- "width = (int) 64" \
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-float, "
- "channels = (int) 1, "
- "rate = (int) 44100, "
- "endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 }")
- );
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-float, "
- "channels = (int) 1, "
- "rate = (int) 44100, "
- "endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 }")
- );
-
-GstElement *
-setup_audiochebyshevfreqlimit ()
-{
- GstElement *audiochebyshevfreqlimit;
-
- GST_DEBUG ("setup_audiochebyshevfreqlimit");
- audiochebyshevfreqlimit = gst_check_setup_element ("audiochebyshevfreqlimit");
- mysrcpad =
- gst_check_setup_src_pad (audiochebyshevfreqlimit, &srctemplate, NULL);
- mysinkpad =
- gst_check_setup_sink_pad (audiochebyshevfreqlimit, &sinktemplate, NULL);
- gst_pad_set_active (mysrcpad, TRUE);
- gst_pad_set_active (mysinkpad, TRUE);
-
- return audiochebyshevfreqlimit;
-}
-
-void
-cleanup_audiochebyshevfreqlimit (GstElement * audiochebyshevfreqlimit)
-{
- GST_DEBUG ("cleanup_audiochebyshevfreqlimit");
-
- g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
- g_list_free (buffers);
- buffers = NULL;
-
- gst_pad_set_active (mysrcpad, FALSE);
- gst_pad_set_active (mysinkpad, FALSE);
- gst_check_teardown_src_pad (audiochebyshevfreqlimit);
- gst_check_teardown_sink_pad (audiochebyshevfreqlimit);
- gst_check_teardown_element (audiochebyshevfreqlimit);
-}
-
-/* Test if data containing only one frequency component
- * at 0 is preserved with lowpass mode and a cutoff
- * at rate/4 */
-GST_START_TEST (test_type1_32_lp_0hz)
-{
- GstElement *audiochebyshevfreqlimit;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
- /* Set to lowpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
- inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 128; i++)
- in[i] = 1.0;
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms >= 0.9);
-
- /* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at rate/2 is erased with lowpass mode and a cutoff
- * at rate/4 */
-GST_START_TEST (test_type1_32_lp_22050hz)
-{
- GstElement *audiochebyshevfreqlimit;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
- /* Set to lowpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
- inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 128; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at 0 is erased with highpass mode and a cutoff
- * at rate/4 */
-GST_START_TEST (test_type1_32_hp_0hz)
-{
- GstElement *audiochebyshevfreqlimit;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
- /* Set to highpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
- inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 128; i++)
- in[i] = 1.0;
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at rate/2 is preserved with highpass mode and a cutoff
- * at rate/4 */
-GST_START_TEST (test_type1_32_hp_22050hz)
-{
- GstElement *audiochebyshevfreqlimit;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
- /* Set to highpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
- inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 128; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms >= 0.9);
-
- /* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at 0 is preserved with lowpass mode and a cutoff
- * at rate/4 */
-GST_START_TEST (test_type1_64_lp_0hz)
-{
- GstElement *audiochebyshevfreqlimit;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
- /* Set to lowpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
- inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 128; i++)
- in[i] = 1.0;
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms >= 0.9);
-
- /* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at rate/2 is erased with lowpass mode and a cutoff
- * at rate/4 */
-GST_START_TEST (test_type1_64_lp_22050hz)
-{
- GstElement *audiochebyshevfreqlimit;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
- /* Set to lowpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
- inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 128; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at 0 is erased with highpass mode and a cutoff
- * at rate/4 */
-GST_START_TEST (test_type1_64_hp_0hz)
-{
- GstElement *audiochebyshevfreqlimit;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
- /* Set to highpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
- inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 128; i++)
- in[i] = 1.0;
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at rate/2 is preserved with highpass mode and a cutoff
- * at rate/4 */
-GST_START_TEST (test_type1_64_hp_22050hz)
-{
- GstElement *audiochebyshevfreqlimit;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
- /* Set to highpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
- inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 128; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms >= 0.9);
-
- /* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at 0 is preserved with lowpass mode and a cutoff
- * at rate/4 */
-GST_START_TEST (test_type2_32_lp_0hz)
-{
- GstElement *audiochebyshevfreqlimit;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
- /* Set to lowpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
- inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 128; i++)
- in[i] = 1.0;
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms >= 0.9);
-
- /* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at rate/2 is erased with lowpass mode and a cutoff
- * at rate/4 */
-GST_START_TEST (test_type2_32_lp_22050hz)
-{
- GstElement *audiochebyshevfreqlimit;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
- /* Set to lowpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
- inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 128; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at 0 is erased with highpass mode and a cutoff
- * at rate/4 */
-GST_START_TEST (test_type2_32_hp_0hz)
-{
- GstElement *audiochebyshevfreqlimit;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
- /* Set to highpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
- inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 128; i++)
- in[i] = 1.0;
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at rate/2 is preserved with highpass mode and a cutoff
- * at rate/4 */
-GST_START_TEST (test_type2_32_hp_22050hz)
-{
- GstElement *audiochebyshevfreqlimit;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gfloat *in, *res, rms;
- gint i;
-
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
- /* Set to highpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
- inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 128; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gfloat *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms >= 0.9);
-
- /* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at 0 is preserved with lowpass mode and a cutoff
- * at rate/4 */
-GST_START_TEST (test_type2_64_lp_0hz)
-{
- GstElement *audiochebyshevfreqlimit;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
- /* Set to lowpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
- inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 128; i++)
- in[i] = 1.0;
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms >= 0.9);
-
- /* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at rate/2 is erased with lowpass mode and a cutoff
- * at rate/4 */
-GST_START_TEST (test_type2_64_lp_22050hz)
-{
- GstElement *audiochebyshevfreqlimit;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
- /* Set to lowpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
- inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 128; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at 0 is erased with highpass mode and a cutoff
- * at rate/4 */
-GST_START_TEST (test_type2_64_hp_0hz)
-{
- GstElement *audiochebyshevfreqlimit;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
- /* Set to highpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
- inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 128; i++)
- in[i] = 1.0;
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms <= 0.1);
-
- /* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
-}
-
-GST_END_TEST;
-
-/* Test if data containing only one frequency component
- * at rate/2 is preserved with highpass mode and a cutoff
- * at rate/4 */
-GST_START_TEST (test_type2_64_hp_22050hz)
-{
- GstElement *audiochebyshevfreqlimit;
- GstBuffer *inbuffer, *outbuffer;
- GstCaps *caps;
- gdouble *in, *res, rms;
- gint i;
-
- audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit ();
- /* Set to highpass */
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL);
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL);
-
- fail_unless (gst_element_set_state (audiochebyshevfreqlimit,
- GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
- "could not set to playing");
-
- g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0,
- NULL);
- inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
- in = (gdouble *) GST_BUFFER_DATA (inbuffer);
- for (i = 0; i < 128; i += 2) {
- in[i] = 1.0;
- in[i + 1] = -1.0;
- }
-
- caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
- gst_buffer_set_caps (inbuffer, caps);
- gst_caps_unref (caps);
- ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
-
- /* pushing gives away my reference ... */
- fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
- /* ... and puts a new buffer on the global list */
- fail_unless_equals_int (g_list_length (buffers), 1);
- fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
-
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
-
- rms = 0.0;
- for (i = 0; i < 128; i++)
- rms += res[i] * res[i];
- rms = sqrt (rms / 128.0);
- fail_unless (rms >= 0.9);
-
- /* cleanup */
- cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit);
-}
-
-GST_END_TEST;
-
-
-Suite *
-audiochebyshevfreqlimit_suite (void)
-{
- Suite *s = suite_create ("audiochebyshevfreqlimit");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_type1_32_lp_0hz);
- tcase_add_test (tc_chain, test_type1_32_lp_22050hz);
- tcase_add_test (tc_chain, test_type1_32_hp_0hz);
- tcase_add_test (tc_chain, test_type1_32_hp_22050hz);
- tcase_add_test (tc_chain, test_type1_64_lp_0hz);
- tcase_add_test (tc_chain, test_type1_64_lp_22050hz);
- tcase_add_test (tc_chain, test_type1_64_hp_0hz);
- tcase_add_test (tc_chain, test_type1_64_hp_22050hz);
- tcase_add_test (tc_chain, test_type2_32_lp_0hz);
- tcase_add_test (tc_chain, test_type2_32_lp_22050hz);
- tcase_add_test (tc_chain, test_type2_32_hp_0hz);
- tcase_add_test (tc_chain, test_type2_32_hp_22050hz);
- tcase_add_test (tc_chain, test_type2_64_lp_0hz);
- tcase_add_test (tc_chain, test_type2_64_lp_22050hz);
- tcase_add_test (tc_chain, test_type2_64_hp_0hz);
- tcase_add_test (tc_chain, test_type2_64_hp_22050hz);
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- int nf;
-
- Suite *s = audiochebyshevfreqlimit_suite ();
- SRunner *sr = srunner_create (s);
-
- gst_check_init (&argc, &argv);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}