Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Decode] Ignore av1 reserved units #274

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -104,6 +104,7 @@ namespace UMC_AV1_DECODER

enum AV1_OBU_TYPE
{
OBU_RESERVED_0 = 0,
OBU_SEQUENCE_HEADER = 1,
OBU_TEMPORAL_DELIMITER = 2,
OBU_FRAME_HEADER = 3,
Expand All @@ -112,6 +113,12 @@ namespace UMC_AV1_DECODER
OBU_FRAME = 6,
OBU_REDUNDANT_FRAME_HEADER = 7,
OBU_TILE_LIST = 8,
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 @@ -81,6 +81,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 @@ -1211,7 +1216,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