Write LEB128 OBU size fields.
Removes padding bytes.
BUG=aomedia:1125
Change-Id: Ib9bce81a86aa218abeeba8e027387634aaa89b92
diff --git a/tools/obu_parser.cc b/tools/obu_parser.cc
index d63a484..667019a 100644
--- a/tools/obu_parser.cc
+++ b/tools/obu_parser.cc
@@ -153,10 +153,8 @@
}
bool DumpObu(const uint8_t *data, int length) {
- const int kObuLengthFieldSizeBytes = 4;
const int kObuHeaderLengthSizeBytes = 1;
- const int kMinimumBytesRequired =
- kObuLengthFieldSizeBytes + kObuHeaderLengthSizeBytes;
+ const int kMinimumBytesRequired = 1 + kObuHeaderLengthSizeBytes;
int consumed = 0;
ObuHeader obu_header;
while (consumed < length) {
@@ -173,10 +171,13 @@
#if CONFIG_OBU_SIZING
uint32_t obu_size = 0;
- aom_uleb_decode(data + consumed, kObuLengthFieldSizeBytes, &obu_size);
+ aom_uleb_decode(data + consumed, sizeof(obu_size), &obu_size);
const int current_obu_length = static_cast<int>(obu_size);
+ const size_t length_field_size = aom_uleb_size_in_bytes(obu_size);
#else
const int current_obu_length = mem_get_le32(data + consumed);
+ const int kObuLengthFieldSizeBytes = 4;
+ const size_t length_field_size = kObuLengthFieldSizeBytes;
#endif // CONFIG_OBU_SIZING
if (current_obu_length > remaining) {
@@ -186,7 +187,7 @@
consumed, current_obu_length, remaining);
return false;
}
- consumed += kObuLengthFieldSizeBytes;
+ consumed += length_field_size;
obu_header = kEmptyObu;
const uint8_t obu_header_byte = *(data + consumed);