From 988849a8b4105c7ce749233a806726885a649540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 1 Oct 2010 11:00:54 +0200 Subject: [PATCH] volume: Convert parts of the controlled processing to orc --- gst/volume/gstvolume.c | 20 ++++++++++---------- gst/volume/gstvolumeorc.orc | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/gst/volume/gstvolume.c b/gst/volume/gstvolume.c index 796210eca6..e18efaafff 100644 --- a/gst/volume/gstvolume.c +++ b/gst/volume/gstvolume.c @@ -49,8 +49,14 @@ #include #include #include -#include "gstvolumeorc.h" +#ifdef HAVE_ORC +#include +#else +#define orc_memset memset +#endif + +#include "gstvolumeorc.h" #include "gstvolume.h" /* some defines for audio processing */ @@ -973,17 +979,11 @@ volume_transform_ip (GstBaseTransform * base, GstBuffer * outbuf) gst_object_unref (volume_csource); volume_csource = NULL; } else { - guint i; - - for (i = 0; i < nsamples; i++) - self->volumes[i] = self->current_volume; + orc_memset_f64 (self->volumes, self->current_volume, nsamples); } if (mute_csource) { - guint i; - - for (i = 0; i < nsamples; i++) - self->volumes[i] *= (1.0 - self->mutes[i]); + orc_prepare_volumes (self->volumes, self->mutes, nsamples); } self->process_controlled (self, data, self->volumes, channels, size); @@ -994,7 +994,7 @@ volume_transform_ip (GstBaseTransform * base, GstBuffer * outbuf) } if (self->current_volume == 0.0 || self->current_mute) { - memset (data, 0, size); + orc_memset (data, 0, size); GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP); } else if (self->current_volume != 1.0) { self->process (self, data, size); diff --git a/gst/volume/gstvolumeorc.orc b/gst/volume/gstvolumeorc.orc index c05a2fbf5f..e405d8350c 100644 --- a/gst/volume/gstvolumeorc.orc +++ b/gst/volume/gstvolumeorc.orc @@ -53,4 +53,18 @@ mulsbw t1, d1, p1 shrsw t1, t1, 5 convssswb d1, t1 +.function orc_memset_f64 +.dest 8 d1 gdouble +.floatparam 8 p1 + +copyq d1, p1 + +.function orc_prepare_volumes +.dest 8 d1 gdouble +.source 4 s1 gboolean +.temp 8 t1 + +convld t1, s1 +subd t1, 0x3FF0000000000000L, t1 +muld d1, d1, t1