Commit 2be211e9 authored by Debargha Mukherjee's avatar Debargha Mukherjee
Browse files

Fix interpolation values and decouple interintra

Decouples interintra modes and probability models from regular
intra modes, to enable creating/optimizing new interintra modes.
Also, fixes interpolation values for 128x128 interintra and obmc.

Change-Id: I5c2016db49b8f029164e5fe84c6274d4e02ff90e
parent 8d3a4aa8
......@@ -190,8 +190,8 @@ typedef struct {
#endif // CONFIG_EXT_INTRA
#if CONFIG_EXT_INTER
PREDICTION_MODE interintra_mode;
PREDICTION_MODE interintra_uv_mode;
INTERINTRA_MODE interintra_mode;
INTERINTRA_MODE interintra_uv_mode;
// TODO(debargha): Consolidate these flags
int use_wedge_interintra;
int interintra_wedge_index;
......
......@@ -310,7 +310,7 @@ const vpx_tree_index vp10_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = {
-D135_PRED, -D117_PRED, /* 5 = D135_NODE */
-D45_PRED, 14, /* 6 = D45_NODE */
-D63_PRED, 16, /* 7 = D63_NODE */
-D153_PRED, -D207_PRED /* 8 = D153_NODE */
-D153_PRED, -D207_PRED /* 8 = D153_NODE */
};
const vpx_tree_index vp10_inter_mode_tree[TREE_SIZE(INTER_MODES)] = {
......@@ -325,6 +325,26 @@ const vpx_tree_index vp10_inter_mode_tree[TREE_SIZE(INTER_MODES)] = {
};
#if CONFIG_EXT_INTER
const vpx_tree_index vp10_interintra_mode_tree[TREE_SIZE(INTERINTRA_MODES)] = {
-II_DC_PRED, 2, /* 0 = II_DC_NODE */
-II_TM_PRED, 4, /* 1 = II_TM_NODE */
-II_V_PRED, 6, /* 2 = II_V_NODE */
8, 12, /* 3 = II_COM_NODE */
-II_H_PRED, 10, /* 4 = II_H_NODE */
-II_D135_PRED, -II_D117_PRED, /* 5 = II_D135_NODE */
-II_D45_PRED, 14, /* 6 = II_D45_NODE */
-II_D63_PRED, 16, /* 7 = II_D63_NODE */
-II_D153_PRED, -II_D207_PRED /* 8 = II_D153_NODE */
};
static const vpx_prob
default_interintra_mode_prob[BLOCK_SIZE_GROUPS][INTERINTRA_MODES - 1] = {
{ 65, 32, 18, 144, 162, 194, 41, 51, 98 }, // block_size < 8x8
{ 132, 68, 18, 165, 217, 196, 45, 40, 78 }, // block_size < 16x16
{ 173, 80, 19, 176, 240, 193, 64, 35, 46 }, // block_size < 32x32
{ 221, 135, 38, 194, 248, 121, 96, 85, 29 } // block_size >= 32x32
};
const vpx_tree_index vp10_inter_compound_mode_tree
[TREE_SIZE(INTER_COMPOUND_MODES)] = {
-INTER_COMPOUND_OFFSET(ZERO_ZEROMV), 2,
......@@ -1211,6 +1231,7 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
#if CONFIG_EXT_INTER
vp10_copy(fc->inter_compound_mode_probs, default_inter_compound_mode_probs);
vp10_copy(fc->interintra_prob, default_interintra_prob);
vp10_copy(fc->interintra_mode_prob, default_interintra_mode_prob);
vp10_copy(fc->wedge_interintra_prob, default_wedge_interintra_prob);
vp10_copy(fc->wedge_interinter_prob, default_wedge_interinter_prob);
#endif // CONFIG_EXT_INTER
......@@ -1322,6 +1343,11 @@ void vp10_adapt_inter_frame_probs(VP10_COMMON *cm) {
fc->interintra_prob[i] = mode_mv_merge_probs(pre_fc->interintra_prob[i],
counts->interintra[i]);
}
for (i = 0; i < BLOCK_SIZE_GROUPS; i++) {
vpx_tree_merge_probs(
vp10_interintra_mode_tree, pre_fc->interintra_mode_prob[i],
counts->interintra_mode[i], fc->interintra_mode_prob[i]);
}
for (i = 0; i < BLOCK_SIZES; ++i) {
if (is_interintra_allowed_bsize(i) && get_wedge_bits(i))
fc->wedge_interintra_prob[i] = mode_mv_merge_probs(
......
......@@ -71,6 +71,7 @@ typedef struct frame_contexts {
vpx_prob inter_compound_mode_probs[INTER_MODE_CONTEXTS]
[INTER_COMPOUND_MODES - 1];
vpx_prob interintra_prob[BLOCK_SIZES];
vpx_prob interintra_mode_prob[BLOCK_SIZE_GROUPS][INTERINTRA_MODES - 1];
vpx_prob wedge_interintra_prob[BLOCK_SIZES];
vpx_prob wedge_interinter_prob[BLOCK_SIZES];
#endif // CONFIG_EXT_INTER
......@@ -138,6 +139,7 @@ typedef struct FRAME_COUNTS {
#if CONFIG_EXT_INTER
unsigned int inter_compound_mode[INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES];
unsigned int interintra[BLOCK_SIZES][2];
unsigned int interintra_mode[BLOCK_SIZE_GROUPS][INTERINTRA_MODES];
unsigned int wedge_interintra[BLOCK_SIZES][2];
unsigned int wedge_interinter[BLOCK_SIZES][2];
#endif // CONFIG_EXT_INTER
......@@ -195,6 +197,8 @@ extern const vpx_prob vp10_default_palette_uv_color_prob
extern const vpx_tree_index vp10_intra_mode_tree[TREE_SIZE(INTRA_MODES)];
extern const vpx_tree_index vp10_inter_mode_tree[TREE_SIZE(INTER_MODES)];
#if CONFIG_EXT_INTER
extern const vpx_tree_index vp10_interintra_mode_tree
[TREE_SIZE(INTERINTRA_MODES)];
extern const vpx_tree_index vp10_inter_compound_mode_tree
[TREE_SIZE(INTER_COMPOUND_MODES)];
#endif // CONFIG_EXT_INTER
......
......@@ -252,6 +252,23 @@ typedef uint8_t PREDICTION_MODE;
#define INTRA_MODES (TM_PRED + 1)
#if CONFIG_EXT_INTER
typedef enum {
II_DC_PRED = 0,
II_V_PRED,
II_H_PRED,
II_D45_PRED,
II_D135_PRED,
II_D117_PRED,
II_D153_PRED,
II_D207_PRED,
II_D63_PRED,
II_TM_PRED,
INTERINTRA_MODES
} INTERINTRA_MODE;
#endif // CONFIG_EXT_INTER
#if CONFIG_EXT_INTRA
typedef enum {
FILTER_DC_PRED,
......
......@@ -1176,24 +1176,18 @@ static const uint8_t obmc_mask_32[2][32] = {
};
#if CONFIG_EXT_PARTITION
// TODO(debargha): What are the correct values here?
static const uint8_t obmc_mask_64[2][64] = {
{ 33, 33, 35, 35, 36, 36, 38, 38,
40, 40, 41, 41, 43, 43, 44, 44,
45, 45, 47, 47, 48, 48, 50, 50,
51, 51, 52, 52, 53, 53, 55, 55,
56, 56, 57, 57, 58, 58, 59, 59,
60, 60, 60, 60, 61, 61, 62, 62,
62, 62, 63, 63, 63, 63, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64 },
{ 31, 31, 29, 29, 28, 28, 26, 26,
24, 24, 23, 23, 21, 21, 20, 20,
19, 19, 17, 17, 16, 16, 14, 14,
13, 13, 12, 12, 11, 11, 9, 9,
8, 8, 7, 7, 6, 6, 5, 5,
4, 4, 4, 4, 3, 3, 2, 2,
2, 2, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 }
{
33, 34, 35, 35, 36, 37, 38, 39, 40, 40, 41, 42, 43, 44, 44, 44,
45, 46, 47, 47, 48, 49, 50, 51, 51, 51, 52, 52, 53, 54, 55, 56,
56, 56, 57, 57, 58, 58, 59, 60, 60, 60, 60, 60, 61, 62, 62, 62,
62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
}, {
31, 30, 29, 29, 28, 27, 26, 25, 24, 24, 23, 22, 21, 20, 20, 20,
19, 18, 17, 17, 16, 15, 14, 13, 13, 13, 12, 12, 11, 10, 9, 8,
8, 8, 7, 7, 6, 6, 5, 4, 4, 4, 4, 4, 3, 2, 2, 2,
2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}
};
#endif // CONFIG_EXT_PARTITION
......@@ -1599,7 +1593,45 @@ void vp10_build_prediction_by_left_preds(VP10_COMMON *cm,
#endif // CONFIG_OBMC
#if CONFIG_EXT_INTER
static void combine_interintra(PREDICTION_MODE mode,
#if CONFIG_EXT_PARTITION
static const int weights1d[MAX_SB_SIZE] = {
128, 127, 125, 124, 123, 122, 120, 119,
118, 117, 116, 115, 113, 112, 111, 110,
109, 108, 107, 106, 105, 104, 103, 103,
102, 101, 100, 99, 98, 97, 97, 96,
95, 94, 94, 93, 92, 91, 91, 90,
89, 89, 88, 87, 87, 86, 86, 85,
84, 84, 83, 83, 82, 82, 81, 81,
80, 80, 79, 79, 78, 78, 77, 77,
76, 76, 75, 75, 75, 74, 74, 73,
73, 73, 72, 72, 72, 71, 71, 70,
70, 70, 69, 69, 69, 69, 68, 68,
68, 67, 67, 67, 67, 66, 66, 66,
66, 65, 65, 65, 65, 64, 64, 64,
64, 63, 63, 63, 63, 63, 62, 62,
62, 62, 62, 61, 61, 61, 61, 61,
61, 60, 60, 60, 60, 60, 60, 60,
};
static int size_scales[BLOCK_SIZES] = {
32, 16, 16, 16, 8, 8, 8, 4, 4, 4, 2, 2, 2, 1, 1, 1
};
#else
static const int weights1d[MAX_SB_SIZE] = {
128, 125, 123, 120, 118, 116, 113, 111,
109, 107, 105, 103, 102, 100, 98, 97,
95, 94, 92, 91, 89, 88, 87, 86,
84, 83, 82, 81, 80, 79, 78, 77,
76, 75, 75, 74, 73, 72, 72, 71,
70, 69, 69, 68, 68, 67, 67, 66,
66, 65, 65, 64, 64, 63, 63, 62,
62, 62, 61, 61, 61, 60, 60, 60,
};
static int size_scales[BLOCK_SIZES] = {
16, 8, 8, 8, 4, 4, 4, 2, 2, 2, 1, 1, 1
};
#endif // CONFIG_EXT_PARTITION
static void combine_interintra(INTERINTRA_MODE mode,
int use_wedge_interintra,
int wedge_index,
BLOCK_SIZE bsize,
......@@ -1613,45 +1645,6 @@ static void combine_interintra(PREDICTION_MODE mode,
static const int scale_bits = 8;
static const int scale_max = 256;
static const int scale_round = 127;
#if CONFIG_EXT_PARTITION
// TODO(debargha): Fill in the correct weights for 128 wide blocks.
static const int weights1d[MAX_SB_SIZE] = {
128, 128, 125, 125, 122, 122, 119, 119,
116, 116, 114, 114, 111, 111, 109, 109,
107, 107, 105, 105, 103, 103, 101, 101,
99, 99, 97, 97, 96, 96, 94, 94,
93, 93, 91, 91, 90, 90, 89, 89,
88, 88, 86, 86, 85, 85, 84, 84,
83, 83, 82, 82, 81, 81, 81, 81,
80, 80, 79, 79, 78, 78, 78, 78,
77, 77, 76, 76, 76, 76, 75, 75,
75, 75, 74, 74, 74, 74, 73, 73,
73, 73, 72, 72, 72, 72, 71, 71,
71, 71, 71, 71, 70, 70, 70, 70,
70, 70, 70, 70, 69, 69, 69, 69,
69, 69, 69, 69, 68, 68, 68, 68,
68, 68, 68, 68, 68, 68, 67, 67,
67, 67, 67, 67, 67, 67, 67, 67,
};
static int size_scales[BLOCK_SIZES] = {
32, 16, 16, 16, 8, 8, 8, 4, 4, 4, 2, 2, 2, 1, 1, 1
};
#else
static const int weights1d[MAX_SB_SIZE] = {
128, 125, 122, 119, 116, 114, 111, 109,
107, 105, 103, 101, 99, 97, 96, 94,
93, 91, 90, 89, 88, 86, 85, 84,
83, 82, 81, 81, 80, 79, 78, 78,
77, 76, 76, 75, 75, 74, 74, 73,
73, 72, 72, 71, 71, 71, 70, 70,
70, 70, 69, 69, 69, 69, 68, 68,
68, 68, 68, 67, 67, 67, 67, 67,
};
static int size_scales[BLOCK_SIZES] = {
16, 8, 8, 8, 4, 4, 4, 2, 2, 2, 1, 1, 1
};
#endif // CONFIG_EXT_PARTITION
const int bw = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
const int bh = 4 * num_4x4_blocks_high_lookup[plane_bsize];
const int size_scale = size_scales[plane_bsize];
......@@ -1674,7 +1667,7 @@ static void combine_interintra(PREDICTION_MODE mode,
}
switch (mode) {
case V_PRED:
case II_V_PRED:
for (i = 0; i < bh; ++i) {
for (j = 0; j < bw; ++j) {
int scale = weights1d[i * size_scale];
......@@ -1686,7 +1679,7 @@ static void combine_interintra(PREDICTION_MODE mode,
}
break;
case H_PRED:
case II_H_PRED:
for (i = 0; i < bh; ++i) {
for (j = 0; j < bw; ++j) {
int scale = weights1d[j * size_scale];
......@@ -1698,8 +1691,8 @@ static void combine_interintra(PREDICTION_MODE mode,
}
break;
case D63_PRED:
case D117_PRED:
case II_D63_PRED:
case II_D117_PRED:
for (i = 0; i < bh; ++i) {
for (j = 0; j < bw; ++j) {
int scale = (weights1d[i * size_scale] * 3 +
......@@ -1712,8 +1705,8 @@ static void combine_interintra(PREDICTION_MODE mode,
}
break;
case D207_PRED:
case D153_PRED:
case II_D207_PRED:
case II_D153_PRED:
for (i = 0; i < bh; ++i) {
for (j = 0; j < bw; ++j) {
int scale = (weights1d[j * size_scale] * 3 +
......@@ -1726,7 +1719,7 @@ static void combine_interintra(PREDICTION_MODE mode,
}
break;
case D135_PRED:
case II_D135_PRED:
for (i = 0; i < bh; ++i) {
for (j = 0; j < bw; ++j) {
int scale = weights1d[(i < j ? i : j) * size_scale];
......@@ -1738,7 +1731,7 @@ static void combine_interintra(PREDICTION_MODE mode,
}
break;
case D45_PRED:
case II_D45_PRED:
for (i = 0; i < bh; ++i) {
for (j = 0; j < bw; ++j) {
int scale = (weights1d[i * size_scale] +
......@@ -1751,8 +1744,8 @@ static void combine_interintra(PREDICTION_MODE mode,
}
break;
case TM_PRED:
case DC_PRED:
case II_TM_PRED:
case II_DC_PRED:
default:
for (i = 0; i < bh; ++i) {
for (j = 0; j < bw; ++j) {
......@@ -1765,7 +1758,7 @@ static void combine_interintra(PREDICTION_MODE mode,
}
#if CONFIG_VP9_HIGHBITDEPTH
static void combine_interintra_highbd(PREDICTION_MODE mode,
static void combine_interintra_highbd(INTERINTRA_MODE mode,
int use_wedge_interintra,
int wedge_index,
BLOCK_SIZE bsize,
......@@ -1779,45 +1772,6 @@ static void combine_interintra_highbd(PREDICTION_MODE mode,
static const int scale_bits = 8;
static const int scale_max = 256;
static const int scale_round = 127;
#if CONFIG_EXT_PARTITION
// TODO(debargha): Fill in the correct weights for 128 wide blocks.
static const int weights1d[MAX_SB_SIZE] = {
128, 128, 125, 125, 122, 122, 119, 119,
116, 116, 114, 114, 111, 111, 109, 109,
107, 107, 105, 105, 103, 103, 101, 101,
99, 99, 97, 97, 96, 96, 94, 94,
93, 93, 91, 91, 90, 90, 89, 89,
88, 88, 86, 86, 85, 85, 84, 84,
83, 83, 82, 82, 81, 81, 81, 81,
80, 80, 79, 79, 78, 78, 78, 78,
77, 77, 76, 76, 76, 76, 75, 75,
75, 75, 74, 74, 74, 74, 73, 73,
73, 73, 72, 72, 72, 72, 71, 71,
71, 71, 71, 71, 70, 70, 70, 70,
70, 70, 70, 70, 69, 69, 69, 69,
69, 69, 69, 69, 68, 68, 68, 68,
68, 68, 68, 68, 68, 68, 67, 67,
67, 67, 67, 67, 67, 67, 67, 67,
};
static int size_scales[BLOCK_SIZES] = {
32, 16, 16, 16, 8, 8, 8, 4, 4, 4, 2, 2, 2, 1, 1, 1
};
#else
static const int weights1d[MAX_SB_SIZE] = {
128, 125, 122, 119, 116, 114, 111, 109,
107, 105, 103, 101, 99, 97, 96, 94,
93, 91, 90, 89, 88, 86, 85, 84,
83, 82, 81, 81, 80, 79, 78, 78,
77, 76, 76, 75, 75, 74, 74, 73,
73, 72, 72, 71, 71, 71, 70, 70,
70, 70, 69, 69, 69, 69, 68, 68,
68, 68, 68, 67, 67, 67, 67, 67,
};
static int size_scales[BLOCK_SIZES] = {
16, 8, 8, 8, 4, 4, 4, 2, 2, 2, 1, 1, 1
};
#endif // CONFIG_EXT_PARTITION
const int bw = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
const int bh = 4 * num_4x4_blocks_high_lookup[plane_bsize];
const int size_scale = size_scales[plane_bsize];
......@@ -1843,7 +1797,7 @@ static void combine_interintra_highbd(PREDICTION_MODE mode,
}
switch (mode) {
case V_PRED:
case II_V_PRED:
for (i = 0; i < bh; ++i) {
for (j = 0; j < bw; ++j) {
int scale = weights1d[i * size_scale];
......@@ -1855,7 +1809,7 @@ static void combine_interintra_highbd(PREDICTION_MODE mode,
}
break;
case H_PRED:
case II_H_PRED:
for (i = 0; i < bh; ++i) {
for (j = 0; j < bw; ++j) {
int scale = weights1d[j * size_scale];
......@@ -1867,8 +1821,8 @@ static void combine_interintra_highbd(PREDICTION_MODE mode,
}
break;
case D63_PRED:
case D117_PRED:
case II_D63_PRED:
case II_D117_PRED:
for (i = 0; i < bh; ++i) {
for (j = 0; j < bw; ++j) {
int scale = (weights1d[i * size_scale] * 3 +
......@@ -1881,8 +1835,8 @@ static void combine_interintra_highbd(PREDICTION_MODE mode,
}
break;
case D207_PRED:
case D153_PRED:
case II_D207_PRED:
case II_D153_PRED:
for (i = 0; i < bh; ++i) {
for (j = 0; j < bw; ++j) {
int scale = (weights1d[j * size_scale] * 3 +
......@@ -1895,7 +1849,7 @@ static void combine_interintra_highbd(PREDICTION_MODE mode,
}
break;
case D135_PRED:
case II_D135_PRED:
for (i = 0; i < bh; ++i) {
for (j = 0; j < bw; ++j) {
int scale = weights1d[(i < j ? i : j) * size_scale];
......@@ -1907,7 +1861,7 @@ static void combine_interintra_highbd(PREDICTION_MODE mode,
}
break;
case D45_PRED:
case II_D45_PRED:
for (i = 0; i < bh; ++i) {
for (j = 0; j < bw; ++j) {
int scale = (weights1d[i * size_scale] +
......@@ -1920,8 +1874,8 @@ static void combine_interintra_highbd(PREDICTION_MODE mode,
}
break;
case TM_PRED:
case DC_PRED:
case II_TM_PRED:
case II_DC_PRED:
default:
for (i = 0; i < bh; ++i) {
for (j = 0; j < bw; ++j) {
......@@ -1999,13 +1953,29 @@ static void build_intra_predictors_for_interintra(
}
}
// Mapping of interintra to intra mode for use in the intra component
static const int interintra_to_intra_mode[INTERINTRA_MODES] = {
DC_PRED,
V_PRED,
H_PRED,
D45_PRED,
D135_PRED,
D117_PRED,
D153_PRED,
D207_PRED,
D63_PRED,
TM_PRED
};
void vp10_build_intra_predictors_for_interintra(
MACROBLOCKD *xd,
BLOCK_SIZE bsize, int plane,
uint8_t *dst, int dst_stride) {
build_intra_predictors_for_interintra(
xd, xd->plane[plane].dst.buf, xd->plane[plane].dst.stride,
dst, dst_stride, xd->mi[0]->mbmi.interintra_mode, bsize, plane);
dst, dst_stride,
interintra_to_intra_mode[xd->mi[0]->mbmi.interintra_mode],
bsize, plane);
}
void vp10_combine_interintra(MACROBLOCKD *xd,
......
......@@ -432,6 +432,10 @@ void vp10_accumulate_frame_counts(VP10_COMMON *cm, FRAME_COUNTS *counts,
for (j = 0; j < 2; j++)
cm->counts.interintra[i][j] += counts->interintra[i][j];
for (i = 0; i < BLOCK_SIZE_GROUPS; i++)
for (j = 0; j < INTERINTRA_MODES; j++)
cm->counts.interintra_mode[i][j] += counts->interintra_mode[i][j];
for (i = 0; i < BLOCK_SIZES; i++)
for (j = 0; j < 2; j++)
cm->counts.wedge_interintra[i][j] += counts->wedge_interintra[i][j];
......
......@@ -4039,6 +4039,10 @@ static int read_compressed_header(VP10Decoder *pbi, const uint8_t *data,
vp10_diff_update_prob(&r, &fc->interintra_prob[i]);
}
}
for (i = 0; i < BLOCK_SIZE_GROUPS; i++) {
for (j = 0; j < INTERINTRA_MODES - 1; j++)
vp10_diff_update_prob(&r, &fc->interintra_mode_prob[i][j]);
}
for (i = 0; i < BLOCK_SIZES; i++) {
if (is_interintra_allowed_bsize(i) && get_wedge_bits(i)) {
vp10_diff_update_prob(&r, &fc->wedge_interintra_prob[i]);
......
......@@ -62,6 +62,19 @@ static PREDICTION_MODE read_intra_mode_uv(VP10_COMMON *cm, MACROBLOCKD *xd,
return uv_mode;
}
#if CONFIG_EXT_INTER
static INTERINTRA_MODE read_interintra_mode(VP10_COMMON *cm, MACROBLOCKD *xd,
vpx_reader *r, int size_group) {
const INTERINTRA_MODE ii_mode =
(INTERINTRA_MODE)vpx_read_tree(r, vp10_interintra_mode_tree,
cm->fc->interintra_mode_prob[size_group]);
FRAME_COUNTS *counts = xd->counts;
if (counts)
++counts->interintra_mode[size_group][ii_mode];
return ii_mode;
}
#endif // CONFIG_EXT_INTER
static PREDICTION_MODE read_inter_mode(VP10_COMMON *cm, MACROBLOCKD *xd,
#if CONFIG_REF_MV && CONFIG_EXT_INTER
MB_MODE_INFO *mbmi,
......@@ -1518,8 +1531,8 @@ static void read_inter_block_mode_info(VP10Decoder *const pbi,
xd->counts->interintra[bsize][interintra]++;
assert(mbmi->ref_frame[1] == NONE);
if (interintra) {
const PREDICTION_MODE interintra_mode =
read_intra_mode_y(cm, xd, r, size_group_lookup[bsize]);
const INTERINTRA_MODE interintra_mode =
read_interintra_mode(cm, xd, r, size_group_lookup[bsize]);
mbmi->ref_frame[1] = INTRA_FRAME;
mbmi->interintra_mode = interintra_mode;
mbmi->interintra_uv_mode = interintra_mode;
......
......@@ -115,6 +115,9 @@ static struct vp10_token ext_tx_encodings[TX_TYPES];
#if CONFIG_EXT_INTRA
static struct vp10_token intra_filter_encodings[INTRA_FILTERS];
#endif // CONFIG_EXT_INTRA
#if CONFIG_EXT_INTER
static struct vp10_token interintra_mode_encodings[INTERINTRA_MODES];
#endif // CONFIG_EXT_INTER
void vp10_encode_token_init() {
#if CONFIG_EXT_TX
......@@ -131,6 +134,9 @@ void vp10_encode_token_init() {
#if CONFIG_EXT_INTRA
vp10_tokens_from_tree(intra_filter_encodings, vp10_intra_filter_tree);
#endif // CONFIG_EXT_INTRA
#if CONFIG_EXT_INTER
vp10_tokens_from_tree(interintra_mode_encodings, vp10_interintra_mode_tree);
#endif // CONFIG_EXT_INTER
}
static void write_intra_mode(vpx_writer *w, PREDICTION_MODE mode,
......@@ -138,6 +144,14 @@ static void write_intra_mode(vpx_writer *w, PREDICTION_MODE mode,
vp10_write_token(w, vp10_intra_mode_tree, probs, &intra_mode_encodings[mode]);
}
#if CONFIG_EXT_INTER
static void write_interintra_mode(vpx_writer *w, INTERINTRA_MODE mode,
const vpx_prob *probs) {
vp10_write_token(w, vp10_interintra_mode_tree, probs,
&interintra_mode_encodings[mode]);
}
#endif // CONFIG_EXT_INTER
static void write_inter_mode(VP10_COMMON *cm,
vpx_writer *w, PREDICTION_MODE mode,
#if CONFIG_REF_MV && CONFIG_EXT_INTER
......@@ -1282,8 +1296,9 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
const int interintra = mbmi->ref_frame[1] == INTRA_FRAME;
vpx_write(w, interintra, cm->fc->interintra_prob[bsize]);
if (interintra) {
write_intra_mode(w, mbmi->interintra_mode,
cm->fc->y_mode_prob[size_group_lookup[bsize]]);
write_interintra_mode(
w, mbmi->interintra_mode,
cm->fc->interintra_mode_prob[size_group_lookup[bsize]]);
assert(mbmi->interintra_mode == mbmi->interintra_uv_mode);
if (get_wedge_bits(bsize)) {
vpx_write(w, mbmi->use_wedge_interintra,
......@@ -3151,6 +3166,12 @@ static uint32_t write_compressed_header(VP10_COMP *cpi, uint8_t *data) {
cm->counts.interintra[i]);
}
}
for (i = 0; i < BLOCK_SIZE_GROUPS; i++) {
prob_diff_update(vp10_interintra_mode_tree,
cm->fc->interintra_mode_prob[i],
counts->interintra_mode[i],
INTERINTRA_MODES, &header_bc);
}
for (i = 0; i < BLOCK_SIZES; i++) {
if (is_interintra_allowed_bsize(i) && get_wedge_bits(i))
vp10_cond_prob_diff_update(&header_bc,
......
......@@ -2023,8 +2023,9 @@ static void update_stats(VP10_COMMON *cm, ThreadData *td
#endif
is_interintra_allowed(mbmi)) {
if (mbmi->ref_frame[1] == INTRA_FRAME) {
counts->y_mode[size_group_lookup[bsize]][mbmi->interintra_mode]++;
counts->interintra[bsize][1]++;
counts->interintra_mode[size_group_lookup[bsize]]
[mbmi->interintra_mode]++;
if (get_wedge_bits(bsize))
counts->wedge_interintra[bsize][mbmi->use_wedge_interintra]++;
} else {
......
......@@ -507,6 +507,7 @@ typedef struct VP10_COMP {
#if CONFIG_EXT_INTER