Motion Mode & compound Type

Add motion mode and compound type to the inspector, and
make frame number use the internal frame counter to account
for frame count differences between showable and non showable
frames.

Change-Id: Id1bfed741243cc388c428becee3ef30ec433dabb
diff --git a/av1/decoder/inspection.c b/av1/decoder/inspection.c
index b993d90..14d6215 100644
--- a/av1/decoder/inspection.c
+++ b/av1/decoder/inspection.c
@@ -40,6 +40,7 @@
     ifd_clear(fd);
     ifd_init_mi_rc(fd, cm->mi_rows, cm->mi_cols);
   }
+  fd->frame_number = cm->current_video_frame;
   fd->show_frame = cm->show_frame;
   fd->frame_type = cm->frame_type;
   fd->base_qindex = cm->base_qindex;
@@ -85,6 +86,10 @@
       } else {
         mi->uv_mode = UV_MODE_INVALID;
       }
+
+      mi->motion_mode = mbmi->motion_mode;
+      mi->compound_type = mbmi->interinter_comp.type;
+
       // Block Size
       mi->sb_type = mbmi->sb_type;
       // Skip Flag
@@ -92,6 +97,7 @@
       mi->filter[0] = av1_extract_interp_filter(mbmi->interp_filters, 0);
       mi->filter[1] = av1_extract_interp_filter(mbmi->interp_filters, 1);
       mi->dual_filter_type = mi->filter[0] * 3 + mi->filter[1];
+
       // Transform
       // TODO(anyone): extract tx type info from mbmi->txk_type[].
 
diff --git a/av1/decoder/inspection.h b/av1/decoder/inspection.h
index ba1b8ac..51e6d19 100644
--- a/av1/decoder/inspection.h
+++ b/av1/decoder/inspection.h
@@ -50,6 +50,8 @@
   int16_t cfl_alpha_idx;
   int16_t cfl_alpha_sign;
   int16_t current_qindex;
+  int16_t compound_type;
+  int16_t motion_mode;
 };
 
 typedef struct insp_frame_data insp_frame_data;
@@ -59,6 +61,7 @@
   Accounting *accounting;
 #endif
   insp_mi_data *mi_grid;
+  int16_t frame_number;
   int show_frame;
   int frame_type;
   int base_qindex;
diff --git a/examples/inspect.c b/examples/inspect.c
index df55378..09766fa 100644
--- a/examples/inspect.c
+++ b/examples/inspect.c
@@ -60,7 +60,9 @@
   DUAL_FILTER_LAYER = 1 << 12,
   Q_INDEX_LAYER = 1 << 13,
   SEGMENT_ID_LAYER = 1 << 14,
-  ALL_LAYERS = (1 << 15) - 1
+  MOTION_MODE_LAYER = 1 << 15,
+  COMPOUND_TYPE_LAYER = 1 << 16,
+  ALL_LAYERS = (1 << 17) - 1
 } LayerType;
 
 static LayerType layers = 0;
@@ -84,6 +86,10 @@
 static const arg_def_t dump_transform_type_arg =
     ARG_DEF("tt", "transformType", 0, "Dump Transform Type");
 static const arg_def_t dump_mode_arg = ARG_DEF("m", "mode", 0, "Dump Mode");
+static const arg_def_t dump_motion_mode_arg =
+    ARG_DEF("mm", "motion_mode", 0, "Dump Motion Modes");
+static const arg_def_t dump_compound_type_arg =
+    ARG_DEF("ct", "compound_type", 0, "Dump Compound Types");
 static const arg_def_t dump_uv_mode_arg =
     ARG_DEF("uvm", "uv_mode", 0, "Dump UV Intra Prediction Modes");
 static const arg_def_t dump_skip_arg = ARG_DEF("s", "skip", 0, "Dump Skip");
@@ -113,6 +119,8 @@
                                         &dump_transform_type_arg,
                                         &dump_mode_arg,
                                         &dump_uv_mode_arg,
+                                        &dump_motion_mode_arg,
+                                        &dump_compound_type_arg,
                                         &dump_skip_arg,
                                         &dump_filter_arg,
                                         &dump_cdef_arg,
@@ -193,6 +201,15 @@
   ENUM(NEW_NEWMV),   ENUM(INTRA_INVALID), LAST_ENUM
 };
 
+const map_entry motion_mode_map[] = { ENUM(SIMPLE_TRANSLATION),
+                                      ENUM(OBMC_CAUSAL),    // 2-sided OBMC
+                                      ENUM(WARPED_CAUSAL),  // 2-sided WARPED
+                                      LAST_ENUM };
+
+const map_entry compound_type_map[] = { ENUM(COMPOUND_AVERAGE),
+                                        ENUM(COMPOUND_WEDGE),
+                                        ENUM(COMPOUND_DIFFWTD), LAST_ENUM };
+
 const map_entry uv_prediction_mode_map[] = {
   ENUM(UV_DC_PRED),       ENUM(UV_V_PRED),
   ENUM(UV_H_PRED),        ENUM(UV_D45_PRED),
@@ -523,6 +540,14 @@
     buf += put_block_info(buf, uv_prediction_mode_map, "uv_mode",
                           offsetof(insp_mi_data, uv_mode), 0);
   }
+  if (layers & MOTION_MODE_LAYER) {
+    buf += put_block_info(buf, motion_mode_map, "motion_mode",
+                          offsetof(insp_mi_data, motion_mode), 0);
+  }
+  if (layers & COMPOUND_TYPE_LAYER) {
+    buf += put_block_info(buf, compound_type_map, "compound_type",
+                          offsetof(insp_mi_data, compound_type), 0);
+  }
   if (layers & SKIP_LAYER) {
     buf +=
         put_block_info(buf, skip_map, "skip", offsetof(insp_mi_data, skip), 0);
@@ -563,7 +588,8 @@
     buf += put_accounting(buf);
   }
 #endif
-  buf += snprintf(buf, MAX_BUFFER, "  \"frame\": %d,\n", decoded_frame_count);
+  buf +=
+      snprintf(buf, MAX_BUFFER, "  \"frame\": %d,\n", frame_data.frame_number);
   buf += snprintf(buf, MAX_BUFFER, "  \"showFrame\": %d,\n",
                   frame_data.show_frame);
   buf += snprintf(buf, MAX_BUFFER, "  \"frameType\": %d,\n",
@@ -707,6 +733,10 @@
       layers |= MODE_LAYER;
     else if (arg_match(&arg, &dump_uv_mode_arg, argi))
       layers |= UV_MODE_LAYER;
+    else if (arg_match(&arg, &dump_motion_mode_arg, argi))
+      layers |= MOTION_MODE_LAYER;
+    else if (arg_match(&arg, &dump_compound_type_arg, argi))
+      layers |= COMPOUND_TYPE_LAYER;
     else if (arg_match(&arg, &dump_skip_arg, argi))
       layers |= SKIP_LAYER;
     else if (arg_match(&arg, &dump_filter_arg, argi))