ref: c093b6228c9ddabf989774a7a01d533f90875ae6
parent: ce34b6f50d8b8316d7b42812c2bf28ee3c5f0468
parent: a8ffa96e9bdc72fa74b0165111880305bcb0d19a
author: Dmitry Kovalev <[email protected]>
date: Fri Oct 18 07:51:24 EDT 2013
Merge "Passing block index explicitly instead of using get_sb_index()."
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -234,31 +234,6 @@
int q_index;
} MACROBLOCKD;
-static INLINE uint8_t *get_sb_index(MACROBLOCKD *xd, BLOCK_SIZE subsize) {
- switch (subsize) {
- case BLOCK_64X64:
- case BLOCK_64X32:
- case BLOCK_32X64:
- case BLOCK_32X32:
- return &xd->sb_index;
- case BLOCK_32X16:
- case BLOCK_16X32:
- case BLOCK_16X16:
- return &xd->mb_index;
- case BLOCK_16X8:
- case BLOCK_8X16:
- case BLOCK_8X8:
- return &xd->b_index;
- case BLOCK_8X4:
- case BLOCK_4X8:
- case BLOCK_4X4:
- return &xd->ab_index;
- default:
- assert(0);
- return NULL;
- }
-}
-
static INLINE void update_partition_context(MACROBLOCKD *xd, BLOCK_SIZE sb_type,
BLOCK_SIZE sb_size) {
const int bsl = b_width_log2(sb_size), bs = (1 << bsl) / 2;
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -224,7 +224,7 @@
static void decode_modes_b(VP9D_COMP *pbi, int tile_col,
int mi_row, int mi_col,
- vp9_reader *r, BLOCK_SIZE bsize) {
+ vp9_reader *r, BLOCK_SIZE bsize, int index) {
MACROBLOCKD *const xd = &pbi->mb;
const int less8x8 = bsize < BLOCK_8X8;
MB_MODE_INFO *mbmi;
@@ -231,7 +231,7 @@
int eobtotal;
if (less8x8)
- if (xd->ab_index > 0)
+ if (index > 0)
return;
set_offsets(pbi, bsize, tile_col, mi_row, mi_col);
@@ -271,9 +271,10 @@
xd->corrupted |= vp9_reader_has_error(r);
}
+
static void decode_modes_sb(VP9D_COMP *pbi, int tile_col,
int mi_row, int mi_col,
- vp9_reader* r, BLOCK_SIZE bsize) {
+ vp9_reader* r, BLOCK_SIZE bsize, int index) {
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
const int hbs = num_8x8_blocks_wide_lookup[bsize] / 2;
@@ -284,7 +285,7 @@
return;
if (bsize < BLOCK_8X8) {
- if (xd->ab_index != 0)
+ if (index > 0)
return;
} else {
int pl;
@@ -306,31 +307,27 @@
}
subsize = get_subsize(bsize, partition);
- *get_sb_index(xd, subsize) = 0;
switch (partition) {
case PARTITION_NONE:
- decode_modes_b(pbi, tile_col, mi_row, mi_col, r, subsize);
+ decode_modes_b(pbi, tile_col, mi_row, mi_col, r, subsize, 0);
break;
case PARTITION_HORZ:
- decode_modes_b(pbi, tile_col, mi_row, mi_col, r, subsize);
- *get_sb_index(xd, subsize) = 1;
+ decode_modes_b(pbi, tile_col, mi_row, mi_col, r, subsize, 0);
if (mi_row + hbs < cm->mi_rows)
- decode_modes_b(pbi, tile_col, mi_row + hbs, mi_col, r, subsize);
+ decode_modes_b(pbi, tile_col, mi_row + hbs, mi_col, r, subsize, 1);
break;
case PARTITION_VERT:
- decode_modes_b(pbi, tile_col, mi_row, mi_col, r, subsize);
- *get_sb_index(xd, subsize) = 1;
+ decode_modes_b(pbi, tile_col, mi_row, mi_col, r, subsize, 0);
if (mi_col + hbs < cm->mi_cols)
- decode_modes_b(pbi, tile_col, mi_row, mi_col + hbs, r, subsize);
+ decode_modes_b(pbi, tile_col, mi_row, mi_col + hbs, r, subsize, 1);
break;
case PARTITION_SPLIT: {
int n;
for (n = 0; n < 4; n++) {
const int j = n >> 1, i = n & 1;
- *get_sb_index(xd, subsize) = n;
decode_modes_sb(pbi, tile_col, mi_row + j * hbs, mi_col + i * hbs,
- r, subsize);
+ r, subsize, n);
}
} break;
default:
@@ -611,7 +608,7 @@
vp9_zero(cm->left_seg_context);
for (mi_col = cm->cur_tile_mi_col_start; mi_col < cm->cur_tile_mi_col_end;
mi_col += MI_BLOCK_SIZE)
- decode_modes_sb(pbi, tile_col, mi_row, mi_col, r, BLOCK_64X64);
+ decode_modes_sb(pbi, tile_col, mi_row, mi_col, r, BLOCK_64X64, 0);
if (pbi->do_loopfilter_inline) {
// delay the loopfilter by 1 macroblock row.
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -565,13 +565,13 @@
static void write_modes_b(VP9_COMP *cpi, MODE_INFO **mi_8x8, vp9_writer *bc,
TOKENEXTRA **tok, TOKENEXTRA *tok_end,
- int mi_row, int mi_col) {
+ int mi_row, int mi_col, int index) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->mb.e_mbd;
MODE_INFO *m = mi_8x8[0];
if (m->mbmi.sb_type < BLOCK_8X8)
- if (xd->ab_index > 0)
+ if (index > 0)
return;
xd->mi_8x8 = mi_8x8;
@@ -597,7 +597,8 @@
static void write_modes_sb(VP9_COMP *cpi, MODE_INFO **mi_8x8, vp9_writer *bc,
TOKENEXTRA **tok, TOKENEXTRA *tok_end,
- int mi_row, int mi_col, BLOCK_SIZE bsize) {
+ int mi_row, int mi_col, BLOCK_SIZE bsize,
+ int index) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *xd = &cpi->mb.e_mbd;
const int mis = cm->mode_info_stride;
@@ -613,11 +614,10 @@
partition = partition_lookup[bsl][m->mbmi.sb_type];
- if (bsize < BLOCK_8X8)
- if (xd->ab_index > 0)
+ if (bsize < BLOCK_8X8) {
+ if (index > 0)
return;
-
- if (bsize >= BLOCK_8X8) {
+ } else {
int pl;
const int idx = check_bsize_coverage(bs, cm->mi_rows, cm->mi_cols,
mi_row, mi_col);
@@ -634,31 +634,28 @@
}
subsize = get_subsize(bsize, partition);
- *(get_sb_index(xd, subsize)) = 0;
switch (partition) {
case PARTITION_NONE:
- write_modes_b(cpi, mi_8x8, bc, tok, tok_end, mi_row, mi_col);
+ write_modes_b(cpi, mi_8x8, bc, tok, tok_end, mi_row, mi_col, 0);
break;
case PARTITION_HORZ:
- write_modes_b(cpi, mi_8x8, bc, tok, tok_end, mi_row, mi_col);
- *(get_sb_index(xd, subsize)) = 1;
+ write_modes_b(cpi, mi_8x8, bc, tok, tok_end, mi_row, mi_col, 0);
if ((mi_row + bs) < cm->mi_rows)
write_modes_b(cpi, mi_8x8 + bs * mis, bc, tok, tok_end, mi_row + bs,
- mi_col);
+ mi_col, 1);
break;
case PARTITION_VERT:
- write_modes_b(cpi, mi_8x8, bc, tok, tok_end, mi_row, mi_col);
- *(get_sb_index(xd, subsize)) = 1;
+ write_modes_b(cpi, mi_8x8, bc, tok, tok_end, mi_row, mi_col, 0);
if ((mi_col + bs) < cm->mi_cols)
- write_modes_b(cpi, mi_8x8 + bs, bc, tok, tok_end, mi_row, mi_col + bs);
+ write_modes_b(cpi, mi_8x8 + bs, bc, tok, tok_end, mi_row, mi_col + bs,
+ 1);
break;
case PARTITION_SPLIT:
for (n = 0; n < 4; n++) {
- int j = n >> 1, i = n & 0x01;
- *(get_sb_index(xd, subsize)) = n;
+ const int j = n >> 1, i = n & 1;
write_modes_sb(cpi, mi_8x8 + j * bs * mis + i * bs, bc, tok, tok_end,
- mi_row + j * bs, mi_col + i * bs, subsize);
+ mi_row + j * bs, mi_col + i * bs, subsize, n);
}
break;
default:
@@ -690,7 +687,7 @@
for (mi_col = cm->cur_tile_mi_col_start; mi_col < cm->cur_tile_mi_col_end;
mi_col += MI_BLOCK_SIZE, m_8x8 += MI_BLOCK_SIZE) {
write_modes_sb(cpi, m_8x8, bc, tok, tok_end, mi_row, mi_col,
- BLOCK_64X64);
+ BLOCK_64X64, 0);
}
}
}
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -59,6 +59,31 @@
int enc_debug = 0;
#endif
+static INLINE uint8_t *get_sb_index(MACROBLOCKD *xd, BLOCK_SIZE subsize) {
+ switch (subsize) {
+ case BLOCK_64X64:
+ case BLOCK_64X32:
+ case BLOCK_32X64:
+ case BLOCK_32X32:
+ return &xd->sb_index;
+ case BLOCK_32X16:
+ case BLOCK_16X32:
+ case BLOCK_16X16:
+ return &xd->mb_index;
+ case BLOCK_16X8:
+ case BLOCK_8X16:
+ case BLOCK_8X8:
+ return &xd->b_index;
+ case BLOCK_8X4:
+ case BLOCK_4X8:
+ case BLOCK_4X4:
+ return &xd->ab_index;
+ default:
+ assert(0);
+ return NULL;
+ }
+}
+
static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
int mi_row, int mi_col, BLOCK_SIZE bsize);