Moving MVcount to macroblock struct
Change-Id: Ie22841d096f3c86694b95bd06fc3a8ce1f032a10
diff --git a/vp8/encoder/block.h b/vp8/encoder/block.h
index 1e475b8..d5496a7 100644
--- a/vp8/encoder/block.h
+++ b/vp8/encoder/block.h
@@ -129,6 +129,7 @@
int skip_true_count;
unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
+ unsigned int MVcount [2] [MVvals]; /* (row,col) MV cts this frame */
int ymode_count [VP8_YMODES]; /* intra MB type cts this frame */
int uv_mode_count[VP8_UV_MODES]; /* intra MB type cts this frame */
diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c
index f99bdb3..6364f7d 100644
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -762,7 +762,7 @@
xd->mode_info_context = cm->mi;
- vp8_zero(cpi->MVcount);
+ vp8_zero(cpi->mb.MVcount);
vp8cx_frame_init_quantizer(cpi);
@@ -868,6 +868,7 @@
for (i = 0; i < cpi->encoding_thread_count; i++)
{
int mode_count;
+ int mv_vals;
totalrate += cpi->mb_row_ei[i].totalrate;
cpi->mb.skip_true_count += cpi->mb_row_ei[i].mb.skip_true_count;
@@ -880,6 +881,13 @@
cpi->mb.uv_mode_count[mode_count] +=
cpi->mb_row_ei[i].mb.uv_mode_count[mode_count];
+ for(mv_vals = 0; mv_vals < MVvals; mv_vals++)
+ {
+ cpi->mb.MVcount[0][mv_vals] +=
+ cpi->mb_row_ei[i].mb.MVcount[0][mv_vals];
+ cpi->mb.MVcount[1][mv_vals] +=
+ cpi->mb_row_ei[i].mb.MVcount[1][mv_vals];
+ }
/* add up counts for each thread */
sum_coef_counts(x, &cpi->mb_row_ei[i].mb);
diff --git a/vp8/encoder/encodemv.c b/vp8/encoder/encodemv.c
index 7d8c84d..0c43d06 100644
--- a/vp8/encoder/encodemv.c
+++ b/vp8/encoder/encodemv.c
@@ -363,10 +363,12 @@
active_section = 4;
#endif
write_component_probs(
- w, &mvc[0], &vp8_default_mv_context[0], &vp8_mv_update_probs[0], cpi->MVcount[0], 0, &flags[0]
+ w, &mvc[0], &vp8_default_mv_context[0], &vp8_mv_update_probs[0],
+ cpi->mb.MVcount[0], 0, &flags[0]
);
write_component_probs(
- w, &mvc[1], &vp8_default_mv_context[1], &vp8_mv_update_probs[1], cpi->MVcount[1], 1, &flags[1]
+ w, &mvc[1], &vp8_default_mv_context[1], &vp8_mv_update_probs[1],
+ cpi->mb.MVcount[1], 1, &flags[1]
);
if (flags[0] || flags[1])
diff --git a/vp8/encoder/ethreading.c b/vp8/encoder/ethreading.c
index 1ad6dab..81fbe52 100644
--- a/vp8/encoder/ethreading.c
+++ b/vp8/encoder/ethreading.c
@@ -475,6 +475,7 @@
vp8_zero(mb->coef_counts);
vp8_zero(x->ymode_count);
mb->skip_true_count = 0;
+ vp8_zero(mb->MVcount);
}
}
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index f38bf89..395287d 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -452,8 +452,6 @@
int drop_frames_allowed; /* Are we permitted to drop frames? */
int drop_frame; /* Drop this frame? */
- unsigned int MVcount [2] [MVvals]; /* (row,col) MV cts this frame */
-
vp8_prob frame_coef_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
char update_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [ENTROPY_NODES];
diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c
index f894d39..3f09a9f 100644
--- a/vp8/encoder/pickinter.c
+++ b/vp8/encoder/pickinter.c
@@ -389,15 +389,16 @@
}
-static void update_mvcount(VP8_COMP *cpi, MACROBLOCKD *xd, int_mv *best_ref_mv)
+static void update_mvcount(VP8_COMP *cpi, MACROBLOCK *x, int_mv *best_ref_mv)
{
+ MACROBLOCKD *xd = &x->e_mbd;
/* Split MV modes currently not supported when RD is nopt enabled,
* therefore, only need to modify MVcount in NEWMV mode. */
if (xd->mode_info_context->mbmi.mode == NEWMV)
{
- cpi->MVcount[0][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.row -
+ x->MVcount[0][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.row -
best_ref_mv->as_mv.row) >> 1)]++;
- cpi->MVcount[1][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.col -
+ x->MVcount[1][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.col -
best_ref_mv->as_mv.col) >> 1)]++;
}
}
@@ -1240,7 +1241,7 @@
!= cpi->common.ref_frame_sign_bias[xd->mode_info_context->mbmi.ref_frame])
best_ref_mv.as_int = best_ref_mv_sb[!sign_bias].as_int;
- update_mvcount(cpi, &x->e_mbd, &best_ref_mv);
+ update_mvcount(cpi, x, &best_ref_mv);
}
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index 0dda240..7d80606 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -1738,18 +1738,18 @@
{
if (x->partition_info->bmi[i].mode == NEW4X4)
{
- cpi->MVcount[0][mv_max+((x->partition_info->bmi[i].mv.as_mv.row
+ x->MVcount[0][mv_max+((x->partition_info->bmi[i].mv.as_mv.row
- best_ref_mv->as_mv.row) >> 1)]++;
- cpi->MVcount[1][mv_max+((x->partition_info->bmi[i].mv.as_mv.col
+ x->MVcount[1][mv_max+((x->partition_info->bmi[i].mv.as_mv.col
- best_ref_mv->as_mv.col) >> 1)]++;
}
}
}
else if (x->e_mbd.mode_info_context->mbmi.mode == NEWMV)
{
- cpi->MVcount[0][mv_max+((x->e_mbd.mode_info_context->mbmi.mv.as_mv.row
+ x->MVcount[0][mv_max+((x->e_mbd.mode_info_context->mbmi.mv.as_mv.row
- best_ref_mv->as_mv.row) >> 1)]++;
- cpi->MVcount[1][mv_max+((x->e_mbd.mode_info_context->mbmi.mv.as_mv.col
+ x->MVcount[1][mv_max+((x->e_mbd.mode_info_context->mbmi.mv.as_mv.col
- best_ref_mv->as_mv.col) >> 1)]++;
}
}