summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioMixer.cpp
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2014-02-28 15:51:47 -0800
committerAndy Hung <hunga@google.com>2014-02-28 17:31:44 -0800
commit3375bde6c6c1821fca3eeb4840774112e26c9a68 (patch)
treeaba09d6bbf9ca0afbc360be7d608ac8d83d2983a /services/audioflinger/AudioMixer.cpp
parent69aed5f0f4a3be3996d1e78a0473e1a72c1547da (diff)
downloadframeworks_av-3375bde6c6c1821fca3eeb4840774112e26c9a68.zip
frameworks_av-3375bde6c6c1821fca3eeb4840774112e26c9a68.tar.gz
frameworks_av-3375bde6c6c1821fca3eeb4840774112e26c9a68.tar.bz2
Use float_from_q19_12 conversion in AudioMixer
Change-Id: Idbe84fb9610c7e636a84468f2e2402a913435ca9 Signed-off-by: Andy Hung <hunga@google.com>
Diffstat (limited to 'services/audioflinger/AudioMixer.cpp')
-rw-r--r--services/audioflinger/AudioMixer.cpp7
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: