[gst-cvs] gst-plugins-base: volume: Implement controlled processing for f64/ 1ch and f32/1-2ch in orc
Sebastian Dröge
slomo at kemper.freedesktop.org
Fri Oct 8 00:10:57 PDT 2010
Module: gst-plugins-base
Branch: master
Commit: 0bf4abe5815f8920dc4995506c1882b07fa6ae32
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=0bf4abe5815f8920dc4995506c1882b07fa6ae32
Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date: Fri Oct 1 11:13:01 2010 +0200
volume: Implement controlled processing for f64/1ch and f32/1-2ch in orc
---
gst/volume/gstvolume.c | 26 ++++++++++++++++++--------
gst/volume/gstvolumeorc.orc | 23 +++++++++++++++++++++++
2 files changed, 41 insertions(+), 8 deletions(-)
diff --git a/gst/volume/gstvolume.c b/gst/volume/gstvolume.c
index e18efaa..43fa340 100644
--- a/gst/volume/gstvolume.c
+++ b/gst/volume/gstvolume.c
@@ -521,10 +521,14 @@ volume_process_controlled_double (GstVolume * self, gpointer bytes,
guint i, j;
gdouble vol;
- for (i = 0; i < num_samples; i++) {
- vol = *volume++;
- for (j = 0; j < channels; j++) {
- *data++ *= vol;
+ if (channels == 1) {
+ orc_process_controlled_f64_1ch (data, volume, num_samples);
+ } else {
+ for (i = 0; i < num_samples; i++) {
+ vol = *volume++;
+ for (j = 0; j < channels; j++) {
+ *data++ *= vol;
+ }
}
}
}
@@ -547,10 +551,16 @@ volume_process_controlled_float (GstVolume * self, gpointer bytes,
guint i, j;
gdouble vol;
- for (i = 0; i < num_samples; i++) {
- vol = *volume++;
- for (j = 0; j < channels; j++) {
- *data++ *= vol;
+ if (channels == 1) {
+ orc_process_controlled_f32_1ch (data, volume, num_samples);
+ } else if (channels == 2) {
+ orc_process_controlled_f32_2ch (data, volume, num_samples);
+ } else {
+ for (i = 0; i < num_samples; i++) {
+ vol = *volume++;
+ for (j = 0; j < channels; j++) {
+ *data++ *= vol;
+ }
}
}
}
diff --git a/gst/volume/gstvolumeorc.orc b/gst/volume/gstvolumeorc.orc
index e405d83..bd2b6e4 100644
--- a/gst/volume/gstvolumeorc.orc
+++ b/gst/volume/gstvolumeorc.orc
@@ -68,3 +68,26 @@ convld t1, s1
subd t1, 0x3FF0000000000000L, t1
muld d1, d1, t1
+.function orc_process_controlled_f64_1ch
+.dest 8 d1 gdouble
+.source 8 s1 gdouble
+
+muld d1, d1, s1
+
+.function orc_process_controlled_f32_1ch
+.dest 4 d1 gfloat
+.source 8 s1 gdouble
+.temp 4 t1
+
+convdf t1, s1
+mulf d1, d1, t1
+
+.function orc_process_controlled_f32_2ch
+.dest 8 d1 gfloat
+.source 8 s1 gdouble
+.temp 4 t1
+.temp 8 t2
+
+convdf t1, s1
+mergelq t2, t1, t1
+x2 mulf d1, d1, t2
More information about the Gstreamer-commits
mailing list