diff options
author | Glenn Kasten <gkasten@google.com> | 2012-07-19 14:02:22 -0700 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2012-07-23 10:56:34 -0700 |
commit | 69d799679c8c0308e42057e7b5ad63a7ae806480 (patch) | |
tree | fd433daeb23326b7818031fcca0f8b87f77dbc3e /services | |
parent | f1b3ee26cafc80900bae681bddf47446a6a3733f (diff) | |
download | frameworks_av-69d799679c8c0308e42057e7b5ad63a7ae806480.zip frameworks_av-69d799679c8c0308e42057e7b5ad63a7ae806480.tar.gz frameworks_av-69d799679c8c0308e42057e7b5ad63a7ae806480.tar.bz2 |
Use upmix/downmix utility routines
Change-Id: I9ae2ec938fb695ec576ea008a42205325af7bbf1
Diffstat (limited to 'services')
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index 424d8bc..5e29f3b 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -6012,18 +6012,12 @@ bool AudioFlinger::RecordThread::threadLoop() mFormat != AUDIO_FORMAT_PCM_16_BIT) { memcpy(dst, src, framesIn * mFrameSize); } else { - int16_t *src16 = (int16_t *)src; - int16_t *dst16 = (int16_t *)dst; if (mChannelCount == 1) { - while (framesIn--) { - *dst16++ = *src16; - *dst16++ = *src16++; - } + upmix_to_stereo_i16_from_mono_i16((int16_t *)dst, + (int16_t *)src, framesIn); } else { - while (framesIn--) { - *dst16++ = (int16_t)(((int32_t)*src16 + (int32_t)*(src16 + 1)) >> 1); - src16 += 2; - } + downmix_to_mono_i16_from_stereo_i16((int16_t *)dst, + (int16_t *)src, framesIn); } } } @@ -6064,12 +6058,8 @@ bool AudioFlinger::RecordThread::threadLoop() if (mChannelCount == 2 && mReqChannelCount == 1) { ditherAndClamp(mRsmpOutBuffer, mRsmpOutBuffer, framesOut); // the resampler always outputs stereo samples: do post stereo to mono conversion - int16_t *src = (int16_t *)mRsmpOutBuffer; - int16_t *dst = buffer.i16; - while (framesOut--) { - *dst++ = (int16_t)(((int32_t)*src + (int32_t)*(src + 1)) >> 1); - src += 2; - } + downmix_to_mono_i16_from_stereo_i16(buffer.i16, (int16_t *)mRsmpOutBuffer, + framesOut); } else { ditherAndClamp((int32_t *)buffer.raw, mRsmpOutBuffer, framesOut); } |