Merge from default branch

This commit is contained in:
Chris Cannam
2020-10-21 09:07:44 +01:00
15 changed files with 77 additions and 27 deletions

View File

@@ -466,6 +466,10 @@ RubberBandStretcher::Impl::calculateSizes()
outputIncrement /= 2;
inputIncrement = int(outputIncrement / r);
}
while (inputIncrement < 1) {
outputIncrement *= 2;
inputIncrement = int(outputIncrement / r);
}
size_t minwin = roundUp(lrint(outputIncrement * windowIncrRatio));
if (windowSize < minwin) windowSize = minwin;
@@ -501,6 +505,10 @@ RubberBandStretcher::Impl::calculateSizes()
outputIncrement /= 2;
inputIncrement = int(outputIncrement / r);
}
while (inputIncrement < 1) {
outputIncrement *= 2;
inputIncrement = int(outputIncrement / r);
}
windowSize = std::max(windowSize, roundUp(outputIncrement * 6));
if (r > 5) while (windowSize < 8192) windowSize *= 2;
}

View File

@@ -42,7 +42,7 @@ HighFrequencyAudioCurve::reset()
}
float
HighFrequencyAudioCurve::processFloat(const float *R__ mag, int increment)
HighFrequencyAudioCurve::processFloat(const float *R__ mag, int)
{
float result = 0.0;
@@ -56,7 +56,7 @@ HighFrequencyAudioCurve::processFloat(const float *R__ mag, int increment)
}
double
HighFrequencyAudioCurve::processDouble(const double *R__ mag, int increment)
HighFrequencyAudioCurve::processDouble(const double *R__ mag, int)
{
float result = 0.0;

View File

@@ -58,7 +58,7 @@ PercussiveAudioCurve::setFftSize(int newSize)
}
float
PercussiveAudioCurve::processFloat(const float *R__ mag, int increment)
PercussiveAudioCurve::processFloat(const float *R__ mag, int)
{
static float threshold = powf(10.f, 0.15f); // 3dB rise in square of magnitude
static float zeroThresh = powf(10.f, -8);
@@ -84,7 +84,7 @@ PercussiveAudioCurve::processFloat(const float *R__ mag, int increment)
}
double
PercussiveAudioCurve::processDouble(const double *R__ mag, int increment)
PercussiveAudioCurve::processDouble(const double *R__ mag, int)
{
static double threshold = pow(10., 0.15); // 3dB rise in square of magnitude
static double zeroThresh = pow(10., -8);

View File

@@ -62,7 +62,7 @@ SpectralDifferenceAudioCurve::setFftSize(int newSize)
}
float
SpectralDifferenceAudioCurve::processFloat(const float *R__ mag, int increment)
SpectralDifferenceAudioCurve::processFloat(const float *R__ mag, int)
{
double result = 0.0;
@@ -83,7 +83,7 @@ SpectralDifferenceAudioCurve::processFloat(const float *R__ mag, int increment)
}
double
SpectralDifferenceAudioCurve::processDouble(const double *R__ mag, int increment)
SpectralDifferenceAudioCurve::processDouble(const double *R__ mag, int)
{
double result = 0.0;

View File

@@ -718,7 +718,7 @@ D_SRC::resampleInterleaved(const float *const R__ in,
{
SRC_DATA data;
int outcount = lrintf(ceilf(incount * ratio));
int outcount = lrintf(ceilf(incount * ratio) + 10);
data.data_in = const_cast<float *>(in);
data.data_out = out;
@@ -1209,11 +1209,11 @@ Resampler::Resampler(Resampler::Quality quality, int channels,
#ifdef HAVE_LIBRESAMPLE
m_method = 3;
#endif
#ifdef HAVE_LIBSAMPLERATE
m_method = 1;
#endif
#ifdef USE_SPEEX
m_method = 2;
#endif
#ifdef HAVE_LIBSAMPLERATE
m_method = 1;
#endif
break;

View File

@@ -271,9 +271,13 @@ T **reallocate_channels(T **ptr,
{
T **newptr = allocate_channels<T>(channels, count);
if (oldcount && ptr) {
v_copy_channels(newptr, ptr, channels, oldcount < count ? oldcount : count);
for (size_t c = 0; c < oldchannels && c < channels; ++c) {
for (size_t i = 0; i < oldcount && i < count; ++i) {
newptr[c][i] = ptr[c][i];
}
}
}
if (ptr) deallocate_channels<T>(ptr, channels);
if (ptr) deallocate_channels<T>(ptr, oldchannels);
return newptr;
}
@@ -284,9 +288,13 @@ T **reallocate_and_zero_extend_channels(T **ptr,
{
T **newptr = allocate_and_zero_channels<T>(channels, count);
if (oldcount && ptr) {
v_copy_channels(newptr, ptr, channels, oldcount < count ? oldcount : count);
for (size_t c = 0; c < oldchannels && c < channels; ++c) {
for (size_t i = 0; i < oldcount && i < count; ++i) {
newptr[c][i] = ptr[c][i];
}
}
}
if (ptr) deallocate_channels<T>(ptr, channels);
if (ptr) deallocate_channels<T>(ptr, oldchannels);
return newptr;
}

View File

@@ -200,7 +200,11 @@ Mutex::trylock()
}
}
Condition::Condition(string name) :
Condition::Condition(string
#ifdef DEBUG_CONDITION
name
#endif
) :
m_locked(false)
#ifdef DEBUG_CONDITION
, m_name(name)
@@ -456,7 +460,11 @@ Mutex::trylock()
}
}
Condition::Condition(string name) :
Condition::Condition(string
#ifdef DEBUG_CONDITION
name
#endif
) :
m_locked(false)
#ifdef DEBUG_CONDITION
, m_name(name)

View File

@@ -38,6 +38,7 @@
#ifdef HAVE_VDSP
#include <Accelerate/Accelerate.h>
#include <alloca.h>
#endif
#include <cstring>
@@ -521,7 +522,7 @@ template<>
inline void v_log(float *const R__ dst,
const int count)
{
float tmp[count];
float *tmp = (float *)alloca(count * sizeof(float));
vvlogf(tmp, dst, &count);
v_copy(dst, tmp, count);
}
@@ -529,7 +530,7 @@ template<>
inline void v_log(double *const R__ dst,
const int count)
{
double tmp[count];
double *tmp = (double *)alloca(count * sizeof(double));
vvlog(tmp, dst, &count);
v_copy(dst, tmp, count);
}
@@ -566,7 +567,7 @@ template<>
inline void v_exp(float *const R__ dst,
const int count)
{
float tmp[count];
float *tmp = (float *)alloca(count * sizeof(float));
vvexpf(tmp, dst, &count);
v_copy(dst, tmp, count);
}
@@ -574,7 +575,7 @@ template<>
inline void v_exp(double *const R__ dst,
const int count)
{
double tmp[count];
double *tmp = (double *)alloca(count * sizeof(double));
vvexp(tmp, dst, &count);
v_copy(dst, tmp, count);
}
@@ -611,7 +612,7 @@ template<>
inline void v_sqrt(float *const R__ dst,
const int count)
{
float tmp[count];
float *tmp = (float *)alloca(count * sizeof(float));
vvsqrtf(tmp, dst, &count);
v_copy(dst, tmp, count);
}
@@ -619,7 +620,7 @@ template<>
inline void v_sqrt(double *const R__ dst,
const int count)
{
double tmp[count];
double *tmp = (double *)alloca(count * sizeof(double));
vvsqrt(tmp, dst, &count);
v_copy(dst, tmp, count);
}
@@ -676,8 +677,10 @@ template<>
inline void v_abs(float *const R__ dst,
const int count)
{
float tmp[count];
#if (defined(MACOSX_DEPLOYMENT_TARGET) && MACOSX_DEPLOYMENT_TARGET <= 1070 && MAC_OS_X_VERSION_MIN_REQUIRED <= 1070)
float *tmp = (float *)alloca(count * sizeof(float));
#if TARGET_OS_IPHONE
vvfabsf(tmp, dst, &count);
#elif (defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
vvfabf(tmp, dst, &count);
#else
vvfabsf(tmp, dst, &count);