diff options
author | Andy Hung <hunga@google.com> | 2014-03-01 01:54:57 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-03-01 01:54:57 +0000 |
commit | 7ed1873acbf43280c5afe51833c3d628fe34e258 (patch) | |
tree | 6b52a5bf289ac63ae3c50fc472afba2756a5cc6e /services | |
parent | 52d623d44989a8f6b463d7d03c180df7011bc662 (diff) | |
parent | 3375bde6c6c1821fca3eeb4840774112e26c9a68 (diff) | |
download | frameworks_av-7ed1873acbf43280c5afe51833c3d628fe34e258.zip frameworks_av-7ed1873acbf43280c5afe51833c3d628fe34e258.tar.gz frameworks_av-7ed1873acbf43280c5afe51833c3d628fe34e258.tar.bz2 |
Merge "Use float_from_q19_12 conversion in AudioMixer"
Diffstat (limited to 'services')
-rw-r--r-- | services/audioflinger/AudioMixer.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp index f00b82a..bfa0f38 100644 --- a/services/audioflinger/AudioMixer.cpp +++ b/services/audioflinger/AudioMixer.cpp @@ -1325,14 +1325,15 @@ void AudioMixer::process__OneTrack16BitsStereoNoResampling(state_t* state, switch (t.mSinkFormat) { case AUDIO_FORMAT_PCM_FLOAT: { float *fout = reinterpret_cast<float*>(out); - static float scale = 1. / (32768. * 4096.); // exact when inverted do { uint32_t rl = *reinterpret_cast<const uint32_t *>(in); in += 2; int32_t l = mulRL(1, rl, vrl); int32_t r = mulRL(0, rl, vrl); - *fout++ = static_cast<float>(l) * scale; - *fout++ = static_cast<float>(r) * scale; + *fout++ = float_from_q19_12(l); + *fout++ = float_from_q19_12(r); + // Note: In case of later int16_t sink output, + // conversion and clamping is done by memcpy_to_i16_from_float(). } while (--outFrames); } break; case AUDIO_FORMAT_PCM_16_BIT: |