summaryrefslogtreecommitdiff
path: root/vp8/decoder/decodemv.c
diff options
context:
space:
mode:
authorPaul Wilkins <paulwilkins@google.com>2012-10-26 09:42:37 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2012-10-26 09:42:37 -0700
commit7d921524d680b08ce5749fdbca4d8e68a433d64d (patch)
tree008516f2c6bc209826324a63447bf0629a6650d8 /vp8/decoder/decodemv.c
parent47fb14743dc05b77f8902bcff6580f5c3136b6af (diff)
parentba30e7746e49a63e9802ae1e86f106d5342ab181 (diff)
downloadlibvpx-7d921524d680b08ce5749fdbca4d8e68a433d64d.tar
libvpx-7d921524d680b08ce5749fdbca4d8e68a433d64d.tar.gz
libvpx-7d921524d680b08ce5749fdbca4d8e68a433d64d.tar.bz2
libvpx-7d921524d680b08ce5749fdbca4d8e68a433d64d.zip
Merge "Explicit MV reference experiment." into experimental
Diffstat (limited to 'vp8/decoder/decodemv.c')
-rw-r--r--vp8/decoder/decodemv.c74
1 files changed, 58 insertions, 16 deletions
diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c
index 0adc3333e..991fb9103 100644
--- a/vp8/decoder/decodemv.c
+++ b/vp8/decoder/decodemv.c
@@ -72,6 +72,23 @@ static void vp8_read_mb_segid(vp8_reader *r, MB_MODE_INFO *mi,
}
}
+#if CONFIG_NEW_MVREF
+int vp8_read_mv_ref_id(vp8_reader *r,
+ vp8_prob * ref_id_probs) {
+ int ref_index = 0;
+
+ if (vp8_read(r, ref_id_probs[0])) {
+ ref_index++;
+ if (vp8_read(r, ref_id_probs[1])) {
+ ref_index++;
+ if (vp8_read(r, ref_id_probs[2]))
+ ref_index++;
+ }
+ }
+ return ref_index;
+}
+#endif
+
extern const int vp8_i8x8_block[4];
static void kfread_modes(VP8D_COMP *pbi,
MODE_INFO *m,
@@ -530,6 +547,12 @@ static void mb_mode_mv_init(VP8D_COMP *pbi, vp8_reader *bc) {
cm->fc.ymode_prob[i] = (vp8_prob) vp8_read_literal(bc, 8);
} while (++i < VP8_YMODES - 1);
}
+
+#if CONFIG_NEW_MVREF
+ // Temp defaults probabilities for ecnoding the MV ref id signal
+ vpx_memset(xd->mb_mv_ref_id_probs, 192, sizeof(xd->mb_mv_ref_id_probs));
+#endif
+
read_nmvprobs(bc, nmvc, xd->allow_high_precision_mv);
}
}
@@ -708,13 +731,9 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
xd->pre.u_buffer = cm->yv12_fb[ref_fb_idx].u_buffer + recon_uvoffset;
xd->pre.v_buffer = cm->yv12_fb[ref_fb_idx].v_buffer + recon_uvoffset;
- // Update stats on relative distance of chosen vector to the
- // possible best reference vectors.
- {
- find_mv_refs(xd, mi, prev_mi,
- ref_frame, mbmi->ref_mvs[ref_frame],
- cm->ref_frame_sign_bias );
- }
+ find_mv_refs(xd, mi, prev_mi,
+ ref_frame, mbmi->ref_mvs[ref_frame],
+ cm->ref_frame_sign_bias);
vp8_find_best_ref_mvs(xd,
xd->pre.y_buffer,
@@ -799,15 +818,10 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
mbmi->second_ref_frame,
cm->ref_frame_sign_bias);
- // Update stats on relative distance of chosen vector to the
- // possible best reference vectors.
- {
- MV_REFERENCE_FRAME ref_frame = mbmi->second_ref_frame;
-
- find_mv_refs(xd, mi, prev_mi,
- ref_frame, mbmi->ref_mvs[ref_frame],
- cm->ref_frame_sign_bias );
- }
+ find_mv_refs(xd, mi, prev_mi,
+ mbmi->second_ref_frame,
+ mbmi->ref_mvs[mbmi->second_ref_frame],
+ cm->ref_frame_sign_bias);
vp8_find_best_ref_mvs(xd,
xd->second_pre.y_buffer,
@@ -977,11 +991,26 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
break;
case NEWMV:
+
+#if CONFIG_NEW_MVREF
+ {
+ int best_index;
+ MV_REFERENCE_FRAME ref_frame = mbmi->ref_frame;
+
+ // Encode the index of the choice.
+ best_index =
+ vp8_read_mv_ref_id(bc, xd->mb_mv_ref_id_probs[ref_frame]);
+
+ best_mv.as_int = mbmi->ref_mvs[ref_frame][best_index].as_int;
+ }
+#endif
+
read_nmv(bc, &mv->as_mv, &best_mv.as_mv, nmvc);
read_nmv_fp(bc, &mv->as_mv, &best_mv.as_mv, nmvc,
xd->allow_high_precision_mv);
vp8_increment_nmv(&mv->as_mv, &best_mv.as_mv, &cm->fc.NMVcount,
xd->allow_high_precision_mv);
+
mv->as_mv.row += best_mv.as_mv.row;
mv->as_mv.col += best_mv.as_mv.col;
@@ -995,7 +1024,20 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
mb_to_right_edge,
mb_to_top_edge,
mb_to_bottom_edge);
+
if (mbmi->second_ref_frame) {
+#if CONFIG_NEW_MVREF
+ {
+ int best_index;
+ MV_REFERENCE_FRAME ref_frame = mbmi->second_ref_frame;
+
+ // Encode the index of the choice.
+ best_index =
+ vp8_read_mv_ref_id(bc, xd->mb_mv_ref_id_probs[ref_frame]);
+ best_mv_second.as_int = mbmi->ref_mvs[ref_frame][best_index].as_int;
+ }
+#endif
+
read_nmv(bc, &mbmi->mv[1].as_mv, &best_mv_second.as_mv, nmvc);
read_nmv_fp(bc, &mbmi->mv[1].as_mv, &best_mv_second.as_mv, nmvc,
xd->allow_high_precision_mv);