diff options
Diffstat (limited to 'media/libaom/src/av1/common/obu_util.c')
-rw-r--r-- | media/libaom/src/av1/common/obu_util.c | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/media/libaom/src/av1/common/obu_util.c b/media/libaom/src/av1/common/obu_util.c index 7d2694b89b..cfca03bb4d 100644 --- a/media/libaom/src/av1/common/obu_util.c +++ b/media/libaom/src/av1/common/obu_util.c @@ -14,24 +14,6 @@ #include "aom_dsp/bitreader_buffer.h" -// Returns 1 when OBU type is valid, and 0 otherwise. -static int valid_obu_type(int obu_type) { - int valid_type = 0; - switch (obu_type) { - case OBU_SEQUENCE_HEADER: - case OBU_TEMPORAL_DELIMITER: - case OBU_FRAME_HEADER: - case OBU_TILE_GROUP: - case OBU_METADATA: - case OBU_FRAME: - case OBU_REDUNDANT_FRAME_HEADER: - case OBU_TILE_LIST: - case OBU_PADDING: valid_type = 1; break; - default: break; - } - return valid_type; -} - static aom_codec_err_t read_obu_size(const uint8_t *data, size_t bytes_available, size_t *const obu_size, @@ -63,9 +45,6 @@ static aom_codec_err_t read_obu_header(struct aom_read_bit_buffer *rb, } header->type = (OBU_TYPE)aom_rb_read_literal(rb, 4); - - if (!valid_obu_type(header->type)) return AOM_CODEC_CORRUPT_FRAME; - header->has_extension = aom_rb_read_bit(rb); header->has_size_field = aom_rb_read_bit(rb); @@ -74,10 +53,8 @@ static aom_codec_err_t read_obu_header(struct aom_read_bit_buffer *rb, return AOM_CODEC_UNSUP_BITSTREAM; } - if (aom_rb_read_bit(rb) != 0) { - // obu_reserved_1bit must be set to 0. - return AOM_CODEC_CORRUPT_FRAME; - } + // obu_reserved_1bit must be set to 0. The value is ignored by a decoder. + aom_rb_read_bit(rb); if (header->has_extension) { if (bit_buffer_byte_length == 1) return AOM_CODEC_CORRUPT_FRAME; @@ -85,10 +62,12 @@ static aom_codec_err_t read_obu_header(struct aom_read_bit_buffer *rb, header->size += 1; header->temporal_layer_id = aom_rb_read_literal(rb, 3); header->spatial_layer_id = aom_rb_read_literal(rb, 2); - if (aom_rb_read_literal(rb, 3) != 0) { - // extension_header_reserved_3bits must be set to 0. - return AOM_CODEC_CORRUPT_FRAME; - } + // extension_header_reserved_3bits must be set to 0. The value is ignored by + // a decoder. + aom_rb_read_literal(rb, 3); + } else { + header->temporal_layer_id = 0; + header->spatial_layer_id = 0; } return AOM_CODEC_OK; |