shithub: libvpx

Download patch

ref: bfca084fcd192e78c1879e566c4ddd57af3426c6
parent: 9961ad479a475fb035bfc3c46059abe0436ed57b
author: Scott LaVarnway <slavarnway@google.com>
date: Tue Dec 4 11:52:47 EST 2012

Moving mbs_tested_so_far, mode_test_hit_counts to macroblock struct

Change-Id: Ifa78c0a953fab3e5dd7af0446924846c7022cd09

--- a/vp8/encoder/block.h
+++ b/vp8/encoder/block.h
@@ -140,6 +140,8 @@
 
     int rd_thresh_mult[MAX_MODES];
     int rd_threshes[MAX_MODES];
+    unsigned int mbs_tested_so_far;
+    unsigned int mode_test_hit_counts[MAX_MODES];
 
 
     void (*short_fdct4x4)(short *input, short *output, int pitch);
--- a/vp8/encoder/ethreading.c
+++ b/vp8/encoder/ethreading.c
@@ -482,7 +482,7 @@
         mb->prediction_error = 0;
         mb->intra_error = 0;
         vp8_zero(mb->count_mb_ref_frame_usage);
-
+        mb->mbs_tested_so_far = 0;
     }
 }
 
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -640,11 +640,10 @@
     for (i = 0; i < MAX_MODES; i ++)
     {
         cpi->mode_check_freq[i] = 0;
-        cpi->mode_test_hit_counts[i] = 0;
         cpi->mode_chosen_counts[i] = 0;
     }
 
-    cpi->mbs_tested_so_far = 0;
+    cpi->mb.mbs_tested_so_far = 0;
 
     /* best quality defaults */
     sf->RD = 1;
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -349,9 +349,7 @@
     int ambient_err;
 
     unsigned int mode_check_freq[MAX_MODES];
-    unsigned int mode_test_hit_counts[MAX_MODES];
     unsigned int mode_chosen_counts[MAX_MODES];
-    unsigned int mbs_tested_so_far;
 
     int rd_baseline_thresh[MAX_MODES];
 
--- a/vp8/encoder/pickinter.c
+++ b/vp8/encoder/pickinter.c
@@ -680,7 +680,7 @@
     get_predictor_pointers(cpi, plane, recon_yoffset, recon_uvoffset);
 
     /* Count of the number of MBs tested so far this frame */
-    cpi->mbs_tested_so_far++;
+    x->mbs_tested_so_far++;
 
     *returnintra = INT_MAX;
     x->skip = 0;
@@ -746,11 +746,11 @@
         /* Check to see if the testing frequency for this mode is at its max
          * If so then prevent it from being tested and increase the threshold
          * for its testing */
-        if (cpi->mode_test_hit_counts[mode_index] &&
+        if (x->mode_test_hit_counts[mode_index] &&
                                          (cpi->mode_check_freq[mode_index] > 1))
         {
-            if (cpi->mbs_tested_so_far <= (cpi->mode_check_freq[mode_index] *
-                                         cpi->mode_test_hit_counts[mode_index]))
+            if (x->mbs_tested_so_far <= (cpi->mode_check_freq[mode_index] *
+                                         x->mode_test_hit_counts[mode_index]))
             {
                 /* Increase the threshold for coding this mode to make it less
                  * likely to be chosen */
@@ -769,7 +769,7 @@
         /* We have now reached the point where we are going to test the current
          * mode so increment the counter for the number of times it has been
          * tested */
-        cpi->mode_test_hit_counts[mode_index] ++;
+        x->mode_test_hit_counts[mode_index] ++;
 
         rate2 = 0;
         distortion2 = 0;
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -265,6 +265,11 @@
 
     vp8_set_speed_features(cpi);
 
+    for (i = 0; i < MAX_MODES; i++)
+    {
+        x->mode_test_hit_counts[i] = 0;
+    }
+
     q = (int)pow(Qvalue, 1.25);
 
     if (q < 8)
@@ -2010,7 +2015,7 @@
 
     *returnintra = INT_MAX;
     /* Count of the number of MBs tested so far this frame */
-    cpi->mbs_tested_so_far++;
+    x->mbs_tested_so_far++;
 
     x->skip = 0;
 
@@ -2068,9 +2073,9 @@
          * max If so then prevent it from being tested and increase the
          * threshold for its testing
          */
-        if (cpi->mode_test_hit_counts[mode_index] && (cpi->mode_check_freq[mode_index] > 1))
+        if (x->mode_test_hit_counts[mode_index] && (cpi->mode_check_freq[mode_index] > 1))
         {
-            if (cpi->mbs_tested_so_far  <= cpi->mode_check_freq[mode_index] * cpi->mode_test_hit_counts[mode_index])
+            if (x->mbs_tested_so_far  <= cpi->mode_check_freq[mode_index] * x->mode_test_hit_counts[mode_index])
             {
                 /* Increase the threshold for coding this mode to make it
                  * less likely to be chosen
@@ -2092,7 +2097,7 @@
          * current mode so increment the counter for the number of times
          * it has been tested
          */
-        cpi->mode_test_hit_counts[mode_index] ++;
+        x->mode_test_hit_counts[mode_index] ++;
 
         /* Experimental code. Special case for gf and arf zeromv modes.
          * Increase zbin size to supress noise
--