Using array of motion vectors instead of separate variables.

Change-Id: I7380a089105f658257bbb3e30a525da168e76952
This commit is contained in:
Dmitry Kovalev 2013-09-30 12:11:46 -07:00
parent 1a9d4fedf3
commit c151bdd412

View File

@ -418,8 +418,7 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
const BLOCK_SIZE bsize = mbmi->sb_type; const BLOCK_SIZE bsize = mbmi->sb_type;
const int allow_hp = xd->allow_high_precision_mv; const int allow_hp = xd->allow_high_precision_mv;
int_mv nearest, nearby, best_mv; int_mv nearest[2], near[2], best[2];
int_mv nearest_second, nearby_second, best_mv_second;
uint8_t inter_mode_ctx; uint8_t inter_mode_ctx;
MV_REFERENCE_FRAME ref0; MV_REFERENCE_FRAME ref0;
int is_compound; int is_compound;
@ -444,8 +443,8 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
// nearest, nearby // nearest, nearby
if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) { if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) {
vp9_find_best_ref_mvs(xd, mbmi->ref_mvs[ref0], &nearest, &nearby); vp9_find_best_ref_mvs(xd, mbmi->ref_mvs[ref0], &nearest[0], &near[0]);
best_mv.as_int = mbmi->ref_mvs[ref0][0].as_int; best[0].as_int = nearest[0].as_int;
} }
if (is_compound) { if (is_compound) {
@ -454,9 +453,8 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
ref1, mbmi->ref_mvs[ref1], mi_row, mi_col); ref1, mbmi->ref_mvs[ref1], mi_row, mi_col);
if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) { if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) {
vp9_find_best_ref_mvs(xd, mbmi->ref_mvs[ref1], vp9_find_best_ref_mvs(xd, mbmi->ref_mvs[ref1], &nearest[1], &near[1]);
&nearest_second, &nearby_second); best[1].as_int = nearest[1].as_int;
best_mv_second.as_int = mbmi->ref_mvs[ref1][0].as_int;
} }
} }
@ -471,50 +469,48 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
int b_mode; int b_mode;
for (idy = 0; idy < 2; idy += num_4x4_h) { for (idy = 0; idy < 2; idy += num_4x4_h) {
for (idx = 0; idx < 2; idx += num_4x4_w) { for (idx = 0; idx < 2; idx += num_4x4_w) {
int_mv blockmv, secondmv; int_mv block[2];
const int j = idy * 2 + idx; const int j = idy * 2 + idx;
b_mode = read_inter_mode(cm, r, inter_mode_ctx); b_mode = read_inter_mode(cm, r, inter_mode_ctx);
if (b_mode == NEARESTMV || b_mode == NEARMV) { if (b_mode == NEARESTMV || b_mode == NEARMV) {
vp9_append_sub8x8_mvs_for_idx(cm, xd, &nearest, &nearby, j, 0, vp9_append_sub8x8_mvs_for_idx(cm, xd, &nearest[0], &near[0], j, 0,
mi_row, mi_col); mi_row, mi_col);
if (is_compound) if (is_compound)
vp9_append_sub8x8_mvs_for_idx(cm, xd, &nearest_second, vp9_append_sub8x8_mvs_for_idx(cm, xd, &nearest[1], &near[1], j, 1,
&nearby_second, j, 1,
mi_row, mi_col); mi_row, mi_col);
} }
switch (b_mode) { switch (b_mode) {
case NEWMV: case NEWMV:
read_mv(r, &blockmv.as_mv, &best_mv.as_mv, nmvc, read_mv(r, &block[0].as_mv, &best[0].as_mv, nmvc, &cm->counts.mv,
&cm->counts.mv, allow_hp); allow_hp);
if (is_compound) if (is_compound)
read_mv(r, &secondmv.as_mv, &best_mv_second.as_mv, nmvc, read_mv(r, &block[1].as_mv, &best[1].as_mv, nmvc, &cm->counts.mv,
&cm->counts.mv, allow_hp); allow_hp);
break; break;
case NEARESTMV: case NEARESTMV:
blockmv.as_int = nearest.as_int; block[0].as_int = nearest[0].as_int;
if (is_compound) if (is_compound)
secondmv.as_int = nearest_second.as_int; block[1].as_int = nearest[1].as_int;
break; break;
case NEARMV: case NEARMV:
blockmv.as_int = nearby.as_int; block[0].as_int = near[0].as_int;
if (is_compound) if (is_compound)
secondmv.as_int = nearby_second.as_int; block[1].as_int = near[1].as_int;
break; break;
case ZEROMV: case ZEROMV:
blockmv.as_int = 0; block[0].as_int = 0;
if (is_compound) if (is_compound)
secondmv.as_int = 0; block[1].as_int = 0;
break; break;
default: default:
assert(!"Invalid inter mode value"); assert(!"Invalid inter mode value");
} }
mi->bmi[j].as_mv[0].as_int = blockmv.as_int; mi->bmi[j].as_mv[0].as_int = block[0].as_int;
if (is_compound) if (is_compound)
mi->bmi[j].as_mv[1].as_int = secondmv.as_int; mi->bmi[j].as_mv[1].as_int = block[1].as_int;
if (num_4x4_h == 2) if (num_4x4_h == 2)
mi->bmi[j + 2] = mi->bmi[j]; mi->bmi[j + 2] = mi->bmi[j];
@ -529,15 +525,15 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
} else { } else {
switch (mbmi->mode) { switch (mbmi->mode) {
case NEARMV: case NEARMV:
mv0->as_int = nearby.as_int; mv0->as_int = near[0].as_int;
if (is_compound) if (is_compound)
mv1->as_int = nearby_second.as_int; mv1->as_int = near[1].as_int;
break; break;
case NEARESTMV: case NEARESTMV:
mv0->as_int = nearest.as_int; mv0->as_int = nearest[0].as_int;
if (is_compound) if (is_compound)
mv1->as_int = nearest_second.as_int; mv1->as_int = nearest[1].as_int;
break; break;
case ZEROMV: case ZEROMV:
@ -547,9 +543,9 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
break; break;
case NEWMV: case NEWMV:
read_mv(r, &mv0->as_mv, &best_mv.as_mv, nmvc, &cm->counts.mv, allow_hp); read_mv(r, &mv0->as_mv, &best[0].as_mv, nmvc, &cm->counts.mv, allow_hp);
if (is_compound) if (is_compound)
read_mv(r, &mv1->as_mv, &best_mv_second.as_mv, nmvc, &cm->counts.mv, read_mv(r, &mv1->as_mv, &best[1].as_mv, nmvc, &cm->counts.mv,
allow_hp); allow_hp);
break; break;
default: default: