shithub: libvpx

Download patch

ref: b0ab51dc2bc9c84a25e5b0408b89f3d45bcde9ea
parent: 1669bde7610c6c94e379be1dfb610a0acd0dcd8c
parent: 62d33725ec0f2a46baa2e6a6c331de36b5e11033
author: Angie Chiang <angiebird@google.com>
date: Wed Apr 10 21:31:41 EDT 2019

Merge changes I9d315e35,Id48f2b65,I4e5ed327

* changes:
  Print mv_mode counts
  Adjust the probs in get_mv_mode_cost
  Add build_inter_mode_cost()

--- a/tools/non_greedy_mv/non_greedy_mv.py
+++ b/tools/non_greedy_mv/non_greedy_mv.py
@@ -177,4 +177,10 @@
     #axes[1][1].figure.colorbar(im, ax=axes[1][1])
 
     print rf_idx, frame_idx, ref_frame_idx, gf_frame_offset, ref_gf_frame_offset, len(mv_ls)
+
+    flatten_mv_mode = mv_mode_arr.flatten()
+    zero_mv_count = sum(flatten_mv_mode == 0);
+    new_mv_count = sum(flatten_mv_mode == 1);
+    ref_mv_count = sum(flatten_mv_mode == 2) + sum(flatten_mv_mode == 3);
+    print zero_mv_count, new_mv_count, ref_mv_count
     plt.show()
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -6291,9 +6291,9 @@
   // TODO(angiebird): The probabilities are roughly inferred from
   // default_inter_mode_probs. Check if there is a better way to set the
   // probabilities.
-  const int zero_mv_prob = 9;
-  const int new_mv_prob = 77;
-  const int ref_mv_prob = 170;
+  const int zero_mv_prob = 16;
+  const int new_mv_prob = 24 * 1;
+  const int ref_mv_prob = 256 - zero_mv_prob - new_mv_prob;
   assert(zero_mv_prob + new_mv_prob + ref_mv_prob == 256);
   switch (mv_mode) {
     case ZERO_MV_MODE: return vp9_prob_cost[zero_mv_prob]; break;
--- a/vp9/encoder/vp9_rd.c
+++ b/vp9/encoder/vp9_rd.c
@@ -309,6 +309,15 @@
   }
 }
 
+void vp9_build_inter_mode_cost(VP9_COMP *cpi) {
+  const VP9_COMMON *const cm = &cpi->common;
+  int i;
+  for (i = 0; i < INTER_MODE_CONTEXTS; ++i) {
+    vp9_cost_tokens((int *)cpi->inter_mode_cost[i], cm->fc->inter_mode_probs[i],
+                    vp9_inter_mode_tree);
+  }
+}
+
 void vp9_initialize_rd_consts(VP9_COMP *cpi) {
   VP9_COMMON *const cm = &cpi->common;
   MACROBLOCK *const x = &cpi->td.mb;
@@ -357,10 +366,7 @@
             x->nmvjointcost,
             cm->allow_high_precision_mv ? x->nmvcost_hp : x->nmvcost,
             &cm->fc->nmvc, cm->allow_high_precision_mv);
-
-        for (i = 0; i < INTER_MODE_CONTEXTS; ++i)
-          vp9_cost_tokens((int *)cpi->inter_mode_cost[i],
-                          cm->fc->inter_mode_probs[i], vp9_inter_mode_tree);
+        vp9_build_inter_mode_cost(cpi);
       }
     }
   }
--- a/vp9/encoder/vp9_rd.h
+++ b/vp9/encoder/vp9_rd.h
@@ -217,6 +217,8 @@
                                                 BLOCK_SIZE bs, int bd);
 #endif
 
+void vp9_build_inter_mode_cost(struct VP9_COMP *cpi);
+
 #ifdef __cplusplus
 }  // extern "C"
 #endif