]> granicus.if.org Git - libvpx/commitdiff
Sync ref-mv experiment between aom and nextgenv2
authorJingning Han <jingning@google.com>
Mon, 3 Oct 2016 14:21:27 +0000 (07:21 -0700)
committerJingning Han <jingning@google.com>
Mon, 3 Oct 2016 16:02:20 +0000 (09:02 -0700)
Change-Id: I134d276234b3b8aa7df1ab647892b5d739647f4c

av1/common/entropymv.c
av1/common/entropymv.h
av1/decoder/decodeframe.c
av1/decoder/decodemv.c
av1/encoder/block.h
av1/encoder/encodemv.c
av1/encoder/rd.c

index b1547ef388babf2d3aa4d28321332f823fc6c182..34918b3c1c37d998fb5aa4883aefc4ba993bf5de 100644 (file)
@@ -42,12 +42,7 @@ const aom_tree_index av1_mv_fp_tree[TREE_SIZE(MV_FP_SIZE)] = { -0, 2,  -1,
                                                                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 @@ static void inc_mv_component(int v, nmv_component_counts *comp_counts, int incr,
 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 @@ void av1_adapt_mv_probs(AV1_COMMON *cm, int allow_hp) {
 
     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];
index f1d997d0a5afe183c053d1f45af1cb228619e363..f97dd85c37a18d4bcf93c61c398cb449e0517836 100644 (file)
@@ -95,9 +95,6 @@ typedef struct {
 
 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 {
 
 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;
 
index d54035e9320f04bab22c6e39eb4c8ed7dfbae77b..52c5da428ab1a218e22cd4c59a7de1b4015fd21e 100644 (file)
@@ -197,10 +197,6 @@ static void read_mv_probs(nmv_context *ctx, int allow_hp, aom_reader *r) {
 
   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);
index c6152e3bbcb3737c358fbe647908dfb6d1bfa63c..dab1008db74cdfc4cd86a366d69a0edb33075017 100644 (file)
@@ -686,35 +686,12 @@ static int read_mv_component(aom_reader *r, const nmv_component *mvcomp,
 }
 
 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 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
                         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 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
                         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 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
                                 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 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
       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 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
       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 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
                                 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,
index e3b4e373428a18d01f4b7249fd7a5021b283c03e..2156032d9645e1073a5c0d797b7570a687fd345e 100644 (file)
@@ -116,8 +116,6 @@ struct macroblock {
   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];
index bcd9b11c0264204896bc8eaa6d268dd35219abf2..13c8d8741e67c27bc05052851f53bb5cd89d3b07 100644 (file)
@@ -164,8 +164,6 @@ void av1_write_nmv_probs(AV1_COMMON *cm, int usehp, aom_writer *w,
     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 @@ void av1_encode_mv(AV1_COMP *cpi, aom_writer *w, const MV *mv, const MV *ref,
   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);
index 4d157ff7c58f0c07583c0ba627a25ec28b7d944a..007f9920d3f9efdfee2fbf110fc1faddb12e441c 100644 (file)
@@ -346,9 +346,6 @@ void av1_set_mvcost(MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame, int ref,
   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 @@ void av1_initialize_rd_consts(AV1_COMP *cpi) {
     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];