]> granicus.if.org Git - libvpx/commitdiff
Reduce the usage of widerlpf
authorYaowu Xu <yaowu@google.com>
Thu, 10 Jan 2013 18:55:07 +0000 (10:55 -0800)
committerYaowu Xu <yaowu@google.com>
Fri, 11 Jan 2013 04:15:47 +0000 (20:15 -0800)
The commit changed to not to use wider lpf within a superblock when
32x32 transform is used for the block.

The commit also changed to use the shorter version of loop filtering:
for UV planes.

Change-Id: I344c1fb9a3be9d1200782a788bcb0b001fedcff8

vp9/common/vp9_loopfilter.c
vp9/common/vp9_loopfilter_filters.c

index 0badd276c69e15b3a6710b77f8e466abe471566b..a7973bea6b2b95a17651faa081ae03e381524450 100644 (file)
@@ -176,19 +176,31 @@ void vp9_loop_filter_frame_init(VP9_COMMON *cm,
   }
 }
 
+// Determine if we should skip inner-MB loop filtering within a MB
+// The current condition is that the loop filtering is skipped only
+// the MB uses a prediction size of 16x16 and either 16x16 transform
+// is used or there is no residue at all.
 static int mb_lf_skip(const MB_MODE_INFO *const mbmi) {
   const MB_PREDICTION_MODE mode = mbmi->mode;
   const int skip_coef = mbmi->mb_skip_coeff;
   const int tx_size = mbmi->txfm_size;
   return mode != B_PRED && mode != I8X8_PRED && mode != SPLITMV &&
-         tx_size >= TX_16X16 && skip_coef;
+         (tx_size >= TX_16X16 || skip_coef);
 }
+
+// Determine if we should skip MB loop filtering on a MB edge within
+// a superblock, the current condition is that MB loop filtering is
+// skipped only when both MBs do not use inner MB loop filtering, and
+// same motion vector with same reference frame
 static int sb_mb_lf_skip(const MODE_INFO *const mip0,
                          const MODE_INFO *const mip1) {
-  return mb_lf_skip(&mip0->mbmi) &&
-         mb_lf_skip(&mip1->mbmi) &&
-         mip0->mbmi.txfm_size >= TX_32X32 &&
-         mip0->mbmi.ref_frame;
+  const MB_MODE_INFO *mbmi0 = &mip0->mbmi;
+  const MB_MODE_INFO *mbmi1 = &mip0->mbmi;
+  return mb_lf_skip(mbmi0) && mb_lf_skip(mbmi1) &&
+         (mbmi0->ref_frame == mbmi1->ref_frame) &&
+         (mbmi0->mv[mbmi0->ref_frame].as_int ==
+          mbmi1->mv[mbmi1->ref_frame].as_int) &&
+         mbmi0->ref_frame != INTRA_FRAME;
 }
 void vp9_loop_filter_frame(VP9_COMMON *cm,
                            MACROBLOCKD *xd,
@@ -235,9 +247,10 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
           lfi.lim = lfi_n->lim[filter_level];
           lfi.hev_thr = lfi_n->hev_thr[hev_index];
 
-          if (mb_col > 0
-              && !((mb_col & 1) && mode_info_context->mbmi.sb_type &&
-                   sb_mb_lf_skip(mode_info_context - 1, mode_info_context))
+          if (mb_col > 0 &&
+              !((mb_col & 1) && mode_info_context->mbmi.sb_type &&
+                (sb_mb_lf_skip(mode_info_context - 1, mode_info_context) ||
+                 tx_size >= TX_32X32))
               ) {
 #if CONFIG_WIDERLPF
             if (tx_size >= TX_16X16)
@@ -258,9 +271,10 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
 
           }
           /* don't apply across umv border */
-          if (mb_row > 0
-              && !((mb_row & 1) && mode_info_context->mbmi.sb_type &&
-                   sb_mb_lf_skip(mode_info_context - mis, mode_info_context))
+          if (mb_row > 0 &&
+              !((mb_row & 1) && mode_info_context->mbmi.sb_type &&
+                (sb_mb_lf_skip(mode_info_context - mis, mode_info_context) ||
+                tx_size >= TX_32X32))
               ) {
 #if CONFIG_WIDERLPF
             if (tx_size >= TX_16X16)
index c73e37ba3fd3b6775b5c64ed90edfdc7d942efe4..18438270f7ee1a4252b53749d13adbcb7286ffbc 100644 (file)
@@ -682,11 +682,11 @@ void vp9_lpf_mbv_w(unsigned char *y_ptr, unsigned char *u_ptr,
                                     lfi->mblim, lfi->lim, lfi->hev_thr, 2);
 
   if (u_ptr)
-    vp9_mb_lpf_vertical_edge_w(u_ptr, uv_stride,
+    vp9_mbloop_filter_vertical_edge_c(u_ptr, uv_stride,
                                       lfi->mblim, lfi->lim, lfi->hev_thr, 1);
 
   if (v_ptr)
-    vp9_mb_lpf_vertical_edge_w(v_ptr, uv_stride,
+    vp9_mbloop_filter_vertical_edge_c(v_ptr, uv_stride,
                                       lfi->mblim, lfi->lim, lfi->hev_thr, 1);
 }
 void vp9_lpf_mbh_w(unsigned char *y_ptr, unsigned char *u_ptr,
@@ -696,11 +696,11 @@ void vp9_lpf_mbh_w(unsigned char *y_ptr, unsigned char *u_ptr,
                                       lfi->mblim, lfi->lim, lfi->hev_thr, 2);
 
   if (u_ptr)
-    vp9_mb_lpf_horizontal_edge_w(u_ptr, uv_stride,
+    vp9_mbloop_filter_horizontal_edge_c(u_ptr, uv_stride,
                                         lfi->mblim, lfi->lim, lfi->hev_thr, 1);
 
   if (v_ptr)
-    vp9_mb_lpf_horizontal_edge_w(v_ptr, uv_stride,
+    vp9_mbloop_filter_horizontal_edge_c(v_ptr, uv_stride,
                                         lfi->mblim, lfi->lim, lfi->hev_thr, 1);
 }