From 71fb1f8eaba95136622c29aad63a5edc75a47f2b Mon Sep 17 00:00:00 2001
From: Adrian Grange <agrange@google.com>
Date: Mon, 31 Oct 2011 12:42:00 -0700
Subject: [PATCH] Fixed this_mode used before set in vp8_pick_inter_mode

The variable this_mode was being used before it had been
initialized.

Moved the line that sets-up this_mode toward the top of the
enclosing loop, prior to its first use. The bug would result in
tests in the loop lagging the mode that was expected to be
tested.

Change-Id: If4e51600449ce6b4285f112da17a44c24b4a19fb
---
 vp8/encoder/pickinter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c
index 8c6f7dda06..404a5bf673 100644
--- a/vp8/encoder/pickinter.c
+++ b/vp8/encoder/pickinter.c
@@ -519,6 +519,8 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
         if (skip_mode[x->e_mbd.mode_info_context->mbmi.ref_frame])
             continue;
 
+        this_mode = vp8_mode_order[mode_index];
+
 #if CONFIG_SEGFEATURES
         // Experimental use of Segment features.
         if ( xd->segmentation_enabled && !cm->refresh_alt_ref_frame )
@@ -575,8 +577,6 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
         rate2 = 0;
         distortion2 = 0;
 
-        this_mode = vp8_mode_order[mode_index];
-
         // Experimental debug code.
         //all_rds[mode_index] = -1;
 
-- 
GitLab