summaryrefslogtreecommitdiff
path: root/vp8
diff options
context:
space:
mode:
Diffstat (limited to 'vp8')
-rw-r--r--vp8/common/findnearmv.c11
-rw-r--r--vp8/decoder/decodemv.c6
-rw-r--r--vp8/encoder/rdopt.c5
-rw-r--r--vp8/encoder/tokenize.c9
4 files changed, 26 insertions, 5 deletions
diff --git a/vp8/common/findnearmv.c b/vp8/common/findnearmv.c
index 1087ee4f8..05789aff2 100644
--- a/vp8/common/findnearmv.c
+++ b/vp8/common/findnearmv.c
@@ -202,7 +202,9 @@ vp8_prob *vp8_mv_ref_probs(VP8_COMMON *pc,
void vp8_find_best_ref_mvs(MACROBLOCKD *xd,
unsigned char *ref_y_buffer,
int ref_y_stride,
- int_mv *best_mv){
+ int_mv *best_mv,
+ int_mv *nearest,
+ int_mv *near) {
int_mv *ref_mv = xd->ref_mv;
int bestsad = INT_MAX;
int i;
@@ -259,6 +261,13 @@ void vp8_find_best_ref_mvs(MACROBLOCKD *xd,
lower_mv_precision(best_mv);
vp8_clamp_mv2(best_mv, xd);
+
+ if (best_mv->as_int != 0 &&
+ (best_mv->as_mv.row >> 3) != (nearest->as_mv.row >>3 ) &&
+ (best_mv->as_mv.col >> 3) != (nearest->as_mv.col >>3 )) {
+ near->as_int = nearest->as_int;
+ nearest->as_int = best_mv->as_int;
+ }
}
#endif
diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c
index f8cf83799..f8efd4199 100644
--- a/vp8/decoder/decodemv.c
+++ b/vp8/decoder/decodemv.c
@@ -653,7 +653,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
vp8_find_best_ref_mvs(xd,
xd->pre.y_buffer,
recon_y_stride,
- &best_mv);
+ &best_mv, &nearest, &nearby);
}
#endif
@@ -732,7 +732,9 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
vp8_find_best_ref_mvs(xd,
xd->second_pre.y_buffer,
recon_y_stride,
- &best_mv_second);
+ &best_mv_second,
+ &nearest_second,
+ &nearby_second);
}
#else
vp8_find_near_mvs(xd, mi, prev_mi,
diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
index 468955022..df5fa2ede 100644
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -2652,7 +2652,10 @@ void setup_buffer_inter(VP8_COMP *cpi, MACROBLOCK *x, int idx, int frame_type,
v_buffer[frame_type] = yv12->v_buffer + recon_uvoffset;
#if CONFIG_NEWBESTREFMV
vp8_find_best_ref_mvs(&x->e_mbd, y_buffer[frame_type],
- yv12->y_stride, &frame_best_ref_mv[frame_type]);
+ yv12->y_stride,
+ &frame_best_ref_mv[frame_type],
+ &frame_nearest_mv[frame_type],
+ &frame_near_mv[frame_type]);
ref_mv[frame_type].as_int = frame_best_ref_mv[frame_type].as_int;
#endif
}
diff --git a/vp8/encoder/tokenize.c b/vp8/encoder/tokenize.c
index a8b6436ef..9b848f3d5 100644
--- a/vp8/encoder/tokenize.c
+++ b/vp8/encoder/tokenize.c
@@ -1311,6 +1311,7 @@ void vp8_stuff_mb_8x8(VP8_COMP *cpi,
ENTROPY_CONTEXT *L = (ENTROPY_CONTEXT *)x->left_context;
int plane_type;
int b;
+ TOKENEXTRA *t_backup = *t;
stuff2nd_order_b_8x8(x->block + 24, t, 1, x->frame_type,
A + vp8_block2above_8x8[24],
@@ -1334,6 +1335,8 @@ void vp8_stuff_mb_8x8(VP8_COMP *cpi,
*(A + vp8_block2above_8x8[b] + 1) = *(A + vp8_block2above_8x8[b]);
*(L + vp8_block2left_8x8[b] + 1) = *(L + vp8_block2left_8x8[b]);
}
+ if (dry_run)
+ *t = t_backup;
}
@@ -1370,6 +1373,7 @@ void vp8_stuff_mb_16x16(VP8_COMP *cpi,
ENTROPY_CONTEXT * A = (ENTROPY_CONTEXT *)x->above_context;
ENTROPY_CONTEXT * L = (ENTROPY_CONTEXT *)x->left_context;
int b, i;
+ TOKENEXTRA *t_backup = *t;
stuff1st_order_b_16x16(x->block, t, x->frame_type, A, L, cpi, dry_run);
for (i = 1; i < 16; i++) {
@@ -1386,6 +1390,8 @@ void vp8_stuff_mb_16x16(VP8_COMP *cpi,
}
vpx_memset(&A[8], 0, sizeof(A[8]));
vpx_memset(&L[8], 0, sizeof(L[8]));
+ if (dry_run)
+ *t = t_backup;
}
#endif
@@ -1456,7 +1462,8 @@ void stuff1st_order_buv
*a = *l = pt;
}
-void vp8_stuff_mb(VP8_COMP *cpi, MACROBLOCKD *x, TOKENEXTRA **t, int dry_run) {
+void vp8_stuff_mb(VP8_COMP *cpi, MACROBLOCKD *x,
+ TOKENEXTRA **t, int dry_run) {
ENTROPY_CONTEXT *A = (ENTROPY_CONTEXT *)x->above_context;
ENTROPY_CONTEXT *L = (ENTROPY_CONTEXT *)x->left_context;
int plane_type;