Commit 16056f5b authored by Debargha Mukherjee's avatar Debargha Mukherjee

Adds option to use 1/32 subpel precision for gm/wm

Adds filters for 1/32 subpel precision for warping.
To use 1/32 subpel precision make WARPEDPIXEL_PREC_BITS 5.
By default, WARPEDPIXEL_PREC_BITS is set as 6 in common/mv.h,
which uses 1/64 subpel precision.

If 1/32 precision is used, BDRATE drops:
on lowres:
-1.101 (vs. -1.186% with 1/64) w/warped-motion
-1.587 (vs. -1.650% with 1/64) w/global-motion

on cam_lowres:
-2.638 (vs. -2.707% with 1/64) w/warped-motion
-3.396 (vs. -3.453% with 1/64) w/global-motion

Change-Id: I82fbfddaad9bd9be658fe382401d212833c7ceef
parent cfe0fede
......@@ -302,6 +302,7 @@ void project_points(WarpedMotionParams *wm_params, int *points, int *proj,
static const int16_t
filter_ntap[WARPEDPIXEL_PREC_SHIFTS][WARPEDPIXEL_FILTER_TAPS] = {
#if WARPEDPIXEL_PREC_BITS == 6
{ 0, 0, 128, 0, 0, 0 }, { 0, -1, 128, 2, -1, 0 },
{ 1, -3, 127, 4, -1, 0 }, { 1, -4, 126, 6, -2, 1 },
{ 1, -5, 126, 8, -3, 1 }, { 1, -6, 125, 11, -4, 1 },
......@@ -334,6 +335,24 @@ static const int16_t
{ 1, -4, 13, 124, -7, 1 }, { 1, -4, 11, 125, -6, 1 },
{ 1, -3, 8, 126, -5, 1 }, { 1, -2, 6, 126, -4, 1 },
{ 0, -1, 4, 127, -3, 1 }, { 0, -1, 2, 128, -1, 0 },
#else
{ 0, 0, 128, 0, 0, 0 }, { 1, -3, 127, 4, -1, 0 },
{ 1, -5, 126, 8, -3, 1 }, { 1, -7, 124, 13, -4, 1 },
{ 2, -9, 122, 18, -6, 1 }, { 2, -11, 120, 22, -7, 2 },
{ 3, -13, 117, 27, -8, 2 }, { 3, -14, 114, 32, -10, 3 },
{ 3, -15, 111, 37, -11, 3 }, { 3, -16, 108, 42, -12, 3 },
{ 4, -17, 104, 47, -13, 3 }, { 4, -17, 100, 52, -14, 3 },
{ 4, -18, 96, 58, -15, 3 }, { 4, -18, 91, 63, -16, 4 },
{ 4, -18, 87, 68, -17, 4 }, { 4, -18, 82, 73, -17, 4 },
{ 4, -18, 78, 78, -18, 4 }, { 4, -17, 73, 82, -18, 4 },
{ 4, -17, 68, 87, -18, 4 }, { 4, -16, 63, 91, -18, 4 },
{ 3, -15, 58, 96, -18, 4 }, { 3, -14, 52, 100, -17, 4 },
{ 3, -13, 47, 104, -17, 4 }, { 3, -12, 42, 108, -16, 3 },
{ 3, -11, 37, 111, -15, 3 }, { 3, -10, 32, 114, -14, 3 },
{ 2, -8, 27, 117, -13, 3 }, { 2, -7, 22, 120, -11, 2 },
{ 1, -6, 18, 122, -9, 2 }, { 1, -4, 13, 124, -7, 1 },
{ 1, -3, 8, 126, -5, 1 }, { 0, -1, 4, 127, -3, 1 },
#endif // WARPEDPIXEL_PREC_BITS == 6
};
static int32_t do_ntap_filter(int32_t *p, int x) {
......@@ -480,6 +499,7 @@ static uint8_t warp_interpolate(uint8_t *ref, int x, int y, int width,
// We need an extra 2 taps to fit this in, for a total of 8 taps.
/* clang-format off */
const int16_t warped_filter[WARPEDPIXEL_PREC_SHIFTS * 3 + 1][8] = {
#if WARPEDPIXEL_PREC_BITS == 6
// [-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 },
......@@ -582,9 +602,65 @@ const int16_t warped_filter[WARPEDPIXEL_PREC_SHIFTS * 3 + 1][8] = {
{ 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 },
#else
// [-1, 0)
{0, 0, 127, 1, 0, 0, 0, 0}, {1, -3, 127, 4, -1, 0, 0, 0},
{1, -5, 126, 8, -3, 1, 0, 0}, {1, -7, 124, 13, -4, 1, 0, 0},
{2, -9, 122, 18, -6, 1, 0, 0}, {2, -11, 120, 22, -7, 2, 0, 0},
{3, -13, 117, 27, -8, 2, 0, 0}, {3, -14, 114, 32, -10, 3, 0, 0},
{3, -15, 111, 37, -11, 3, 0, 0}, {3, -16, 108, 42, -12, 3, 0, 0},
{4, -17, 104, 47, -13, 3, 0, 0}, {4, -17, 100, 52, -14, 3, 0, 0},
{4, -18, 96, 58, -15, 3, 0, 0}, {4, -18, 91, 63, -16, 4, 0, 0},
{4, -18, 87, 68, -17, 4, 0, 0}, {4, -18, 82, 73, -17, 4, 0, 0},
{4, -18, 78, 78, -18, 4, 0, 0}, {4, -17, 73, 82, -18, 4, 0, 0},
{4, -17, 68, 87, -18, 4, 0, 0}, {4, -16, 63, 91, -18, 4, 0, 0},
{3, -15, 58, 96, -18, 4, 0, 0}, {3, -14, 52, 100, -17, 4, 0, 0},
{3, -13, 47, 104, -17, 4, 0, 0}, {3, -12, 42, 108, -16, 3, 0, 0},
{3, -11, 37, 111, -15, 3, 0, 0}, {3, -10, 32, 114, -14, 3, 0, 0},
{2, -8, 27, 117, -13, 3, 0, 0}, {2, -7, 22, 120, -11, 2, 0, 0},
{1, -6, 18, 122, -9, 2, 0, 0}, {1, -4, 13, 124, -7, 1, 0, 0},
{1, -3, 8, 126, -5, 1, 0, 0}, {0, -1, 4, 127, -3, 1, 0, 0},
// [0, 1)
{ 0, 0, 0, 127, 1, 0, 0, 0}, { 0, 1, -3, 127, 4, -2, 1, 0},
{ 0, 2, -6, 126, 8, -3, 1, 0}, {-1, 3, -8, 125, 13, -5, 2, -1},
{-1, 4, -11, 123, 18, -7, 3, -1}, {-1, 4, -13, 121, 23, -8, 3, -1},
{-1, 5, -15, 119, 27, -10, 4, -1}, {-2, 6, -17, 116, 33, -12, 5, -1},
{-2, 6, -18, 113, 38, -13, 5, -1}, {-2, 7, -19, 110, 43, -15, 6, -2},
{-2, 7, -20, 106, 49, -16, 6, -2}, {-2, 7, -21, 102, 54, -17, 7, -2},
{-2, 8, -22, 98, 59, -18, 7, -2}, {-2, 8, -22, 94, 64, -19, 7, -2},
{-2, 8, -22, 89, 69, -20, 8, -2}, {-2, 8, -21, 84, 74, -21, 8, -2},
{-2, 8, -21, 79, 79, -21, 8, -2}, {-2, 8, -21, 74, 84, -21, 8, -2},
{-2, 8, -20, 69, 89, -22, 8, -2}, {-2, 7, -19, 64, 94, -22, 8, -2},
{-2, 7, -18, 59, 98, -22, 8, -2}, {-2, 7, -17, 54, 102, -21, 7, -2},
{-2, 6, -16, 49, 106, -20, 7, -2}, {-2, 6, -15, 43, 110, -19, 7, -2},
{-1, 5, -13, 38, 113, -18, 6, -2}, {-1, 5, -12, 33, 116, -17, 6, -2},
{-1, 4, -10, 27, 119, -15, 5, -1}, {-1, 3, -8, 23, 121, -13, 4, -1},
{-1, 3, -7, 18, 123, -11, 4, -1}, {-1, 2, -5, 13, 125, -8, 3, -1},
{ 0, 1, -3, 8, 126, -6, 2, 0}, { 0, 1, -2, 4, 127, -3, 1, 0},
// [1, 2)
{0, 0, 0, 1, 127, 0, 0, 0}, {0, 0, 1, -3, 127, 4, -1, 0},
{0, 0, 1, -5, 126, 8, -3, 1}, {0, 0, 1, -7, 124, 13, -4, 1},
{0, 0, 2, -9, 122, 18, -6, 1}, {0, 0, 2, -11, 120, 22, -7, 2},
{0, 0, 3, -13, 117, 27, -8, 2}, {0, 0, 3, -14, 114, 32, -10, 3},
{0, 0, 3, -15, 111, 37, -11, 3}, {0, 0, 3, -16, 108, 42, -12, 3},
{0, 0, 4, -17, 104, 47, -13, 3}, {0, 0, 4, -17, 100, 52, -14, 3},
{0, 0, 4, -18, 96, 58, -15, 3}, {0, 0, 4, -18, 91, 63, -16, 4},
{0, 0, 4, -18, 87, 68, -17, 4}, {0, 0, 4, -18, 82, 73, -17, 4},
{0, 0, 4, -18, 78, 78, -18, 4}, {0, 0, 4, -17, 73, 82, -18, 4},
{0, 0, 4, -17, 68, 87, -18, 4}, {0, 0, 4, -16, 63, 91, -18, 4},
{0, 0, 3, -15, 58, 96, -18, 4}, {0, 0, 3, -14, 52, 100, -17, 4},
{0, 0, 3, -13, 47, 104, -17, 4}, {0, 0, 3, -12, 42, 108, -16, 3},
{0, 0, 3, -11, 37, 111, -15, 3}, {0, 0, 3, -10, 32, 114, -14, 3},
{0, 0, 2, -8, 27, 117, -13, 3}, {0, 0, 2, -7, 22, 120, -11, 2},
{0, 0, 1, -6, 18, 122, -9, 2}, {0, 0, 1, -4, 13, 124, -7, 1},
{0, 0, 1, -3, 8, 126, -5, 1}, {0, 0, 0, -1, 4, 127, -3, 1},
#endif // WARPEDPIXEL_PREC_BITS == 6
// dummy
{ 0, 0, 0, 0, 1, 127, 0, 0 },
};
/* clang-format on */
#define DIV_LUT_PREC_BITS 14
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment