shithub: libvpx

Download patch

ref: 71b5897f39cb3c710840ae1297749c8758c8bd83
parent: e65f9e8bcef72711133b1ef7109856c9de05e8d1
parent: 4c6e284dc5726117893b113e0664d80f1443322d
author: Angie Chiang <angiebird@google.com>
date: Fri Sep 21 13:32:17 EDT 2018

Merge "Use different corner detection score"

--- a/tools/non_greedy_mv/non_greedy_mv.py
+++ b/tools/non_greedy_mv/non_greedy_mv.py
@@ -87,7 +87,7 @@
 def read_feature_score(fp, mv_rows, mv_cols):
   line = fp.readline()
   word_ls = line.split()
-  feature_score = np.array([float(v) for v in word_ls])
+  feature_score = np.array([math.log(float(v) + 1, 2) for v in word_ls])
   feature_score = feature_score.reshape(mv_rows, mv_cols)
   return feature_score
 
@@ -141,24 +141,30 @@
   filename = sys.argv[1]
   data_ls = read_dpl_stats_file(filename, frame_num=5)
   for frame_idx, mv_ls, img, ref, bs, feature_score in data_ls:
-    fig, axes = plt.subplots(1, 3)
+    fig, axes = plt.subplots(2, 2)
 
-    axes[0].imshow(img)
-    draw_mv_ls(axes[0], mv_ls)
-    draw_pred_block_ls(axes[0], mv_ls, bs, mode=0)
+    axes[0][0].imshow(img)
+    draw_mv_ls(axes[0][0], mv_ls)
+    draw_pred_block_ls(axes[0][0], mv_ls, bs, mode=0)
     #axes[0].grid(color='k', linestyle='-')
-    axes[0].set_ylim(img.shape[0], 0)
-    axes[0].set_xlim(0, img.shape[1])
+    axes[0][0].set_ylim(img.shape[0], 0)
+    axes[0][0].set_xlim(0, img.shape[1])
 
     if ref is not None:
-      axes[1].imshow(ref)
-      draw_mv_ls(axes[1], mv_ls, mode=1)
-      draw_pred_block_ls(axes[1], mv_ls, bs, mode=1)
+      axes[0][1].imshow(ref)
+      draw_mv_ls(axes[0][1], mv_ls, mode=1)
+      draw_pred_block_ls(axes[0][1], mv_ls, bs, mode=1)
       #axes[1].grid(color='k', linestyle='-')
-      axes[1].set_ylim(ref.shape[0], 0)
-      axes[1].set_xlim(0, ref.shape[1])
+      axes[0][1].set_ylim(ref.shape[0], 0)
+      axes[0][1].set_xlim(0, ref.shape[1])
 
-    axes[2].imshow(feature_score)
+    axes[1][0].imshow(feature_score)
+    feature_score_arr = feature_score.flatten()
+    feature_score_max = feature_score_arr.max()
+    feature_score_min = feature_score_arr.min()
+    step = (feature_score_max - feature_score_min) / 20.
+    feature_score_bins = np.arange(feature_score_min, feature_score_max, step)
+    axes[1][1].hist(feature_score_arr, bins=feature_score_bins)
 
     plt.show()
     print frame_idx, len(mv_ls)
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -5689,7 +5689,7 @@
   IxIx /= (rows - 1) * (cols - 1);
   IxIy /= (rows - 1) * (cols - 1);
   IyIy /= (rows - 1) * (cols - 1);
-  score = IxIx * IyIy - IxIy * IxIy - 0.04 * (IxIx + IyIy) * (IxIx + IyIy);
+  score = (IxIx * IyIy - IxIy * IxIy + 0.0001) / (IxIx + IyIy + 0.0001);
   return score;
 }
 #endif