]> granicus.if.org Git - libvpx/commitdiff
Add more coding staticstics tracker
authorJingning Han <jingning@google.com>
Wed, 29 Jul 2015 16:32:43 +0000 (09:32 -0700)
committerJingning Han <jingning@google.com>
Wed, 29 Jul 2015 17:31:47 +0000 (10:31 -0700)
Count the average sub-pixel motion vector, sub8x8 block, intra
prediction mode use case.

Change-Id: Idbccc67a7eb4d2447b02b1fc158fdc8a344c2f21

vp9/decoder/vp9_decodeframe.c
vp9/decoder/vp9_decodemv.c
vp9/decoder/vp9_decoder.h

index a0a2fb82a1ece5fb1dbf2254f89abe76cc494a2f..8002effeb09a5da273d1cf24e992d023853f980e 100644 (file)
@@ -760,6 +760,9 @@ static void decode_block(VP9Decoder *const pbi, MACROBLOCKD *const xd,
     struct intra_args arg = {xd, r, mbmi->segment_id};
     vp9_foreach_transformed_block(xd, bsize,
                                   predict_and_reconstruct_intra_block, &arg);
+#if CONFIG_INTERNAL_STATS
+    pbi->sub8x8_intra += less8x8;
+#endif
   } else {
     // Prediction
     dec_build_inter_predictors_sb(pbi, xd, mi_row, mi_col, bsize);
@@ -774,6 +777,10 @@ static void decode_block(VP9Decoder *const pbi, MACROBLOCKD *const xd,
     }
   }
 
+#if CONFIG_INTERNAL_STATS
+  pbi->sub8x8_inter += less8x8;
+#endif
+
   xd->corrupted |= vp9_reader_has_error(r);
 }
 
