summaryrefslogtreecommitdiffstats
path: root/media/libmedia
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2011-01-29 09:32:05 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-01-29 09:32:05 -0800
commitcc2915c0b1608933819aa284788dbdb184fe9823 (patch)
treeba6c3b5b023f990dc84ab5608199d73dd5c1919b /media/libmedia
parent1ac6d08a05aac04f9a5bcc365a9d61244e932767 (diff)
parentc929677e017759047d94599faa1b80ebe278fefb (diff)
downloadframeworks_base-cc2915c0b1608933819aa284788dbdb184fe9823.zip
frameworks_base-cc2915c0b1608933819aa284788dbdb184fe9823.tar.gz
frameworks_base-cc2915c0b1608933819aa284788dbdb184fe9823.tar.bz2
am c929677e: Merge "Increase the number of useful bits in the spectrum." into gingerbread
* commit 'c929677e017759047d94599faa1b80ebe278fefb': Increase the number of useful bits in the spectrum.
Diffstat (limited to 'media/libmedia')
-rw-r--r--media/libmedia/Visualizer.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/media/libmedia/Visualizer.cpp b/media/libmedia/Visualizer.cpp
index a660429..43571cf 100644
--- a/media/libmedia/Visualizer.cpp
+++ b/media/libmedia/Visualizer.cpp
@@ -219,8 +219,13 @@ status_t Visualizer::doFft(uint8_t *fft, uint8_t *waveform)
}
for (uint32_t i = 0; i < mCaptureSize; i += 2) {
- fft[i] = workspace[i >> 1] >> 24;
- fft[i + 1] = workspace[i >> 1] >> 8;
+ short tmp = workspace[i >> 1] >> 21;
+ while (tmp > 127 || tmp < -128) tmp >>= 1;
+ fft[i] = tmp;
+ tmp = workspace[i >> 1];
+ tmp >>= 5;
+ while (tmp > 127 || tmp < -128) tmp >>= 1;
+ fft[i + 1] = tmp;
}
return NO_ERROR;