From 0bf4abe5815f8920dc4995506c1882b07fa6ae32 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 1 Oct 2010 11:13:01 +0200 Subject: [PATCH] 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 -- 2.7.4