]> granicus.if.org Git - libvpx/commitdiff
Reinitialize motion search tables on frame size change
authorJohn Koleszar <jkoleszar@google.com>
Mon, 4 Mar 2013 23:21:45 +0000 (15:21 -0800)
committerJohn Koleszar <jkoleszar@google.com>
Tue, 5 Mar 2013 00:00:01 +0000 (16:00 -0800)
Make sure the motion search is done with the offsets calculated from
the correct stride.

Change-Id: Ifbcc0f742eda3399c255bfcfa1cdee9a4bb4b4e7

vp9/encoder/vp9_onyx_if.c

index 6335827cfcd7be7b09b5cc3134c033401c7afd69..667769ecc04f82abc96f4f3c02fdd9615db18c4b 100644 (file)
@@ -732,7 +732,6 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
   int mode = cpi->compressor_speed;
   int speed = cpi->Speed;
   int i;
-  VP9_COMMON *cm = &cpi->common;
 
   // Only modes 0 and 1 supported for now in experimental code basae
   if (mode > 1)
@@ -832,16 +831,6 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
     sf->improved_dct = 0;
   }
 
-  {
-    int y_stride = cm->yv12_fb[cm->ref_frame_map[cpi->lst_fb_idx]].y_stride;
-
-    if (cpi->sf.search_method == NSTEP) {
-      vp9_init3smotion_compensation(&cpi->mb, y_stride);
-    } else if (cpi->sf.search_method == DIAMOND) {
-      vp9_init_dsmotion_compensation(&cpi->mb, y_stride);
-    }
-  }
-
   cpi->mb.fwd_txm16x16  = vp9_short_fdct16x16;
   cpi->mb.fwd_txm8x8    = vp9_short_fdct8x8;
   cpi->mb.fwd_txm8x4    = vp9_short_fdct8x4;
@@ -1025,6 +1014,16 @@ static void update_frame_size(VP9_COMP *cpi) {
                                     width, height, VP9BORDERINPIXELS))
     vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
                        "Failed to reallocate scaled source buffer");
+
+  {
+    int y_stride = cpi->scaled_source.y_stride;
+
+    if (cpi->sf.search_method == NSTEP) {
+      vp9_init3smotion_compensation(&cpi->mb, y_stride);
+    } else if (cpi->sf.search_method == DIAMOND) {
+      vp9_init_dsmotion_compensation(&cpi->mb, y_stride);
+    }
+  }
 }