diff options
author | Glenn Kasten <gkasten@google.com> | 2012-02-02 14:09:43 -0800 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2012-02-09 16:58:07 -0800 |
commit | d8b2e2b9e3885ab5857a8ac3d2a7551aa3c0eefb (patch) | |
tree | dbbe8481e8b0c0e5184d4b779c98dc2e9aef1852 /services | |
parent | f4aaf1f56247289838f4bb25ee704196464be4f2 (diff) | |
download | frameworks_base-d8b2e2b9e3885ab5857a8ac3d2a7551aa3c0eefb.zip frameworks_base-d8b2e2b9e3885ab5857a8ac3d2a7551aa3c0eefb.tar.gz frameworks_base-d8b2e2b9e3885ab5857a8ac3d2a7551aa3c0eefb.tar.bz2 |
Remove aliasing
Code was aliasing mBuffer as buffer, but continuing to use both buffer
and mBuffer after that point. This was at best misleading, and at worst
could confuse the compiler into generating bad code. There was no
performance advantage to the alias, in fact removing it saves 16 bytes.
Change-Id: I55023ddba465d9be82f66745b088d18af658ac60
Diffstat (limited to 'services')
-rw-r--r-- | services/audioflinger/AudioResamplerSinc.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/services/audioflinger/AudioResamplerSinc.cpp b/services/audioflinger/AudioResamplerSinc.cpp index d012433..7a27b81 100644 --- a/services/audioflinger/AudioResamplerSinc.cpp +++ b/services/audioflinger/AudioResamplerSinc.cpp @@ -199,33 +199,32 @@ void AudioResamplerSinc::resample(int32_t* out, size_t outFrameCount, size_t outputSampleCount = outFrameCount * 2; size_t inFrameCount = (outFrameCount*mInSampleRate)/mSampleRate; - AudioBufferProvider::Buffer& buffer(mBuffer); while (outputIndex < outputSampleCount) { // buffer is empty, fetch a new one - while (buffer.frameCount == 0) { - buffer.frameCount = inFrameCount; - provider->getNextBuffer(&buffer); - if (buffer.raw == NULL) { + while (mBuffer.frameCount == 0) { + mBuffer.frameCount = inFrameCount; + provider->getNextBuffer(&mBuffer); + if (mBuffer.raw == NULL) { goto resample_exit; } const uint32_t phaseIndex = phaseFraction >> kNumPhaseBits; if (phaseIndex == 1) { // read one frame - read<CHANNELS>(impulse, phaseFraction, buffer.i16, inputIndex); + read<CHANNELS>(impulse, phaseFraction, mBuffer.i16, inputIndex); } else if (phaseIndex == 2) { // read 2 frames - read<CHANNELS>(impulse, phaseFraction, buffer.i16, inputIndex); + read<CHANNELS>(impulse, phaseFraction, mBuffer.i16, inputIndex); inputIndex++; if (inputIndex >= mBuffer.frameCount) { inputIndex -= mBuffer.frameCount; - provider->releaseBuffer(&buffer); + provider->releaseBuffer(&mBuffer); } else { - read<CHANNELS>(impulse, phaseFraction, buffer.i16, inputIndex); + read<CHANNELS>(impulse, phaseFraction, mBuffer.i16, inputIndex); } } } - int16_t *in = buffer.i16; - const size_t frameCount = buffer.frameCount; + int16_t *in = mBuffer.i16; + const size_t frameCount = mBuffer.frameCount; // Always read-in the first samples from the input buffer int16_t* head = impulse + halfNumCoefs*CHANNELS; @@ -264,7 +263,7 @@ void AudioResamplerSinc::resample(int32_t* out, size_t outFrameCount, // if done with buffer, save samples if (inputIndex >= frameCount) { inputIndex -= frameCount; - provider->releaseBuffer(&buffer); + provider->releaseBuffer(&mBuffer); } } |