shithub: libvpx

Download patch

ref: 9a4e175a6458d6439f920c436665b235ba589e33
parent: b09d37af0c4715db6fb29264d33b48bae0bd3e1b
author: James Zern <jzern@google.com>
date: Sat Jul 13 14:21:05 EDT 2013

filter_block_plane: reuse some constants

+ light const application
+ limit scope of params to build_lfi

Change-Id: I1031c556aec160a690921dc10e7aa8a707f43ecd

--- a/vp9/common/vp9_loopfilter.c
+++ b/vp9/common/vp9_loopfilter.c
@@ -117,9 +117,9 @@
   }
 }
 
-static int build_lfi(const VP9_COMMON *cm, const MB_MODE_INFO *mbmi,
-                      struct loop_filter_info *lfi) {
-  const loop_filter_info_n *const lfi_n = &cm->lf_info;
+static int build_lfi(const loop_filter_info_n *const lfi_n,
+                     const MB_MODE_INFO *const mbmi,
+                     struct loop_filter_info *const lfi) {
   const int seg = mbmi->segment_id;
   const int ref = mbmi->ref_frame[0];
   const int mode = lfi_n->mode_lf_lut[mbmi->mode];
@@ -230,13 +230,13 @@
   }
 }
 
-static void filter_block_plane(VP9_COMMON *cm, MACROBLOCKD *xd,
+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;
-  const int row_step = 1 << xd->plane[plane].subsampling_y;
-  const int col_step = 1 << xd->plane[plane].subsampling_x;
-  struct buf_2d * const dst = &xd->plane[plane].dst;
+  const int row_step = 1 << ss_x;
+  const int col_step = 1 << ss_y;
+  struct buf_2d *const dst = &xd->plane[plane].dst;
   uint8_t* const dst0 = dst->buf;
   unsigned int mask_16x16[MI_BLOCK_SIZE] = {0};
   unsigned int mask_8x8[MI_BLOCK_SIZE] = {0};
@@ -244,8 +244,8 @@
   unsigned int mask_4x4_int[MI_BLOCK_SIZE] = {0};
   struct loop_filter_info lfi[MI_BLOCK_SIZE][MI_BLOCK_SIZE];
   int r, c;
-  MODE_INFO *mi = xd->mode_info_context;
-  int row_step_stride = cm->mode_info_stride * row_step;
+  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;
@@ -271,8 +271,7 @@
       const int skip_border_4x4_r = ss_y && mi_row + r == cm->mi_rows - 1;
 
       // Filter level can vary per MI
-      if (!build_lfi(cm, &mi[c].mbmi,
-                     lfi[r] + (c >> xd->plane[plane].subsampling_x)))
+      if (!build_lfi(&cm->lf_info, &mi[c].mbmi, lfi[r] + (c >> ss_x)))
         continue;
 
       // Build masks based on the transform size of each block