Commit 5cac6607 authored by Ronald S. Bultje's avatar Ronald S. Bultje

Remove splitmv.

Also do per-partition motion vector referencing in <sb8x8 partitions,
and adjust mvref finding for sub8x8 partitions.

Change-Id: Id3ed1ed4d2a8910d11d327db6cc63b8eb79f941f
parent 0b2b8124
......@@ -138,16 +138,10 @@ typedef enum {
B_D63_PRED,
B_TM_PRED,
LEFT4X4,
ABOVE4X4,
ZERO4X4,
NEW4X4,
B_MODE_COUNT
} B_PREDICTION_MODE;
#define VP9_BINTRAMODES (LEFT4X4)
#define VP9_SUBMVREFS (1 + NEW4X4 - LEFT4X4)
#define VP9_BINTRAMODES (B_MODE_COUNT)
#define VP9_KF_BINTRAMODES (VP9_BINTRAMODES) /* 10 */
#define VP9_NKF_BINTRAMODES (VP9_BINTRAMODES) /* 10 */
......
......@@ -67,42 +67,6 @@ static const unsigned int bmode_cts[VP9_NKF_BINTRAMODES] = {
43891, 10036, 3920, 3363, 2546, 5119, 2471, 1723, 3221, 17694
};
typedef enum {
SUBMVREF_NORMAL,
SUBMVREF_LEFT_ZED,
SUBMVREF_ABOVE_ZED,
SUBMVREF_LEFT_ABOVE_SAME,
SUBMVREF_LEFT_ABOVE_ZED
} sumvfref_t;
int vp9_mv_cont(const int_mv *l, const int_mv *a) {
const int lez = (l->as_int == 0);
const int aez = (a->as_int == 0);
const int lea = (l->as_int == a->as_int);
if (lea && lez)
return SUBMVREF_LEFT_ABOVE_ZED;
if (lea)
return SUBMVREF_LEFT_ABOVE_SAME;
if (aez)
return SUBMVREF_ABOVE_ZED;
if (lez)
return SUBMVREF_LEFT_ZED;
return SUBMVREF_NORMAL;
}
const vp9_prob vp9_sub_mv_ref_prob2 [SUBMVREF_COUNT][VP9_SUBMVREFS - 1] = {
{ 147, 136, 18 },
{ 106, 145, 1 },
{ 179, 121, 1 },
{ 223, 1, 34 },
{ 208, 1, 1 }
};
const vp9_prob vp9_partition_probs[NUM_PARTITION_CONTEXTS]
[PARTITION_TYPES - 1] = {
// FIXME(jingning,rbultje) put real probabilities here
......@@ -203,12 +167,6 @@ const vp9_tree_index vp9_sb_mv_ref_tree[6] = {
-NEARMV, -NEWMV
};
const vp9_tree_index vp9_sub_mv_ref_tree[6] = {
-LEFT4X4, 2,
-ABOVE4X4, 4,
-ZERO4X4, -NEW4X4
};
const vp9_tree_index vp9_partition_tree[6] = {
-PARTITION_NONE, 2,
-PARTITION_HORZ, 4,
......@@ -225,7 +183,6 @@ struct vp9_token vp9_uv_mode_encodings[VP9_UV_MODES];
struct vp9_token vp9_mv_ref_encoding_array[VP9_MVREFS];
struct vp9_token vp9_sb_mv_ref_encoding_array[VP9_MVREFS];
struct vp9_token vp9_sub_mv_ref_encoding_array[VP9_SUBMVREFS];
struct vp9_token vp9_partition_encodings[PARTITION_TYPES];
......@@ -252,8 +209,6 @@ void vp9_init_mbmode_probs(VP9_COMMON *x) {
bct, uv_mode_cts[i], 0);
}
vpx_memcpy(x->fc.sub_mv_ref_prob, vp9_sub_mv_ref_prob2,
sizeof(vp9_sub_mv_ref_prob2));
vpx_memcpy(x->fc.switchable_interp_prob, vp9_switchable_interp_prob,
sizeof(vp9_switchable_interp_prob));
......@@ -327,8 +282,6 @@ void vp9_entropy_mode_init() {
vp9_mv_ref_tree, NEARESTMV);
vp9_tokens_from_tree_offset(vp9_sb_mv_ref_encoding_array,
vp9_sb_mv_ref_tree, NEARESTMV);
vp9_tokens_from_tree_offset(vp9_sub_mv_ref_encoding_array,
vp9_sub_mv_ref_tree, LEFT4X4);
}
void vp9_init_mode_contexts(VP9_COMMON *pc) {
......@@ -438,15 +391,6 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
for (t = 0; t < VP9_I8X8_MODES; ++t)
printf("%d, ", fc->i8x8_mode_counts[t]);
printf("};\n");
printf("static const unsigned int\nsub_mv_ref_counts"
"[SUBMVREF_COUNT] [VP9_SUBMVREFS] = {\n");
for (i = 0; i < SUBMVREF_COUNT; ++i) {
printf(" {");
for (t = 0; t < VP9_SUBMVREFS; ++t)
printf("%d, ", fc->sub_mv_ref_counts[i][t]);
printf("},\n");
}
printf("};\n");
printf("static const unsigned int\nmbsplit_counts"
"[VP9_NUMMBSPLITS] = {\n");
for (t = 0; t < VP9_NUMMBSPLITS; ++t)
......@@ -470,12 +414,6 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
fc->bmode_counts, fc->pre_bmode_prob,
fc->bmode_prob, 0);
for (i = 0; i < SUBMVREF_COUNT; ++i)
update_mode_probs(VP9_SUBMVREFS,
vp9_sub_mv_ref_tree, fc->sub_mv_ref_counts[i],
fc->pre_sub_mv_ref_prob[i], fc->sub_mv_ref_prob[i],
LEFT4X4);
for (i = 0; i < NUM_PARTITION_CONTEXTS; i++)
update_mode_probs(PARTITION_TYPES, vp9_partition_tree,
fc->partition_counts[i], fc->pre_partition_prob[i],
......
......@@ -18,8 +18,6 @@
extern int vp9_mv_cont(const int_mv *l, const int_mv *a);
extern const vp9_prob vp9_sub_mv_ref_prob2[SUBMVREF_COUNT][VP9_SUBMVREFS - 1];
extern const vp9_prob vp9_kf_default_bmode_probs[VP9_KF_BINTRAMODES]
[VP9_KF_BINTRAMODES]
[VP9_KF_BINTRAMODES -1 ];
......@@ -48,7 +46,6 @@ extern struct vp9_token vp9_uv_mode_encodings[VP9_UV_MODES];
extern struct vp9_token vp9_mv_ref_encoding_array[VP9_MVREFS];
extern struct vp9_token vp9_sb_mv_ref_encoding_array[VP9_MVREFS];
extern struct vp9_token vp9_sub_mv_ref_encoding_array[VP9_SUBMVREFS];
// probability models for partition information
extern const vp9_tree_index vp9_partition_tree[];
......
......@@ -11,6 +11,7 @@
#include <limits.h>
#include "vp9/common/vp9_findnearmv.h"
#include "vp9/common/vp9_mvref_common.h"
#include "vp9/common/vp9_sadmxn.h"
#include "vp9/common/vp9_subpelvar.h"
......@@ -51,3 +52,59 @@ void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
*nearest = mvlist[0];
*near = mvlist[1];
}
void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd,
int_mv *dst_nearest,
int_mv *dst_near,
int block_idx, int ref_idx) {
int_mv dst_list[MAX_MV_REF_CANDIDATES];
int_mv mv_list[MAX_MV_REF_CANDIDATES];
MODE_INFO *mi = xd->mode_info_context;
MB_MODE_INFO *const mbmi = &mi->mbmi;
int use_prev_in_find_mv_refs;
assert(ref_idx == 0 || ref_idx == 1);
assert(MAX_MV_REF_CANDIDATES == 2); // makes code here slightly easier
use_prev_in_find_mv_refs = cm->width == cm->last_width &&
cm->height == cm->last_height &&
!cm->error_resilient_mode &&
cm->last_show_frame;
vp9_find_mv_refs_idx(cm, xd, xd->mode_info_context,
use_prev_in_find_mv_refs ?
xd->prev_mode_info_context : NULL,
ref_idx ? mbmi->second_ref_frame : mbmi->ref_frame,
mv_list, cm->ref_frame_sign_bias, block_idx);
dst_list[1].as_int = 0;
if (block_idx == 0) {
memcpy(dst_list, mv_list, MAX_MV_REF_CANDIDATES * sizeof(int_mv));
} else if (block_idx == 1 || block_idx == 2) {
int dst = 0, n;
union b_mode_info *bmi = mi->bmi;
dst_list[dst++].as_int = bmi[0].as_mv[ref_idx].as_int;
for (n = 0; dst < MAX_MV_REF_CANDIDATES &&
n < MAX_MV_REF_CANDIDATES; n++)
if (mv_list[n].as_int != dst_list[0].as_int)
dst_list[dst++].as_int = mv_list[n].as_int;
} else {
int dst = 0, n;
union b_mode_info *bmi = mi->bmi;
assert(block_idx == 3);
dst_list[dst++].as_int = bmi[2].as_mv[ref_idx].as_int;
if (dst_list[0].as_int != bmi[1].as_mv[ref_idx].as_int)
dst_list[dst++].as_int = bmi[1].as_mv[ref_idx].as_int;
if (dst < MAX_MV_REF_CANDIDATES &&
dst_list[0].as_int != bmi[0].as_mv[ref_idx].as_int)
dst_list[dst++].as_int = bmi[0].as_mv[ref_idx].as_int;
for (n = 0; dst < MAX_MV_REF_CANDIDATES &&
n < MAX_MV_REF_CANDIDATES; n++)
if (mv_list[n].as_int != dst_list[0].as_int)
dst_list[dst++].as_int = mv_list[n].as_int;
}
dst_nearest->as_int = dst_list[0].as_int;
dst_near->as_int = dst_list[1].as_int;
}
......@@ -74,72 +74,11 @@ vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc,
vp9_prob p[VP9_MVREFS - 1],
const int context);
static int left_block_mv(const MACROBLOCKD *xd,
const MODE_INFO *cur_mb, int b) {
if (!(b & 1)) {
if (!xd->left_available)
return 0;
// On L edge, get from MB to left of us
--cur_mb;
if (cur_mb->mbmi.mode != SPLITMV)
return cur_mb->mbmi.mv[0].as_int;
b += 2;
}
return (cur_mb->bmi + b - 1)->as_mv[0].as_int;
}
static int left_block_second_mv(const MACROBLOCKD *xd,
const MODE_INFO *cur_mb, int b) {
if (!(b & 1)) {
if (!xd->left_available)
return 0;
/* On L edge, get from MB to left of us */
--cur_mb;
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 += 2;
}
return cur_mb->mbmi.second_ref_frame > 0 ?
(cur_mb->bmi + b - 1)->as_mv[1].as_int :
(cur_mb->bmi + b - 1)->as_mv[0].as_int;
}
static int above_block_mv(const MODE_INFO *cur_mb, int b, int mi_stride) {
if (!(b >> 1)) {
/* 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 += 4;
}
return (cur_mb->bmi + b - 2)->as_mv[0].as_int;
}
static int above_block_second_mv(const MODE_INFO *cur_mb, int b, int mi_stride) {
if (!(b >> 1)) {
/* 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 += 4;
}
return cur_mb->mbmi.second_ref_frame > 0 ?
(cur_mb->bmi + b - 2)->as_mv[1].as_int :
(cur_mb->bmi + b - 2)->as_mv[0].as_int;
}
void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *pc,
MACROBLOCKD *xd,
int_mv *dst_nearest,
int_mv *dst_near,
int block_idx, int ref_idx);
static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b) {
// FIXME(rbultje, jingning): temporary hack because jenkins doesn't
......
......@@ -46,11 +46,17 @@ static void clamp_mv_ref(const MACROBLOCKD *xd, int_mv *mv) {
// structure if one exists that matches the given reference frame.
static int get_matching_candidate(const MODE_INFO *candidate_mi,
MV_REFERENCE_FRAME ref_frame,
int_mv *c_mv) {
int_mv *c_mv, int block_idx) {
if (ref_frame == candidate_mi->mbmi.ref_frame) {
c_mv->as_int = candidate_mi->mbmi.mv[0].as_int;
if (block_idx >= 0 && candidate_mi->mbmi.sb_type < BLOCK_SIZE_SB8X8)
c_mv->as_int = candidate_mi->bmi[block_idx].as_mv[0].as_int;
else
c_mv->as_int = candidate_mi->mbmi.mv[0].as_int;
} else if (ref_frame == candidate_mi->mbmi.second_ref_frame) {
c_mv->as_int = candidate_mi->mbmi.mv[1].as_int;
if (block_idx >= 0 && candidate_mi->mbmi.sb_type < BLOCK_SIZE_SB8X8)
c_mv->as_int = candidate_mi->bmi[block_idx].as_mv[1].as_int;
else
c_mv->as_int = candidate_mi->mbmi.mv[1].as_int;
} else {
return 0;
}
......@@ -150,9 +156,10 @@ static void add_candidate_mv(int_mv *mv_list, int *mv_scores,
// This function searches the neighbourhood of a given MB/SB
// to try and find candidate reference vectors.
//
void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
MODE_INFO *lf_here, MV_REFERENCE_FRAME ref_frame,
int_mv *mv_ref_list, int *ref_sign_bias) {
void vp9_find_mv_refs_idx(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
MODE_INFO *lf_here, MV_REFERENCE_FRAME ref_frame,
int_mv *mv_ref_list, int *ref_sign_bias,
int block_idx) {
int i;
MODE_INFO *candidate_mi;
MB_MODE_INFO * mbmi = &xd->mode_info_context->mbmi;
......@@ -168,6 +175,7 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
int intra_count = 0;
int zero_count = 0;
int newmv_count = 0;
int x_idx = 0, y_idx = 0;
// Blank the reference vector lists and other local structures.
vpx_memset(mv_ref_list, 0, sizeof(int_mv) * MAX_MV_REF_CANDIDATES);
......@@ -181,6 +189,10 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
mv_ref_search = mb_mv_ref_search;
} else {
mv_ref_search = b_mv_ref_search;
if (mbmi->sb_type < BLOCK_SIZE_SB8X8) {
x_idx = block_idx & 1;
y_idx = block_idx >> 1;
}
}
// We first scan for candidate vectors that match the current reference frame
......@@ -191,11 +203,20 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
if ((mi_search_col >= cm->cur_tile_mi_col_start) &&
(mi_search_col < cm->cur_tile_mi_col_end) &&
((mv_ref_search[i][1] << 6) >= xd->mb_to_top_edge)) {
int b;
candidate_mi = here + mv_ref_search[i][0] +
(mv_ref_search[i][1] * xd->mode_info_stride);
if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) {
if (block_idx >= 0) {
if (mv_ref_search[i][0])
b = 1 + y_idx * 2;
else
b = 2 + x_idx;
} else {
b = -1;
}
if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv, b)) {
add_candidate_mv(mv_ref_list, candidate_scores,
&refmv_count, c_refmv, 16);
}
......@@ -229,7 +250,7 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
candidate_mi = here + mv_ref_search[i][0] +
(mv_ref_search[i][1] * xd->mode_info_stride);
if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) {
if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv, -1)) {
add_candidate_mv(mv_ref_list, candidate_scores,
&refmv_count, c_refmv, 16);
}
......@@ -239,7 +260,7 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
// Look in the last frame if it exists
if (lf_here && (refmv_count < MAX_MV_REF_CANDIDATES)) {
candidate_mi = lf_here;
if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) {
if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv, block_idx)) {
add_candidate_mv(mv_ref_list, candidate_scores,
&refmv_count, c_refmv, 16);
}
......
......@@ -14,12 +14,24 @@
#ifndef VP9_COMMON_VP9_MVREF_COMMON_H_
#define VP9_COMMON_VP9_MVREF_COMMON_H_
void vp9_find_mv_refs(VP9_COMMON *cm,
MACROBLOCKD *xd,
MODE_INFO *here,
MODE_INFO *lf_here,
MV_REFERENCE_FRAME ref_frame,
int_mv *mv_ref_list,
int *ref_sign_bias);
void vp9_find_mv_refs_idx(VP9_COMMON *cm,
MACROBLOCKD *xd,
MODE_INFO *here,
MODE_INFO *lf_here,
MV_REFERENCE_FRAME ref_frame,
int_mv *mv_ref_list,
int *ref_sign_bias,
int block_idx);
static INLINE void vp9_find_mv_refs(VP9_COMMON *cm,
MACROBLOCKD *xd,
MODE_INFO *here,
MODE_INFO *lf_here,
MV_REFERENCE_FRAME ref_frame,
int_mv *mv_ref_list,
int *ref_sign_bias) {
vp9_find_mv_refs_idx(cm, xd, here, lf_here, ref_frame,
mv_ref_list, ref_sign_bias, -1);
}
#endif // VP9_COMMON_VP9_MVREF_COMMON_H_
......@@ -51,7 +51,6 @@ typedef struct frame_contexts {
vp9_prob ymode_prob[VP9_YMODES - 1]; /* interframe intra mode probs */
vp9_prob sb_ymode_prob[VP9_I32X32_MODES - 1];
vp9_prob uv_mode_prob[VP9_YMODES][VP9_UV_MODES - 1];
vp9_prob sub_mv_ref_prob[SUBMVREF_COUNT][VP9_SUBMVREFS - 1];
vp9_prob partition_prob[NUM_PARTITION_CONTEXTS][PARTITION_TYPES - 1];
nmv_context nmvc;
......@@ -60,13 +59,11 @@ typedef struct frame_contexts {
vp9_prob pre_ymode_prob[VP9_YMODES - 1]; /* interframe intra mode probs */
vp9_prob pre_sb_ymode_prob[VP9_I32X32_MODES - 1];
vp9_prob pre_uv_mode_prob[VP9_YMODES][VP9_UV_MODES - 1];
vp9_prob pre_sub_mv_ref_prob[SUBMVREF_COUNT][VP9_SUBMVREFS - 1];
vp9_prob pre_partition_prob[NUM_PARTITION_CONTEXTS][PARTITION_TYPES - 1];
unsigned int bmode_counts[VP9_NKF_BINTRAMODES];
unsigned int ymode_counts[VP9_YMODES]; /* interframe intra mode probs */
unsigned int sb_ymode_counts[VP9_I32X32_MODES];
unsigned int uv_mode_counts[VP9_YMODES][VP9_UV_MODES];
unsigned int sub_mv_ref_counts[SUBMVREF_COUNT][VP9_SUBMVREFS];
unsigned int partition_counts[NUM_PARTITION_CONTEXTS][PARTITION_TYPES];
vp9_coeff_probs_model coef_probs_4x4[BLOCK_TYPES];
......
......@@ -367,10 +367,6 @@ static MB_PREDICTION_MODE read_mv_ref(vp9_reader *r, const vp9_prob *p) {
return (MB_PREDICTION_MODE) treed_read(r, vp9_mv_ref_tree, p);
}
static B_PREDICTION_MODE read_sub_mv_ref(vp9_reader *r, const vp9_prob *p) {
return (B_PREDICTION_MODE) treed_read(r, vp9_sub_mv_ref_tree, p);
}
#ifdef VPX_MODE_COUNT
unsigned int vp9_mv_cont_count[5][4] = {
{ 0, 0, 0, 0 },
......@@ -527,7 +523,6 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
vp9_reader *r) {
VP9_COMMON *const cm = &pbi->common;
nmv_context *const nmvc = &cm->fc.nmvc;
const int mis = cm->mode_info_stride;
MACROBLOCKD *const xd = &pbi->mb;
int_mv *const mv0 = &mbmi->mv[0];
......@@ -679,28 +674,24 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
mbmi->need_to_clamp_mvs = 0;
for (idy = 0; idy < 2; idy += bh) {
for (idx = 0; idx < 2; idx += bw) {
int_mv leftmv, abovemv, second_leftmv, second_abovemv;
int_mv blockmv, secondmv;
int mv_contz;
int blockmode;
int i, k;
int i;
j = idy * 2 + idx;
k = j;
leftmv.as_int = left_block_mv(xd, mi, k);
abovemv.as_int = above_block_mv(mi, k, mis);
second_leftmv.as_int = 0;
second_abovemv.as_int = 0;
if (mbmi->second_ref_frame > 0) {
second_leftmv.as_int = left_block_second_mv(xd, mi, k);
second_abovemv.as_int = above_block_second_mv(mi, k, mis);
blockmode = read_sb_mv_ref(r, mv_ref_p);
vp9_accum_mv_refs(cm, blockmode, mbmi->mb_mode_context[ref_frame]);
if (blockmode == NEARESTMV || blockmode == NEARMV) {
MV_REFERENCE_FRAME rf2 = mbmi->second_ref_frame;
vp9_append_sub8x8_mvs_for_idx(cm, xd, &nearest, &nearby, j, 0);
if (rf2 > 0) {
vp9_append_sub8x8_mvs_for_idx(cm, xd, &nearest_second,
&nearby_second, j, 1);
}
}
mv_contz = vp9_mv_cont(&leftmv, &abovemv);
blockmode = read_sub_mv_ref(r, cm->fc.sub_mv_ref_prob[mv_contz]);
cm->fc.sub_mv_ref_counts[mv_contz][blockmode - LEFT4X4]++;
switch (blockmode) {
case NEW4X4:
case NEWMV:
decode_mv(r, &blockmv.as_mv, &best_mv.as_mv, nmvc,
&cm->fc.NMVcount, xd->allow_high_precision_mv);
......@@ -712,23 +703,23 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
vp9_mv_cont_count[mv_contz][3]++;
#endif
break;
case LEFT4X4:
blockmv.as_int = leftmv.as_int;
case NEARESTMV:
blockmv.as_int = nearest.as_int;
if (mbmi->second_ref_frame > 0)
secondmv.as_int = second_leftmv.as_int;
secondmv.as_int = nearest_second.as_int;
#ifdef VPX_MODE_COUNT
vp9_mv_cont_count[mv_contz][0]++;
#endif
break;
case ABOVE4X4:
blockmv.as_int = abovemv.as_int;
case NEARMV:
blockmv.as_int = nearby.as_int;
if (mbmi->second_ref_frame > 0)
secondmv.as_int = second_abovemv.as_int;
secondmv.as_int = nearby_second.as_int;
#ifdef VPX_MODE_COUNT
vp9_mv_cont_count[mv_contz][1]++;
#endif
break;
case ZERO4X4:
case ZEROMV:
blockmv.as_int = 0;
if (mbmi->second_ref_frame > 0)
secondmv.as_int = 0;
......
......@@ -828,7 +828,6 @@ static void update_frame_context(FRAME_CONTEXT *fc) {
vp9_copy(fc->pre_sb_ymode_prob, fc->sb_ymode_prob);
vp9_copy(fc->pre_uv_mode_prob, fc->uv_mode_prob);
vp9_copy(fc->pre_bmode_prob, fc->bmode_prob);
vp9_copy(fc->pre_sub_mv_ref_prob, fc->sub_mv_ref_prob);
vp9_copy(fc->pre_partition_prob, fc->partition_prob);
fc->pre_nmvc = fc->nmvc;
......@@ -841,7 +840,6 @@ static void update_frame_context(FRAME_CONTEXT *fc) {
vp9_zero(fc->sb_ymode_counts);
vp9_zero(fc->uv_mode_counts);
vp9_zero(fc->bmode_counts);
vp9_zero(fc->sub_mv_ref_counts);
vp9_zero(fc->NMVcount);
vp9_zero(fc->mv_ref_ct);
vp9_zero(fc->partition_counts);
......
......@@ -543,16 +543,6 @@ static void write_sb_mv_ref(vp9_writer *bc, MB_PREDICTION_MODE m,
vp9_sb_mv_ref_encoding_array - NEARESTMV + m);
}
static void write_sub_mv_ref(vp9_writer *bc, B_PREDICTION_MODE m,
const vp9_prob *p) {
#if CONFIG_DEBUG
assert(LEFT4X4 <= m && m <= NEW4X4);
#endif
write_token(bc, vp9_sub_mv_ref_tree, p,
vp9_sub_mv_ref_encoding_array - LEFT4X4 + m);
}
// This function writes the current macro block's segnment id to the bitstream
// It should only be called if a segment map update is indicated.
static void write_mb_segid(vp9_writer *bc,
......@@ -668,7 +658,6 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
const nmv_context *nmvc = &pc->fc.nmvc;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
const int mis = pc->mode_info_stride;
MB_MODE_INFO *const mi = &m->mbmi;
const MV_REFERENCE_FRAME rf = mi->ref_frame;
const MB_PREDICTION_MODE mode = mi->mode;
......@@ -781,11 +770,8 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
break;
case SPLITMV: {
int j;
B_PREDICTION_MODE blockmode;
MB_PREDICTION_MODE blockmode;
int_mv blockmv;
int k = -1; /* first block in subset j */
int mv_contz;
int_mv leftmv, abovemv;
int bwl = b_width_log2(mi->sb_type), bw = 1 << bwl;
int bhl = b_height_log2(mi->sb_type), bh = 1 << bhl;
int idx, idy;
......@@ -794,15 +780,9 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
j = idy * 2 + idx;
blockmode = cpi->mb.partition_info->bmi[j].mode;
blockmv = cpi->mb.partition_info->bmi[j].mv;
k = j;
leftmv.as_int = left_block_mv(xd, m, k);
abovemv.as_int = above_block_mv(m, k, mis);
mv_contz = vp9_mv_cont(&leftmv, &abovemv);
write_sub_mv_ref(bc, blockmode,
cpi->common.fc.sub_mv_ref_prob[mv_contz]);
cpi->sub_mv_ref_count[mv_contz][blockmode - LEFT4X4]++;
if (blockmode == NEW4X4) {
write_sb_mv_ref(bc, blockmode, mv_ref_p);
vp9_accum_mv_refs(&cpi->common, blockmode, mi->mb_mode_context[rf]);
if (blockmode == NEWMV) {
#ifdef ENTROPY_STATS
active_section = 11;
#endif
......@@ -1738,10 +1718,8 @@ void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, unsigned long *size) {
vp9_copy(cpi->common.fc.pre_ymode_prob, cpi->common.fc.ymode_prob);
vp9_copy(cpi->common.fc.pre_uv_mode_prob, cpi->common.fc.uv_mode_prob);
vp9_copy(cpi->common.fc.pre_bmode_prob, cpi->common.fc.bmode_prob);
vp9_copy(cpi->common.fc.pre_sub_mv_ref_prob, cpi->common.fc.sub_mv_ref_prob);
vp9_copy(cpi->common.fc.pre_partition_prob, cpi->common.fc.partition_prob);
cpi->common.fc.pre_nmvc = cpi->common.fc.nmvc;
vp9_zero(cpi->sub_mv_ref_count);
vp9_zero(cpi->common.fc.mv_ref_ct);
update_coef_probs(cpi, &header_bc);
......
......@@ -26,7 +26,7 @@ typedef struct {
typedef struct {
int count;
struct {
B_PREDICTION_MODE mode;
MB_PREDICTION_MODE mode;
int_mv mv;
int_mv second_mv;
} bmi[4];
......
......@@ -1093,7 +1093,6 @@ static void init_encode_frame_mb_context(VP9_COMP *cpi) {
vp9_zero(cpi->bmode_count)
vp9_zero(cpi->ymode_count)
vp9_zero(cpi->y_uv_mode_count)
vp9_zero(cpi->sub_mv_ref_count)
vp9_zero(cpi->common.fc.mv_ref_ct)
vp9_zero(cpi->sb_ymode_cou