* Fix FFTW wisdom saving (do it only once)
* Add makedepend dependencies
This commit is contained in:
37
Makefile.in
37
Makefile.in
@@ -102,3 +102,40 @@ clean:
|
||||
distclean: clean
|
||||
rm -f $(PROGRAM_TARGET) $(STATIC_TARGET) $(DYNAMIC_TARGET) $(VAMP_TARGET) $(LADSPA_TARGET)
|
||||
|
||||
# DO NOT DELETE
|
||||
|
||||
src/AudioCurve.o: src/AudioCurve.h
|
||||
src/ConstantAudioCurve.o: src/ConstantAudioCurve.h src/AudioCurve.h
|
||||
src/FFT.o: src/FFT.h src/Thread.h
|
||||
src/HighFrequencyAudioCurve.o: src/HighFrequencyAudioCurve.h src/AudioCurve.h
|
||||
src/HighFrequencyAudioCurve.o: src/Window.h
|
||||
src/main.o: rubberband/RubberBandStretcher.h rubberband/TimeStretcher.h
|
||||
src/PercussiveAudioCurve.o: src/PercussiveAudioCurve.h src/AudioCurve.h
|
||||
src/Resampler.o: src/Resampler.h
|
||||
src/RubberBandStretcher.o: src/StretcherImpl.h
|
||||
src/RubberBandStretcher.o: rubberband/RubberBandStretcher.h
|
||||
src/RubberBandStretcher.o: rubberband/TimeStretcher.h src/Window.h
|
||||
src/RubberBandStretcher.o: src/Thread.h src/RingBuffer.h src/Scavenger.h
|
||||
src/RubberBandStretcher.o: src/FFT.h src/sysutils.h
|
||||
src/StretchCalculator.o: src/StretchCalculator.h
|
||||
src/StretcherChannelData.o: src/StretcherChannelData.h src/StretcherImpl.h
|
||||
src/StretcherChannelData.o: rubberband/RubberBandStretcher.h
|
||||
src/StretcherChannelData.o: rubberband/TimeStretcher.h src/Window.h
|
||||
src/StretcherChannelData.o: src/Thread.h src/RingBuffer.h src/Scavenger.h
|
||||
src/StretcherChannelData.o: src/FFT.h src/sysutils.h src/Resampler.h
|
||||
src/StretcherImpl.o: src/StretcherImpl.h rubberband/RubberBandStretcher.h
|
||||
src/StretcherImpl.o: rubberband/TimeStretcher.h src/Window.h src/Thread.h
|
||||
src/StretcherImpl.o: src/RingBuffer.h src/Scavenger.h src/FFT.h
|
||||
src/StretcherImpl.o: src/sysutils.h src/PercussiveAudioCurve.h
|
||||
src/StretcherImpl.o: src/AudioCurve.h src/HighFrequencyAudioCurve.h
|
||||
src/StretcherImpl.o: src/ConstantAudioCurve.h src/StretchCalculator.h
|
||||
src/StretcherImpl.o: src/StretcherChannelData.h src/Resampler.h
|
||||
src/StretcherProcess.o: src/StretcherImpl.h rubberband/RubberBandStretcher.h
|
||||
src/StretcherProcess.o: rubberband/TimeStretcher.h src/Window.h src/Thread.h
|
||||
src/StretcherProcess.o: src/RingBuffer.h src/Scavenger.h src/FFT.h
|
||||
src/StretcherProcess.o: src/sysutils.h src/PercussiveAudioCurve.h
|
||||
src/StretcherProcess.o: src/AudioCurve.h src/HighFrequencyAudioCurve.h
|
||||
src/StretcherProcess.o: src/ConstantAudioCurve.h src/StretchCalculator.h
|
||||
src/StretcherProcess.o: src/StretcherChannelData.h src/Resampler.h
|
||||
src/sysutils.o: src/sysutils.h
|
||||
src/Thread.o: src/Thread.h
|
||||
|
||||
46
src/FFT.cpp
46
src/FFT.cpp
@@ -13,6 +13,7 @@
|
||||
*/
|
||||
|
||||
#include "FFT.h"
|
||||
#include "Thread.h"
|
||||
|
||||
|
||||
#include <fftw3.h>
|
||||
@@ -23,6 +24,8 @@
|
||||
#include <cstdio>
|
||||
#include <vector>
|
||||
|
||||
namespace RubberBand {
|
||||
|
||||
class FFTImpl
|
||||
{
|
||||
public:
|
||||
@@ -57,17 +60,22 @@ public:
|
||||
|
||||
~D_FFTW() {
|
||||
if (m_fplanf) {
|
||||
//!!! shouldn't do this every time, but only when the last one
|
||||
// is destroyed (likewise shouldn't load every time) -- want
|
||||
// a static refcount + mutex
|
||||
saveWisdom('f');
|
||||
bool save = false;
|
||||
m_extantMutex.lock();
|
||||
if (m_extantf > 0 && --m_extantf == 0) save = true;
|
||||
m_extantMutex.unlock();
|
||||
if (save) saveWisdom('f');
|
||||
fftwf_destroy_plan(m_fplanf);
|
||||
fftwf_destroy_plan(m_fplani);
|
||||
fftwf_free(m_fbuf);
|
||||
fftwf_free(m_fpacked);
|
||||
}
|
||||
if (m_dplanf) {
|
||||
saveWisdom('d');
|
||||
bool save = false;
|
||||
m_extantMutex.lock();
|
||||
if (m_extantd > 0 && --m_extantd == 0) save = true;
|
||||
m_extantMutex.unlock();
|
||||
if (save) saveWisdom('d');
|
||||
fftw_destroy_plan(m_dplanf);
|
||||
fftw_destroy_plan(m_dplani);
|
||||
fftw_free(m_dbuf);
|
||||
@@ -75,11 +83,13 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
//!!! check return values
|
||||
|
||||
void initFloat() {
|
||||
if (m_fplanf) return;
|
||||
loadWisdom('f');
|
||||
bool load = false;
|
||||
m_extantMutex.lock();
|
||||
if (m_extantf++ == 0) load = true;
|
||||
m_extantMutex.unlock();
|
||||
if (load) loadWisdom('f');
|
||||
m_fbuf = (float *)fftw_malloc(m_size * sizeof(float));
|
||||
m_fpacked = (fftwf_complex *)fftw_malloc
|
||||
((m_size/2 + 1) * sizeof(fftwf_complex));
|
||||
@@ -91,7 +101,11 @@ public:
|
||||
|
||||
void initDouble() {
|
||||
if (m_dplanf) return;
|
||||
loadWisdom('d');
|
||||
bool load = false;
|
||||
m_extantMutex.lock();
|
||||
if (m_extantd++ == 0) load = true;
|
||||
m_extantMutex.unlock();
|
||||
if (load) loadWisdom('d');
|
||||
m_dbuf = (double *)fftw_malloc(m_size * sizeof(double));
|
||||
m_dpacked = (fftw_complex *)fftw_malloc
|
||||
((m_size/2 + 1) * sizeof(fftw_complex));
|
||||
@@ -278,8 +292,20 @@ private:
|
||||
fftwf_complex *m_fpacked;
|
||||
double *m_dbuf;
|
||||
fftw_complex *m_dpacked;
|
||||
static unsigned int m_extantf;
|
||||
static unsigned int m_extantd;
|
||||
static Mutex m_extantMutex;
|
||||
};
|
||||
|
||||
unsigned int
|
||||
D_FFTW::m_extantf = 0;
|
||||
|
||||
unsigned int
|
||||
D_FFTW::m_extantd = 0;
|
||||
|
||||
Mutex
|
||||
D_FFTW::m_extantMutex;
|
||||
|
||||
|
||||
class D_Cross : public FFTImpl
|
||||
{
|
||||
@@ -641,3 +667,5 @@ FFT::tune()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
#ifndef _RUBBERBAND_FFT_H_
|
||||
#define _RUBBERBAND_FFT_H_
|
||||
|
||||
class FFTImpl;
|
||||
namespace RubberBand {
|
||||
|
||||
class FFTImpl;
|
||||
|
||||
/**
|
||||
* Provide the basic FFT computations we need, using one of a set of
|
||||
@@ -66,5 +67,7 @@ protected:
|
||||
static int m_method;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -237,6 +237,9 @@ int main(int argc, char **argv)
|
||||
frequencyshift *= pow(2.0, pitchshift / 12);
|
||||
}
|
||||
|
||||
struct timeval tv;
|
||||
(void)gettimeofday(&tv, 0);
|
||||
|
||||
RubberBandStretcher::setDefaultDebugLevel(debug);
|
||||
|
||||
RubberBandStretcher ts(sfinfo.samplerate, channels, options,
|
||||
@@ -251,9 +254,6 @@ int main(int argc, char **argv)
|
||||
int frame = 0;
|
||||
int percent = 0;
|
||||
|
||||
struct timeval tv;
|
||||
(void)gettimeofday(&tv, 0);
|
||||
|
||||
if (!realtime) {
|
||||
|
||||
if (!quiet) {
|
||||
|
||||
Reference in New Issue
Block a user