1 /* GStreamer
2 *
3 * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
4 *
5 * audiowsincband.c: Unit test for the audiowsincband element
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23 #include <gst/gst.h>
24 #include <gst/audio/audio.h>
25 #include <gst/base/gstbasetransform.h>
26 #include <gst/check/gstcheck.h>
27
28 #include <math.h>
29
30 /* For ease of programming we use globals to keep refs for our floating
31 * src and sink pads we create; otherwise we always have to do get_pad,
32 * get_peer, and then remove references in every test function */
33 GstPad *mysrcpad, *mysinkpad;
34
35 #define AUDIO_WSINC_BAND_CAPS_STRING_32 \
36 "audio/x-raw, " \
37 "format = (string) " GST_AUDIO_NE (F32) ", " \
38 "layout = (string) interleaved, " \
39 "channels = (int) 1, " \
40 "rate = (int) 44100"
41
42 #define AUDIO_WSINC_BAND_CAPS_STRING_64 \
43 "audio/x-raw, " \
44 "format = (string) " GST_AUDIO_NE (F64) ", " \
45 "layout = (string) interleaved, " \
46 "channels = (int) 1, " \
47 "rate = (int) 44100"
48
49 #define FORMATS "{ "GST_AUDIO_NE (F32)","GST_AUDIO_NE (F64)" }"
50
51 static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
52 GST_PAD_SINK,
53 GST_PAD_ALWAYS,
54 GST_STATIC_CAPS ("audio/x-raw, "
55 "format = (string) " FORMATS ", "
56 "layout = (string) interleaved, "
57 "channels = (int) 1, " "rate = (int) 44100")
58 );
59 static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
60 GST_PAD_SRC,
61 GST_PAD_ALWAYS,
62 GST_STATIC_CAPS ("audio/x-raw, "
63 "format = (string) " FORMATS ", "
64 "layout = (string) interleaved, "
65 "channels = (int) 1, " "rate = (int) 44100")
66 );
67
68 static GstElement *
setup_audiowsincband(void)69 setup_audiowsincband (void)
70 {
71 GstElement *audiowsincband;
72
73 GST_DEBUG ("setup_audiowsincband");
74 audiowsincband = gst_check_setup_element ("audiowsincband");
75 mysrcpad = gst_check_setup_src_pad (audiowsincband, &srctemplate);
76 mysinkpad = gst_check_setup_sink_pad (audiowsincband, &sinktemplate);
77 gst_pad_set_active (mysrcpad, TRUE);
78 gst_pad_set_active (mysinkpad, TRUE);
79
80 return audiowsincband;
81 }
82
83 static void
cleanup_audiowsincband(GstElement * audiowsincband)84 cleanup_audiowsincband (GstElement * audiowsincband)
85 {
86 GST_DEBUG ("cleanup_audiowsincband");
87
88 g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
89 g_list_free (buffers);
90 buffers = NULL;
91
92 gst_pad_set_active (mysrcpad, FALSE);
93 gst_pad_set_active (mysinkpad, FALSE);
94 gst_check_teardown_src_pad (audiowsincband);
95 gst_check_teardown_sink_pad (audiowsincband);
96 gst_check_teardown_element (audiowsincband);
97 }
98
99 /* Test if data containing only one frequency component
100 * at rate/2 is erased with bandpass mode and a
101 * 2000Hz frequency band around rate/4 */
GST_START_TEST(test_32_bp_0hz)102 GST_START_TEST (test_32_bp_0hz)
103 {
104 GstElement *audiowsincband;
105 GstBuffer *inbuffer, *outbuffer;
106 GstCaps *caps;
107 gfloat *in, *res, rms;
108 gint i;
109 GstMapInfo map;
110 GList *node;
111 GstSegment segment;
112
113 audiowsincband = setup_audiowsincband ();
114 /* Set to bandpass */
115 g_object_set (G_OBJECT (audiowsincband), "mode", 0, NULL);
116 g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL);
117
118 fail_unless (gst_element_set_state (audiowsincband,
119 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
120 "could not set to playing");
121
122 g_object_set (G_OBJECT (audiowsincband), "lower-frequency",
123 44100 / 4.0 - 1000, NULL);
124 g_object_set (G_OBJECT (audiowsincband), "upper-frequency",
125 44100 / 4.0 + 1000, NULL);
126 inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
127 GST_BUFFER_TIMESTAMP (inbuffer) = 0;
128
129 gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
130 in = (gfloat *) map.data;
131 for (i = 0; i < 1024; i++)
132 in[i] = 1.0;
133 gst_buffer_unmap (inbuffer, &map);
134
135 caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
136 gst_check_setup_events (mysrcpad, audiowsincband, caps, GST_FORMAT_TIME);
137 gst_caps_unref (caps);
138 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
139
140 /* ensure segment (format) properly setup */
141 gst_segment_init (&segment, GST_FORMAT_TIME);
142 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
143
144 /* pushing gives away my reference ... */
145 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
146 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
147 /* ... and puts a new buffer on the global list */
148 fail_unless (g_list_length (buffers) >= 1);
149
150 for (node = buffers; node; node = node->next) {
151 gint buffer_length;
152
153 fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
154
155 gst_buffer_map (outbuffer, &map, GST_MAP_READ);
156 res = (gfloat *) map.data;
157 buffer_length = map.size / sizeof (gfloat);
158
159 rms = 0.0;
160 for (i = 0; i < buffer_length; i++)
161 rms += res[i] * res[i];
162 rms = sqrt (rms / buffer_length);
163 fail_unless (rms <= 0.1);
164
165 gst_buffer_unmap (outbuffer, &map);
166 }
167
168 /* cleanup */
169 cleanup_audiowsincband (audiowsincband);
170 }
171
172 GST_END_TEST;
173
174 /* Test if data containing only one frequency component
175 * at the band center is preserved with bandreject mode
176 * and a 2000Hz frequency band around rate/4 */
GST_START_TEST(test_32_bp_11025hz)177 GST_START_TEST (test_32_bp_11025hz)
178 {
179 GstElement *audiowsincband;
180 GstBuffer *inbuffer, *outbuffer;
181 GstCaps *caps;
182 gfloat *in, *res, rms;
183 gint i;
184 GstMapInfo map;
185 GList *node;
186 GstSegment segment;
187
188 audiowsincband = setup_audiowsincband ();
189 /* Set to bandpass */
190 g_object_set (G_OBJECT (audiowsincband), "mode", 0, NULL);
191 g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL);
192
193 fail_unless (gst_element_set_state (audiowsincband,
194 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
195 "could not set to playing");
196
197 g_object_set (G_OBJECT (audiowsincband), "lower-frequency",
198 44100 / 4.0 - 1000, NULL);
199 g_object_set (G_OBJECT (audiowsincband), "upper-frequency",
200 44100 / 4.0 + 1000, NULL);
201 inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
202 GST_BUFFER_TIMESTAMP (inbuffer) = 0;
203 gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
204 in = (gfloat *) map.data;
205 for (i = 0; i < 1024; i += 4) {
206 in[i] = 0.0;
207 in[i + 1] = 1.0;
208 in[i + 2] = 0.0;
209 in[i + 3] = -1.0;
210 }
211 gst_buffer_unmap (inbuffer, &map);
212
213 caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
214 gst_check_setup_events (mysrcpad, audiowsincband, caps, GST_FORMAT_TIME);
215 gst_caps_unref (caps);
216 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
217
218 /* ensure segment (format) properly setup */
219 gst_segment_init (&segment, GST_FORMAT_TIME);
220 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
221
222 /* pushing gives away my reference ... */
223 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
224 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
225 /* ... and puts a new buffer on the global list */
226 fail_unless (g_list_length (buffers) >= 1);
227
228 for (node = buffers; node; node = node->next) {
229 gint buffer_length;
230
231 fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
232
233 gst_buffer_map (outbuffer, &map, GST_MAP_READ);
234 res = (gfloat *) map.data;
235 buffer_length = map.size / sizeof (gfloat);
236 rms = 0.0;
237 for (i = 0; i < buffer_length; i++)
238 rms += res[i] * res[i];
239 rms = sqrt (rms / buffer_length);
240 fail_unless (rms >= 0.4);
241 gst_buffer_unmap (outbuffer, &map);
242 }
243
244 /* cleanup */
245 cleanup_audiowsincband (audiowsincband);
246 }
247
248 GST_END_TEST;
249
250
251 /* Test if data containing only one frequency component
252 * at rate/2 is erased with bandreject mode and a
253 * 2000Hz frequency band around rate/4 */
GST_START_TEST(test_32_bp_22050hz)254 GST_START_TEST (test_32_bp_22050hz)
255 {
256 GstElement *audiowsincband;
257 GstBuffer *inbuffer, *outbuffer;
258 GstCaps *caps;
259 gfloat *in, *res, rms;
260 gint i;
261 GstMapInfo map;
262 GList *node;
263 GstSegment segment;
264
265 audiowsincband = setup_audiowsincband ();
266 /* Set to bandpass */
267 g_object_set (G_OBJECT (audiowsincband), "mode", 0, NULL);
268 g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL);
269
270 fail_unless (gst_element_set_state (audiowsincband,
271 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
272 "could not set to playing");
273
274 g_object_set (G_OBJECT (audiowsincband), "lower-frequency",
275 44100 / 4.0 - 1000, NULL);
276 g_object_set (G_OBJECT (audiowsincband), "upper-frequency",
277 44100 / 4.0 + 1000, NULL);
278 inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
279 GST_BUFFER_TIMESTAMP (inbuffer) = 0;
280 gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
281 in = (gfloat *) map.data;
282 for (i = 0; i < 1024; i += 2) {
283 in[i] = 1.0;
284 in[i + 1] = -1.0;
285 }
286 gst_buffer_unmap (inbuffer, &map);
287
288 caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
289 gst_check_setup_events (mysrcpad, audiowsincband, caps, GST_FORMAT_TIME);
290 gst_caps_unref (caps);
291 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
292
293 /* ensure segment (format) properly setup */
294 gst_segment_init (&segment, GST_FORMAT_TIME);
295 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
296
297 /* pushing gives away my reference ... */
298 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
299 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
300 /* ... and puts a new buffer on the global list */
301 fail_unless (g_list_length (buffers) >= 1);
302
303 for (node = buffers; node; node = node->next) {
304 gint buffer_length;
305
306 fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
307
308 gst_buffer_map (outbuffer, &map, GST_MAP_READ);
309 res = (gfloat *) map.data;
310 buffer_length = map.size / sizeof (gfloat);
311 rms = 0.0;
312 for (i = 0; i < buffer_length; i++)
313 rms += res[i] * res[i];
314 rms = sqrt (rms / buffer_length);
315 fail_unless (rms <= 0.3);
316 gst_buffer_unmap (outbuffer, &map);
317 }
318
319 /* cleanup */
320 cleanup_audiowsincband (audiowsincband);
321 }
322
323 GST_END_TEST;
324
325 /* Test if data containing only one frequency component
326 * at rate/2 is preserved with bandreject mode and a
327 * 2000Hz frequency band around rate/4 */
GST_START_TEST(test_32_br_0hz)328 GST_START_TEST (test_32_br_0hz)
329 {
330 GstElement *audiowsincband;
331 GstBuffer *inbuffer, *outbuffer;
332 GstCaps *caps;
333 gfloat *in, *res, rms;
334 gint i;
335 GstMapInfo map;
336 GList *node;
337 GstSegment segment;
338
339 audiowsincband = setup_audiowsincband ();
340 /* Set to bandreject */
341 g_object_set (G_OBJECT (audiowsincband), "mode", 1, NULL);
342 g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL);
343
344 fail_unless (gst_element_set_state (audiowsincband,
345 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
346 "could not set to playing");
347
348 g_object_set (G_OBJECT (audiowsincband), "lower-frequency",
349 44100 / 4.0 - 1000, NULL);
350 g_object_set (G_OBJECT (audiowsincband), "upper-frequency",
351 44100 / 4.0 + 1000, NULL);
352 inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
353 GST_BUFFER_TIMESTAMP (inbuffer) = 0;
354 gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
355 in = (gfloat *) map.data;
356 for (i = 0; i < 1024; i++)
357 in[i] = 1.0;
358 gst_buffer_unmap (inbuffer, &map);
359
360 caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
361 gst_check_setup_events (mysrcpad, audiowsincband, caps, GST_FORMAT_TIME);
362 gst_caps_unref (caps);
363 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
364
365 /* ensure segment (format) properly setup */
366 gst_segment_init (&segment, GST_FORMAT_TIME);
367 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
368
369 /* pushing gives away my reference ... */
370 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
371 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
372 /* ... and puts a new buffer on the global list */
373 fail_unless (g_list_length (buffers) >= 1);
374
375 for (node = buffers; node; node = node->next) {
376 gint buffer_length;
377
378 fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
379
380 gst_buffer_map (outbuffer, &map, GST_MAP_READ);
381 res = (gfloat *) map.data;
382 buffer_length = map.size / sizeof (gfloat);
383 rms = 0.0;
384 for (i = 0; i < buffer_length; i++)
385 rms += res[i] * res[i];
386 rms = sqrt (rms / buffer_length);
387 fail_unless (rms >= 0.9);
388 gst_buffer_unmap (outbuffer, &map);
389 }
390
391 /* cleanup */
392 cleanup_audiowsincband (audiowsincband);
393 }
394
395 GST_END_TEST;
396
397 /* Test if data containing only one frequency component
398 * at the band center is erased with bandreject mode
399 * and a 2000Hz frequency band around rate/4 */
GST_START_TEST(test_32_br_11025hz)400 GST_START_TEST (test_32_br_11025hz)
401 {
402 GstElement *audiowsincband;
403 GstBuffer *inbuffer, *outbuffer;
404 GstCaps *caps;
405 gfloat *in, *res, rms;
406 gint i;
407 GstMapInfo map;
408 GList *node;
409 GstSegment segment;
410
411 audiowsincband = setup_audiowsincband ();
412 /* Set to bandreject */
413 g_object_set (G_OBJECT (audiowsincband), "mode", 1, NULL);
414 g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL);
415
416 fail_unless (gst_element_set_state (audiowsincband,
417 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
418 "could not set to playing");
419
420 g_object_set (G_OBJECT (audiowsincband), "lower-frequency",
421 44100 / 4.0 - 1000, NULL);
422 g_object_set (G_OBJECT (audiowsincband), "upper-frequency",
423 44100 / 4.0 + 1000, NULL);
424 inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
425 GST_BUFFER_TIMESTAMP (inbuffer) = 0;
426 gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
427 in = (gfloat *) map.data;
428
429 for (i = 0; i < 1024; i += 4) {
430 in[i] = 0.0;
431 in[i + 1] = 1.0;
432 in[i + 2] = 0.0;
433 in[i + 3] = -1.0;
434 }
435 gst_buffer_unmap (inbuffer, &map);
436
437 caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
438 gst_check_setup_events (mysrcpad, audiowsincband, caps, GST_FORMAT_TIME);
439 gst_caps_unref (caps);
440 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
441
442 /* ensure segment (format) properly setup */
443 gst_segment_init (&segment, GST_FORMAT_TIME);
444 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
445
446 /* pushing gives away my reference ... */
447 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
448 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
449 /* ... and puts a new buffer on the global list */
450 fail_unless (g_list_length (buffers) >= 1);
451
452 for (node = buffers; node; node = node->next) {
453 gint buffer_length;
454
455 fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
456
457 gst_buffer_map (outbuffer, &map, GST_MAP_READ);
458 res = (gfloat *) map.data;
459 buffer_length = map.size / sizeof (gfloat);
460 rms = 0.0;
461 for (i = 0; i < buffer_length; i++)
462 rms += res[i] * res[i];
463 rms = sqrt (rms / buffer_length);
464 fail_unless (rms <= 0.35);
465 gst_buffer_unmap (outbuffer, &map);
466 }
467
468 /* cleanup */
469 cleanup_audiowsincband (audiowsincband);
470 }
471
472 GST_END_TEST;
473
474
475 /* Test if data containing only one frequency component
476 * at rate/2 is preserved with bandreject mode and a
477 * 2000Hz frequency band around rate/4 */
GST_START_TEST(test_32_br_22050hz)478 GST_START_TEST (test_32_br_22050hz)
479 {
480 GstElement *audiowsincband;
481 GstBuffer *inbuffer, *outbuffer;
482 GstCaps *caps;
483 gfloat *in, *res, rms;
484 gint i;
485 GstMapInfo map;
486 GList *node;
487 GstSegment segment;
488
489 audiowsincband = setup_audiowsincband ();
490 /* Set to bandreject */
491 g_object_set (G_OBJECT (audiowsincband), "mode", 1, NULL);
492 g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL);
493
494 fail_unless (gst_element_set_state (audiowsincband,
495 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
496 "could not set to playing");
497
498 g_object_set (G_OBJECT (audiowsincband), "lower-frequency",
499 44100 / 4.0 - 1000, NULL);
500 g_object_set (G_OBJECT (audiowsincband), "upper-frequency",
501 44100 / 4.0 + 1000, NULL);
502 inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
503 GST_BUFFER_TIMESTAMP (inbuffer) = 0;
504 gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
505 in = (gfloat *) map.data;
506 for (i = 0; i < 1024; i += 2) {
507 in[i] = 1.0;
508 in[i + 1] = -1.0;
509 }
510 gst_buffer_unmap (inbuffer, &map);
511
512 caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
513 gst_check_setup_events (mysrcpad, audiowsincband, caps, GST_FORMAT_TIME);
514 gst_caps_unref (caps);
515 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
516
517 /* ensure segment (format) properly setup */
518 gst_segment_init (&segment, GST_FORMAT_TIME);
519 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
520
521 /* pushing gives away my reference ... */
522 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
523 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
524 /* ... and puts a new buffer on the global list */
525 fail_unless (g_list_length (buffers) >= 1);
526
527 for (node = buffers; node; node = node->next) {
528 gint buffer_length;
529
530 fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
531
532 gst_buffer_map (outbuffer, &map, GST_MAP_READ);
533 res = (gfloat *) map.data;
534 buffer_length = map.size / sizeof (gfloat);
535 rms = 0.0;
536 for (i = 0; i < buffer_length; i++)
537 rms += res[i] * res[i];
538 rms = sqrt (rms / buffer_length);
539 fail_unless (rms >= 0.9);
540 gst_buffer_unmap (outbuffer, &map);
541 }
542
543 /* cleanup */
544 cleanup_audiowsincband (audiowsincband);
545 }
546
547 GST_END_TEST;
548
549 /* Test if buffers smaller than the kernel size are handled
550 * correctly without accessing wrong memory areas */
GST_START_TEST(test_32_small_buffer)551 GST_START_TEST (test_32_small_buffer)
552 {
553 GstElement *audiowsincband;
554 GstBuffer *inbuffer;
555 GstCaps *caps;
556 gfloat *in;
557 gint i;
558 GstMapInfo map;
559 GstSegment segment;
560
561 audiowsincband = setup_audiowsincband ();
562 /* Set to bandpass */
563 g_object_set (G_OBJECT (audiowsincband), "mode", 0, NULL);
564 g_object_set (G_OBJECT (audiowsincband), "length", 101, NULL);
565
566 fail_unless (gst_element_set_state (audiowsincband,
567 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
568 "could not set to playing");
569
570 g_object_set (G_OBJECT (audiowsincband), "lower-frequency",
571 44100 / 4.0 - 44100 / 16.0, NULL);
572 g_object_set (G_OBJECT (audiowsincband), "upper-frequency",
573 44100 / 4.0 + 44100 / 16.0, NULL);
574 inbuffer = gst_buffer_new_and_alloc (20 * sizeof (gfloat));
575 GST_BUFFER_TIMESTAMP (inbuffer) = 0;
576 gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
577 in = (gfloat *) map.data;
578 for (i = 0; i < 20; i++)
579 in[i] = 1.0;
580 gst_buffer_unmap (inbuffer, &map);
581
582 caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
583 gst_check_setup_events (mysrcpad, audiowsincband, caps, GST_FORMAT_TIME);
584 gst_caps_unref (caps);
585 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
586
587 /* ensure segment (format) properly setup */
588 gst_segment_init (&segment, GST_FORMAT_TIME);
589 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
590
591 /* pushing gives away my reference ... */
592 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
593 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
594 /* ... and puts a new buffer on the global list */
595 fail_unless (g_list_length (buffers) >= 1);
596
597 /* cleanup */
598 cleanup_audiowsincband (audiowsincband);
599 }
600
601 GST_END_TEST;
602
603
604
605
606
607
608
609
610
611 /* Test if data containing only one frequency component
612 * at rate/2 is erased with bandpass mode and a
613 * 2000Hz frequency band around rate/4 */
GST_START_TEST(test_64_bp_0hz)614 GST_START_TEST (test_64_bp_0hz)
615 {
616 GstElement *audiowsincband;
617 GstBuffer *inbuffer, *outbuffer;
618 GstCaps *caps;
619 gdouble *in, *res, rms;
620 gint i;
621 GstMapInfo map;
622 GList *node;
623 GstSegment segment;
624
625 audiowsincband = setup_audiowsincband ();
626 /* Set to bandpass */
627 g_object_set (G_OBJECT (audiowsincband), "mode", 0, NULL);
628 g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL);
629
630 fail_unless (gst_element_set_state (audiowsincband,
631 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
632 "could not set to playing");
633
634 g_object_set (G_OBJECT (audiowsincband), "lower-frequency",
635 44100 / 4.0 - 1000, NULL);
636 g_object_set (G_OBJECT (audiowsincband), "upper-frequency",
637 44100 / 4.0 + 1000, NULL);
638 inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
639 GST_BUFFER_TIMESTAMP (inbuffer) = 0;
640 gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
641 in = (gdouble *) map.data;
642 for (i = 0; i < 1024; i++)
643 in[i] = 1.0;
644 gst_buffer_unmap (inbuffer, &map);
645
646 caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
647 gst_check_setup_events (mysrcpad, audiowsincband, caps, GST_FORMAT_TIME);
648 gst_caps_unref (caps);
649 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
650
651 /* ensure segment (format) properly setup */
652 gst_segment_init (&segment, GST_FORMAT_TIME);
653 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
654
655 /* pushing gives away my reference ... */
656 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
657 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
658 /* ... and puts a new buffer on the global list */
659 fail_unless (g_list_length (buffers) >= 1);
660
661 for (node = buffers; node; node = node->next) {
662 gint buffer_length;
663
664 fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
665
666 gst_buffer_map (outbuffer, &map, GST_MAP_READ);
667 res = (gdouble *) map.data;
668 buffer_length = map.size / sizeof (gdouble);
669 rms = 0.0;
670 for (i = 0; i < buffer_length; i++)
671 rms += res[i] * res[i];
672 rms = sqrt (rms / buffer_length);
673 fail_unless (rms <= 0.1);
674 gst_buffer_unmap (outbuffer, &map);
675 }
676
677 /* cleanup */
678 cleanup_audiowsincband (audiowsincband);
679 }
680
681 GST_END_TEST;
682
683 /* Test if data containing only one frequency component
684 * at the band center is preserved with bandreject mode
685 * and a 2000Hz frequency band around rate/4 */
GST_START_TEST(test_64_bp_11025hz)686 GST_START_TEST (test_64_bp_11025hz)
687 {
688 GstElement *audiowsincband;
689 GstBuffer *inbuffer, *outbuffer;
690 GstCaps *caps;
691 gdouble *in, *res, rms;
692 gint i;
693 GstMapInfo map;
694 GList *node;
695 GstSegment segment;
696
697 audiowsincband = setup_audiowsincband ();
698 /* Set to bandpass */
699 g_object_set (G_OBJECT (audiowsincband), "mode", 0, NULL);
700 g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL);
701
702 fail_unless (gst_element_set_state (audiowsincband,
703 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
704 "could not set to playing");
705
706 g_object_set (G_OBJECT (audiowsincband), "lower-frequency",
707 44100 / 4.0 - 1000, NULL);
708 g_object_set (G_OBJECT (audiowsincband), "upper-frequency",
709 44100 / 4.0 + 1000, NULL);
710 inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
711 GST_BUFFER_TIMESTAMP (inbuffer) = 0;
712 gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
713 in = (gdouble *) map.data;
714 for (i = 0; i < 1024; i += 4) {
715 in[i] = 0.0;
716 in[i + 1] = 1.0;
717 in[i + 2] = 0.0;
718 in[i + 3] = -1.0;
719 }
720 gst_buffer_unmap (inbuffer, &map);
721
722 caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
723 gst_check_setup_events (mysrcpad, audiowsincband, caps, GST_FORMAT_TIME);
724 gst_caps_unref (caps);
725 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
726
727 /* ensure segment (format) properly setup */
728 gst_segment_init (&segment, GST_FORMAT_TIME);
729 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
730
731 /* pushing gives away my reference ... */
732 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
733 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
734 /* ... and puts a new buffer on the global list */
735 fail_unless (g_list_length (buffers) >= 1);
736
737 for (node = buffers; node; node = node->next) {
738 gint buffer_length;
739
740 fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
741
742 gst_buffer_map (outbuffer, &map, GST_MAP_READ);
743 res = (gdouble *) map.data;
744 buffer_length = map.size / sizeof (gdouble);
745 rms = 0.0;
746 for (i = 0; i < buffer_length; i++)
747 rms += res[i] * res[i];
748 rms = sqrt (rms / buffer_length);
749 fail_unless (rms >= 0.4);
750 gst_buffer_unmap (outbuffer, &map);
751 }
752
753 /* cleanup */
754 cleanup_audiowsincband (audiowsincband);
755 }
756
757 GST_END_TEST;
758
759
760 /* Test if data containing only one frequency component
761 * at rate/2 is erased with bandreject mode and a
762 * 2000Hz frequency band around rate/4 */
GST_START_TEST(test_64_bp_22050hz)763 GST_START_TEST (test_64_bp_22050hz)
764 {
765 GstElement *audiowsincband;
766 GstBuffer *inbuffer, *outbuffer;
767 GstCaps *caps;
768 gdouble *in, *res, rms;
769 gint i;
770 GstMapInfo map;
771 GList *node;
772 GstSegment segment;
773
774 audiowsincband = setup_audiowsincband ();
775 /* Set to bandpass */
776 g_object_set (G_OBJECT (audiowsincband), "mode", 0, NULL);
777 g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL);
778
779 fail_unless (gst_element_set_state (audiowsincband,
780 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
781 "could not set to playing");
782
783 g_object_set (G_OBJECT (audiowsincband), "lower-frequency",
784 44100 / 4.0 - 1000, NULL);
785 g_object_set (G_OBJECT (audiowsincband), "upper-frequency",
786 44100 / 4.0 + 1000, NULL);
787 inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
788 GST_BUFFER_TIMESTAMP (inbuffer) = 0;
789 gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
790 in = (gdouble *) map.data;
791 for (i = 0; i < 1024; i += 2) {
792 in[i] = 1.0;
793 in[i + 1] = -1.0;
794 }
795 gst_buffer_unmap (inbuffer, &map);
796
797 caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
798 gst_check_setup_events (mysrcpad, audiowsincband, caps, GST_FORMAT_TIME);
799 gst_caps_unref (caps);
800 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
801
802 /* ensure segment (format) properly setup */
803 gst_segment_init (&segment, GST_FORMAT_TIME);
804 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
805
806 /* pushing gives away my reference ... */
807 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
808 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
809 /* ... and puts a new buffer on the global list */
810 fail_unless (g_list_length (buffers) >= 1);
811
812 for (node = buffers; node; node = node->next) {
813 gint buffer_length;
814
815 fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
816
817 gst_buffer_map (outbuffer, &map, GST_MAP_READ);
818 res = (gdouble *) map.data;
819 buffer_length = map.size / sizeof (gdouble);
820 rms = 0.0;
821 for (i = 0; i < buffer_length; i++)
822 rms += res[i] * res[i];
823 rms = sqrt (rms / buffer_length);
824 fail_unless (rms <= 0.3);
825 gst_buffer_unmap (outbuffer, &map);
826 }
827
828 /* cleanup */
829 cleanup_audiowsincband (audiowsincband);
830 }
831
832 GST_END_TEST;
833
834 /* Test if data containing only one frequency component
835 * at rate/2 is preserved with bandreject mode and a
836 * 2000Hz frequency band around rate/4 */
GST_START_TEST(test_64_br_0hz)837 GST_START_TEST (test_64_br_0hz)
838 {
839 GstElement *audiowsincband;
840 GstBuffer *inbuffer, *outbuffer;
841 GstCaps *caps;
842 gdouble *in, *res, rms;
843 gint i;
844 GstMapInfo map;
845 GList *node;
846 GstSegment segment;
847
848 audiowsincband = setup_audiowsincband ();
849 /* Set to bandreject */
850 g_object_set (G_OBJECT (audiowsincband), "mode", 1, NULL);
851 g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL);
852
853 fail_unless (gst_element_set_state (audiowsincband,
854 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
855 "could not set to playing");
856
857 g_object_set (G_OBJECT (audiowsincband), "lower-frequency",
858 44100 / 4.0 - 1000, NULL);
859 g_object_set (G_OBJECT (audiowsincband), "upper-frequency",
860 44100 / 4.0 + 1000, NULL);
861 inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
862 GST_BUFFER_TIMESTAMP (inbuffer) = 0;
863 gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
864 in = (gdouble *) map.data;
865 for (i = 0; i < 1024; i++)
866 in[i] = 1.0;
867 gst_buffer_unmap (inbuffer, &map);
868
869 caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
870 gst_check_setup_events (mysrcpad, audiowsincband, caps, GST_FORMAT_TIME);
871 gst_caps_unref (caps);
872 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
873
874 /* ensure segment (format) properly setup */
875 gst_segment_init (&segment, GST_FORMAT_TIME);
876 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
877
878 /* pushing gives away my reference ... */
879 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
880 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
881 /* ... and puts a new buffer on the global list */
882 fail_unless (g_list_length (buffers) >= 1);
883
884 for (node = buffers; node; node = node->next) {
885 gint buffer_length;
886
887 fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
888
889 gst_buffer_map (outbuffer, &map, GST_MAP_READ);
890 res = (gdouble *) map.data;
891 buffer_length = map.size / sizeof (gdouble);
892 rms = 0.0;
893 for (i = 0; i < buffer_length; i++)
894 rms += res[i] * res[i];
895 rms = sqrt (rms / buffer_length);
896 fail_unless (rms >= 0.9);
897 gst_buffer_unmap (outbuffer, &map);
898 }
899
900 /* cleanup */
901 cleanup_audiowsincband (audiowsincband);
902 }
903
904 GST_END_TEST;
905
906 /* Test if data containing only one frequency component
907 * at the band center is erased with bandreject mode
908 * and a 2000Hz frequency band around rate/4 */
GST_START_TEST(test_64_br_11025hz)909 GST_START_TEST (test_64_br_11025hz)
910 {
911 GstElement *audiowsincband;
912 GstBuffer *inbuffer, *outbuffer;
913 GstCaps *caps;
914 gdouble *in, *res, rms;
915 gint i;
916 GstMapInfo map;
917 GList *node;
918 GstSegment segment;
919
920 audiowsincband = setup_audiowsincband ();
921 /* Set to bandreject */
922 g_object_set (G_OBJECT (audiowsincband), "mode", 1, NULL);
923 g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL);
924
925 fail_unless (gst_element_set_state (audiowsincband,
926 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
927 "could not set to playing");
928
929 g_object_set (G_OBJECT (audiowsincband), "lower-frequency",
930 44100 / 4.0 - 1000, NULL);
931 g_object_set (G_OBJECT (audiowsincband), "upper-frequency",
932 44100 / 4.0 + 1000, NULL);
933 inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
934 GST_BUFFER_TIMESTAMP (inbuffer) = 0;
935 gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
936 in = (gdouble *) map.data;
937
938 for (i = 0; i < 1024; i += 4) {
939 in[i] = 0.0;
940 in[i + 1] = 1.0;
941 in[i + 2] = 0.0;
942 in[i + 3] = -1.0;
943 }
944 gst_buffer_unmap (inbuffer, &map);
945
946 caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
947 gst_check_setup_events (mysrcpad, audiowsincband, caps, GST_FORMAT_TIME);
948 gst_caps_unref (caps);
949 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
950
951 /* ensure segment (format) properly setup */
952 gst_segment_init (&segment, GST_FORMAT_TIME);
953 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
954
955 /* pushing gives away my reference ... */
956 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
957 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
958 /* ... and puts a new buffer on the global list */
959 fail_unless (g_list_length (buffers) >= 1);
960
961 for (node = buffers; node; node = node->next) {
962 gint buffer_length;
963
964 fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
965
966 gst_buffer_map (outbuffer, &map, GST_MAP_READ);
967 res = (gdouble *) map.data;
968 buffer_length = map.size / sizeof (gdouble);
969 rms = 0.0;
970 for (i = 0; i < buffer_length; i++)
971 rms += res[i] * res[i];
972 rms = sqrt (rms / buffer_length);
973 fail_unless (rms <= 0.35);
974 gst_buffer_unmap (outbuffer, &map);
975 }
976
977 /* cleanup */
978 cleanup_audiowsincband (audiowsincband);
979 }
980
981 GST_END_TEST;
982
983
984 /* Test if data containing only one frequency component
985 * at rate/2 is preserved with bandreject mode and a
986 * 2000Hz frequency band around rate/4 */
GST_START_TEST(test_64_br_22050hz)987 GST_START_TEST (test_64_br_22050hz)
988 {
989 GstElement *audiowsincband;
990 GstBuffer *inbuffer, *outbuffer;
991 GstCaps *caps;
992 gdouble *in, *res, rms;
993 gint i;
994 GstMapInfo map;
995 GList *node;
996 GstSegment segment;
997
998 audiowsincband = setup_audiowsincband ();
999 /* Set to bandreject */
1000 g_object_set (G_OBJECT (audiowsincband), "mode", 1, NULL);
1001 g_object_set (G_OBJECT (audiowsincband), "length", 31, NULL);
1002
1003 fail_unless (gst_element_set_state (audiowsincband,
1004 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1005 "could not set to playing");
1006
1007 g_object_set (G_OBJECT (audiowsincband), "lower-frequency",
1008 44100 / 4.0 - 1000, NULL);
1009 g_object_set (G_OBJECT (audiowsincband), "upper-frequency",
1010 44100 / 4.0 + 1000, NULL);
1011 inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
1012 GST_BUFFER_TIMESTAMP (inbuffer) = 0;
1013 gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
1014 in = (gdouble *) map.data;
1015 for (i = 0; i < 1024; i += 2) {
1016 in[i] = 1.0;
1017 in[i + 1] = -1.0;
1018 }
1019 gst_buffer_unmap (inbuffer, &map);
1020
1021 caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
1022 gst_check_setup_events (mysrcpad, audiowsincband, caps, GST_FORMAT_TIME);
1023 gst_caps_unref (caps);
1024 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1025
1026 /* ensure segment (format) properly setup */
1027 gst_segment_init (&segment, GST_FORMAT_TIME);
1028 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
1029
1030 /* pushing gives away my reference ... */
1031 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1032 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
1033 /* ... and puts a new buffer on the global list */
1034 fail_unless (g_list_length (buffers) >= 1);
1035
1036 for (node = buffers; node; node = node->next) {
1037 gint buffer_length;
1038
1039 fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
1040
1041 gst_buffer_map (outbuffer, &map, GST_MAP_READ);
1042 res = (gdouble *) map.data;
1043 buffer_length = map.size / sizeof (gdouble);
1044 rms = 0.0;
1045 for (i = 0; i < buffer_length; i++)
1046 rms += res[i] * res[i];
1047 rms = sqrt (rms / buffer_length);
1048 fail_unless (rms >= 0.9);
1049 gst_buffer_unmap (outbuffer, &map);
1050 }
1051
1052 /* cleanup */
1053 cleanup_audiowsincband (audiowsincband);
1054 }
1055
1056 GST_END_TEST;
1057
1058 /* Test if buffers smaller than the kernel size are handled
1059 * correctly without accessing wrong memory areas */
GST_START_TEST(test_64_small_buffer)1060 GST_START_TEST (test_64_small_buffer)
1061 {
1062 GstElement *audiowsincband;
1063 GstBuffer *inbuffer;
1064 GstCaps *caps;
1065 gdouble *in;
1066 gint i;
1067 GstMapInfo map;
1068 GstSegment segment;
1069
1070 audiowsincband = setup_audiowsincband ();
1071 /* Set to bandpass */
1072 g_object_set (G_OBJECT (audiowsincband), "mode", 0, NULL);
1073 g_object_set (G_OBJECT (audiowsincband), "length", 101, NULL);
1074
1075 fail_unless (gst_element_set_state (audiowsincband,
1076 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1077 "could not set to playing");
1078
1079 g_object_set (G_OBJECT (audiowsincband), "lower-frequency",
1080 44100 / 4.0 - 44100 / 16.0, NULL);
1081 g_object_set (G_OBJECT (audiowsincband), "upper-frequency",
1082 44100 / 4.0 + 44100 / 16.0, NULL);
1083 inbuffer = gst_buffer_new_and_alloc (20 * sizeof (gdouble));
1084 GST_BUFFER_TIMESTAMP (inbuffer) = 0;
1085 gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
1086 in = (gdouble *) map.data;
1087 for (i = 0; i < 20; i++)
1088 in[i] = 1.0;
1089 gst_buffer_unmap (inbuffer, &map);
1090
1091 caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
1092 gst_check_setup_events (mysrcpad, audiowsincband, caps, GST_FORMAT_TIME);
1093 gst_caps_unref (caps);
1094 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1095
1096 /* ensure segment (format) properly setup */
1097 gst_segment_init (&segment, GST_FORMAT_TIME);
1098 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
1099
1100 /* pushing gives away my reference ... */
1101 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1102 fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()));
1103 /* ... and puts a new buffer on the global list */
1104 fail_unless (g_list_length (buffers) >= 1);
1105
1106 /* cleanup */
1107 cleanup_audiowsincband (audiowsincband);
1108 }
1109
1110 GST_END_TEST;
1111
1112 static Suite *
audiowsincband_suite(void)1113 audiowsincband_suite (void)
1114 {
1115 Suite *s = suite_create ("audiowsincband");
1116 TCase *tc_chain = tcase_create ("general");
1117
1118 suite_add_tcase (s, tc_chain);
1119 tcase_add_test (tc_chain, test_32_bp_0hz);
1120 tcase_add_test (tc_chain, test_32_bp_11025hz);
1121 tcase_add_test (tc_chain, test_32_bp_22050hz);
1122 tcase_add_test (tc_chain, test_32_br_0hz);
1123 tcase_add_test (tc_chain, test_32_br_11025hz);
1124 tcase_add_test (tc_chain, test_32_br_22050hz);
1125 tcase_add_test (tc_chain, test_32_small_buffer);
1126 tcase_add_test (tc_chain, test_64_bp_0hz);
1127 tcase_add_test (tc_chain, test_64_bp_11025hz);
1128 tcase_add_test (tc_chain, test_64_bp_22050hz);
1129 tcase_add_test (tc_chain, test_64_br_0hz);
1130 tcase_add_test (tc_chain, test_64_br_11025hz);
1131 tcase_add_test (tc_chain, test_64_br_22050hz);
1132 tcase_add_test (tc_chain, test_64_small_buffer);
1133
1134 return s;
1135 }
1136
1137 GST_CHECK_MAIN (audiowsincband);
1138