From 915f13bd5972c7e004b48533a455c9c7b7bc6d2d Mon Sep 17 00:00:00 2001
From: "Ronald S. Bultje" <rbultje@google.com>
Date: Wed, 8 Feb 2012 14:55:46 -0800
Subject: [PATCH] Fix dual prediction recode loop.

We should only change the dual prediction mode if we actually entered
the recode branch. Else, it may potentially undo beneficial changes
to the dual prediction mode in the first encode iteration.

Change-Id: I79fc53e5fd0bb551092ed422c797619f1566f002
---
 vp8/encoder/encodeframe.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c
index f06930968c..388d8a6bb2 100644
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -1537,21 +1537,21 @@ void vp8_encode_frame(VP8_COMP *cpi)
         if (redo)
         {
             encode_frame_internal(cpi);
-        }
 
-        if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
-        {
-            if (cpi->dual_pred_count[0] == 0 &&
-                cpi->dual_pred_count[1] == 0 &&
-                cpi->dual_pred_count[2] == 0)
-            {
-                cpi->common.dual_pred_mode = SINGLE_PREDICTION_ONLY;
-            }
-            else if (cpi->single_pred_count[0] == 0 &&
-                     cpi->single_pred_count[1] == 0 &&
-                     cpi->single_pred_count[2] == 0)
+            if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
             {
-                cpi->common.dual_pred_mode = DUAL_PREDICTION_ONLY;
+                if (cpi->dual_pred_count[0] == 0 &&
+                    cpi->dual_pred_count[1] == 0 &&
+                    cpi->dual_pred_count[2] == 0)
+                {
+                    cpi->common.dual_pred_mode = SINGLE_PREDICTION_ONLY;
+                }
+                else if (cpi->single_pred_count[0] == 0 &&
+                         cpi->single_pred_count[1] == 0 &&
+                         cpi->single_pred_count[2] == 0)
+                {
+                    cpi->common.dual_pred_mode = DUAL_PREDICTION_ONLY;
+                }
             }
         }
     }
-- 
GitLab