]> granicus.if.org Git - libvpx/commitdiff
Fix dual prediction recode loop.
authorRonald S. Bultje <rbultje@google.com>
Wed, 8 Feb 2012 22:55:46 +0000 (14:55 -0800)
committerRonald S. Bultje <rbultje@google.com>
Wed, 8 Feb 2012 22:55:46 +0000 (14:55 -0800)
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

index f06930968c2b5c76bdb6ff8b8509563a4597c2bd..388d8a6bb2d64d253f0afac2883cfc72ab3921b6 100644 (file)
@@ -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;
+                }
             }
         }
     }