diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-02-15 13:14:43 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-02-15 13:14:43 +0000 |
commit | ad1ba429b98b2f4803a5113a094812091d229c3f (patch) | |
tree | 37b8e8e8dbd806b7edf7fe4d2a34adfb8ec6bea8 /apps | |
parent | 9bea3493828db1cafa54a8dafd3488e371dc7b41 (diff) |
Minor speed up of atrac3 codec. Applying 2 bits fract part to scalefactors instead of brute force adding it to the full spectrum. Move decodeSpectrum() to IRAM. Speeds up codec by 1.2 MHz (+2%) on ARM.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24667 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/codecs/libatrac/atrac3.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/apps/codecs/libatrac/atrac3.c b/apps/codecs/libatrac/atrac3.c index 5ff3a8587b..18a4f120e1 100644 --- a/apps/codecs/libatrac/atrac3.c +++ b/apps/codecs/libatrac/atrac3.c @@ -374,7 +374,8 @@ static void readQuantSpectralCoeffs (GetBitContext *gb, int selector, int coding * @return outSubbands subband counter, fix for broken specification/files */ -static int decodeSpectrum (GetBitContext *gb, int32_t *pOut) +int decodeSpectrum (GetBitContext *gb, int32_t *pOut) ICODE_ATTR; +int decodeSpectrum (GetBitContext *gb, int32_t *pOut) { int numSubbands, codingMode, cnt, first, last, subbWidth, *pIn; int subband_vlc_index[32], SF_idxs[32]; @@ -408,6 +409,11 @@ static int decodeSpectrum (GetBitContext *gb, int32_t *pOut) /* Decode the scale factor for this subband. */ SF = fixmul31(SFTable_fixed[SF_idxs[cnt]], iMaxQuant_fix[subband_vlc_index[cnt]]); + /* 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 + */ + SF <<= 2; /* Inverse quantize the coefficients. */ if((first/256) &1) { @@ -488,6 +494,11 @@ static int decodeTonalComponents (GetBitContext *gb, tonal_component *pComponent coded_values = FFMIN(max_coded_values,coded_values); scalefactor = fixmul31(SFTable_fixed[sfIndx], iMaxQuant_fix[quant_step_index]); + /* 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 + */ + scalefactor <<= 2; readQuantSpectralCoeffs(gb, quant_step_index, coding_mode, mantissa, coded_values); @@ -790,16 +801,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++) { |