From 8861174624fc52d6b5e6516448a9216226860cb3 Mon Sep 17 00:00:00 2001 From: Adrian Grange <agrange@google.com> Date: Wed, 13 Apr 2011 12:56:46 -0700 Subject: [PATCH] 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 --- vp8/encoder/pickinter.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c index 52566e9fd2..4b3c6c6322 100644 --- a/vp8/encoder/pickinter.c +++ b/vp8/encoder/pickinter.c @@ -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; } -- GitLab