volume: Implement controlled processing for f64/1ch and f32/1-2ch in orc
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 1 Oct 2010 09:13:01 +0000 (11:13 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 7 Oct 2010 22:01:15 +0000 (00:01 +0200)
gst/volume/gstvolume.c
gst/volume/gstvolumeorc.orc

index e18efaa..43fa340 100644 (file)
@@ -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;
+      }
     }
   }
 }
index e405d83..bd2b6e4 100644 (file)
@@ -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