Skip to content

Commit c929677

Browse files
marconeAndroid (Google) Code Review
authored andcommitted
Merge "Increase the number of useful bits in the spectrum." into gingerbread
2 parents b134223 + dbc0fe9 commit c929677

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

media/libmedia/Visualizer.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,13 @@ status_t Visualizer::doFft(uint8_t *fft, uint8_t *waveform)
219219
}
220220

221221
for (uint32_t i = 0; i < mCaptureSize; i += 2) {
222-
fft[i] = workspace[i >> 1] >> 24;
223-
fft[i + 1] = workspace[i >> 1] >> 8;
222+
short tmp = workspace[i >> 1] >> 21;
223+
while (tmp > 127 || tmp < -128) tmp >>= 1;
224+
fft[i] = tmp;
225+
tmp = workspace[i >> 1];
226+
tmp >>= 5;
227+
while (tmp > 127 || tmp < -128) tmp >>= 1;
228+
fft[i + 1] = tmp;
224229
}
225230

226231
return NO_ERROR;

0 commit comments

Comments
 (0)