Always prefix OBUs with a size field.
- Make the add_4bytes_obusize experiment part of the obu experiment.
- Remove the add_4bytes_obusize experiment flags.
- Update the encoder, decoder, and tooling sources.
BUG=aomedia:1125
Change-Id: Ia5c443c855e52618257b39c44ca2632703bf83fd
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 9066965..95f6a05 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -1376,9 +1376,7 @@
OBU_TEMPORAL_DELIMITER, 0,
(uint8_t *)(ctx->pending_cx_data + PRE_OBU_SIZE_BYTES));
obu_size += write_temporal_delimiter_obu();
-#if CONFIG_ADD_4BYTES_OBUSIZE
mem_put_le32(ctx->pending_cx_data, obu_size);
-#endif
pkt.data.frame.sz += (obu_size + PRE_OBU_SIZE_BYTES);
#endif
diff --git a/av1/common/common.h b/av1/common/common.h
index 0c6ef49..286c1f1 100644
--- a/av1/common/common.h
+++ b/av1/common/common.h
@@ -54,11 +54,8 @@
#define AOM_FRAME_MARKER 0x2
-#if CONFIG_ADD_4BYTES_OBUSIZE
+// Size of OBU length field.
#define PRE_OBU_SIZE_BYTES 4
-#else
-#define PRE_OBU_SIZE_BYTES 0
-#endif
#ifdef __cplusplus
} // extern "C"
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 23073e8..15adb74 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -1797,12 +1797,7 @@
aom_internal_error(error_info, AOM_CODEC_CORRUPT_FRAME,
"Truncated packet or corrupt tile size");
} else {
-#if !CONFIG_OBU || CONFIG_ADD_4BYTES_OBUSIZE
size = data_end - *data;
-#else
- size = mem_get_varsize(*data, tile_size_bytes);
- *data += tile_size_bytes;
-#endif
}
buf->data = *data;
@@ -1838,6 +1833,7 @@
for (int r = 0; r < tile_rows; ++r) {
for (int c = 0; c < tile_cols; ++c, ++tc) {
TileBufferDec *const buf = &tile_buffers[r][c];
+
#if CONFIG_OBU
const int is_last = (tc == endTile);
const size_t hdr_offset = 0;
diff --git a/av1/decoder/obu.c b/av1/decoder/obu.c
index 6416ece..67e9bb9 100644
--- a/av1/decoder/obu.c
+++ b/av1/decoder/obu.c
@@ -169,14 +169,10 @@
av1_init_read_bit_buffer(pbi, &rb, data + PRE_OBU_SIZE_BYTES, data_end);
-// every obu is preceded by PRE_OBU_SIZE_BYTES-byte size of obu (obu header +
-// payload size)
-// The obu size is only needed for tile group OBUs
-#if CONFIG_ADD_4BYTES_OBUSIZE
+ // every obu is preceded by PRE_OBU_SIZE_BYTES-byte size of obu (obu header
+ // + payload size)
+ // The obu size is only needed for tile group OBUs
const size_t obu_size = mem_get_le32(data);
-#else
- const size_t obu_size = (size_t)(data_end - data);
-#endif
const OBU_TYPE obu_type = read_obu_header(&rb, &obu_header_size);
data += (PRE_OBU_SIZE_BYTES + obu_header_size);
diff --git a/av1/decoder/obu.h b/av1/decoder/obu.h
index fec25fb..fe7d2ad 100644
--- a/av1/decoder/obu.h
+++ b/av1/decoder/obu.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
+ * Copyright (c) 2017, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index beeb30d..92d10c3 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -4699,12 +4699,8 @@
#endif
buf->data = dst + total_size;
-// The last tile of the tile group does not have a header.
-#if CONFIG_ADD_4BYTES_OBUSIZE
+ // The last tile of the tile group does not have a header.
if (!is_last_tile_in_tg) total_size += 4;
-#else
- total_size += 4;
-#endif
// Initialise tile context from the frame context
this_tile->tctx = *cm->fc;
@@ -4738,12 +4734,8 @@
// size of this tile
mem_put_le32(buf->data, tile_size);
} else {
-#if CONFIG_ADD_4BYTES_OBUSIZE
// write current tile group size
mem_put_le32(data, curr_tg_data_size);
-#else
- mem_put_le32(buf->data, tile_size);
-#endif
}
total_size += tile_size;
@@ -4782,9 +4774,7 @@
write_obu_header(OBU_SEQUENCE_HEADER, 0, data + PRE_OBU_SIZE_BYTES);
obu_size +=
write_sequence_header_obu(cpi, data + PRE_OBU_SIZE_BYTES + obu_size);
-#if CONFIG_ADD_4BYTES_OBUSIZE
mem_put_le32(data, obu_size);
-#endif
data += obu_size + PRE_OBU_SIZE_BYTES;
}
@@ -4802,9 +4792,7 @@
#endif
data + PRE_OBU_SIZE_BYTES + obu_size);
obu_size += frame_header_size;
-#if CONFIG_ADD_4BYTES_OBUSIZE
mem_put_le32(data, obu_size);
-#endif
data += obu_size + PRE_OBU_SIZE_BYTES;
if (cm->show_existing_frame) {