]> granicus.if.org Git - libvpx/commitdiff
Remove MODE_STATS flag and code
authorPaul Wilkins <paulwilkins@google.com>
Thu, 16 May 2013 12:40:32 +0000 (13:40 +0100)
committerPaul Wilkins <paulwilkins@google.com>
Fri, 17 May 2013 11:34:10 +0000 (12:34 +0100)
Change-Id: I6c70a8a8a4633399842ac74792003ae5f7859ffa

vp9/common/vp9_blockd.h
vp9/common/vp9_entropymode.c
vp9/encoder/vp9_bitstream.c
vp9/encoder/vp9_encodeframe.c
vp9/encoder/vp9_onyx_if.c
vp9/encoder/vp9_onyx_int.h
vp9/encoder/vp9_ratectrl.c

index 6a3fbb160053bdac8de2954f077f45fade722825..0bfaec7a0c5e8573318ddf01643e012ff810c2ce 100644 (file)
@@ -21,8 +21,6 @@
 #include "vp9/common/vp9_common.h"
 #include "vp9/common/vp9_enums.h"
 
-// #define MODE_STATS
-
 #define MAX_MB_SEGMENTS     8
 #define MB_SEG_TREE_PROBS   (MAX_MB_SEGMENTS-1)
 #define PREDICTION_PROBS 3
index 577aab558a7c672021302d0d7763262b9f81d447..f4646f6b1c6c8c9dbce54058e0d2070a36e60539 100644 (file)
@@ -409,27 +409,6 @@ void vp9_adapt_mode_context(VP9_COMMON *pc) {
   }
 }
 
