From 76b111685010e1fea7c0a865c038aee35507fde4 Mon Sep 17 00:00:00 2001 From: SathishKumar Mani Date: Tue, 17 Jan 2012 10:49:47 -0800 Subject: 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 --- services/audioflinger/AudioResamplerSinc.h | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'services/audioflinger/AudioResamplerSinc.h') 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<