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 { ...@@ -212,6 +212,9 @@ typedef struct {
#if CONFIG_REF_MV #if CONFIG_REF_MV
uint8_t ref_mv_idx; uint8_t ref_mv_idx;
#endif #endif
#if CONFIG_EXT_PARTITION_TYPES
PARTITION_TYPE partition;
#endif
} MB_MODE_INFO; } MB_MODE_INFO;
typedef struct MODE_INFO { typedef struct MODE_INFO {
...@@ -356,6 +359,37 @@ static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize, ...@@ -356,6 +359,37 @@ static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize,
return subsize_lookup[partition][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] = { static const TX_TYPE intra_mode_to_tx_type_context[INTRA_MODES] = {
DCT_DCT, // DC DCT_DCT, // DC
ADST_DCT, // V ADST_DCT, // V
......
...@@ -80,6 +80,59 @@ static const PARTITION_TYPE partition_lookup[][BLOCK_SIZES] = { ...@@ -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] = { static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES] = {
{ // PARTITION_NONE { // PARTITION_NONE
BLOCK_4X4, BLOCK_4X8, BLOCK_8X4, BLOCK_4X4, BLOCK_4X8, BLOCK_8X4,
...@@ -107,6 +160,7 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES] = { ...@@ -107,6 +160,7 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES] = {
BLOCK_32X32, BLOCK_32X32,
} }
}; };
#endif // CONFIG_EXT_PARTITION_TYPES
static const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = { static const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = {
TX_4X4, TX_4X4, TX_4X4, TX_4X4, TX_4X4, TX_4X4,
...@@ -180,9 +234,16 @@ static const TX_SIZE uvsupertx_size_lookup[TX_SIZES][2][2] = { ...@@ -180,9 +234,16 @@ static const TX_SIZE uvsupertx_size_lookup[TX_SIZES][2][2] = {
{{TX_32X32, TX_16X16}, {TX_16X16, TX_16X16}}, {{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] = { static const int partition_supertx_context_lookup[PARTITION_TYPES] = {
-1, 0, 0, 1 -1, 0, 0, 1
}; };
#endif // CONFIG_EXT_PARTITION_TYPES
#endif // CONFIG_SUPERTX #endif // CONFIG_SUPERTX
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -148,6 +148,31 @@ static const vpx_prob default_uv_probs[INTRA_MODES][INTRA_MODES - 1] = { ...@@ -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 { 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] static const vpx_prob default_partition_probs[PARTITION_CONTEXTS]
[PARTITION_TYPES - 1] = { [PARTITION_TYPES - 1] = {
// 8x8 -> 4x4 // 8x8 -> 4x4
...@@ -171,6 +196,7 @@ static const vpx_prob default_partition_probs[PARTITION_CONTEXTS] ...@@ -171,6 +196,7 @@ static const vpx_prob default_partition_probs[PARTITION_CONTEXTS]
{ 58, 32, 12 }, // l split, a not split { 58, 32, 12 }, // l split, a not split
{ 10, 7, 6 }, // a/l both split { 10, 7, 6 }, // a/l both split
}; };
#endif // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_REF_MV #if CONFIG_REF_MV
static const vpx_prob default_newmv_prob[NEWMV_MODE_CONTEXTS] = { 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)] = { ...@@ -292,6 +318,18 @@ const vpx_tree_index vp10_partition_tree[TREE_SIZE(PARTITION_TYPES)] = {
-PARTITION_VERT, -PARTITION_SPLIT -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] = { static const vpx_prob default_intra_inter_p[INTRA_INTER_CONTEXTS] = {
9, 102, 187, 225 9, 102, 187, 225
}; };
...@@ -1354,9 +1392,17 @@ void vp10_adapt_intra_frame_probs(VP10_COMMON *cm) { ...@@ -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], vpx_tree_merge_probs(vp10_intra_mode_tree, pre_fc->uv_mode_prob[i],
counts->uv_mode[i], 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++) for (i = 0; i < PARTITION_CONTEXTS; i++)
vpx_tree_merge_probs(vp10_partition_tree, pre_fc->partition_prob[i], vpx_tree_merge_probs(vp10_partition_tree, pre_fc->partition_prob[i],
counts->partition[i], fc->partition_prob[i]); counts->partition[i], fc->partition_prob[i]);
#endif // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
for (i = 0; i < PLANE_TYPES; ++i) { for (i = 0; i < PLANE_TYPES; ++i) {
......
...@@ -46,7 +46,11 @@ struct seg_counts { ...@@ -46,7 +46,11 @@ struct seg_counts {
typedef struct frame_contexts { typedef struct frame_contexts {
vpx_prob y_mode_prob[BLOCK_SIZE_GROUPS][INTRA_MODES - 1]; vpx_prob y_mode_prob[BLOCK_SIZE_GROUPS][INTRA_MODES - 1];
vpx_prob uv_mode_prob[INTRA_MODES][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]; vpx_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1];
#endif
vp10_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES]; vp10_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES];
vpx_prob switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS] vpx_prob switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS - 1]; [SWITCHABLE_FILTERS - 1];
...@@ -111,7 +115,11 @@ typedef struct FRAME_COUNTS { ...@@ -111,7 +115,11 @@ typedef struct FRAME_COUNTS {
unsigned int kf_y_mode[INTRA_MODES][INTRA_MODES][INTRA_MODES]; unsigned int kf_y_mode[INTRA_MODES][INTRA_MODES][INTRA_MODES];
unsigned int y_mode[BLOCK_SIZE_GROUPS][INTRA_MODES]; unsigned int y_mode[BLOCK_SIZE_GROUPS][INTRA_MODES];
unsigned int uv_mode[INTRA_MODES][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]; unsigned int partition[PARTITION_CONTEXTS][PARTITION_TYPES];
#endif
vp10_coeff_count_model coef[TX_SIZES][PLANE_TYPES]; vp10_coeff_count_model coef[TX_SIZES][PLANE_TYPES];
unsigned int eob_branch[TX_SIZES][PLANE_TYPES][REF_TYPES] unsigned int eob_branch[TX_SIZES][PLANE_TYPES][REF_TYPES]
[COEF_BANDS][COEFF_CONTEXTS]; [COEF_BANDS][COEFF_CONTEXTS];
...@@ -193,6 +201,10 @@ extern const vpx_tree_index vp10_inter_compound_mode_tree ...@@ -193,6 +201,10 @@ extern const vpx_tree_index vp10_inter_compound_mode_tree
[TREE_SIZE(INTER_COMPOUND_MODES)]; [TREE_SIZE(INTER_COMPOUND_MODES)];
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
extern const vpx_tree_index vp10_partition_tree[TREE_SIZE(PARTITION_TYPES)]; 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 extern const vpx_tree_index vp10_switchable_interp_tree
[TREE_SIZE(SWITCHABLE_FILTERS)]; [TREE_SIZE(SWITCHABLE_FILTERS)];
extern const vpx_tree_index vp10_palette_size_tree[TREE_SIZE(PALETTE_SIZES)]; extern const vpx_tree_index vp10_palette_size_tree[TREE_SIZE(PALETTE_SIZES)];
......
...@@ -69,6 +69,21 @@ typedef enum BITSTREAM_PROFILE { ...@@ -69,6 +69,21 @@ typedef enum BITSTREAM_PROFILE {
typedef uint8_t BLOCK_SIZE; 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 { typedef enum PARTITION_TYPE {
PARTITION_NONE, PARTITION_NONE,
PARTITION_HORZ, PARTITION_HORZ,
...@@ -77,10 +92,11 @@ typedef enum PARTITION_TYPE { ...@@ -77,10 +92,11 @@ typedef enum PARTITION_TYPE {
PARTITION_TYPES, PARTITION_TYPES,
PARTITION_INVALID = PARTITION_TYPES PARTITION_INVALID = PARTITION_TYPES
} PARTITION_TYPE; } PARTITION_TYPE;
#endif // CONFIG_EXT_PARTITION_TYPES
typedef char PARTITION_CONTEXT; typedef char PARTITION_CONTEXT;
#define PARTITION_PLOFFSET 4 // number of probability models per block size #define PARTITION_PLOFFSET 4 // number of probability models per block size
#define PARTITION_CONTEXTS (4 * PARTITION_PLOFFSET) #define PARTITION_CONTEXTS (4 * PARTITION_PLOFFSET)
// block transform size // block transform size
typedef uint8_t TX_SIZE; typedef uint8_t TX_SIZE;
......
...@@ -1634,7 +1634,7 @@ void vp10_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, ...@@ -1634,7 +1634,7 @@ void vp10_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer,
int start, int stop, int y_only) { int start, int stop, int y_only) {
const int num_planes = y_only ? 1 : MAX_MB_PLANE; const int num_planes = y_only ? 1 : MAX_MB_PLANE;
int mi_row, mi_col; int mi_row, mi_col;
#if !CONFIG_VAR_TX #if !CONFIG_VAR_TX && !CONFIG_EXT_PARTITION_TYPES
enum lf_path path; enum lf_path path;
LOOP_FILTER_MASK lfm; LOOP_FILTER_MASK lfm;
...@@ -1646,7 +1646,7 @@ void vp10_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, ...@@ -1646,7 +1646,7 @@ void vp10_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer,
path = LF_PATH_444; path = LF_PATH_444;
else else
path = LF_PATH_SLOW; path = LF_PATH_SLOW;
#endif #endif // !CONFIG_VAR_TX && !CONFIG_EXT_PARTITION_TYPES
#if CONFIG_VAR_TX #if CONFIG_VAR_TX
memset(cm->above_txfm_context, TX_SIZES, cm->mi_cols); memset(cm->above_txfm_context, TX_SIZES, cm->mi_cols);
...@@ -1661,7 +1661,7 @@ void vp10_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, ...@@ -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); 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) for (plane = 0; plane < num_planes; ++plane)
vp10_filter_block_plane_non420(cm, &planes[plane], mi + mi_col, vp10_filter_block_plane_non420(cm, &planes[plane], mi + mi_col,
mi_row, mi_col); mi_row, mi_col);
...@@ -1684,7 +1684,7 @@ void vp10_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, ...@@ -1684,7 +1684,7 @@ void vp10_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer,
break; 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, ...@@ -246,31 +246,51 @@ static uint8_t scan_blk_mbmi(const VP10_COMMON *cm, const MACROBLOCKD *xd,
return newmv_count; return newmv_count;
} }
// This function assumes MI blocks are 8x8 and coding units are 64x64
static int has_top_right(const MACROBLOCKD *xd, static int has_top_right(const MACROBLOCKD *xd,
int mi_row, int mi_col, int bs) { 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)) || int has_tr = !((mi_row & bs) & (bs * 2 - 1)) ||
!((mi_col & bs) & (bs * 2 - 1)); !((mi_col & bs) & (bs * 2 - 1));
// Filter out partial right-most boundaries // 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 & bs) & (bs * 2 - 1)) {
if (((mi_col & (2 * bs)) & (bs * 4 - 1)) && if (((mi_col & (2 * bs)) & (bs * 4 - 1)) &&
((mi_row & (2 * bs)) & (bs * 4 - 1))) ((mi_row & (2 * bs)) & (bs * 4 - 1)))
has_tr = 0; 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 (has_tr)
if (((mi_col + xd->n8_w) & 0x07) == 0) if (((mi_col + xd->n8_w) & 0x07) == 0)
if ((mi_row & 0x07) > 0) if ((mi_row & 0x07) > 0)
has_tr = 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->n8_w < xd->n8_h)
if (!xd->is_sec_rect) if (!xd->is_sec_rect)
has_tr = 1; 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->n8_w > xd->n8_h)
if (xd->is_sec_rect) if (xd->is_sec_rect)
has_tr = 0; 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; return has_tr;
} }
......
...@@ -499,6 +499,12 @@ static INLINE void update_partition_context(MACROBLOCKD *xd, ...@@ -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 above_ctx = xd->above_seg_context + mi_col;
PARTITION_CONTEXT *const left_ctx = xd->left_seg_context + (mi_row & MI_MASK); 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 // num_4x4_blocks_wide_lookup[bsize] / 2
const int bs = num_8x8_blocks_wide_lookup[bsize]; const int bs = num_8x8_blocks_wide_lookup[bsize];
...@@ -507,7 +513,49 @@ static INLINE void update_partition_context(MACROBLOCKD *xd, ...@@ -507,7 +513,49 @@ static INLINE void update_partition_context(MACROBLOCKD *xd,
// bits of smaller block sizes to be zero. // bits of smaller block sizes to be zero.
memset(above_ctx, partition_context_lookup[subsize].above, bs); memset(above_ctx, partition_context_lookup[subsize].above, bs);
memset(left_ctx, partition_context_lookup[subsize].left, 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, static INLINE int partition_plane_context(const MACROBLOCKD *xd,
int mi_row, int mi_col, int mi_row, int mi_col,
......
...@@ -99,9 +99,40 @@ static const uint8_t *const orders[BLOCK_SIZES] = { ...@@ -99,9 +99,40 @@ static const uint8_t *const orders[BLOCK_SIZES] = {
orders_16x32, orders_32x16, orders_32x32, orders_16x32, orders_32x16, orders_32x32,
orders_32x64, orders_64x32, orders_64x64, 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, static int vp10_has_right(BLOCK_SIZE bsize, int mi_row, int mi_col,
int right_available, int right_available,
#if CONFIG_EXT_PARTITION_TYPES
PARTITION_TYPE partition,
#endif
TX_SIZE txsz, int y, int x, int ss_x) { TX_SIZE txsz, int y, int x, int ss_x) {
const int wl = mi_width_log2_lookup[bsize]; const int wl = mi_width_log2_lookup[bsize];
const int w = VPXMAX(num_4x4_blocks_wide_lookup[bsize] >> ss_x, 1); 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, ...@@ -113,8 +144,14 @@ static int vp10_has_right(BLOCK_SIZE bsize, int mi_row, int mi_col,
if (y == 0) { if (y == 0) {
const int hl = mi_height_log2_lookup[bsize]; const int hl = mi_height_log2_lookup[bsize];
const uint8_t *order = orders[bsize]; const uint8_t *order;
int my_order, tr_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) if (x + step < w)