summaryrefslogtreecommitdiffstats
path: root/libs/audioflinger/AudioResamplerSinc.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/audioflinger/AudioResamplerSinc.h')
-rw-r--r--libs/audioflinger/AudioResamplerSinc.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/libs/audioflinger/AudioResamplerSinc.h b/libs/audioflinger/AudioResamplerSinc.h
index 89b9577..e6cb90b 100644
--- a/libs/audioflinger/AudioResamplerSinc.h
+++ b/libs/audioflinger/AudioResamplerSinc.h
@@ -24,19 +24,20 @@
#include "AudioResampler.h"
namespace android {
+
// ----------------------------------------------------------------------------
class AudioResamplerSinc : public AudioResampler {
public:
- AudioResamplerSinc(int bitDepth, int inChannelCount, int32_t sampleRate);
+ AudioResamplerSinc(int bitDepth, int inChannelCount, int32_t sampleRate);
+
+ ~AudioResamplerSinc();
- ~AudioResamplerSinc();
-
virtual void resample(int32_t* out, size_t outFrameCount,
AudioBufferProvider* provider);
private:
void init();
-
+
template<int CHANNELS>
void resample(int32_t* out, size_t outFrameCount,
AudioBufferProvider* provider);
@@ -52,12 +53,12 @@ private:
template<int CHANNELS>
inline void read(int16_t*& impulse, uint32_t& phaseFraction,
- int16_t const* in, size_t inputIndex);
+ int16_t const* in, size_t inputIndex);
int16_t *mState;
int16_t *mImpulse;
int16_t *mRingFull;
-
+
int32_t const * mFirCoefs;
static const int32_t mFirCoefsDown[];
static const int32_t mFirCoefsUp[];
@@ -67,15 +68,15 @@ private:
static const int32_t RESAMPLE_FIR_LERP_INT_BITS = 4;
// we have 16 coefs samples per zero-crossing
- static const int coefsBits = RESAMPLE_FIR_LERP_INT_BITS;
- static const int cShift = kNumPhaseBits - coefsBits;
- static const uint32_t cMask = ((1<<coefsBits)-1) << cShift;
+ static const int coefsBits = RESAMPLE_FIR_LERP_INT_BITS; // 4
+ static const int cShift = kNumPhaseBits - coefsBits; // 26
+ static const uint32_t cMask = ((1<<coefsBits)-1) << cShift; // 0xf<<26 = 3c00 0000
// and we use 15 bits to interpolate between these samples
// this cannot change because the mul below rely on it.
static const int pLerpBits = 15;
- static const int pShift = kNumPhaseBits - coefsBits - pLerpBits;
- static const uint32_t pMask = ((1<<pLerpBits)-1) << pShift;
+ static const int pShift = kNumPhaseBits - coefsBits - pLerpBits; // 11
+ static const uint32_t pMask = ((1<<pLerpBits)-1) << pShift; // 0x7fff << 11
// number of zero-crossing on each side
static const unsigned int halfNumCoefs = RESAMPLE_FIR_NUM_COEF;