From 6f4fa44c42cad43c2ce7adc56fc208fc310c5276 Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev Date: Thu, 15 Aug 2013 11:37:56 -0700 Subject: [PATCH] Using { 0 } for initialization instead of memset. Change-Id: I4fad357465022d14bfc7e13b348c6da267587314 --- vp9/encoder/vp9_firstpass.c | 4 +--- vp9/encoder/vp9_mbgraph.c | 7 ++----- vp9/encoder/vp9_rdopt.c | 6 ++---- vp9/encoder/vp9_segmentation.c | 10 +++------- 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index 6ba2a4fc9..8eab71c26 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -1580,7 +1580,7 @@ void define_fixed_arf_period(VP9_COMP *cpi) { // 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; @@ -1616,8 +1616,6 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { 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); diff --git a/vp9/encoder/vp9_mbgraph.c b/vp9/encoder/vp9_mbgraph.c index 57fa0106e..1baea643d 100644 --- a/vp9/encoder/vp9_mbgraph.c +++ b/vp9/encoder/vp9_mbgraph.c @@ -241,9 +241,7 @@ static void update_mbgraph_frame_stats(VP9_COMP *cpi, 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; - - vp9_zero(mi_local); + MODE_INFO mi_local = { { 0 } }; // Set up limit values for motion vectors to prevent them extending outside the UMV borders arf_top_mv.as_int = 0; @@ -309,7 +307,7 @@ static void update_mbgraph_frame_stats(VP9_COMP *cpi, 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 @@ static void separate_arf_mbs(VP9_COMP *cpi) { } } - 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++) { diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index b2fe00925..e0ff090e1 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -3142,7 +3142,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, 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 vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, 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 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, 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; diff --git a/vp9/encoder/vp9_segmentation.c b/vp9/encoder/vp9_segmentation.c index 9564edc84..3db91caca 100644 --- a/vp9/encoder/vp9_segmentation.c +++ b/vp9/encoder/vp9_segmentation.c @@ -217,9 +217,9 @@ void vp9_choose_segmap_coding_method(VP9_COMP *cpi) { 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]; @@ -233,10 +233,6 @@ void vp9_choose_segmap_coding_method(VP9_COMP *cpi) { 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 for (tile_col = 0; tile_col < 1 << cm->log2_tile_cols; tile_col++) { -- 2.40.0