diff options
Diffstat (limited to 'apps/codecs')
-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 | |||
374 | * @return outSubbands subband counter, fix for broken specification/files | 374 | * @return outSubbands subband counter, fix for broken specification/files |
375 | */ | 375 | */ |
376 | 376 | ||
377 | static int decodeSpectrum (GetBitContext *gb, int32_t *pOut) | 377 | int decodeSpectrum (GetBitContext *gb, int32_t *pOut) ICODE_ATTR; |
378 | int decodeSpectrum (GetBitContext *gb, int32_t *pOut) | ||
378 | { | 379 | { |
379 | int numSubbands, codingMode, cnt, first, last, subbWidth, *pIn; | 380 | int numSubbands, codingMode, cnt, first, last, subbWidth, *pIn; |
380 | int subband_vlc_index[32], SF_idxs[32]; | 381 | int subband_vlc_index[32], SF_idxs[32]; |
@@ -408,6 +409,11 @@ static int decodeSpectrum (GetBitContext *gb, int32_t *pOut) | |||
408 | 409 | ||
409 | /* Decode the scale factor for this subband. */ | 410 | /* Decode the scale factor for this subband. */ |
410 | SF = fixmul31(SFTable_fixed[SF_idxs[cnt]], iMaxQuant_fix[subband_vlc_index[cnt]]); | 411 | SF = fixmul31(SFTable_fixed[SF_idxs[cnt]], iMaxQuant_fix[subband_vlc_index[cnt]]); |
412 | /* Remark: Hardcoded hack to add 2 bits (empty) fract part to internal sample | ||
413 | * representation. Needed for higher accuracy in internal calculations as | ||
414 | * well as for DSP configuration. See also: ../atrac3_rm.c, DSP_SET_SAMPLE_DEPTH | ||
415 | */ | ||
416 | SF <<= 2; | ||
411 | 417 | ||
412 | /* Inverse quantize the coefficients. */ | 418 | /* Inverse quantize the coefficients. */ |
413 | if((first/256) &1) { | 419 | if((first/256) &1) { |
@@ -488,6 +494,11 @@ static int decodeTonalComponents (GetBitContext *gb, tonal_component *pComponent | |||
488 | coded_values = FFMIN(max_coded_values,coded_values); | 494 | coded_values = FFMIN(max_coded_values,coded_values); |
489 | 495 | ||
490 | scalefactor = fixmul31(SFTable_fixed[sfIndx], iMaxQuant_fix[quant_step_index]); | 496 | scalefactor = fixmul31(SFTable_fixed[sfIndx], iMaxQuant_fix[quant_step_index]); |
497 | /* Remark: Hardcoded hack to add 2 bits (empty) fract part to internal sample | ||
498 | * representation. Needed for higher accuracy in internal calculations as | ||
499 | * well as for DSP configuration. See also: ../atrac3_rm.c, DSP_SET_SAMPLE_DEPTH | ||
500 | */ | ||
501 | scalefactor <<= 2; | ||
491 | 502 | ||
492 | readQuantSpectralCoeffs(gb, quant_step_index, coding_mode, mantissa, coded_values); | 503 | readQuantSpectralCoeffs(gb, quant_step_index, coding_mode, mantissa, coded_values); |
493 | 504 | ||
@@ -790,16 +801,6 @@ static int decodeChannelSoundUnit (GetBitContext *gb, channel_unit *pSnd, int32_ | |||
790 | numBands = (subbandTab[numSubbands] - 1) >> 8; | 801 | numBands = (subbandTab[numSubbands] - 1) >> 8; |
791 | if (lastTonal >= 0) | 802 | if (lastTonal >= 0) |
792 | numBands = FFMAX((lastTonal + 256) >> 8, numBands); | 803 | numBands = FFMAX((lastTonal + 256) >> 8, numBands); |
793 | |||
794 | /* Remark: Hardcoded hack to add 2 bits (empty) fract part to internal sample | ||
795 | * representation. Needed for higher accuracy in internal calculations as | ||
796 | * well as for DSP configuration. See also: ../atrac3_rm.c, DSP_SET_SAMPLE_DEPTH | ||
797 | * Todo: Check spectral requantisation for using and outputting samples with | ||
798 | * fract part. */ | ||
799 | int32_t i; | ||
800 | for (i=0; i<1024; ++i) { | ||
801 | pSnd->spectrum[i] <<= 2; | ||
802 | } | ||
803 | 804 | ||
804 | /* Reconstruct time domain samples. */ | 805 | /* Reconstruct time domain samples. */ |
805 | for (band=0; band<4; band++) { | 806 | for (band=0; band<4; band++) { |