Commit d2630fa4 authored by Debargha Mukherjee's avatar Debargha Mukherjee

Move sb_size to the keyframe (sequence) header

This patch moves the sb_size to the keyframe header from all frame
headers as discussed in the AOM Codec WG meeting.

Change-Id: Ia0190e57b36b98e51ab61ad4ff14f24f9c294877
parent 787eb3d1
......@@ -3085,6 +3085,15 @@ static void setup_frame_size(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
pool->frame_bufs[cm->new_fb_idx].buf.render_height = cm->render_height;
}
static void setup_sb_size(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
(void)rb;
#if CONFIG_EXT_PARTITION
set_sb_size(cm, aom_rb_read_bit(rb) ? BLOCK_128X128 : BLOCK_64X64);
#else
set_sb_size(cm, BLOCK_64X64);
#endif // CONFIG_EXT_PARTITION
}
static INLINE int valid_ref_frame_img_fmt(aom_bit_depth_t ref_bit_depth,
int ref_xss, int ref_yss,
aom_bit_depth_t this_bit_depth,
......@@ -4720,6 +4729,8 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
}
setup_frame_size(cm, rb);
setup_sb_size(cm, rb);
if (pbi->need_resync) {
memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map));
pbi->need_resync = 0;
......@@ -4967,12 +4978,6 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
if (frame_is_intra_only(cm) || cm->error_resilient_mode)
av1_setup_past_independence(cm);
#if CONFIG_EXT_PARTITION
set_sb_size(cm, aom_rb_read_bit(rb) ? BLOCK_128X128 : BLOCK_64X64);
#else
set_sb_size(cm, BLOCK_64X64);
#endif // CONFIG_EXT_PARTITION
setup_loopfilter(cm, rb);
setup_quantization(cm, rb);
xd->bd = (int)cm->bit_depth;
......
......@@ -4319,6 +4319,20 @@ void write_sequence_header(
}
#endif
static void write_sb_size(const AV1_COMMON *cm,
struct aom_write_bit_buffer *wb) {
(void)cm;
(void)wb;
assert(cm->mib_size == mi_size_wide[cm->sb_size]);
assert(cm->mib_size == 1 << cm->mib_size_log2);
#if CONFIG_EXT_PARTITION
assert(cm->sb_size == BLOCK_128X128 || cm->sb_size == BLOCK_64X64);
aom_wb_write_bit(wb, cm->sb_size == BLOCK_128X128 ? 1 : 0);
#else
assert(cm->sb_size == BLOCK_64X64);
#endif // CONFIG_EXT_PARTITION
}
#if CONFIG_EXT_INTER
static void write_compound_tools(const AV1_COMMON *cm,
struct aom_write_bit_buffer *wb) {
......@@ -4538,6 +4552,8 @@ static void write_uncompressed_header_frame(AV1_COMP *cpi,
write_sync_code(wb);
write_bitdepth_colorspace_sampling(cm, wb);
write_frame_size(cm, wb);
write_sb_size(cm, wb);
#if CONFIG_ANS && ANS_MAX_SYMBOLS
assert(cpi->common.ans_window_size_log2 >= 8);
assert(cpi->common.ans_window_size_log2 < 24);
......@@ -4684,15 +4700,6 @@ static void write_uncompressed_header_frame(AV1_COMP *cpi,
#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING
aom_wb_write_literal(wb, cm->frame_context_idx, FRAME_CONTEXTS_LOG2);
#endif
assert(cm->mib_size == mi_size_wide[cm->sb_size]);
assert(cm->mib_size == 1 << cm->mib_size_log2);
#if CONFIG_EXT_PARTITION
assert(cm->sb_size == BLOCK_128X128 || cm->sb_size == BLOCK_64X64);
aom_wb_write_bit(wb, cm->sb_size == BLOCK_128X128 ? 1 : 0);
#else
assert(cm->sb_size == BLOCK_64X64);
#endif // CONFIG_EXT_PARTITION
encode_loopfilter(cm, wb);
encode_quantization(cm, wb);
encode_segmentation(cm, xd, wb);
......@@ -4829,8 +4836,9 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
if (cm->frame_type == KEY_FRAME) {
write_sync_code(wb);
write_frame_size(cm, wb);
write_sb_size(cm, wb);
#if CONFIG_ANS && ANS_MAX_SYMBOLS
assert(cpi->common.ans_window_size_log2 >= 8);
assert(cpi->common.ans_window_size_log2 < 24);
......@@ -5041,15 +5049,6 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
#if !CONFIG_NO_FRAME_CONTEXT_SIGNALING
aom_wb_write_literal(wb, cm->frame_context_idx, FRAME_CONTEXTS_LOG2);
#endif
assert(cm->mib_size == mi_size_wide[cm->sb_size]);
assert(cm->mib_size == 1 << cm->mib_size_log2);
#if CONFIG_EXT_PARTITION
assert(cm->sb_size == BLOCK_128X128 || cm->sb_size == BLOCK_64X64);
aom_wb_write_bit(wb, cm->sb_size == BLOCK_128X128 ? 1 : 0);
#else
assert(cm->sb_size == BLOCK_64X64);
#endif // CONFIG_EXT_PARTITION
encode_loopfilter(cm, wb);
encode_quantization(cm, wb);
encode_segmentation(cm, xd, wb);
......
......@@ -344,6 +344,7 @@ static void setup_frame(AV1_COMP *cpi) {
cpi->refresh_golden_frame = 1;
cpi->refresh_alt_ref_frame = 1;
av1_zero(cpi->interp_filter_selected);
set_sb_size(cm, select_sb_size(cpi));
} else {
#if CONFIG_NO_FRAME_CONTEXT_SIGNALING
if (frame_is_intra_only(cm) || cm->error_resilient_mode ||
......@@ -380,8 +381,6 @@ static void setup_frame(AV1_COMP *cpi) {
#endif // CONFIG_NO_FRAME_CONTEXT_SIGNALING
cpi->vaq_refresh = 0;
set_sb_size(cm, select_sb_size(cpi));
}
static void enc_setup_mi(AV1_COMMON *cm) {
......
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