diff options
author | SathishKumar Mani <smani@codeaurora.org> | 2012-01-17 10:49:47 -0800 |
---|---|---|
committer | Iliyan Malchev <malchev@google.com> | 2012-09-26 18:48:44 -0700 |
commit | 76b111685010e1fea7c0a865c038aee35507fde4 (patch) | |
tree | 25a9d24b4cc23476d25cc026ff0888a3ffcf73e8 /services/audioflinger/AudioResamplerSinc.h | |
parent | 12bff5dd87e6b863482e6bfd9f4561078ebcf3f0 (diff) | |
download | frameworks_av-76b111685010e1fea7c0a865c038aee35507fde4.zip frameworks_av-76b111685010e1fea7c0a865c038aee35507fde4.tar.gz frameworks_av-76b111685010e1fea7c0a865c038aee35507fde4.tar.bz2 |
audioflinger: use resample coefficients from audio-resampler library.
-Add a separate quality VERY_HIGH_QUALITY in resampler
-Use resample coefficients audio-resampler library for
quality VERY_HIGH_QUALITY.
-This improves the quality of resampled output.
Bug: 7024293
Change-Id: Ia44142413bed5f5963d7eab7846eec877a2415e4
Signed-off-by: Iliyan Malchev <malchev@google.com>
Diffstat (limited to 'services/audioflinger/AudioResamplerSinc.h')
-rw-r--r-- | services/audioflinger/AudioResamplerSinc.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/services/audioflinger/AudioResamplerSinc.h b/services/audioflinger/AudioResamplerSinc.h index f0a07b8..c53c66d 100644 --- a/services/audioflinger/AudioResamplerSinc.h +++ b/services/audioflinger/AudioResamplerSinc.h @@ -25,11 +25,16 @@ namespace android { + +typedef const int32_t * (*readCoefficientsFn)(bool upDownSample); +typedef int32_t (*readResampleFirNumCoeffFn)(); +typedef int32_t (*readResampleFirLerpIntBitsFn)(); + // ---------------------------------------------------------------------------- class AudioResamplerSinc : public AudioResampler { public: - AudioResamplerSinc(int bitDepth, int inChannelCount, int32_t sampleRate); + AudioResamplerSinc(int bitDepth, int inChannelCount, int32_t sampleRate, int32_t quality = HIGH_QUALITY); virtual ~AudioResamplerSinc(); @@ -55,6 +60,10 @@ private: inline void read(int16_t*& impulse, uint32_t& phaseFraction, const int16_t* in, size_t inputIndex); + readCoefficientsFn mReadResampleCoefficients ; + readResampleFirNumCoeffFn mReadResampleFirNumCoeff; + readResampleFirLerpIntBitsFn mReadResampleFirLerpIntBits; + int16_t *mState; int16_t *mImpulse; int16_t *mRingFull; @@ -63,23 +72,24 @@ private: static const int32_t mFirCoefsDown[]; static const int32_t mFirCoefsUp[]; + void * mResampleCoeffLib; // ---------------------------------------------------------------------------- static const int32_t RESAMPLE_FIR_NUM_COEF = 8; 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; // 4 - static const int cShift = kNumPhaseBits - coefsBits; // 26 - static const uint32_t cMask = ((1<<coefsBits)-1) << cShift; // 0xf<<26 = 3c00 0000 + static int coefsBits; + static int cShift; + static uint32_t cMask; // 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; // 11 - static const uint32_t pMask = ((1<<pLerpBits)-1) << pShift; // 0x7fff << 11 + static int pShift; + static uint32_t pMask; // number of zero-crossing on each side - static const unsigned int halfNumCoefs = RESAMPLE_FIR_NUM_COEF; + static unsigned int halfNumCoefs; }; // ---------------------------------------------------------------------------- |