Fix inconsistent use of ref_mv_idx.
"+ 1" has been added in a few locations to match the indices for the
context for the CDFs and the motion vectors.
Suggested fix (of removing +1s entirely) can then be implemented
without further affecting the overall behaviour of the encoder and
decoder.
BUG=aomedia:858
Change-Id: I650a618d3fda1d27bd3550d25ad1ac52e4365061
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 8afb572..b96a0ca 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -1453,18 +1453,18 @@
}
} else if (mode == NEAREST_NEWMV || mode == NEAR_NEWMV) {
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
- int nmv_ctx =
- av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
- mbmi_ext->ref_mv_stack[rf_type], 1, mbmi->ref_mv_idx);
+ int nmv_ctx = av1_nmv_ctx(
+ mbmi_ext->ref_mv_count[rf_type], mbmi_ext->ref_mv_stack[rf_type], 1,
+ mbmi->ref_mv_idx + (mode == NEAR_NEWMV ? 1 : 0));
nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx];
av1_encode_mv(cpi, w, &mbmi->mv[1].as_mv,
&mbmi_ext->ref_mvs[mbmi->ref_frame[1]][0].as_mv, nmvc,
allow_hp);
} else if (mode == NEW_NEARESTMV || mode == NEW_NEARMV) {
int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame);
- int nmv_ctx =
- av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
- mbmi_ext->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx);
+ int nmv_ctx = av1_nmv_ctx(
+ mbmi_ext->ref_mv_count[rf_type], mbmi_ext->ref_mv_stack[rf_type], 0,
+ mbmi->ref_mv_idx + (mode == NEW_NEARMV ? 1 : 0));
nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx];
av1_encode_mv(cpi, w, &mbmi->mv[0].as_mv,
&mbmi_ext->ref_mvs[mbmi->ref_frame[0]][0].as_mv, nmvc,