Fixed use of early breakout in vp8_pick_intra4x4mby_modes
authorAdrian Grange <agrange@google.com>
Wed, 13 Apr 2011 19:56:46 +0000 (12:56 -0700)
committerAdrian Grange <agrange@google.com>
Wed, 13 Apr 2011 19:56:46 +0000 (12:56 -0700)
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

vp8/encoder/pickinter.c

index 52566e9..4b3c6c6 100644 (file)
@@ -212,7 +212,13 @@ static int pick_intra4x4block(
 }
 
 
-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 @@ int vp8_pick_intra4x4mby_modes(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *mb, int
 
         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)
@@ -260,6 +264,9 @@ int vp8_pick_intra4x4mby_modes(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *mb, int
         error = INT_MAX;
     }
 
+    for (i = 0; i < 16; i++)
+        xd->block[i].bmi.mv.as_int = 0;
+
     return error;
 }