Commit cb2d06ce authored by Deb Mukherjee's avatar Deb Mukherjee Committed by Gerrit Code Review
Browse files

Merge "Compound inter-intra experiment" into experimental

parents 170305dc 0c917fc9
......@@ -246,6 +246,7 @@ EXPERIMENT_LIST="
new_mvref
implicit_segmentation
newbintramodes
comp_interintra_pred
"
CONFIG_LIST="
external_build
......
......@@ -214,6 +214,7 @@ union b_mode_info {
};
typedef enum {
NONE = -1,
INTRA_FRAME = 0,
LAST_FRAME = 1,
GOLDEN_FRAME = 2,
......@@ -225,6 +226,9 @@ typedef struct {
MB_PREDICTION_MODE mode, uv_mode;
#if CONFIG_COMP_INTRA_PRED
MB_PREDICTION_MODE second_mode, second_uv_mode;
#endif
#if CONFIG_COMP_INTERINTRA_PRED
MB_PREDICTION_MODE interintra_mode, interintra_uv_mode;
#endif
MV_REFERENCE_FRAME ref_frame, second_ref_frame;
TX_SIZE txfm_size;
......
......@@ -345,6 +345,9 @@ void vp9_init_mbmode_probs(VP9_COMMON *x) {
vpx_memcpy(x->fc.mbsplit_prob, vp9_mbsplit_probs, sizeof(vp9_mbsplit_probs));
vpx_memcpy(x->fc.switchable_interp_prob, vp9_switchable_interp_prob,
sizeof(vp9_switchable_interp_prob));
#if CONFIG_COMP_INTERINTRA_PRED
x->fc.interintra_prob = VP9_DEF_INTERINTRA_PROB;
#endif
}
......@@ -547,6 +550,9 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
vp9_prob i8x8_mode_probs[VP9_I8X8_MODES - 1];
vp9_prob sub_mv_ref_probs[VP9_SUBMVREFS - 1];
vp9_prob mbsplit_probs[VP9_NUMMBSPLITS - 1];
#if CONFIG_COMP_INTERINTRA_PRED
vp9_prob interintra_prob;
#endif
#ifdef MODE_COUNT_TESTING
printf("static const unsigned int\nymode_counts"
"[VP9_YMODES] = {\n");
......@@ -581,6 +587,12 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
"[VP9_NUMMBSPLITS] = {\n");
for (t = 0; t < VP9_NUMMBSPLITS; ++t) printf("%d, ", cm->fc.mbsplit_counts[t]);
printf("};\n");
#if CONFIG_COMP_INTERINTRA_PRED
printf("static const unsigned int\ninterintra_counts"
"[2] = {\n");
for (t = 0; t < 2; ++t) printf("%d, ", cm->fc.interintra_counts[t]);
printf("};\n");
#endif
#endif
vp9_tree_probs_from_distribution(
VP9_YMODES, vp9_ymode_encodings, vp9_ymode_tree,
......@@ -673,4 +685,21 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
else if (prob > 255) cm->fc.mbsplit_prob[t] = 255;
else cm->fc.mbsplit_prob[t] = prob;
}
#if CONFIG_COMP_INTERINTRA_PRED
if (cm->use_interintra) {
int prob;
interintra_prob = vp9_bin_prob_from_distribution(cm->fc.interintra_counts);
count = cm->fc.interintra_counts[0] + cm->fc.interintra_counts[1];
count = count > MODE_COUNT_SAT ? MODE_COUNT_SAT : count;
factor = (MODE_MAX_UPDATE_FACTOR * count / MODE_COUNT_SAT);
prob = ((int)cm->fc.pre_interintra_prob * (256 - factor) +
(int)interintra_prob * factor + 128) >> 8;
if (prob <= 0)
cm->fc.interintra_prob = 1;
else if (prob > 255)
cm->fc.interintra_prob = 255;
else
cm->fc.interintra_prob = prob;
}
#endif
}
......@@ -21,6 +21,13 @@
#define DEFAULT_COMP_INTRA_PROB 32
#endif
#if CONFIG_COMP_INTERINTRA_PRED
#define VP9_DEF_INTERINTRA_PROB 248
#define VP9_UPD_INTERINTRA_PROB 192
// whether to use a separate uv mode (1) or use the same as the y mode (0)
#define SEPARATE_INTERINTRA_UV 0
#endif
typedef const int vp9_mbsplit[16];
extern vp9_mbsplit vp9_mbsplits[VP9_NUMMBSPLITS];
......
......@@ -104,11 +104,14 @@ static int left_block_second_mv(const MODE_INFO *cur_mb, int b) {
--cur_mb;
if (cur_mb->mbmi.mode != SPLITMV)
return cur_mb->mbmi.second_ref_frame ? cur_mb->mbmi.mv[1].as_int : cur_mb->mbmi.mv[0].as_int;
return cur_mb->mbmi.second_ref_frame > 0 ?
cur_mb->mbmi.mv[1].as_int : cur_mb->mbmi.mv[0].as_int;
b += 4;
}
return cur_mb->mbmi.second_ref_frame ? (cur_mb->bmi + b - 1)->as_mv.second.as_int : (cur_mb->bmi + b - 1)->as_mv.first.as_int;
return cur_mb->mbmi.second_ref_frame > 0 ?
(cur_mb->bmi + b - 1)->as_mv.second.as_int :
(cur_mb->bmi + b - 1)->as_mv.first.as_int;
}
static int above_block_mv(const MODE_INFO *cur_mb, int b, int mi_stride) {
......@@ -130,11 +133,14 @@ static int above_block_second_mv(const MODE_INFO *cur_mb, int b, int mi_stride)
cur_mb -= mi_stride;
if (cur_mb->mbmi.mode != SPLITMV)
return cur_mb->mbmi.second_ref_frame ? cur_mb->mbmi.mv[1].as_int : cur_mb->mbmi.mv[0].as_int;
return cur_mb->mbmi.second_ref_frame > 0 ?
cur_mb->mbmi.mv[1].as_int : cur_mb->mbmi.mv[0].as_int;
b += 16;
}
return cur_mb->mbmi.second_ref_frame ? (cur_mb->bmi + b - 4)->as_mv.second.as_int : (cur_mb->bmi + b - 4)->as_mv.first.as_int;
return cur_mb->mbmi.second_ref_frame > 0 ?
(cur_mb->bmi + b - 4)->as_mv.second.as_int :
(cur_mb->bmi + b - 4)->as_mv.first.as_int;
}
static B_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b) {
......
......@@ -63,7 +63,7 @@ static int get_candidate_mvref(
ret_val = TRUE;
// Is there a second non zero vector we can use.
if ((candidate_mi->mbmi.second_ref_frame != INTRA_FRAME) &&
if ((candidate_mi->mbmi.second_ref_frame > INTRA_FRAME) &&
(candidate_mi->mbmi.mv[1].as_int != 0) &&
(candidate_mi->mbmi.mv[1].as_int != c_mv->as_int)) {
c2_mv->as_int = candidate_mi->mbmi.mv[1].as_int;
......@@ -77,7 +77,7 @@ static int get_candidate_mvref(
ret_val = TRUE;
// Is there a second non zero vector we can use.
if ((candidate_mi->mbmi.ref_frame != INTRA_FRAME) &&
if ((candidate_mi->mbmi.ref_frame > INTRA_FRAME) &&
(candidate_mi->mbmi.mv[0].as_int != 0) &&
(candidate_mi->mbmi.mv[0].as_int != c_mv->as_int)) {
c2_mv->as_int = candidate_mi->mbmi.mv[0].as_int;
......@@ -85,13 +85,13 @@ static int get_candidate_mvref(
}
// No ref frame matches so use first ref mv as first choice
} else if (candidate_mi->mbmi.ref_frame != INTRA_FRAME) {
} else if (candidate_mi->mbmi.ref_frame > INTRA_FRAME) {
c_mv->as_int = candidate_mi->mbmi.mv[0].as_int;
*c_ref_frame = candidate_mi->mbmi.ref_frame;
ret_val = TRUE;
// Is there a second non zero vector we can use.
if ((candidate_mi->mbmi.second_ref_frame != INTRA_FRAME) &&
if ((candidate_mi->mbmi.second_ref_frame > INTRA_FRAME) &&
(candidate_mi->mbmi.mv[1].as_int != 0) &&
(candidate_mi->mbmi.mv[1].as_int != c_mv->as_int)) {
c2_mv->as_int = candidate_mi->mbmi.mv[1].as_int;
......@@ -100,7 +100,7 @@ static int get_candidate_mvref(
// If only the second ref mv is valid:- (Should not trigger in current code
// base given current possible compound prediction options).
} else if (candidate_mi->mbmi.second_ref_frame != INTRA_FRAME) {
} else if (candidate_mi->mbmi.second_ref_frame > INTRA_FRAME) {
c_mv->as_int = candidate_mi->mbmi.mv[1].as_int;
*c_ref_frame = candidate_mi->mbmi.second_ref_frame;
ret_val = TRUE;
......
......@@ -106,6 +106,11 @@ typedef struct frame_contexts {
nmv_context_counts NMVcount;
vp9_prob switchable_interp_prob[VP9_SWITCHABLE_FILTERS + 1]
[VP9_SWITCHABLE_FILTERS - 1];
#if CONFIG_COMP_INTERINTRA_PRED
unsigned int interintra_counts[2];
vp9_prob interintra_prob;
vp9_prob pre_interintra_prob;
#endif
int mode_context[INTER_MODE_CONTEXTS][4];
int mode_context_a[INTER_MODE_CONTEXTS][4];
......@@ -311,6 +316,9 @@ typedef struct VP9Common {
// 2=specified per MB (1=filtered, 0=non-filtered)
vp9_prob prob_pred_filter_off;
#endif
#if CONFIG_COMP_INTERINTRA_PRED
int use_interintra;
#endif
} VP9_COMMON;
......
......@@ -40,8 +40,8 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
case PRED_COMP:
// Context based on use of comp pred flag by neighbours
// pred_context =
// ((m - 1)->mbmi.second_ref_frame != INTRA_FRAME) +
// ((m - cm->mode_info_stride)->mbmi.second_ref_frame != INTRA_FRAME);
// ((m - 1)->mbmi.second_ref_frame > INTRA_FRAME) +
// ((m - cm->mode_info_stride)->mbmi.second_ref_frame > INTRA_FRAME);
// Context based on mode and reference frame
// if ( m->mbmi.ref_frame == LAST_FRAME )
......
......@@ -14,6 +14,7 @@
#include "subpixel.h"
#include "blockd.h"
#include "reconinter.h"
#include "vp9/common/reconintra.h"
#if CONFIG_RUNTIME_CPU_DETECT
#include "onyxc_int.h"
#endif
......@@ -511,7 +512,7 @@ void vp9_build_inter4x4_predictors_mbuv(MACROBLOCKD *xd) {
blockd[voffset].bmi.as_mv.first.as_mv.col =
blockd[uoffset].bmi.as_mv.first.as_mv.col;
if (xd->mode_info_context->mbmi.second_ref_frame) {
if (xd->mode_info_context->mbmi.second_ref_frame > 0) {
temp = blockd[yoffset ].bmi.as_mv.second.as_mv.row
+ blockd[yoffset + 1].bmi.as_mv.second.as_mv.row
+ blockd[yoffset + 4].bmi.as_mv.second.as_mv.row
......@@ -559,7 +560,7 @@ void vp9_build_inter4x4_predictors_mbuv(MACROBLOCKD *xd) {
vp9_build_inter_predictors_b(d1, 8, xd->subpixel_predict);
}
if (xd->mode_info_context->mbmi.second_ref_frame) {
if (xd->mode_info_context->mbmi.second_ref_frame > 0) {
vp9_build_2nd_inter_predictors_b(d0, 8, xd->subpixel_predict_avg);
vp9_build_2nd_inter_predictors_b(d1, 8, xd->subpixel_predict_avg);
}
......@@ -777,7 +778,7 @@ void vp9_build_inter32x32_predictors_sb(MACROBLOCKD *x,
dst_u + y_idx * 8 * dst_uvstride + x_idx * 8,
dst_v + y_idx * 8 * dst_uvstride + x_idx * 8,
dst_ystride, dst_uvstride);
if (x->mode_info_context->mbmi.second_ref_frame) {
if (x->mode_info_context->mbmi.second_ref_frame > 0) {
x->second_pre.y_buffer = y2 + y_idx * 16 * x->pre.y_stride + x_idx * 16;
x->second_pre.u_buffer = u2 + y_idx * 8 * x->pre.uv_stride + x_idx * 8;
x->second_pre.v_buffer = v2 + y_idx * 8 * x->pre.uv_stride + x_idx * 8;
......@@ -799,7 +800,7 @@ void vp9_build_inter32x32_predictors_sb(MACROBLOCKD *x,
x->pre.u_buffer = u1;
x->pre.v_buffer = v1;
if (x->mode_info_context->mbmi.second_ref_frame) {
if (x->mode_info_context->mbmi.second_ref_frame > 0) {
x->second_pre.y_buffer = y2;
x->second_pre.u_buffer = u2;
x->second_pre.v_buffer = v2;
......@@ -979,7 +980,7 @@ static void build_inter4x4_predictors_mb(MACROBLOCKD *xd) {
clamp_mv_to_umv_border(&blockd[ 2].bmi.as_mv.first.as_mv, xd);
clamp_mv_to_umv_border(&blockd[ 8].bmi.as_mv.first.as_mv, xd);
clamp_mv_to_umv_border(&blockd[10].bmi.as_mv.first.as_mv, xd);
if (mbmi->second_ref_frame) {
if (mbmi->second_ref_frame > 0) {
clamp_mv_to_umv_border(&blockd[ 0].bmi.as_mv.second.as_mv, xd);
clamp_mv_to_umv_border(&blockd[ 2].bmi.as_mv.second.as_mv, xd);
clamp_mv_to_umv_border(&blockd[ 8].bmi.as_mv.second.as_mv, xd);
......@@ -993,7 +994,7 @@ static void build_inter4x4_predictors_mb(MACROBLOCKD *xd) {
vp9_build_inter_predictors4b(xd, &blockd[ 8], 16);
vp9_build_inter_predictors4b(xd, &blockd[10], 16);
if (mbmi->second_ref_frame) {
if (mbmi->second_ref_frame > 0) {
vp9_build_2nd_inter_predictors4b(xd, &blockd[ 0], 16);
vp9_build_2nd_inter_predictors4b(xd, &blockd[ 2], 16);
vp9_build_2nd_inter_predictors4b(xd, &blockd[ 8], 16);
......@@ -1010,7 +1011,7 @@ static void build_inter4x4_predictors_mb(MACROBLOCKD *xd) {
if (mbmi->need_to_clamp_mvs) {
clamp_mv_to_umv_border(&blockd[i + 0].bmi.as_mv.first.as_mv, xd);
clamp_mv_to_umv_border(&blockd[i + 1].bmi.as_mv.first.as_mv, xd);
if (mbmi->second_ref_frame) {
if (mbmi->second_ref_frame > 0) {
clamp_mv_to_umv_border(&blockd[i + 0].bmi.as_mv.second.as_mv, xd);
clamp_mv_to_umv_border(&blockd[i + 1].bmi.as_mv.second.as_mv, xd);
}
......@@ -1023,7 +1024,7 @@ static void build_inter4x4_predictors_mb(MACROBLOCKD *xd) {
vp9_build_inter_predictors_b(d1, 16, xd->subpixel_predict);
}
if (mbmi->second_ref_frame) {
if (mbmi->second_ref_frame > 0) {
vp9_build_2nd_inter_predictors_b(d0, 16, xd->subpixel_predict_avg);
vp9_build_2nd_inter_predictors_b(d1, 16, xd->subpixel_predict_avg);
}
......@@ -1041,7 +1042,7 @@ static void build_inter4x4_predictors_mb(MACROBLOCKD *xd) {
vp9_build_inter_predictors_b(d1, 8, xd->subpixel_predict);
}
if (mbmi->second_ref_frame) {
if (mbmi->second_ref_frame > 0) {
vp9_build_2nd_inter_predictors_b(d0, 8, xd->subpixel_predict_avg);
vp9_build_2nd_inter_predictors_b(d1, 8, xd->subpixel_predict_avg);
}
......@@ -1094,7 +1095,7 @@ void build_4x4uvmvs(MACROBLOCKD *xd) {
blockd[voffset].bmi.as_mv.first.as_mv.col =
blockd[uoffset].bmi.as_mv.first.as_mv.col;
if (xd->mode_info_context->mbmi.second_ref_frame) {
if (xd->mode_info_context->mbmi.second_ref_frame > 0) {
temp = xd->mode_info_context->bmi[yoffset + 0].as_mv.second.as_mv.row
+ xd->mode_info_context->bmi[yoffset + 1].as_mv.second.as_mv.row
+ xd->mode_info_context->bmi[yoffset + 4].as_mv.second.as_mv.row
......@@ -1146,7 +1147,7 @@ void vp9_build_inter_predictors_mb(MACROBLOCKD *xd) {
&xd->predictor[256],
&xd->predictor[320], 16, 8);
if (xd->mode_info_context->mbmi.second_ref_frame) {
if (xd->mode_info_context->mbmi.second_ref_frame > 0) {
/* 256 = offset of U plane in Y+U+V buffer;
* 320 = offset of V plane in Y+U+V buffer.
* (256=16x16, 320=16x16+8x8). */
......@@ -1154,6 +1155,13 @@ void vp9_build_inter_predictors_mb(MACROBLOCKD *xd) {
&xd->predictor[256],
&xd->predictor[320], 16, 8);
}
#if CONFIG_COMP_INTERINTRA_PRED
else if (xd->mode_info_context->mbmi.second_ref_frame == INTRA_FRAME) {
vp9_build_interintra_16x16_predictors_mb(xd, xd->predictor,
&xd->predictor[256],
&xd->predictor[320], 16, 8);
}
#endif
} else {
build_4x4uvmvs(xd);
build_inter4x4_predictors_mb(xd);
......
<
......@@ -372,6 +372,294 @@ void vp9_build_intra_predictors_internal(unsigned char *src, int src_stride,
}
}
#if CONFIG_COMP_INTERINTRA_PRED
static void combine_interintra(MB_PREDICTION_MODE mode,
unsigned char *interpred,
int interstride,
unsigned char *intrapred,
int intrastride,
int size) {
// TODO(debargha): Explore different ways of combining predictors
// or designing the tables below
static const int scale_bits = 8;
static const int scale_max = 1 << scale_bits;
static const int scale_round = (1 << scale_bits) - 1;
// This table is a function A + B*exp(-kx), where x is hor. index
static const int weights1d[32] = {
128, 122, 116, 111, 107, 103, 99, 96,
93, 90, 88, 85, 83, 81, 80, 78,
77, 76, 75, 74, 73, 72, 71, 70,
70, 69, 69, 68, 68, 68, 67, 67,
};
// This table is a function A + B*exp(-k.sqrt(xy)), where x, y are
// hor. and vert. indices
static const int weights2d[1024] = {
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
128, 122, 120, 118, 116, 115, 114, 113,
112, 111, 111, 110, 109, 109, 108, 107,
107, 106, 106, 105, 105, 104, 104, 104,
103, 103, 102, 102, 102, 101, 101, 101,
128, 120, 116, 114, 112, 111, 109, 108,
107, 106, 105, 104, 103, 102, 102, 101,
100, 100, 99, 99, 98, 97, 97, 96,
96, 96, 95, 95, 94, 94, 93, 93,
128, 118, 114, 111, 109, 107, 106, 104,
103, 102, 101, 100, 99, 98, 97, 97,
96, 95, 95, 94, 93, 93, 92, 92,
91, 91, 90, 90, 90, 89, 89, 88,
128, 116, 112, 109, 107, 105, 103, 102,
100, 99, 98, 97, 96, 95, 94, 93,
93, 92, 91, 91, 90, 90, 89, 89,
88, 88, 87, 87, 86, 86, 85, 85,
128, 115, 111, 107, 105, 103, 101, 99,
98, 97, 96, 94, 93, 93, 92, 91,
90, 89, 89, 88, 88, 87, 86, 86,
85, 85, 84, 84, 84, 83, 83, 82,
128, 114, 109, 106, 103, 101, 99, 97,
96, 95, 93, 92, 91, 90, 90, 89,
88, 87, 87, 86, 85, 85, 84, 84,
83, 83, 82, 82, 82, 81, 81, 80,
128, 113, 108, 104, 102, 99, 97, 96,
94, 93, 92, 91, 90, 89, 88, 87,
86, 85, 85, 84, 84, 83, 83, 82,
82, 81, 81, 80, 80, 79, 79, 79,
128, 112, 107, 103, 100, 98, 96, 94,
93, 91, 90, 89, 88, 87, 86, 85,
85, 84, 83, 83, 82, 82, 81, 80,
80, 80, 79, 79, 78, 78, 78, 77,
128, 111, 106, 102, 99, 97, 95, 93,
91, 90, 89, 88, 87, 86, 85, 84,
83, 83, 82, 81, 81, 80, 80, 79,
79, 78, 78, 77, 77, 77, 76, 76,
128, 111, 105, 101, 98, 96, 93, 92,
90, 89, 88, 86, 85, 84, 84, 83,
82, 81, 81, 80, 80, 79, 79, 78,
78, 77, 77, 76, 76, 76, 75, 75,
128, 110, 104, 100, 97, 94, 92, 91,
89, 88, 86, 85, 84, 83, 83, 82,
81, 80, 80, 79, 79, 78, 78, 77,
77, 76, 76, 75, 75, 75, 74, 74,
128, 109, 103, 99, 96, 93, 91, 90,
88, 87, 85, 84, 83, 82, 82, 81,
80, 79, 79, 78, 78, 77, 77, 76,
76, 75, 75, 75, 74, 74, 74, 73,
128, 109, 102, 98, 95, 93, 90, 89,
87, 86, 84, 83, 82, 81, 81, 80,
79, 78, 78, 77, 77, 76, 76, 75,
75, 75, 74, 74, 73, 73, 73, 73,
128, 108, 102, 97, 94, 92, 90, 88,
86, 85, 84, 83, 82, 81, 80, 79,
78, 78, 77, 77, 76, 76, 75, 75,
74, 74, 73, 73, 73, 73, 72, 72,
128, 107, 101, 97, 93, 91, 89, 87,
85, 84, 83, 82, 81, 80, 79, 78,
78, 77, 76, 76, 75, 75, 74, 74,
74, 73, 73, 73, 72, 72, 72, 71,
128, 107, 100, 96, 93, 90, 88, 86,
85, 83, 82, 81, 80, 79, 78, 78,
77, 76, 76, 75, 75, 74, 74, 73,
73, 73, 72, 72, 72, 71, 71, 71,
128, 106, 100, 95, 92, 89, 87, 85,
84, 83, 81, 80, 79, 78, 78, 77,
76, 76, 75, 75, 74, 74, 73, 73,
72, 72, 72, 72, 71, 71, 71, 70,
128, 106, 99, 95, 91, 89, 87, 85,
83, 82, 81, 80, 79, 78, 77, 76,
76, 75, 75, 74, 74, 73, 73, 72,
72, 72, 71, 71, 71, 71, 70, 70,
128, 105, 99, 94, 91, 88, 86, 84,
83, 81, 80, 79, 78, 77, 77, 76,
75, 75, 74, 74, 73, 73, 72, 72,
72, 71, 71, 71, 70, 70, 70, 70,
128, 105, 98, 93, 90, 88, 85, 84,
82, 81, 80, 79, 78, 77, 76, 75,
75, 74, 74, 73, 73, 72, 72, 71,
71, 71, 71, 70, 70, 70, 70, 69,
128, 104, 97, 93, 90, 87, 85, 83,
82, 80, 79, 78, 77, 76, 76, 75,
74, 74, 73, 73, 72, 72, 71, 71,
71, 70, 70, 70, 70, 69, 69, 69,
128, 104, 97, 92, 89, 86, 84, 83,
81, 80, 79, 78, 77, 76, 75, 74,
74, 73, 73, 72, 72, 71, 71, 71,
70, 70, 70, 70, 69, 69, 69, 69,
128, 104, 96, 92, 89, 86, 84, 82,
80, 79, 78, 77, 76, 75, 75, 74,
73, 73, 72, 72, 71, 71, 71, 70,
70, 70, 70, 69, 69, 69, 69, 68,
128, 103, 96, 91, 88, 85, 83, 82,
80, 79, 78, 77, 76, 75, 74, 74,
73, 72, 72, 72, 71, 71, 70, 70,
70, 70, 69, 69, 69, 69, 68, 68,
128, 103, 96, 91, 88, 85, 83, 81,
80, 78, 77, 76, 75, 75, 74, 73,
73, 72, 72, 71, 71, 70, 70, 70,
70, 69, 69, 69, 69, 68, 68, 68,
128, 102, 95, 90, 87, 84, 82, 81,
79, 78, 77, 76, 75, 74, 73, 73,
72, 72, 71, 71, 71, 70, 70, 70,
69, 69, 69, 69, 68, 68, 68, 68,
128, 102, 95, 90, 87, 84, 82, 80,
79, 77, 76, 75, 75, 74, 73, 73,
72, 72, 71, 71, 70, 70, 70, 69,
69, 69, 69, 68, 68, 68, 68, 68,
128, 102, 94, 90, 86, 84, 82, 80,
78, 77, 76, 75, 74, 73, 73, 72,
72, 71, 71, 70, 70, 70, 69, 69,
69, 69, 68, 68, 68, 68, 68, 67,
128, 101, 94, 89, 86, 83, 81, 79,
78, 77, 76, 75, 74, 73, 73, 72,
71, 71, 71, 70, 70, 69, 69, 69,
69, 68, 68, 68, 68, 68, 67, 67,
128, 101, 93, 89, 85, 83, 81, 79,
78, 76, 75, 74, 74, 73, 72, 72,
71, 71, 70, 70, 70, 69, 69, 69,
68, 68, 68, 68, 68, 67, 67, 67,
128, 101, 93, 88, 85, 82, 80, 79,
77, 76, 75, 74, 73, 73, 72, 71,
71, 70, 70, 70, 69, 69, 69, 68,
68, 68, 68, 68, 67, 67, 67, 67,
};
int size_scale = (size == 32 ? 1 :
size == 16 ? 2 :
size == 8 ? 4 : 8);
int i, j;
switch (mode) {
case V_PRED:
for (i = 0; i < size; ++i) {
for (j = 0; j < size; ++j) {
int k = i * interstride + j;
int scale = weights1d[i * size_scale];
interpred[k] =
((scale_max - scale) * interpred[k] +
scale * intrapred[i * intrastride + j] + scale_round)
>> scale_bits;
}
}
break;
case H_PRED:
for (i = 0; i < size; ++i) {
for (j = 0; j < size; ++j) {
int k = i * interstride + j;
int scale = weights1d[j * size_scale];
interpred[k] =
((scale_max - scale) * interpred[k] +
scale * intrapred[i * intrastride + j] + scale_round)
>> scale_bits;
}
}
break;
case D63_PRED:
case D117_PRED:
for (i = 0; i < size; ++i) {
for (j = 0; j < size; ++j) {
int k = i * interstride + j;
int scale = (weights2d[i * size_scale * 32 + j * size_scale] +
weights1d[i * size_scale]) >> 1;
interpred[k] =
((scale_max - scale) * interpred[k] +
scale * intrapred[i * intrastride + j] + scale_round)
>> scale_bits;
}
}
break;
case D27_PRED:
case D153_PRED:
for (i = 0; i < size; ++i) {
for (j = 0; j < size; ++j) {
int k = i * interstride + j;
int scale = (weights2d[i * size_scale * 32 + j * size_scale] +
weights1d[j * size_scale]) >> 1;
interpred[k] =
((scale_max - scale) * interpred[k] +
scale * intrapred[i * intrastride + j] + scale_round)
>> scale_bits;
}
}
break;
case D135_PRED:
for (i = 0; i < size; ++i) {
for (j = 0; j < size; ++j) {
int k = i * interstride + j;
int scale = weights2d[i * size_scale * 32 + j * size_scale];
interpred[k] =
((scale_max - scale) * interpred[k] +
scale * intrapred[i * intrastride + j] + scale_round)
>> scale_bits;
}
}
break;
case D45_PRED:
case DC_PRED:
case TM_PRED:
default:
// simple average
for (i = 0; i < size; ++i) {
for (j = 0; j < size; ++j) {
int k = i * interstride + j;
interpred[k] = (interpred[k] + intrapred[i * intrastride + j]) >> 1;
}
}
break;
}
}
void vp9_build_interintra_16x16_predictors_mb(MACROBLOCKD *xd,
unsigned char *ypred,
unsigned char *upred,
unsigned char *vpred,
int ystride, int uvstride) {
vp9_build_interintra_16x16_predictors_mby(xd, ypred, ystride);
vp9_build_interintra_16x16_predictors_mbuv(xd, upred, vpred, uvstride);
}