shithub: libvpx

Download patch

ref: 6f4fa44c42cad43c2ce7adc56fc208fc310c5276
parent: 89a1fcf884f0e7a2d62eb8b45cece8c2bfbe2278
author: Dmitry Kovalev <[email protected]>
date: Thu Aug 15 07:37:56 EDT 2013

Using { 0 } for initialization instead of memset.

Change-Id: I4fad357465022d14bfc7e13b348c6da267587314

--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1580,7 +1580,7 @@
 
 // Analyse and define a gf/arf group.
 static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
-  FIRSTPASS_STATS next_frame;
+  FIRSTPASS_STATS next_frame = { 0 };
   FIRSTPASS_STATS *start_pos;
   int i;
   double boost_score = 0.0;
@@ -1615,8 +1615,6 @@
   vp9_clear_system_state();  // __asm emms;
 
   start_pos = cpi->twopass.stats_in;
-
-  vpx_memset(&next_frame, 0, sizeof(next_frame)); // assure clean
 
   // Load stats for the current frame.
   mod_frame_err = calculate_modified_err(cpi, this_frame);
--- a/vp9/encoder/vp9_mbgraph.c
+++ b/vp9/encoder/vp9_mbgraph.c
@@ -241,10 +241,8 @@
   int mb_col, mb_row, offset = 0;
   int mb_y_offset = 0, arf_y_offset = 0, gld_y_offset = 0;
   int_mv arf_top_mv, gld_top_mv;
-  MODE_INFO mi_local;
+  MODE_INFO mi_local = { { 0 } };
 
-  vp9_zero(mi_local);
-
   // Set up limit values for motion vectors to prevent them extending outside the UMV borders
   arf_top_mv.as_int = 0;
   gld_top_mv.as_int = 0;
@@ -309,7 +307,7 @@
 static void separate_arf_mbs(VP9_COMP *cpi) {
   VP9_COMMON *const cm = &cpi->common;
   int mb_col, mb_row, offset, i;
-  int ncnt[4];
+  int ncnt[4] = { 0 };
   int n_frames = cpi->mbgraph_n_frames;
 
   int *arf_not_zz;
@@ -345,7 +343,6 @@
     }
   }
 
-  vpx_memset(ncnt, 0, sizeof(ncnt));
   for (offset = 0, mb_row = 0; mb_row < cm->mb_rows;
        offset += cm->mb_cols, mb_row++) {
     for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) {
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -3142,7 +3142,7 @@
   int comp_pred, i;
   int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES];
   struct buf_2d yv12_mb[4][MAX_MB_PLANE];
-  int_mv single_newmv[MAX_REF_FRAMES];
+  int_mv single_newmv[MAX_REF_FRAMES] = { { 0 } };
   static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG,
                                     VP9_ALT_FLAG };
   int idx_list[4] = {0,
@@ -3157,7 +3157,7 @@
   int64_t best_pred_rd[NB_PREDICTION_TYPES];
   int64_t best_filter_rd[VP9_SWITCHABLE_FILTERS + 1];
   int64_t best_filter_diff[VP9_SWITCHABLE_FILTERS + 1];
-  MB_MODE_INFO best_mbmode;
+  MB_MODE_INFO best_mbmode = { 0 };
   int j;
   int mode_index, best_mode_index = 0;
   unsigned int ref_costs_single[MAX_REF_FRAMES], ref_costs_comp[MAX_REF_FRAMES];
@@ -3202,8 +3202,6 @@
 
   estimate_ref_frame_costs(cpi, segment_id, ref_costs_single, ref_costs_comp,
                            &comp_mode_p);
-  vpx_memset(&best_mbmode, 0, sizeof(best_mbmode));
-  vpx_memset(&single_newmv, 0, sizeof(single_newmv));
 
   for (i = 0; i < NB_PREDICTION_TYPES; ++i)
     best_pred_rd[i] = INT64_MAX;
--- a/vp9/encoder/vp9_segmentation.c
+++ b/vp9/encoder/vp9_segmentation.c
@@ -217,9 +217,9 @@
 
   int i, tile_col, mi_row, mi_col;
 
-  int temporal_predictor_count[PREDICTION_PROBS][2];
-  int no_pred_segcounts[MAX_SEGMENTS];
-  int t_unpred_seg_counts[MAX_SEGMENTS];
+  int temporal_predictor_count[PREDICTION_PROBS][2] = { { 0 } };
+  int no_pred_segcounts[MAX_SEGMENTS] = { 0 };
+  int t_unpred_seg_counts[MAX_SEGMENTS] = { 0 };
 
   vp9_prob no_pred_tree[SEG_TREE_PROBS];
   vp9_prob t_pred_tree[SEG_TREE_PROBS];
@@ -232,10 +232,6 @@
   // temporal coding probabilities
   vpx_memset(seg->tree_probs, 255, sizeof(seg->tree_probs));
   vpx_memset(seg->pred_probs, 255, sizeof(seg->pred_probs));
-
-  vpx_memset(no_pred_segcounts, 0, sizeof(no_pred_segcounts));
-  vpx_memset(t_unpred_seg_counts, 0, sizeof(t_unpred_seg_counts));
-  vpx_memset(temporal_predictor_count, 0, sizeof(temporal_predictor_count));
 
   // First of all generate stats regarding how well the last segment map
   // predicts this one