shithub: dav1d

Download patch

ref: a0692eb8ef38e3a8715aa2e56f48d791e3bc8ceb
parent: 4a499fd51ad6e650d067fdfd6cce07f7209c54c4
author: Henrik Gramner <[email protected]>
date: Mon Nov 5 09:11:34 EST 2018

Reorder the mc warp filter array

Required to be able to use pmaddubsw without overflow in the x86 SIMD.

--- a/src/mc_tmpl.c
+++ b/src/mc_tmpl.c
@@ -442,6 +442,22 @@
 
 #undef w_mask_fns
 
+#define FILTER_WARP(src, x, F, stride) \
+    (F[0] * src[x + -3 * stride] + \
+     F[4] * src[x + -2 * stride] + \
+     F[1] * src[x + -1 * stride] + \
+     F[5] * src[x + +0 * stride] + \
+     F[2] * src[x + +1 * stride] + \
+     F[6] * src[x + +2 * stride] + \
+     F[3] * src[x + +3 * stride] + \
+     F[7] * src[x + +4 * stride])
+
+#define FILTER_WARP_RND(src, x, F, stride, sh) \
+    ((FILTER_WARP(src, x, F, stride) + ((1 << sh) >> 1)) >> sh)
+
+#define FILTER_WARP_CLIP(src, x, F, stride, sh) \
+    iclip_pixel(FILTER_WARP_RND(src, x, F, stride, sh))
+
 static void warp_affine_8x8_c(pixel *dst, const ptrdiff_t dst_stride,
                               const pixel *src, const ptrdiff_t src_stride,
                               const int16_t *const abcd, int mx, int my)
@@ -454,7 +470,7 @@
             const int8_t *const filter =
                 dav1d_mc_warp_filter[64 + ((tmx + 512) >> 10)];
 
-            mid_ptr[x] = FILTER_8TAP_RND(src, x, filter, 1, 3);
+            mid_ptr[x] = FILTER_WARP_RND(src, x, filter, 1, 3);
         }
         src += PXSTRIDE(src_stride);
         mid_ptr += 8;
@@ -466,7 +482,7 @@
             const int8_t *const filter =
                 dav1d_mc_warp_filter[64 + ((tmy + 512) >> 10)];
 
-            dst[x] = FILTER_8TAP_CLIP(mid_ptr, x, filter, 8, 11);
+            dst[x] = FILTER_WARP_CLIP(mid_ptr, x, filter, 8, 11);
         }
         mid_ptr += 8;
         dst += PXSTRIDE(dst_stride);
@@ -485,7 +501,7 @@
             const int8_t *const filter =
                 dav1d_mc_warp_filter[64 + ((tmx + 512) >> 10)];
 
-            mid_ptr[x] = FILTER_8TAP_RND(src, x, filter, 1, 3);
+            mid_ptr[x] = FILTER_WARP_RND(src, x, filter, 1, 3);
         }
         src += PXSTRIDE(src_stride);
         mid_ptr += 8;
@@ -497,7 +513,7 @@
             const int8_t *const filter =
                 dav1d_mc_warp_filter[64 + ((tmy + 512) >> 10)];
 
-            tmp[x] = FILTER_8TAP_RND(mid_ptr, x, filter, 8, 7);
+            tmp[x] = FILTER_WARP_RND(mid_ptr, x, filter, 8, 7);
         }
         mid_ptr += 8;
         tmp += tmp_stride;
--- a/src/tables.c
+++ b/src/tables.c
@@ -608,111 +608,108 @@
     }
 };
 
