diff --git a/source/SoundTouch/TDStretch.cpp b/source/SoundTouch/TDStretch.cpp index f6bb0b5..ac6dc37 100644 --- a/source/SoundTouch/TDStretch.cpp +++ b/source/SoundTouch/TDStretch.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include "STTypes.h" @@ -768,6 +769,12 @@ void TDStretch::overlapStereo(short *output, const short *input) const } } +// Calculates the x having the closest 2^x value for the given value +static int _getClosest2Power(double value) +{ + return (int)(log(value) / log(2.0) + 0.5); +} + /// Calculates overlap period length in samples. /// Integer version rounds overlap length to closest power of 2 @@ -794,7 +801,7 @@ void TDStretch::calculateOverlapLength(int overlapMs) long TDStretch::calcCrossCorrMono(const short *mixingPos, const short *compare) const { long corr; - uint i; + int i; corr = 0; for (i = 1; i < overlapLength; i ++) @@ -809,7 +816,7 @@ long TDStretch::calcCrossCorrMono(const short *mixingPos, const short *compare) long TDStretch::calcCrossCorrStereo(const short *mixingPos, const short *compare) const { long corr; - uint i; + int i; corr = 0; for (i = 2; i < 2 * overlapLength; i += 2) diff --git a/source/SoundTouch/TDStretch.h b/source/SoundTouch/TDStretch.h index d16d495..129e568 100644 --- a/source/SoundTouch/TDStretch.h +++ b/source/SoundTouch/TDStretch.h @@ -104,6 +104,8 @@ protected: int seekLength; int seekWindowLength; int maxOffset; + int overlapDividerBits; + int slopingDivider; float nominalSkip; float skipFract; FIFOSampleBuffer outputBuffer; diff --git a/source/SoundTouch/mmx_optimized.cpp b/source/SoundTouch/mmx_optimized.cpp index f5a1445..cf5e4e0 100644 --- a/source/SoundTouch/mmx_optimized.cpp +++ b/source/SoundTouch/mmx_optimized.cpp @@ -77,7 +77,7 @@ long TDStretchMMX::calcCrossCorrStereo(const short *pV1, const short *pV2) const __m64 shifter; __m64 accu; long corr; - uint i; + int i; pVec1 = (__m64*)pV1; pVec2 = (__m64*)pV2; @@ -139,7 +139,7 @@ void TDStretchMMX::overlapStereo(short *output, const short *input) const const __m64 *pVinput, *pVMidBuf; __m64 *pVdest; __m64 mix1, mix2, adder, shifter; - uint i; + int i; pVinput = (const __m64*)input; pVMidBuf = (const __m64*)pMidBuffer;