diff options
author | Eric Laurent <elaurent@google.com> | 2010-11-30 18:54:27 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-11-30 18:54:27 -0800 |
commit | 8e8053263ab53b1200d7204f44c6a480e5459862 (patch) | |
tree | 93ff864977267181d9252e0bf9e85e13bfbcad41 /libaudio | |
parent | 3f7ec3645a6efb05234fb9fcd48f65dd67dfc02e (diff) | |
parent | ee0ab9299099b9f5e0e3577ffe407ae2e8be2455 (diff) | |
download | device_samsung_crespo-8e8053263ab53b1200d7204f44c6a480e5459862.zip device_samsung_crespo-8e8053263ab53b1200d7204f44c6a480e5459862.tar.gz device_samsung_crespo-8e8053263ab53b1200d7204f44c6a480e5459862.tar.bz2 |
am ee0ab929: Fix issue 3198397
* commit 'ee0ab9299099b9f5e0e3577ffe407ae2e8be2455':
Fix issue 3198397
Diffstat (limited to 'libaudio')
-rw-r--r-- | libaudio/AudioHardware.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libaudio/AudioHardware.cpp b/libaudio/AudioHardware.cpp index 10409a1..4cca932 100644 --- a/libaudio/AudioHardware.cpp +++ b/libaudio/AudioHardware.cpp @@ -1771,16 +1771,17 @@ void resample_441_320(int16_t* input, int16_t* output, int* num_samples_in, int* } const float step_float = (float)RESAMPLE_16KHZ_SAMPLES_IN / (float)RESAMPLE_16KHZ_SAMPLES_OUT; + const uint32_t step = (uint32_t)(step_float * 32768.0f + 0.5f); // 17.15 fixed point - uint32_t in_sample_num = 0; // 16.16 fixed point - const uint32_t step = (uint32_t)(step_float * 65536.0f + 0.5f); // 16.16 fixed point + uint32_t in_sample_num = 0; // 17.15 fixed point for (int j = 0; j < RESAMPLE_16KHZ_SAMPLES_OUT; ++j, in_sample_num += step) { - const uint32_t whole = in_sample_num >> 16; - const uint32_t frac = (in_sample_num & 0xffff); // 0.16 fixed point + const uint32_t whole = in_sample_num >> 15; + const uint32_t frac = (in_sample_num & 0x7fff); // 0.15 fixed point const int32_t s1 = tmp[whole]; const int32_t s2 = tmp[whole + 1]; - *output++ = clip(s1 + (((s2 - s1) * (int32_t)frac) >> 16)); + *output++ = clip(s1 + (((s2 - s1) * (int32_t)frac) >> 15)); } + } const int samples_consumed = num_blocks * RESAMPLE_16KHZ_SAMPLES_IN; |