MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / III_stereo

Function III_stereo

modules/data/mp3/libmad/layer3.c:1385–1593  ·  view source on GitHub ↗

NAME: III_stereo() DESCRIPTION: perform joint stereo processing on a granule */

Source from the content-addressed store, hash-verified

1383 DESCRIPTION: perform joint stereo processing on a granule
1384*/
1385static
1386enum mad_error III_stereo(mad_fixed_t xr[2][576],
1387 struct granule const *granule,
1388 struct mad_header *header,
1389 unsigned int const *sfbwidth)
1390{
1391 short modes[39];
1392 unsigned int sfbi, l, n, i;
1393 stack(__FUNCTION__, __FILE__, __LINE__);
1394
1395 if (granule->ch[0].block_type !=
1396 granule->ch[1].block_type ||
1397 (granule->ch[0].flags & mixed_block_flag) !=
1398 (granule->ch[1].flags & mixed_block_flag))
1399 return MAD_ERROR_BADSTEREO;
1400
1401 for (i = 0; i < 39; ++i)
1402 modes[i] = header->mode_extension;
1403
1404 /* intensity stereo */
1405
1406 if (header->mode_extension & I_STEREO) {
1407 struct channel const *right_ch = &granule->ch[1];
1408 mad_fixed_t const *right_xr = xr[1];
1409 unsigned int is_pos;
1410
1411 header->flags |= MAD_FLAG_I_STEREO;
1412
1413 /* first determine which scalefactor bands are to be processed */
1414
1415 if (right_ch->block_type == 2) {
1416 unsigned int lower, start, max, bound[3], w;
1417
1418 lower = start = max = bound[0] = bound[1] = bound[2] = 0;
1419
1420 sfbi = l = 0;
1421
1422 if (right_ch->flags & mixed_block_flag) {
1423 while (l < 36) {
1424 n = sfbwidth[sfbi++];
1425
1426 for (i = 0; i < n; ++i) {
1427 if (right_xr[i]) {
1428 lower = sfbi;
1429 break;
1430 }
1431 }
1432
1433 right_xr += n;
1434 l += n;
1435 }
1436
1437 start = sfbi;
1438 }
1439
1440 w = 0;
1441 while (l < 576) {
1442 n = sfbwidth[sfbi++];

Callers 1

III_decodeFunction · 0.85

Calls 2

is_tableFunction · 0.85
root_tableFunction · 0.85

Tested by

no test coverage detected