Adds support for switchable interpolation filters.

Allows for swtiching/setting interpolation filters at the MB
level. A frame level flag indicates whether to use a specifc
filter for the entire frame or to signal the interpolation
filter for each MB. When switchable filters are used, the
encoder chooses between 8-tap and 8-tap sharp filters. The
code currently has options to explore other variations as well,
which will be cleaned up subsequently.

One issue with the framework is that encoding is slow. I
tried to do some tricks to speed things up but it is still slow.
Decoding speed should not be affected since the number of
filter taps remain unchanged.

With the current version, we are up 0.5% on derf on average but
some videos city/mobile improve by close to 4 and 2% respectively.
If we did a full-search by turning the SEARCH_BEST_FILTER flag
on, the results are somewhat better.

The framework can be combined with filtered prediction, and I
seek feedback regarding that.

Rebased.

Change-Id: I8f632cb2c111e76284140a2bd480945d6d42b77a
diff --git a/vp8/common/filter.c b/vp8/common/filter.c
index 856bad5..78c2390 100644
--- a/vp8/common/filter.c
+++ b/vp8/common/filter.c
@@ -46,7 +46,7 @@
 #if CONFIG_ENHANCED_INTERP
 
 #define FILTER_ALPHA       0
-#define FILTER_ALPHA_SHARP 60
+#define FILTER_ALPHA_SHARP 1
 DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters_8[SUBPEL_SHIFTS][2 * INTERP_EXTEND]) = {
 #if SUBPEL_SHIFTS==16
 #if FILTER_ALPHA == 0
@@ -91,24 +91,6 @@
   { 0,   3,  -9,  27, 118, -13,   3, -1},
   { 0,   2,  -6,  18, 122, -10,   2,  0},
   { 0,   1,  -3,   8, 126,  -5,   1,  0}
-#elif FILTER_ALPHA == 45
-  /* alpha = 0.45 */
-  { 0,   0,   0, 128,   0,   0,   0,  0},
-  { 0,   1,  -5, 126,   8,  -3,   1,  0},
-  { 0,   2,  -9, 122,  17,  -6,   2,  0},
-  { 0,   3, -13, 117,  27,  -8,   2,  0},
-  { -1,   4, -15, 111,  37, -11,   3,  0},
-  { -1,   4, -17, 104,  47, -13,   4,  0},
-  { -1,   5, -18,  96,  58, -15,   4, -1},
-  { -1,   5, -18,  87,  68, -17,   5, -1},
-  { -1,   5, -18,  78,  78, -18,   5, -1},
-  { -1,   5, -17,  68,  87, -18,   5, -1},
-  { -1,   4, -15,  58,  96, -18,   5, -1},
-  { 0,   4, -13,  47, 104, -17,   4, -1},
-  { 0,   3, -11,  37, 111, -15,   4, -1},
-  { 0,   2,  -8,  27, 117, -13,   3,  0},
-  { 0,   2,  -6,  17, 122,  -9,   2,  0},
-  { 0,   1,  -3,   8, 126,  -5,   1,  0}
 #endif  /* FILTER_ALPHA */
 #else   /* SUBPEL_SHIFTS==16 */
 #if FILTER_ALPHA == 0
@@ -130,23 +112,48 @@
   { -1,   5, -16,  58,  96, -18,   5, -1},
   { 0,   3, -11,  37, 112, -16,   4, -1},
   { 0,   2,  -6,  18, 122, -10,   2,  0}
-#elif FILTER_ALPHA == 45
-  /* alpha = 0.45 */
-  { 0,   0,   0, 128,   0,   0,   0,  0},
-  { 0,   2,  -9, 122,  17,  -6,   2,  0},
-  { -1,   4, -15, 111,  37, -11,   3,  0},
-  { -1,   5, -18,  96,  58, -15,   4, -1},
-  { -1,   5, -18,  78,  78, -18,   5, -1},
-  { -1,   4, -15,  58,  96, -18,   5, -1},
-  { 0,   3, -11,  37, 111, -15,   4, -1},
-  { 0,   2,  -6,  17, 122,  -9,   2,  0},
 #endif  /* FILTER_ALPHA */
 #endif  /* SUBPEL_SHIFTS==16 */
 };
 
 DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters_8s[SUBPEL_SHIFTS][2 * INTERP_EXTEND]) = {
 #if SUBPEL_SHIFTS==16
-#if FILTER_ALPHA_SHARP == 65
+#if FILTER_ALPHA_SHARP == 1
+  /* dct based filter */
+  {0,   0,   0, 128,   0,   0,   0, 0},
+  {-1,   3,  -7, 127,   8,  -3,   1, 0},
+  {-2,   5, -13, 125,  17,  -6,   3, -1},
+  {-3,   7, -17, 121,  27, -10,   5, -2},
+  {-4,   9, -20, 115,  37, -13,   6, -2},
+  {-4,  10, -23, 108,  48, -16,   8, -3},
+  {-4,  10, -24, 100,  59, -19,   9, -3},
+  {-4,  11, -24,  90,  70, -21,  10, -4},
+  {-4,  11, -23,  80,  80, -23,  11, -4},
+  {-4,  10, -21,  70,  90, -24,  11, -4},
+  {-3,   9, -19,  59, 100, -24,  10, -4},
+  {-3,   8, -16,  48, 108, -23,  10, -4},
+  {-2,   6, -13,  37, 115, -20,   9, -4},
+  {-2,   5, -10,  27, 121, -17,   7, -3},
+  {-1,   3,  -6,  17, 125, -13,   5, -2},
+  {0,   1,  -3,   8, 127,  -7,   3, -1}
+#elif FILTER_ALPHA_SHARP == 75
+  {0,   0,   0, 128,   0,   0,   0, 0},
+  {-1,   2,  -6, 126,   9,  -3,   2, -1},
+  {-1,   4, -11, 123,  18,  -7,   3, -1},
+  {-2,   6, -16, 119,  28, -10,   5, -2},
+  {-2,   7, -19, 113,  38, -13,   6, -2},
+  {-3,   8, -21, 106,  49, -16,   7, -2},
+  {-3,   9, -22,  99,  59, -19,   8, -3},
+  {-3,   9, -23,  90,  70, -21,   9, -3},
+  {-3,   9, -22,  80,  80, -22,   9, -3},
+  {-3,   9, -21,  70,  90, -23,   9, -3},
+  {-3,   8, -19,  59,  99, -22,   9, -3},
+  {-2,   7, -16,  49, 106, -21,   8, -3},
+  {-2,   6, -13,  38, 113, -19,   7, -2},
+  {-2,   5, -10,  28, 119, -16,   6, -2},
+  {-1,   3,  -7,  18, 123, -11,   4, -1},
+  {-1,   2,  -3,   9, 126,  -6,   2, -1}
+#elif FILTER_ALPHA_SHARP == 65
   /* alpha = 0.65 */
   { 0,   0,   0, 128,   0,   0,   0,  0},
   { 0,   2,  -6, 126,   8,  -3,   1,  0},
@@ -164,45 +171,27 @@
   { -1,   4, -10,  27, 118, -14,   5, -1},
   { -1,   2,  -6,  18, 123, -10,   3, -1},
   { 0,   1,  -3,   8, 126,  -6,   2,  0}
-#elif FILTER_ALPHA_SHARP == 60
-  /* alpha = 0.60 */
-  { 0,   0,   0, 128,   0,   0,   0,  0},
-  { 0,   2,  -6, 126,   8,  -3,   1,  0},
-  { -1,   3, -10, 123,  18,  -6,   2, -1},
-  { -1,   4, -14, 118,  28,  -9,   3, -1},
-  { -1,   5, -17, 112,  38, -12,   4, -1},
-  { -1,   6, -19, 105,  48, -15,   5, -1},
-  { -1,   6, -20,  97,  58, -17,   6, -1},
-  { -1,   6, -20,  88,  69, -19,   6, -1},
-  { -1,   6, -20,  79,  79, -20,   6, -1},
-  { -1,   6, -19,  69,  88, -20,   6, -1},
-  { -1,   6, -17,  58,  97, -20,   6, -1},
-  { -1,   5, -15,  48, 105, -19,   6, -1},
-  { -1,   4, -12,  38, 112, -17,   5, -1},
-  { -1,   3,  -9,  28, 118, -14,   4, -1},
-  { -1,   2,  -6,  18, 123, -10,   3, -1},
-  { 0,   1,  -3,   8, 126,  -6,   2,  0}
-#elif FILTER_ALPHA_SHARP == 55
-  /* alpha = 0.55 */
-  { 0,   0,   0, 128,   0,   0,   0,  0},
-  { 0,   1,  -5, 126,   8,  -3,   1,  0},
-  { -1,   2, -10, 123,  18,  -6,   2,  0},
-  { -1,   4, -13, 118,  27,  -9,   3, -1},
-  { -1,   5, -16, 112,  37, -12,   4, -1},
-  { -1,   5, -18, 105,  48, -14,   4, -1},
-  { -1,   5, -19,  97,  58, -16,   5, -1},
-  { -1,   6, -19,  88,  68, -18,   5, -1},
-  { -1,   6, -19,  78,  78, -19,   6, -1},
-  { -1,   5, -18,  68,  88, -19,   6, -1},
-  { -1,   5, -16,  58,  97, -19,   5, -1},
-  { -1,   4, -14,  48, 105, -18,   5, -1},
-  { -1,   4, -12,  37, 112, -16,   5, -1},
-  { -1,   3,  -9,  27, 118, -13,   4, -1},
-  { 0,   2,  -6,  18, 123, -10,   2, -1},
-  { 0,   1,  -3,   8, 126,  -5,   1,  0}
 #endif  /* FILTER_ALPHA_SHARP */
 #else   /* SUBPEL_SHIFTS==16 */
-#if FILTER_ALPHA_SHARP == 65
+#if FILTER_ALPHA_SHARP == 1
+  {0,   0,   0, 128,   0,   0,   0, 0},
+  {-2,   5, -13, 125,  17,  -6,   3, -1},
+  {-4,   9, -20, 115,  37, -13,   6, -2},
+  {-4,  10, -24, 100,  59, -19,   9, -3},
+  {-4,  10, -23,  81,  81, -23,  10, -4},
+  {-3,   9, -19,  59, 100, -24,  10, -4},
+  {-2,   6, -13,  37, 115, -20,   9, -4},
+  {-1,   3,  -6,  17, 125, -13,   5, -2}
+#elif FILTER_ALPHA_SHARP == 75
+  {0,   0,   0, 128,   0,   0,   0, 0},
+  {-1,   4, -11, 123,  18,  -7,   3, -1},
+  {-2,   7, -19, 113,  38, -13,   6, -2},
+  {-3,   9, -22,  99,  59, -19,   8, -3},
+  {-3,   9, -22,  80,  80, -22,   9, -3},
+  {-3,   8, -19,  59,  99, -22,   9, -3},
+  {-2,   6, -13,  38, 113, -19,   7, -2},
+  {-1,   3,  -7,  18, 123, -11,   4, -1}
+#elif FILTER_ALPHA_SHARP == 65
   /* alpha = 0.65 */
   { 0,   0,   0, 128,   0,   0,   0, 0},
   { -1,   3, -10, 123,  18,  -6,   2, -1},
@@ -212,26 +201,6 @@
   { -2,   6, -17,  59,  98, -21,   7, -2},
   { -1,   5, -13,  38, 112, -17,   5, -1},
   { -1,   2,  -6,  18, 123, -10,   3, -1}
-#elif FILTER_ALPHA_SHARP == 60
-  /* alpha = 0.60 */
-  { 0,   0,   0, 128,   0,   0,   0, 0},
-  { -1,   3, -10, 123,  18,  -6,   2, -1},
-  { -1,   5, -17, 112,  38, -12,   4, -1},
-  { -1,   6, -20,  97,  58, -17,   6, -1},
-  { -1,   6, -20,  79,  79, -20,   6, -1},
-  { -1,   6, -17,  58,  97, -20,   6, -1},
-  { -1,   4, -12,  38, 112, -17,   5, -1},
-  { -1,   2,  -6,  18, 123, -10,   3, -1}
-#elif FILTER_ALPHA_SHARP == 55
-  /* alpha = 0.55 */
-  { 0,   0,   0, 128,   0,   0,   0,  0},
-  { -1,   2, -10, 123,  18,  -6,   2,  0},
-  { -1,   5, -16, 112,  37, -12,   4, -1},
-  { -1,   5, -19,  97,  58, -16,   5, -1},
-  { -1,   6, -19,  78,  78, -19,   6, -1},
-  { -1,   5, -16,  58,  97, -19,   5, -1},
-  { -1,   4, -12,  37, 112, -16,   5, -1},
-  { 0,   2,  -6,  18, 123, -10,   2, -1}
 #endif  /* FILTER_ALPHA_SHARP */
 #endif  /* SUBPEL_SHIFTS==16 */
 };