diff options
author | Mohamed Tarek <mt@rockbox.org> | 2010-02-14 23:41:32 +0000 |
---|---|---|
committer | Mohamed Tarek <mt@rockbox.org> | 2010-02-14 23:41:32 +0000 |
commit | b540be8f4b5b168cbdd86e2d5b38f0b2917d1c86 (patch) | |
tree | 30c6d2a2e932b2ff9a427d582292bdb8fa3cab8c /apps/codecs | |
parent | 7074a64d8aa7030543832ab2e59885fd16e34adb (diff) | |
download | rockbox-b540be8f4b5b168cbdd86e2d5b38f0b2917d1c86.tar.gz rockbox-b540be8f4b5b168cbdd86e2d5b38f0b2917d1c86.zip |
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.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/apps/codecs/libatrac/atrac3.c b/apps/codecs/libatrac/atrac3.c index 467f42f161..157aff57f7 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) | |||
410 | SF = fixmul31(SFTable_fixed[SF_idxs[cnt]], iMaxQuant_fix[subband_vlc_index[cnt]]); | 410 | SF = fixmul31(SFTable_fixed[SF_idxs[cnt]], iMaxQuant_fix[subband_vlc_index[cnt]]); |
411 | 411 | ||
412 | /* Inverse quantize the coefficients. */ | 412 | /* Inverse quantize the coefficients. */ |
413 | |||
414 | /* Remark: Hardcoded hack to add 2 bits (empty) fract part to internal sample | ||
415 | * representation. Needed for higher accuracy in internal calculations as | ||
416 | * well as for DSP configuration. See also: ../atrac3_rm.c, DSP_SET_SAMPLE_DEPTH | ||
417 | * Todo: Check spectral requantisation for using and outputting samples with | ||
418 | * fract part. */ | ||
413 | if((first/256) &1) { | 419 | if((first/256) &1) { |
414 | /* Odd band - Reverse coefficients */ | 420 | /* Odd band - Reverse coefficients */ |
415 | for (pIn=mantissas ; last>first; last--, pIn++) | 421 | for (pIn=mantissas ; last>first; last--, pIn++) |
416 | pOut[last] = fixmul16(*pIn, SF); | 422 | pOut[last] = fixmul16(*pIn, SF) << 2; |
417 | } else { | 423 | } else { |
418 | for (pIn=mantissas ; first<last; first++, pIn++) | 424 | for (pIn=mantissas ; first<last; first++, pIn++) |
419 | pOut[first] = fixmul16(*pIn, SF); | 425 | pOut[first] = fixmul16(*pIn, SF) << 2; |
420 | } | 426 | } |
421 | 427 | ||
422 | } else { | 428 | } else { |
@@ -777,16 +783,6 @@ static int decodeChannelSoundUnit (GetBitContext *gb, channel_unit *pSnd, int32_ | |||
777 | numBands = (subbandTab[numSubbands] - 1) >> 8; | 783 | numBands = (subbandTab[numSubbands] - 1) >> 8; |
778 | if (lastTonal >= 0) | 784 | if (lastTonal >= 0) |
779 | numBands = FFMAX((lastTonal + 256) >> 8, numBands); | 785 | numBands = FFMAX((lastTonal + 256) >> 8, numBands); |
780 | |||
781 | /* Remark: Hardcoded hack to add 2 bits (empty) fract part to internal sample | ||
782 | * representation. Needed for higher accuracy in internal calculations as | ||
783 | * well as for DSP configuration. See also: ../atrac3_rm.c, DSP_SET_SAMPLE_DEPTH | ||
784 | * Todo: Check spectral requantisation for using and outputting samples with | ||
785 | * fract part. */ | ||
786 | int32_t i; | ||
787 | for (i=0; i<1024; ++i) { | ||
788 | pSnd->spectrum[i] <<= 2; | ||
789 | } | ||
790 | 786 | ||
791 | /* Reconstruct time domain samples. */ | 787 | /* Reconstruct time domain samples. */ |
792 | for (band=0; band<4; band++) { | 788 | for (band=0; band<4; band++) { |