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
This commit is contained in:
Julia Robson
2016-03-17 16:50:28 +00:00
committed by Debargha Mukherjee
parent cbfc15b11b
commit 5cce322a09
19 changed files with 1760 additions and 30 deletions

View File

@@ -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,
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

View File

@@ -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] = {
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] = {
{{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

View File

@@ -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]
{ 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)] = {
-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) {
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) {

View File

@@ -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 {
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
[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)];

View File

@@ -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 {
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;

View File

@@ -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,
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,
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,
break; break;
} }
} }
#endif #endif // CONFIG_VAR_TX || CONFIG_EXT_PARTITION_TYPES
} }
} }
} }

View File

@@ -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;
} }

View File

@@ -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,8 +513,50 @@ 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,
BLOCK_SIZE bsize) { BLOCK_SIZE bsize) {

View File

@@ -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,
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)
return 1; 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_row = (mi_row & 7) >> hl;
mi_col = (mi_col & 7) >> wl; mi_col = (mi_col & 7) >> wl;
// If top row of coding unit
if (mi_row == 0) if (mi_row == 0)
return right_available; return right_available;
// If rightmost column of coding unit
if (((mi_col + 1) << wl) >= 8) if (((mi_col + 1) << wl) >= 8)
return 0; 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 struct macroblockd_plane *const pd = &xd->plane[plane];
const int right_available = const int right_available =
mi_col + (1 << mi_width_log2_lookup[bsize]) < xd->tile.mi_col_end; 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, const int have_right = vp10_has_right(bsize, mi_row, mi_col,
right_available, right_available,
#if CONFIG_EXT_PARTITION_TYPES
partition,
#endif
tx_size, row_off, col_off, tx_size, row_off, col_off,
pd->subsampling_x); pd->subsampling_x);
const int have_bottom = vp10_has_bottom(bsize, mi_row, mi_col, const int have_bottom = vp10_has_bottom(bsize, mi_row, mi_col,

View File

@@ -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 num_planes = y_only ? 1 : MAX_MB_PLANE;
const int sb_cols = mi_cols_aligned_to_sb(cm->mi_cols) >> MI_BLOCK_SIZE_LOG2; const int sb_cols = mi_cols_aligned_to_sb(cm->mi_cols) >> MI_BLOCK_SIZE_LOG2;
int mi_row, mi_col; int mi_row, mi_col;
#if !CONFIG_EXT_PARTITION_TYPES
enum lf_path path; enum lf_path path;
LOOP_FILTER_MASK lfm;
if (y_only) if (y_only)
path = LF_PATH_444; path = LF_PATH_444;
else if (planes[1].subsampling_y == 1 && planes[1].subsampling_x == 1) 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; path = LF_PATH_444;
else else
path = LF_PATH_SLOW; path = LF_PATH_SLOW;
#endif // !CONFIG_EXT_PARTITION_TYPES
for (mi_row = start; mi_row < stop; for (mi_row = start; mi_row < stop;
mi_row += lf_sync->num_workers * MI_BLOCK_SIZE) { 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) { 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 r = mi_row >> MI_BLOCK_SIZE_LOG2;
const int c = mi_col >> MI_BLOCK_SIZE_LOG2; const int c = mi_col >> MI_BLOCK_SIZE_LOG2;
LOOP_FILTER_MASK lfm;
int plane; int plane;
sync_read(lf_sync, r, c); sync_read(lf_sync, r, c);
vp10_setup_dst_planes(planes, frame_buffer, mi_row, mi_col); 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. // TODO(JBB): Make setup_mask work for non 420.
vp10_setup_mask(cm, mi_row, mi_col, mi + mi_col, cm->mi_stride, vp10_setup_mask(cm, mi_row, mi_col, mi + mi_col, cm->mi_stride,
&lfm); &lfm);
@@ -139,7 +146,7 @@ void thread_loop_filter_rows(const YV12_BUFFER_CONFIG *const frame_buffer,
break; break;
} }
} }
#endif // CONFIG_EXT_PARTITION_TYPES
sync_write(lf_sync, r, c, sb_cols); 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]; cm->counts.uv_mode[i][j] += counts->uv_mode[i][j];
for (i = 0; i < PARTITION_CONTEXTS; i++) 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++) for (j = 0; j < PARTITION_TYPES; j++)
#endif
cm->counts.partition[i][j] += counts->partition[i][j]; cm->counts.partition[i][j] += counts->partition[i][j];
if (is_dec) { if (is_dec) {

View File

@@ -1529,8 +1529,13 @@ static void dec_predict_sb_complex(VP10Decoder *const pbi,
const int bsl = b_width_log2_lookup[bsize], hbs = (1 << bsl) / 4; const int bsl = b_width_log2_lookup[bsize], hbs = (1 << bsl) / 4;
PARTITION_TYPE partition; PARTITION_TYPE partition;
BLOCK_SIZE subsize; BLOCK_SIZE subsize;
#if !CONFIG_EXT_PARTITION_TYPES
MB_MODE_INFO *mbmi; MB_MODE_INFO *mbmi;
#endif
int i, offset = mi_row * cm->mi_stride + mi_col; int i, offset = mi_row * cm->mi_stride + mi_col;
#if CONFIG_EXT_PARTITION_TYPES
BLOCK_SIZE bsize2 = get_subsize(bsize, PARTITION_SPLIT);
#endif
uint8_t *dst_buf1[3], *dst_buf2[3], *dst_buf3[3]; uint8_t *dst_buf1[3], *dst_buf2[3], *dst_buf3[3];
DECLARE_ALIGNED(16, uint8_t, DECLARE_ALIGNED(16, uint8_t,
@@ -1575,8 +1580,13 @@ static void dec_predict_sb_complex(VP10Decoder *const pbi,
xd->mi = cm->mi_grid_visible + offset; xd->mi = cm->mi_grid_visible + offset;
xd->mi[0] = cm->mi + 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; mbmi = &xd->mi[0]->mbmi;
partition = partition_lookup[bsl][mbmi->sb_type]; partition = partition_lookup[bsl][mbmi->sb_type];
#endif
subsize = get_subsize(bsize, partition); subsize = get_subsize(bsize, partition);
for (i = 0; i < MAX_MB_PLANE; i++) { for (i = 0; i < MAX_MB_PLANE; i++) {
@@ -1822,6 +1832,204 @@ static void dec_predict_sb_complex(VP10Decoder *const pbi,
} }
} }
break; break;
#if CONFIG_EXT_PARTITION_TYPES
case PARTITION_HORZ_A:
dec_predict_b_extend(pbi, xd, tile, 0, mi_row, mi_col, mi_row, mi_col,
mi_row_top, mi_col_top, dst_buf, dst_stride,
top_bsize, bsize2, 0, 0);
dec_extend_all(pbi, xd, tile, 0, bsize2, top_bsize, mi_row, mi_col,
mi_row_top, mi_col_top, dst_buf, dst_stride);
dec_predict_b_extend(pbi, xd, tile, 0, mi_row, mi_col + hbs, mi_row,
mi_col + hbs, mi_row_top, mi_col_top,
dst_buf1, dst_stride1, top_bsize, bsize2, 0, 0);
dec_extend_all(pbi, xd, tile, 0, bsize2, top_bsize, mi_row, mi_col + hbs,
mi_row_top, mi_col_top, dst_buf1, dst_stride1);
dec_predict_b_extend(pbi, xd, tile, 0, mi_row + hbs, mi_col,
mi_row + hbs, mi_col, mi_row_top, mi_col_top,
dst_buf2, dst_stride2, top_bsize, subsize, 0, 0);
if (bsize < top_bsize)
dec_extend_all(pbi, xd, tile, 0, subsize, top_bsize,
mi_row + hbs, mi_col, mi_row_top, mi_col_top,
dst_buf2, dst_stride2);
else
dec_extend_dir(pbi, xd, tile, 0, subsize, top_bsize,
mi_row + hbs, mi_col, mi_row_top, mi_col_top,
dst_buf2, dst_stride2, 1);
for (i = 0; i < MAX_MB_PLANE; i++) {
xd->plane[i].dst.buf = dst_buf[i];
xd->plane[i].dst.stride = dst_stride[i];
vp10_build_masked_inter_predictor_complex(xd,
dst_buf[i], dst_stride[i],
dst_buf1[i], dst_stride1[i],
&xd->plane[i],
mi_row, mi_col,
mi_row_top, mi_col_top,
bsize, top_bsize,
PARTITION_VERT, i);
}
for (i = 0; i < MAX_MB_PLANE; i++) {
vp10_build_masked_inter_predictor_complex(xd,
dst_buf[i], dst_stride[i],
dst_buf2[i], dst_stride2[i],
&xd->plane[i],
mi_row, mi_col,
mi_row_top, mi_col_top,
bsize, top_bsize,
PARTITION_HORZ, i);
}
break;
case PARTITION_VERT_A:
dec_predict_b_extend(pbi, xd, tile, 0, mi_row, mi_col, mi_row, mi_col,
mi_row_top, mi_col_top, dst_buf, dst_stride,
top_bsize, bsize2, 0, 0);
dec_extend_all(pbi, xd, tile, 0, bsize2, top_bsize, mi_row, mi_col,
mi_row_top, mi_col_top, dst_buf, dst_stride);
dec_predict_b_extend(pbi, xd, tile, 0, mi_row + hbs, mi_col,
mi_row + hbs, mi_col, mi_row_top, mi_col_top,
dst_buf1, dst_stride1, top_bsize, bsize2, 0, 0);
dec_extend_all(pbi, xd, tile, 0, bsize2, top_bsize, mi_row + hbs, mi_col,
mi_row_top, mi_col_top, dst_buf1, dst_stride1);
dec_predict_b_extend(pbi, xd, tile, 0, mi_row, mi_col + hbs,
mi_row, mi_col + hbs, mi_row_top, mi_col_top,
dst_buf2, dst_stride2,
top_bsize, subsize, 0, 0);
if (bsize < top_bsize)
dec_extend_all(pbi, xd, tile, 0, subsize, top_bsize,
mi_row, mi_col + hbs, mi_row_top, mi_col_top,
dst_buf2, dst_stride2);
else
dec_extend_dir(pbi, xd, tile, 0, subsize, top_bsize,
mi_row, mi_col + hbs, mi_row_top, mi_col_top,
dst_buf2, dst_stride2, 2);
for (i = 0; i < MAX_MB_PLANE; i++) {
xd->plane[i].dst.buf = dst_buf[i];
xd->plane[i].dst.stride = dst_stride[i];
vp10_build_masked_inter_predictor_complex(xd,
dst_buf[i], dst_stride[i],
dst_buf1[i], dst_stride1[i],
&xd->plane[i],
mi_row, mi_col,
mi_row_top, mi_col_top,
bsize, top_bsize,
PARTITION_HORZ, i);
}
for (i = 0; i < MAX_MB_PLANE; i++) {
vp10_build_masked_inter_predictor_complex(xd,
dst_buf[i], dst_stride[i],
dst_buf2[i], dst_stride2[i],
&xd->plane[i],
mi_row, mi_col,
mi_row_top, mi_col_top,
bsize, top_bsize,
PARTITION_VERT, i);
}
break;
case PARTITION_HORZ_B:
dec_predict_b_extend(pbi, xd, tile, 0, mi_row, mi_col, mi_row, mi_col,
mi_row_top, mi_col_top, dst_buf, dst_stride,
top_bsize, subsize, 0, 0);
if (bsize < top_bsize)
dec_extend_all(pbi, xd, tile, 0, subsize, top_bsize, mi_row, mi_col,
mi_row_top, mi_col_top, dst_buf, dst_stride);
else
dec_extend_dir(pbi, xd, tile, 0, subsize, top_bsize, mi_row, mi_col,
mi_row_top, mi_col_top, dst_buf, dst_stride, 0);
dec_predict_b_extend(pbi, xd, tile, 0, mi_row + hbs, mi_col, mi_row + hbs,
mi_col, mi_row_top, mi_col_top,
dst_buf1, dst_stride1, top_bsize, bsize2, 0, 0);
dec_extend_all(pbi, xd, tile, 0, bsize2, top_bsize, mi_row + hbs, mi_col,
mi_row_top, mi_col_top, dst_buf1, dst_stride1);
dec_predict_b_extend(pbi, xd, tile, 0, mi_row + hbs, mi_col + hbs,
mi_row + hbs, mi_col + hbs, mi_row_top, mi_col_top,
dst_buf2, dst_stride2, top_bsize, bsize2, 0, 0);
dec_extend_all(pbi, xd, tile, 0, bsize2, top_bsize,
mi_row + hbs, mi_col + hbs,
mi_row_top, mi_col_top, dst_buf2, dst_stride2);
for (i = 0; i < MAX_MB_PLANE; i++) {
xd->plane[i].dst.buf = dst_buf1[i];
xd->plane[i].dst.stride = dst_stride1[i];
vp10_build_masked_inter_predictor_complex(xd,
dst_buf1[i], dst_stride1[i],
dst_buf2[i], dst_stride2[i],
&xd->plane[i],
mi_row, mi_col,
mi_row_top, mi_col_top,
bsize, top_bsize,
PARTITION_VERT, i);
}
for (i = 0; i < MAX_MB_PLANE; i++) {
xd->plane[i].dst.buf = dst_buf[i];
xd->plane[i].dst.stride = dst_stride[i];
vp10_build_masked_inter_predictor_complex(xd,
dst_buf[i], dst_stride[i],
dst_buf1[i], dst_stride1[i],
&xd->plane[i],
mi_row, mi_col,
mi_row_top, mi_col_top,
bsize, top_bsize,
PARTITION_HORZ, i);
}
break;
case PARTITION_VERT_B:
dec_predict_b_extend(pbi, xd, tile, 0, mi_row, mi_col, mi_row, mi_col,
mi_row_top, mi_col_top, dst_buf, dst_stride,
top_bsize, subsize, 0, 0);
if (bsize < top_bsize)
dec_extend_all(pbi, xd, tile, 0, subsize, top_bsize, mi_row, mi_col,
mi_row_top, mi_col_top, dst_buf, dst_stride);
else
dec_extend_dir(pbi, xd, tile, 0, subsize, top_bsize, mi_row, mi_col,
mi_row_top, mi_col_top, dst_buf, dst_stride, 3);
dec_predict_b_extend(pbi, xd, tile, 0, mi_row, mi_col + hbs,
mi_row, mi_col + hbs, mi_row_top, mi_col_top,
dst_buf1, dst_stride1, top_bsize, bsize2, 0, 0);
dec_extend_all(pbi, xd, tile, 0, bsize2, top_bsize, mi_row, mi_col + hbs,
mi_row_top, mi_col_top, dst_buf1, dst_stride1);
dec_predict_b_extend(pbi, xd, tile, 0, mi_row + hbs, mi_col + hbs,
mi_row + hbs, mi_col + hbs, mi_row_top, mi_col_top,
dst_buf2, dst_stride2, top_bsize, bsize2, 0, 0);
dec_extend_all(pbi, xd, tile, 0, bsize2, top_bsize,
mi_row + hbs, mi_col + hbs,
mi_row_top, mi_col_top, dst_buf2, dst_stride2);
for (i = 0; i < MAX_MB_PLANE; i++) {
xd->plane[i].dst.buf = dst_buf1[i];
xd->plane[i].dst.stride = dst_stride1[i];
vp10_build_masked_inter_predictor_complex(xd,
dst_buf1[i], dst_stride1[i],
dst_buf2[i], dst_stride2[i],
&xd->plane[i],
mi_row, mi_col,
mi_row_top, mi_col_top,
bsize, top_bsize,
PARTITION_HORZ, i);
}
for (i = 0; i < MAX_MB_PLANE; i++) {
xd->plane[i].dst.buf = dst_buf[i];
xd->plane[i].dst.stride = dst_stride[i];
vp10_build_masked_inter_predictor_complex(xd,
dst_buf[i], dst_stride[i],
dst_buf1[i], dst_stride1[i],
&xd->plane[i],
mi_row, mi_col,
mi_row_top, mi_col_top,
bsize, top_bsize,
PARTITION_VERT, i);
}
break;
#endif // CONFIG_EXT_PARTITION_TYPES
default: default:
assert(0); assert(0);
} }
@@ -1837,6 +2045,9 @@ static void decode_block(VP10Decoder *const pbi, MACROBLOCKD *const xd,
#if CONFIG_ANS #if CONFIG_ANS
struct AnsDecoder *const tok, struct AnsDecoder *const tok,
#endif // CONFIG_ANS #endif // CONFIG_ANS
#if CONFIG_EXT_PARTITION_TYPES
PARTITION_TYPE partition,
#endif // CONFIG_EXT_PARTITION_TYPES
BLOCK_SIZE bsize, BLOCK_SIZE bsize,
int bwl, int bhl) { int bwl, int bhl) {
VP10_COMMON *const cm = &pbi->common; VP10_COMMON *const cm = &pbi->common;
@@ -1855,11 +2066,17 @@ static void decode_block(VP10Decoder *const pbi, MACROBLOCKD *const xd,
mbmi = set_offsets(cm, xd, bsize, mi_row, mi_col, mbmi = set_offsets(cm, xd, bsize, mi_row, mi_col,
bw, bh, x_mis, y_mis, bwl, bhl); bw, bh, x_mis, y_mis, bwl, bhl);
} }
#if CONFIG_EXT_PARTITION_TYPES
xd->mi[0]->mbmi.partition = partition;
#endif
vp10_read_mode_info(pbi, xd, supertx_enabled, vp10_read_mode_info(pbi, xd, supertx_enabled,
mi_row, mi_col, r, x_mis, y_mis); mi_row, mi_col, r, x_mis, y_mis);
#else #else
MB_MODE_INFO *mbmi = set_offsets(cm, xd, bsize, mi_row, mi_col, MB_MODE_INFO *mbmi = set_offsets(cm, xd, bsize, mi_row, mi_col,
bw, bh, x_mis, y_mis, bwl, bhl); bw, bh, x_mis, y_mis, bwl, bhl);
#if CONFIG_EXT_PARTITION_TYPES
xd->mi[0]->mbmi.partition = partition;
#endif
vp10_read_mode_info(pbi, xd, mi_row, mi_col, r, x_mis, y_mis); vp10_read_mode_info(pbi, xd, mi_row, mi_col, r, x_mis, y_mis);
#endif // CONFIG_SUPERTX #endif // CONFIG_SUPERTX
@@ -1899,6 +2116,9 @@ static void decode_block(VP10Decoder *const pbi, MACROBLOCKD *const xd,
(xd->mb_to_bottom_edge >= 0 ? (xd->mb_to_bottom_edge >= 0 ?
0 : xd->mb_to_bottom_edge >> (5 + pd->subsampling_y)); 0 : xd->mb_to_bottom_edge >> (5 + pd->subsampling_y));
if (plane <= 1 && mbmi->palette_mode_info.palette_size[plane])
vp10_decode_palette_tokens(xd, plane, r);
for (row = 0; row < max_blocks_high; row += step) for (row = 0; row < max_blocks_high; row += step)
for (col = 0; col < max_blocks_wide; col += step) for (col = 0; col < max_blocks_wide; col += step)
predict_and_reconstruct_intra_block(xd, predict_and_reconstruct_intra_block(xd,
@@ -2041,6 +2261,7 @@ static INLINE int dec_partition_plane_context(const MACROBLOCKD *xd,
return (left * 2 + above) + bsl * PARTITION_PLOFFSET; return (left * 2 + above) + bsl * PARTITION_PLOFFSET;
} }
#if !CONFIG_EXT_PARTITION_TYPES
static INLINE void dec_update_partition_context(MACROBLOCKD *xd, static INLINE void dec_update_partition_context(MACROBLOCKD *xd,
int mi_row, int mi_col, int mi_row, int mi_col,
BLOCK_SIZE subsize, BLOCK_SIZE subsize,
@@ -2054,17 +2275,29 @@ static INLINE void dec_update_partition_context(MACROBLOCKD *xd,
memset(above_ctx, partition_context_lookup[subsize].above, bw); memset(above_ctx, partition_context_lookup[subsize].above, bw);
memset(left_ctx, partition_context_lookup[subsize].left, bw); memset(left_ctx, partition_context_lookup[subsize].left, bw);
} }
#endif // !CONFIG_EXT_PARTITION_TYPES
static PARTITION_TYPE read_partition(VP10_COMMON *cm, MACROBLOCKD *xd, static PARTITION_TYPE read_partition(VP10_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col, vpx_reader *r, int mi_row, int mi_col, vpx_reader *r,
int has_rows, int has_cols, int bsl) { int has_rows, int has_cols,
#if CONFIG_EXT_PARTITION_TYPES
BLOCK_SIZE bsize,
#endif
int bsl) {
const int ctx = dec_partition_plane_context(xd, mi_row, mi_col, bsl); const int ctx = dec_partition_plane_context(xd, mi_row, mi_col, bsl);
const vpx_prob *const probs = cm->fc->partition_prob[ctx]; const vpx_prob *const probs = cm->fc->partition_prob[ctx];
FRAME_COUNTS *counts = xd->counts; FRAME_COUNTS *counts = xd->counts;
PARTITION_TYPE p; PARTITION_TYPE p;
if (has_rows && has_cols) if (has_rows && has_cols)
#if CONFIG_EXT_PARTITION_TYPES
if (bsize <= BLOCK_8X8)
p = (PARTITION_TYPE)vpx_read_tree(r, vp10_partition_tree, probs);
else
p = (PARTITION_TYPE)vpx_read_tree(r, vp10_ext_partition_tree, probs);
#else
p = (PARTITION_TYPE)vpx_read_tree(r, vp10_partition_tree, probs); p = (PARTITION_TYPE)vpx_read_tree(r, vp10_partition_tree, probs);
#endif // CONFIG_EXT_PARTITION_TYPES
else if (!has_rows && has_cols) else if (!has_rows && has_cols)
p = vpx_read(r, probs[1]) ? PARTITION_SPLIT : PARTITION_HORZ; p = vpx_read(r, probs[1]) ? PARTITION_SPLIT : PARTITION_HORZ;
else if (has_rows && !has_cols) else if (has_rows && !has_cols)
@@ -2107,6 +2340,9 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
const int hbs = num_8x8_wh >> 1; const int hbs = num_8x8_wh >> 1;
PARTITION_TYPE partition; PARTITION_TYPE partition;
BLOCK_SIZE subsize; BLOCK_SIZE subsize;
#if CONFIG_EXT_PARTITION_TYPES
BLOCK_SIZE bsize2 = get_subsize(bsize, PARTITION_SPLIT);
#endif
const int has_rows = (mi_row + hbs) < cm->mi_rows; const int has_rows = (mi_row + hbs) < cm->mi_rows;
const int has_cols = (mi_col + hbs) < cm->mi_cols; const int has_cols = (mi_col + hbs) < cm->mi_cols;
#if CONFIG_SUPERTX #if CONFIG_SUPERTX
@@ -2121,6 +2357,9 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
return; return;
partition = read_partition(cm, xd, mi_row, mi_col, r, has_rows, has_cols, partition = read_partition(cm, xd, mi_row, mi_col, r, has_rows, has_cols,
#if CONFIG_EXT_PARTITION_TYPES
bsize,
#endif
n8x8_l2); n8x8_l2);
subsize = subsize_lookup[partition][bsize]; // get_subsize(bsize, partition); subsize = subsize_lookup[partition][bsize]; // get_subsize(bsize, partition);
#if CONFIG_SUPERTX #if CONFIG_SUPERTX
@@ -2185,6 +2424,9 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
#if CONFIG_ANS #if CONFIG_ANS
tok, tok,
#endif // CONFIG_ANS #endif // CONFIG_ANS
#if CONFIG_EXT_PARTITION_TYPES
partition,
#endif // CONFIG_EXT_PARTITION_TYPES
subsize, 1, 1); subsize, 1, 1);
} else { } else {
switch (partition) { switch (partition) {
@@ -2197,6 +2439,9 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
#if CONFIG_ANS #if CONFIG_ANS
tok, tok,
#endif // CONFIG_ANS #endif // CONFIG_ANS
#if CONFIG_EXT_PARTITION_TYPES
partition,
#endif // CONFIG_EXT_PARTITION_TYPES
subsize, n4x4_l2, n4x4_l2); subsize, n4x4_l2, n4x4_l2);
break; break;
case PARTITION_HORZ: case PARTITION_HORZ:
@@ -2208,6 +2453,9 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
#if CONFIG_ANS #if CONFIG_ANS
tok, tok,
#endif // CONFIG_ANS #endif // CONFIG_ANS
#if CONFIG_EXT_PARTITION_TYPES
partition,
#endif // CONFIG_EXT_PARTITION_TYPES
subsize, n4x4_l2, n8x8_l2); subsize, n4x4_l2, n8x8_l2);
if (has_rows) if (has_rows)
decode_block(pbi, xd, decode_block(pbi, xd,
@@ -2218,6 +2466,9 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
#if CONFIG_ANS #if CONFIG_ANS
tok, tok,
#endif // CONFIG_ANS #endif // CONFIG_ANS
#if CONFIG_EXT_PARTITION_TYPES
partition,
#endif // CONFIG_EXT_PARTITION_TYPES
subsize, n4x4_l2, n8x8_l2); subsize, n4x4_l2, n8x8_l2);
break; break;
case PARTITION_VERT: case PARTITION_VERT:
@@ -2229,6 +2480,9 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
#if CONFIG_ANS #if CONFIG_ANS
tok, tok,
#endif // CONFIG_ANS #endif // CONFIG_ANS
#if CONFIG_EXT_PARTITION_TYPES
partition,
#endif // CONFIG_EXT_PARTITION_TYPES
subsize, n8x8_l2, n4x4_l2); subsize, n8x8_l2, n4x4_l2);
if (has_cols) if (has_cols)
decode_block(pbi, xd, decode_block(pbi, xd,
@@ -2239,6 +2493,9 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
#if CONFIG_ANS #if CONFIG_ANS
tok, tok,
#endif // CONFIG_ANS #endif // CONFIG_ANS
#if CONFIG_EXT_PARTITION_TYPES
partition,
#endif // CONFIG_EXT_PARTITION_TYPES
subsize, n8x8_l2, n4x4_l2); subsize, n8x8_l2, n4x4_l2);
break; break;
case PARTITION_SPLIT: case PARTITION_SPLIT:
@@ -2279,6 +2536,124 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
#endif // CONFIG_ANS #endif // CONFIG_ANS
subsize, n8x8_l2); subsize, n8x8_l2);
break; break;
#if CONFIG_EXT_PARTITION_TYPES
case PARTITION_HORZ_A:
decode_block(pbi, xd,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row, mi_col, r,
#if CONFIG_ANS
tok,
#endif // CONFIG_ANS
partition, bsize2, n8x8_l2, n8x8_l2);
decode_block(pbi, xd,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row, mi_col + hbs, r,
#if CONFIG_ANS
tok,
#endif // CONFIG_ANS
partition, bsize2, n8x8_l2, n8x8_l2);
decode_block(pbi, xd,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row + hbs, mi_col, r,
#if CONFIG_ANS
tok,
#endif // CONFIG_ANS
partition, subsize, n4x4_l2, n8x8_l2);
break;
case PARTITION_HORZ_B:
decode_block(pbi, xd,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row, mi_col, r,
#if CONFIG_ANS
tok,
#endif // CONFIG_ANS
partition, subsize, n4x4_l2, n8x8_l2);
decode_block(pbi, xd,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row + hbs, mi_col, r,
#if CONFIG_ANS
tok,
#endif // CONFIG_ANS
partition, bsize2, n8x8_l2, n8x8_l2);
decode_block(pbi, xd,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row + hbs, mi_col + hbs, r,
#if CONFIG_ANS
tok,
#endif // CONFIG_ANS
partition, bsize2, n8x8_l2, n8x8_l2);
break;
case PARTITION_VERT_A:
decode_block(pbi, xd,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row, mi_col, r,
#if CONFIG_ANS
tok,
#endif // CONFIG_ANS
partition, bsize2, n8x8_l2, n8x8_l2);
decode_block(pbi, xd,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row + hbs, mi_col, r,
#if CONFIG_ANS
tok,
#endif // CONFIG_ANS
partition, bsize2, n8x8_l2, n8x8_l2);
decode_block(pbi, xd,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row, mi_col + hbs, r,
#if CONFIG_ANS
tok,
#endif // CONFIG_ANS
partition, subsize, n8x8_l2, n4x4_l2);
break;
case PARTITION_VERT_B:
decode_block(pbi, xd,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row, mi_col, r,
#if CONFIG_ANS
tok,
#endif // CONFIG_ANS
partition, subsize, n8x8_l2, n4x4_l2);
decode_block(pbi, xd,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row, mi_col + hbs, r,
#if CONFIG_ANS
tok,
#endif // CONFIG_ANS
partition, bsize2, n8x8_l2, n8x8_l2);
decode_block(pbi, xd,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row + hbs, mi_col + hbs, r,
#if CONFIG_ANS
tok,
#endif // CONFIG_ANS
partition, bsize2, n8x8_l2, n8x8_l2);
break;
#endif
default: default:
assert(0 && "Invalid partition type"); assert(0 && "Invalid partition type");
} }
@@ -2336,10 +2711,43 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
} }
#endif // CONFIG_SUPERTX #endif // CONFIG_SUPERTX
#if CONFIG_EXT_PARTITION_TYPES
if (bsize >= BLOCK_8X8) {
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");
}
}
#else
// update partition context // update partition context
if (bsize >= BLOCK_8X8 && if (bsize >= BLOCK_8X8 &&
(bsize == BLOCK_8X8 || partition != PARTITION_SPLIT)) (bsize == BLOCK_8X8 || partition != PARTITION_SPLIT))
dec_update_partition_context(xd, mi_row, mi_col, subsize, num_8x8_wh); dec_update_partition_context(xd, mi_row, mi_col, subsize, num_8x8_wh);
#endif // CONFIG_EXT_PARTITION_TYPES
} }
static void setup_bool_decoder(const uint8_t *data, static void setup_bool_decoder(const uint8_t *data,
@@ -3594,9 +4002,17 @@ static int read_compressed_header(VP10Decoder *pbi, const uint8_t *data,
for (i = 0; i < INTRA_MODES - 1; ++i) for (i = 0; i < INTRA_MODES - 1; ++i)
vp10_diff_update_prob(&r, &fc->uv_mode_prob[j][i]); vp10_diff_update_prob(&r, &fc->uv_mode_prob[j][i]);
#if CONFIG_EXT_PARTITION_TYPES
for (i = 0; i < PARTITION_TYPES - 1; ++i)
vp10_diff_update_prob(&r, &fc->partition_prob[0][i]);
for (j = 1; j < PARTITION_CONTEXTS; ++j)
for (i = 0; i < EXT_PARTITION_TYPES - 1; ++i)
vp10_diff_update_prob(&r, &fc->partition_prob[j][i]);
#else
for (j = 0; j < PARTITION_CONTEXTS; ++j) for (j = 0; j < PARTITION_CONTEXTS; ++j)
for (i = 0; i < PARTITION_TYPES - 1; ++i) for (i = 0; i < PARTITION_TYPES - 1; ++i)
vp10_diff_update_prob(&r, &fc->partition_prob[j][i]); vp10_diff_update_prob(&r, &fc->partition_prob[j][i]);
#endif // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
for (i = 0; i < INTRA_FILTERS + 1; ++i) for (i = 0; i < INTRA_FILTERS + 1; ++i)

View File

@@ -50,6 +50,10 @@ static const struct vp10_token switchable_interp_encodings[SWITCHABLE_FILTERS] =
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}}; {{0, 1}, {2, 2}, {3, 2}};
#endif // CONFIG_EXT_INTERP && SWITCHABLE_FILTERS == 4 #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] = static const struct vp10_token partition_encodings[PARTITION_TYPES] =
{{0, 1}, {2, 2}, {6, 3}, {7, 3}}; {{0, 1}, {2, 2}, {6, 3}, {7, 3}};
#if !CONFIG_REF_MV #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; const int has_cols = (mi_col + hbs) < cm->mi_cols;
if (has_rows && has_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]); vp10_write_token(w, vp10_partition_tree, probs, &partition_encodings[p]);
#endif // CONFIG_EXT_PARTITION_TYPES
} else if (!has_rows && has_cols) { } else if (!has_rows && has_cols) {
assert(p == PARTITION_SPLIT || p == PARTITION_HORZ); assert(p == PARTITION_SPLIT || p == PARTITION_HORZ);
vpx_write(w, p == PARTITION_SPLIT, probs[1]); 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]; m = cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col];
partition = partition_lookup[bsl][m->mbmi.sb_type]; 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); write_partition(cm, xd, bs, mi_row, mi_col, partition, bsize, w);
subsize = get_subsize(bsize, partition); subsize = get_subsize(bsize, partition);
#if CONFIG_SUPERTX #if CONFIG_SUPERTX
@@ -1770,6 +1786,76 @@ static void write_modes_sb(VP10_COMP *cpi, const TileInfo *const tile,
#endif // CONFIG_SUPERTX #endif // CONFIG_SUPERTX
mi_row + bs, mi_col + bs, subsize); mi_row + bs, mi_col + bs, subsize);
break; 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);
write_modes_b(cpi, tile, w, tok, tok_end,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row + bs, mi_col);
write_modes_b(cpi, tile, w, tok, tok_end,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row + bs, mi_col + bs);
break;
case PARTITION_VERT_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 + bs, mi_col);
write_modes_b(cpi, tile, w, tok, tok_end,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
mi_row, mi_col + bs);
break;
case PARTITION_VERT_B:
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 + bs);
break;
#endif // CONFIG_EXT_PARTITION_TYPES
default: default:
assert(0); assert(0);
} }
@@ -1803,9 +1889,13 @@ static void write_modes_sb(VP10_COMP *cpi, const TileInfo *const tile,
#endif // CONFIG_SUPERTX #endif // CONFIG_SUPERTX
// update partition context // update partition context
#if CONFIG_EXT_PARTITION_TYPES
update_ext_partition_context(xd, mi_row, mi_col, subsize, bsize, partition);
#else
if (bsize >= BLOCK_8X8 && if (bsize >= BLOCK_8X8 &&
(bsize == BLOCK_8X8 || partition != PARTITION_SPLIT)) (bsize == BLOCK_8X8 || partition != PARTITION_SPLIT))
update_partition_context(xd, mi_row, mi_col, subsize, bsize); update_partition_context(xd, mi_row, mi_col, subsize, bsize);
#endif // CONFIG_EXT_PARTITION_TYPES
} }
static void write_modes(VP10_COMP *cpi, const TileInfo *const tile, static void write_modes(VP10_COMP *cpi, const TileInfo *const tile,
@@ -2581,9 +2671,18 @@ static size_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
prob_diff_update(vp10_intra_mode_tree, fc->uv_mode_prob[i], prob_diff_update(vp10_intra_mode_tree, fc->uv_mode_prob[i],
counts->uv_mode[i], INTRA_MODES, &header_bc); counts->uv_mode[i], INTRA_MODES, &header_bc);
#if CONFIG_EXT_PARTITION_TYPES
prob_diff_update(vp10_partition_tree, fc->partition_prob[0],
counts->partition[0], PARTITION_TYPES, &header_bc);
for (i = 1; i < PARTITION_CONTEXTS; ++i)
prob_diff_update(vp10_ext_partition_tree, fc->partition_prob[i],
counts->partition[i], EXT_PARTITION_TYPES,
&header_bc);
#else
for (i = 0; i < PARTITION_CONTEXTS; ++i) for (i = 0; i < PARTITION_CONTEXTS; ++i)
prob_diff_update(vp10_partition_tree, fc->partition_prob[i], prob_diff_update(vp10_partition_tree, fc->partition_prob[i],
counts->partition[i], PARTITION_TYPES, &header_bc); counts->partition[i], PARTITION_TYPES, &header_bc);
#endif // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
for (i = 0; i < INTRA_FILTERS + 1; ++i) for (i = 0; i < INTRA_FILTERS + 1; ++i)

View File

@@ -19,11 +19,17 @@ static const BLOCK_SIZE square[] = {
}; };
static void alloc_mode_context(VP10_COMMON *cm, int num_4x4_blk, static void alloc_mode_context(VP10_COMMON *cm, int num_4x4_blk,
#if CONFIG_EXT_PARTITION_TYPES
PARTITION_TYPE partition,
#endif
PICK_MODE_CONTEXT *ctx) { PICK_MODE_CONTEXT *ctx) {
const int num_blk = (num_4x4_blk < 4 ? 4 : num_4x4_blk); const int num_blk = (num_4x4_blk < 4 ? 4 : num_4x4_blk);
const int num_pix = num_blk << 4; const int num_pix = num_blk << 4;
int i, k; int i, k;
ctx->num_4x4_blk = num_blk; ctx->num_4x4_blk = num_blk;
#if CONFIG_EXT_PARTITION_TYPES
ctx->partition = partition;
#endif
CHECK_MEM_ERROR(cm, ctx->zcoeff_blk, CHECK_MEM_ERROR(cm, ctx->zcoeff_blk,
vpx_calloc(num_blk, sizeof(uint8_t))); vpx_calloc(num_blk, sizeof(uint8_t)));
@@ -78,6 +84,46 @@ static void free_mode_context(PICK_MODE_CONTEXT *ctx) {
static void alloc_tree_contexts(VP10_COMMON *cm, PC_TREE *tree, static void alloc_tree_contexts(VP10_COMMON *cm, PC_TREE *tree,
int num_4x4_blk) { int num_4x4_blk) {
#if CONFIG_EXT_PARTITION_TYPES
alloc_mode_context(cm, num_4x4_blk, PARTITION_NONE, &tree->none);
alloc_mode_context(cm, num_4x4_blk/2, PARTITION_HORZ, &tree->horizontal[0]);
alloc_mode_context(cm, num_4x4_blk/2, PARTITION_VERT, &tree->vertical[0]);
alloc_mode_context(cm, num_4x4_blk/2, PARTITION_VERT, &tree->horizontal[1]);
alloc_mode_context(cm, num_4x4_blk/2, PARTITION_VERT, &tree->vertical[1]);
alloc_mode_context(cm, num_4x4_blk/4, PARTITION_HORZ_A,
&tree->horizontala[0]);
alloc_mode_context(cm, num_4x4_blk/4, PARTITION_HORZ_A,
&tree->horizontala[1]);
alloc_mode_context(cm, num_4x4_blk/2, PARTITION_HORZ_A,
&tree->horizontala[2]);
alloc_mode_context(cm, num_4x4_blk/2, PARTITION_HORZ_B,
&tree->horizontalb[0]);
alloc_mode_context(cm, num_4x4_blk/4, PARTITION_HORZ_B,
&tree->horizontalb[1]);
alloc_mode_context(cm, num_4x4_blk/4, PARTITION_HORZ_B,
&tree->horizontalb[2]);
alloc_mode_context(cm, num_4x4_blk/4, PARTITION_VERT_A, &tree->verticala[0]);
alloc_mode_context(cm, num_4x4_blk/4, PARTITION_VERT_A, &tree->verticala[1]);
alloc_mode_context(cm, num_4x4_blk/2, PARTITION_VERT_A, &tree->verticala[2]);
alloc_mode_context(cm, num_4x4_blk/2, PARTITION_VERT_B, &tree->verticalb[0]);
alloc_mode_context(cm, num_4x4_blk/4, PARTITION_VERT_B, &tree->verticalb[1]);
alloc_mode_context(cm, num_4x4_blk/4, PARTITION_VERT_B, &tree->verticalb[2]);
#ifdef CONFIG_SUPERTX
alloc_mode_context(cm, num_4x4_blk, PARTITION_HORZ,
&tree->horizontal_supertx);
alloc_mode_context(cm, num_4x4_blk, PARTITION_VERT, &tree->vertical_supertx);
alloc_mode_context(cm, num_4x4_blk, PARTITION_SPLIT, &tree->split_supertx);
alloc_mode_context(cm, num_4x4_blk, PARTITION_HORZ_A,
&tree->horizontala_supertx);
alloc_mode_context(cm, num_4x4_blk, PARTITION_HORZ_B,
&tree->horizontalb_supertx);
alloc_mode_context(cm, num_4x4_blk, PARTITION_VERT_A,
&tree->verticala_supertx);
alloc_mode_context(cm, num_4x4_blk, PARTITION_VERT_B,
&tree->verticalb_supertx);
#endif // CONFIG_SUPERTX
#else
alloc_mode_context(cm, num_4x4_blk, &tree->none); alloc_mode_context(cm, num_4x4_blk, &tree->none);
alloc_mode_context(cm, num_4x4_blk/2, &tree->horizontal[0]); alloc_mode_context(cm, num_4x4_blk/2, &tree->horizontal[0]);
alloc_mode_context(cm, num_4x4_blk/2, &tree->vertical[0]); alloc_mode_context(cm, num_4x4_blk/2, &tree->vertical[0]);
@@ -94,9 +140,19 @@ static void alloc_tree_contexts(VP10_COMMON *cm, PC_TREE *tree,
memset(&tree->horizontal[1], 0, sizeof(tree->horizontal[1])); memset(&tree->horizontal[1], 0, sizeof(tree->horizontal[1]));
memset(&tree->vertical[1], 0, sizeof(tree->vertical[1])); memset(&tree->vertical[1], 0, sizeof(tree->vertical[1]));
} }
#endif // CONFIG_EXT_PARTITION_TYPES
} }
static void free_tree_contexts(PC_TREE *tree) { static void free_tree_contexts(PC_TREE *tree) {
#if CONFIG_EXT_PARTITION_TYPES
int i;
for (i = 0; i < 3; i++) {
free_mode_context(&tree->horizontala[i]);
free_mode_context(&tree->horizontalb[i]);
free_mode_context(&tree->verticala[i]);
free_mode_context(&tree->verticalb[i]);
}
#endif // CONFIG_EXT_PARTITION_TYPES
free_mode_context(&tree->none); free_mode_context(&tree->none);
free_mode_context(&tree->horizontal[0]); free_mode_context(&tree->horizontal[0]);
free_mode_context(&tree->horizontal[1]); free_mode_context(&tree->horizontal[1]);
@@ -106,7 +162,13 @@ static void free_tree_contexts(PC_TREE *tree) {
free_mode_context(&tree->horizontal_supertx); free_mode_context(&tree->horizontal_supertx);
free_mode_context(&tree->vertical_supertx); free_mode_context(&tree->vertical_supertx);
free_mode_context(&tree->split_supertx); free_mode_context(&tree->split_supertx);
#endif #if CONFIG_EXT_PARTITION_TYPES
free_mode_context(&tree->horizontala_supertx);
free_mode_context(&tree->horizontalb_supertx);
free_mode_context(&tree->verticala_supertx);
free_mode_context(&tree->verticalb_supertx);
#endif // CONFIG_EXT_PARTITION_TYPES
#endif // CONFIG_SUPERTX
} }
// This function sets up a tree of contexts such that at each square // This function sets up a tree of contexts such that at each square
@@ -135,8 +197,13 @@ void vp10_setup_pc_tree(VP10_COMMON *cm, ThreadData *td) {
// 4x4 blocks smaller than 8x8 but in the same 8x8 block share the same // 4x4 blocks smaller than 8x8 but in the same 8x8 block share the same
// context so we only need to allocate 1 for each 8x8 block. // context so we only need to allocate 1 for each 8x8 block.
for (i = 0; i < leaf_nodes; ++i) for (i = 0; i < leaf_nodes; ++i) {
#if CONFIG_EXT_PARTITION_TYPES
alloc_mode_context(cm, 1, PARTITION_NONE, &td->leaf_tree[i]);
#else
alloc_mode_context(cm, 1, &td->leaf_tree[i]); alloc_mode_context(cm, 1, &td->leaf_tree[i]);
#endif
}
// Sets up all the leaf nodes in the tree. // Sets up all the leaf nodes in the tree.
for (pc_tree_index = 0; pc_tree_index < leaf_nodes; ++pc_tree_index) { for (pc_tree_index = 0; pc_tree_index < leaf_nodes; ++pc_tree_index) {

View File

@@ -73,6 +73,9 @@ typedef struct {
// search loop // search loop
MV pred_mv[MAX_REF_FRAMES]; MV pred_mv[MAX_REF_FRAMES];
INTERP_FILTER pred_interp_filter; INTERP_FILTER pred_interp_filter;
#if CONFIG_EXT_PARTITION_TYPES
PARTITION_TYPE partition;
#endif
} PICK_MODE_CONTEXT; } PICK_MODE_CONTEXT;
typedef struct PC_TREE { typedef struct PC_TREE {
@@ -82,6 +85,12 @@ typedef struct PC_TREE {
PICK_MODE_CONTEXT none; PICK_MODE_CONTEXT none;
PICK_MODE_CONTEXT horizontal[2]; PICK_MODE_CONTEXT horizontal[2];
PICK_MODE_CONTEXT vertical[2]; PICK_MODE_CONTEXT vertical[2];
#if CONFIG_EXT_PARTITION_TYPES
PICK_MODE_CONTEXT horizontala[3];
PICK_MODE_CONTEXT horizontalb[3];
PICK_MODE_CONTEXT verticala[3];
PICK_MODE_CONTEXT verticalb[3];
#endif
union { union {
struct PC_TREE *split[4]; struct PC_TREE *split[4];
PICK_MODE_CONTEXT *leaf_split[4]; PICK_MODE_CONTEXT *leaf_split[4];
@@ -90,6 +99,12 @@ typedef struct PC_TREE {
PICK_MODE_CONTEXT horizontal_supertx; PICK_MODE_CONTEXT horizontal_supertx;
PICK_MODE_CONTEXT vertical_supertx; PICK_MODE_CONTEXT vertical_supertx;
PICK_MODE_CONTEXT split_supertx; PICK_MODE_CONTEXT split_supertx;
#if CONFIG_EXT_PARTITION_TYPES
PICK_MODE_CONTEXT horizontala_supertx;
PICK_MODE_CONTEXT horizontalb_supertx;
PICK_MODE_CONTEXT verticala_supertx;
PICK_MODE_CONTEXT verticalb_supertx;
#endif
#endif #endif
} PC_TREE; } PC_TREE;

File diff suppressed because it is too large Load Diff

View File

@@ -282,9 +282,9 @@ static void inc_mvs(const MB_MODE_INFO *mbmi, const MB_MODE_INFO_EXT *mbmi_ext,
const MV diff = {mvs[i].as_mv.row - ref->row, const MV diff = {mvs[i].as_mv.row - ref->row,
mvs[i].as_mv.col - ref->col}; mvs[i].as_mv.col - ref->col};
#if CONFIG_REF_MV #if CONFIG_REF_MV
int nmv_ctx = vp10_nmv_ctx(mbmi_ext->ref_mv_count[mbmi->ref_frame[i]], int nmv_ctx = vp10_nmv_ctx(mbmi_ext->ref_mv_count[mbmi->ref_frame[i]],
mbmi_ext->ref_mv_stack[mbmi->ref_frame[i]]); mbmi_ext->ref_mv_stack[mbmi->ref_frame[i]]);
nmv_context_counts *counts = &nmv_counts[nmv_ctx]; nmv_context_counts *counts = &nmv_counts[nmv_ctx];
#endif #endif
vp10_inc_mv(&diff, counts, vp10_use_mv_hp(ref)); vp10_inc_mv(&diff, counts, vp10_use_mv_hp(ref));
} }
@@ -332,9 +332,9 @@ static void inc_mvs_sub8x8(const MODE_INFO *mi,
const MV diff = {mvs[i].as_mv.row - ref->row, const MV diff = {mvs[i].as_mv.row - ref->row,
mvs[i].as_mv.col - ref->col}; mvs[i].as_mv.col - ref->col};
#if CONFIG_REF_MV #if CONFIG_REF_MV
int nmv_ctx = vp10_nmv_ctx(mbmi_ext->ref_mv_count[mbmi->ref_frame[i]], int nmv_ctx = vp10_nmv_ctx(mbmi_ext->ref_mv_count[mbmi->ref_frame[i]],
mbmi_ext->ref_mv_stack[mbmi->ref_frame[i]]); mbmi_ext->ref_mv_stack[mbmi->ref_frame[i]]);
nmv_context_counts *counts = &nmv_counts[nmv_ctx]; nmv_context_counts *counts = &nmv_counts[nmv_ctx];
#endif #endif
vp10_inc_mv(&diff, counts, vp10_use_mv_hp(ref)); vp10_inc_mv(&diff, counts, vp10_use_mv_hp(ref));
} }

View File

@@ -504,7 +504,11 @@ typedef struct VP10_COMP {
int intra_uv_mode_cost[INTRA_MODES][INTRA_MODES]; int intra_uv_mode_cost[INTRA_MODES][INTRA_MODES];
int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES]; int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES];
int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS]; int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS];
#if CONFIG_EXT_PARTITION_TYPES
int partition_cost[PARTITION_CONTEXTS][EXT_PARTITION_TYPES];
#else
int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES]; int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES];
#endif
int palette_y_size_cost[PALETTE_BLOCK_SIZES][PALETTE_SIZES]; int palette_y_size_cost[PALETTE_BLOCK_SIZES][PALETTE_SIZES];
int palette_uv_size_cost[PALETTE_BLOCK_SIZES][PALETTE_SIZES]; int palette_uv_size_cost[PALETTE_BLOCK_SIZES][PALETTE_SIZES];
int palette_y_color_cost[PALETTE_MAX_SIZE - 1][PALETTE_COLOR_CONTEXTS] int palette_y_color_cost[PALETTE_MAX_SIZE - 1][PALETTE_COLOR_CONTEXTS]

View File

@@ -393,9 +393,17 @@ void vp10_initialize_rd_consts(VP10_COMP *cpi) {
if (cpi->sf.partition_search_type != VAR_BASED_PARTITION || if (cpi->sf.partition_search_type != VAR_BASED_PARTITION ||
cm->frame_type == KEY_FRAME) { cm->frame_type == KEY_FRAME) {
#if CONFIG_EXT_PARTITION_TYPES
vp10_cost_tokens(cpi->partition_cost[0], cm->fc->partition_prob[0],
vp10_partition_tree);
for (i = 1; i < PARTITION_CONTEXTS; ++i)
vp10_cost_tokens(cpi->partition_cost[i], cm->fc->partition_prob[i],
vp10_ext_partition_tree);
#else
for (i = 0; i < PARTITION_CONTEXTS; ++i) for (i = 0; i < PARTITION_CONTEXTS; ++i)
vp10_cost_tokens(cpi->partition_cost[i], cm->fc->partition_prob[i], vp10_cost_tokens(cpi->partition_cost[i], cm->fc->partition_prob[i],
vp10_partition_tree); vp10_partition_tree);
#endif // CONFIG_EXT_PARTITION_TYPES
} }
fill_mode_costs(cpi); fill_mode_costs(cpi);

View File

@@ -164,15 +164,106 @@ static void count_segs_sb(const VP10_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col, int mi_row, int mi_col,
BLOCK_SIZE bsize) { BLOCK_SIZE bsize) {
const int mis = cm->mi_stride; const int mis = cm->mi_stride;
int bw, bh;
const int bs = num_8x8_blocks_wide_lookup[bsize], hbs = bs / 2; const int bs = num_8x8_blocks_wide_lookup[bsize], hbs = bs / 2;
#if CONFIG_EXT_PARTITION_TYPES
PARTITION_TYPE partition;
#else
const int bw = num_8x8_blocks_wide_lookup[mi[0]->mbmi.sb_type];
const int bh = num_8x8_blocks_high_lookup[mi[0]->mbmi.sb_type];
#endif // CONFIG_EXT_PARTITION_TYPES
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
return; return;
bw = num_8x8_blocks_wide_lookup[mi[0]->mbmi.sb_type];
bh = num_8x8_blocks_high_lookup[mi[0]->mbmi.sb_type];
#if CONFIG_EXT_PARTITION_TYPES
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);
switch (partition) {
case PARTITION_NONE:
count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count,
t_unpred_seg_counts, bs, bs, mi_row, mi_col);
break;
case PARTITION_HORZ:
count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count,
t_unpred_seg_counts, bs, hbs, mi_row, mi_col);
count_segs(cm, xd, tile, mi + hbs * mis, no_pred_segcounts,
temporal_predictor_count, t_unpred_seg_counts, bs, hbs,
mi_row + hbs, mi_col);
break;
case PARTITION_VERT:
count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count,
t_unpred_seg_counts, hbs, bs, mi_row, mi_col);
count_segs(cm, xd, tile, mi + hbs,
no_pred_segcounts, temporal_predictor_count,
t_unpred_seg_counts, hbs, bs, mi_row, mi_col + hbs);
break;
case PARTITION_HORZ_A:
count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count,
t_unpred_seg_counts, hbs, hbs, mi_row, mi_col);
count_segs(cm, xd, tile, mi + hbs, no_pred_segcounts,
temporal_predictor_count, t_unpred_seg_counts, hbs, hbs,
mi_row, mi_col + hbs);
count_segs(cm, xd, tile, mi + hbs * mis, no_pred_segcounts,
temporal_predictor_count, t_unpred_seg_counts, bs, hbs,
mi_row + hbs, mi_col);
break;
case PARTITION_HORZ_B:
count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count,
t_unpred_seg_counts, bs, hbs, mi_row, mi_col);
count_segs(cm, xd, tile, mi + hbs * mis, no_pred_segcounts,
temporal_predictor_count, t_unpred_seg_counts, hbs, hbs,
mi_row + hbs, mi_col);
count_segs(cm, xd, tile, mi + hbs + hbs * mis, no_pred_segcounts,
temporal_predictor_count, t_unpred_seg_counts, hbs, hbs,
mi_row + hbs, mi_col + hbs);
break;
case PARTITION_VERT_A:
count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count,
t_unpred_seg_counts, hbs, hbs, mi_row, mi_col);
count_segs(cm, xd, tile, mi + hbs * mis, no_pred_segcounts,
temporal_predictor_count, t_unpred_seg_counts, hbs, hbs,
mi_row + hbs, mi_col);
count_segs(cm, xd, tile, mi + hbs,
no_pred_segcounts, temporal_predictor_count,
t_unpred_seg_counts, hbs, bs, mi_row, mi_col + hbs);
break;
case PARTITION_VERT_B:
count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count,
t_unpred_seg_counts, hbs, bs, mi_row, mi_col);
count_segs(cm, xd, tile, mi + hbs,
no_pred_segcounts, temporal_predictor_count,
t_unpred_seg_counts, hbs, hbs, mi_row, mi_col + hbs);
count_segs(cm, xd, tile, mi + hbs + hbs * mis,
no_pred_segcounts, temporal_predictor_count,
t_unpred_seg_counts, hbs, hbs, mi_row + hbs, mi_col + hbs);
break;
case PARTITION_SPLIT:
{
const BLOCK_SIZE subsize = subsize_lookup[PARTITION_SPLIT][bsize];
int n;
assert(num_8x8_blocks_wide_lookup[mi[0]->mbmi.sb_type] < bs &&
num_8x8_blocks_high_lookup[mi[0]->mbmi.sb_type] < bs);
for (n = 0; n < 4; n++) {
const int mi_dc = hbs * (n & 1);
const int mi_dr = hbs * (n >> 1);
count_segs_sb(cm, xd, tile, &mi[mi_dr * mis + mi_dc],
no_pred_segcounts, temporal_predictor_count,
t_unpred_seg_counts,
mi_row + mi_dr, mi_col + mi_dc, subsize);
}
}
break;
default:
assert(0);
}
#else
if (bw == bs && bh == bs) { if (bw == bs && bh == bs) {
count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count, count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count,
t_unpred_seg_counts, bs, bs, mi_row, mi_col); t_unpred_seg_counts, bs, bs, mi_row, mi_col);
@@ -204,6 +295,7 @@ static void count_segs_sb(const VP10_COMMON *cm, MACROBLOCKD *xd,
mi_row + mi_dr, mi_col + mi_dc, subsize); mi_row + mi_dr, mi_col + mi_dc, subsize);
} }
} }
#endif // CONFIG_EXT_PARTITION_TYPES
} }
void vp10_choose_segmap_coding_method(VP10_COMMON *cm, MACROBLOCKD *xd) { void vp10_choose_segmap_coding_method(VP10_COMMON *cm, MACROBLOCKD *xd) {