shithub: libvpx

Download patch

ref: de012cec4f5c61b53278af831902b269dc646edc
parent: b7750812838eb84b55b8bcf25b9398cc41cdc0eb
author: James Zern <[email protected]>
date: Fri Jul 19 10:16:07 EDT 2013

filter_block_plane: remove MACROBLOCKD param

replace with direct use of the plane and MODE_INFO

Change-Id: Icce57bc398a6e3607aedde0573d977e192040696

--- a/vp9/common/vp9_loopfilter.c
+++ b/vp9/common/vp9_loopfilter.c
@@ -228,13 +228,16 @@
   }
 }
 
-static void filter_block_plane(VP9_COMMON *const cm, MACROBLOCKD *const xd,
-                               int plane, int mi_row, int mi_col) {
-  const int ss_x = xd->plane[plane].subsampling_x;
-  const int ss_y = xd->plane[plane].subsampling_y;
+static void filter_block_plane(VP9_COMMON *const cm,
+                               struct macroblockd_plane *const plane,
+                               const MODE_INFO *mi,
+                               int mi_row, int mi_col) {
+  const int ss_x = plane->subsampling_x;
+  const int ss_y = plane->subsampling_y;
   const int row_step = 1 << ss_x;
   const int col_step = 1 << ss_y;
-  struct buf_2d *const dst = &xd->plane[plane].dst;
+  const int row_step_stride = cm->mode_info_stride * row_step;
+  struct buf_2d *const dst = &plane->dst;
   uint8_t* const dst0 = dst->buf;
   unsigned int mask_16x16[MI_BLOCK_SIZE] = {0};
   unsigned int mask_8x8[MI_BLOCK_SIZE] = {0};
@@ -243,9 +246,6 @@
   struct loop_filter_info lfi[MI_BLOCK_SIZE][MI_BLOCK_SIZE];
   int r, c;
 
-  const MODE_INFO *mi = xd->mode_info_context;
-  const int row_step_stride = cm->mode_info_stride * row_step;
-
   for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += row_step) {
     unsigned int mask_16x16_c = 0;
     unsigned int mask_8x8_c = 0;
@@ -264,8 +264,9 @@
       const int block_edge_above = b_height_log2(mi[c].mbmi.sb_type) ?
           !(r & ((1 << (b_height_log2(mi[c].mbmi.sb_type)-1)) - 1)) : 1;
       const int skip_this_r = skip_this && !block_edge_above;
-      const TX_SIZE tx_size = plane ? get_uv_tx_size(&mi[c].mbmi)
-                                    : mi[c].mbmi.txfm_size;
+      const TX_SIZE tx_size = (plane->plane_type == PLANE_TYPE_UV)
+                            ? get_uv_tx_size(&mi[c].mbmi)
+                            : mi[c].mbmi.txfm_size;
       const int skip_border_4x4_c = ss_x && mi_col + c == cm->mi_cols - 1;
       const int skip_border_4x4_r = ss_y && mi_row + r == cm->mi_rows - 1;
 
@@ -349,6 +350,7 @@
 
 void vp9_loop_filter_frame(VP9_COMMON *cm, MACROBLOCKD *xd,
                            int frame_filter_level, int y_only) {
+  const int num_planes = y_only ? 1 : MAX_MB_PLANE;
   int mi_row, mi_col;
 
   // Initialize the loop filter for this frame.
@@ -361,9 +363,8 @@
       int plane;
 
       setup_dst_planes(xd, cm->frame_to_show, mi_row, mi_col);
-      for (plane = 0; plane < (y_only ? 1 : MAX_MB_PLANE); plane++) {
-        xd->mode_info_context = mi + mi_col;
-        filter_block_plane(cm, xd, plane, mi_row, mi_col);
+      for (plane = 0; plane < num_planes; ++plane) {
+        filter_block_plane(cm, &xd->plane[plane], mi + mi_col, mi_row, mi_col);
       }
     }
   }