mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
tests: audiochebband: port to 0.11
This commit is contained in:
parent
d40e915449
commit
ad095ae316
1 changed files with 169 additions and 96 deletions
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/base/gstbasetransform.h>
|
#include <gst/base/gstbasetransform.h>
|
||||||
|
#include <gst/audio/audio.h>
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
@ -32,35 +33,35 @@
|
||||||
GstPad *mysrcpad, *mysinkpad;
|
GstPad *mysrcpad, *mysinkpad;
|
||||||
|
|
||||||
#define BUFFER_CAPS_STRING_32 \
|
#define BUFFER_CAPS_STRING_32 \
|
||||||
"audio/x-raw-float, " \
|
"audio/x-raw, " \
|
||||||
"channels = (int) 1, " \
|
"channels = (int) 1, " \
|
||||||
"rate = (int) 44100, " \
|
"rate = (int) 44100, " \
|
||||||
"endianness = (int) BYTE_ORDER, " \
|
"format = (string) " GST_AUDIO_NE(F32)
|
||||||
"width = (int) 32" \
|
|
||||||
|
|
||||||
#define BUFFER_CAPS_STRING_64 \
|
#define BUFFER_CAPS_STRING_64 \
|
||||||
"audio/x-raw-float, " \
|
"audio/x-raw, " \
|
||||||
"channels = (int) 1, " \
|
"channels = (int) 1, " \
|
||||||
"rate = (int) 44100, " \
|
"rate = (int) 44100, " \
|
||||||
"endianness = (int) BYTE_ORDER, " \
|
"format = (string) " GST_AUDIO_NE(F64)
|
||||||
"width = (int) 64" \
|
|
||||||
|
|
||||||
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS ("audio/x-raw-float, "
|
GST_STATIC_CAPS ("audio/x-raw, "
|
||||||
"channels = (int) 1, "
|
"channels = (int) 1, "
|
||||||
"rate = (int) 44100, "
|
"rate = (int) 44100, "
|
||||||
"endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 }")
|
"format = (string) { "
|
||||||
);
|
GST_AUDIO_NE(F32) ", "
|
||||||
|
GST_AUDIO_NE(F64) " }"));
|
||||||
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS ("audio/x-raw-float, "
|
GST_STATIC_CAPS ("audio/x-raw, "
|
||||||
"channels = (int) 1, "
|
"channels = (int) 1, "
|
||||||
"rate = (int) 44100, "
|
"rate = (int) 44100, "
|
||||||
"endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 }")
|
"format = (string) { "
|
||||||
);
|
GST_AUDIO_NE(F32) ", "
|
||||||
|
GST_AUDIO_NE(F64) " }"));
|
||||||
|
|
||||||
static GstElement *
|
static GstElement *
|
||||||
setup_audiochebband (void)
|
setup_audiochebband (void)
|
||||||
|
@ -119,13 +120,14 @@ GST_START_TEST (test_type1_32_bp_0hz)
|
||||||
44100 / 4.0 - 1000, NULL);
|
44100 / 4.0 - 1000, NULL);
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
|
inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
|
||||||
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
in[i] = 1.0;
|
in[i] = 1.0;
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -135,7 +137,7 @@ GST_START_TEST (test_type1_32_bp_0hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -143,6 +145,8 @@ GST_START_TEST (test_type1_32_bp_0hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms <= 0.1);
|
fail_unless (rms <= 0.1);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -175,17 +179,18 @@ GST_START_TEST (test_type1_32_bp_11025hz)
|
||||||
44100 / 4.0 - 1000, NULL);
|
44100 / 4.0 - 1000, NULL);
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
|
inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
|
||||||
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i += 4) {
|
for (i = 0; i < 1024; i += 4) {
|
||||||
in[i] = 0.0;
|
in[i] = 0.0;
|
||||||
in[i + 1] = 1.0;
|
in[i + 1] = 1.0;
|
||||||
in[i + 2] = 0.0;
|
in[i + 2] = 0.0;
|
||||||
in[i + 3] = -1.0;
|
in[i + 3] = -1.0;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -195,7 +200,7 @@ GST_START_TEST (test_type1_32_bp_11025hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -203,6 +208,8 @@ GST_START_TEST (test_type1_32_bp_11025hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms >= 0.6);
|
fail_unless (rms >= 0.6);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -235,15 +242,16 @@ GST_START_TEST (test_type1_32_bp_22050hz)
|
||||||
44100 / 4.0 - 1000, NULL);
|
44100 / 4.0 - 1000, NULL);
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
|
inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
|
||||||
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i += 2) {
|
for (i = 0; i < 1024; i += 2) {
|
||||||
in[i] = 1.0;
|
in[i] = 1.0;
|
||||||
in[i + 1] = -1.0;
|
in[i + 1] = -1.0;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -253,7 +261,7 @@ GST_START_TEST (test_type1_32_bp_22050hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -261,6 +269,8 @@ GST_START_TEST (test_type1_32_bp_22050hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms <= 0.1);
|
fail_unless (rms <= 0.1);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -293,13 +303,14 @@ GST_START_TEST (test_type1_32_br_0hz)
|
||||||
44100 / 4.0 - 1000, NULL);
|
44100 / 4.0 - 1000, NULL);
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
|
inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
|
||||||
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
in[i] = 1.0;
|
in[i] = 1.0;
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -309,7 +320,7 @@ GST_START_TEST (test_type1_32_br_0hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -317,6 +328,8 @@ GST_START_TEST (test_type1_32_br_0hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms >= 0.9);
|
fail_unless (rms >= 0.9);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -349,17 +362,18 @@ GST_START_TEST (test_type1_32_br_11025hz)
|
||||||
44100 / 4.0 - 1000, NULL);
|
44100 / 4.0 - 1000, NULL);
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
|
inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
|
||||||
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i += 4) {
|
for (i = 0; i < 1024; i += 4) {
|
||||||
in[i] = 0.0;
|
in[i] = 0.0;
|
||||||
in[i + 1] = 1.0;
|
in[i + 1] = 1.0;
|
||||||
in[i + 2] = 0.0;
|
in[i + 2] = 0.0;
|
||||||
in[i + 3] = -1.0;
|
in[i + 3] = -1.0;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -369,7 +383,7 @@ GST_START_TEST (test_type1_32_br_11025hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -377,6 +391,8 @@ GST_START_TEST (test_type1_32_br_11025hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms <= 0.1);
|
fail_unless (rms <= 0.1);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -409,15 +425,16 @@ GST_START_TEST (test_type1_32_br_22050hz)
|
||||||
44100 / 4.0 - 1000, NULL);
|
44100 / 4.0 - 1000, NULL);
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
|
inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
|
||||||
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i += 2) {
|
for (i = 0; i < 1024; i += 2) {
|
||||||
in[i] = 1.0;
|
in[i] = 1.0;
|
||||||
in[i + 1] = -1.0;
|
in[i + 1] = -1.0;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -427,7 +444,7 @@ GST_START_TEST (test_type1_32_br_22050hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -435,6 +452,8 @@ GST_START_TEST (test_type1_32_br_22050hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms >= 0.9);
|
fail_unless (rms >= 0.9);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -468,12 +487,13 @@ GST_START_TEST (test_type1_64_bp_0hz)
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
in[i] = 1.0;
|
in[i] = 1.0;
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -483,7 +503,7 @@ GST_START_TEST (test_type1_64_bp_0hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -491,6 +511,8 @@ GST_START_TEST (test_type1_64_bp_0hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms <= 0.1);
|
fail_unless (rms <= 0.1);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -524,16 +546,17 @@ GST_START_TEST (test_type1_64_bp_11025hz)
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i += 4) {
|
for (i = 0; i < 1024; i += 4) {
|
||||||
in[i] = 0.0;
|
in[i] = 0.0;
|
||||||
in[i + 1] = 1.0;
|
in[i + 1] = 1.0;
|
||||||
in[i + 2] = 0.0;
|
in[i + 2] = 0.0;
|
||||||
in[i + 3] = -1.0;
|
in[i + 3] = -1.0;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -543,7 +566,7 @@ GST_START_TEST (test_type1_64_bp_11025hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -551,6 +574,8 @@ GST_START_TEST (test_type1_64_bp_11025hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms >= 0.6);
|
fail_unless (rms >= 0.6);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -584,14 +609,15 @@ GST_START_TEST (test_type1_64_bp_22050hz)
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i += 2) {
|
for (i = 0; i < 1024; i += 2) {
|
||||||
in[i] = 1.0;
|
in[i] = 1.0;
|
||||||
in[i + 1] = -1.0;
|
in[i + 1] = -1.0;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -601,7 +627,7 @@ GST_START_TEST (test_type1_64_bp_22050hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -609,6 +635,8 @@ GST_START_TEST (test_type1_64_bp_22050hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms <= 0.1);
|
fail_unless (rms <= 0.1);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -642,12 +670,13 @@ GST_START_TEST (test_type1_64_br_0hz)
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
in[i] = 1.0;
|
in[i] = 1.0;
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -657,7 +686,7 @@ GST_START_TEST (test_type1_64_br_0hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -665,6 +694,8 @@ GST_START_TEST (test_type1_64_br_0hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms >= 0.9);
|
fail_unless (rms >= 0.9);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -698,16 +729,17 @@ GST_START_TEST (test_type1_64_br_11025hz)
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i += 4) {
|
for (i = 0; i < 1024; i += 4) {
|
||||||
in[i] = 0.0;
|
in[i] = 0.0;
|
||||||
in[i + 1] = 1.0;
|
in[i + 1] = 1.0;
|
||||||
in[i + 2] = 0.0;
|
in[i + 2] = 0.0;
|
||||||
in[i + 3] = -1.0;
|
in[i + 3] = -1.0;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -717,7 +749,7 @@ GST_START_TEST (test_type1_64_br_11025hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -725,6 +757,8 @@ GST_START_TEST (test_type1_64_br_11025hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms <= 0.1);
|
fail_unless (rms <= 0.1);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -758,14 +792,15 @@ GST_START_TEST (test_type1_64_br_22050hz)
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i += 2) {
|
for (i = 0; i < 1024; i += 2) {
|
||||||
in[i] = 1.0;
|
in[i] = 1.0;
|
||||||
in[i + 1] = -1.0;
|
in[i + 1] = -1.0;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -775,7 +810,7 @@ GST_START_TEST (test_type1_64_br_22050hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -783,6 +818,8 @@ GST_START_TEST (test_type1_64_br_22050hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms >= 0.9);
|
fail_unless (rms >= 0.9);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -815,13 +852,14 @@ GST_START_TEST (test_type2_32_bp_0hz)
|
||||||
44100 / 4.0 - 1000, NULL);
|
44100 / 4.0 - 1000, NULL);
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
|
inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
|
||||||
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
in[i] = 1.0;
|
in[i] = 1.0;
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -831,7 +869,7 @@ GST_START_TEST (test_type2_32_bp_0hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -839,6 +877,8 @@ GST_START_TEST (test_type2_32_bp_0hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms <= 0.1);
|
fail_unless (rms <= 0.1);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -871,17 +911,18 @@ GST_START_TEST (test_type2_32_bp_11025hz)
|
||||||
44100 / 4.0 - 1000, NULL);
|
44100 / 4.0 - 1000, NULL);
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
|
inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
|
||||||
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i += 4) {
|
for (i = 0; i < 1024; i += 4) {
|
||||||
in[i] = 0.0;
|
in[i] = 0.0;
|
||||||
in[i + 1] = 1.0;
|
in[i + 1] = 1.0;
|
||||||
in[i + 2] = 0.0;
|
in[i + 2] = 0.0;
|
||||||
in[i + 3] = -1.0;
|
in[i + 3] = -1.0;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -891,7 +932,7 @@ GST_START_TEST (test_type2_32_bp_11025hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -899,6 +940,8 @@ GST_START_TEST (test_type2_32_bp_11025hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms >= 0.6);
|
fail_unless (rms >= 0.6);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -931,15 +974,16 @@ GST_START_TEST (test_type2_32_bp_22050hz)
|
||||||
44100 / 4.0 - 1000, NULL);
|
44100 / 4.0 - 1000, NULL);
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
|
inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
|
||||||
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i += 2) {
|
for (i = 0; i < 1024; i += 2) {
|
||||||
in[i] = 1.0;
|
in[i] = 1.0;
|
||||||
in[i + 1] = -1.0;
|
in[i + 1] = -1.0;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -949,7 +993,7 @@ GST_START_TEST (test_type2_32_bp_22050hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -957,6 +1001,8 @@ GST_START_TEST (test_type2_32_bp_22050hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms <= 0.1);
|
fail_unless (rms <= 0.1);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -989,13 +1035,14 @@ GST_START_TEST (test_type2_32_br_0hz)
|
||||||
44100 / 4.0 - 1000, NULL);
|
44100 / 4.0 - 1000, NULL);
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
|
inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
|
||||||
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
in[i] = 1.0;
|
in[i] = 1.0;
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -1005,7 +1052,7 @@ GST_START_TEST (test_type2_32_br_0hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -1013,6 +1060,8 @@ GST_START_TEST (test_type2_32_br_0hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms >= 0.9);
|
fail_unless (rms >= 0.9);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -1045,17 +1094,18 @@ GST_START_TEST (test_type2_32_br_11025hz)
|
||||||
44100 / 4.0 - 1000, NULL);
|
44100 / 4.0 - 1000, NULL);
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
|
inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
|
||||||
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i += 4) {
|
for (i = 0; i < 1024; i += 4) {
|
||||||
in[i] = 0.0;
|
in[i] = 0.0;
|
||||||
in[i + 1] = 1.0;
|
in[i + 1] = 1.0;
|
||||||
in[i + 2] = 0.0;
|
in[i + 2] = 0.0;
|
||||||
in[i + 3] = -1.0;
|
in[i + 3] = -1.0;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -1065,7 +1115,7 @@ GST_START_TEST (test_type2_32_br_11025hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -1073,6 +1123,8 @@ GST_START_TEST (test_type2_32_br_11025hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms <= 0.1);
|
fail_unless (rms <= 0.1);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -1105,15 +1157,16 @@ GST_START_TEST (test_type2_32_br_22050hz)
|
||||||
44100 / 4.0 - 1000, NULL);
|
44100 / 4.0 - 1000, NULL);
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
|
inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
|
||||||
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i += 2) {
|
for (i = 0; i < 1024; i += 2) {
|
||||||
in[i] = 1.0;
|
in[i] = 1.0;
|
||||||
in[i + 1] = -1.0;
|
in[i + 1] = -1.0;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -1123,7 +1176,7 @@ GST_START_TEST (test_type2_32_br_22050hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -1131,6 +1184,8 @@ GST_START_TEST (test_type2_32_br_22050hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms >= 0.9);
|
fail_unless (rms >= 0.9);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -1164,12 +1219,13 @@ GST_START_TEST (test_type2_64_bp_0hz)
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
in[i] = 1.0;
|
in[i] = 1.0;
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -1179,7 +1235,7 @@ GST_START_TEST (test_type2_64_bp_0hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -1187,6 +1243,8 @@ GST_START_TEST (test_type2_64_bp_0hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms <= 0.1);
|
fail_unless (rms <= 0.1);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -1220,16 +1278,17 @@ GST_START_TEST (test_type2_64_bp_11025hz)
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i += 4) {
|
for (i = 0; i < 1024; i += 4) {
|
||||||
in[i] = 0.0;
|
in[i] = 0.0;
|
||||||
in[i + 1] = 1.0;
|
in[i + 1] = 1.0;
|
||||||
in[i + 2] = 0.0;
|
in[i + 2] = 0.0;
|
||||||
in[i + 3] = -1.0;
|
in[i + 3] = -1.0;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -1239,7 +1298,7 @@ GST_START_TEST (test_type2_64_bp_11025hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -1247,6 +1306,8 @@ GST_START_TEST (test_type2_64_bp_11025hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms >= 0.6);
|
fail_unless (rms >= 0.6);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -1280,14 +1341,15 @@ GST_START_TEST (test_type2_64_bp_22050hz)
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i += 2) {
|
for (i = 0; i < 1024; i += 2) {
|
||||||
in[i] = 1.0;
|
in[i] = 1.0;
|
||||||
in[i + 1] = -1.0;
|
in[i + 1] = -1.0;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -1297,7 +1359,7 @@ GST_START_TEST (test_type2_64_bp_22050hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -1305,6 +1367,8 @@ GST_START_TEST (test_type2_64_bp_22050hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms <= 0.1);
|
fail_unless (rms <= 0.1);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -1338,12 +1402,13 @@ GST_START_TEST (test_type2_64_br_0hz)
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
in[i] = 1.0;
|
in[i] = 1.0;
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -1353,7 +1418,7 @@ GST_START_TEST (test_type2_64_br_0hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -1361,6 +1426,8 @@ GST_START_TEST (test_type2_64_br_0hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms >= 0.9);
|
fail_unless (rms >= 0.9);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -1394,16 +1461,17 @@ GST_START_TEST (test_type2_64_br_11025hz)
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i += 4) {
|
for (i = 0; i < 1024; i += 4) {
|
||||||
in[i] = 0.0;
|
in[i] = 0.0;
|
||||||
in[i + 1] = 1.0;
|
in[i + 1] = 1.0;
|
||||||
in[i + 2] = 0.0;
|
in[i + 2] = 0.0;
|
||||||
in[i + 3] = -1.0;
|
in[i + 3] = -1.0;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -1413,7 +1481,7 @@ GST_START_TEST (test_type2_64_br_11025hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -1421,6 +1489,8 @@ GST_START_TEST (test_type2_64_br_11025hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms <= 0.1);
|
fail_unless (rms <= 0.1);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
@ -1454,14 +1524,15 @@ GST_START_TEST (test_type2_64_br_22050hz)
|
||||||
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
|
||||||
44100 / 4.0 + 1000, NULL);
|
44100 / 4.0 + 1000, NULL);
|
||||||
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
|
||||||
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
|
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
|
||||||
for (i = 0; i < 1024; i += 2) {
|
for (i = 0; i < 1024; i += 2) {
|
||||||
in[i] = 1.0;
|
in[i] = 1.0;
|
||||||
in[i + 1] = -1.0;
|
in[i + 1] = -1.0;
|
||||||
}
|
}
|
||||||
|
gst_buffer_unmap (inbuffer, in, -1);
|
||||||
|
|
||||||
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -1471,7 +1542,7 @@ GST_START_TEST (test_type2_64_br_22050hz)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
|
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
rms = 0.0;
|
rms = 0.0;
|
||||||
for (i = 0; i < 1024; i++)
|
for (i = 0; i < 1024; i++)
|
||||||
|
@ -1479,6 +1550,8 @@ GST_START_TEST (test_type2_64_br_22050hz)
|
||||||
rms = sqrt (rms / 1024.0);
|
rms = sqrt (rms / 1024.0);
|
||||||
fail_unless (rms >= 0.9);
|
fail_unless (rms >= 0.9);
|
||||||
|
|
||||||
|
gst_buffer_unmap (outbuffer, res, -1);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_audiochebband (audiochebband);
|
cleanup_audiochebband (audiochebband);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue