From 197cd79c6314ac2e14ce94624e21f3c4e38dca7c Mon Sep 17 00:00:00 2001 From: Yamit Mehta Date: Wed, 26 Aug 2015 21:00:40 +0530 Subject: audio: Audio resampler support for 192Khz playback Add support for QTI audio resampler audio: Audio resampler support for 192Khz playback Change-Id: Ia8f24a0874ebf6e16ef7bd1f2759a14f47149875 audio: Add audio mixing support for qti resampler Change-Id: Ib657aa12b2a72323564148c302ff8891e1bb7433 AudioMixer: Extend use of QTI resampler for 44.1Khz sampling rate Change-Id: I2a819dbc9f1e3e280cb4fa79328e331883a3e981 AudioMixer: fill 0s at right place when no more buffers available Change-Id: I50504c5a02eb0c69abfc9b047792b0f6f85b9ce8 audioflinger: add channel count check to use QTI resampler Change-Id: I8f76dd82b72a0dd8b77343e77e0d0545e1be2114 Change-Id: Ia8f24a0874ebf6e16ef7bd1f2759a14f47149875 --- services/audioflinger/AudioMixer.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'services/audioflinger/AudioMixer.cpp') diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp index 8a9a837..27a2f65 100644 --- a/services/audioflinger/AudioMixer.cpp +++ b/services/audioflinger/AudioMixer.cpp @@ -85,6 +85,9 @@ static const bool kUseFloat = true; // Set to default copy buffer size in frames for input processing. static const size_t kCopyBufferFrameCount = 256; +#ifdef QTI_RESAMPLER +#define QTI_RESAMPLER_MAX_SAMPLERATE 192000 +#endif namespace android { // ---------------------------------------------------------------------------- @@ -779,6 +782,13 @@ bool AudioMixer::track_t::setResampler(uint32_t trackSampleRate, uint32_t devSam // but if none exists, it is the channel count (1 for mono). const int resamplerChannelCount = downmixerBufferProvider != NULL ? mMixerChannelCount : channelCount; +#ifdef QTI_RESAMPLER + if ((trackSampleRate <= QTI_RESAMPLER_MAX_SAMPLERATE) && + (trackSampleRate > devSampleRate * 2) && + ((devSampleRate == 48000)||(devSampleRate == 44100))) { + quality = AudioResampler::QTI_QUALITY; + } +#endif ALOGVV("Creating resampler:" " format(%#x) channels(%d) devSampleRate(%u) quality(%d)\n", mMixerInFormat, resamplerChannelCount, devSampleRate, quality); @@ -1644,6 +1654,9 @@ void AudioMixer::process__OneTrack16BitsStereoNoResampling(state_t* state, // Note: In case of later int16_t sink output, // conversion and clamping is done by memcpy_to_i16_from_float(). } while (--outFrames); + //assign fout to out, when no more frames are available, so that 0s + //can be filled at the right place + out = (int32_t *)fout; break; case AUDIO_FORMAT_PCM_16_BIT: if (CC_UNLIKELY(uint32_t(vl) > UNITY_GAIN_INT || uint32_t(vr) > UNITY_GAIN_INT)) { -- cgit v1.1