shithub: libvpx

Download patch

ref: 8861174624fc52d6b5e6516448a9216226860cb3
parent: 538f1104078c444f962ed615b873d2d551758843
author: Adrian Grange <agrange@google.com>
date: Wed Apr 13 08:56:46 EDT 2011

Fixed use of early breakout in vp8_pick_intra4x4mby_modes

Index i is used to detect early breakout from the first loop, but
its value is lost due to reuse in the second for loop. I moved
the position of the second loop and did some format cleanup.

Change-Id: I02780eae1bd89df4b6c000fb8a018b0837aac2e5

--- a/vp8/encoder/pickinter.c
+++ b/vp8/encoder/pickinter.c
@@ -212,7 +212,13 @@
 }
 
 
-int vp8_pick_intra4x4mby_modes(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *mb, int *Rate, int *best_dist)
+int vp8_pick_intra4x4mby_modes
+(
+    const VP8_ENCODER_RTCD *rtcd,
+    MACROBLOCK *mb,
+    int *Rate,
+    int *best_dist
+)
 {
     MACROBLOCKD *const xd = &mb->e_mbd;
     int i;
@@ -239,14 +245,12 @@
 
         mic->bmi[i].mode = xd->block[i].bmi.mode = best_mode;
 
-        // Break out case where we have already exceeded best so far value that was bassed in
+        // Break out case where we have already exceeded best so far value
+        // that was passed in
         if (distortion > *best_dist)
             break;
     }
 
-    for (i = 0; i < 16; i++)
-        xd->block[i].bmi.mv.as_int = 0;
-
     *Rate = cost;
 
     if (i == 16)
@@ -259,6 +263,9 @@
         *best_dist = INT_MAX;
         error = INT_MAX;
     }
+
+    for (i = 0; i < 16; i++)
+        xd->block[i].bmi.mv.as_int = 0;
 
     return error;
 }