mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
tests/check/elements/audioconvert.c: Added check for correct clipping when doing float samples in audioconvert.
Original commit message from CVS: * tests/check/elements/audioconvert.c: (get_float_caps), (GST_START_TEST), (audioconvert_suite): Added check for correct clipping when doing float samples in audioconvert.
This commit is contained in:
parent
e6da668a05
commit
b01a267aa1
2 changed files with 48 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2006-04-28 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* tests/check/elements/audioconvert.c: (get_float_caps),
|
||||||
|
(GST_START_TEST), (audioconvert_suite):
|
||||||
|
Added check for correct clipping when doing float samples
|
||||||
|
in audioconvert.
|
||||||
|
|
||||||
2006-04-28 Wim Taymans <wim@fluendo.com>
|
2006-04-28 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst/videorate/gstvideorate.c: (gst_video_rate_event),
|
* gst/videorate/gstvideorate.c: (gst_video_rate_event),
|
||||||
|
|
|
@ -139,6 +139,26 @@ get_int_caps (guint channels, gchar * endianness, guint width,
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* returns a newly allocated caps */
|
||||||
|
static GstCaps *
|
||||||
|
get_float_caps (guint channels, gchar * endianness, guint width)
|
||||||
|
{
|
||||||
|
GstCaps *caps;
|
||||||
|
gchar *string;
|
||||||
|
|
||||||
|
string = g_strdup_printf ("audio/x-raw-float, "
|
||||||
|
"rate = (int) 44100, "
|
||||||
|
"channels = (int) %d, "
|
||||||
|
"endianness = (int) %s, "
|
||||||
|
"width = (int) %d ", channels, endianness, width);
|
||||||
|
GST_DEBUG ("creating caps from %s", string);
|
||||||
|
caps = gst_caps_from_string (string);
|
||||||
|
g_free (string);
|
||||||
|
fail_unless (caps != NULL);
|
||||||
|
GST_DEBUG ("returning caps %p", caps);
|
||||||
|
return caps;
|
||||||
|
}
|
||||||
|
|
||||||
/* eats the refs to the caps */
|
/* eats the refs to the caps */
|
||||||
static void
|
static void
|
||||||
verify_convert (void *in, int inlength,
|
verify_convert (void *in, int inlength,
|
||||||
|
@ -283,6 +303,25 @@ GST_START_TEST (test_int_conversion)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
|
GST_START_TEST (test_float_conversion)
|
||||||
|
{
|
||||||
|
/* float32 <-> 16 signed */
|
||||||
|
/* NOTE: if audioconvert was doing dithering we'd have a problem */
|
||||||
|
{
|
||||||
|
gfloat in[] = { 0.0, 1.0, -1.0, 0.5, -0.5, 1.1, -1.1 };
|
||||||
|
gint16 out[] = { 0, 32767, -32768, 16384, -16384, 32767, -32768 };
|
||||||
|
|
||||||
|
/* only one direction conversion, the other direction does
|
||||||
|
* not produce exactly the same as the input due to floating
|
||||||
|
* point rounding errors etc. */
|
||||||
|
RUN_CONVERSION (in, get_float_caps (1, "BYTE_ORDER", 32),
|
||||||
|
out, get_int_caps (1, "BYTE_ORDER", 16, 16, TRUE)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
|
|
||||||
Suite *
|
Suite *
|
||||||
audioconvert_suite (void)
|
audioconvert_suite (void)
|
||||||
|
@ -292,7 +331,8 @@ audioconvert_suite (void)
|
||||||
|
|
||||||
suite_add_tcase (s, tc_chain);
|
suite_add_tcase (s, tc_chain);
|
||||||
tcase_add_test (tc_chain, test_int16);
|
tcase_add_test (tc_chain, test_int16);
|
||||||
//tcase_add_test (tc_chain, test_int_conversion);
|
tcase_add_test (tc_chain, test_int_conversion);
|
||||||
|
tcase_add_test (tc_chain, test_float_conversion);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue