summaryrefslogtreecommitdiff
path: root/apps/codecs
diff options
context:
space:
mode:
authorMohamed Tarek <mt@rockbox.org>2010-02-15 00:04:33 +0000
committerMohamed Tarek <mt@rockbox.org>2010-02-15 00:04:33 +0000
commit1bef4c66501893b4b7e154979a80f5386cbe964f (patch)
tree0b190cc139ee08b52c036d5db68b2a3a680c9dd2 /apps/codecs
parentb540be8f4b5b168cbdd86e2d5b38f0b2917d1c86 (diff)
downloadrockbox-1bef4c66501893b4b7e154979a80f5386cbe964f.tar.gz
rockbox-1bef4c66501893b4b7e154979a80f5386cbe964f.zip
revert last commit (r24660). There was a mistake in the location of the
shifts leading to a deteriorated sound quality for some samples. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24662 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs')
-rw-r--r--apps/codecs/libatrac/atrac3.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/apps/codecs/libatrac/atrac3.c b/apps/codecs/libatrac/atrac3.c
index 157aff57f7..467f42f161 100644
--- a/apps/codecs/libatrac/atrac3.c
+++ b/apps/codecs/libatrac/atrac3.c
@@ -410,19 +410,13 @@ 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. */
419 if((first/256) &1) { 413 if((first/256) &1) {
420 /* Odd band - Reverse coefficients */ 414 /* Odd band - Reverse coefficients */
421 for (pIn=mantissas ; last>first; last--, pIn++) 415 for (pIn=mantissas ; last>first; last--, pIn++)
422 pOut[last] = fixmul16(*pIn, SF) << 2; 416 pOut[last] = fixmul16(*pIn, SF);
423 } else { 417 } else {
424 for (pIn=mantissas ; first<last; first++, pIn++) 418 for (pIn=mantissas ; first<last; first++, pIn++)
425 pOut[first] = fixmul16(*pIn, SF) << 2; 419 pOut[first] = fixmul16(*pIn, SF);
426 } 420 }
427 421
428 } else { 422 } else {
@@ -783,6 +777,16 @@ static int decodeChannelSoundUnit (GetBitContext *gb, channel_unit *pSnd, int32_
783 numBands = (subbandTab[numSubbands] - 1) >> 8; 777 numBands = (subbandTab[numSubbands] - 1) >> 8;
784 if (lastTonal >= 0) 778 if (lastTonal >= 0)
785 numBands = FFMAX((lastTonal + 256) >> 8, numBands); 779 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 }
786 790
787 /* Reconstruct time domain samples. */ 791 /* Reconstruct time domain samples. */
788 for (band=0; band<4; band++) { 792 for (band=0; band<4; band++) {