MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / parse_aux_data

Function parse_aux_data

libavcodec/dca_core.c:1615–1681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1613}
1614
1615static int parse_aux_data(DCACoreDecoder *s)
1616{
1617 int aux_pos;
1618
1619 if (get_bits_left(&s->gb) < 0)
1620 return AVERROR_INVALIDDATA;
1621
1622 // Auxiliary data byte count (can't be trusted)
1623 skip_bits(&s->gb, 6);
1624
1625 // 4-byte align
1626 skip_bits_long(&s->gb, -get_bits_count(&s->gb) & 31);
1627
1628 // Auxiliary data sync word
1629 if (get_bits_long(&s->gb, 32) != DCA_SYNCWORD_REV1AUX) {
1630 av_log(s->avctx, AV_LOG_ERROR, "Invalid auxiliary data sync word\n");
1631 return AVERROR_INVALIDDATA;
1632 }
1633
1634 aux_pos = get_bits_count(&s->gb);
1635
1636 // Auxiliary decode time stamp flag
1637 if (get_bits1(&s->gb))
1638 skip_bits_long(&s->gb, 47);
1639
1640 // Auxiliary dynamic downmix flag
1641 if (s->prim_dmix_embedded = get_bits1(&s->gb)) {
1642 int i, m, n;
1643
1644 // Auxiliary primary channel downmix type
1645 s->prim_dmix_type = get_bits(&s->gb, 3);
1646 if (s->prim_dmix_type >= DCA_DMIX_TYPE_COUNT) {
1647 av_log(s->avctx, AV_LOG_ERROR, "Invalid primary channel set downmix type\n");
1648 return AVERROR_INVALIDDATA;
1649 }
1650
1651 // Size of downmix coefficients matrix
1652 m = ff_dca_dmix_primary_nch[s->prim_dmix_type];
1653 n = ff_dca_channels[s->audio_mode] + !!s->lfe_present;
1654
1655 // Dynamic downmix code coefficients
1656 for (i = 0; i < m * n; i++) {
1657 int code = get_bits(&s->gb, 9);
1658 int sign = (code >> 8) - 1;
1659 unsigned int index = code & 0xff;
1660 if (index >= FF_DCA_DMIXTABLE_SIZE) {
1661 av_log(s->avctx, AV_LOG_ERROR, "Invalid downmix coefficient index\n");
1662 return AVERROR_INVALIDDATA;
1663 }
1664 s->prim_dmix_coeff[i] = (ff_dca_dmixtable[index] ^ sign) - sign;
1665 }
1666 }
1667
1668 // Byte align
1669 skip_bits(&s->gb, -get_bits_count(&s->gb) & 7);
1670
1671 // CRC16 of auxiliary data
1672 skip_bits(&s->gb, 16);

Callers 1

parse_optional_infoFunction · 0.85

Calls 9

get_bits_leftFunction · 0.85
skip_bitsFunction · 0.85
skip_bits_longFunction · 0.85
get_bits_countFunction · 0.85
get_bits_longFunction · 0.85
av_logFunction · 0.85
get_bits1Function · 0.85
ff_dca_check_crcFunction · 0.85
get_bitsFunction · 0.70

Tested by

no test coverage detected