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

Function decode_header

libavcodec/exr.c:1602–2112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1600}
1601
1602static int decode_header(EXRContext *s, AVFrame *frame)
1603{
1604 AVDictionary *metadata = NULL;
1605 GetByteContext *gb = &s->gb;
1606 int magic_number, version, flags;
1607 int layer_match = 0;
1608 int ret;
1609 int dup_channels = 0;
1610
1611 s->current_channel_offset = 0;
1612 s->xmin = ~0;
1613 s->xmax = ~0;
1614 s->ymin = ~0;
1615 s->ymax = ~0;
1616 s->xdelta = ~0;
1617 s->ydelta = ~0;
1618 s->channel_offsets[0] = -1;
1619 s->channel_offsets[1] = -1;
1620 s->channel_offsets[2] = -1;
1621 s->channel_offsets[3] = -1;
1622 s->pixel_type = EXR_UNKNOWN;
1623 s->compression = EXR_UNKN;
1624 s->nb_channels = 0;
1625 s->w = 0;
1626 s->h = 0;
1627 s->tile_attr.xSize = -1;
1628 s->tile_attr.ySize = -1;
1629 s->is_tile = 0;
1630 s->is_multipart = 0;
1631 s->is_luma = 0;
1632 s->has_channel = 0;
1633 s->current_part = 0;
1634
1635 if (bytestream2_get_bytes_left(gb) < 10) {
1636 av_log(s->avctx, AV_LOG_ERROR, "Header too short to parse.\n");
1637 return AVERROR_INVALIDDATA;
1638 }
1639
1640 magic_number = bytestream2_get_le32(gb);
1641 if (magic_number != 20000630) {
1642 /* As per documentation of OpenEXR, it is supposed to be
1643 * int 20000630 little-endian */
1644 av_log(s->avctx, AV_LOG_ERROR, "Wrong magic number %d.\n", magic_number);
1645 return AVERROR_INVALIDDATA;
1646 }
1647
1648 version = bytestream2_get_byte(gb);
1649 if (version != 2) {
1650 avpriv_report_missing_feature(s->avctx, "Version %d", version);
1651 return AVERROR_PATCHWELCOME;
1652 }
1653
1654 flags = bytestream2_get_le24(gb);
1655
1656 if (flags & 0x02)
1657 s->is_tile = 1;
1658 if (flags & 0x10)
1659 s->is_multipart = 1;

Callers 1

exr.cFile · 0.70

Calls 15

av_logFunction · 0.85
skip_header_chunkFunction · 0.85
bytestream2_skipFunction · 0.85
check_header_variableFunction · 0.85
bytestream2_initFunction · 0.85
av_toupperFunction · 0.85
MFunction · 0.85
av_strcasecmpFunction · 0.85
av_realloc_arrayFunction · 0.85
avpriv_request_sampleFunction · 0.85

Tested by

no test coverage detected