Commit 64b4aedf authored by Stefan Kost's avatar Stefan Kost

gst/volume/gstvolume.c: Enable liboil for float and add more details about problems with int16.

Original commit message from CVS:
* gst/volume/gstvolume.c:
Enable liboil for float and add more details about problems with
int16.
parent 3e3b2214
2007-08-22 Stefan Kost <ensonic@users.sf.net>
* gst/volume/gstvolume.c:
Enable liboil for float and add more details about problems with
int16.
2007-08-21 Wim Taymans <wim.taymans@gmail.com>
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_palette_to_caps):
......@@ -396,37 +396,47 @@ static void
volume_process_float (GstVolume * this, gpointer bytes, guint n_bytes)
{
gfloat *data = (gfloat *) bytes;
guint i, num_samples;
num_samples = n_bytes / sizeof (gfloat);
guint num_samples = n_bytes / sizeof (gfloat);
for (i = 0; i < num_samples; i++) {
*data++ *= this->real_vol_f;
}
/* FIXME: seems to be slower than above!
oil_scalarmultiply_f32_ns (data, data, &this->real_vol_f, num_samples);
/*
guint i;
for (i = 0; i < num_samples; i++) {
*data++ *= this->real_vol_f;
}
*/
/* time gst-launch 2>/dev/null audiotestsrc wave=7 num-buffers=10000 ! audio/x-raw-float ! volume volume=1.5 ! fakesink
* goes from 0m0.850s -> 0m0.717s with liboil
*/
oil_scalarmultiply_f32_ns (data, data, &this->real_vol_f, num_samples);
}
static void
volume_process_int16 (GstVolume * this, gpointer bytes, guint n_bytes)
{
gint16 *data = (gint16 *) bytes;
guint i, num_samples;
gint val;
guint num_samples = n_bytes / sizeof (gint16);
num_samples = n_bytes / sizeof (gint16);
#if 1
guint i;
gint val;
/* FIXME: need... liboil...
* oil_scalarmultiply_s16_ns ?
* https://bugs.freedesktop.org/show_bug.cgi?id=7060
*/
for (i = 0; i < num_samples; i++) {
/* we use bitshifting instead of dividing by UNITY_INT for speed */
val = (gint) * data;
*data++ =
(gint16) ((this->real_vol_i * val) >> VOLUME_UNITY_INT16_BIT_SHIFT);
}
#else
/* FIXME: need oil_scalarmultiply_s16_ns ?
* https://bugs.freedesktop.org/show_bug.cgi?id=7060
* code below
* - crashes for volume<1.0
* - is not faster
* time gst-launch 2>/dev/null audiotestsrc wave=7 num-buffers=100 ! volume volume=1.5 ! fakesink
*/
oil_scalarmult_s16 (data, 0, data, 0,
((gint16 *) (void *) (&this->real_vol_i)), num_samples);
#endif
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment