Remove compressed header related code
Removed compressed header related code that is not used anymore.
Change-Id: I8e4881ecf9a4e0a25bd59a456eab9815d4bdd418
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;