Sync ref-mv experiment between aom and nextgenv2
Change-Id: I134d276234b3b8aa7df1ab647892b5d739647f4c
diff --git a/av1/common/entropymv.c b/av1/common/entropymv.c
index b1547ef..34918b3 100644
--- a/av1/common/entropymv.c
+++ b/av1/common/entropymv.c
@@ -42,12 +42,7 @@
4, -2, -3 };
static const nmv_context default_nmv_context = {
-#if CONFIG_REF_MV
- { 1, 64, 96 },
- 128,
-#else
{ 32, 64, 96 },
-#endif
{ {
// Vertical component
128, // sign
@@ -175,11 +170,6 @@
void av1_inc_mv(const MV *mv, nmv_context_counts *counts, const int usehp) {
if (counts != NULL) {
const MV_JOINT_TYPE j = av1_get_mv_joint(mv);
-
-#if CONFIG_REF_MV
- ++counts->zero_rmv[j == MV_JOINT_ZERO];
- if (j == MV_JOINT_ZERO) return;
-#endif
++counts->joints[j];
if (mv_joint_vertical(j))
@@ -202,8 +192,6 @@
aom_tree_merge_probs(av1_mv_joint_tree, pre_fc->joints, counts->joints,
fc->joints);
- fc->zero_rmv = av1_mode_mv_merge_probs(pre_fc->zero_rmv, counts->zero_rmv);
-
for (i = 0; i < 2; ++i) {
nmv_component *comp = &fc->comps[i];
const nmv_component *pre_comp = &pre_fc->comps[i];
diff --git a/av1/common/entropymv.h b/av1/common/entropymv.h
index f1d997d..f97dd85 100644
--- a/av1/common/entropymv.h
+++ b/av1/common/entropymv.h
@@ -95,9 +95,6 @@
typedef struct {
aom_prob joints[MV_JOINTS - 1];
-#if CONFIG_REF_MV
- aom_prob zero_rmv;
-#endif
nmv_component comps[2];
} nmv_context;
@@ -124,9 +121,6 @@
typedef struct {
unsigned int joints[MV_JOINTS];
-#if CONFIG_REF_MV
- unsigned int zero_rmv[2];
-#endif
nmv_component_counts comps[2];
} nmv_context_counts;
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index d54035e..52c5da4 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -197,10 +197,6 @@
update_mv_probs(ctx->joints, MV_JOINTS - 1, r);
-#if CONFIG_REF_MV
- av1_diff_update_prob(r, &ctx->zero_rmv);
-#endif
-
for (i = 0; i < 2; ++i) {
nmv_component *const comp_ctx = &ctx->comps[i];
update_mv_probs(&comp_ctx->sign, 1, r);
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index c6152e3..dab1008 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -686,35 +686,12 @@
}
static INLINE void read_mv(aom_reader *r, MV *mv, const MV *ref,
-#if CONFIG_REF_MV
- int is_compound,
-#endif
const nmv_context *ctx, nmv_context_counts *counts,
int allow_hp) {
MV_JOINT_TYPE joint_type;
const int use_hp = allow_hp && av1_use_mv_hp(ref);
MV diff = { 0, 0 };
-
-#if CONFIG_REF_MV && !CONFIG_EXT_INTER
- if (is_compound) {
- int is_zero_rmv = aom_read(r, ctx->zero_rmv);
- if (is_zero_rmv) {
- joint_type = MV_JOINT_ZERO;
- } else {
- joint_type =
- (MV_JOINT_TYPE)aom_read_tree(r, av1_mv_joint_tree, ctx->joints);
- }
- } else {
- joint_type =
- (MV_JOINT_TYPE)aom_read_tree(r, av1_mv_joint_tree, ctx->joints);
- }
-#else
joint_type = (MV_JOINT_TYPE)aom_read_tree(r, av1_mv_joint_tree, ctx->joints);
-#endif
-
-#if CONFIG_REF_MV && CONFIG_EXT_INTER
- (void)is_compound;
-#endif
if (mv_joint_vertical(joint_type))
diff.row = read_mv_component(r, &ctx->comps[0], use_hp);
@@ -971,8 +948,8 @@
mbmi->ref_mv_idx);
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
- read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, is_compound,
- &cm->fc->nmvc[nmv_ctx], mv_counts, allow_hp);
+ read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, &cm->fc->nmvc[nmv_ctx],
+ mv_counts, allow_hp);
#else
read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, &cm->fc->nmvc, mv_counts,
allow_hp);
@@ -1038,8 +1015,8 @@
mbmi->ref_mv_idx);
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
- read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, is_compound,
- &cm->fc->nmvc[nmv_ctx], mv_counts, allow_hp);
+ read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, &cm->fc->nmvc[nmv_ctx],
+ mv_counts, allow_hp);
#else
read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, &cm->fc->nmvc, mv_counts,
allow_hp);
@@ -1080,8 +1057,8 @@
xd->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx);
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
- read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, is_compound,
- &cm->fc->nmvc[nmv_ctx], mv_counts, allow_hp);
+ read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &cm->fc->nmvc[nmv_ctx],
+ mv_counts, allow_hp);
#else
nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL;
read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &cm->fc->nmvc, mv_counts,
@@ -1101,8 +1078,8 @@
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
mv[0].as_int = nearest_mv[0].as_int;
- read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, is_compound,
- &cm->fc->nmvc[nmv_ctx], mv_counts, allow_hp);
+ read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, &cm->fc->nmvc[nmv_ctx],
+ mv_counts, allow_hp);
#else
nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL;
mv[0].as_int = nearest_mv[0].as_int;
@@ -1122,8 +1099,8 @@
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
mv[0].as_int = near_mv[0].as_int;
- read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, is_compound,
- &cm->fc->nmvc[nmv_ctx], mv_counts, allow_hp);
+ read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, &cm->fc->nmvc[nmv_ctx],
+ mv_counts, allow_hp);
#else
nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL;
mv[0].as_int = near_mv[0].as_int;
@@ -1143,8 +1120,8 @@
xd->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx);
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
- read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, is_compound,
- &cm->fc->nmvc[nmv_ctx], mv_counts, allow_hp);
+ read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &cm->fc->nmvc[nmv_ctx],
+ mv_counts, allow_hp);
#else
nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL;
read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &cm->fc->nmvc, mv_counts,
diff --git a/av1/encoder/block.h b/av1/encoder/block.h
index e3b4e37..2156032 100644
--- a/av1/encoder/block.h
+++ b/av1/encoder/block.h
@@ -116,8 +116,6 @@
int *nmvcost_hp[NMV_CONTEXTS][2];
int **mv_cost_stack[NMV_CONTEXTS];
int *nmvjointsadcost;
- int zero_rmv_cost[NMV_CONTEXTS][2];
- int comp_rmv_cost[2];
#else
int nmvjointcost[MV_JOINTS];
int *nmvcost[2];
diff --git a/av1/encoder/encodemv.c b/av1/encoder/encodemv.c
index bcd9b11..13c8d87 100644
--- a/av1/encoder/encodemv.c
+++ b/av1/encoder/encodemv.c
@@ -164,8 +164,6 @@
write_mv_update(av1_mv_joint_tree, mvc->joints, counts->joints, MV_JOINTS,
w);
- av1_cond_prob_diff_update(w, &mvc->zero_rmv, counts->zero_rmv);
-
for (i = 0; i < 2; ++i) {
nmv_component *comp = &mvc->comps[i];
nmv_component_counts *comp_counts = &counts->comps[i];
@@ -242,20 +240,9 @@
const MV diff = { mv->row - ref->row, mv->col - ref->col };
const MV_JOINT_TYPE j = av1_get_mv_joint(&diff);
usehp = usehp && av1_use_mv_hp(ref);
-
-#if CONFIG_REF_MV && !CONFIG_EXT_INTER
- if (is_compound) {
- aom_write(w, (j == MV_JOINT_ZERO), mvctx->zero_rmv);
- if (j == MV_JOINT_ZERO) return;
- } else {
- if (j == MV_JOINT_ZERO) assert(0);
- }
-#endif
-
-#if CONFIG_REF_MV && CONFIG_EXT_INTER
+#if CONFIG_REF_MV
(void)is_compound;
#endif
-
av1_write_token(w, av1_mv_joint_tree, mvctx->joints, &mv_joint_encodings[j]);
if (mv_joint_vertical(j))
encode_mv_component(w, diff.row, &mvctx->comps[0], usehp);
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index 4d157ff..007f992 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -346,9 +346,6 @@
x->nmvjointcost = x->nmv_vec_cost[nmv_ctx];
x->mvsadcost = x->mvcost;
x->nmvjointsadcost = x->nmvjointcost;
-
- x->nmv_vec_cost[nmv_ctx][MV_JOINT_ZERO] =
- x->zero_rmv_cost[nmv_ctx][1] - x->zero_rmv_cost[nmv_ctx][0];
}
#endif
@@ -372,21 +369,11 @@
int nmv_ctx;
for (nmv_ctx = 0; nmv_ctx < NMV_CONTEXTS; ++nmv_ctx) {
- aom_prob tmp_prob = cm->fc->nmvc[nmv_ctx].joints[MV_JOINT_ZERO];
- cm->fc->nmvc[nmv_ctx].joints[MV_JOINT_ZERO] = 1;
-
av1_build_nmv_cost_table(
x->nmv_vec_cost[nmv_ctx],
cm->allow_high_precision_mv ? x->nmvcost_hp[nmv_ctx]
: x->nmvcost[nmv_ctx],
&cm->fc->nmvc[nmv_ctx], cm->allow_high_precision_mv);
- cm->fc->nmvc[nmv_ctx].joints[MV_JOINT_ZERO] = tmp_prob;
-
- x->nmv_vec_cost[nmv_ctx][MV_JOINT_ZERO] = 0;
- x->zero_rmv_cost[nmv_ctx][0] =
- av1_cost_bit(cm->fc->nmvc[nmv_ctx].zero_rmv, 0);
- x->zero_rmv_cost[nmv_ctx][1] =
- av1_cost_bit(cm->fc->nmvc[nmv_ctx].zero_rmv, 1);
}
x->mvcost = x->mv_cost_stack[0];
x->nmvjointcost = x->nmv_vec_cost[0];