shithub: libvpx

Download patch

ref: 2fd20eb37d3221f17150f64e9844fc9a1086cb49
parent: 7c134bc0cdad93bf2b6037ca56e91a6af74eadba
parent: f2a6bcfb18c9fc6c92ae26b00e502fb25b98bf68
author: Scott LaVarnway <[email protected]>
date: Tue Jul 23 02:43:52 EDT 2013

Merge "Eliminated prev_mip memsets/memcpys in encoder"

--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -3460,16 +3460,25 @@
   cm->last_width = cm->width;
   cm->last_height = cm->height;
 
-  // Don't increment frame counters if this was an altref buffer
-  // update not a real frame
+  // reset to normal state now that we are done.
   cm->last_show_frame = cm->show_frame;
   if (cm->show_frame) {
+    // current mip will be the prev_mip for the next frame
+    MODE_INFO *temp = cm->prev_mip;
+    cm->prev_mip = cm->mip;
+    cm->mip = temp;
+
+    // update the upper left visible macroblock ptrs
+    cm->mi = cm->mip + cm->mode_info_stride + 1;
+
+    // Don't increment frame counters if this was an altref buffer
+    // update not a real frame
     ++cm->current_video_frame;
     ++cpi->frames_since_key;
   }
+  // restore prev_mi
+  cm->prev_mi = cm->prev_mip + cm->mode_info_stride + 1;
 
-  // reset to normal state now that we are done.
-
 #if 0
   {
     char filename[512];
@@ -3486,17 +3495,6 @@
   vp9_write_yuv_rec_frame(cm);
 #endif
 
-  if (cm->show_frame) {
-    vpx_memcpy(cm->prev_mip, cm->mip,
-               cm->mode_info_stride * (cm->mi_rows + MI_BLOCK_SIZE) *
-               sizeof(MODE_INFO));
-  } else {
-    vpx_memset(cm->prev_mip, 0,
-               cm->mode_info_stride * (cm->mi_rows + MI_BLOCK_SIZE) *
-               sizeof(MODE_INFO));
-  }
-  // restore prev_mi
-  cm->prev_mi = cm->prev_mip + cm->mode_info_stride + 1;
 }
 
 static void Pass2Encode(VP9_COMP *cpi, unsigned long *size,