Commit 5a1c9533 authored by Jingning Han's avatar Jingning Han
Browse files

Refactor encode_sb_ for 4x8/8x4 partition

Deprecate set_block_index. Replace it with get_sb_index_ for
consistency with partition search and bit-stream writing/reading.

Use b_width/height_log2 instead of mi_width/height_log2, to support
4x4 resolution partition types.

Change-Id: Ic1e71981e163c669f7ea6b3c12b831c284c4a494
parent f0ab155e
...@@ -710,24 +710,6 @@ static void update_stats(VP9_COMP *cpi, int mi_row, int mi_col) { ...@@ -710,24 +710,6 @@ static void update_stats(VP9_COMP *cpi, int mi_row, int mi_col) {
} }
} }
static void set_block_index(MACROBLOCKD *xd, int idx,
BLOCK_SIZE_TYPE bsize) {
if (bsize >= BLOCK_SIZE_SB32X32) {
xd->sb_index = idx;
} else if (bsize >= BLOCK_SIZE_MB16X16) {
xd->mb_index = idx;
} else {
#if CONFIG_AB4X4
if (bsize >= BLOCK_SIZE_SB8X8)
xd->b_index = idx;
else
xd->ab_index = idx;
#else
xd->b_index = idx;
#endif
}
}
// TODO(jingning): the variables used here are little complicated. need further // TODO(jingning): the variables used here are little complicated. need further
// refactoring on organizing the the temporary buffers, when recursive // refactoring on organizing the the temporary buffers, when recursive
// partition down to 4x4 block size is enabled. // partition down to 4x4 block size is enabled.
...@@ -831,7 +813,7 @@ static void encode_b(VP9_COMP *cpi, TOKENEXTRA **tp, ...@@ -831,7 +813,7 @@ static void encode_b(VP9_COMP *cpi, TOKENEXTRA **tp,
return; return;
if (sub_index != -1) if (sub_index != -1)
set_block_index(xd, sub_index, bsize); *(get_sb_index(xd, bsize)) = sub_index;
set_offsets(cpi, mi_row, mi_col, bsize); set_offsets(cpi, mi_row, mi_col, bsize);
update_state(cpi, get_block_context(x, bsize), bsize, output_enabled); update_state(cpi, get_block_context(x, bsize), bsize, output_enabled);
encode_superblock(cpi, tp, output_enabled, mi_row, mi_col, bsize); encode_superblock(cpi, tp, output_enabled, mi_row, mi_col, bsize);
...@@ -851,7 +833,7 @@ static void encode_sb(VP9_COMP *cpi, TOKENEXTRA **tp, ...@@ -851,7 +833,7 @@ static void encode_sb(VP9_COMP *cpi, TOKENEXTRA **tp,
MACROBLOCK *const x = &cpi->mb; MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
BLOCK_SIZE_TYPE c1 = BLOCK_SIZE_SB8X8; BLOCK_SIZE_TYPE c1 = BLOCK_SIZE_SB8X8;
const int bsl = mi_width_log2(bsize), bs = (1 << bsl) / 2; const int bsl = b_width_log2(bsize), bs = (1 << bsl) / 4;
int bwl, bhl; int bwl, bhl;
int UNINITIALIZED_IS_SAFE(pl); int UNINITIALIZED_IS_SAFE(pl);
...@@ -870,7 +852,7 @@ static void encode_sb(VP9_COMP *cpi, TOKENEXTRA **tp, ...@@ -870,7 +852,7 @@ static void encode_sb(VP9_COMP *cpi, TOKENEXTRA **tp,
c1 = *(get_sb_partitioning(x, bsize)); c1 = *(get_sb_partitioning(x, bsize));
} }
bwl = mi_width_log2(c1), bhl = mi_height_log2(c1); bwl = b_width_log2(c1), bhl = b_height_log2(c1);
if (bsl == bwl && bsl == bhl) { if (bsl == bwl && bsl == bhl) {
#if CONFIG_AB4X4 #if CONFIG_AB4X4
...@@ -909,7 +891,7 @@ static void encode_sb(VP9_COMP *cpi, TOKENEXTRA **tp, ...@@ -909,7 +891,7 @@ static void encode_sb(VP9_COMP *cpi, TOKENEXTRA **tp,
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
const int x_idx = i & 1, y_idx = i >> 1; const int x_idx = i & 1, y_idx = i >> 1;
set_block_index(xd, i, subsize); *(get_sb_index(xd, subsize)) = i;
encode_sb(cpi, tp, mi_row + y_idx * bs, mi_col + x_idx * bs, encode_sb(cpi, tp, mi_row + y_idx * bs, mi_col + x_idx * bs,
output_enabled, subsize); output_enabled, subsize);
} }
......
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