@@ -2016,9 +2023,15 @@ void vp9_decode_frame(VP9Decoder *pbi,
   vp9_zero(cm->counts);
 #if CONFIG_INTERNAL_STATS
   // Reset internal stats
-  pbi->total_block_in_8x8 = 0;
-  pbi->subpel_mc_block_in_4x4 = 0;
-  pbi->intra_block_in_8x8 = 0;
+  if (cm->current_video_frame == 0) {
+    pbi->total_block_in_8x8 = 0;
+    pbi->subpel_mc_block_in_4x4_h = 0;
+    pbi->subpel_mc_block_in_4x4_v = 0;
+    pbi->sub8x8_inter = 0;
+    pbi->sub8x8_intra = 0;
+    pbi->intra_block_in_8x8 = 0;
+    pbi->compound_inter_block_in_8x8 = 0;
+  }
 #endif
 
   xd->corrupted = 0;
@@ -2093,12 +2106,23 @@ void vp9_decode_frame(VP9Decoder *pbi,
   vp9_clear_system_state();
   {
     FILE *pf = fopen("frame_level_stats.stt", "a");
-    double subpel_mc = (double)pbi->subpel_mc_block_in_4x4 /
+    double subpel_mc_h = (double)pbi->subpel_mc_block_in_4x4_h /
+        (double)pbi->total_block_in_8x8;
+    double subpel_mc_v = (double)pbi->subpel_mc_block_in_4x4_v /
         (double)pbi->total_block_in_8x8;
     double intra_mode = (double)pbi->intra_block_in_8x8 /
         (double)pbi->total_block_in_8x8;
-    fprintf(pf, "frame index %d, sub-pel mc %7.3f\tintra mode%7.3f\n",
-            cm->current_video_frame, 25 * subpel_mc, 100 * intra_mode);
+    double compound_block = (double)pbi->compound_inter_block_in_8x8 /
+        (double)pbi->total_block_in_8x8;
+    double sub8x8_inter = (double)pbi->sub8x8_inter /
+        (double)pbi->total_block_in_8x8;
+    double sub8x8_intra = (double)pbi->sub8x8_intra /
+        (double)pbi->total_block_in_8x8;
+
+    fprintf(pf, "frame index %d, sub-pel mc (%7.3f, %7.3f)\tintra mode%7.3f\tcompound inter block%7.3f\t",
+            cm->current_video_frame, 25 * subpel_mc_h, 25 * subpel_mc_v, 100 * intra_mode,
+            100 * compound_block);
+    fprintf(pf, "sub8x8 inter %7.3f intra %7.3f\n", 100 * sub8x8_inter, 100 * sub8x8_intra);
     fclose(pf);
   }
 #endif
index 7aed5a2760742eec862dbf262cebdb3b93158b90..8007adaf18c0003f98877dbdefc6ff57327fcaac 100644 (file)
@@ -479,6 +479,10 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
   read_ref_frames(cm, xd, r, mbmi->segment_id, mbmi->ref_frame);
   is_compound = has_second_ref(mbmi);
 
+#if CONFIG_INTERNAL_STATS
+  pbi->compound_inter_block_in_8x8 += is_compound;
+#endif
+
   for (ref = 0; ref < 1 + is_compound; ++ref) {
     const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref];
     RefBuffer *ref_buf = &cm->frame_refs[frame - LAST_FRAME];
@@ -549,17 +553,17 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
           mi->bmi[j].as_mv[1].as_int = block[1].as_int;
 #if CONFIG_INTERNAL_STATS
         if (mi->bmi[j].as_mv[0].as_mv.row & 0x07)
-          pbi->subpel_mc_block_in_4x4 +=
+          pbi->subpel_mc_block_in_4x4_v +=
               (1 << (num_pels_log2_lookup[bsize] - 4));
         if (mi->bmi[j].as_mv[0].as_mv.col & 0x07)
-          pbi->subpel_mc_block_in_4x4 +=
+          pbi->subpel_mc_block_in_4x4_h +=
               (1 << (num_pels_log2_lookup[bsize] - 4));
         if (is_compound) {
           if (mi->bmi[j].as_mv[1].as_mv.row & 0x07)
-            pbi->subpel_mc_block_in_4x4 +=
+            pbi->subpel_mc_block_in_4x4_v +=
                 (1 << (num_pels_log2_lookup[bsize] - 4));
           if (mi->bmi[j].as_mv[1].as_mv.col & 0x07)
-            pbi->subpel_mc_block_in_4x4 +=
+            pbi->subpel_mc_block_in_4x4_h +=
                 (1 << (num_pels_log2_lookup[bsize] - 4));
         }
 #endif
@@ -579,14 +583,14 @@ static void read_inter_block_mode_info(VP9Decoder *const pbi,
                                 nearestmv, nearmv, is_compound, allow_hp, r);
 #if CONFIG_INTERNAL_STATS
     if (mbmi->mv[0].as_mv.row & 0x07)
-      pbi->subpel_mc_block_in_4x4 += (1 << (num_pels_log2_lookup[bsize] - 4));
+      pbi->subpel_mc_block_in_4x4_v += (1 << (num_pels_log2_lookup[bsize] - 4));
     if (mbmi->mv[0].as_mv.col & 0x07)
-      pbi->subpel_mc_block_in_4x4 += (1 << (num_pels_log2_lookup[bsize] - 4));
+      pbi->subpel_mc_block_in_4x4_h += (1 << (num_pels_log2_lookup[bsize] - 4));
     if (is_compound) {
       if (mbmi->mv[1].as_mv.row & 0x07)
-        pbi->subpel_mc_block_in_4x4 += (1 << (num_pels_log2_lookup[bsize] - 4));
+        pbi->subpel_mc_block_in_4x4_v += (1 << (num_pels_log2_lookup[bsize] - 4));
       if (mbmi->mv[1].as_mv.col & 0x07)
-        pbi->subpel_mc_block_in_4x4 += (1 << (num_pels_log2_lookup[bsize] - 4));
+        pbi->subpel_mc_block_in_4x4_h += (1 << (num_pels_log2_lookup[bsize] - 4));
     }
 #endif
   }
index 216698e9bb66940cd1026b889e1d5e64b18acf1b..4b3ced6bf35a9fedcd6b37d160f5179ad9cef76e 100644 (file)
@@ -78,13 +78,23 @@ typedef struct VP9Decoder {
 
 #if CONFIG_INTERNAL_STATS
   // total blocks in unit of 8x8 inside the frame.
-  int total_block_in_8x8;
+  int64_t total_block_in_8x8;
+
+  // sub8x8 blocks in unit of 8x8.
+  int64_t sub8x8_inter;
+  int64_t sub8x8_intra;
+
   // number of blocks using 1-D sub-pixel filtering for motion compensated
   // prediction. if a block is using sub-pixel filter in both vertical and
   // horizontal directions, it counts as using 1-D sub-pixel filter twice.
-  int subpel_mc_block_in_4x4;
+  int64_t subpel_mc_block_in_4x4_h;
+  int64_t subpel_mc_block_in_4x4_v;
+
   // nubmer of blocks using intra prediction mode.
-  int intra_block_in_8x8;
+  int64_t intra_block_in_8x8;
+
+  // number of blocks using compound prediction mode.
+  int64_t compound_inter_block_in_8x8;
 #endif
 } VP9Decoder;