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
This commit is contained in:
Adrian Grange 2011-04-13 12:56:46 -07:00
parent 538f110407
commit 8861174624

View 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;
}