1
0
Fork 0
forked from len0rd/rockbox

Fix playback of atrac3 joint stereo encoded files. Define the interpolation macro in the right way.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25135 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andree Buschmann 2010-03-12 20:07:28 +00:00
parent 2ac401f486
commit 76e8701626

View file

@ -797,11 +797,11 @@ static int addTonalComponents (int32_t *pSpectrum, int numComponents, tonal_comp
* @param y second input point * @param y second input point
* @param s index of interpolation point (0..7) * @param s index of interpolation point (0..7)
*/ */
/* /* rockbox: Not used anymore. Faster version defined below.
#define INTERPOLATE(x, y, s) ((x*ONE_16) + fixmul16(((s*ONE_16)>>3), (((x) - (y))*ONE_16))) #define INTERPOLATE_FP16(x, y, s) ((x) + fixmul16(((s*ONE_16)>>3), (((y) - (x)))))
*/ */
#define INTERPOLATE(x, y, s) ((((x)<<3) + s*((y)-(x)))<<13) #define INTERPOLATE_FP16(x, y, s) ((x) + ((s*((y)-(x)))>>3))
static void reverseMatrixing(int32_t *su1, int32_t *su2, int *pPrevCode, int *pCurrCode) static void reverseMatrixing(int32_t *su1, int32_t *su2, int *pPrevCode, int *pCurrCode)
{ {
@ -825,7 +825,7 @@ static void reverseMatrixing(int32_t *su1, int32_t *su2, int *pPrevCode, int *pC
for(; nsample < 8; nsample++) { for(; nsample < 8; nsample++) {
c1 = su1[band+nsample]; c1 = su1[band+nsample];
c2 = su2[band+nsample]; c2 = su2[band+nsample];
c2 = fixmul16(c1, INTERPOLATE(mc1_l, mc2_l, nsample)) + fixmul16(c2, INTERPOLATE(mc1_r, mc2_r, nsample)); c2 = fixmul16(c1, INTERPOLATE_FP16(mc1_l, mc2_l, nsample)) + fixmul16(c2, INTERPOLATE_FP16(mc1_r, mc2_r, nsample));
su1[band+nsample] = c2; su1[band+nsample] = c2;
su2[band+nsample] = (c1 << 1) - c2; su2[band+nsample] = (c1 << 1) - c2;
} }
@ -891,8 +891,8 @@ static void channelWeighting (int32_t *su1, int32_t *su2, int *p3)
for(band = 1; band < 4; band++) { for(band = 1; band < 4; band++) {
/* scale the channels by the weights */ /* scale the channels by the weights */
for(nsample = 0; nsample < 8; nsample++) { for(nsample = 0; nsample < 8; nsample++) {
su1[band*256+nsample] = fixmul16(su1[band*256+nsample], INTERPOLATE(w[0][0], w[0][1], nsample)); su1[band*256+nsample] = fixmul16(su1[band*256+nsample], INTERPOLATE_FP16(w[0][0], w[0][1], nsample));
su2[band*256+nsample] = fixmul16(su2[band*256+nsample], INTERPOLATE(w[1][0], w[1][1], nsample)); su2[band*256+nsample] = fixmul16(su2[band*256+nsample], INTERPOLATE_FP16(w[1][0], w[1][1], nsample));
} }
for(; nsample < 256; nsample++) { for(; nsample < 256; nsample++) {