static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize,
PARTITION_TYPE partition) {
- return subsize_lookup[partition][bsize];
-}
-
-#if CONFIG_EXT_PARTITION_TYPES
-static INLINE PARTITION_TYPE get_partition(const MODE_INFO *const mi,
- int mi_stride, int mi_rows,
- int mi_cols, int mi_row,
- int mi_col, BLOCK_SIZE bsize) {
- const int bsl = b_width_log2_lookup[bsize];
- const int bs = (1 << bsl) / 4;
- MODE_INFO m = mi[mi_row * mi_stride + mi_col];
- PARTITION_TYPE partition = partition_lookup[bsl][m.mbmi.sb_type];
- if (partition != PARTITION_NONE && bsize > BLOCK_8X8 &&
- mi_row + bs < mi_rows && mi_col + bs < mi_cols) {
- BLOCK_SIZE h = get_subsize(bsize, PARTITION_HORZ_A);
- BLOCK_SIZE v = get_subsize(bsize, PARTITION_VERT_A);
- MODE_INFO m_right = mi[mi_row * mi_stride + mi_col + bs];
- MODE_INFO m_below = mi[(mi_row + bs) * mi_stride + mi_col];
- if (m.mbmi.sb_type == h) {
- return m_below.mbmi.sb_type == h ? PARTITION_HORZ : PARTITION_HORZ_B;
- } else if (m.mbmi.sb_type == v) {
- return m_right.mbmi.sb_type == v ? PARTITION_VERT : PARTITION_VERT_B;
- } else if (m_below.mbmi.sb_type == h) {
- return PARTITION_HORZ_A;
- } else if (m_right.mbmi.sb_type == v) {
- return PARTITION_VERT_A;
- } else {
- return PARTITION_SPLIT;
- }
- }
- return partition;
+ if (partition == PARTITION_INVALID)
+ return PARTITION_INVALID;
+ else
+ return subsize_lookup[partition][bsize];
}
-#endif // CONFIG_EXT_PARTITION_TYPES
static const TX_TYPE intra_mode_to_tx_type_context[INTRA_MODES] = {
DCT_DCT, // DC
const YV12_BUFFER_CONFIG *show = cm->frame_to_show;
// Last decoded frame and will store the MFQE result.
YV12_BUFFER_CONFIG *dest = &cm->post_proc_buffer;
+
+#if CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES
+ // TODO(any): Fix for ext parition types and 128 superblocks
+ assert(0);
+#endif // CONFIG_EXT_PARTITION || CONFIG_EXT_PARTITION_TYPES
+
// Loop through each super block.
for (mi_row = 0; mi_row < cm->mi_rows; mi_row += MAX_MIB_SIZE) {
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
}
#endif
+static INLINE PARTITION_TYPE get_partition(const VP10_COMMON *const cm,
+ const int mi_row,
+ const int mi_col,
+ const BLOCK_SIZE bsize) {
+ if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) {
+ return PARTITION_INVALID;
+ } else {
+ const int offset = mi_row * cm->mi_stride + mi_col;
+ MODE_INFO **mi = cm->mi_grid_visible + offset;
+ const MB_MODE_INFO *const mbmi = &mi[0]->mbmi;
+ const int bsl = b_width_log2_lookup[bsize];
+ const PARTITION_TYPE partition = partition_lookup[bsl][mbmi->sb_type];
+#if !CONFIG_EXT_PARTITION_TYPES
+ return partition;
+#else
+ const int hbs = num_8x8_blocks_wide_lookup[bsize] / 2;
+
+ assert(cm->mi_grid_visible[offset] == &cm->mi[offset]);
+
+ if (partition != PARTITION_NONE &&
+ bsize > BLOCK_8X8 &&
+ mi_row + hbs < cm->mi_rows &&
+ mi_col + hbs < cm->mi_cols) {
+ const BLOCK_SIZE h = get_subsize(bsize, PARTITION_HORZ_A);
+ const BLOCK_SIZE v = get_subsize(bsize, PARTITION_VERT_A);
+ const MB_MODE_INFO *const mbmi_right = &mi[hbs]->mbmi;
+ const MB_MODE_INFO *const mbmi_below = &mi[hbs * cm->mi_stride]->mbmi;
+ if (mbmi->sb_type == h) {
+ return mbmi_below->sb_type == h ? PARTITION_HORZ : PARTITION_HORZ_B;
+ } else if (mbmi->sb_type == v) {
+ return mbmi_right->sb_type == v ? PARTITION_VERT : PARTITION_VERT_B;
+ } else if (mbmi_below->sb_type == h) {
+ return PARTITION_HORZ_A;
+ } else if (mbmi_right->sb_type == v) {
+ return PARTITION_VERT_A;
+ } else {
+ return PARTITION_SPLIT;
+ }
+ }
+
+ return partition;
+#endif // !CONFIG_EXT_PARTITION_TYPES
+ }
+}
+
#ifdef __cplusplus
} // extern "C"
#endif
int mi_row_top, int mi_col_top,
BLOCK_SIZE bsize, BLOCK_SIZE top_bsize,
uint8_t *dst_buf[3], int dst_stride[3]) {
- VP10_COMMON *const cm = &pbi->common;
- const int bsl = b_width_log2_lookup[bsize], hbs = (1 << bsl) / 4;
- PARTITION_TYPE partition;
- BLOCK_SIZE subsize;
-#if !CONFIG_EXT_PARTITION_TYPES
- MB_MODE_INFO *mbmi;
-#endif
- int i, offset = mi_row * cm->mi_stride + mi_col;
+ const VP10_COMMON *const cm = &pbi->common;
+ const int hbs = num_8x8_blocks_wide_lookup[bsize] / 2;
+ const PARTITION_TYPE partition = get_partition(cm, mi_row, mi_col, bsize);
+ const BLOCK_SIZE subsize = get_subsize(bsize, partition);
#if CONFIG_EXT_PARTITION_TYPES
- BLOCK_SIZE bsize2 = get_subsize(bsize, PARTITION_SPLIT);
+ const BLOCK_SIZE bsize2 = get_subsize(bsize, PARTITION_SPLIT);
#endif
+ int i;
+ const int mi_offset = mi_row * cm->mi_stride + mi_col;
uint8_t *dst_buf1[3], *dst_buf2[3], *dst_buf3[3];
DECLARE_ALIGNED(16, uint8_t,
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
return;
- xd->mi = cm->mi_grid_visible + offset;
- xd->mi[0] = cm->mi + offset;
-#if CONFIG_EXT_PARTITION_TYPES
- partition = get_partition(cm->mi, cm->mi_stride, cm->mi_rows, cm->mi_cols,
- mi_row, mi_col, bsize);
-#else
- mbmi = &xd->mi[0]->mbmi;
- partition = partition_lookup[bsl][mbmi->sb_type];
-#endif
- subsize = get_subsize(bsize, partition);
+ xd->mi = cm->mi_grid_visible + mi_offset;
+ xd->mi[0] = cm->mi + mi_offset;
for (i = 0; i < MAX_MB_PLANE; i++) {
xd->plane[i].dst.buf = dst_buf[i];
int mi_row, int mi_col, BLOCK_SIZE bsize) {
const VP10_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
-
- const int bsl = b_width_log2_lookup[bsize];
- const int bs = (1 << bsl) / 4;
- PARTITION_TYPE partition;
- BLOCK_SIZE subsize;
- MODE_INFO *m = NULL;
+ const int hbs = num_8x8_blocks_wide_lookup[bsize] / 2;
+ const PARTITION_TYPE partition = get_partition(cm, mi_row, mi_col, bsize);
+ const BLOCK_SIZE subsize = get_subsize(bsize, partition);
#if CONFIG_SUPERTX
+ const int mi_offset = mi_row * cm->mi_stride + mi_col;
+ MB_MODE_INFO *mbmi = NULL;
const int pack_token = !supertx_enabled;
TX_SIZE supertx_size;
int plane;
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
return;
- m = cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col];
-
- partition = partition_lookup[bsl][m->mbmi.sb_type];
-#if CONFIG_EXT_PARTITION_TYPES
- partition = get_partition(cm->mi, cm->mi_stride, cm->mi_rows, cm->mi_cols,
- mi_row, mi_col, bsize);
-#endif
- write_partition(cm, xd, bs, mi_row, mi_col, partition, bsize, w);
- subsize = get_subsize(bsize, partition);
+ write_partition(cm, xd, hbs, mi_row, mi_col, partition, bsize, w);
#if CONFIG_SUPERTX
- xd->mi = cm->mi_grid_visible + (mi_row * cm->mi_stride + mi_col);
+ mbmi = &cm->mi_grid_visible[mi_offset]->mbmi;
+ xd->mi = cm->mi_grid_visible + mi_offset;
set_mi_row_col(xd, tile,
mi_row, num_8x8_blocks_high_lookup[bsize],
mi_col, num_8x8_blocks_wide_lookup[bsize],
case PARTITION_HORZ:
write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
mi_row, mi_col);
- if (mi_row + bs < cm->mi_rows)
+ if (mi_row + hbs < cm->mi_rows)
write_modes_b_wrapper(cpi, tile, w, tok, tok_end,
- supertx_enabled, mi_row + bs, mi_col);
+ supertx_enabled, mi_row + hbs, mi_col);
break;
case PARTITION_VERT:
write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
mi_row, mi_col);
- if (mi_col + bs < cm->mi_cols)
+ if (mi_col + hbs < cm->mi_cols)
write_modes_b_wrapper(cpi, tile, w, tok, tok_end,
- supertx_enabled, mi_row, mi_col + bs);
+ supertx_enabled, mi_row, mi_col + hbs);
break;
case PARTITION_SPLIT:
write_modes_sb_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
mi_row, mi_col, subsize);
write_modes_sb_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
- mi_row, mi_col + bs, subsize);
+ mi_row, mi_col + hbs, subsize);
write_modes_sb_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
- mi_row + bs, mi_col, subsize);
+ mi_row + hbs, mi_col, subsize);
write_modes_sb_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
- mi_row + bs, mi_col + bs, subsize);
+ mi_row + hbs, mi_col + hbs, subsize);
break;
#if CONFIG_EXT_PARTITION_TYPES
case PARTITION_HORZ_A:
write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
mi_row, mi_col);
write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
- mi_row, mi_col + bs);
+ mi_row, mi_col + hbs);
write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
- mi_row + bs, mi_col);
+ mi_row + hbs, mi_col);
break;
case PARTITION_HORZ_B:
write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
mi_row, mi_col);
write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
- mi_row + bs, mi_col);
+ mi_row + hbs, mi_col);
write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
- mi_row + bs, mi_col + bs);
+ mi_row + hbs, mi_col + hbs);
break;
case PARTITION_VERT_A:
write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
mi_row, mi_col);
write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
- mi_row + bs, mi_col);
+ mi_row + hbs, mi_col);
write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
- mi_row, mi_col + bs);
+ mi_row, mi_col + hbs);
break;
case PARTITION_VERT_B:
write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
mi_row, mi_col);
write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
- mi_row, mi_col + bs);
+ mi_row, mi_col + hbs);
write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
- mi_row + bs, mi_col + bs);
+ mi_row + hbs, mi_col + hbs);
break;
#endif // CONFIG_EXT_PARTITION_TYPES
default:
}
#if CONFIG_SUPERTX
if (partition != PARTITION_NONE && supertx_enabled && pack_token &&
- !m->mbmi.skip) {
+ !mbmi->skip) {
assert(*tok < tok_end);
for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
- const int mbmi_txb_size = txsize_to_bsize[m->mbmi.tx_size];
+ const int mbmi_txb_size = txsize_to_bsize[mbmi->tx_size];
const int num_4x4_w = num_4x4_blocks_wide_lookup[mbmi_txb_size];
const int num_4x4_h = num_4x4_blocks_high_lookup[mbmi_txb_size];
int row, col;
- TX_SIZE tx = plane ? get_uv_tx_size(&m->mbmi, &xd->plane[plane])
- : m->mbmi.tx_size;
+ TX_SIZE tx = plane ? get_uv_tx_size(mbmi, &xd->plane[plane])
+ : mbmi->tx_size;
BLOCK_SIZE txb_size = txsize_to_bsize[tx];
int bw = num_4x4_blocks_wide_lookup[txb_size];
MACROBLOCK *const x = &td->mb;
MACROBLOCKD *const xd = &x->e_mbd;
const int mis = cm->mi_stride;
- const int bsl = b_width_log2_lookup[bsize];
- const int mi_step = num_4x4_blocks_wide_lookup[bsize] / 2;
- const int bss = (1 << bsl) / 4;
+ const int bs = num_8x8_blocks_wide_lookup[bsize];
+ const int hbs = bs / 2;
int i, pl;
- PARTITION_TYPE partition = PARTITION_NONE;
- BLOCK_SIZE subsize;
+ const PARTITION_TYPE partition = get_partition(cm, mi_row, mi_col, bsize);
+ const BLOCK_SIZE subsize = get_subsize(bsize, partition);
RD_SEARCH_MACROBLOCK_CONTEXT x_ctx;
RD_COST last_part_rdc, none_rdc, chosen_rdc;
BLOCK_SIZE sub_subsize = BLOCK_4X4;
vp10_rd_cost_reset(&none_rdc);
vp10_rd_cost_reset(&chosen_rdc);
- partition = partition_lookup[bsl][bs_type];
- subsize = get_subsize(bsize, partition);
-
pc_tree->partitioning = partition;
#if CONFIG_VAR_TX
splits_below = 1;
for (i = 0; i < 4; i++) {
int jj = i >> 1, ii = i & 0x01;
- MODE_INFO *this_mi = mi_8x8[jj * bss * mis + ii * bss];
+ MODE_INFO *this_mi = mi_8x8[jj * hbs * mis + ii * hbs];
if (this_mi && this_mi->mbmi.sb_type >= sub_subsize) {
splits_below = 0;
}
// If partition is not none try none unless each of the 4 splits are split
// even further..
if (partition != PARTITION_NONE && !splits_below &&
- mi_row + (mi_step >> 1) < cm->mi_rows &&
- mi_col + (mi_step >> 1) < cm->mi_cols) {
+ mi_row + hbs < cm->mi_rows &&
+ mi_col + hbs < cm->mi_cols) {
pc_tree->partitioning = PARTITION_NONE;
rd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &none_rdc,
#if CONFIG_SUPERTX
subsize, &pc_tree->horizontal[0],
INT64_MAX);
if (last_part_rdc.rate != INT_MAX &&
- bsize >= BLOCK_8X8 && mi_row + (mi_step >> 1) < cm->mi_rows) {
+ bsize >= BLOCK_8X8 && mi_row + hbs < cm->mi_rows) {
RD_COST tmp_rdc;
#if CONFIG_SUPERTX
int rt_nocoef = 0;
update_state(cpi, td, ctx, mi_row, mi_col, subsize, 0);
encode_superblock(cpi, td, tp, 0, mi_row, mi_col, subsize, ctx);
rd_pick_sb_modes(cpi, tile_data, x,
- mi_row + (mi_step >> 1), mi_col, &tmp_rdc,
+ mi_row + hbs, mi_col, &tmp_rdc,
#if CONFIG_SUPERTX
&rt_nocoef,
#endif
#endif
subsize, &pc_tree->vertical[0], INT64_MAX);
if (last_part_rdc.rate != INT_MAX &&
- bsize >= BLOCK_8X8 && mi_col + (mi_step >> 1) < cm->mi_cols) {
+ bsize >= BLOCK_8X8 && mi_col + hbs < cm->mi_cols) {
RD_COST tmp_rdc;
#if CONFIG_SUPERTX
int rt_nocoef = 0;
update_state(cpi, td, ctx, mi_row, mi_col, subsize, 0);
encode_superblock(cpi, td, tp, 0, mi_row, mi_col, subsize, ctx);
rd_pick_sb_modes(cpi, tile_data, x,
- mi_row, mi_col + (mi_step >> 1), &tmp_rdc,
+ mi_row, mi_col + hbs, &tmp_rdc,
#if CONFIG_SUPERTX
&rt_nocoef,
#endif
last_part_rate_nocoef = 0;
#endif
for (i = 0; i < 4; i++) {
- int x_idx = (i & 1) * (mi_step >> 1);
- int y_idx = (i >> 1) * (mi_step >> 1);
+ int x_idx = (i & 1) * hbs;
+ int y_idx = (i >> 1) * hbs;
int jj = i >> 1, ii = i & 0x01;
RD_COST tmp_rdc;
#if CONFIG_SUPERTX
vp10_rd_cost_init(&tmp_rdc);
rd_use_partition(cpi, td, tile_data,
- mi_8x8 + jj * bss * mis + ii * bss, tp,
+ mi_8x8 + jj * hbs * mis + ii * hbs, tp,
mi_row + y_idx, mi_col + x_idx, subsize,
&tmp_rdc.rate, &tmp_rdc.dist,
#if CONFIG_SUPERTX
&& cpi->sf.adjust_partitioning_from_last_frame
&& cpi->sf.partition_search_type == SEARCH_PARTITION
&& partition != PARTITION_SPLIT && bsize > BLOCK_8X8
- && (mi_row + mi_step < cm->mi_rows ||
- mi_row + (mi_step >> 1) == cm->mi_rows)
- && (mi_col + mi_step < cm->mi_cols ||
- mi_col + (mi_step >> 1) == cm->mi_cols)) {
+ && (mi_row + bs < cm->mi_rows ||
+ mi_row + hbs == cm->mi_rows)
+ && (mi_col + bs < cm->mi_cols ||
+ mi_col + hbs == cm->mi_cols)) {
BLOCK_SIZE split_subsize = get_subsize(bsize, PARTITION_SPLIT);
chosen_rdc.rate = 0;
chosen_rdc.dist = 0;
// Split partition.
for (i = 0; i < 4; i++) {
- int x_idx = (i & 1) * (mi_step >> 1);
- int y_idx = (i >> 1) * (mi_step >> 1);
+ int x_idx = (i & 1) * hbs;
+ int y_idx = (i >> 1) * hbs;
RD_COST tmp_rdc;
#if CONFIG_SUPERTX
int rt_nocoef = 0;
if (bsize == BLOCK_8X8)
partition = PARTITION_NONE;
else
- partition = get_partition(cm->mi, cm->mi_stride, cm->mi_rows, cm->mi_cols,
- mi_row, mi_col, bsize);
+ partition = get_partition(cm, mi_row, mi_col, bsize);
switch (partition) {
case PARTITION_NONE:
count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count,