shithub: libvpx

Download patch

ref: 4a4ade6dc8d6b4af4848c830a359b4a0fc81d1a5
parent: 4fb5ce6a920f2a0cdce231d81e98daacf84b8b15
parent: 8795b52512b69193d91d27776513439fa96a9604
author: John Koleszar <jkoleszar@google.com>
date: Fri May 27 08:35:06 EDT 2011

Merge "bug fix check frame buffer index before copy"

--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -3103,15 +3103,21 @@
 
             if (cm->copy_buffer_to_arf == 1)
             {
-                yv12_fb[cm->lst_fb_idx].flags |= VP8_ALT_FLAG;
-                yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG;
-                cm->alt_fb_idx = cm->lst_fb_idx;
+                if(cm->alt_fb_idx != cm->lst_fb_idx)
+                {
+                    yv12_fb[cm->lst_fb_idx].flags |= VP8_ALT_FLAG;
+                    yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG;
+                    cm->alt_fb_idx = cm->lst_fb_idx;
+                }
             }
             else /* if (cm->copy_buffer_to_arf == 2) */
             {
-                yv12_fb[cm->gld_fb_idx].flags |= VP8_ALT_FLAG;
-                yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG;
-                cm->alt_fb_idx = cm->gld_fb_idx;
+                if(cm->alt_fb_idx != cm->gld_fb_idx)
+                {
+                    yv12_fb[cm->gld_fb_idx].flags |= VP8_ALT_FLAG;
+                    yv12_fb[cm->alt_fb_idx].flags &= ~VP8_ALT_FLAG;
+                    cm->alt_fb_idx = cm->gld_fb_idx;
+                }
             }
         }
 
@@ -3129,15 +3135,21 @@
 
             if (cm->copy_buffer_to_gf == 1)
             {
-                yv12_fb[cm->lst_fb_idx].flags |= VP8_GOLD_FLAG;
-                yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG;
-                cm->gld_fb_idx = cm->lst_fb_idx;
+                if(cm->gld_fb_idx != cm->lst_fb_idx)
+                {
+                    yv12_fb[cm->lst_fb_idx].flags |= VP8_GOLD_FLAG;
+                    yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG;
+                    cm->gld_fb_idx = cm->lst_fb_idx;
+                }
             }
             else /* if (cm->copy_buffer_to_gf == 2) */
             {
-                yv12_fb[cm->alt_fb_idx].flags |= VP8_GOLD_FLAG;
-                yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG;
-                cm->gld_fb_idx = cm->alt_fb_idx;
+                if(cm->alt_fb_idx != cm->gld_fb_idx)
+                {
+                    yv12_fb[cm->alt_fb_idx].flags |= VP8_GOLD_FLAG;
+                    yv12_fb[cm->gld_fb_idx].flags &= ~VP8_GOLD_FLAG;
+                    cm->gld_fb_idx = cm->alt_fb_idx;
+                }
             }
         }
     }