Merge "Passing block index explicitly instead of using get_sb_index()."

This commit is contained in:
Dmitry Kovalev 2013-10-18 11:51:24 -07:00 committed by Gerrit Code Review
commit c093b6228c
4 changed files with 53 additions and 59 deletions

View File

@ -234,31 +234,6 @@ typedef struct macroblockd {
int q_index; int q_index;
} MACROBLOCKD; } 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, static INLINE void update_partition_context(MACROBLOCKD *xd, BLOCK_SIZE sb_type,
BLOCK_SIZE sb_size) { BLOCK_SIZE sb_size) {
const int bsl = b_width_log2(sb_size), bs = (1 << bsl) / 2; const int bsl = b_width_log2(sb_size), bs = (1 << bsl) / 2;

View File

@ -224,14 +224,14 @@ static void set_ref(VP9D_COMP *pbi, int i, int mi_row, int mi_col) {
static void decode_modes_b(VP9D_COMP *pbi, int tile_col, static void decode_modes_b(VP9D_COMP *pbi, int tile_col,
int mi_row, int mi_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; MACROBLOCKD *const xd = &pbi->mb;
const int less8x8 = bsize < BLOCK_8X8; const int less8x8 = bsize < BLOCK_8X8;
MB_MODE_INFO *mbmi; MB_MODE_INFO *mbmi;
int eobtotal; int eobtotal;
if (less8x8) if (less8x8)
if (xd->ab_index > 0) if (index > 0)
return; return;
set_offsets(pbi, bsize, tile_col, mi_row, mi_col); set_offsets(pbi, bsize, tile_col, mi_row, mi_col);
@ -271,9 +271,10 @@ static void decode_modes_b(VP9D_COMP *pbi, int tile_col,
xd->corrupted |= vp9_reader_has_error(r); xd->corrupted |= vp9_reader_has_error(r);
} }
static void decode_modes_sb(VP9D_COMP *pbi, int tile_col, static void decode_modes_sb(VP9D_COMP *pbi, int tile_col,
int mi_row, int mi_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; VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb; MACROBLOCKD *const xd = &pbi->mb;
const int hbs = num_8x8_blocks_wide_lookup[bsize] / 2; const int hbs = num_8x8_blocks_wide_lookup[bsize] / 2;
@ -284,7 +285,7 @@ static void decode_modes_sb(VP9D_COMP *pbi, int tile_col,
return; return;
if (bsize < BLOCK_8X8) { if (bsize < BLOCK_8X8) {
if (xd->ab_index != 0) if (index > 0)
return; return;
} else { } else {
int pl; int pl;
@ -306,31 +307,27 @@ static void decode_modes_sb(VP9D_COMP *pbi, int tile_col,
} }
subsize = get_subsize(bsize, partition); subsize = get_subsize(bsize, partition);
*get_sb_index(xd, subsize) = 0;
switch (partition) { switch (partition) {
case PARTITION_NONE: 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; break;
case PARTITION_HORZ: case PARTITION_HORZ:
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);
*get_sb_index(xd, subsize) = 1;
if (mi_row + hbs < cm->mi_rows) 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; break;
case PARTITION_VERT: case PARTITION_VERT:
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);
*get_sb_index(xd, subsize) = 1;
if (mi_col + hbs < cm->mi_cols) 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; break;
case PARTITION_SPLIT: { case PARTITION_SPLIT: {
int n; int n;
for (n = 0; n < 4; n++) { for (n = 0; n < 4; n++) {
const int j = n >> 1, i = n & 1; 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, decode_modes_sb(pbi, tile_col, mi_row + j * hbs, mi_col + i * hbs,
r, subsize); r, subsize, n);
} }
} break; } break;
default: default:
@ -611,7 +608,7 @@ static void decode_tile(VP9D_COMP *pbi, vp9_reader *r, int tile_col) {
vp9_zero(cm->left_seg_context); vp9_zero(cm->left_seg_context);
for (mi_col = cm->cur_tile_mi_col_start; mi_col < cm->cur_tile_mi_col_end; for (mi_col = cm->cur_tile_mi_col_start; mi_col < cm->cur_tile_mi_col_end;
mi_col += MI_BLOCK_SIZE) 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) { if (pbi->do_loopfilter_inline) {
// delay the loopfilter by 1 macroblock row. // delay the loopfilter by 1 macroblock row.

View File

@ -565,13 +565,13 @@ static void write_mb_modes_kf(const VP9_COMP *cpi, MODE_INFO **mi_8x8,
static void write_modes_b(VP9_COMP *cpi, MODE_INFO **mi_8x8, vp9_writer *bc, static void write_modes_b(VP9_COMP *cpi, MODE_INFO **mi_8x8, vp9_writer *bc,
TOKENEXTRA **tok, TOKENEXTRA *tok_end, 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; VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->mb.e_mbd; MACROBLOCKD *const xd = &cpi->mb.e_mbd;
MODE_INFO *m = mi_8x8[0]; MODE_INFO *m = mi_8x8[0];
if (m->mbmi.sb_type < BLOCK_8X8) if (m->mbmi.sb_type < BLOCK_8X8)
if (xd->ab_index > 0) if (index > 0)
return; return;
xd->mi_8x8 = mi_8x8; xd->mi_8x8 = mi_8x8;
@ -597,7 +597,8 @@ static void write_modes_b(VP9_COMP *cpi, MODE_INFO **mi_8x8, vp9_writer *bc,
static void write_modes_sb(VP9_COMP *cpi, MODE_INFO **mi_8x8, vp9_writer *bc, static void write_modes_sb(VP9_COMP *cpi, MODE_INFO **mi_8x8, vp9_writer *bc,
TOKENEXTRA **tok, TOKENEXTRA *tok_end, 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; VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *xd = &cpi->mb.e_mbd; MACROBLOCKD *xd = &cpi->mb.e_mbd;
const int mis = cm->mode_info_stride; const int mis = cm->mode_info_stride;
@ -613,11 +614,10 @@ static void write_modes_sb(VP9_COMP *cpi, MODE_INFO **mi_8x8, vp9_writer *bc,
partition = partition_lookup[bsl][m->mbmi.sb_type]; partition = partition_lookup[bsl][m->mbmi.sb_type];
if (bsize < BLOCK_8X8) if (bsize < BLOCK_8X8) {
if (xd->ab_index > 0) if (index > 0)
return; return;
} else {
if (bsize >= BLOCK_8X8) {
int pl; int pl;
const int idx = check_bsize_coverage(bs, cm->mi_rows, cm->mi_cols, const int idx = check_bsize_coverage(bs, cm->mi_rows, cm->mi_cols,
mi_row, mi_col); mi_row, mi_col);
@ -634,31 +634,28 @@ static void write_modes_sb(VP9_COMP *cpi, MODE_INFO **mi_8x8, vp9_writer *bc,
} }
subsize = get_subsize(bsize, partition); subsize = get_subsize(bsize, partition);
*(get_sb_index(xd, subsize)) = 0;
switch (partition) { switch (partition) {
case PARTITION_NONE: 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; break;
case PARTITION_HORZ: case PARTITION_HORZ:
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);
*(get_sb_index(xd, subsize)) = 1;
if ((mi_row + bs) < cm->mi_rows) if ((mi_row + bs) < cm->mi_rows)
write_modes_b(cpi, mi_8x8 + bs * mis, bc, tok, tok_end, mi_row + bs, write_modes_b(cpi, mi_8x8 + bs * mis, bc, tok, tok_end, mi_row + bs,
mi_col); mi_col, 1);
break; break;
case PARTITION_VERT: case PARTITION_VERT:
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);
*(get_sb_index(xd, subsize)) = 1;
if ((mi_col + bs) < cm->mi_cols) 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; break;
case PARTITION_SPLIT: case PARTITION_SPLIT:
for (n = 0; n < 4; n++) { for (n = 0; n < 4; n++) {
int j = n >> 1, i = n & 0x01; const int j = n >> 1, i = n & 1;
*(get_sb_index(xd, subsize)) = n;
write_modes_sb(cpi, mi_8x8 + j * bs * mis + i * bs, bc, tok, tok_end, 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; break;
default: default:
@ -690,7 +687,7 @@ static void write_modes(VP9_COMP *cpi, vp9_writer* const bc,
for (mi_col = cm->cur_tile_mi_col_start; mi_col < cm->cur_tile_mi_col_end; 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) { mi_col += MI_BLOCK_SIZE, m_8x8 += MI_BLOCK_SIZE) {
write_modes_sb(cpi, m_8x8, bc, tok, tok_end, mi_row, mi_col, write_modes_sb(cpi, m_8x8, bc, tok, tok_end, mi_row, mi_col,
BLOCK_64X64); BLOCK_64X64, 0);
} }
} }
} }

View File

@ -59,6 +59,31 @@ static const TX_SIZE tx_mode_to_biggest_tx_size[TX_MODES] = {
int enc_debug = 0; int enc_debug = 0;
#endif #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, static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
int mi_row, int mi_col, BLOCK_SIZE bsize); int mi_row, int mi_col, BLOCK_SIZE bsize);