-#ifdef MODE_STATS
-#include "vp9/common/vp9_modecont.h"
-void print_mode_contexts(VP9_COMMON *pc) {
-  int j, i;
-  printf("\n====================\n");
-  for (j = 0; j < INTER_MODE_CONTEXTS; j++) {
-    for (i = 0; i < 4; i++) {
-      printf("%4d ", pc->fc.mode_context[j][i]);
-    }
-    printf("\n");
-  }
-  printf("====================\n");
-  for (j = 0; j < INTER_MODE_CONTEXTS; j++) {
-    for (i = 0; i < 4; i++) {
-      printf("%4d ", pc->fc.mode_context_a[j][i]);
-    }
-    printf("\n");
-  }
-}
-#endif
-
 #define MODE_COUNT_SAT 20
 #define MODE_MAX_UPDATE_FACTOR 144
 static void update_mode_probs(int n_modes,
index ff9a7354bd6ff190202aaaf160573924e176cbcb..9ced27b88c1c0bd46bd090c7c38fd2866fdca9cc 100644 (file)
@@ -50,10 +50,6 @@ vp9_coeff_stats tree_update_hist_32x32[BLOCK_TYPES];
 extern unsigned int active_section;
 #endif
 
-#ifdef MODE_STATS
-int count_mb_seg[4] = { 0, 0, 0, 0 };
-#endif
-
 #define vp9_cost_upd  ((int)(vp9_cost_one(upd) - vp9_cost_zero(upd)) >> 8)
 #define vp9_cost_upd256  ((int)(vp9_cost_one(upd) - vp9_cost_zero(upd)))
 
@@ -702,10 +698,6 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
       case SPLITMV: {
         int j = 0;
 
-#ifdef MODE_STATS
-        ++count_mb_seg[mi->partitioning];
-#endif
-
         do {
           B_PREDICTION_MODE blockmode;
           int_mv blockmv;
index d4e5114e7d0f6d9cad3deab3a4f7002547c5e940..7bbf5b0b923657db978d1a5bb962fd466e78d509 100644 (file)
@@ -52,18 +52,6 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t,
 
 static void adjust_act_zbin(VP9_COMP *cpi, MACROBLOCK *x);
 
-#ifdef MODE_STATS
-unsigned int inter_y_modes[MB_MODE_COUNT];
-unsigned int inter_uv_modes[VP9_UV_MODES];
-unsigned int inter_b_modes[B_MODE_COUNT];
-unsigned int y_modes[VP9_YMODES];
-unsigned int i8x8_modes[VP9_I8X8_MODES];
-unsigned int uv_modes[VP9_UV_MODES];
-unsigned int uv_modes_y[VP9_YMODES][VP9_UV_MODES];
-unsigned int b_modes[B_MODE_COUNT];
-#endif
-
-
 /* activity_avg must be positive, or flat regions could get a zero weight
  *  (infinite lambda), which confounds analysis.
  * This also avoids the need for divide by zero checks in
@@ -661,11 +649,7 @@ static void update_stats(VP9_COMP *cpi, int mi_row, int mi_col) {
   MODE_INFO *mi = xd->mode_info_context;
   MB_MODE_INFO *const mbmi = &mi->mbmi;
 
-  if (cm->frame_type == KEY_FRAME) {
-#ifdef MODE_STATS
-    y_modes[mbmi->mode]++;
-#endif
-  } else {
+  if (cm->frame_type != KEY_FRAME) {
     int segment_id, seg_ref_active;
 
     if (mbmi->ref_frame) {
@@ -677,18 +661,6 @@ static void update_stats(VP9_COMP *cpi, int mi_row, int mi_col) {
         cpi->comp_pred_count[pred_context]++;
     }
 
-#ifdef MODE_STATS
-    inter_y_modes[mbmi->mode]++;
-
-    if (mbmi->mode == SPLITMV) {
-      int b;
-
-      for (b = 0; b < x->partition_info->count; b++) {
-        inter_b_modes[x->partition_info->bmi[b].mode]++;
-      }
-    }
-#endif
-
     // If we have just a single reference frame coded for a segment then
     // exclude from the reference frame counts used to work out
     // probabilities. NOTE: At the moment we dont support custom trees
@@ -1634,23 +1606,6 @@ static void sum_intra_stats(VP9_COMP *cpi, MACROBLOCK *x) {
   const MB_PREDICTION_MODE m = xd->mode_info_context->mbmi.mode;
   const MB_PREDICTION_MODE uvm = xd->mode_info_context->mbmi.uv_mode;
 
-#ifdef MODE_STATS
-  const int is_key = cpi->common.frame_type == KEY_FRAME;
-
-  ++ (is_key ? uv_modes : inter_uv_modes)[uvm];
-  ++ uv_modes_y[m][uvm];
-
-  if (m == I4X4_PRED) {
-    unsigned int *const bct = is_key ? b_modes : inter_b_modes;
-
-    int b = 0;
-
-    do {
-      ++ bct[xd->block[b].bmi.as_mode.first];
-    } while (++b < 4);
-  }
-#endif
-
 #if CONFIG_AB4X4
   if (xd->mode_info_context->mbmi.sb_type >= BLOCK_SIZE_SB8X8) {
 #else
index 2d3fea975127ca446ceadb0d1552f6c3d00e63b7..859fff17d11f9bced0d8b3cc6f181760c646ca7c 100644 (file)
@@ -120,17 +120,6 @@ unsigned int frames_at_speed[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 #if defined(SECTIONBITS_OUTPUT)
 extern unsigned __int64 Sectionbits[500];
 #endif
-#ifdef MODE_STATS
-extern int64_t Sectionbits[500];
-extern unsigned int y_modes[VP9_YMODES];
-extern unsigned int i8x8_modes[VP9_I8X8_MODES];
-extern unsigned int uv_modes[VP9_UV_MODES];
-extern unsigned int uv_modes_y[VP9_YMODES][VP9_UV_MODES];
-extern unsigned int b_modes[B_MODE_COUNT];
-extern unsigned int inter_y_modes[MB_MODE_COUNT];
-extern unsigned int inter_uv_modes[VP9_UV_MODES];
-extern unsigned int inter_b_modes[B_MODE_COUNT];
-#endif
 
 extern void vp9_init_quantizer(VP9_COMP *cpi);
 
@@ -1396,16 +1385,7 @@ VP9_PTR vp9_create_compressor(VP9_CONFIG *oxcf) {
   if (cpi->pass != 1)
     init_context_counters();
 #endif
-#ifdef MODE_STATS
-  vp9_zero(y_modes);
-  vp9_zero(i8x8_modes);
-  vp9_zero(uv_modes);
-  vp9_zero(uv_modes_y);
-  vp9_zero(b_modes);
-  vp9_zero(inter_y_modes);
-  vp9_zero(inter_uv_modes);
-  vp9_zero(inter_b_modes);
-#endif
+
 #ifdef NMV_STATS
   init_nmvstats();
 #endif
@@ -1669,9 +1649,7 @@ void vp9_remove_compressor(VP9_PTR *ptr) {
                              - cpi->first_time_stamp_ever) / 10000000.000;
       double total_encode_time = (cpi->time_receive_data + cpi->time_compress_data)   / 1000.000;
       double dr = (double)cpi->bytes * (double) 8 / (double)1000  / time_encoded;
-#if defined(MODE_STATS)
-      print_mode_contexts(&cpi->common);
-#endif
+
       if (cpi->b_calculate_psnr) {
         YV12_BUFFER_CONFIG *lst_yv12 =
             &cpi->common.yv12_fb[cpi->common.ref_frame_map[cpi->lst_fb_idx]];
@@ -1711,88 +1689,6 @@ void vp9_remove_compressor(VP9_PTR *ptr) {
 
 #endif
 
-
-#ifdef MODE_STATS
-    {
-      extern int count_mb_seg[4];
-      char modes_stats_file[250];
-      FILE *f;
-      double dr = (double)cpi->oxcf.frame_rate * (double)cpi->bytes * (double)8 / (double)cpi->count / (double)1000;
-      sprintf(modes_stats_file, "modes_q%03d.stt", cpi->common.base_qindex);
-      f = fopen(modes_stats_file, "w");
-      fprintf(f, "intra_mode in Intra Frames:\n");
-      {
-        int i;
-        fprintf(f, "Y: ");
-        for (i = 0; i < VP9_YMODES; i++) fprintf(f, " %8d,", y_modes[i]);
-        fprintf(f, "\n");
-      }
-      {
-        int i;
-        fprintf(f, "I8: ");
-        for (i = 0; i < VP9_I8X8_MODES; i++) fprintf(f, " %8d,", i8x8_modes[i]);
-        fprintf(f, "\n");
-      }
-      {
-        int i;
-        fprintf(f, "UV: ");
-        for (i = 0; i < VP9_UV_MODES; i++) fprintf(f, " %8d,", uv_modes[i]);
-        fprintf(f, "\n");
-      }
-      {
-        int i, j;
-        fprintf(f, "KeyFrame Y-UV:\n");
-        for (i = 0; i < VP9_YMODES; i++) {
-          fprintf(f, "%2d:", i);
-          for (j = 0; j < VP9_UV_MODES; j++) fprintf(f, "%8d, ", uv_modes_y[i][j]);
-          fprintf(f, "\n");
-        }
-      }
-      {
-        int i, j;
-        fprintf(f, "Inter Y-UV:\n");
-        for (i = 0; i < VP9_YMODES; i++) {
-          fprintf(f, "%2d:", i);
-          for (j = 0; j < VP9_UV_MODES; j++) fprintf(f, "%8d, ", cpi->y_uv_mode_count[i][j]);
-          fprintf(f, "\n");
-        }
-      }
-      {
-        int i;
-
-        fprintf(f, "B: ");
-        for (i = 0; i < VP9_NKF_BINTRAMODES; i++)
-          fprintf(f, "%8d, ", b_modes[i]);
-
-        fprintf(f, "\n");
-
-      }
-
-      fprintf(f, "Modes in Inter Frames:\n");
-      {
-        int i;
-        fprintf(f, "Y: ");
-        for (i = 0; i < MB_MODE_COUNT; i++) fprintf(f, " %8d,", inter_y_modes[i]);
-        fprintf(f, "\n");
-      }
-      {
-        int i;
-        fprintf(f, "UV: ");
-        for (i = 0; i < VP9_UV_MODES; i++) fprintf(f, " %8d,", inter_uv_modes[i]);
-        fprintf(f, "\n");
-      }
-      {
-        int i;
-        fprintf(f, "B: ");
-        for (i = 0; i < B_MODE_COUNT; i++) fprintf(f, "%8d, ", inter_b_modes[i]);
-        fprintf(f, "\n");
-      }
-      fprintf(f, "P:%8d, %8d, %8d, %8d\n", count_mb_seg[0], count_mb_seg[1], count_mb_seg[2], count_mb_seg[3]);
-      fprintf(f, "PB:%8d, %8d, %8d, %8d\n", inter_b_modes[LEFT4X4], inter_b_modes[ABOVE4X4], inter_b_modes[ZERO4X4], inter_b_modes[NEW4X4]);
-      fclose(f);
-    }
-#endif
-
 #ifdef ENTROPY_STATS
     {
       int i, j, k;
index aba4c0e64d6f2322edcc8d0e89e1452d4a5b1346..c6808ae2b106d210243f6e6659c17e509ee4d449 100644 (file)
@@ -64,16 +64,6 @@ typedef struct {
   int nmvcosts[2][MV_VALS];
   int nmvcosts_hp[2][MV_VALS];
 
-#ifdef MODE_STATS
-  // Stats
-  int y_modes[VP9_YMODES];
-  int uv_modes[VP9_UV_MODES];
-  int b_modes[B_MODE_COUNT];
-  int inter_y_modes[MB_MODE_COUNT];
-  int inter_uv_modes[VP9_UV_MODES];
-  int inter_b_modes[B_MODE_COUNT];
-#endif
-
   vp9_prob segment_pred_probs[PREDICTION_PROBS];
   unsigned char ref_pred_probs_update[PREDICTION_PROBS];
   vp9_prob ref_pred_probs[PREDICTION_PROBS];
index 10a3b2eab50823021c2dbeb066c403cfb8d363d5..263387185ab5a7ba858f706193e5cf307a63ccdc 100644 (file)
 #define MIN_BPB_FACTOR 0.005
 #define MAX_BPB_FACTOR 50
 
-#ifdef MODE_STATS
-extern unsigned int y_modes[VP9_YMODES];
-extern unsigned int uv_modes[VP9_UV_MODES];
-extern unsigned int b_modes[B_MODE_COUNT];
-
-extern unsigned int inter_y_modes[MB_MODE_COUNT];
-extern unsigned int inter_uv_modes[VP9_UV_MODES];
-extern unsigned int inter_b_modes[B_MODE_COUNT];
-#endif
-
 // Bits Per MB at different Q (Multiplied by 512)
 #define BPER_MB_NORMBITS    9
 
@@ -141,16 +131,6 @@ void vp9_save_coding_context(VP9_COMP *cpi) {
   vp9_copy(cc->sub_mv_ref_prob, cm->fc.sub_mv_ref_prob);
   vp9_copy(cc->partition_prob, cm->fc.partition_prob);
 
-  // Stats
-#ifdef MODE_STATS
-  vp9_copy(cc->y_modes,       y_modes);
-  vp9_copy(cc->uv_modes,      uv_modes);
-  vp9_copy(cc->b_modes,       b_modes);
-  vp9_copy(cc->inter_y_modes,  inter_y_modes);
-  vp9_copy(cc->inter_uv_modes, inter_uv_modes);
-  vp9_copy(cc->inter_b_modes,  inter_b_modes);
-#endif
-
   vp9_copy(cc->segment_pred_probs, cm->segment_pred_probs);
   vp9_copy(cc->ref_pred_probs_update, cpi->ref_pred_probs_update);
   vp9_copy(cc->ref_pred_probs, cm->ref_pred_probs);
@@ -191,16 +171,6 @@ void vp9_restore_coding_context(VP9_COMP *cpi) {
   vp9_copy(cm->fc.sub_mv_ref_prob, cc->sub_mv_ref_prob);
   vp9_copy(cm->fc.partition_prob, cc->partition_prob);
 
-  // Stats
-#ifdef MODE_STATS
-  vp9_copy(y_modes, cc->y_modes);
-  vp9_copy(uv_modes, cc->uv_modes);
-  vp9_copy(b_modes, cc->b_modes);
-  vp9_copy(inter_y_modes, cc->inter_y_modes);
-  vp9_copy(inter_uv_modes, cc->inter_uv_modes);
-  vp9_copy(inter_b_modes, cc->inter_b_modes);
-#endif
-
   vp9_copy(cm->segment_pred_probs, cc->segment_pred_probs);
   vp9_copy(cpi->ref_pred_probs_update, cc->ref_pred_probs_update);
   vp9_copy(cm->ref_pred_probs, cc->ref_pred_probs);