Remove compressed header related code
Removed compressed header related code that is not used anymore.
Change-Id: I8e4881ecf9a4e0a25bd59a456eab9815d4bdd418
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index ba0bae3..ab18816 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -1376,11 +1376,6 @@
return all_lossless;
}
-static INLINE int use_compressed_header(const AV1_COMMON *cm) {
- (void)cm;
- return 0;
-}
-
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 829039e..2602c28 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -1829,7 +1829,7 @@
int first_tile_in_tg = 0;
#if !CONFIG_OBU
struct aom_read_bit_buffer rb_tg_hdr;
- const size_t hdr_size = pbi->uncomp_hdr_size + pbi->first_partition_size;
+ const size_t hdr_size = pbi->uncomp_hdr_size;
const int tg_size_bit_offset = pbi->tg_size_bit_offset;
#endif
@@ -2491,8 +2491,8 @@
}
#endif // CONFIG_FWD_KF
-static size_t read_uncompressed_header(AV1Decoder *pbi,
- struct aom_read_bit_buffer *rb) {
+static int read_uncompressed_header(AV1Decoder *pbi,
+ struct aom_read_bit_buffer *rb) {
AV1_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
BufferPool *const pool = cm->buffer_pool;
@@ -3149,23 +3149,6 @@
read_tile_info(pbi, rb);
#endif
- size_t sz;
- if (use_compressed_header(cm)) {
- sz = aom_rb_read_literal(rb, 16);
- if (sz == 0)
- aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
- "Invalid header size");
- } else {
- sz = 0;
- }
- return sz;
-}
-
-static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
- size_t partition_size) {
- (void)pbi;
- (void)data;
- (void)partition_size;
return 0;
}
@@ -3273,9 +3256,9 @@
}
}
-size_t av1_decode_frame_headers_and_setup(AV1Decoder *pbi, const uint8_t *data,
- const uint8_t *data_end,
- const uint8_t **p_data_end) {
+int av1_decode_frame_headers_and_setup(AV1Decoder *pbi, const uint8_t *data,
+ const uint8_t *data_end,
+ const uint8_t **p_data_end) {
AV1_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
@@ -3293,8 +3276,8 @@
xd->global_motion = cm->global_motion;
struct aom_read_bit_buffer rb;
- const size_t first_partition_size = read_uncompressed_header(
- pbi, av1_init_read_bit_buffer(pbi, &rb, data, data_end));
+ read_uncompressed_header(pbi,
+ av1_init_read_bit_buffer(pbi, &rb, data, data_end));
#if CONFIG_EXT_TILE
// If cm->single_tile_decoding = 0, the independent decoding of a single tile
@@ -3306,7 +3289,6 @@
}
#endif // CONFIG_EXT_TILE
- pbi->first_partition_size = first_partition_size;
pbi->uncomp_hdr_size = aom_rb_bytes_read(&rb);
YV12_BUFFER_CONFIG *new_fb = get_frame_new_buffer(cm);
xd->cur_buf = new_fb;
@@ -3343,12 +3325,6 @@
return 0;
}
- data += aom_rb_bytes_read(&rb);
- if (first_partition_size)
- if (!read_is_valid(data, first_partition_size, data_end))
- aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
- "Truncated packet or corrupt header length");
-
cm->setup_mi(cm);
#if CONFIG_SEGMENT_PRED_LAST
@@ -3380,13 +3356,7 @@
av1_zero(cm->counts);
xd->corrupted = 0;
- if (first_partition_size) {
- new_fb->corrupted = read_compressed_header(pbi, data, first_partition_size);
- if (new_fb->corrupted)
- aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
- "Decode failed. Frame data header is corrupted.");
- }
- return first_partition_size;
+ return 0;
}
// Once-per-frame initialization
diff --git a/av1/decoder/decodeframe.h b/av1/decoder/decodeframe.h
index 5e153a5..9cc511d 100644
--- a/av1/decoder/decodeframe.h
+++ b/av1/decoder/decodeframe.h
@@ -37,10 +37,10 @@
// This function is now obsolete
void av1_decode_frame(struct AV1Decoder *pbi, const uint8_t *data,
const uint8_t *data_end, const uint8_t **p_data_end);
-size_t av1_decode_frame_headers_and_setup(struct AV1Decoder *pbi,
- const uint8_t *data,
- const uint8_t *data_end,
- const uint8_t **p_data_end);
+int av1_decode_frame_headers_and_setup(struct AV1Decoder *pbi,
+ const uint8_t *data,
+ const uint8_t *data_end,
+ const uint8_t **p_data_end);
void av1_decode_tg_tiles_and_wrapup(struct AV1Decoder *pbi, const uint8_t *data,
const uint8_t *data_end,
diff --git a/av1/decoder/decoder.c b/av1/decoder/decoder.c
index 8a5aaab..08d423a 100644
--- a/av1/decoder/decoder.c
+++ b/av1/decoder/decoder.c
@@ -374,8 +374,7 @@
#if !CONFIG_OBU
av1_decode_frame_headers_and_setup(pbi, source, source + size, psource);
if (!cm->show_existing_frame) {
- const uint8_t *data =
- source + pbi->uncomp_hdr_size + pbi->first_partition_size;
+ const uint8_t *data = source + pbi->uncomp_hdr_size;
av1_decode_tg_tiles_and_wrapup(pbi, data, source + size, psource, 0,
cm->tile_rows * cm->tile_cols - 1, 1);
}
diff --git a/av1/decoder/decoder.h b/av1/decoder/decoder.h
index e7547ed..7b56a04 100644
--- a/av1/decoder/decoder.h
+++ b/av1/decoder/decoder.h
@@ -92,10 +92,9 @@
int acct_enabled;
Accounting accounting;
#endif
- size_t uncomp_hdr_size; // Size of the uncompressed header
- size_t first_partition_size; // Size of the compressed header
- int tg_size; // Number of tiles in the current tilegroup
- int tg_start; // First tile in the current tilegroup
+ size_t uncomp_hdr_size; // Size of the uncompressed header
+ int tg_size; // Number of tiles in the current tilegroup
+ int tg_start; // First tile in the current tilegroup
int tg_size_bit_offset;
#if CONFIG_INSPECTION
aom_inspect_cb inspect_cb;
diff --git a/av1/decoder/obu.c b/av1/decoder/obu.c
index e540aca..5f8675c 100644
--- a/av1/decoder/obu.c
+++ b/av1/decoder/obu.c
@@ -62,9 +62,8 @@
static uint32_t read_frame_header_obu(AV1Decoder *pbi, const uint8_t *data,
const uint8_t *data_end,
const uint8_t **p_data_end) {
- const size_t header_size =
- av1_decode_frame_headers_and_setup(pbi, data, data_end, p_data_end);
- return (uint32_t)(pbi->uncomp_hdr_size + header_size);
+ av1_decode_frame_headers_and_setup(pbi, data, data_end, p_data_end);
+ return (uint32_t)(pbi->uncomp_hdr_size);
}
static uint32_t read_tile_group_header(AV1Decoder *pbi,
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 1703d15..4335f91 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -83,8 +83,6 @@
struct aom_write_bit_buffer *wb);
#endif
-static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data);
-
#if !CONFIG_OBU || CONFIG_EXT_TILE
static int remux_tiles(const AV1_COMMON *const cm, uint8_t *dst,
const uint32_t data_size, const uint32_t max_tile_size,
@@ -2822,7 +2820,6 @@
const int have_tiles = tile_cols * tile_rows > 1;
struct aom_write_bit_buffer wb = { dst, 0 };
const int n_log2_tiles = cm->log2_tile_rows + cm->log2_tile_cols;
- uint32_t compressed_hdr_size;
// Fixed size tile groups for the moment
const int num_tg_hdrs = cm->num_tg;
const int tg_size =
@@ -2962,22 +2959,8 @@
aom_wb_write_literal(&wb, (1 << n_log2_tiles) - 1, n_log2_tiles);
}
- if (!use_compressed_header(cm)) {
- uncompressed_hdr_size = aom_wb_bytes_written(&wb);
- compressed_hdr_size = 0;
- } else {
- /* Write a placeholder for the compressed header length */
- struct aom_write_bit_buffer comp_hdr_len_wb = wb;
- aom_wb_write_literal(&wb, 0, 16);
-
- uncompressed_hdr_size = aom_wb_bytes_written(&wb);
- compressed_hdr_size =
- write_compressed_header(cpi, dst + uncompressed_hdr_size);
- aom_wb_overwrite_literal(&comp_hdr_len_wb, (int)(compressed_hdr_size),
- 16);
- }
-
- hdr_size = uncompressed_hdr_size + compressed_hdr_size;
+ uncompressed_hdr_size = aom_wb_bytes_written(&wb);
+ hdr_size = uncompressed_hdr_size;
total_size += hdr_size;
for (tile_row = 0; tile_row < tile_rows; tile_row++) {
@@ -3018,10 +3001,6 @@
n_log2_tiles);
// Update the pointer to the last TG params
tg_params_wb.bit_offset = saved_offset + 8 * old_total_size;
- // Copy compressed header
- memmove(dst + old_total_size + uncompressed_hdr_size,
- dst + uncompressed_hdr_size,
- compressed_hdr_size * sizeof(uint8_t));
total_size += hdr_size;
tile_count = 1;
curr_tg_data_size = hdr_size + tile_size + 4;
@@ -3037,10 +3016,6 @@
aom_wb_overwrite_literal(&tg_params_wb, tile_count - 1,
n_log2_tiles);
tg_params_wb.bit_offset = saved_offset + 8 * total_size;
- // Copy compressed header
- memmove(dst + total_size + uncompressed_hdr_size,
- dst + uncompressed_hdr_size,
- compressed_hdr_size * sizeof(uint8_t));
total_size += hdr_size;
tile_count = 0;
curr_tg_data_size = hdr_size;
@@ -3098,13 +3073,11 @@
// Remux if possible. TODO (Thomas Davies): do this for more than one tile
// group
if (have_tiles && tg_count == 1) {
- int data_size =
- total_size - (uncompressed_hdr_size + compressed_hdr_size);
- data_size =
- remux_tiles(cm, dst + uncompressed_hdr_size + compressed_hdr_size,
- data_size, *max_tile_size, *max_tile_col_size,
- &tile_size_bytes, &tile_col_size_bytes);
- total_size = data_size + uncompressed_hdr_size + compressed_hdr_size;
+ int data_size = total_size - uncompressed_hdr_size;
+ data_size = remux_tiles(cm, dst + uncompressed_hdr_size, data_size,
+ *max_tile_size, *max_tile_col_size,
+ &tile_size_bytes, &tile_col_size_bytes);
+ total_size = data_size + uncompressed_hdr_size;
aom_wb_overwrite_literal(&tile_size_bytes_wb, tile_size_bytes - 1, 2);
}
@@ -4204,29 +4177,6 @@
}
#endif // CONFIG_OBU
-static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
- AV1_COMMON *const cm = &cpi->common;
- FRAME_CONTEXT *const fc = cm->fc;
- aom_writer *header_bc;
-
- const int probwt = cm->num_tg;
- (void)probwt;
- (void)fc;
-
- aom_writer real_header_bc;
- header_bc = &real_header_bc;
- aom_start_encode(header_bc, data);
-
- if (!frame_is_intra_only(cm)) {
- if (cm->reference_mode != COMPOUND_REFERENCE &&
- cm->allow_interintra_compound) {
- }
- }
- aom_stop_encode(header_bc);
- assert(header_bc->pos <= 0xffff);
- return header_bc->pos;
-}
-
#if !CONFIG_OBU || CONFIG_EXT_TILE
static int choose_size_bytes(uint32_t size, int spare_msbs) {
// Choose the number of bytes required to represent size, without
@@ -4414,7 +4364,7 @@
AV1_COMMON *const cm = &cpi->common;
struct aom_write_bit_buffer wb = { dst, 0 };
uint32_t total_size = 0;
- uint32_t compressed_hdr_size, uncompressed_hdr_size;
+ uint32_t uncompressed_hdr_size;
write_uncompressed_header_obu(cpi,
#if CONFIG_EXT_TILE
@@ -4435,21 +4385,8 @@
aom_wb_write_literal(&wb, 3, 2);
#endif
- if (!use_compressed_header(cm)) {
- uncompressed_hdr_size = aom_wb_bytes_written(&wb);
- compressed_hdr_size = 0;
- } else {
- // placeholder for the compressed header length
- struct aom_write_bit_buffer compr_hdr_len_wb = wb;
- aom_wb_write_literal(&wb, 0, 16);
-
- uncompressed_hdr_size = aom_wb_bytes_written(&wb);
- compressed_hdr_size =
- write_compressed_header(cpi, dst + uncompressed_hdr_size);
- aom_wb_overwrite_literal(&compr_hdr_len_wb, (int)(compressed_hdr_size), 16);
- }
-
- total_size = uncompressed_hdr_size + compressed_hdr_size;
+ uncompressed_hdr_size = aom_wb_bytes_written(&wb);
+ total_size = uncompressed_hdr_size;
return total_size;
}
@@ -4507,8 +4444,6 @@
#if CONFIG_EXT_TILE
if (cm->large_scale_tile) {
- uint32_t compressed_hdr_size = 0;
-
uint32_t tg_hdr_size =
write_obu_header(OBU_TILE_GROUP, 0, data + PRE_OBU_SIZE_BYTES);
tg_hdr_size += PRE_OBU_SIZE_BYTES;
@@ -4610,13 +4545,6 @@
assert(tile_size_bytes >= 1 && tile_size_bytes <= 4);
aom_wb_write_literal(saved_wb, tile_size_bytes - 1, 2);
}
- // TODO(jbb): Figure out what to do if compressed_hdr_size > 16 bits.
- assert(compressed_hdr_size <= 0xffff);
- // Fill in the compressed header size (but only if we're using one)
- if (use_compressed_header(cm)) {
- aom_wb_write_literal(saved_wb, compressed_hdr_size, 16);
- }
-
total_size += tg_hdr_size;
} else {
#endif // CONFIG_EXT_TILE
@@ -4786,7 +4714,6 @@
#endif
#if CONFIG_EXT_TILE && !CONFIG_OBU
- uint32_t compressed_hdr_size = 0;
uint32_t uncompressed_hdr_size;
struct aom_write_bit_buffer saved_wb;
struct aom_write_bit_buffer wb = { data, 0 };
@@ -4819,20 +4746,9 @@
aom_wb_write_literal(&wb, 0, 2);
}
- if (!use_compressed_header(cm)) {
- uncompressed_hdr_size = (uint32_t)aom_wb_bytes_written(&wb);
- aom_clear_system_state();
- compressed_hdr_size = 0;
- } else {
- // Size of compressed header
- aom_wb_write_literal(&wb, 0, 16);
- uncompressed_hdr_size = (uint32_t)aom_wb_bytes_written(&wb);
- aom_clear_system_state();
- // Write the compressed header
- compressed_hdr_size =
- write_compressed_header(cpi, data + uncompressed_hdr_size);
- }
- data += uncompressed_hdr_size + compressed_hdr_size;
+ uncompressed_hdr_size = (uint32_t)aom_wb_bytes_written(&wb);
+ aom_clear_system_state();
+ data += uncompressed_hdr_size;
#define EXT_TILE_DEBUG 0
#if EXT_TILE_DEBUG
@@ -4842,9 +4758,8 @@
fn[5] = (cm->current_video_frame % 100) / 10 + '0';
fn[6] = (cm->current_video_frame % 10) + '0';
fn[7] = '\0';
- av1_print_uncompressed_frame_header(
- data - uncompressed_hdr_size - compressed_hdr_size,
- uncompressed_hdr_size, fn);
+ av1_print_uncompressed_frame_header(data - uncompressed_hdr_size,
+ uncompressed_hdr_size, fn);
}
#endif // EXT_TILE_DEBUG
#undef EXT_TILE_DEBUG
@@ -4877,12 +4792,6 @@
assert(tile_size_bytes >= 1 && tile_size_bytes <= 4);
aom_wb_write_literal(&saved_wb, tile_size_bytes - 1, 2);
}
- // TODO(jbb): Figure out what to do if compressed_hdr_size > 16 bits.
- assert(compressed_hdr_size <= 0xffff);
- // Fill in the compressed header size (but only if we're using one)
- if (use_compressed_header(cm)) {
- aom_wb_write_literal(&saved_wb, compressed_hdr_size, 16);
- }
} else {
#endif // CONFIG_EXT_TILE
data += data_size;