summaryrefslogtreecommitdiff
path: root/apps/codecs/libatrac
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libatrac')
-rw-r--r--apps/codecs/libatrac/atrac3.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/apps/codecs/libatrac/atrac3.c b/apps/codecs/libatrac/atrac3.c
index cd49aec348..ac63925ce7 100644
--- a/apps/codecs/libatrac/atrac3.c
+++ b/apps/codecs/libatrac/atrac3.c
@@ -189,23 +189,8 @@ static void iqmf (int32_t *inlo, int32_t *inhi, unsigned int nIn, int32_t *pOut,
189 * @param odd_band 1 if the band is an odd band 189 * @param odd_band 1 if the band is an odd band
190 */ 190 */
191 191
192static void IMLT(int32_t *pInput, int32_t *pOutput, int odd_band) 192static void IMLT(int32_t *pInput, int32_t *pOutput)
193{ 193{
194 int i;
195 if (odd_band) {
196 /**
197 * Reverse the odd bands before IMDCT, this is an effect of the QMF transform
198 * or it gives better compression to do it this way.
199 * FIXME: It should be possible to handle this in ff_imdct_calc
200 * for that to happen a modification of the prerotation step of
201 * all SIMD code and C code is needed.
202 * Or fix the functions before so they generate a pre reversed spectrum.
203 */
204
205 for (i=0; i<128; i++)
206 FFSWAP(int32_t, pInput[i], pInput[255-i]);
207 }
208
209 /* Apply the imdct. */ 194 /* Apply the imdct. */
210 mdct_backward(512, pInput, pOutput); 195 mdct_backward(512, pInput, pOutput);
211 196
@@ -365,8 +350,15 @@ static int decodeSpectrum (GetBitContext *gb, int32_t *pOut)
365 SF = fixmul31(SFTable_fixed[SF_idxs[cnt]], iMaxQuant_fix[subband_vlc_index[cnt]]); 350 SF = fixmul31(SFTable_fixed[SF_idxs[cnt]], iMaxQuant_fix[subband_vlc_index[cnt]]);
366 351
367 /* Inverse quantize the coefficients. */ 352 /* Inverse quantize the coefficients. */
368 for (pIn=mantissas ; first<last; first++, pIn++) 353 if((first/256) &1) {
369 pOut[first] = fixmul16(*pIn, SF); 354 /* Odd band - Reverse coefficients */
355 for (pIn=mantissas ; last>first; last--, pIn++)
356 pOut[last] = fixmul16(*pIn, SF);
357 } else {
358 for (pIn=mantissas ; first<last; first++, pIn++)
359 pOut[first] = fixmul16(*pIn, SF);
360 }
361
370 } else { 362 } else {
371 /* This subband was not coded, so zero the entire subband. */ 363 /* This subband was not coded, so zero the entire subband. */
372 memset(pOut+first, 0, subbWidth*sizeof(int32_t)); 364 memset(pOut+first, 0, subbWidth*sizeof(int32_t));
@@ -740,7 +732,7 @@ static int decodeChannelSoundUnit (GetBitContext *gb, channel_unit *pSnd, int32_
740 for (band=0; band<4; band++) { 732 for (band=0; band<4; band++) {
741 /* Perform the IMDCT step without overlapping. */ 733 /* Perform the IMDCT step without overlapping. */
742 if (band <= numBands) { 734 if (band <= numBands) {
743 IMLT(&(pSnd->spectrum[band*256]), pSnd->IMDCT_buf, band&1); 735 IMLT(&(pSnd->spectrum[band*256]), pSnd->IMDCT_buf);
744 } else 736 } else
745 memset(pSnd->IMDCT_buf, 0, 512 * sizeof(int32_t)); 737 memset(pSnd->IMDCT_buf, 0, 512 * sizeof(int32_t));
746 738