Commit d068d869 authored by Ronald S. Bultje's avatar Ronald S. Bultje

sb8x8 integration in rd loop.

Work-in-progress, not yet ready for review. TODO items:
- bitstream writing (encoder) and reading (decoder)
- decoder reconstruction

Change-Id: I5afb7284e7e0480847b47cd0097cb469433c9081
parent ad689031
......@@ -83,7 +83,9 @@ typedef enum {
D27_PRED, /* Directional 22 deg prediction [anti-clockwise from 0 deg hor] */
D63_PRED, /* Directional 67 deg prediction [anti-clockwise from 0 deg hor] */
TM_PRED, /* Truemotion prediction */
#if !CONFIG_SB8X8
I8X8_PRED, /* 8x8 based prediction, each 8x8 has its own mode */
#endif
I4X4_PRED, /* 4x4 based prediction, each 4x4 has its own mode */
NEARESTMV,
NEARMV,
......@@ -126,7 +128,9 @@ typedef enum {
#define VP9_YMODES (I4X4_PRED + 1)
#define VP9_UV_MODES (TM_PRED + 1)
#if !CONFIG_SB8X8
#define VP9_I8X8_MODES (TM_PRED + 1)
#endif
#define VP9_I32X32_MODES (TM_PRED + 1)
#define VP9_MVREFS (1 + SPLITMV - NEARESTMV)
......@@ -169,6 +173,7 @@ typedef enum {
#define VP9_NKF_BINTRAMODES (VP9_BINTRAMODES) /* 10 */
#endif
#if !CONFIG_SB8X8
typedef enum {
PARTITIONING_16X8 = 0,
PARTITIONING_8X16,
......@@ -176,6 +181,7 @@ typedef enum {
PARTITIONING_4X4,
NB_PARTITIONINGS,
} SPLITMV_PARTITIONING_TYPE;
#endif
/* For keyframes, intra block modes are predicted by the (already decoded)
modes for the Y blocks to the left and above us; for interframes, there
......@@ -271,7 +277,9 @@ typedef struct {
int mb_mode_context[MAX_REF_FRAMES];
#if !CONFIG_SB8X8
SPLITMV_PARTITIONING_TYPE partitioning;
#endif
unsigned char mb_skip_coeff; /* does this mb has coefficients at all, 1=no coefficients, 0=need decode tokens */
unsigned char need_to_clamp_mvs;
unsigned char need_to_clamp_secondmv;
......@@ -293,7 +301,7 @@ typedef struct {
typedef struct {
MB_MODE_INFO mbmi;
union b_mode_info bmi[16];
union b_mode_info bmi[16 >> (CONFIG_SB8X8 * 2)];
} MODE_INFO;
struct scale_factors {
......@@ -433,8 +441,11 @@ typedef struct macroblockd {
int corrupted;
int sb_index;
int mb_index; // Index of the MB in the SB (0..3)
int sb_index; // index of 32x32 block inside the 64x64 block
int mb_index; // index of 16x16 block inside the 32x32 block
#if CONFIG_SB8X8
int b_index; // index of 8x8 block inside the 16x16 block
#endif
int q_index;
} MACROBLOCKD;
......@@ -442,10 +453,10 @@ typedef struct macroblockd {
static INLINE void update_partition_context(MACROBLOCKD *xd,
BLOCK_SIZE_TYPE sb_type,
BLOCK_SIZE_TYPE sb_size) {
int bsl = mi_width_log2(sb_size) - CONFIG_SB8X8, bs = 1 << bsl;
int bwl = mi_width_log2(sb_type) - CONFIG_SB8X8;
int bhl = mi_height_log2(sb_type) - CONFIG_SB8X8;
int boffset = mi_width_log2(BLOCK_SIZE_SB64X64) - CONFIG_SB8X8 - bsl;
int bsl = mi_width_log2(sb_size), bs = 1 << bsl;
int bwl = mi_width_log2(sb_type);
int bhl = mi_height_log2(sb_type);
int boffset = mi_width_log2(BLOCK_SIZE_SB64X64) - bsl;
int i;
// skip macroblock partition
if (bsl == 0)
......@@ -481,9 +492,9 @@ static INLINE void update_partition_context(MACROBLOCKD *xd,
static INLINE int partition_plane_context(MACROBLOCKD *xd,
BLOCK_SIZE_TYPE sb_type) {
int bsl = mi_width_log2(sb_type) - CONFIG_SB8X8, bs = 1 << bsl;
int bsl = mi_width_log2(sb_type), bs = 1 << bsl;
int above = 0, left = 0, i;
int boffset = mi_width_log2(BLOCK_SIZE_SB64X64) - bsl - CONFIG_SB8X8;
int boffset = mi_width_log2(BLOCK_SIZE_SB64X64) - bsl;
assert(mi_width_log2(sb_type) == mi_height_log2(sb_type));
assert(bsl >= 0);
......@@ -581,6 +592,7 @@ static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, int ib) {
xd->mode_info_context->bmi[ib].as_mode.context :
#endif
xd->mode_info_context->bmi[ib].as_mode.first);
#if !CONFIG_SB8X8
} else if (xd->mode_info_context->mbmi.mode == I8X8_PRED &&
xd->q_index < ACTIVE_HT) {
const int ic = (ib & 10);
......@@ -615,7 +627,8 @@ static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, int ib) {
// Use 2D DCT
tx_type = DCT_DCT;
#endif
} else if (xd->mode_info_context->mbmi.mode < I8X8_PRED &&
#endif // !CONFIG_SB8X8
} else if (xd->mode_info_context->mbmi.mode <= TM_PRED &&
xd->q_index < ACTIVE_HT) {
#if USE_ADST_FOR_I16X16_4X4
#if USE_ADST_PERIPHERY_ONLY
......@@ -659,14 +672,17 @@ static TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd, int ib) {
#endif
if (ib >= (1 << (wb + hb))) // no chroma adst
return tx_type;
#if !CONFIG_SB8X8
if (xd->mode_info_context->mbmi.mode == I8X8_PRED &&
xd->q_index < ACTIVE_HT8) {
// TODO(rbultje): MB_PREDICTION_MODE / B_PREDICTION_MODE should be merged
// or the relationship otherwise modified to address this type conversion.
tx_type = txfm_map(pred_mode_conv(
(MB_PREDICTION_MODE)xd->mode_info_context->bmi[ib].as_mode.first));
} else if (xd->mode_info_context->mbmi.mode < I8X8_PRED &&
xd->q_index < ACTIVE_HT8) {
} else
#endif // CONFIG_SB8X8
if (xd->mode_info_context->mbmi.mode <= TM_PRED &&
xd->q_index < ACTIVE_HT8) {
#if USE_ADST_FOR_I16X16_8X8
#if USE_ADST_PERIPHERY_ONLY
const int hmax = 1 << wb;
......@@ -707,7 +723,7 @@ static TX_TYPE get_tx_type_16x16(const MACROBLOCKD *xd, int ib) {
#endif
if (ib >= (1 << (wb + hb)))
return tx_type;
if (xd->mode_info_context->mbmi.mode < I8X8_PRED &&
if (xd->mode_info_context->mbmi.mode <= TM_PRED &&
xd->q_index < ACTIVE_HT16) {
tx_type = txfm_map(pred_mode_conv(xd->mode_info_context->mbmi.mode));
#if USE_ADST_PERIPHERY_ONLY
......@@ -738,7 +754,9 @@ void vp9_setup_block_dptrs(MACROBLOCKD *xd);
static TX_SIZE get_uv_tx_size(const MACROBLOCKD *xd) {
MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi;
const TX_SIZE size = mbmi->txfm_size;
#if !CONFIG_SB8X8
const MB_PREDICTION_MODE mode = mbmi->mode;
#endif // !CONFIG_SB8X8
switch (mbmi->sb_type) {
case BLOCK_SIZE_SB64X64:
......@@ -750,6 +768,17 @@ static TX_SIZE get_uv_tx_size(const MACROBLOCKD *xd) {
return TX_16X16;
else
return size;
#if CONFIG_SB8X8
case BLOCK_SIZE_SB32X16:
case BLOCK_SIZE_SB16X32:
case BLOCK_SIZE_MB16X16:
if (size == TX_16X16)
return TX_8X8;
else
return size;
default:
return TX_4X4;
#else // CONFIG_SB8X8
default:
if (size == TX_16X16)
return TX_8X8;
......@@ -757,6 +786,7 @@ static TX_SIZE get_uv_tx_size(const MACROBLOCKD *xd) {
return TX_4X4;
else
return size;
#endif // CONFIG_SB8X8
}
return size;
......@@ -812,7 +842,10 @@ typedef void (*foreach_transformed_block_visitor)(int plane, int block,
void *arg);
static INLINE void foreach_transformed_block_in_plane(
const MACROBLOCKD* const xd, BLOCK_SIZE_TYPE bsize, int plane,
int is_split, foreach_transformed_block_visitor visit, void *arg) {
#if !CONFIG_SB8X8
int is_split,
#endif // !CONFIG_SB8X8
foreach_transformed_block_visitor visit, void *arg) {
const int bw = b_width_log2(bsize), bh = b_height_log2(bsize);
// block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
......@@ -830,7 +863,10 @@ static INLINE void foreach_transformed_block_in_plane(
// than the size of the subsampled data, or forced externally by the mb mode.
const int ss_max = MAX(xd->plane[plane].subsampling_x,
xd->plane[plane].subsampling_y);
const int ss_txfrm_size = txfrm_size_b > ss_block_size || is_split
const int ss_txfrm_size = txfrm_size_b > ss_block_size
#if !CONFIG_SB8X8
|| is_split
#endif // !CONFIG_SB8X8
? txfrm_size_b - ss_max * 2
: txfrm_size_b;
const int step = 1 << ss_txfrm_size;
......@@ -847,17 +883,24 @@ static INLINE void foreach_transformed_block_in_plane(
static INLINE void foreach_transformed_block(
const MACROBLOCKD* const xd, BLOCK_SIZE_TYPE bsize,
foreach_transformed_block_visitor visit, void *arg) {
#if !CONFIG_SB8X8
const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
const int is_split =
xd->mode_info_context->mbmi.txfm_size == TX_8X8 &&
(mode == I8X8_PRED || mode == SPLITMV);
#endif // !CONFIG_SB8X8
int plane;
for (plane = 0; plane < MAX_MB_PLANE; plane++) {
#if !CONFIG_SB8X8
const int is_split_chroma = is_split &&
xd->plane[plane].plane_type == PLANE_TYPE_UV;
#endif // !CONFIG_SB8X8
foreach_transformed_block_in_plane(xd, bsize, plane, is_split_chroma,
foreach_transformed_block_in_plane(xd, bsize, plane,
#if !CONFIG_SB8X8
is_split_chroma,
#endif // !CONFIG_SB8X8
visit, arg);
}
}
......@@ -865,14 +908,19 @@ static INLINE void foreach_transformed_block(
static INLINE void foreach_transformed_block_uv(
const MACROBLOCKD* const xd, BLOCK_SIZE_TYPE bsize,
foreach_transformed_block_visitor visit, void *arg) {
#if !CONFIG_SB8X8
const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
const int is_split =
xd->mode_info_context->mbmi.txfm_size == TX_8X8 &&
(mode == I8X8_PRED || mode == SPLITMV);
#endif // !CONFIG_SB8X8
int plane;
for (plane = 1; plane < MAX_MB_PLANE; plane++) {
foreach_transformed_block_in_plane(xd, bsize, plane, is_split,
foreach_transformed_block_in_plane(xd, bsize, plane,
#if !CONFIG_SB8X8
is_split,
#endif // !CONFIG_SB8X8
visit, arg);
}
}
......@@ -900,11 +948,16 @@ static INLINE void foreach_predicted_block_in_plane(
int pred_w, pred_h;
if (mode == SPLITMV) {
#if CONFIG_SB8X8
pred_w = 0;
pred_h = 0;
#else
// 4x4 or 8x8
const int is_4x4 =
(xd->mode_info_context->mbmi.partitioning == PARTITIONING_4X4);
pred_w = is_4x4 ? 0 : 1 >> xd->plane[plane].subsampling_x;
pred_h = is_4x4 ? 0 : 1 >> xd->plane[plane].subsampling_y;
#endif
} else {
pred_w = bw;
pred_h = bh;
......
......@@ -16,6 +16,17 @@
#include "vpx_mem/vpx_mem.h"
static const unsigned int kf_y_mode_cts[8][VP9_YMODES] = {
#if CONFIG_SB8X8
/* DC V H D45 135 117 153 D27 D63 TM i4X4 */
{12, 6, 5, 5, 5, 5, 5, 5, 5, 2, 200},
{25, 13, 13, 7, 7, 7, 7, 7, 7, 6, 160},
{31, 17, 18, 8, 8, 8, 8, 8, 8, 9, 139},
{40, 22, 23, 8, 8, 8, 8, 8, 8, 12, 116},
{53, 26, 28, 8, 8, 8, 8, 8, 8, 13, 94},
{68, 33, 35, 8, 8, 8, 8, 8, 8, 17, 68},
{78, 38, 38, 8, 8, 8, 8, 8, 8, 19, 52},
{89, 42, 42, 8, 8, 8, 8, 8, 8, 21, 34},
#else
/* DC V H D45 135 117 153 D27 D63 TM i8x8 i4X4 */
{12, 6, 5, 5, 5, 5, 5, 5, 5, 2, 22, 200},
{25, 13, 13, 7, 7, 7, 7, 7, 7, 6, 27, 160},
......@@ -25,11 +36,17 @@ static const unsigned int kf_y_mode_cts[8][VP9_YMODES] = {
{68, 33, 35, 8, 8, 8, 8, 8, 8, 17, 20, 68},
{78, 38, 38, 8, 8, 8, 8, 8, 8, 19, 16, 52},
{89, 42, 42, 8, 8, 8, 8, 8, 8, 21, 12, 34},
#endif
};
static const unsigned int y_mode_cts [VP9_YMODES] = {
#if CONFIG_SB8X8
/* DC V H D45 135 117 153 D27 D63 TM i4X4 */
98, 19, 15, 14, 14, 14, 14, 12, 12, 13, 70
#else
/* DC V H D45 135 117 153 D27 D63 TM i8x8 i4X4 */
98, 19, 15, 14, 14, 14, 14, 12, 12, 13, 16, 70
#endif
};
static const unsigned int uv_mode_cts [VP9_YMODES] [VP9_UV_MODES] = {
......@@ -44,14 +61,18 @@ static const unsigned int uv_mode_cts [VP9_YMODES] [VP9_UV_MODES] = {
{ 150, 15, 10, 10, 10, 10, 10, 75, 10, 6}, /* D27 */
{ 150, 15, 10, 10, 10, 10, 10, 10, 75, 6}, /* D63 */
{ 160, 30, 30, 10, 10, 10, 10, 10, 10, 16}, /* TM */
#if !CONFIG_SB8X8
{ 132, 46, 40, 10, 10, 10, 10, 10, 10, 18}, /* i8x8 - never used */
#endif
{ 150, 35, 41, 10, 10, 10, 10, 10, 10, 10}, /* i4X4 */
};
#if !CONFIG_SB8X8
static const unsigned int i8x8_mode_cts [VP9_I8X8_MODES] = {
/* DC V H D45 135 117 153 D27 D63 TM */
73, 49, 61, 30, 30, 30, 30, 30, 30, 13
};
#endif
static const unsigned int kf_uv_mode_cts [VP9_YMODES] [VP9_UV_MODES] = {
// DC V H D45 135 117 153 D27 D63 TM
......@@ -65,7 +86,9 @@ static const unsigned int kf_uv_mode_cts [VP9_YMODES] [VP9_UV_MODES] = {
{ 102, 33, 20, 20, 20, 20, 20, 64, 20, 14}, /* D27 */
{ 102, 33, 20, 20, 20, 20, 20, 20, 64, 14}, /* D63 */
{ 132, 36, 30, 20, 20, 20, 20, 20, 20, 18}, /* TM */
#if !CONFIG_SB8X8
{ 122, 41, 35, 20, 20, 20, 20, 20, 20, 18}, /* i8x8 - never used */
#endif
{ 122, 41, 35, 20, 20, 20, 20, 20, 20, 18}, /* I4X4 */
};
......@@ -123,6 +146,7 @@ const vp9_prob vp9_sub_mv_ref_prob2 [SUBMVREF_COUNT][VP9_SUBMVREFS - 1] = {
{ 208, 1, 1 }
};
#if !CONFIG_SB8X8
vp9_mbsplit vp9_mbsplits [VP9_NUMMBSPLITS] = {
{
0, 0, 0, 0,
......@@ -150,9 +174,17 @@ vp9_mbsplit vp9_mbsplits [VP9_NUMMBSPLITS] = {
const int vp9_mbsplit_count [VP9_NUMMBSPLITS] = { 2, 2, 4, 16};
const vp9_prob vp9_mbsplit_probs [VP9_NUMMBSPLITS - 1] = { 110, 111, 150};
#endif
const vp9_prob vp9_partition_probs[NUM_PARTITION_CONTEXTS]
[PARTITION_TYPES - 1] = {
#if CONFIG_SB8X8
// FIXME(jingning,rbultje) put real probabilities here
{202, 162, 107},
{16, 2, 169},
{3, 246, 19},
{104, 90, 134},
#endif
{202, 162, 107},
{16, 2, 169},
{3, 246, 19},
......@@ -228,8 +260,12 @@ const vp9_tree_index vp9_ymode_tree[VP9_YMODES * 2 - 2] = {
-D27_PRED, -D63_PRED,
16, 18,
-V_PRED, -H_PRED,
#if CONFIG_SB8X8
-TM_PRED, -I4X4_PRED
#else
-TM_PRED, 20,
-I4X4_PRED, -I8X8_PRED
#endif
};
const vp9_tree_index vp9_kf_ymode_tree[VP9_YMODES * 2 - 2] = {
......@@ -242,10 +278,15 @@ const vp9_tree_index vp9_kf_ymode_tree[VP9_YMODES * 2 - 2] = {
-D27_PRED, -D63_PRED,
16, 18,
-V_PRED, -H_PRED,
#if CONFIG_SB8X8
-TM_PRED, -I4X4_PRED
#else
-TM_PRED, 20,
-I4X4_PRED, -I8X8_PRED
#endif
};
#if !CONFIG_SB8X8
const vp9_tree_index vp9_i8x8_mode_tree[VP9_I8X8_MODES * 2 - 2] = {
2, 14,
-DC_PRED, 4,
......@@ -257,6 +298,7 @@ const vp9_tree_index vp9_i8x8_mode_tree[VP9_I8X8_MODES * 2 - 2] = {
-V_PRED, 16,
-H_PRED, -TM_PRED
};
#endif
const vp9_tree_index vp9_uv_mode_tree[VP9_UV_MODES * 2 - 2] = {
2, 14,
......@@ -270,11 +312,13 @@ const vp9_tree_index vp9_uv_mode_tree[VP9_UV_MODES * 2 - 2] = {
-H_PRED, -TM_PRED
};
#if !CONFIG_SB8X8
const vp9_tree_index vp9_mbsplit_tree[6] = {
-PARTITIONING_4X4, 2,
-PARTITIONING_8X8, 4,
-PARTITIONING_16X8, -PARTITIONING_8X16,
};
#endif
const vp9_tree_index vp9_mv_ref_tree[8] = {
-ZEROMV, 2,
......@@ -308,8 +352,10 @@ struct vp9_token vp9_sb_ymode_encodings[VP9_I32X32_MODES];
struct vp9_token vp9_sb_kf_ymode_encodings[VP9_I32X32_MODES];
struct vp9_token vp9_kf_ymode_encodings[VP9_YMODES];
struct vp9_token vp9_uv_mode_encodings[VP9_UV_MODES];
#if !CONFIG_SB8X8
struct vp9_token vp9_i8x8_mode_encodings[VP9_I8X8_MODES];
struct vp9_token vp9_mbsplit_encodings[VP9_NUMMBSPLITS];
#endif
struct vp9_token vp9_mv_ref_encoding_array[VP9_MVREFS];
struct vp9_token vp9_sb_mv_ref_encoding_array[VP9_MVREFS];
......@@ -340,12 +386,16 @@ void vp9_init_mbmode_probs(VP9_COMMON *x) {
bct, uv_mode_cts[i], 0);
}
#if !CONFIG_SB8X8
vp9_tree_probs_from_distribution(vp9_i8x8_mode_tree, x->fc.i8x8_mode_prob,
bct, i8x8_mode_cts, 0);
#endif
vpx_memcpy(x->fc.sub_mv_ref_prob, vp9_sub_mv_ref_prob2,
sizeof(vp9_sub_mv_ref_prob2));
#if !CONFIG_SB8X8
vpx_memcpy(x->fc.mbsplit_prob, vp9_mbsplit_probs, sizeof(vp9_mbsplit_probs));
#endif
vpx_memcpy(x->fc.switchable_interp_prob, vp9_switchable_interp_prob,
sizeof(vp9_switchable_interp_prob));
......@@ -449,8 +499,10 @@ void vp9_entropy_mode_init() {
vp9_tokens_from_tree(vp9_sb_ymode_encodings, vp9_sb_ymode_tree);
vp9_tokens_from_tree(vp9_sb_kf_ymode_encodings, vp9_sb_kf_ymode_tree);
vp9_tokens_from_tree(vp9_uv_mode_encodings, vp9_uv_mode_tree);
#if !CONFIG_SB8X8
vp9_tokens_from_tree(vp9_i8x8_mode_encodings, vp9_i8x8_mode_tree);
vp9_tokens_from_tree(vp9_mbsplit_encodings, vp9_mbsplit_tree);
#endif
vp9_tokens_from_tree(vp9_switchable_interp_encodings,
vp9_switchable_interp_tree);
vp9_tokens_from_tree(vp9_partition_encodings, vp9_partition_tree);
......@@ -629,9 +681,11 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
update_mode_probs(VP9_NKF_BINTRAMODES, vp9_bmode_tree,
fc->bmode_counts, fc->pre_bmode_prob,
fc->bmode_prob, 0);
#if !CONFIG_SB8X8
update_mode_probs(VP9_I8X8_MODES,
vp9_i8x8_mode_tree, fc->i8x8_mode_counts,
fc->pre_i8x8_mode_prob, fc->i8x8_mode_prob, 0);
#endif
for (i = 0; i < SUBMVREF_COUNT; ++i)
update_mode_probs(VP9_SUBMVREFS,
......@@ -639,9 +693,11 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
fc->pre_sub_mv_ref_prob[i], fc->sub_mv_ref_prob[i],
LEFT4X4);
#if !CONFIG_SB8X8
update_mode_probs(VP9_NUMMBSPLITS, vp9_mbsplit_tree,
fc->mbsplit_counts, fc->pre_mbsplit_prob,
fc->mbsplit_prob, 0);
#endif
#if CONFIG_COMP_INTERINTRA_PRED
if (cm->use_interintra) {
int factor, interintra_prob, count;
......
......@@ -15,7 +15,9 @@
#include "vp9/common/vp9_treecoder.h"
#define SUBMVREF_COUNT 5
#if !CONFIG_SB8X8
#define VP9_NUMMBSPLITS 4
#endif
#if CONFIG_COMP_INTERINTRA_PRED
#define VP9_DEF_INTERINTRA_PROB 248
......@@ -24,6 +26,7 @@
#define SEPARATE_INTERINTRA_UV 0
#endif
#if !CONFIG_SB8X8
typedef const int vp9_mbsplit[16];
extern vp9_mbsplit vp9_mbsplits[VP9_NUMMBSPLITS];
......@@ -31,6 +34,7 @@ extern vp9_mbsplit vp9_mbsplits[VP9_NUMMBSPLITS];
extern const int vp9_mbsplit_count[VP9_NUMMBSPLITS]; /* # of subsets */
extern const vp9_prob vp9_mbsplit_probs[VP9_NUMMBSPLITS - 1];
#endif
extern int vp9_mv_cont(const int_mv *l, const int_mv *a);
......@@ -48,8 +52,10 @@ extern const vp9_tree_index vp9_kf_ymode_tree[];
extern const vp9_tree_index vp9_uv_mode_tree[];
#define vp9_sb_ymode_tree vp9_uv_mode_tree
#define vp9_sb_kf_ymode_tree vp9_uv_mode_tree
#if !CONFIG_SB8X8
extern const vp9_tree_index vp9_i8x8_mode_tree[];
extern const vp9_tree_index vp9_mbsplit_tree[];
#endif
extern const vp9_tree_index vp9_mv_ref_tree[];
extern const vp9_tree_index vp9_sb_mv_ref_tree[];
extern const vp9_tree_index vp9_sub_mv_ref_tree[];
......@@ -60,9 +66,11 @@ extern struct vp9_token vp9_ymode_encodings[VP9_YMODES];
extern struct vp9_token vp9_sb_ymode_encodings[VP9_I32X32_MODES];
extern struct vp9_token vp9_sb_kf_ymode_encodings[VP9_I32X32_MODES];
extern struct vp9_token vp9_kf_ymode_encodings[VP9_YMODES];
extern struct vp9_token vp9_i8x8_mode_encodings[VP9_I8X8_MODES];
extern struct vp9_token vp9_uv_mode_encodings[VP9_UV_MODES];
#if !CONFIG_SB8X8
extern struct vp9_token vp9_i8x8_mode_encodings[VP9_I8X8_MODES];
extern struct vp9_token vp9_mbsplit_encodings[VP9_NUMMBSPLITS];
#endif
/* Inter mode values do not start at zero */
......
......@@ -47,6 +47,6 @@ typedef enum PARTITION_TYPE {
} PARTITION_TYPE;
#define PARTITION_PLOFFSET 4 // number of probability models per block size
#define NUM_PARTITION_CONTEXTS (2 * PARTITION_PLOFFSET)
#define NUM_PARTITION_CONTEXTS ((2 + CONFIG_SB8X8) * PARTITION_PLOFFSET)
#endif // VP9_COMMON_VP9_ENUMS_H_
......@@ -74,11 +74,13 @@ vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
vp9_prob p[VP9_MVREFS - 1],
const int context);
#if !CONFIG_SB8X8
extern const uint8_t vp9_mbsplit_offset[4][16];
#endif
static int left_block_mv(const MACROBLOCKD *xd,
const MODE_INFO *cur_mb, int b) {
if (!(b & 3)) {
if (!(b & (3 >> CONFIG_SB8X8))) {
if (!xd->left_available)
return 0;
......@@ -88,7 +90,7 @@ static int left_block_mv(const MACROBLOCKD *xd,
if (cur_mb->mbmi.mode != SPLITMV)
return cur_mb->mbmi.mv[0].as_int;
b += 4;
b += 4 >> CONFIG_SB8X8;
}
return (cur_mb->bmi + b - 1)->as_mv[0].as_int;
......@@ -96,7 +98,7 @@ static int left_block_mv(const MACROBLOCKD *xd,
static int left_block_second_mv(const MACROBLOCKD *xd,
const MODE_INFO *cur_mb, int b) {
if (!(b & 3)) {
if (!(b & (3 >> CONFIG_SB8X8))) {
if (!xd->left_available)
return 0;
......@@ -106,7 +108,7 @@ static int left_block_second_mv(const MACROBLOCKD *xd,
if (cur_mb->mbmi.mode != SPLITMV)
return cur_mb->mbmi.second_ref_frame > 0 ?
cur_mb->mbmi.mv[1].as_int : cur_mb->mbmi.mv[0].as_int;
b += 4;
b += 4 >> CONFIG_SB8X8;
}
return cur_mb->mbmi.second_ref_frame > 0 ?
......@@ -115,72 +117,85 @@ static int left_block_second_mv(const MACROBLOCKD *xd,
}
static int above_block_mv(const MODE_INFO *cur_mb, int b, int mi_stride) {
if (!(b >> 2)) {
if (!(b >> (2 >> CONFIG_SB8X8))) {
/* On top edge, get from MB above us */
cur_mb -= mi_stride;
if (cur_mb->mbmi.mode != SPLITMV)
return cur_mb->mbmi.mv[0].as_int;
b += 16;
b += 16 >> (2 * CONFIG_SB8X8);
}
return (cur_mb->bmi + b - 4)->as_mv[0].as_int;
return (cur_mb->bmi + b - (4 >> CONFIG_SB8X8))->as_mv[0].as_int;
}
static int above_block_second_mv(const MODE_INFO *cur_mb, int b, int mi_stride) {
if (!(b >> 2)) {
if (!(b >> (2 >> CONFIG_SB8X8))) {
/* On top edge, get from MB above us */
cur_mb -= mi_stride;
if (cur_mb->mbmi.mode != SPLITMV)
return cur_mb->mbmi.second_ref_frame > 0 ?
cur_mb->mbmi.mv[1].as_int : cur_mb->mbmi.mv[0].as_int;
b += 16;
b += 16 >> (2 * CONFIG_SB8X8);
}
return cur_mb->mbmi.second_ref_frame > 0 ?
(cur_mb->bmi + b - 4)->as_mv[1].as_int :
(cur_mb->bmi + b - 4)->as_mv[0].as_int;
(cur_mb->bmi + b - (4 >> CONFIG_SB8X8))->as_mv[1].as_int :
(cur_mb->bmi + b - (4 >> CONFIG_SB8X8))->as_mv[0].as_int;
}
static B_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b) {
if (!(b & 3)) {
#if CONFIG_SB8X8
// FIXME(rbultje, jingning): temporary hack because jenkins doesn't
// understand this condition. This will go away soon.
if (b == 0 || b == 2) {
#else
if (!(b & (3 >> CONFIG_SB8X8))) {
#endif
/* On L edge, get from MB to left of us */
--cur_mb;
if (cur_mb->mbmi.mode < I8X8_PRED) {
if (cur_mb->mbmi.mode <= TM_PRED) {
return pred_mode_conv(cur_mb->mbmi.mode);
#if !CONFIG_SB8X8
} else if (cur_mb->mbmi.mode == I8X8_PRED) {
return pred_mode_conv(
(MB_PREDICTION_MODE)(cur_mb->bmi + 3 + b)->as_mode.first);
#endif // !CONFIG_SB8X8
} else if (cur_mb->mbmi.mode == I4X4_PRED) {
return ((cur_mb->bmi + 3 + b)->as_mode.first);
return ((cur_mb->bmi + (3 >> CONFIG_SB8X8) + b)->as_mode.first);
} else {
return B_DC_PRED;
}
}
#if CONFIG_SB8X8
assert(b == 1 || b == 3);
#endif
return (cur_mb->bmi + b - 1)->as_mode.first;
}
static B_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb,
int b, int mi_stride) {
if (!(b >> 2)) {
if (!(b >> (2 >> CONFIG_SB8X8))) {
/* On top edge, get from MB above us */
cur_mb -= mi_stride;
if (cur_mb->mbmi.mode < I8X8_PRED) {
if (cur_mb->mbmi.mode <= TM_PRED) {
return pred_mode_conv(cur_mb->mbmi.mode);
#if !CONFIG_SB8X8