]> granicus.if.org Git - libvpx/commitdiff
Fix uninitialized new_mv_count in first pass file
authorJohn Koleszar <jkoleszar@google.com>
Tue, 4 Oct 2011 13:50:40 +0000 (09:50 -0400)
committerJohn Koleszar <jkoleszar@google.com>
Tue, 4 Oct 2011 13:50:52 +0000 (09:50 -0400)
Uninitialized data could be written to the first pass file when no
motion vectors are present in the frame.

Also fix a number of compiler warnings.

Change-Id: Icc9f53b6d33da9de4563d86d9fd591910473ea90

vp8/encoder/firstpass.c

index 7a6228f3be1bf7bbbee96bf1e3d90d68998a4c86..23e30508a5ceb13ac801647e859c093ce6c83065 100644 (file)
@@ -777,6 +777,7 @@ void vp8_first_pass(VP8_COMP *cpi)
         fps.MVrv       = 0.0;
         fps.MVcv       = 0.0;
         fps.mv_in_out_count  = 0.0;
+        fps.new_mv_count = 0.0;
         fps.count      = 1.0;
 
         fps.pcnt_inter   = 1.0 * (double)intercount / cm->MBs;
@@ -932,10 +933,7 @@ static int estimate_max_q(VP8_COMP *cpi,
     double section_err = (fpstats->coded_error / fpstats->count);
     double err_per_mb = section_err / num_mbs;
     double err_correction_factor;
-    double corr_high;
     double speed_correction = 1.0;
-    double inter_pct = (fpstats->pcnt_inter / fpstats->count);
-    double intra_pct = 1.0 - inter_pct;
     int overhead_bits_per_mb;
 
     if (section_target_bandwitdh <= 0)
@@ -1047,12 +1045,9 @@ static int estimate_cq( VP8_COMP *cpi,
     double section_err = (fpstats->coded_error / fpstats->count);
     double err_per_mb = section_err / num_mbs;
     double err_correction_factor;
-    double corr_high;
     double speed_correction = 1.0;
     double clip_iiratio;
     double clip_iifactor;
-    double inter_pct = (fpstats->pcnt_inter / fpstats->count);
-    double intra_pct = 1.0 - inter_pct;
     int overhead_bits_per_mb;
 
     if (0)
@@ -1131,7 +1126,6 @@ static int estimate_q(VP8_COMP *cpi, double section_err, int section_target_band
 
     double err_per_mb = section_err / num_mbs;
     double err_correction_factor;
-    double corr_high;
     double speed_correction = 1.0;
 
     target_norm_bits_per_mb = (section_target_bandwitdh < (1 << 20)) ? (512 * section_target_bandwitdh) / num_mbs : 512 * (section_target_bandwitdh / num_mbs);
@@ -1177,7 +1171,6 @@ static int estimate_kf_group_q(VP8_COMP *cpi, double section_err, int section_ta
 
     double err_per_mb = section_err / num_mbs;
     double err_correction_factor;
-    double corr_high;
     double speed_correction = 1.0;
     double current_spend_ratio = 1.0;
 
@@ -2305,7 +2298,7 @@ void vp8_second_pass(VP8_COMP *cpi)
     int tmp_q;
     int frames_left = (int)(cpi->twopass.total_stats->count - cpi->common.current_video_frame);
 
-    FIRSTPASS_STATS this_frame;
+    FIRSTPASS_STATS this_frame = {0};
     FIRSTPASS_STATS this_frame_copy;
 
     double this_frame_error;