summaryrefslogtreecommitdiffstats
path: root/libaudio
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2010-12-01 09:21:30 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2010-12-01 09:21:30 -0800
commite22db4b8cb8eaec0498b6ca37d677c86a9aec562 (patch)
treef8f202ad0d52a4a55a78e8f097ceebc3ccf603c5 /libaudio
parent5aa04db3766cf5ec4544acd16a4ec7eee4bbc48b (diff)
parent8e8053263ab53b1200d7204f44c6a480e5459862 (diff)
downloaddevice_samsung_crespo-e22db4b8cb8eaec0498b6ca37d677c86a9aec562.zip
device_samsung_crespo-e22db4b8cb8eaec0498b6ca37d677c86a9aec562.tar.gz
device_samsung_crespo-e22db4b8cb8eaec0498b6ca37d677c86a9aec562.tar.bz2
am 8e805326: am ee0ab929: Fix issue 3198397
* commit '8e8053263ab53b1200d7204f44c6a480e5459862': Fix issue 3198397
Diffstat (limited to 'libaudio')
-rw-r--r--libaudio/AudioHardware.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/libaudio/AudioHardware.cpp b/libaudio/AudioHardware.cpp
index 716f545..7a39d93 100644
--- a/libaudio/AudioHardware.cpp
+++ b/libaudio/AudioHardware.cpp
@@ -1793,16 +1793,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;