-const int8_t dav1d_mc_warp_filter[][8] = {
-    // [-1, 0)
-    { 0,   0, 127,   1,   0, 0, 0, 0 }, { 0, - 1, 127,   2,   0, 0, 0, 0 },
-    { 1, - 3, 127,   4, - 1, 0, 0, 0 }, { 1, - 4, 126,   6, - 2, 1, 0, 0 },
-    { 1, - 5, 126,   8, - 3, 1, 0, 0 }, { 1, - 6, 125,  11, - 4, 1, 0, 0 },
-    { 1, - 7, 124,  13, - 4, 1, 0, 0 }, { 2, - 8, 123,  15, - 5, 1, 0, 0 },
-    { 2, - 9, 122,  18, - 6, 1, 0, 0 }, { 2, -10, 121,  20, - 6, 1, 0, 0 },
-    { 2, -11, 120,  22, - 7, 2, 0, 0 }, { 2, -12, 119,  25, - 8, 2, 0, 0 },
-    { 3, -13, 117,  27, - 8, 2, 0, 0 }, { 3, -13, 116,  29, - 9, 2, 0, 0 },
-    { 3, -14, 114,  32, -10, 3, 0, 0 }, { 3, -15, 113,  35, -10, 2, 0, 0 },
-    { 3, -15, 111,  37, -11, 3, 0, 0 }, { 3, -16, 109,  40, -11, 3, 0, 0 },
-    { 3, -16, 108,  42, -12, 3, 0, 0 }, { 4, -17, 106,  45, -13, 3, 0, 0 },
-    { 4, -17, 104,  47, -13, 3, 0, 0 }, { 4, -17, 102,  50, -14, 3, 0, 0 },
-    { 4, -17, 100,  52, -14, 3, 0, 0 }, { 4, -18,  98,  55, -15, 4, 0, 0 },
-    { 4, -18,  96,  58, -15, 3, 0, 0 }, { 4, -18,  94,  60, -16, 4, 0, 0 },
-    { 4, -18,  91,  63, -16, 4, 0, 0 }, { 4, -18,  89,  65, -16, 4, 0, 0 },
-    { 4, -18,  87,  68, -17, 4, 0, 0 }, { 4, -18,  85,  70, -17, 4, 0, 0 },
-    { 4, -18,  82,  73, -17, 4, 0, 0 }, { 4, -18,  80,  75, -17, 4, 0, 0 },
-    { 4, -18,  78,  78, -18, 4, 0, 0 }, { 4, -17,  75,  80, -18, 4, 0, 0 },
-    { 4, -17,  73,  82, -18, 4, 0, 0 }, { 4, -17,  70,  85, -18, 4, 0, 0 },
-    { 4, -17,  68,  87, -18, 4, 0, 0 }, { 4, -16,  65,  89, -18, 4, 0, 0 },
-    { 4, -16,  63,  91, -18, 4, 0, 0 }, { 4, -16,  60,  94, -18, 4, 0, 0 },
-    { 3, -15,  58,  96, -18, 4, 0, 0 }, { 4, -15,  55,  98, -18, 4, 0, 0 },
-    { 3, -14,  52, 100, -17, 4, 0, 0 }, { 3, -14,  50, 102, -17, 4, 0, 0 },
-    { 3, -13,  47, 104, -17, 4, 0, 0 }, { 3, -13,  45, 106, -17, 4, 0, 0 },
-    { 3, -12,  42, 108, -16, 3, 0, 0 }, { 3, -11,  40, 109, -16, 3, 0, 0 },
-    { 3, -11,  37, 111, -15, 3, 0, 0 }, { 2, -10,  35, 113, -15, 3, 0, 0 },
-    { 3, -10,  32, 114, -14, 3, 0, 0 }, { 2, - 9,  29, 116, -13, 3, 0, 0 },
-    { 2, - 8,  27, 117, -13, 3, 0, 0 }, { 2, - 8,  25, 119, -12, 2, 0, 0 },
-    { 2, - 7,  22, 120, -11, 2, 0, 0 }, { 1, - 6,  20, 121, -10, 2, 0, 0 },
-    { 1, - 6,  18, 122, - 9, 2, 0, 0 }, { 1, - 5,  15, 123, - 8, 2, 0, 0 },
-    { 1, - 4,  13, 124, - 7, 1, 0, 0 }, { 1, - 4,  11, 125, - 6, 1, 0, 0 },
-    { 1, - 3,   8, 126, - 5, 1, 0, 0 }, { 1, - 2,   6, 126, - 4, 1, 0, 0 },
-    { 0, - 1,   4, 127, - 3, 1, 0, 0 }, { 0,   0,   2, 127, - 1, 0, 0, 0 },
-
+const int8_t ALIGN(dav1d_mc_warp_filter[193][8], 8) = {
+   // [-1, 0)
+    { 0, 127,   0, 0,   0,   1, 0, 0 }, { 0, 127,   0, 0,  -1,   2, 0, 0 },
+    { 1, 127,  -1, 0,  -3,   4, 0, 0 }, { 1, 126,  -2, 0,  -4,   6, 1, 0 },
+    { 1, 126,  -3, 0,  -5,   8, 1, 0 }, { 1, 125,  -4, 0,  -6,  11, 1, 0 },
+    { 1, 124,  -4, 0,  -7,  13, 1, 0 }, { 2, 123,  -5, 0,  -8,  15, 1, 0 },
+    { 2, 122,  -6, 0,  -9,  18, 1, 0 }, { 2, 121,  -6, 0, -10,  20, 1, 0 },
+    { 2, 120,  -7, 0, -11,  22, 2, 0 }, { 2, 119,  -8, 0, -12,  25, 2, 0 },
+    { 3, 117,  -8, 0, -13,  27, 2, 0 }, { 3, 116,  -9, 0, -13,  29, 2, 0 },
+    { 3, 114, -10, 0, -14,  32, 3, 0 }, { 3, 113, -10, 0, -15,  35, 2, 0 },
+    { 3, 111, -11, 0, -15,  37, 3, 0 }, { 3, 109, -11, 0, -16,  40, 3, 0 },
+    { 3, 108, -12, 0, -16,  42, 3, 0 }, { 4, 106, -13, 0, -17,  45, 3, 0 },
+    { 4, 104, -13, 0, -17,  47, 3, 0 }, { 4, 102, -14, 0, -17,  50, 3, 0 },
+    { 4, 100, -14, 0, -17,  52, 3, 0 }, { 4,  98, -15, 0, -18,  55, 4, 0 },
+    { 4,  96, -15, 0, -18,  58, 3, 0 }, { 4,  94, -16, 0, -18,  60, 4, 0 },
+    { 4,  91, -16, 0, -18,  63, 4, 0 }, { 4,  89, -16, 0, -18,  65, 4, 0 },
+    { 4,  87, -17, 0, -18,  68, 4, 0 }, { 4,  85, -17, 0, -18,  70, 4, 0 },
+    { 4,  82, -17, 0, -18,  73, 4, 0 }, { 4,  80, -17, 0, -18,  75, 4, 0 },
+    { 4,  78, -18, 0, -18,  78, 4, 0 }, { 4,  75, -18, 0, -17,  80, 4, 0 },
+    { 4,  73, -18, 0, -17,  82, 4, 0 }, { 4,  70, -18, 0, -17,  85, 4, 0 },
+    { 4,  68, -18, 0, -17,  87, 4, 0 }, { 4,  65, -18, 0, -16,  89, 4, 0 },
+    { 4,  63, -18, 0, -16,  91, 4, 0 }, { 4,  60, -18, 0, -16,  94, 4, 0 },
+    { 3,  58, -18, 0, -15,  96, 4, 0 }, { 4,  55, -18, 0, -15,  98, 4, 0 },
+    { 3,  52, -17, 0, -14, 100, 4, 0 }, { 3,  50, -17, 0, -14, 102, 4, 0 },
+    { 3,  47, -17, 0, -13, 104, 4, 0 }, { 3,  45, -17, 0, -13, 106, 4, 0 },
+    { 3,  42, -16, 0, -12, 108, 3, 0 }, { 3,  40, -16, 0, -11, 109, 3, 0 },
+    { 3,  37, -15, 0, -11, 111, 3, 0 }, { 2,  35, -15, 0, -10, 113, 3, 0 },
+    { 3,  32, -14, 0, -10, 114, 3, 0 }, { 2,  29, -13, 0,  -9, 116, 3, 0 },
+    { 2,  27, -13, 0,  -8, 117, 3, 0 }, { 2,  25, -12, 0,  -8, 119, 2, 0 },
+    { 2,  22, -11, 0,  -7, 120, 2, 0 }, { 1,  20, -10, 0,  -6, 121, 2, 0 },
+    { 1,  18,  -9, 0,  -6, 122, 2, 0 }, { 1,  15,  -8, 0,  -5, 123, 2, 0 },
+    { 1,  13,  -7, 0,  -4, 124, 1, 0 }, { 1,  11,  -6, 0,  -4, 125, 1, 0 },
+    { 1,   8,  -5, 0,  -3, 126, 1, 0 }, { 1,   6,  -4, 0,  -2, 126, 1, 0 },
+    { 0,   4,  -3, 0,  -1, 127, 1, 0 }, { 0,   2,  -1, 0,   0, 127, 0, 0 },
     // [0, 1)
-    { 0,  0,   0, 127,   1,   0,  0,  0}, { 0,  0,  -1, 127,   2,   0,  0,  0},
-    { 0,  1,  -3, 127,   4,  -2,  1,  0}, { 0,  1,  -5, 127,   6,  -2,  1,  0},
-    { 0,  2,  -6, 126,   8,  -3,  1,  0}, {-1,  2,  -7, 126,  11,  -4,  2, -1},
-    {-1,  3,  -8, 125,  13,  -5,  2, -1}, {-1,  3, -10, 124,  16,  -6,  3, -1},
-    {-1,  4, -11, 123,  18,  -7,  3, -1}, {-1,  4, -12, 122,  20,  -7,  3, -1},
-    {-1,  4, -13, 121,  23,  -8,  3, -1}, {-2,  5, -14, 120,  25,  -9,  4, -1},
-    {-1,  5, -15, 119,  27, -10,  4, -1}, {-1,  5, -16, 118,  30, -11,  4, -1},
-    {-2,  6, -17, 116,  33, -12,  5, -1}, {-2,  6, -17, 114,  35, -12,  5, -1},
-    {-2,  6, -18, 113,  38, -13,  5, -1}, {-2,  7, -19, 111,  41, -14,  6, -2},
-    {-2,  7, -19, 110,  43, -15,  6, -2}, {-2,  7, -20, 108,  46, -15,  6, -2},
-    {-2,  7, -20, 106,  49, -16,  6, -2}, {-2,  7, -21, 104,  51, -16,  7, -2},
-    {-2,  7, -21, 102,  54, -17,  7, -2}, {-2,  8, -21, 100,  56, -18,  7, -2},
-    {-2,  8, -22,  98,  59, -18,  7, -2}, {-2,  8, -22,  96,  62, -19,  7, -2},
-    {-2,  8, -22,  94,  64, -19,  7, -2}, {-2,  8, -22,  91,  67, -20,  8, -2},
-    {-2,  8, -22,  89,  69, -20,  8, -2}, {-2,  8, -22,  87,  72, -21,  8, -2},
-    {-2,  8, -21,  84,  74, -21,  8, -2}, {-2,  8, -22,  82,  77, -21,  8, -2},
-    {-2,  8, -21,  79,  79, -21,  8, -2}, {-2,  8, -21,  77,  82, -22,  8, -2},
-    {-2,  8, -21,  74,  84, -21,  8, -2}, {-2,  8, -21,  72,  87, -22,  8, -2},
-    {-2,  8, -20,  69,  89, -22,  8, -2}, {-2,  8, -20,  67,  91, -22,  8, -2},
-    {-2,  7, -19,  64,  94, -22,  8, -2}, {-2,  7, -19,  62,  96, -22,  8, -2},
-    {-2,  7, -18,  59,  98, -22,  8, -2}, {-2,  7, -18,  56, 100, -21,  8, -2},
-    {-2,  7, -17,  54, 102, -21,  7, -2}, {-2,  7, -16,  51, 104, -21,  7, -2},
-    {-2,  6, -16,  49, 106, -20,  7, -2}, {-2,  6, -15,  46, 108, -20,  7, -2},
-    {-2,  6, -15,  43, 110, -19,  7, -2}, {-2,  6, -14,  41, 111, -19,  7, -2},
-    {-1,  5, -13,  38, 113, -18,  6, -2}, {-1,  5, -12,  35, 114, -17,  6, -2},
-    {-1,  5, -12,  33, 116, -17,  6, -2}, {-1,  4, -11,  30, 118, -16,  5, -1},
-    {-1,  4, -10,  27, 119, -15,  5, -1}, {-1,  4,  -9,  25, 120, -14,  5, -2},
-    {-1,  3,  -8,  23, 121, -13,  4, -1}, {-1,  3,  -7,  20, 122, -12,  4, -1},
-    {-1,  3,  -7,  18, 123, -11,  4, -1}, {-1,  3,  -6,  16, 124, -10,  3, -1},
-    {-1,  2,  -5,  13, 125,  -8,  3, -1}, {-1,  2,  -4,  11, 126,  -7,  2, -1},
-    { 0,  1,  -3,   8, 126,  -6,  2,  0}, { 0,  1,  -2,   6, 127,  -5,  1,  0},
-    { 0,  1,  -2,   4, 127,  -3,  1,  0}, { 0,  0,   0,   2, 127,  -1,  0,  0},
-
+    {  0,   0,   1, 0, 0, 127,   0,  0 }, {  0,  -1,   2, 0, 0, 127,   0,  0 },
+    {  0,  -3,   4, 1, 1, 127,  -2,  0 }, {  0,  -5,   6, 1, 1, 127,  -2,  0 },
+    {  0,  -6,   8, 1, 2, 126,  -3,  0 }, { -1,  -7,  11, 2, 2, 126,  -4, -1 },
+    { -1,  -8,  13, 2, 3, 125,  -5, -1 }, { -1, -10,  16, 3, 3, 124,  -6, -1 },
+    { -1, -11,  18, 3, 4, 123,  -7, -1 }, { -1, -12,  20, 3, 4, 122,  -7, -1 },
+    { -1, -13,  23, 3, 4, 121,  -8, -1 }, { -2, -14,  25, 4, 5, 120,  -9, -1 },
+    { -1, -15,  27, 4, 5, 119, -10, -1 }, { -1, -16,  30, 4, 5, 118, -11, -1 },
+    { -2, -17,  33, 5, 6, 116, -12, -1 }, { -2, -17,  35, 5, 6, 114, -12, -1 },
+    { -2, -18,  38, 5, 6, 113, -13, -1 }, { -2, -19,  41, 6, 7, 111, -14, -2 },
+    { -2, -19,  43, 6, 7, 110, -15, -2 }, { -2, -20,  46, 6, 7, 108, -15, -2 },
+    { -2, -20,  49, 6, 7, 106, -16, -2 }, { -2, -21,  51, 7, 7, 104, -16, -2 },
+    { -2, -21,  54, 7, 7, 102, -17, -2 }, { -2, -21,  56, 7, 8, 100, -18, -2 },
+    { -2, -22,  59, 7, 8,  98, -18, -2 }, { -2, -22,  62, 7, 8,  96, -19, -2 },
+    { -2, -22,  64, 7, 8,  94, -19, -2 }, { -2, -22,  67, 8, 8,  91, -20, -2 },
+    { -2, -22,  69, 8, 8,  89, -20, -2 }, { -2, -22,  72, 8, 8,  87, -21, -2 },
+    { -2, -21,  74, 8, 8,  84, -21, -2 }, { -2, -22,  77, 8, 8,  82, -21, -2 },
+    { -2, -21,  79, 8, 8,  79, -21, -2 }, { -2, -21,  82, 8, 8,  77, -22, -2 },
+    { -2, -21,  84, 8, 8,  74, -21, -2 }, { -2, -21,  87, 8, 8,  72, -22, -2 },
+    { -2, -20,  89, 8, 8,  69, -22, -2 }, { -2, -20,  91, 8, 8,  67, -22, -2 },
+    { -2, -19,  94, 8, 7,  64, -22, -2 }, { -2, -19,  96, 8, 7,  62, -22, -2 },
+    { -2, -18,  98, 8, 7,  59, -22, -2 }, { -2, -18, 100, 8, 7,  56, -21, -2 },
+    { -2, -17, 102, 7, 7,  54, -21, -2 }, { -2, -16, 104, 7, 7,  51, -21, -2 },
+    { -2, -16, 106, 7, 6,  49, -20, -2 }, { -2, -15, 108, 7, 6,  46, -20, -2 },
+    { -2, -15, 110, 7, 6,  43, -19, -2 }, { -2, -14, 111, 7, 6,  41, -19, -2 },
+    { -1, -13, 113, 6, 5,  38, -18, -2 }, { -1, -12, 114, 6, 5,  35, -17, -2 },
+    { -1, -12, 116, 6, 5,  33, -17, -2 }, { -1, -11, 118, 5, 4,  30, -16, -1 },
+    { -1, -10, 119, 5, 4,  27, -15, -1 }, { -1,  -9, 120, 5, 4,  25, -14, -2 },
+    { -1,  -8, 121, 4, 3,  23, -13, -1 }, { -1,  -7, 122, 4, 3,  20, -12, -1 },
+    { -1,  -7, 123, 4, 3,  18, -11, -1 }, { -1,  -6, 124, 3, 3,  16, -10, -1 },
+    { -1,  -5, 125, 3, 2,  13,  -8, -1 }, { -1,  -4, 126, 2, 2,  11,  -7, -1 },
+    {  0,  -3, 126, 2, 1,   8,  -6,  0 }, {  0,  -2, 127, 1, 1,   6,  -5,  0 },
+    {  0,  -2, 127, 1, 1,   4,  -3,  0 }, {  0,   0, 127, 0, 0,   2,  -1,  0 },
     // [1, 2)
-    { 0, 0, 0,   1, 127,   0,   0, 0 }, { 0, 0, 0, - 1, 127,   2,   0, 0 },
-    { 0, 0, 1, - 3, 127,   4, - 1, 0 }, { 0, 0, 1, - 4, 126,   6, - 2, 1 },
-    { 0, 0, 1, - 5, 126,   8, - 3, 1 }, { 0, 0, 1, - 6, 125,  11, - 4, 1 },
-    { 0, 0, 1, - 7, 124,  13, - 4, 1 }, { 0, 0, 2, - 8, 123,  15, - 5, 1 },
-    { 0, 0, 2, - 9, 122,  18, - 6, 1 }, { 0, 0, 2, -10, 121,  20, - 6, 1 },
-    { 0, 0, 2, -11, 120,  22, - 7, 2 }, { 0, 0, 2, -12, 119,  25, - 8, 2 },
-    { 0, 0, 3, -13, 117,  27, - 8, 2 }, { 0, 0, 3, -13, 116,  29, - 9, 2 },
-    { 0, 0, 3, -14, 114,  32, -10, 3 }, { 0, 0, 3, -15, 113,  35, -10, 2 },
-    { 0, 0, 3, -15, 111,  37, -11, 3 }, { 0, 0, 3, -16, 109,  40, -11, 3 },
-    { 0, 0, 3, -16, 108,  42, -12, 3 }, { 0, 0, 4, -17, 106,  45, -13, 3 },
-    { 0, 0, 4, -17, 104,  47, -13, 3 }, { 0, 0, 4, -17, 102,  50, -14, 3 },
-    { 0, 0, 4, -17, 100,  52, -14, 3 }, { 0, 0, 4, -18,  98,  55, -15, 4 },
-    { 0, 0, 4, -18,  96,  58, -15, 3 }, { 0, 0, 4, -18,  94,  60, -16, 4 },
-    { 0, 0, 4, -18,  91,  63, -16, 4 }, { 0, 0, 4, -18,  89,  65, -16, 4 },
-    { 0, 0, 4, -18,  87,  68, -17, 4 }, { 0, 0, 4, -18,  85,  70, -17, 4 },
-    { 0, 0, 4, -18,  82,  73, -17, 4 }, { 0, 0, 4, -18,  80,  75, -17, 4 },
-    { 0, 0, 4, -18,  78,  78, -18, 4 }, { 0, 0, 4, -17,  75,  80, -18, 4 },
-    { 0, 0, 4, -17,  73,  82, -18, 4 }, { 0, 0, 4, -17,  70,  85, -18, 4 },
-    { 0, 0, 4, -17,  68,  87, -18, 4 }, { 0, 0, 4, -16,  65,  89, -18, 4 },
-    { 0, 0, 4, -16,  63,  91, -18, 4 }, { 0, 0, 4, -16,  60,  94, -18, 4 },
-    { 0, 0, 3, -15,  58,  96, -18, 4 }, { 0, 0, 4, -15,  55,  98, -18, 4 },
-    { 0, 0, 3, -14,  52, 100, -17, 4 }, { 0, 0, 3, -14,  50, 102, -17, 4 },
-    { 0, 0, 3, -13,  47, 104, -17, 4 }, { 0, 0, 3, -13,  45, 106, -17, 4 },
-    { 0, 0, 3, -12,  42, 108, -16, 3 }, { 0, 0, 3, -11,  40, 109, -16, 3 },
-    { 0, 0, 3, -11,  37, 111, -15, 3 }, { 0, 0, 2, -10,  35, 113, -15, 3 },
-    { 0, 0, 3, -10,  32, 114, -14, 3 }, { 0, 0, 2, - 9,  29, 116, -13, 3 },
-    { 0, 0, 2, - 8,  27, 117, -13, 3 }, { 0, 0, 2, - 8,  25, 119, -12, 2 },
-    { 0, 0, 2, - 7,  22, 120, -11, 2 }, { 0, 0, 1, - 6,  20, 121, -10, 2 },
-    { 0, 0, 1, - 6,  18, 122, - 9, 2 }, { 0, 0, 1, - 5,  15, 123, - 8, 2 },
-    { 0, 0, 1, - 4,  13, 124, - 7, 1 }, { 0, 0, 1, - 4,  11, 125, - 6, 1 },
-    { 0, 0, 1, - 3,   8, 126, - 5, 1 }, { 0, 0, 1, - 2,   6, 126, - 4, 1 },
-    { 0, 0, 0, - 1,   4, 127, - 3, 1 }, { 0, 0, 0,   0,   2, 127, - 1, 0 },
-
+    { 0, 0, 127,   0, 0,   1,   0, 0 }, { 0, 0, 127,   0, 0,  -1,   2, 0 },
+    { 0, 1, 127,  -1, 0,  -3,   4, 0 }, { 0, 1, 126,  -2, 0,  -4,   6, 1 },
+    { 0, 1, 126,  -3, 0,  -5,   8, 1 }, { 0, 1, 125,  -4, 0,  -6,  11, 1 },
+    { 0, 1, 124,  -4, 0,  -7,  13, 1 }, { 0, 2, 123,  -5, 0,  -8,  15, 1 },
+    { 0, 2, 122,  -6, 0,  -9,  18, 1 }, { 0, 2, 121,  -6, 0, -10,  20, 1 },
+    { 0, 2, 120,  -7, 0, -11,  22, 2 }, { 0, 2, 119,  -8, 0, -12,  25, 2 },
+    { 0, 3, 117,  -8, 0, -13,  27, 2 }, { 0, 3, 116,  -9, 0, -13,  29, 2 },
+    { 0, 3, 114, -10, 0, -14,  32, 3 }, { 0, 3, 113, -10, 0, -15,  35, 2 },
+    { 0, 3, 111, -11, 0, -15,  37, 3 }, { 0, 3, 109, -11, 0, -16,  40, 3 },
+    { 0, 3, 108, -12, 0, -16,  42, 3 }, { 0, 4, 106, -13, 0, -17,  45, 3 },
+    { 0, 4, 104, -13, 0, -17,  47, 3 }, { 0, 4, 102, -14, 0, -17,  50, 3 },
+    { 0, 4, 100, -14, 0, -17,  52, 3 }, { 0, 4,  98, -15, 0, -18,  55, 4 },
+    { 0, 4,  96, -15, 0, -18,  58, 3 }, { 0, 4,  94, -16, 0, -18,  60, 4 },
+    { 0, 4,  91, -16, 0, -18,  63, 4 }, { 0, 4,  89, -16, 0, -18,  65, 4 },
+    { 0, 4,  87, -17, 0, -18,  68, 4 }, { 0, 4,  85, -17, 0, -18,  70, 4 },
+    { 0, 4,  82, -17, 0, -18,  73, 4 }, { 0, 4,  80, -17, 0, -18,  75, 4 },
+    { 0, 4,  78, -18, 0, -18,  78, 4 }, { 0, 4,  75, -18, 0, -17,  80, 4 },
+    { 0, 4,  73, -18, 0, -17,  82, 4 }, { 0, 4,  70, -18, 0, -17,  85, 4 },
+    { 0, 4,  68, -18, 0, -17,  87, 4 }, { 0, 4,  65, -18, 0, -16,  89, 4 },
+    { 0, 4,  63, -18, 0, -16,  91, 4 }, { 0, 4,  60, -18, 0, -16,  94, 4 },
+    { 0, 3,  58, -18, 0, -15,  96, 4 }, { 0, 4,  55, -18, 0, -15,  98, 4 },
+    { 0, 3,  52, -17, 0, -14, 100, 4 }, { 0, 3,  50, -17, 0, -14, 102, 4 },
+    { 0, 3,  47, -17, 0, -13, 104, 4 }, { 0, 3,  45, -17, 0, -13, 106, 4 },
+    { 0, 3,  42, -16, 0, -12, 108, 3 }, { 0, 3,  40, -16, 0, -11, 109, 3 },
+    { 0, 3,  37, -15, 0, -11, 111, 3 }, { 0, 2,  35, -15, 0, -10, 113, 3 },
+    { 0, 3,  32, -14, 0, -10, 114, 3 }, { 0, 2,  29, -13, 0,  -9, 116, 3 },
+    { 0, 2,  27, -13, 0,  -8, 117, 3 }, { 0, 2,  25, -12, 0,  -8, 119, 2 },
+    { 0, 2,  22, -11, 0,  -7, 120, 2 }, { 0, 1,  20, -10, 0,  -6, 121, 2 },
+    { 0, 1,  18,  -9, 0,  -6, 122, 2 }, { 0, 1,  15,  -8, 0,  -5, 123, 2 },
+    { 0, 1,  13,  -7, 0,  -4, 124, 1 }, { 0, 1,  11,  -6, 0,  -4, 125, 1 },
+    { 0, 1,   8,  -5, 0,  -3, 126, 1 }, { 0, 1,   6,  -4, 0,  -2, 126, 1 },
+    { 0, 0,   4,  -3, 0,  -1, 127, 1 }, { 0, 0,   2,  -1, 0,   0, 127, 0 },
     // dummy (replicate row index 191)
-    { 0, 0, 0,   0,   2, 127, - 1, 0 },
+    { 0, 0,   2,  -1, 0,   0, 127, 0 }
 };
 
 const uint8_t dav1d_sm_weights[128] = {
--- a/src/tables.h
+++ b/src/tables.h
@@ -110,7 +110,7 @@
 extern const int dav1d_sgr_x_by_xplus1[256];
 
 extern const int8_t dav1d_mc_subpel_filters[5][15][8];
-extern const int8_t dav1d_mc_warp_filter[][8];
+extern const int8_t dav1d_mc_warp_filter[193][8];
 
 extern const uint8_t dav1d_sm_weights[128];
 extern const int16_t dav1d_dr_intra_derivative[90];