shithub: libvpx

Download patch

ref: cc0ff7ecfa5e687d617511c9e7e779e943740e31
parent: 118ccdcd309c6bdaa967ffe1e13ba6df8aad64db
author: Dmitry Kovalev <dkovalev@google.com>
date: Fri Jul 26 15:05:37 EDT 2013

Cleanup: replacing xd->mode_info_context with temp variable.

Change-Id: I5a3e83102784cabb918a5404405fcab99c5bb9b6

--- a/vp9/common/vp9_reconinter.c
+++ b/vp9/common/vp9_reconinter.c
@@ -220,20 +220,18 @@
   return (value < 0 ? value - 2 : value + 2) / 4;
 }
 
-static int mi_mv_pred_row_q4(MACROBLOCKD *mb, int idx) {
-  const int temp = mb->mode_info_context->bmi[0].as_mv[idx].as_mv.row +
-                   mb->mode_info_context->bmi[1].as_mv[idx].as_mv.row +
-                   mb->mode_info_context->bmi[2].as_mv[idx].as_mv.row +
-                   mb->mode_info_context->bmi[3].as_mv[idx].as_mv.row;
-  return round_mv_comp_q4(temp);
+static int mi_mv_pred_row_q4(const MODE_INFO *mi, int idx) {
+  return round_mv_comp_q4(mi->bmi[0].as_mv[idx].as_mv.row +
+                          mi->bmi[1].as_mv[idx].as_mv.row +
+                          mi->bmi[2].as_mv[idx].as_mv.row +
+                          mi->bmi[3].as_mv[idx].as_mv.row);
 }
 
-static int mi_mv_pred_col_q4(MACROBLOCKD *mb, int idx) {
-  const int temp = mb->mode_info_context->bmi[0].as_mv[idx].as_mv.col +
-                   mb->mode_info_context->bmi[1].as_mv[idx].as_mv.col +
-                   mb->mode_info_context->bmi[2].as_mv[idx].as_mv.col +
-                   mb->mode_info_context->bmi[3].as_mv[idx].as_mv.col;
-  return round_mv_comp_q4(temp);
+static int mi_mv_pred_col_q4(const MODE_INFO *mi, int idx) {
+  return round_mv_comp_q4(mi->bmi[0].as_mv[idx].as_mv.col +
+                          mi->bmi[1].as_mv[idx].as_mv.col +
+                          mi->bmi[2].as_mv[idx].as_mv.col +
+                          mi->bmi[3].as_mv[idx].as_mv.col);
 }
 
 // TODO(jkoleszar): yet another mv clamping function :-(
@@ -280,15 +278,14 @@
   const int bwl = b_width_log2(bsize) - xd->plane[plane].subsampling_x;
   const int bhl = b_height_log2(bsize) - xd->plane[plane].subsampling_y;
   const int x = 4 * (block & ((1 << bwl) - 1)), y = 4 * (block >> bwl);
-  const int use_second_ref = xd->mode_info_context->mbmi.ref_frame[1] > 0;
+  const MODE_INFO *const mi = xd->mode_info_context;
+  const int use_second_ref = mi->mbmi.ref_frame[1] > 0;
   int which_mv;
 
   assert(x < (4 << bwl));
   assert(y < (4 << bhl));
-  assert(xd->mode_info_context->mbmi.sb_type < BLOCK_SIZE_SB8X8 ||
-         4 << pred_w == (4 << bwl));
-  assert(xd->mode_info_context->mbmi.sb_type < BLOCK_SIZE_SB8X8 ||
-         4 << pred_h == (4 << bhl));
+  assert(mi->mbmi.sb_type < BLOCK_SIZE_SB8X8 || 4 << pred_w == (4 << bwl));
+  assert(mi->mbmi.sb_type < BLOCK_SIZE_SB8X8 || 4 << pred_h == (4 << bhl));
 
   for (which_mv = 0; which_mv < 1 + use_second_ref; ++which_mv) {
     // source
@@ -306,20 +303,20 @@
     MV split_chroma_mv;
     int_mv clamped_mv;
 
-    if (xd->mode_info_context->mbmi.sb_type < BLOCK_SIZE_SB8X8) {
+    if (mi->mbmi.sb_type < BLOCK_SIZE_SB8X8) {
       if (plane == 0) {
-        mv = &xd->mode_info_context->bmi[block].as_mv[which_mv].as_mv;
+        mv = &mi->bmi[block].as_mv[which_mv].as_mv;
       } else {
         // TODO(jkoleszar): All chroma MVs in SPLITMV mode are taken as the
         // same MV (the average of the 4 luma MVs) but we could do something
         // smarter for non-4:2:0. Just punt for now, pending the changes to get
         // rid of SPLITMV mode entirely.
-        split_chroma_mv.row = mi_mv_pred_row_q4(xd, which_mv);
-        split_chroma_mv.col = mi_mv_pred_col_q4(xd, which_mv);
+        split_chroma_mv.row = mi_mv_pred_row_q4(mi, which_mv);
+        split_chroma_mv.col = mi_mv_pred_col_q4(mi, which_mv);
         mv = &split_chroma_mv;
       }
     } else {
-      mv = &xd->mode_info_context->mbmi.mv[which_mv].as_mv;
+      mv = &mi->mbmi.mv[which_mv].as_mv;
     }
 
     /* TODO(jkoleszar): This clamping is done in the incorrect place for the