From 4ecb1fa6f19d5f3278e2d62eeb023720eaf676f4 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Fri, 9 Dec 2011 18:18:32 +0000 Subject: [PATCH] Minor and mostly immaterial bits --- src/StretcherImpl.cpp | 22 +++------------------- src/StretcherImpl.h | 3 ++- src/StretcherProcess.cpp | 3 +++ src/system/Thread.cpp | 1 + src/system/Thread.h | 6 ++++-- src/system/VectorOpsComplex.h | 8 ++++++++ src/system/sysutils.h | 1 + 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/StretcherImpl.cpp b/src/StretcherImpl.cpp index 01d8461..27bce44 100644 --- a/src/StretcherImpl.cpp +++ b/src/StretcherImpl.cpp @@ -1220,7 +1220,6 @@ RubberBandStretcher::Impl::process(const float *const *input, size_t samples, bo } } - if (m_threaded) { MutexLocker locker(&m_threadSetMutex); @@ -1247,12 +1246,6 @@ RubberBandStretcher::Impl::process(const float *const *input, size_t samples, bo while (!allConsumed) { -//#ifndef NO_THREADING -// if (m_threaded) { -// pthread_mutex_lock(&m_inputProcessedMutex); -// } -//#endif - // In a threaded mode, our "consumed" counters only indicate // the number of samples that have been taken into the input // ring buffers waiting to be processed by the process thread. @@ -1276,7 +1269,9 @@ RubberBandStretcher::Impl::process(const float *const *input, size_t samples, bo } // cerr << "process: happy with channel " << c << endl; } - if (!m_threaded && !m_realtime) { + if ( + !m_threaded && + !m_realtime) { bool any = false, last = false; processChunks(c, any, last); } @@ -1289,7 +1284,6 @@ RubberBandStretcher::Impl::process(const float *const *input, size_t samples, bo // the realtime onset detector processOneChunk(); } - if (m_threaded) { for (ThreadSet::iterator i = m_threadSet.begin(); i != m_threadSet.end(); ++i) { @@ -1300,16 +1294,6 @@ RubberBandStretcher::Impl::process(const float *const *input, size_t samples, bo m_spaceAvailable.wait(500); } m_spaceAvailable.unlock(); -/* - } else { - if (!allConsumed) { - cerr << "RubberBandStretcher::Impl::process: ERROR: Too much data provided to process() call -- either call setMaxProcessSize() beforehand, or provide only getSamplesRequired() frames at a time" << endl; - for (size_t c = 0; c < m_channels; ++c) { - cerr << "channel " << c << ": " << samples << " provided, " << consumed[c] << " consumed" << endl; - } -// break; - } -*/ } if (m_debugLevel > 2) { diff --git a/src/StretcherImpl.h b/src/StretcherImpl.h index 2cae410..6d34991 100644 --- a/src/StretcherImpl.h +++ b/src/StretcherImpl.h @@ -160,8 +160,9 @@ protected: size_t m_maxProcessSize; size_t m_expectedInputDuration; - + bool m_threaded; + bool m_realtime; Options m_options; int m_debugLevel; diff --git a/src/StretcherProcess.cpp b/src/StretcherProcess.cpp index 32a9708..b228596 100644 --- a/src/StretcherProcess.cpp +++ b/src/StretcherProcess.cpp @@ -42,6 +42,7 @@ using std::endl; namespace RubberBand { + RubberBandStretcher::Impl::ProcessThread::ProcessThread(Impl *s, size_t c) : m_s(s), m_channel(c), @@ -116,6 +117,7 @@ RubberBandStretcher::Impl::ProcessThread::abandon() m_abandoning = true; } + bool RubberBandStretcher::Impl::resampleBeforeStretching() const { @@ -377,6 +379,7 @@ RubberBandStretcher::Impl::testInbufReadSpace(size_t c) << inbuf.getReadSpace() << " < " << m_aWindowSize << ") when not all input written, on processChunks for channel " << c << endl; } + } return false; } diff --git a/src/system/Thread.cpp b/src/system/Thread.cpp index f11a2ec..07df4cd 100644 --- a/src/system/Thread.cpp +++ b/src/system/Thread.cpp @@ -12,6 +12,7 @@ COPYING included with this distribution for more information. */ + #include "Thread.h" #include diff --git a/src/system/Thread.h b/src/system/Thread.h index e976a95..f5a0053 100644 --- a/src/system/Thread.h +++ b/src/system/Thread.h @@ -15,14 +15,15 @@ #ifndef _RUBBERBAND_THREAD_H_ #define _RUBBERBAND_THREAD_H_ +#include + + #ifdef _WIN32 #include #else /* !_WIN32 */ #include #endif /* !_WIN32 */ -#include - //#define DEBUG_THREAD 1 //#define DEBUG_MUTEX 1 //#define DEBUG_CONDITION 1 @@ -143,4 +144,5 @@ private: } + #endif diff --git a/src/system/VectorOpsComplex.h b/src/system/VectorOpsComplex.h index 499a27c..c3786a8 100644 --- a/src/system/VectorOpsComplex.h +++ b/src/system/VectorOpsComplex.h @@ -26,6 +26,13 @@ inline void c_phasor(T *real, T *imag, T phase) { //!!! IPP contains ippsSinCos_xxx in ippvm.h -- these are //!!! fixed-accuracy, test and compare +#if defined __GNUC__ + if (sizeof(T) == sizeof(float)) { + sincosf(phase, (float *)imag, (float *)real); + } else { + sincos(phase, (double *)imag, (double *)real); + } +#else if (sizeof(T) == sizeof(float)) { *real = cosf(phase); *imag = sinf(phase); @@ -33,6 +40,7 @@ inline void c_phasor(T *real, T *imag, T phase) *real = cos(phase); *imag = sin(phase); } +#endif } template diff --git a/src/system/sysutils.h b/src/system/sysutils.h index f72bbd7..e61e51c 100644 --- a/src/system/sysutils.h +++ b/src/system/sysutils.h @@ -125,4 +125,5 @@ extern void system_memorybarrier(); #endif + #endif