summaryrefslogtreecommitdiff
path: root/apps/codecs
diff options
context:
space:
mode:
authorMohamed Tarek <mt@rockbox.org>2010-02-14 23:41:32 +0000
committerMohamed Tarek <mt@rockbox.org>2010-02-14 23:41:32 +0000
commitb540be8f4b5b168cbdd86e2d5b38f0b2917d1c86 (patch)
tree30c6d2a2e932b2ff9a427d582292bdb8fa3cab8c /apps/codecs
parent7074a64d8aa7030543832ab2e59885fd16e34adb (diff)
downloadrockbox-b540be8f4b5b168cbdd86e2d5b38f0b2917d1c86.zip
rockbox-b540be8f4b5b168cbdd86e2d5b38f0b2917d1c86.tar.gz
rockbox-b540be8f4b5b168cbdd86e2d5b38f0b2917d1c86.tar.bz2
rockbox-b540be8f4b5b168cbdd86e2d5b38f0b2917d1c86.tar.xz
Fold a 2-bit shift into decodeSpectrum(), saves 1MHz on ARM, +2%
speedup. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24660 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs')
-rw-r--r--apps/codecs/libatrac/atrac3.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/apps/codecs/libatrac/atrac3.c b/apps/codecs/libatrac/atrac3.c
index 467f42f..157aff5 100644
--- a/apps/codecs/libatrac/atrac3.c
+++ b/apps/codecs/libatrac/atrac3.c
@@ -410,13 +410,19 @@ static int decodeSpectrum (GetBitContext *gb, int32_t *pOut)
SF = fixmul31(SFTable_fixed[SF_idxs[cnt]], iMaxQuant_fix[subband_vlc_index[cnt]]);
/* Inverse quantize the coefficients. */
+
+ /* Remark: Hardcoded hack to add 2 bits (empty) fract part to internal sample
+ * representation. Needed for higher accuracy in internal calculations as
+ * well as for DSP configuration. See also: ../atrac3_rm.c, DSP_SET_SAMPLE_DEPTH
+ * Todo: Check spectral requantisation for using and outputting samples with
+ * fract part. */
if((first/256) &1) {
/* Odd band - Reverse coefficients */
for (pIn=mantissas ; last>first; last--, pIn++)
- pOut[last] = fixmul16(*pIn, SF);
+ pOut[last] = fixmul16(*pIn, SF) << 2;
} else {
for (pIn=mantissas ; first<last; first++, pIn++)
- pOut[first] = fixmul16(*pIn, SF);
+ pOut[first] = fixmul16(*pIn, SF) << 2;
}
} else {
@@ -777,16 +783,6 @@ static int decodeChannelSoundUnit (GetBitContext *gb, channel_unit *pSnd, int32_
numBands = (subbandTab[numSubbands] - 1) >> 8;
if (lastTonal >= 0)
numBands = FFMAX((lastTonal + 256) >> 8, numBands);
-
- /* Remark: Hardcoded hack to add 2 bits (empty) fract part to internal sample
- * representation. Needed for higher accuracy in internal calculations as
- * well as for DSP configuration. See also: ../atrac3_rm.c, DSP_SET_SAMPLE_DEPTH
- * Todo: Check spectral requantisation for using and outputting samples with
- * fract part. */
- int32_t i;
- for (i=0; i<1024; ++i) {
- pSnd->spectrum[i] <<= 2;
- }
/* Reconstruct time domain samples. */
for (band=0; band<4; band++) {