From f74981874f578ce5b698be7542a185d4d06b8873 Mon Sep 17 00:00:00 2001 From: Taybin Rutkin Date: Wed, 14 Mar 2007 21:33:44 +0000 Subject: veclib implementation of find_peaks(). git-svn-id: svn://localhost/ardour2/trunk@1590 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/mix.h | 6 +++--- libs/ardour/ardour/session.h | 2 +- libs/ardour/mix.cc | 22 +++++----------------- libs/pbd/macosx/pbd.xcodeproj/project.pbxproj | 2 ++ 4 files changed, 11 insertions(+), 21 deletions(-) (limited to 'libs') diff --git a/libs/ardour/ardour/mix.h b/libs/ardour/ardour/mix.h index 7515401a2a..68f57c1aa8 100644 --- a/libs/ardour/ardour/mix.h +++ b/libs/ardour/ardour/mix.h @@ -36,7 +36,7 @@ extern "C" { void x86_sse_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes); } -float x86_sse_find_peaks (ARDOUR::Sample *buf, nframes_t nsamples, float *min, float *max); +void x86_sse_find_peaks (ARDOUR::Sample *buf, nframes_t nsamples, float *min, float *max); /* debug wrappers for SSE functions */ @@ -54,7 +54,7 @@ void debug_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nfra float veclib_compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current); -float veclib_find_peaks (ARDOUR::Sample *buf, nframes_t nsamples, float *min, float *max); +void veclib_find_peaks (ARDOUR::Sample *buf, nframes_t nsamples, float *min, float *max); void veclib_apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain); @@ -68,7 +68,7 @@ void veclib_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src float compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current); -float find_peaks (ARDOUR::Sample *buf, nframes_t nsamples, float *min, float *max); +void find_peaks (ARDOUR::Sample *buf, nframes_t nsamples, float *min, float *max); void apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain); diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 7794dc95c8..05840cbc43 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -906,7 +906,7 @@ class Session : public PBD::StatefulDestructible float opt); typedef float (*compute_peak_t) (Sample *, nframes_t, float); - typedef float (*find_peaks_t) (Sample *, nframes_t, float *, float*); + typedef void (*find_peaks_t) (Sample *, nframes_t, float *, float*); typedef void (*apply_gain_to_buffer_t) (Sample *, nframes_t, float); typedef void (*mix_buffers_with_gain_t) (Sample *, Sample *, nframes_t, float); typedef void (*mix_buffers_no_gain_t) (Sample *, Sample *, nframes_t); diff --git a/libs/ardour/mix.cc b/libs/ardour/mix.cc index e2096178dd..a32c274b7c 100644 --- a/libs/ardour/mix.cc +++ b/libs/ardour/mix.cc @@ -89,7 +89,7 @@ compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current) return current; } -float +void find_peaks (ARDOUR::Sample *buf, nframes_t nframes, float *min, float *max) { long i; @@ -142,25 +142,13 @@ veclib_compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current) return f_max(current, tmpmax); } -float +void 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; + vDSP_maxv (buf, 1, max, nframes); + vDSP_minv (buf, 1, min, nframes); } + void veclib_apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain) { diff --git a/libs/pbd/macosx/pbd.xcodeproj/project.pbxproj b/libs/pbd/macosx/pbd.xcodeproj/project.pbxproj index 4fcb6a7efd..535d16b8a2 100644 --- a/libs/pbd/macosx/pbd.xcodeproj/project.pbxproj +++ b/libs/pbd/macosx/pbd.xcodeproj/project.pbxproj @@ -533,6 +533,7 @@ 4FADC24808B4156D00ABE55E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = ( "$(NATIVE_ARCH)", ppc, @@ -557,6 +558,7 @@ 69C9AF150B97A83A0097DE90 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(NATIVE_ARCH)"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = stabs; -- cgit v1.2.3