shithub: libvpx

Download patch

ref: 91907e0bf445e63e24257296248d96396cdeb731
parent: 96a42aaa2d5e14eb16891f14a1364f4e91ed100d
author: John Koleszar <jkoleszar@google.com>
date: Wed Jun 8 09:08:12 EDT 2011

vp8_pick_intra_mode: correct returned rate

The returned rate was always the 4x4 rate, instead of the rate
matching the selected mode.

Change-Id: I51da31f80884f5e37f3bcc77d1047d31e612ded4

--- a/vp8/encoder/pickinter.c
+++ b/vp8/encoder/pickinter.c
@@ -972,7 +972,7 @@
 void vp8_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate_)
 {
     int error4x4, error16x16 = INT_MAX;
-    int rate, distortion, best_distortion;
+    int rate, best_rate = 0, distortion, best_distortion;
     MB_PREDICTION_MODE mode, best_mode = DC_PRED;
     int this_rd;
 
@@ -995,6 +995,7 @@
             error16x16 = this_rd;
             best_mode = mode;
             best_distortion = distortion;
+            best_rate = rate;
         }
     }
     x->e_mbd.mode_info_context->mbmi.mode = best_mode;
@@ -1002,7 +1003,10 @@
     error4x4 = pick_intra4x4mby_modes(IF_RTCD(&cpi->rtcd), x, &rate,
                                       &best_distortion);
     if (error4x4 < error16x16)
+    {
         x->e_mbd.mode_info_context->mbmi.mode = B_PRED;
+        best_rate = rate;
+    }
 
-    *rate_ = rate;
+    *rate_ = best_rate;
 }
--