shithub: libvpx

Download patch

ref: 72d8b4612cce798cb4d548aebd74d4cbf566dd6f
parent: de80da39dc9b7b56c180bf27ee6e47779280fa4d
author: Paul Wilkins <paulwilkins@google.com>
date: Fri Apr 19 12:56:14 EDT 2013

Clean out some legacy code.

Removed some unused legacy code relating to GF activity.

Change-Id: I0b0fe90a1a5208aaa81d7393ba6cf75ab412dbda

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -551,9 +551,6 @@
   xd->above_context = cm->above_context + mb_col;
   xd->left_context  = cm->left_context + (mb_row & 3);
 
-  // GF active flags data structure
-  x->gf_active_ptr = (signed char *)&cpi->gf_active_flags[idx_map];
-
   // Activity map pointer
   x->mb_activity_ptr = &cpi->mb_activity_map[idx_map];
   x->active_ptr = cpi->active_map + idx_map;
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -332,10 +332,6 @@
   vpx_free(cpi->tok);
   cpi->tok = 0;
 
-  // Structure used to monitor GF usage
-  vpx_free(cpi->gf_active_flags);
-  cpi->gf_active_flags = 0;
-
   // Activity mask based per mb zbin adjustments
   vpx_free(cpi->mb_activity_map);
   cpi->mb_activity_map = 0;
@@ -909,13 +905,6 @@
   cpi->gf_bad_count = 0;
   cpi->gf_update_recommended = 0;
 
-
-  // Structures used to minitor GF usage
-  vpx_free(cpi->gf_active_flags);
-  CHECK_MEM_ERROR(cpi->gf_active_flags,
-                  vpx_calloc(1, cm->mb_rows * cm->mb_cols));
-  cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
-
   vpx_free(cpi->mb_activity_map);
   CHECK_MEM_ERROR(cpi->mb_activity_map,
                   vpx_calloc(sizeof(unsigned int),
@@ -2231,12 +2220,6 @@
 
 
 static void update_alt_ref_frame_stats(VP9_COMP *cpi) {
-  VP9_COMMON *cm = &cpi->common;
-
-  // Update data structure that monitors level of reference to last GF
-  vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
-  cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
-
   // this frame refreshes means next frames don't unless specified by user
   cpi->common.frames_since_golden = 0;
 
@@ -2248,18 +2231,10 @@
 
   // Set the alternate reference frame active flag
   cpi->source_alt_ref_active = 1;
-
-
 }
 static void update_golden_frame_stats(VP9_COMP *cpi) {
-  VP9_COMMON *cm = &cpi->common;
-
   // Update the Golden frame usage counts.
   if (cpi->refresh_golden_frame) {
-    // Update data structure that monitors level of reference to last GF
-    vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
-    cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
-
     // this frame refreshes means next frames don't unless specified by user
     cpi->refresh_golden_frame = 0;
     cpi->common.frames_since_golden = 0;
@@ -3293,27 +3268,8 @@
     }
   }
 
-  // Update the GF usage maps.
-  // This is done after completing the compression of a frame when all modes
-  // etc. are finalized but before loop filter
-  vp9_update_gf_useage_maps(cpi, cm, &cpi->mb);
-
   if (cm->frame_type == KEY_FRAME)
     cpi->refresh_last_frame = 1;
-
-#if 0
-  {
-    FILE *f = fopen("gfactive.stt", "a");
-    fprintf(f, "%8d %8d %8d %8d %8d\n",
-            cm->current_video_frame,
-            (100 * cpi->gf_active_count)
-              / (cpi->common.mb_rows * cpi->common.mb_cols),
-            cpi->this_iiratio,
-            cpi->next_iiratio,
-            cpi->refresh_golden_frame);
-    fclose(f);
-  }
-#endif
 
   cm->frame_to_show = &cm->yv12_fb[cm->new_fb_idx];
 
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -658,12 +658,6 @@
   unsigned int activity_avg;
   unsigned int *mb_activity_map;
   int *mb_norm_activity_map;
-
-  // Record of which MBs still refer to last golden frame either
-  // directly or through 0,0
-  unsigned char *gf_active_flags;
-  int gf_active_count;
-
   int output_partition;
 
   // Store last frame's MV info for next frame MV prediction
--- a/vp9/encoder/vp9_segmentation.c
+++ b/vp9/encoder/vp9_segmentation.c
@@ -15,50 +15,6 @@
 #include "vp9/common/vp9_pred_common.h"
 #include "vp9/common/vp9_tile_common.h"
 
-void vp9_update_gf_useage_maps(VP9_COMP *cpi, VP9_COMMON *cm, MACROBLOCK *x) {
-  int mb_row, mb_col;
-
-  MODE_INFO *this_mb_mode_info = cm->mi;
-
-  x->gf_active_ptr = (signed char *)cpi->gf_active_flags;
-
-  if ((cm->frame_type == KEY_FRAME) || (cpi->refresh_golden_frame)) {
-    // Reset Gf useage monitors
-    vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
-    cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
-  } else {
-    // for each macroblock row in image
-    for (mb_row = 0; mb_row < cm->mb_rows; mb_row++) {
-      // for each macroblock col in image
-      for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) {
-
-        // If using golden then set GF active flag if not already set.
-        // If using last frame 0,0 mode then leave flag as it is
-        // else if using non 0,0 motion or intra modes then clear
-        // flag if it is currently set
-        if ((this_mb_mode_info->mbmi.ref_frame == GOLDEN_FRAME) ||
-            (this_mb_mode_info->mbmi.ref_frame == ALTREF_FRAME)) {
-          if (*(x->gf_active_ptr) == 0) {
-            *(x->gf_active_ptr) = 1;
-            cpi->gf_active_count++;
-          }
-        } else if ((this_mb_mode_info->mbmi.mode != ZEROMV) &&
-                   *(x->gf_active_ptr)) {
-          *(x->gf_active_ptr) = 0;
-          cpi->gf_active_count--;
-        }
-
-        x->gf_active_ptr++;          // Step onto next entry
-        this_mb_mode_info++;         // skip to next mb
-
-      }
-
-      // this is to account for the border
-      this_mb_mode_info++;
-    }
-  }
-}
-
 void vp9_enable_segmentation(VP9_PTR ptr) {
   VP9_COMP *cpi = (VP9_COMP *)(ptr);
 
--- a/vp9/encoder/vp9_segmentation.h
+++ b/vp9/encoder/vp9_segmentation.h
@@ -15,8 +15,6 @@
 #include "vp9/common/vp9_blockd.h"
 #include "vp9/encoder/vp9_onyx_int.h"
 
-void vp9_update_gf_useage_maps(VP9_COMP *cpi, VP9_COMMON *cm, MACROBLOCK *x);
-
 void vp9_enable_segmentation(VP9_PTR ptr);
 void vp9_disable_segmentation(VP9_PTR ptr);