Avoid double copying of key frames into alt and golden buffer
authorAttila Nagy <attilanagy@google.com>
Fri, 25 Feb 2011 06:21:45 +0000 (08:21 +0200)
committerAttila Nagy <attilanagy@google.com>
Fri, 25 Feb 2011 07:03:16 +0000 (09:03 +0200)
Change-Id: I726976a297a593a35ed6cba3c660e372562f7b27

vp8/encoder/onyx_if.c

index f7c2c4a..e6c83a1 100644 (file)
@@ -3130,8 +3130,11 @@ static void update_golden_frame_and_stats(VP8_COMP *cpi)
     // Update the Golden frame reconstruction buffer if signalled and the GF usage counts.
     if (cm->refresh_golden_frame)
     {
-        // Update the golden frame buffer
-        vp8_yv12_copy_frame_ptr(cm->frame_to_show, &cm->yv12_fb[cm->gld_fb_idx]);
+        if (cm->frame_type != KEY_FRAME)
+        {
+            // Update the golden frame buffer
+            vp8_yv12_copy_frame_ptr(cm->frame_to_show, &cm->yv12_fb[cm->gld_fb_idx]);
+        }
 
         // Select an interval before next GF
         if (!cpi->auto_gold)
@@ -4748,16 +4751,19 @@ static void encode_frame_to_data_rate
 
     if (cpi->oxcf.error_resilient_mode)
     {
-        // Is this an alternate reference update
-        if (cpi->common.refresh_alt_ref_frame)
-            vp8_yv12_copy_frame_ptr(cm->frame_to_show, &cm->yv12_fb[cm->alt_fb_idx]);
+        if (cm->frame_type != KEY_FRAME)
+        {
+            // Is this an alternate reference update
+            if (cm->refresh_alt_ref_frame)
+                vp8_yv12_copy_frame_ptr(cm->frame_to_show, &cm->yv12_fb[cm->alt_fb_idx]);
 
-        if (cpi->common.refresh_golden_frame)
-            vp8_yv12_copy_frame_ptr(cm->frame_to_show, &cm->yv12_fb[cm->gld_fb_idx]);
+            if (cm->refresh_golden_frame)
+                vp8_yv12_copy_frame_ptr(cm->frame_to_show, &cm->yv12_fb[cm->gld_fb_idx]);
+        }
     }
     else
     {
-        if (cpi->oxcf.play_alternate && cpi->common.refresh_alt_ref_frame && (cpi->common.frame_type != KEY_FRAME))
+        if (cpi->oxcf.play_alternate && cm->refresh_alt_ref_frame && (cm->frame_type != KEY_FRAME))
             // Update the alternate reference frame and stats as appropriate.
             update_alt_ref_frame_and_stats(cpi);
         else