]> granicus.if.org Git - libvpx/commitdiff
Use sharp filter for alter reference frame generation
authorJingning Han <jingning@google.com>
Wed, 24 Feb 2016 23:33:10 +0000 (15:33 -0800)
committerJingning Han <jingning@google.com>
Thu, 25 Feb 2016 22:20:38 +0000 (14:20 -0800)
This commit uses 12-tap sharp filter to generate alter reference
frame. It improves the compression performance by
derf    0.45%
hevcmr  0.35%
stdhd   0.79%

No encoding time change is observed.

Change-Id: Ia5dc26d5aae6b9b0cb782e5a28dc5066eeeb2ec8

vp10/common/filter.c
vp10/common/filter.h
vp10/encoder/temporal_filter.c

index c001f7f06384b01779ca360b76fdbc06cf047049..d9bfcbcbb52d5f6c2e79a6ea39650f3d80836fe9 100644 (file)
@@ -32,6 +32,27 @@ DECLARE_ALIGNED(256, static const InterpKernel,
   { 0, 0, 0,   8, 120, 0, 0, 0 }
 };
 
+DECLARE_ALIGNED(16, static const int16_t,
+                sub_pel_filters_12sharp[16][12]) = {
+  // intfilt 0.8
+  {0,   0,   0,   0,   0, 128,   0,   0,   0,   0,   0, 0},
+  {0,   1,  -1,   3,  -7, 127,   8,  -4,   2,  -1,   0, 0},
+  {0,   1,  -3,   5, -12, 124,  18,  -8,   4,  -2,   1, 0},
+  {-1,   2,  -4,   8, -17, 120,  28, -11,   6,  -3,   1, -1},
+  {-1,   2,  -4,  10, -21, 114,  38, -15,   8,  -4,   2, -1},
+  {-1,   3,  -5,  11, -23, 107,  49, -18,   9,  -5,   2, -1},
+  {-1,   3,  -6,  12, -25,  99,  60, -21,  11,  -6,   3, -1},
+  {-1,   3,  -6,  12, -25,  90,  70, -23,  12,  -6,   3, -1},
+  {-1,   3,  -6,  12, -24,  80,  80, -24,  12,  -6,   3, -1},
+  {-1,   3,  -6,  12, -23,  70,  90, -25,  12,  -6,   3, -1},
+  {-1,   3,  -6,  11, -21,  60,  99, -25,  12,  -6,   3, -1},
+  {-1,   2,  -5,   9, -18,  49, 107, -23,  11,  -5,   3, -1},
+  {-1,   2,  -4,   8, -15,  38, 114, -21,  10,  -4,   2, -1},
+  {-1,   1,  -3,   6, -11,  28, 120, -17,   8,  -4,   2, -1},
+  {0,   1,  -2,   4,  -8,  18, 124, -12,   5,  -3,   1, 0},
+  {0,   0,  -1,   2,  -4,   8, 127,  -7,   3,  -1,   1, 0},
+};
+
 DECLARE_ALIGNED(256, static const InterpKernel,
                 sub_pel_filters_8[SUBPEL_SHIFTS]) = {
 #if CONFIG_EXT_INTERP
@@ -157,28 +178,6 @@ DECLARE_ALIGNED(256, static const InterpKernel,
   {0,   2, -12,  37,  94,  14,  -9, 2},
   {0,   2, -11,  31,  95,  19, -10, 2},
 };
-
-DECLARE_ALIGNED(16, static const int16_t,
-                sub_pel_filters_12sharp[16][12]) = {
-  // intfilt 0.8
-  {0,   0,   0,   0,   0, 128,   0,   0,   0,   0,   0, 0},
-  {0,   1,  -1,   3,  -7, 127,   8,  -4,   2,  -1,   0, 0},
-  {0,   1,  -3,   5, -12, 124,  18,  -8,   4,  -2,   1, 0},
-  {-1,   2,  -4,   8, -17, 120,  28, -11,   6,  -3,   1, -1},
-  {-1,   2,  -4,  10, -21, 114,  38, -15,   8,  -4,   2, -1},
-  {-1,   3,  -5,  11, -23, 107,  49, -18,   9,  -5,   2, -1},
-  {-1,   3,  -6,  12, -25,  99,  60, -21,  11,  -6,   3, -1},
-  {-1,   3,  -6,  12, -25,  90,  70, -23,  12,  -6,   3, -1},
-  {-1,   3,  -6,  12, -24,  80,  80, -24,  12,  -6,   3, -1},
-  {-1,   3,  -6,  12, -23,  70,  90, -25,  12,  -6,   3, -1},
-  {-1,   3,  -6,  11, -21,  60,  99, -25,  12,  -6,   3, -1},
-  {-1,   2,  -5,   9, -18,  49, 107, -23,  11,  -5,   3, -1},
-  {-1,   2,  -4,   8, -15,  38, 114, -21,  10,  -4,   2, -1},
-  {-1,   1,  -3,   6, -11,  28, 120, -17,   8,  -4,   2, -1},
-  {0,   1,  -2,   4,  -8,  18, 124, -12,   5,  -3,   1, 0},
-  {0,   0,  -1,   2,  -4,   8, 127,  -7,   3,  -1,   1, 0},
-};
-
 #else
 
 DECLARE_ALIGNED(256, static const InterpKernel,
@@ -201,7 +200,6 @@ DECLARE_ALIGNED(256, static const InterpKernel,
   { 0, -3,  2,  41, 63, 29, -2, -2},
   { 0, -3,  1,  38, 64, 32, -1, -3}
 };
-
 #endif  // CONFIG_EXT_INTERP
 
 const InterpKernel *vp10_filter_kernels[SWITCHABLE_FILTERS + 1] = {
@@ -240,7 +238,17 @@ vp10_interp_filter_params_list[SWITCHABLE_FILTERS + 1] = {
   {(const int16_t*)bilinear_filters, SUBPEL_TAPS, SUBPEL_SHIFTS}
 };
 
+#if FILTER_12TAP
+static const InterpFilterParams vp10_interp_filter_12tap = {
+    (const int16_t*)sub_pel_filters_12sharp, 12, SUBPEL_SHIFTS
+};
+#endif
+
 InterpFilterParams vp10_get_interp_filter_params(
     const INTERP_FILTER interp_filter) {
+#if FILTER_12TAP
+  if (interp_filter == SHARP_FILTER_12TAP)
+    return vp10_interp_filter_12tap;
+#endif
   return vp10_interp_filter_params_list[interp_filter];
 }
index fea833097a4698e8c3c9bc11bee065105273fcff..df46ca83200eebc816c6afc539b323df89de4d8b 100644 (file)
@@ -43,6 +43,13 @@ extern "C" {
 #else
 #define SWITCHABLE_FILTERS  3 /* Number of switchable filters */
 #endif  // CONFIG_EXT_INTERP
+
+// TODO(jingning): Align the experiment flags and clean this up.
+#define FILTER_12TAP (!CONFIG_EXT_INTERP)
+#if FILTER_12TAP
+#define SHARP_FILTER_12TAP (SWITCHABLE_FILTERS + 1)
+#endif
+
 // The codec can operate in four possible inter prediction filter mode:
 // 8-tap, 8-tap-smooth, 8-tap-sharp, and switching between the three.
 
index afe555d5af026428b7b06b7955d2e7d9333ee412..534d10b4665ab7f49bb491a7f25891e2730624fb 100644 (file)
@@ -45,10 +45,16 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd,
                                             int x, int y) {
   const int which_mv = 0;
   const MV mv = { mv_row, mv_col };
-  const INTERP_FILTER interp_filter = xd->mi[0]->mbmi.interp_filter;
-
   enum mv_precision mv_precision_uv;
   int uv_stride;
+
+#if FILTER_12TAP
+  const INTERP_FILTER interp_filter = SHARP_FILTER_12TAP;
+  (void)xd;
+#else
+  const INTERP_FILTER interp_filter = xd->mi[0]->mbmi.interp_filter;
+#endif
+
   if (uv_block_width == 8) {
     uv_stride = (stride + 1) >> 1;
     mv_precision_uv = MV_PRECISION_Q4;