From: Sebastian Dröge Date: Fri, 1 Oct 2010 09:00:54 +0000 (+0200) Subject: volume: Convert parts of the controlled processing to orc X-Git-Tag: RELEASE-0.10.31~108 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=988849a8b4105c7ce749233a806726885a649540;p=platform%2Fupstream%2Fgst-plugins-base.git volume: Convert parts of the controlled processing to orc --- diff --git a/gst/volume/gstvolume.c b/gst/volume/gstvolume.c index 796210e..e18efaa 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 c05a2fb..e405d83 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