Commit e7142e11 authored by Yunqing Wang's avatar Yunqing Wang

Remove compressed header related code

Removed compressed header related code that is not used anymore.

Change-Id: I8e4881ecf9a4e0a25bd59a456eab9815d4bdd418
parent 50e9a1eb
......@@ -1376,11 +1376,6 @@ static INLINE int all_lossless(const AV1_COMMON *cm, const MACROBLOCKD *xd) {
return all_lossless;
}
static INLINE int use_compressed_header(const AV1_COMMON *cm) {
(void)cm;
return 0;
}
#ifdef __cplusplus
} // extern "C"
#endif
......
......@@ -1829,7 +1829,7 @@ static void get_tile_buffers(AV1Decoder *pbi, const uint8_t *data,
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 @@ static void show_existing_frame_reset(AV1Decoder *const pbi) {
}
#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 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
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 @@ static void dec_setup_frame_boundary_info(AV1_COMMON *const cm) {
}
}
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 @@ size_t av1_decode_frame_headers_and_setup(AV1Decoder *pbi, const uint8_t *data,
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 @@ size_t av1_decode_frame_headers_and_setup(AV1Decoder *pbi, const uint8_t *data,
}
#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 @@ size_t av1_decode_frame_headers_and_setup(AV1Decoder *pbi, const uint8_t *data,
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 @@ size_t av1_decode_frame_headers_and_setup(AV1Decoder *pbi, const uint8_t *data,
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
......
......@@ -37,10 +37,10 @@ BITSTREAM_PROFILE av1_read_profile(struct aom_read_bit_buffer *rb);
// 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,
......
......@@ -374,8 +374,7 @@ int av1_receive_compressed_data(AV1Decoder *pbi, size_t size,
#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);
}
......
......@@ -92,10 +92,9 @@ typedef struct AV1Decoder {
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;
......
......@@ -62,9 +62,8 @@ static uint32_t read_sequence_header_obu(AV1Decoder *pbi,
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,
......
......@@ -83,8 +83,6 @@ static void write_uncompressed_header_frame(AV1_COMP *cpi,
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 @@ static uint32_t write_tiles(AV1_COMP *const cpi, uint8_t *const dst,
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 @@ static uint32_t write_tiles(AV1_COMP *const cpi, uint8_t *const dst,
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 @@ static uint32_t write_tiles(AV1_COMP *const cpi, uint8_t *const dst,
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 @@ static uint32_t write_tiles(AV1_COMP *const cpi, uint8_t *const dst,
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 @@ static uint32_t write_tiles(AV1_COMP *const cpi, uint8_t *const dst,
// 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 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
}
#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 @@ static uint32_t write_frame_header_obu(AV1_COMP *cpi,
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 @@ static uint32_t write_frame_header_obu(AV1_COMP *cpi,
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 @@ static uint32_t write_tiles_in_tg_obus(AV1_COMP *const cpi, uint8_t *const dst,
#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 @@ static uint32_t write_tiles_in_tg_obus(AV1_COMP *const cpi, uint8_t *const dst,
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 @@ void av1_pack_bitstream(AV1_COMP *const cpi, uint8_t *dst, size_t *size) {
#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 @@ void av1_pack_bitstream(AV1_COMP *const cpi, uint8_t *dst, size_t *size) {
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 @@ void av1_pack_bitstream(AV1_COMP *const cpi, uint8_t *dst, size_t *size) {
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 @@ void av1_pack_bitstream(AV1_COMP *const cpi, uint8_t *dst, size_t *size) {
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment