* 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
|
distclean: clean
|
||||||
rm -f $(PROGRAM_TARGET) $(STATIC_TARGET) $(DYNAMIC_TARGET) $(VAMP_TARGET) $(LADSPA_TARGET)
|
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
|
||||||
|
|||||||
48
src/FFT.cpp
48
src/FFT.cpp
@@ -13,6 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "FFT.h"
|
#include "FFT.h"
|
||||||
|
#include "Thread.h"
|
||||||
|
|
||||||
|
|
||||||
#include <fftw3.h>
|
#include <fftw3.h>
|
||||||
@@ -23,6 +24,8 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
namespace RubberBand {
|
||||||
|
|
||||||
class FFTImpl
|
class FFTImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -52,22 +55,27 @@ public:
|
|||||||
class D_FFTW : public FFTImpl
|
class D_FFTW : public FFTImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
D_FFTW(unsigned int size) : m_size(size), m_fplanf(0), m_dplanf(0) {
|
D_FFTW(unsigned int size) : m_size(size), m_fplanf(0), m_dplanf(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
~D_FFTW() {
|
~D_FFTW() {
|
||||||
if (m_fplanf) {
|
if (m_fplanf) {
|
||||||
//!!! shouldn't do this every time, but only when the last one
|
bool save = false;
|
||||||
// is destroyed (likewise shouldn't load every time) -- want
|
m_extantMutex.lock();
|
||||||
// a static refcount + mutex
|
if (m_extantf > 0 && --m_extantf == 0) save = true;
|
||||||
saveWisdom('f');
|
m_extantMutex.unlock();
|
||||||
|
if (save) saveWisdom('f');
|
||||||
fftwf_destroy_plan(m_fplanf);
|
fftwf_destroy_plan(m_fplanf);
|
||||||
fftwf_destroy_plan(m_fplani);
|
fftwf_destroy_plan(m_fplani);
|
||||||
fftwf_free(m_fbuf);
|
fftwf_free(m_fbuf);
|
||||||
fftwf_free(m_fpacked);
|
fftwf_free(m_fpacked);
|
||||||
}
|
}
|
||||||
if (m_dplanf) {
|
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_dplanf);
|
||||||
fftw_destroy_plan(m_dplani);
|
fftw_destroy_plan(m_dplani);
|
||||||
fftw_free(m_dbuf);
|
fftw_free(m_dbuf);
|
||||||
@@ -75,11 +83,13 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//!!! check return values
|
|
||||||
|
|
||||||
void initFloat() {
|
void initFloat() {
|
||||||
if (m_fplanf) return;
|
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_fbuf = (float *)fftw_malloc(m_size * sizeof(float));
|
||||||
m_fpacked = (fftwf_complex *)fftw_malloc
|
m_fpacked = (fftwf_complex *)fftw_malloc
|
||||||
((m_size/2 + 1) * sizeof(fftwf_complex));
|
((m_size/2 + 1) * sizeof(fftwf_complex));
|
||||||
@@ -91,7 +101,11 @@ public:
|
|||||||
|
|
||||||
void initDouble() {
|
void initDouble() {
|
||||||
if (m_dplanf) return;
|
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_dbuf = (double *)fftw_malloc(m_size * sizeof(double));
|
||||||
m_dpacked = (fftw_complex *)fftw_malloc
|
m_dpacked = (fftw_complex *)fftw_malloc
|
||||||
((m_size/2 + 1) * sizeof(fftw_complex));
|
((m_size/2 + 1) * sizeof(fftw_complex));
|
||||||
@@ -278,8 +292,20 @@ private:
|
|||||||
fftwf_complex *m_fpacked;
|
fftwf_complex *m_fpacked;
|
||||||
double *m_dbuf;
|
double *m_dbuf;
|
||||||
fftw_complex *m_dpacked;
|
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
|
class D_Cross : public FFTImpl
|
||||||
{
|
{
|
||||||
@@ -641,3 +667,5 @@ FFT::tune()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,8 +15,9 @@
|
|||||||
#ifndef _RUBBERBAND_FFT_H_
|
#ifndef _RUBBERBAND_FFT_H_
|
||||||
#define _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
|
* Provide the basic FFT computations we need, using one of a set of
|
||||||
@@ -66,5 +67,7 @@ protected:
|
|||||||
static int m_method;
|
static int m_method;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -237,6 +237,9 @@ int main(int argc, char **argv)
|
|||||||
frequencyshift *= pow(2.0, pitchshift / 12);
|
frequencyshift *= pow(2.0, pitchshift / 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct timeval tv;
|
||||||
|
(void)gettimeofday(&tv, 0);
|
||||||
|
|
||||||
RubberBandStretcher::setDefaultDebugLevel(debug);
|
RubberBandStretcher::setDefaultDebugLevel(debug);
|
||||||
|
|
||||||
RubberBandStretcher ts(sfinfo.samplerate, channels, options,
|
RubberBandStretcher ts(sfinfo.samplerate, channels, options,
|
||||||
@@ -251,9 +254,6 @@ int main(int argc, char **argv)
|
|||||||
int frame = 0;
|
int frame = 0;
|
||||||
int percent = 0;
|
int percent = 0;
|
||||||
|
|
||||||
struct timeval tv;
|
|
||||||
(void)gettimeofday(&tv, 0);
|
|
||||||
|
|
||||||
if (!realtime) {
|
if (!realtime) {
|
||||||
|
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
|
|||||||
Reference in New Issue
Block a user