summaryrefslogtreecommitdiff
path: root/libs/ardour/mix.cc
diff options
context:
space:
mode:
authorSampo Savolainen <v2@iki.fi>2007-03-13 22:42:34 +0000
committerSampo Savolainen <v2@iki.fi>2007-03-13 22:42:34 +0000
commit75d2f51193f6fd25881a9c766db9078f3b68d80e (patch)
tree2fd7df7152970a134e291bf307f69158ac79bdf8 /libs/ardour/mix.cc
parent29f4d8b52c937b984dfba80cd912a20ee6b526ce (diff)
Added a xmmintrin.h based SSE function find_peaks(). Needs polishing as
this commit breaks the build system for i386 builds with dynamic SSE enabled. git-svn-id: svn://localhost/ardour2/trunk@1586 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/mix.cc')
-rw-r--r--libs/ardour/mix.cc39
1 files changed, 38 insertions, 1 deletions
diff --git a/libs/ardour/mix.cc b/libs/ardour/mix.cc
index 63ccc8b7ea..e2096178dd 100644
--- a/libs/ardour/mix.cc
+++ b/libs/ardour/mix.cc
@@ -24,7 +24,6 @@
#include <stdint.h>
#if defined (ARCH_X86) && defined (BUILD_SSE_OPTIMIZATIONS)
-
// Debug wrappers
float
@@ -90,6 +89,25 @@ compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current)
return current;
}
+float
+find_peaks (ARDOUR::Sample *buf, nframes_t nframes, float *min, float *max)
+{
+ long i;
+ float a, b;
+
+ a = *max;
+ b = *min;
+
+ for (i = 0; i < nframes; i++)
+ {
+ a = fmax (buf[i], a);
+ b = fmin (buf[i], b);
+ }
+
+ *max = a;
+ *min = b;
+}
+
void
apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain)
{
@@ -124,6 +142,25 @@ veclib_compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current)
return f_max(current, tmpmax);
}
+float
+veclib_find_peaks (ARDOUR::Sample *buf, nframes_t nframes, float *min, float *max)
+{
+ // TODO: someone with veclib skills needs to write this one
+ long i;
+ float a, b;
+
+ a = *max;
+ b = *min;
+
+ for (i = 0; i < nframes; i++)
+ {
+ a = fmax (buf[i], a);
+ b = fmin (buf[i], b);
+ }
+
+ *max = a;
+ *min = b;
+}
void
veclib_apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain)
{