gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
/* 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;
|
|
|
|
|
2007-08-19 18:47:19 +00:00
|
|
|
#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 \
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
"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, "
|
2007-08-19 18:47:19 +00:00
|
|
|
"endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 }")
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
);
|
|
|
|
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, "
|
2007-08-19 18:47:19 +00:00
|
|
|
"endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 }")
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
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 */
|
2007-08-19 18:47:19 +00:00
|
|
|
GST_START_TEST (test_type1_32_bp_0hz)
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
{
|
|
|
|
GstElement *audiochebyshevfreqband;
|
|
|
|
GstBuffer *inbuffer, *outbuffer;
|
|
|
|
GstCaps *caps;
|
2007-08-19 18:47:19 +00:00
|
|
|
gfloat *in, *res, rms;
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
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);
|
2007-08-19 18:47:19 +00:00
|
|
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
|
|
|
|
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
for (i = 0; i < 1024; i++)
|
|
|
|
in[i] = 1.0;
|
|
|
|
|
2007-08-19 18:47:19 +00:00
|
|
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
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);
|
|
|
|
|
2007-08-19 18:47:19 +00:00
|
|
|
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
|
|
|
|
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 */
|
2007-08-19 18:47:19 +00:00
|
|
|
GST_START_TEST (test_type1_32_bp_11025hz)
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
{
|
|
|
|
GstElement *audiochebyshevfreqband;
|
|
|
|
GstBuffer *inbuffer, *outbuffer;
|
|
|
|
GstCaps *caps;
|
2007-08-19 18:47:19 +00:00
|
|
|
gfloat *in, *res, rms;
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
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);
|
2007-08-19 18:47:19 +00:00
|
|
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
|
|
|
|
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2007-08-19 18:47:19 +00:00
|
|
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
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);
|
|
|
|
|
2007-08-19 18:47:19 +00:00
|
|
|
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
|
|
|
|
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 */
|
2007-08-19 18:47:19 +00:00
|
|
|
GST_START_TEST (test_type1_32_bp_22050hz)
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
{
|
|
|
|
GstElement *audiochebyshevfreqband;
|
|
|
|
GstBuffer *inbuffer, *outbuffer;
|
|
|
|
GstCaps *caps;
|
2007-08-19 18:47:19 +00:00
|
|
|
gfloat *in, *res, rms;
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
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);
|
2007-08-19 18:47:19 +00:00
|
|
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
|
|
|
|
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
for (i = 0; i < 1024; i += 2) {
|
|
|
|
in[i] = 1.0;
|
|
|
|
in[i + 1] = -1.0;
|
|
|
|
}
|
|
|
|
|
2007-08-19 18:47:19 +00:00
|
|
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
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);
|
|
|
|
|
2007-08-19 18:47:19 +00:00
|
|
|
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
|
|
|
|
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 */
|
2007-08-19 18:47:19 +00:00
|
|
|
GST_START_TEST (test_type1_32_br_0hz)
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
{
|
|
|
|
GstElement *audiochebyshevfreqband;
|
|
|
|
GstBuffer *inbuffer, *outbuffer;
|
|
|
|
GstCaps *caps;
|
2007-08-19 18:47:19 +00:00
|
|
|
gfloat *in, *res, rms;
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
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);
|
2007-08-19 18:47:19 +00:00
|
|
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
|
|
|
|
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
for (i = 0; i < 1024; i++)
|
|
|
|
in[i] = 1.0;
|
|
|
|
|
2007-08-19 18:47:19 +00:00
|
|
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
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);
|
|
|
|
|
2007-08-19 18:47:19 +00:00
|
|
|
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
|
|
|
|
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 */
|
2007-08-19 18:47:19 +00:00
|
|
|
GST_START_TEST (test_type1_32_br_11025hz)
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
{
|
|
|
|
GstElement *audiochebyshevfreqband;
|
|
|
|
GstBuffer *inbuffer, *outbuffer;
|
|
|
|
GstCaps *caps;
|
2007-08-19 18:47:19 +00:00
|
|
|
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;
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
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);
|
|
|
|
|
2007-08-19 18:47:19 +00:00
|
|
|
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);
|
|
|
|
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2007-08-19 18:47:19 +00:00
|
|
|
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/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
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
|
2007-08-19 18:47:19 +00:00
|
|
|
* at 0 is preserved with bandreject mode and a
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
* 2000Hz frequency band around rate/4 */
|
2007-08-19 18:47:19 +00:00
|
|
|
GST_START_TEST (test_type1_64_br_0hz)
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
2007-08-19 18:47:19 +00:00
|
|
|
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);
|
|
|
|
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2007-08-19 18:47:19 +00:00
|
|
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
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);
|
2007-08-19 18:47:19 +00:00
|
|
|
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);
|
gst/audiofx/: Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebyshevfreqband.c:
(gst_audio_chebyshev_freq_band_mode_get_type),
(gst_audio_chebyshev_freq_band_base_init),
(gst_audio_chebyshev_freq_band_dispose),
(gst_audio_chebyshev_freq_band_class_init),
(gst_audio_chebyshev_freq_band_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_band_set_property),
(gst_audio_chebyshev_freq_band_get_property),
(gst_audio_chebyshev_freq_band_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_band_transform_ip),
(gst_audio_chebyshev_freq_band_start):
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
(gst_audio_chebyshev_freq_limit_mode_get_type),
(gst_audio_chebyshev_freq_limit_base_init),
(gst_audio_chebyshev_freq_limit_dispose),
(gst_audio_chebyshev_freq_limit_class_init),
(gst_audio_chebyshev_freq_limit_init),
(generate_biquad_coefficients), (calculate_gain),
(generate_coefficients),
(gst_audio_chebyshev_freq_limit_set_property),
(gst_audio_chebyshev_freq_limit_get_property),
(gst_audio_chebyshev_freq_limit_setup), (process), (process_64),
(process_32), (gst_audio_chebyshev_freq_limit_transform_ip),
(gst_audio_chebyshev_freq_limit_start):
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c: (plugin_init):
Add Chebyshev lowpass/highpass and bandpass/bandreject elements.
Fixes #464800.
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebyshevfreqband.c:
(setup_audiochebyshevfreqband), (cleanup_audiochebyshevfreqband),
(GST_START_TEST), (audiochebyshevfreqband_suite), (main):
* tests/check/elements/audiochebyshevfreqlimit.c:
(setup_audiochebyshevfreqlimit), (cleanup_audiochebyshevfreqlimit),
(GST_START_TEST), (audiochebyshevfreqlimit_suite), (main):
Add unit tests for the chebyshev filters.
* 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-1394.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-shout2send.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
And add docs for the chebyshev filters. While doing
that also run make update in docs/plugins.
2007-08-16 17:02:07 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|