Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Commit

Permalink
Ignore av1 reserved units
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyichix committed Jul 21, 2022
1 parent 9264f6a commit 134768b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions _studio/shared/umc/codec/av1_dec/include/umc_av1_dec_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,20 @@ namespace UMC_AV1_DECODER

enum AV1_OBU_TYPE
{
OBU_RESERVED_0 = 0,
OBU_SEQUENCE_HEADER = 1,
OBU_TEMPORAL_DELIMITER = 2,
OBU_FRAME_HEADER = 3,
OBU_TILE_GROUP = 4,
OBU_METADATA = 5,
OBU_FRAME = 6,
OBU_REDUNDANT_FRAME_HEADER = 7,
OBU_RESERVED_9 = 9,
OBU_RESERVED_10 = 10,
OBU_RESERVED_11 = 11,
OBU_RESERVED_12 = 12,
OBU_RESERVED_13 = 13,
OBU_RESERVED_14 = 14,
OBU_PADDING = 15,
};

Expand Down
8 changes: 7 additions & 1 deletion _studio/shared/umc/codec/av1_dec/src/umc_av1_bitstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ namespace UMC_AV1_DECODER
info.num_ticks_per_picture_minus_1 = read_uvlc(bs);
}

inline bool av1_obu_type_is_reserved(AV1_OBU_TYPE& obu_type)
{
return OBU_RESERVED_0 == obu_type || (OBU_RESERVED_9 <= obu_type && OBU_RESERVED_14 >= obu_type);
}

static void av1_color_config(AV1Bitstream& bs, ColorConfig& config, uint32_t profile)
{
AV1D_LOG("[+]: %d", (uint32_t)bs.BitsDecoded());
Expand Down Expand Up @@ -1198,7 +1203,8 @@ namespace UMC_AV1_DECODER

if (info.header.obu_has_size_field)
av1_read_obu_size(*this, obu_size, sizeFieldLength);
else if (info.header.obu_type != OBU_TEMPORAL_DELIMITER)
// Av1-spec section 6.2.2: Reserved units are for future use and shall be ignored by AV1 decoder.
else if (info.header.obu_type != OBU_TEMPORAL_DELIMITER && !av1_obu_type_is_reserved(info.header.obu_type))
throw av1_exception(UMC::UMC_ERR_NOT_IMPLEMENTED); // no support for OBUs w/o size field so far

info.size = headerSize + sizeFieldLength + obu_size;
Expand Down

0 comments on commit 134768b

Please sign in to comment.