Commit 5cce322a authored by Julia Robson's avatar Julia Robson Committed by Debargha Mukherjee

Porting ext_partition experiment from nextgen

This has been ported under ext_partition_types because it is due
to be combined with the coding_unit_size experiment which is
already being ported under ext_partition

Change-Id: I47af869ae123ddf0aa99160dac644059d14266ee
parent cbfc15b1
......@@ -212,6 +212,9 @@ typedef struct {
#if CONFIG_REF_MV
uint8_t ref_mv_idx;
#endif
#if CONFIG_EXT_PARTITION_TYPES
PARTITION_TYPE partition;
#endif
} MB_MODE_INFO;
typedef struct MODE_INFO {
......@@ -356,6 +359,37 @@ static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize,
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;
}
#endif // CONFIG_EXT_PARTITION_TYPES
static const TX_TYPE intra_mode_to_tx_type_context[INTRA_MODES] = {
DCT_DCT, // DC
ADST_DCT, // V
......
......@@ -80,6 +80,59 @@ static const PARTITION_TYPE partition_lookup[][BLOCK_SIZES] = {
}
};
#if CONFIG_EXT_PARTITION_TYPES
static const BLOCK_SIZE subsize_lookup[EXT_PARTITION_TYPES][BLOCK_SIZES] = {
{ // PARTITION_NONE
BLOCK_4X4, BLOCK_4X8, BLOCK_8X4,
BLOCK_8X8, BLOCK_8X16, BLOCK_16X8,
BLOCK_16X16, BLOCK_16X32, BLOCK_32X16,
BLOCK_32X32, BLOCK_32X64, BLOCK_64X32,
BLOCK_64X64,
}, { // PARTITION_HORZ
BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_8X4, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_16X8, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_32X16, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_64X32,
}, { // PARTITION_VERT
BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_4X8, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_8X16, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_16X32, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_32X64,
}, { // PARTITION_SPLIT
BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_4X4, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_8X8, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_16X16, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_32X32,
}, { // PARTITION_HORZ_A
BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_8X4, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_16X8, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_32X16, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_64X32,
}, { // PARTITION_HORZ_B
BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_8X4, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_16X8, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_32X16, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_64X32,
}, { // PARTITION_VERT_A
BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_4X8, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_8X16, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_16X32, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_32X64,
}, { // PARTITION_VERT_B
BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_4X8, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_8X16, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_16X32, BLOCK_INVALID, BLOCK_INVALID,
BLOCK_32X64,
}
};
#else
static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES] = {
{ // PARTITION_NONE
BLOCK_4X4, BLOCK_4X8, BLOCK_8X4,
......@@ -107,6 +160,7 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES] = {
BLOCK_32X32,
}
};
#endif // CONFIG_EXT_PARTITION_TYPES
static const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = {
TX_4X4, TX_4X4, TX_4X4,
......@@ -180,9 +234,16 @@ static const TX_SIZE uvsupertx_size_lookup[TX_SIZES][2][2] = {
{{TX_32X32, TX_16X16}, {TX_16X16, TX_16X16}},
};
#if CONFIG_EXT_PARTITION_TYPES
static const int partition_supertx_context_lookup[EXT_PARTITION_TYPES] = {
-1, 0, 0, 1, 0, 0, 0, 0
};
#else
static const int partition_supertx_context_lookup[PARTITION_TYPES] = {
-1, 0, 0, 1
};
#endif // CONFIG_EXT_PARTITION_TYPES
#endif // CONFIG_SUPERTX
#ifdef __cplusplus
......
......@@ -148,6 +148,31 @@ static const vpx_prob default_uv_probs[INTRA_MODES][INTRA_MODES - 1] = {
{ 101, 21, 107, 181, 192, 103, 19, 67, 125 } // y = tm
};
#if CONFIG_EXT_PARTITION_TYPES
static const vpx_prob default_partition_probs[PARTITION_CONTEXTS]
[EXT_PARTITION_TYPES - 1] = {
// 8x8 -> 4x4
{ 199, 122, 141, 128, 128, 128, 128 }, // a/l both not split
{ 147, 63, 159, 128, 128, 128, 128 }, // a split, l not split
{ 148, 133, 118, 128, 128, 128, 128 }, // l split, a not split
{ 121, 104, 114, 128, 128, 128, 128 }, // a/l both split
// 16x16 -> 8x8
{ 174, 73, 87, 128, 128, 128, 128 }, // a/l both not split
{ 92, 41, 83, 128, 128, 128, 128 }, // a split, l not split
{ 82, 99, 50, 128, 128, 128, 128 }, // l split, a not split
{ 53, 39, 39, 128, 128, 128, 128 }, // a/l both split
// 32x32 -> 16x16
{ 177, 58, 59, 128, 128, 128, 128 }, // a/l both not split
{ 68, 26, 63, 128, 128, 128, 128 }, // a split, l not split
{ 52, 79, 25, 128, 128, 128, 128 }, // l split, a not split
{ 17, 14, 12, 128, 128, 128, 128 }, // a/l both split
// 64x64 -> 32x32
{ 222, 34, 30, 128, 128, 128, 128 }, // a/l both not split
{ 72, 16, 44, 128, 128, 128, 128 }, // a split, l not split
{ 58, 32, 12, 128, 128, 128, 128 }, // l split, a not split
{ 10, 7, 6, 128, 128, 128, 128 }, // a/l both split
};
#else
static const vpx_prob default_partition_probs[PARTITION_CONTEXTS]
[PARTITION_TYPES - 1] = {
// 8x8 -> 4x4
......@@ -171,6 +196,7 @@ static const vpx_prob default_partition_probs[PARTITION_CONTEXTS]
{ 58, 32, 12 }, // l split, a not split
{ 10, 7, 6 }, // a/l both split
};
#endif // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_REF_MV
static const vpx_prob default_newmv_prob[NEWMV_MODE_CONTEXTS] = {
......@@ -292,6 +318,18 @@ const vpx_tree_index vp10_partition_tree[TREE_SIZE(PARTITION_TYPES)] = {
-PARTITION_VERT, -PARTITION_SPLIT
};
#if CONFIG_EXT_PARTITION_TYPES
const vpx_tree_index vp10_ext_partition_tree[TREE_SIZE(EXT_PARTITION_TYPES)] = {
-PARTITION_NONE, 2,
6, 4,
8, -PARTITION_SPLIT,
-PARTITION_HORZ, 10,
-PARTITION_VERT, 12,
-PARTITION_HORZ_A, -PARTITION_HORZ_B,
-PARTITION_VERT_A, -PARTITION_VERT_B
};
#endif // CONFIG_EXT_PARTITION_TYPES
static const vpx_prob default_intra_inter_p[INTRA_INTER_CONTEXTS] = {
9, 102, 187, 225
};
......@@ -1354,9 +1392,17 @@ void vp10_adapt_intra_frame_probs(VP10_COMMON *cm) {
vpx_tree_merge_probs(vp10_intra_mode_tree, pre_fc->uv_mode_prob[i],
counts->uv_mode[i], fc->uv_mode_prob[i]);
#if CONFIG_EXT_PARTITION_TYPES
vpx_tree_merge_probs(vp10_partition_tree, pre_fc->partition_prob[0],
counts->partition[0], fc->partition_prob[0]);
for (i = 1; i < PARTITION_CONTEXTS; i++)
vpx_tree_merge_probs(vp10_ext_partition_tree, pre_fc->partition_prob[i],
counts->partition[i], fc->partition_prob[i]);
#else
for (i = 0; i < PARTITION_CONTEXTS; i++)
vpx_tree_merge_probs(vp10_partition_tree, pre_fc->partition_prob[i],
counts->partition[i], fc->partition_prob[i]);
#endif // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_EXT_INTRA
for (i = 0; i < PLANE_TYPES; ++i) {
......
......@@ -46,7 +46,11 @@ struct seg_counts {
typedef struct frame_contexts {
vpx_prob y_mode_prob[BLOCK_SIZE_GROUPS][INTRA_MODES - 1];
vpx_prob uv_mode_prob[INTRA_MODES][INTRA_MODES - 1];
#if CONFIG_EXT_PARTITION_TYPES
vpx_prob partition_prob[PARTITION_CONTEXTS][EXT_PARTITION_TYPES - 1];
#else
vpx_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1];
#endif
vp10_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES];
vpx_prob switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS - 1];
......@@ -111,7 +115,11 @@ typedef struct FRAME_COUNTS {
unsigned int kf_y_mode[INTRA_MODES][INTRA_MODES][INTRA_MODES];
unsigned int y_mode[BLOCK_SIZE_GROUPS][INTRA_MODES];
unsigned int uv_mode[INTRA_MODES][INTRA_MODES];
#if CONFIG_EXT_PARTITION_TYPES
unsigned int partition[PARTITION_CONTEXTS][EXT_PARTITION_TYPES];
#else
unsigned int partition[PARTITION_CONTEXTS][PARTITION_TYPES];
#endif
vp10_coeff_count_model coef[TX_SIZES][PLANE_TYPES];
unsigned int eob_branch[TX_SIZES][PLANE_TYPES][REF_TYPES]
[COEF_BANDS][COEFF_CONTEXTS];
......@@ -193,6 +201,10 @@ extern const vpx_tree_index vp10_inter_compound_mode_tree
[TREE_SIZE(INTER_COMPOUND_MODES)];
#endif // CONFIG_EXT_INTER
extern const vpx_tree_index vp10_partition_tree[TREE_SIZE(PARTITION_TYPES)];
#if CONFIG_EXT_PARTITION_TYPES
extern const vpx_tree_index vp10_ext_partition_tree
[TREE_SIZE(EXT_PARTITION_TYPES)];
#endif
extern const vpx_tree_index vp10_switchable_interp_tree
[TREE_SIZE(SWITCHABLE_FILTERS)];
extern const vpx_tree_index vp10_palette_size_tree[TREE_SIZE(PALETTE_SIZES)];
......
......@@ -69,6 +69,21 @@ typedef enum BITSTREAM_PROFILE {
typedef uint8_t BLOCK_SIZE;
#if CONFIG_EXT_PARTITION_TYPES
typedef enum PARTITION_TYPE {
PARTITION_NONE,
PARTITION_HORZ,
PARTITION_VERT,
PARTITION_SPLIT,
PARTITION_HORZ_A, // HORZ split and the left partition is split again
PARTITION_HORZ_B, // HORZ split and the right partition is split again
PARTITION_VERT_A, // VERT split and the top partition is split again
PARTITION_VERT_B, // VERT split and the bottom partition is split again
EXT_PARTITION_TYPES,
PARTITION_TYPES = PARTITION_SPLIT + 1,
PARTITION_INVALID = EXT_PARTITION_TYPES
} PARTITION_TYPE;
#else
typedef enum PARTITION_TYPE {
PARTITION_NONE,
PARTITION_HORZ,
......@@ -77,6 +92,7 @@ typedef enum PARTITION_TYPE {
PARTITION_TYPES,
PARTITION_INVALID = PARTITION_TYPES
} PARTITION_TYPE;
#endif // CONFIG_EXT_PARTITION_TYPES
typedef char PARTITION_CONTEXT;
#define PARTITION_PLOFFSET 4 // number of probability models per block size
......
......@@ -1634,7 +1634,7 @@ void vp10_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer,
int start, int stop, int y_only) {
const int num_planes = y_only ? 1 : MAX_MB_PLANE;
int mi_row, mi_col;
#if !CONFIG_VAR_TX
#if !CONFIG_VAR_TX && !CONFIG_EXT_PARTITION_TYPES
enum lf_path path;
LOOP_FILTER_MASK lfm;
......@@ -1646,7 +1646,7 @@ void vp10_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer,
path = LF_PATH_444;
else
path = LF_PATH_SLOW;
#endif
#endif // !CONFIG_VAR_TX && !CONFIG_EXT_PARTITION_TYPES
#if CONFIG_VAR_TX
memset(cm->above_txfm_context, TX_SIZES, cm->mi_cols);
......@@ -1661,7 +1661,7 @@ void vp10_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer,
vp10_setup_dst_planes(planes, frame_buffer, mi_row, mi_col);
#if CONFIG_VAR_TX
#if CONFIG_VAR_TX || CONFIG_EXT_PARTITION_TYPES
for (plane = 0; plane < num_planes; ++plane)
vp10_filter_block_plane_non420(cm, &planes[plane], mi + mi_col,
mi_row, mi_col);
......@@ -1684,7 +1684,7 @@ void vp10_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer,
break;
}
}
#endif
#endif // CONFIG_VAR_TX || CONFIG_EXT_PARTITION_TYPES
}
}
}
......
......@@ -246,31 +246,51 @@ static uint8_t scan_blk_mbmi(const VP10_COMMON *cm, const MACROBLOCKD *xd,
return newmv_count;
}
// This function assumes MI blocks are 8x8 and coding units are 64x64
static int has_top_right(const MACROBLOCKD *xd,
int mi_row, int mi_col, int bs) {
// In a split partition all apart from the bottom right has a top right
int has_tr = !((mi_row & bs) & (bs * 2 - 1)) ||
!((mi_col & bs) & (bs * 2 - 1));
// Filter out partial right-most boundaries
// For each 4x4 group of blocks, when the bottom right is decoded the blocks
// to the right have not been decoded therefore the second from bottom in the
// right-most column does not have a top right
if ((mi_col & bs) & (bs * 2 - 1)) {
if (((mi_col & (2 * bs)) & (bs * 4 - 1)) &&
((mi_row & (2 * bs)) & (bs * 4 - 1)))
has_tr = 0;
}
// If the right had side of the block lines up with the right had edge end of
// a group of 8x8 MI blocks (i.e. edge of a coding unit) and is not on the top
// row of that coding unit, it does not have a top right
if (has_tr)
if (((mi_col + xd->n8_w) & 0x07) == 0)
if ((mi_row & 0x07) > 0)
has_tr = 0;
// The left had of two vertical rectangles always has a top right (as the
// block above will have been decoded)
if (xd->n8_w < xd->n8_h)
if (!xd->is_sec_rect)
has_tr = 1;
// The bottom of two horizontal rectangles never has a top right (as the block
// to the right won't have been decoded)
if (xd->n8_w > xd->n8_h)
if (xd->is_sec_rect)
has_tr = 0;
#if CONFIG_EXT_PARTITION_TYPES
// The bottom left square of a Vertical A does not have a top right as it is
// decoded before the right hand rectangle of the partition
if (xd->mi[0]->mbmi.partition == PARTITION_VERT_A)
if ((mi_row & bs) && !(mi_col & bs))
has_tr = 0;
#endif // CONFIG_EXT_PARTITION_TYPES
return has_tr;
}
......
......@@ -499,6 +499,12 @@ static INLINE void update_partition_context(MACROBLOCKD *xd,
PARTITION_CONTEXT *const above_ctx = xd->above_seg_context + mi_col;
PARTITION_CONTEXT *const left_ctx = xd->left_seg_context + (mi_row & MI_MASK);
#if CONFIG_EXT_PARTITION_TYPES
const int bw = num_8x8_blocks_wide_lookup[bsize];
const int bh = num_8x8_blocks_high_lookup[bsize];
memset(above_ctx, partition_context_lookup[subsize].above, bw);
memset(left_ctx, partition_context_lookup[subsize].left, bh);
#else
// num_4x4_blocks_wide_lookup[bsize] / 2
const int bs = num_8x8_blocks_wide_lookup[bsize];
......@@ -507,7 +513,49 @@ static INLINE void update_partition_context(MACROBLOCKD *xd,
// bits of smaller block sizes to be zero.
memset(above_ctx, partition_context_lookup[subsize].above, bs);
memset(left_ctx, partition_context_lookup[subsize].left, bs);
#endif // CONFIG_EXT_PARTITION_TYPES
}
#if CONFIG_EXT_PARTITION_TYPES
static INLINE void update_ext_partition_context(MACROBLOCKD *xd,
int mi_row, int mi_col,
BLOCK_SIZE subsize,
BLOCK_SIZE bsize,
PARTITION_TYPE partition) {
if (bsize >= BLOCK_8X8) {
const int bsl = b_width_log2_lookup[bsize], hbs = (1 << bsl) / 4;
BLOCK_SIZE bsize2 = get_subsize(bsize, PARTITION_SPLIT);
switch (partition) {
case PARTITION_SPLIT:
if (bsize != BLOCK_8X8)
break;
case PARTITION_NONE:
case PARTITION_HORZ:
case PARTITION_VERT:
update_partition_context(xd, mi_row, mi_col, subsize, bsize);
break;
case PARTITION_HORZ_A:
update_partition_context(xd, mi_row, mi_col, bsize2, subsize);
update_partition_context(xd, mi_row + hbs, mi_col, subsize, subsize);
break;
case PARTITION_HORZ_B:
update_partition_context(xd, mi_row, mi_col, subsize, subsize);
update_partition_context(xd, mi_row + hbs, mi_col, bsize2, subsize);
break;
case PARTITION_VERT_A:
update_partition_context(xd, mi_row, mi_col, bsize2, subsize);
update_partition_context(xd, mi_row, mi_col + hbs, subsize, subsize);
break;
case PARTITION_VERT_B:
update_partition_context(xd, mi_row, mi_col, subsize, subsize);
update_partition_context(xd, mi_row, mi_col + hbs, bsize2, subsize);
break;
default:
assert(0 && "Invalid partition type");
}
}
}
#endif // CONFIG_EXT_PARTITION_TYPES
static INLINE int partition_plane_context(const MACROBLOCKD *xd,
int mi_row, int mi_col,
......
......@@ -99,9 +99,40 @@ static const uint8_t *const orders[BLOCK_SIZES] = {
orders_16x32, orders_32x16, orders_32x32,
orders_32x64, orders_64x32, orders_64x64,
};
#if CONFIG_EXT_PARTITION_TYPES
static const uint8_t orders_verta_32x32[4] = {
0, 2,
1, 2,
};
static const uint8_t orders_verta_16x16[16] = {
0, 2, 4, 6,
1, 2, 5, 6,
8, 10, 12, 14,
9, 10, 13, 14,
};
static const uint8_t orders_verta_8x8[64] = {
0, 2, 4, 6, 16, 18, 20, 22,
1, 2, 5, 6, 17, 18, 21, 22,
8, 10, 12, 14, 24, 26, 28, 30,
9, 10, 13, 14, 25, 26, 29, 30,
32, 34, 36, 38, 48, 50, 52, 54,
33, 34, 37, 38, 49, 50, 53, 54,
40, 42, 44, 46, 56, 58, 60, 62,
41, 42, 45, 46, 57, 58, 61, 62,
};
static const uint8_t *const orders_verta[BLOCK_SIZES] = {
orders_verta_8x8, orders_verta_8x8, orders_verta_8x8, orders_verta_8x8,
orders_8x16, orders_16x8, orders_verta_16x16,
orders_16x32, orders_32x16, orders_verta_32x32,
orders_32x64, orders_64x32, orders_64x64,
};
#endif // CONFIG_EXT_PARTITION_TYPES
static int vp10_has_right(BLOCK_SIZE bsize, int mi_row, int mi_col,
int right_available,
#if CONFIG_EXT_PARTITION_TYPES
PARTITION_TYPE partition,
#endif
TX_SIZE txsz, int y, int x, int ss_x) {
const int wl = mi_width_log2_lookup[bsize];
const int w = VPXMAX(num_4x4_blocks_wide_lookup[bsize] >> ss_x, 1);
......@@ -113,8 +144,14 @@ static int vp10_has_right(BLOCK_SIZE bsize, int mi_row, int mi_col,
if (y == 0) {
const int hl = mi_height_log2_lookup[bsize];
const uint8_t *order = orders[bsize];
const uint8_t *order;
int my_order, tr_order;
#if CONFIG_EXT_PARTITION_TYPES
if (partition == PARTITION_VERT_A)
order = orders_verta[bsize];
else
#endif // CONFIG_EXT_PARTITION_TYPES
order = orders[bsize];
if (x + step < w)
return 1;
......@@ -122,9 +159,11 @@ static int vp10_has_right(BLOCK_SIZE bsize, int mi_row, int mi_col,
mi_row = (mi_row & 7) >> hl;
mi_col = (mi_col & 7) >> wl;
// If top row of coding unit
if (mi_row == 0)
return right_available;
// If rightmost column of coding unit
if (((mi_col + 1) << wl) >= 8)
return 0;
......@@ -1346,8 +1385,14 @@ void vp10_predict_intra_block(const MACROBLOCKD *xd, int bwl_in, int bhl_in,
const struct macroblockd_plane *const pd = &xd->plane[plane];
const int right_available =
mi_col + (1 << mi_width_log2_lookup[bsize]) < xd->tile.mi_col_end;
#if CONFIG_EXT_PARTITION_TYPES
const PARTITION_TYPE partition = xd->mi[0]->mbmi.partition;
#endif
const int have_right = vp10_has_right(bsize, mi_row, mi_col,
right_available,
#if CONFIG_EXT_PARTITION_TYPES
partition,
#endif
tx_size, row_off, col_off,
pd->subsampling_x);
const int have_bottom = vp10_has_bottom(bsize, mi_row, mi_col,
......
......@@ -96,7 +96,9 @@ void thread_loop_filter_rows(const YV12_BUFFER_CONFIG *const frame_buffer,
const int num_planes = y_only ? 1 : MAX_MB_PLANE;
const int sb_cols = mi_cols_aligned_to_sb(cm->mi_cols) >> MI_BLOCK_SIZE_LOG2;
int mi_row, mi_col;
#if !CONFIG_EXT_PARTITION_TYPES
enum lf_path path;
LOOP_FILTER_MASK lfm;
if (y_only)
path = LF_PATH_444;
else if (planes[1].subsampling_y == 1 && planes[1].subsampling_x == 1)
......@@ -105,6 +107,7 @@ void thread_loop_filter_rows(const YV12_BUFFER_CONFIG *const frame_buffer,
path = LF_PATH_444;
else
path = LF_PATH_SLOW;
#endif // !CONFIG_EXT_PARTITION_TYPES
for (mi_row = start; mi_row < stop;
mi_row += lf_sync->num_workers * MI_BLOCK_SIZE) {
......@@ -113,13 +116,17 @@ void thread_loop_filter_rows(const YV12_BUFFER_CONFIG *const frame_buffer,
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) {
const int r = mi_row >> MI_BLOCK_SIZE_LOG2;
const int c = mi_col >> MI_BLOCK_SIZE_LOG2;
LOOP_FILTER_MASK lfm;
int plane;
sync_read(lf_sync, r, c);
vp10_setup_dst_planes(planes, frame_buffer, mi_row, mi_col);
#if CONFIG_EXT_PARTITION_TYPES
for (plane = 0; plane < num_planes; ++plane)
vp10_filter_block_plane_non420(cm, &planes[plane], mi + mi_col,
mi_row, mi_col);
#else
// TODO(JBB): Make setup_mask work for non 420.
vp10_setup_mask(cm, mi_row, mi_col, mi + mi_col, cm->mi_stride,
&lfm);
......@@ -139,7 +146,7 @@ void thread_loop_filter_rows(const YV12_BUFFER_CONFIG *const frame_buffer,
break;
}
}
#endif // CONFIG_EXT_PARTITION_TYPES
sync_write(lf_sync, r, c, sb_cols);
}
}
......@@ -331,7 +338,11 @@ void vp10_accumulate_frame_counts(VP10_COMMON *cm, FRAME_COUNTS *counts,
cm->counts.uv_mode[i][j] += counts->uv_mode[i][j];
for (i = 0; i < PARTITION_CONTEXTS; i++)
#if CONFIG_EXT_PARTITION_TYPES
for (j = 0; j < (i ? EXT_PARTITION_TYPES : PARTITION_TYPES); j++)
#else
for (j = 0; j < PARTITION_TYPES; j++)
#endif
cm->counts.partition[i][j] += counts->partition[i][j];
if (is_dec) {
......
This diff is collapsed.
......@@ -50,6 +50,10 @@ static const struct vp10_token switchable_interp_encodings[SWITCHABLE_FILTERS] =
static const struct vp10_token switchable_interp_encodings[SWITCHABLE_FILTERS] =
{{0, 1}, {2, 2}, {3, 2}};
#endif // CONFIG_EXT_INTERP && SWITCHABLE_FILTERS == 4
#if CONFIG_EXT_PARTITION_TYPES
static const struct vp10_token ext_partition_encodings[EXT_PARTITION_TYPES] =
{{0, 1}, {4, 3}, {12, 4}, {7, 3}, {10, 4}, {11, 4}, {26, 5}, {27, 5}};
#endif
static const struct vp10_token partition_encodings[PARTITION_TYPES] =
{{0, 1}, {2, 2}, {6, 3}, {7, 3}};
#if !CONFIG_REF_MV
......@@ -1583,7 +1587,15 @@ static void write_partition(const VP10_COMMON *const cm,
const int has_cols = (mi_col + hbs) < cm->mi_cols;
if (has_rows && has_cols) {
#if CONFIG_EXT_PARTITION_TYPES
if (bsize <= BLOCK_8X8)
vp10_write_token(w, vp10_partition_tree, probs, &partition_encodings[p]);
else
vp10_write_token(w, vp10_ext_partition_tree, probs,
&ext_partition_encodings[p]);
#else
vp10_write_token(w, vp10_partition_tree, probs, &partition_encodings[p]);
#endif // CONFIG_EXT_PARTITION_TYPES
} else if (!has_rows && has_cols) {
assert(p == PARTITION_SPLIT || p == PARTITION_HORZ);
vpx_write(w, p == PARTITION_SPLIT, probs[1]);
......@@ -1625,6 +1637,10 @@ static void write_modes_sb(VP10_COMP *cpi, const TileInfo *const tile,
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);
#if CONFIG_SUPERTX
......@@ -1770,6 +1786,76 @@ static void write_modes_sb(VP10_COMP *cpi, const TileInfo *const tile,
#endif // CONFIG_SUPERTX
mi_row + bs, mi_col + bs, subsize);
break;
#if CONFIG_EXT_PARTITION_TYPES
case PARTITION_HORZ_A:
write_modes_b(cpi, tile, w, tok, tok_end,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row, mi_col);
write_modes_b(cpi, tile, w, tok, tok_end,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row, mi_col + bs);
write_modes_b(cpi, tile, w, tok, tok_end,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row + bs, mi_col);
break;
case PARTITION_HORZ_B:
write_modes_b(cpi, tile, w, tok, tok_end,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row, mi_col);