summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vp9/common/vp9_findnearmv.c65
-rw-r--r--vp9/common/vp9_findnearmv.h6
-rw-r--r--vp9/decoder/vp9_decodemv.c4
-rw-r--r--vp9/encoder/vp9_rdopt.c8
4 files changed, 42 insertions, 41 deletions
diff --git a/vp9/common/vp9_findnearmv.c b/vp9/common/vp9_findnearmv.c
index ad97c0277..7cdf2c1c7 100644
--- a/vp9/common/vp9_findnearmv.c
+++ b/vp9/common/vp9_findnearmv.c
@@ -36,46 +36,49 @@ void vp9_find_best_ref_mvs(MACROBLOCKD *xd, int allow_hp,
void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd,
const TileInfo *const tile,
- int_mv *dst_nearest, int_mv *dst_near,
- int block_idx, int ref_idx,
- int mi_row, int mi_col) {
+ int block, int ref, int mi_row, int mi_col,
+ int_mv *nearest, int_mv *near) {
int_mv mv_list[MAX_MV_REF_CANDIDATES];
MODE_INFO *const mi = xd->mi_8x8[0];
b_mode_info *bmi = mi->bmi;
int n;
- assert(ref_idx == 0 || ref_idx == 1);
assert(MAX_MV_REF_CANDIDATES == 2);
- vp9_find_mv_refs_idx(cm, xd, tile, mi, xd->last_mi,
- mi->mbmi.ref_frame[ref_idx],
- mv_list, block_idx, mi_row, mi_col);
+ vp9_find_mv_refs_idx(cm, xd, tile, mi, xd->last_mi, mi->mbmi.ref_frame[ref],
+ mv_list, block, mi_row, mi_col);
- dst_near->as_int = 0;
- if (block_idx == 0) {
- dst_nearest->as_int = mv_list[0].as_int;
- dst_near->as_int = mv_list[1].as_int;
- } else if (block_idx == 1 || block_idx == 2) {
- dst_nearest->as_int = bmi[0].as_mv[ref_idx].as_int;
- for (n = 0; n < MAX_MV_REF_CANDIDATES; ++n)
- if (dst_nearest->as_int != mv_list[n].as_int) {
- dst_near->as_int = mv_list[n].as_int;
- break;
- }
- } else {
- int_mv candidates[2 + MAX_MV_REF_CANDIDATES];
- candidates[0] = bmi[1].as_mv[ref_idx];
- candidates[1] = bmi[0].as_mv[ref_idx];
- candidates[2] = mv_list[0];
- candidates[3] = mv_list[1];
+ near->as_int = 0;
+ switch (block) {
+ case 0:
+ nearest->as_int = mv_list[0].as_int;
+ near->as_int = mv_list[1].as_int;
+ break;
+ case 1:
+ case 2:
+ nearest->as_int = bmi[0].as_mv[ref].as_int;
+ for (n = 0; n < MAX_MV_REF_CANDIDATES; ++n)
+ if (nearest->as_int != mv_list[n].as_int) {
+ near->as_int = mv_list[n].as_int;
+ break;
+ }
+ break;
+ case 3: {
+ int_mv candidates[2 + MAX_MV_REF_CANDIDATES];
+ candidates[0] = bmi[1].as_mv[ref];
+ candidates[1] = bmi[0].as_mv[ref];
+ candidates[2] = mv_list[0];
+ candidates[3] = mv_list[1];
- assert(block_idx == 3);
- dst_nearest->as_int = bmi[2].as_mv[ref_idx].as_int;
- for (n = 0; n < 2 + MAX_MV_REF_CANDIDATES; ++n) {
- if (dst_nearest->as_int != candidates[n].as_int) {
- dst_near->as_int = candidates[n].as_int;
- break;
- }
+ nearest->as_int = bmi[2].as_mv[ref].as_int;
+ for (n = 0; n < 2 + MAX_MV_REF_CANDIDATES; ++n)
+ if (nearest->as_int != candidates[n].as_int) {
+ near->as_int = candidates[n].as_int;
+ break;
+ }
+ break;
}
+ default:
+ assert("Invalid block index.");
}
}
diff --git a/vp9/common/vp9_findnearmv.h b/vp9/common/vp9_findnearmv.h
index e9d4e1171..5028af77c 100644
--- a/vp9/common/vp9_findnearmv.h
+++ b/vp9/common/vp9_findnearmv.h
@@ -36,9 +36,7 @@ static void clamp_mv2(MV *mv, const MACROBLOCKD *xd) {
void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd,
const TileInfo *const tile,
- int_mv *dst_nearest,
- int_mv *dst_near,
- int block_idx, int ref_idx,
- int mi_row, int mi_col);
+ int block, int ref, int mi_row, int mi_col,
+ int_mv *nearest, int_mv *near);
#endif // VP9_COMMON_VP9_FINDNEARMV_H_
diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c
index 164576d0c..6b2d39362 100644
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -475,8 +475,8 @@ static void read_inter_block_mode_info(VP9_COMMON *const cm,
if (b_mode == NEARESTMV || b_mode == NEARMV)
for (ref = 0; ref < 1 + is_compound; ++ref)
- vp9_append_sub8x8_mvs_for_idx(cm, xd, tile, &nearest[ref],
- &nearmv[ref], j, ref, mi_row, mi_col);
+ vp9_append_sub8x8_mvs_for_idx(cm, xd, tile, j, ref, mi_row, mi_col,
+ &nearest[ref], &nearmv[ref]);
if (!assign_mv(cm, b_mode, block, best, nearest, nearmv,
is_compound, allow_hp, r)) {
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 274ced1f1..7d5fbd9cb 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1669,15 +1669,15 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
frame_mv[ZEROMV][mbmi->ref_frame[0]].as_int = 0;
vp9_append_sub8x8_mvs_for_idx(&cpi->common, &x->e_mbd, tile,
+ i, 0, mi_row, mi_col,
&frame_mv[NEARESTMV][mbmi->ref_frame[0]],
- &frame_mv[NEARMV][mbmi->ref_frame[0]],
- i, 0, mi_row, mi_col);
+ &frame_mv[NEARMV][mbmi->ref_frame[0]]);
if (has_second_rf) {
frame_mv[ZEROMV][mbmi->ref_frame[1]].as_int = 0;
vp9_append_sub8x8_mvs_for_idx(&cpi->common, &x->e_mbd, tile,
+ i, 1, mi_row, mi_col,
&frame_mv[NEARESTMV][mbmi->ref_frame[1]],
- &frame_mv[NEARMV][mbmi->ref_frame[1]],
- i, 1, mi_row, mi_col);
+ &frame_mv[NEARMV][mbmi->ref_frame[1]]);
}
// search for the best motion vector on this segment
for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode) {