]> granicus.if.org Git - libvpx/commitdiff
Cleaning up vp9_init_second_pass().
authorDmitry Kovalev <dkovalev@google.com>
Thu, 22 May 2014 20:04:43 +0000 (13:04 -0700)
committerDmitry Kovalev <dkovalev@google.com>
Thu, 22 May 2014 20:04:43 +0000 (13:04 -0700)
modified_error_total from TWO_PASS struct is not required anymore.

Change-Id: I0e07cac1e6d1b6a78418116be725bcd72bfbd847

vp9/encoder/vp9_firstpass.c
vp9/encoder/vp9_firstpass.h

index efc20f6b3e7f9bd34e54c4c94c74bba46c2824f2..a601877a67900a884fd2d1124c24e53ea030be5f 100644 (file)
@@ -1003,25 +1003,19 @@ void vp9_init_second_pass(VP9_COMP *cpi) {
   // Scan the first pass file and calculate a modified total error based upon
   // the bias/power function used to allocate bits.
   {
-    const FIRSTPASS_STATS *const start_pos = twopass->stats_in;
-    FIRSTPASS_STATS this_frame;
-    const double av_error = stats->ssim_weighted_pred_err /
-                                DOUBLE_DIVIDE_CHECK(stats->count);
-
-
-    twopass->modified_error_total = 0.0;
-    twopass->modified_error_min =
-        (av_error * oxcf->two_pass_vbrmin_section) / 100;
-    twopass->modified_error_max =
-        (av_error * oxcf->two_pass_vbrmax_section) / 100;
-
-    while (input_stats(twopass, &this_frame) != EOF) {
-      twopass->modified_error_total += calculate_modified_err(twopass, oxcf,
-                                                              &this_frame);
+    const double avg_error = stats->ssim_weighted_pred_err /
+                                 DOUBLE_DIVIDE_CHECK(stats->count);
+    const FIRSTPASS_STATS *s = twopass->stats_in;
+    double modified_error_total = 0.0;
+    twopass->modified_error_min = (avg_error *
+                                      oxcf->two_pass_vbrmin_section) / 100;
+    twopass->modified_error_max = (avg_error *
+                                      oxcf->two_pass_vbrmax_section) / 100;
+    while (s < twopass->stats_in_end) {
+      modified_error_total += calculate_modified_err(twopass, oxcf, s);
+      ++s;
     }
-    twopass->modified_error_left = twopass->modified_error_total;
-
-    reset_fpf_position(twopass, start_pos);
+    twopass->modified_error_left = modified_error_total;
   }
 
   // Reset the vbr bits off target counter
index d84793e28e11b0edd97fc5c53b0c14f8eb54881d..1a61132c66c66fa50f6e32b87280f2028b4c1fdb 100644 (file)
@@ -51,7 +51,6 @@ typedef struct {
   int64_t bits_left;
   double modified_error_min;
   double modified_error_max;
-  double modified_error_total;
   double modified_error_left;
   double kf_intra_err_min;
   double gf_intra_err_min;