author | harlekin <harlekin> | 2002-04-19 16:08:55 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-04-19 16:08:55 (UTC) |
commit | 7ea4abeb652e6787e57a938e1ca028d25fd249ce (patch) (unidiff) | |
tree | ee08f2d9d6aaa8adb1c5f07f4124da8a61eb8cd5 /core/multimedia/opieplayer/libmad/layer3.c | |
parent | caa7ced77b9014526607f9f65c58aabe7e0ba631 (diff) | |
download | opie-7ea4abeb652e6787e57a938e1ca028d25fd249ce.zip opie-7ea4abeb652e6787e57a938e1ca028d25fd249ce.tar.gz opie-7ea4abeb652e6787e57a938e1ca028d25fd249ce.tar.bz2 |
new libmad version, less cpu usage
Diffstat (limited to 'core/multimedia/opieplayer/libmad/layer3.c') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/libmad/layer3.c | 146 |
1 files changed, 78 insertions, 68 deletions
diff --git a/core/multimedia/opieplayer/libmad/layer3.c b/core/multimedia/opieplayer/libmad/layer3.c index 194fc7e..03f13fe 100644 --- a/core/multimedia/opieplayer/libmad/layer3.c +++ b/core/multimedia/opieplayer/libmad/layer3.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * mad - MPEG audio decoder | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2001 Robert Leslie |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
@@ -27,7 +27,10 @@ | |||
27 | 27 | ||
28 | # include <stdlib.h> | 28 | # include <stdlib.h> |
29 | # include <string.h> | 29 | # include <string.h> |
30 | |||
31 | # ifdef HAVE_ASSERT_H | ||
30 | # include <assert.h> | 32 | # include <assert.h> |
33 | # endif | ||
31 | 34 | ||
32 | # ifdef HAVE_LIMITS_H | 35 | # ifdef HAVE_LIMITS_H |
33 | # include <limits.h> | 36 | # include <limits.h> |
@@ -51,6 +54,11 @@ enum { | |||
51 | mixed_block_flag = 0x08 | 54 | mixed_block_flag = 0x08 |
52 | }; | 55 | }; |
53 | 56 | ||
57 | enum { | ||
58 | I_STEREO = 0x1, | ||
59 | MS_STEREO = 0x2 | ||
60 | }; | ||
61 | |||
54 | struct sideinfo { | 62 | struct sideinfo { |
55 | unsigned int main_data_begin; | 63 | unsigned int main_data_begin; |
56 | unsigned int private_bits; | 64 | unsigned int private_bits; |
@@ -503,7 +511,7 @@ enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch, | |||
503 | unsigned int *priv_bitlen) | 511 | unsigned int *priv_bitlen) |
504 | { | 512 | { |
505 | unsigned int ngr, gr, ch, i; | 513 | unsigned int ngr, gr, ch, i; |
506 | enum mad_error result = 0; | 514 | enum mad_error result = MAD_ERROR_NONE; |
507 | 515 | ||
508 | *data_bitlen = 0; | 516 | *data_bitlen = 0; |
509 | *priv_bitlen = lsf ? ((nch == 1) ? 1 : 2) : ((nch == 1) ? 5 : 3); | 517 | *priv_bitlen = lsf ? ((nch == 1) ? 1 : 2) : ((nch == 1) ? 5 : 3); |
@@ -602,7 +610,7 @@ unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr, | |||
602 | index = (channel->block_type == 2) ? | 610 | index = (channel->block_type == 2) ? |
603 | ((channel->flags & mixed_block_flag) ? 2 : 1) : 0; | 611 | ((channel->flags & mixed_block_flag) ? 2 : 1) : 0; |
604 | 612 | ||
605 | if (!((mode_extension & 0x1) && gr1ch)) { | 613 | if (!((mode_extension & I_STEREO) && gr1ch)) { |
606 | if (scalefac_compress < 400) { | 614 | if (scalefac_compress < 400) { |
607 | slen[0] = (scalefac_compress >> 4) / 5; | 615 | slen[0] = (scalefac_compress >> 4) / 5; |
608 | slen[1] = (scalefac_compress >> 4) % 5; | 616 | slen[1] = (scalefac_compress >> 4) % 5; |
@@ -643,7 +651,7 @@ unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr, | |||
643 | while (n < 39) | 651 | while (n < 39) |
644 | channel->scalefac[n++] = 0; | 652 | channel->scalefac[n++] = 0; |
645 | } | 653 | } |
646 | else { /* (mode_extension & 0x1) && gr1ch (i.e. ch == 1) */ | 654 | else { /* (mode_extension & I_STEREO) && gr1ch (i.e. ch == 1) */ |
647 | scalefac_compress >>= 1; | 655 | scalefac_compress >>= 1; |
648 | 656 | ||
649 | if (scalefac_compress < 180) { | 657 | if (scalefac_compress < 180) { |
@@ -775,6 +783,28 @@ unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel, | |||
775 | } | 783 | } |
776 | 784 | ||
777 | /* | 785 | /* |
786 | * The Layer III formula for requantization and scaling is defined by | ||
787 | * section 2.4.3.4.7.1 of ISO/IEC 11172-3, as follows: | ||
788 | * | ||
789 | * long blocks: | ||
790 | * xr[i] = sign(is[i]) * abs(is[i])^(4/3) * | ||
791 | * 2^((1/4) * (global_gain - 210)) * | ||
792 | * 2^-(scalefac_multiplier * | ||
793 | * (scalefac_l[sfb] + preflag * pretab[sfb])) | ||
794 | * | ||
795 | * short blocks: | ||
796 | * xr[i] = sign(is[i]) * abs(is[i])^(4/3) * | ||
797 | * 2^((1/4) * (global_gain - 210 - 8 * subblock_gain[w])) * | ||
798 | * 2^-(scalefac_multiplier * scalefac_s[sfb][w]) | ||
799 | * | ||
800 | * where: | ||
801 | * scalefac_multiplier = (scalefac_scale + 1) / 2 | ||
802 | * | ||
803 | * The routines III_exponents() and III_requantize() facilitate this | ||
804 | * calculation. | ||
805 | */ | ||
806 | |||
807 | /* | ||
778 | * NAME:III_exponents() | 808 | * NAME:III_exponents() |
779 | * DESCRIPTION:calculate scalefactor exponents | 809 | * DESCRIPTION:calculate scalefactor exponents |
780 | */ | 810 | */ |
@@ -856,23 +886,7 @@ mad_fixed_t III_requantize(unsigned int value, signed int exp) | |||
856 | signed int frac; | 886 | signed int frac; |
857 | struct fixedfloat const *power; | 887 | struct fixedfloat const *power; |
858 | 888 | ||
859 | /* | 889 | frac = exp % 4; /* assumes sign(frac) == sign(exp) */ |
860 | * long blocks: | ||
861 | * xr[i] = sign(is[i]) * abs(is[i])^(4/3) * | ||
862 | * 2^((1/4) * (global_gain - 210)) * | ||
863 | * 2^-(scalefac_multiplier * | ||
864 | * (scalefac_l[sfb] + preflag * pretab[sfb])) | ||
865 | * | ||
866 | * short blocks: | ||
867 | * xr[i] = sign(is[i]) * abs(is[i])^(4/3) * | ||
868 | * 2^((1/4) * (global_gain - 210 - 8 * subblock_gain[w])) * | ||
869 | * 2^-(scalefac_multiplier * scalefac_s[sfb][w]) | ||
870 | * | ||
871 | * where: | ||
872 | * scalefac_multiplier = (scalefac_scale + 1) / 2 | ||
873 | */ | ||
874 | |||
875 | frac = exp % 4; | ||
876 | exp /= 4; | 890 | exp /= 4; |
877 | 891 | ||
878 | power = &rq_table[value]; | 892 | power = &rq_table[value]; |
@@ -884,9 +898,11 @@ mad_fixed_t III_requantize(unsigned int value, signed int exp) | |||
884 | /* underflow */ | 898 | /* underflow */ |
885 | requantized = 0; | 899 | requantized = 0; |
886 | } | 900 | } |
887 | else | 901 | else { |
902 | requantized += 1L << (-exp - 1); | ||
888 | requantized >>= -exp; | 903 | requantized >>= -exp; |
889 | } | 904 | } |
905 | } | ||
890 | else { | 906 | else { |
891 | if (exp >= 5) { | 907 | if (exp >= 5) { |
892 | /* overflow */ | 908 | /* overflow */ |
@@ -1251,7 +1267,7 @@ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xr[576], | |||
1251 | xrptr += 2; | 1267 | xrptr += 2; |
1252 | } | 1268 | } |
1253 | 1269 | ||
1254 | return 0; | 1270 | return MAD_ERROR_NONE; |
1255 | } | 1271 | } |
1256 | 1272 | ||
1257 | # undef MASK | 1273 | # undef MASK |
@@ -1266,37 +1282,39 @@ void III_reorder(mad_fixed_t xr[576], struct channel const *channel, | |||
1266 | unsigned char const sfbwidth[39]) | 1282 | unsigned char const sfbwidth[39]) |
1267 | { | 1283 | { |
1268 | mad_fixed_t tmp[32][3][6]; | 1284 | mad_fixed_t tmp[32][3][6]; |
1269 | unsigned int sb, l, sfbi, f, w, sbw[3], sw[3]; | 1285 | unsigned int sb, l, f, w, sbw[3], sw[3]; |
1270 | 1286 | ||
1271 | /* this is probably wrong for 8000 Hz mixed blocks */ | 1287 | /* this is probably wrong for 8000 Hz mixed blocks */ |
1272 | 1288 | ||
1273 | if (channel->flags & mixed_block_flag) | 1289 | sb = 0; |
1274 | sb = 2, sfbi = 3 * 3; | 1290 | if (channel->flags & mixed_block_flag) { |
1275 | else | 1291 | sb = 2; |
1276 | sb = 0, sfbi = 0; | 1292 | |
1293 | l = 0; | ||
1294 | while (l < 36) | ||
1295 | l += *sfbwidth++; | ||
1296 | } | ||
1277 | 1297 | ||
1278 | for (w = 0; w < 3; ++w) { | 1298 | for (w = 0; w < 3; ++w) { |
1279 | sbw[w] = sb; | 1299 | sbw[w] = sb; |
1280 | sw[w] = 0; | 1300 | sw[w] = 0; |
1281 | } | 1301 | } |
1282 | 1302 | ||
1283 | f = sfbwidth[sfbi]; | 1303 | f = *sfbwidth++; |
1284 | w = 0; | 1304 | w = 0; |
1285 | 1305 | ||
1286 | for (l = 18 * sb; l < 576; ++l) { | 1306 | for (l = 18 * sb; l < 576; ++l) { |
1307 | if (f-- == 0) { | ||
1308 | f = *sfbwidth++ - 1; | ||
1309 | w = (w + 1) % 3; | ||
1310 | } | ||
1311 | |||
1287 | tmp[sbw[w]][w][sw[w]++] = xr[l]; | 1312 | tmp[sbw[w]][w][sw[w]++] = xr[l]; |
1288 | 1313 | ||
1289 | if (sw[w] == 6) { | 1314 | if (sw[w] == 6) { |
1290 | sw[w] = 0; | 1315 | sw[w] = 0; |
1291 | ++sbw[w]; | 1316 | ++sbw[w]; |
1292 | } | 1317 | } |
1293 | |||
1294 | if (--f == 0) { | ||
1295 | if (++w == 3) | ||
1296 | w = 0; | ||
1297 | |||
1298 | f = sfbwidth[++sfbi]; | ||
1299 | } | ||
1300 | } | 1318 | } |
1301 | 1319 | ||
1302 | memcpy(&xr[18 * sb], &tmp[sb], (576 - 18 * sb) * sizeof(mad_fixed_t)); | 1320 | memcpy(&xr[18 * sb], &tmp[sb], (576 - 18 * sb) * sizeof(mad_fixed_t)); |
@@ -1315,11 +1333,6 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], | |||
1315 | short modes[39]; | 1333 | short modes[39]; |
1316 | unsigned int sfbi, l, n, i; | 1334 | unsigned int sfbi, l, n, i; |
1317 | 1335 | ||
1318 | enum { | ||
1319 | i_stereo = 0x1, | ||
1320 | ms_stereo = 0x2 | ||
1321 | }; | ||
1322 | |||
1323 | if (granule->ch[0].block_type != | 1336 | if (granule->ch[0].block_type != |
1324 | granule->ch[1].block_type || | 1337 | granule->ch[1].block_type || |
1325 | (granule->ch[0].flags & mixed_block_flag) != | 1338 | (granule->ch[0].flags & mixed_block_flag) != |
@@ -1331,7 +1344,7 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], | |||
1331 | 1344 | ||
1332 | /* intensity stereo */ | 1345 | /* intensity stereo */ |
1333 | 1346 | ||
1334 | if (header->mode_extension & i_stereo) { | 1347 | if (header->mode_extension & I_STEREO) { |
1335 | struct channel const *right_ch = &granule->ch[1]; | 1348 | struct channel const *right_ch = &granule->ch[1]; |
1336 | mad_fixed_t const *right_xr = xr[1]; | 1349 | mad_fixed_t const *right_xr = xr[1]; |
1337 | unsigned int is_pos; | 1350 | unsigned int is_pos; |
@@ -1387,14 +1400,14 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], | |||
1387 | /* long blocks */ | 1400 | /* long blocks */ |
1388 | 1401 | ||
1389 | for (i = 0; i < lower; ++i) | 1402 | for (i = 0; i < lower; ++i) |
1390 | modes[i] = header->mode_extension & ~i_stereo; | 1403 | modes[i] = header->mode_extension & ~I_STEREO; |
1391 | 1404 | ||
1392 | /* short blocks */ | 1405 | /* short blocks */ |
1393 | 1406 | ||
1394 | w = 0; | 1407 | w = 0; |
1395 | for (i = start; i < max; ++i) { | 1408 | for (i = start; i < max; ++i) { |
1396 | if (i < bound[w]) | 1409 | if (i < bound[w]) |
1397 | modes[i] = header->mode_extension & ~i_stereo; | 1410 | modes[i] = header->mode_extension & ~I_STEREO; |
1398 | 1411 | ||
1399 | w = (w + 1) % 3; | 1412 | w = (w + 1) % 3; |
1400 | } | 1413 | } |
@@ -1417,7 +1430,7 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], | |||
1417 | } | 1430 | } |
1418 | 1431 | ||
1419 | for (i = 0; i < bound; ++i) | 1432 | for (i = 0; i < bound; ++i) |
1420 | modes[i] = header->mode_extension & ~i_stereo; | 1433 | modes[i] = header->mode_extension & ~I_STEREO; |
1421 | } | 1434 | } |
1422 | 1435 | ||
1423 | /* now do the actual processing */ | 1436 | /* now do the actual processing */ |
@@ -1432,11 +1445,11 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], | |||
1432 | for (sfbi = l = 0; l < 576; ++sfbi, l += n) { | 1445 | for (sfbi = l = 0; l < 576; ++sfbi, l += n) { |
1433 | n = sfbwidth[sfbi]; | 1446 | n = sfbwidth[sfbi]; |
1434 | 1447 | ||
1435 | if (!(modes[sfbi] & i_stereo)) | 1448 | if (!(modes[sfbi] & I_STEREO)) |
1436 | continue; | 1449 | continue; |
1437 | 1450 | ||
1438 | if (illegal_pos[sfbi]) { | 1451 | if (illegal_pos[sfbi]) { |
1439 | modes[sfbi] &= ~i_stereo; | 1452 | modes[sfbi] &= ~I_STEREO; |
1440 | continue; | 1453 | continue; |
1441 | } | 1454 | } |
1442 | 1455 | ||
@@ -1468,13 +1481,13 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], | |||
1468 | for (sfbi = l = 0; l < 576; ++sfbi, l += n) { | 1481 | for (sfbi = l = 0; l < 576; ++sfbi, l += n) { |
1469 | n = sfbwidth[sfbi]; | 1482 | n = sfbwidth[sfbi]; |
1470 | 1483 | ||
1471 | if (!(modes[sfbi] & i_stereo)) | 1484 | if (!(modes[sfbi] & I_STEREO)) |
1472 | continue; | 1485 | continue; |
1473 | 1486 | ||
1474 | is_pos = right_ch->scalefac[sfbi]; | 1487 | is_pos = right_ch->scalefac[sfbi]; |
1475 | 1488 | ||
1476 | if (is_pos >= 7) { /* illegal intensity position */ | 1489 | if (is_pos >= 7) { /* illegal intensity position */ |
1477 | modes[sfbi] &= ~i_stereo; | 1490 | modes[sfbi] &= ~I_STEREO; |
1478 | continue; | 1491 | continue; |
1479 | } | 1492 | } |
1480 | 1493 | ||
@@ -1492,7 +1505,7 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], | |||
1492 | 1505 | ||
1493 | /* middle/side stereo */ | 1506 | /* middle/side stereo */ |
1494 | 1507 | ||
1495 | if (header->mode_extension & ms_stereo) { | 1508 | if (header->mode_extension & MS_STEREO) { |
1496 | register mad_fixed_t invsqrt2; | 1509 | register mad_fixed_t invsqrt2; |
1497 | 1510 | ||
1498 | header->flags |= MAD_FLAG_MS_STEREO; | 1511 | header->flags |= MAD_FLAG_MS_STEREO; |
@@ -1502,7 +1515,7 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], | |||
1502 | for (sfbi = l = 0; l < 576; ++sfbi, l += n) { | 1515 | for (sfbi = l = 0; l < 576; ++sfbi, l += n) { |
1503 | n = sfbwidth[sfbi]; | 1516 | n = sfbwidth[sfbi]; |
1504 | 1517 | ||
1505 | if (modes[sfbi] != ms_stereo) | 1518 | if (modes[sfbi] != MS_STEREO) |
1506 | continue; | 1519 | continue; |
1507 | 1520 | ||
1508 | for (i = 0; i < n; ++i) { | 1521 | for (i = 0; i < n; ++i) { |
@@ -1517,7 +1530,7 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576], | |||
1517 | } | 1530 | } |
1518 | } | 1531 | } |
1519 | 1532 | ||
1520 | return 0; | 1533 | return MAD_ERROR_NONE; |
1521 | } | 1534 | } |
1522 | 1535 | ||
1523 | /* | 1536 | /* |
@@ -1533,15 +1546,12 @@ void III_aliasreduce(mad_fixed_t xr[576], int lines) | |||
1533 | bound = &xr[lines]; | 1546 | bound = &xr[lines]; |
1534 | for (xr += 18; xr < bound; xr += 18) { | 1547 | for (xr += 18; xr < bound; xr += 18) { |
1535 | for (i = 0; i < 8; ++i) { | 1548 | for (i = 0; i < 8; ++i) { |
1536 | register mad_fixed_t *aptr, *bptr, a, b; | 1549 | register mad_fixed_t a, b; |
1537 | register mad_fixed64hi_t hi; | 1550 | register mad_fixed64hi_t hi; |
1538 | register mad_fixed64lo_t lo; | 1551 | register mad_fixed64lo_t lo; |
1539 | 1552 | ||
1540 | aptr = &xr[-1 - i]; | 1553 | a = xr[-1 - i]; |
1541 | bptr = &xr[ i]; | 1554 | b = xr[ i]; |
1542 | |||
1543 | a = *aptr; | ||
1544 | b = *bptr; | ||
1545 | 1555 | ||
1546 | # if defined(ASO_ZEROCHECK) | 1556 | # if defined(ASO_ZEROCHECK) |
1547 | if (a | b) { | 1557 | if (a | b) { |
@@ -1549,12 +1559,12 @@ void III_aliasreduce(mad_fixed_t xr[576], int lines) | |||
1549 | MAD_F_ML0(hi, lo, a, cs[i]); | 1559 | MAD_F_ML0(hi, lo, a, cs[i]); |
1550 | MAD_F_MLA(hi, lo, -b, ca[i]); | 1560 | MAD_F_MLA(hi, lo, -b, ca[i]); |
1551 | 1561 | ||
1552 | *aptr = MAD_F_MLZ(hi, lo); | 1562 | xr[-1 - i] = MAD_F_MLZ(hi, lo); |
1553 | 1563 | ||
1554 | MAD_F_ML0(hi, lo, b, cs[i]); | 1564 | MAD_F_ML0(hi, lo, b, cs[i]); |
1555 | MAD_F_MLA(hi, lo, a, ca[i]); | 1565 | MAD_F_MLA(hi, lo, a, ca[i]); |
1556 | 1566 | ||
1557 | *bptr = MAD_F_MLZ(hi, lo); | 1567 | xr[ i] = MAD_F_MLZ(hi, lo); |
1558 | # if defined(ASO_ZEROCHECK) | 1568 | # if defined(ASO_ZEROCHECK) |
1559 | } | 1569 | } |
1560 | # endif | 1570 | # endif |
@@ -2141,7 +2151,7 @@ void III_freqinver(mad_fixed_t sample[18][32], unsigned int sb) | |||
2141 | * DESCRIPTION:decode frame main_data | 2151 | * DESCRIPTION:decode frame main_data |
2142 | */ | 2152 | */ |
2143 | static | 2153 | static |
2144 | int III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, | 2154 | enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, |
2145 | struct sideinfo *si, unsigned int nch) | 2155 | struct sideinfo *si, unsigned int nch) |
2146 | { | 2156 | { |
2147 | struct mad_header *header = &frame->header; | 2157 | struct mad_header *header = &frame->header; |
@@ -2169,7 +2179,7 @@ int III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, | |||
2169 | 2179 | ||
2170 | for (gr = 0; gr < ngr; ++gr) { | 2180 | for (gr = 0; gr < ngr; ++gr) { |
2171 | struct granule *granule = &si->gr[gr]; | 2181 | struct granule *granule = &si->gr[gr]; |
2172 | unsigned char const *sfbwidth = 0; | 2182 | unsigned char const *sfbwidth[2]; |
2173 | mad_fixed_t xr[2][576]; | 2183 | mad_fixed_t xr[2][576]; |
2174 | unsigned int ch; | 2184 | unsigned int ch; |
2175 | enum mad_error error; | 2185 | enum mad_error error; |
@@ -2178,9 +2188,9 @@ int III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, | |||
2178 | struct channel *channel = &granule->ch[ch]; | 2188 | struct channel *channel = &granule->ch[ch]; |
2179 | unsigned int part2_length; | 2189 | unsigned int part2_length; |
2180 | 2190 | ||
2181 | sfbwidth = sfbwidth_table[sfreqi].l; | 2191 | sfbwidth[ch] = sfbwidth_table[sfreqi].l; |
2182 | if (channel->block_type == 2) { | 2192 | if (channel->block_type == 2) { |
2183 | sfbwidth = (channel->flags & mixed_block_flag) ? | 2193 | sfbwidth[ch] = (channel->flags & mixed_block_flag) ? |
2184 | sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s; | 2194 | sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s; |
2185 | } | 2195 | } |
2186 | 2196 | ||
@@ -2194,7 +2204,7 @@ int III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, | |||
2194 | gr == 0 ? 0 : si->scfsi[ch]); | 2204 | gr == 0 ? 0 : si->scfsi[ch]); |
2195 | } | 2205 | } |
2196 | 2206 | ||
2197 | error = III_huffdecode(ptr, xr[ch], channel, sfbwidth, part2_length); | 2207 | error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length); |
2198 | if (error) | 2208 | if (error) |
2199 | return error; | 2209 | return error; |
2200 | } | 2210 | } |
@@ -2202,7 +2212,7 @@ int III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, | |||
2202 | /* joint stereo processing */ | 2212 | /* joint stereo processing */ |
2203 | 2213 | ||
2204 | if (header->mode == MAD_MODE_JOINT_STEREO && header->mode_extension) { | 2214 | if (header->mode == MAD_MODE_JOINT_STEREO && header->mode_extension) { |
2205 | error = III_stereo(xr, granule, header, sfbwidth); | 2215 | error = III_stereo(xr, granule, header, sfbwidth[0]); |
2206 | if (error) | 2216 | if (error) |
2207 | return error; | 2217 | return error; |
2208 | } | 2218 | } |
@@ -2216,7 +2226,7 @@ int III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, | |||
2216 | mad_fixed_t output[36]; | 2226 | mad_fixed_t output[36]; |
2217 | 2227 | ||
2218 | if (channel->block_type == 2) { | 2228 | if (channel->block_type == 2) { |
2219 | III_reorder(xr[ch], channel, sfbwidth_table[sfreqi].s); | 2229 | III_reorder(xr[ch], channel, sfbwidth[ch]); |
2220 | 2230 | ||
2221 | # if !defined(OPT_STRICT) | 2231 | # if !defined(OPT_STRICT) |
2222 | /* | 2232 | /* |
@@ -2300,7 +2310,7 @@ int III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, | |||
2300 | } | 2310 | } |
2301 | } | 2311 | } |
2302 | 2312 | ||
2303 | return 0; | 2313 | return MAD_ERROR_NONE; |
2304 | } | 2314 | } |
2305 | 2315 | ||
2306 | /* | 2316 | /* |