Commit 4cae64c3 authored by Scott LaVarnway's avatar Scott LaVarnway

vpxdsp: [x86] add highbd_d117_predictor functions

C vs SSE2 speed gains:
_4x4 : ~2.04x

C vs SSSE3 speed gains:
_8x8 : ~2.82x
_16x16 : ~5.93x
_32x32 : ~2.79x

BUG=webm:1411

Change-Id: I31d949695991c067dac89d91e0bed3e666c94993
parent a2ef180d
......@@ -484,9 +484,10 @@ HIGHBD_INTRA_PRED_TEST(
SSE2, TestHighbdIntraPred4, vpx_highbd_dc_predictor_4x4_sse2,
vpx_highbd_dc_left_predictor_4x4_sse2, vpx_highbd_dc_top_predictor_4x4_sse2,
vpx_highbd_dc_128_predictor_4x4_sse2, vpx_highbd_v_predictor_4x4_sse2,
vpx_highbd_h_predictor_4x4_sse2, NULL, NULL, NULL,
vpx_highbd_d153_predictor_4x4_sse2, vpx_highbd_d207_predictor_4x4_sse2,
vpx_highbd_d63_predictor_4x4_sse2, vpx_highbd_tm_predictor_4x4_c)
vpx_highbd_h_predictor_4x4_sse2, NULL, NULL,
vpx_highbd_d117_predictor_4x4_sse2, vpx_highbd_d153_predictor_4x4_sse2,
vpx_highbd_d207_predictor_4x4_sse2, vpx_highbd_d63_predictor_4x4_sse2,
vpx_highbd_tm_predictor_4x4_c)
HIGHBD_INTRA_PRED_TEST(SSE2, TestHighbdIntraPred8,
vpx_highbd_dc_predictor_8x8_sse2,
......@@ -522,17 +523,20 @@ HIGHBD_INTRA_PRED_TEST(SSSE3, TestHighbdIntraPred4, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL)
HIGHBD_INTRA_PRED_TEST(SSSE3, TestHighbdIntraPred8, NULL, NULL, NULL, NULL,
NULL, NULL, vpx_highbd_d45_predictor_8x8_ssse3, NULL,
NULL, vpx_highbd_d153_predictor_8x8_ssse3,
vpx_highbd_d117_predictor_8x8_ssse3,
vpx_highbd_d153_predictor_8x8_ssse3,
vpx_highbd_d207_predictor_8x8_ssse3,
vpx_highbd_d63_predictor_8x8_ssse3, NULL)
HIGHBD_INTRA_PRED_TEST(SSSE3, TestHighbdIntraPred16, NULL, NULL, NULL, NULL,
NULL, NULL, vpx_highbd_d45_predictor_16x16_ssse3, NULL,
NULL, vpx_highbd_d153_predictor_16x16_ssse3,
vpx_highbd_d117_predictor_16x16_ssse3,
vpx_highbd_d153_predictor_16x16_ssse3,
vpx_highbd_d207_predictor_16x16_ssse3,
vpx_highbd_d63_predictor_16x16_ssse3, NULL)
HIGHBD_INTRA_PRED_TEST(SSSE3, TestHighbdIntraPred32, NULL, NULL, NULL, NULL,
NULL, NULL, vpx_highbd_d45_predictor_32x32_ssse3, NULL,
NULL, vpx_highbd_d153_predictor_32x32_ssse3,
vpx_highbd_d117_predictor_32x32_ssse3,
vpx_highbd_d153_predictor_32x32_ssse3,
vpx_highbd_d207_predictor_32x32_ssse3,
vpx_highbd_d63_predictor_32x32_ssse3, NULL)
#endif // HAVE_SSSE3
......
......@@ -485,6 +485,12 @@ INSTANTIATE_TEST_CASE_P(
&vpx_highbd_d63_predictor_16x16_c, 16, 8),
HighbdIntraPredParam(&vpx_highbd_d63_predictor_32x32_c,
&vpx_highbd_d63_predictor_32x32_ssse3, 32, 8),
HighbdIntraPredParam(&vpx_highbd_d117_predictor_8x8_ssse3,
&vpx_highbd_d117_predictor_8x8_c, 8, 8),
HighbdIntraPredParam(&vpx_highbd_d117_predictor_16x16_ssse3,
&vpx_highbd_d117_predictor_16x16_c, 16, 8),
HighbdIntraPredParam(&vpx_highbd_d117_predictor_32x32_c,
&vpx_highbd_d117_predictor_32x32_ssse3, 32, 8),
HighbdIntraPredParam(&vpx_highbd_d153_predictor_8x8_ssse3,
&vpx_highbd_d153_predictor_8x8_c, 8, 8),
HighbdIntraPredParam(&vpx_highbd_d153_predictor_16x16_ssse3,
......@@ -515,6 +521,12 @@ INSTANTIATE_TEST_CASE_P(
&vpx_highbd_d63_predictor_16x16_c, 16, 10),
HighbdIntraPredParam(&vpx_highbd_d63_predictor_32x32_c,
&vpx_highbd_d63_predictor_32x32_ssse3, 32, 10),
HighbdIntraPredParam(&vpx_highbd_d117_predictor_8x8_ssse3,
&vpx_highbd_d117_predictor_8x8_c, 8, 10),
HighbdIntraPredParam(&vpx_highbd_d117_predictor_16x16_ssse3,
&vpx_highbd_d117_predictor_16x16_c, 16, 10),
HighbdIntraPredParam(&vpx_highbd_d117_predictor_32x32_c,
&vpx_highbd_d117_predictor_32x32_ssse3, 32, 10),
HighbdIntraPredParam(&vpx_highbd_d153_predictor_8x8_ssse3,
&vpx_highbd_d153_predictor_8x8_c, 8, 10),
HighbdIntraPredParam(&vpx_highbd_d153_predictor_16x16_ssse3,
......@@ -545,6 +557,12 @@ INSTANTIATE_TEST_CASE_P(
&vpx_highbd_d63_predictor_16x16_c, 16, 12),
HighbdIntraPredParam(&vpx_highbd_d63_predictor_32x32_c,
&vpx_highbd_d63_predictor_32x32_ssse3, 32, 12),
HighbdIntraPredParam(&vpx_highbd_d117_predictor_8x8_ssse3,
&vpx_highbd_d117_predictor_8x8_c, 8, 12),
HighbdIntraPredParam(&vpx_highbd_d117_predictor_16x16_ssse3,
&vpx_highbd_d117_predictor_16x16_c, 16, 12),
HighbdIntraPredParam(&vpx_highbd_d117_predictor_32x32_c,
&vpx_highbd_d117_predictor_32x32_ssse3, 32, 12),
HighbdIntraPredParam(&vpx_highbd_d153_predictor_8x8_ssse3,
&vpx_highbd_d153_predictor_8x8_c, 8, 12),
HighbdIntraPredParam(&vpx_highbd_d153_predictor_16x16_ssse3,
......@@ -573,6 +591,8 @@ INSTANTIATE_TEST_CASE_P(
&vpx_highbd_dc_128_predictor_32x32_c, 32, 8),
HighbdIntraPredParam(&vpx_highbd_d63_predictor_4x4_sse2,
&vpx_highbd_d63_predictor_4x4_c, 4, 8),
HighbdIntraPredParam(&vpx_highbd_d117_predictor_4x4_sse2,
&vpx_highbd_d117_predictor_4x4_c, 4, 8),
HighbdIntraPredParam(&vpx_highbd_d153_predictor_4x4_sse2,
&vpx_highbd_d153_predictor_4x4_c, 4, 8),
HighbdIntraPredParam(&vpx_highbd_d207_predictor_4x4_sse2,
......@@ -639,6 +659,8 @@ INSTANTIATE_TEST_CASE_P(
&vpx_highbd_dc_128_predictor_32x32_c, 32, 10),
HighbdIntraPredParam(&vpx_highbd_d63_predictor_4x4_sse2,
&vpx_highbd_d63_predictor_4x4_c, 4, 10),
HighbdIntraPredParam(&vpx_highbd_d117_predictor_4x4_sse2,
&vpx_highbd_d117_predictor_4x4_c, 4, 10),
HighbdIntraPredParam(&vpx_highbd_d153_predictor_4x4_sse2,
&vpx_highbd_d153_predictor_4x4_c, 4, 10),
HighbdIntraPredParam(&vpx_highbd_d207_predictor_4x4_sse2,
......@@ -705,6 +727,8 @@ INSTANTIATE_TEST_CASE_P(
&vpx_highbd_dc_128_predictor_32x32_c, 32, 12),
HighbdIntraPredParam(&vpx_highbd_d63_predictor_4x4_sse2,
&vpx_highbd_d63_predictor_4x4_c, 4, 12),
HighbdIntraPredParam(&vpx_highbd_d117_predictor_4x4_sse2,
&vpx_highbd_d117_predictor_4x4_c, 4, 12),
HighbdIntraPredParam(&vpx_highbd_d153_predictor_4x4_sse2,
&vpx_highbd_d153_predictor_4x4_c, 4, 12),
HighbdIntraPredParam(&vpx_highbd_d207_predictor_4x4_sse2,
......
......@@ -201,6 +201,7 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
specialize qw/vpx_highbd_h_predictor_4x4 neon sse2/;
add_proto qw/void vpx_highbd_d117_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_d117_predictor_4x4 sse2/;
add_proto qw/void vpx_highbd_d135_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_d135_predictor_4x4 neon/;
......@@ -239,6 +240,7 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
specialize qw/vpx_highbd_h_predictor_8x8 neon sse2/;
add_proto qw/void vpx_highbd_d117_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_d117_predictor_8x8 ssse3/;
add_proto qw/void vpx_highbd_d135_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_d135_predictor_8x8 neon/;
......@@ -277,6 +279,7 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
specialize qw/vpx_highbd_h_predictor_16x16 neon sse2/;
add_proto qw/void vpx_highbd_d117_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_d117_predictor_16x16 ssse3/;
add_proto qw/void vpx_highbd_d135_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_d135_predictor_16x16 neon/;
......@@ -315,6 +318,7 @@ if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
specialize qw/vpx_highbd_h_predictor_32x32 neon sse2/;
add_proto qw/void vpx_highbd_d117_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_d117_predictor_32x32 ssse3/;
add_proto qw/void vpx_highbd_d135_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_d135_predictor_32x32 neon/;
......
......@@ -393,6 +393,38 @@ static INLINE __m128i avg3_epu16(const __m128i *x, const __m128i *y,
return _mm_avg_epu16(b, *y);
}
void vpx_highbd_d117_predictor_4x4_sse2(uint16_t *dst, ptrdiff_t stride,
const uint16_t *above,
const uint16_t *left, int bd) {
const int I = left[0];
const int J = left[1];
const int K = left[2];
const __m128i XXXXABCD = _mm_loadu_si128((const __m128i *)(above - 4));
const __m128i KXXXABCD = _mm_insert_epi16(XXXXABCD, K, 0);
const __m128i KJXXABCD = _mm_insert_epi16(KXXXABCD, J, 1);
const __m128i KJIXABCD = _mm_insert_epi16(KJXXABCD, I, 2);
const __m128i JIXABCD0 = _mm_srli_si128(KJIXABCD, 2);
const __m128i IXABCD00 = _mm_srli_si128(KJIXABCD, 4);
const __m128i avg2 = _mm_avg_epu16(KJIXABCD, JIXABCD0);
const __m128i avg3 = avg3_epu16(&KJIXABCD, &JIXABCD0, &IXABCD00);
const __m128i row0 = _mm_srli_si128(avg2, 6);
const __m128i row1 = _mm_srli_si128(avg3, 4);
const __m128i row2 = _mm_srli_si128(avg2, 4);
const __m128i row3 = _mm_srli_si128(avg3, 2);
(void)bd;
_mm_storel_epi64((__m128i *)dst, row0);
dst += stride;
_mm_storel_epi64((__m128i *)dst, row1);
dst += stride;
_mm_storel_epi64((__m128i *)dst, row2);
dst += stride;
_mm_storel_epi64((__m128i *)dst, row3);
dst -= stride;
dst[0] = _mm_extract_epi16(avg3, 1);
dst[stride] = _mm_extract_epi16(avg3, 0);
}
void vpx_highbd_d153_predictor_4x4_sse2(uint16_t *dst, ptrdiff_t stride,
const uint16_t *above,
const uint16_t *left, int bd) {
......
......@@ -170,6 +170,166 @@ void vpx_highbd_d45_predictor_32x32_ssse3(uint16_t *dst, ptrdiff_t stride,
}
}
DECLARE_ALIGNED(16, static const uint8_t, rotate_right_epu16[16]) = {
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1
};
static INLINE __m128i rotr_epu16(__m128i *a, const __m128i *rotrw) {
*a = _mm_shuffle_epi8(*a, *rotrw);
return *a;
}
void vpx_highbd_d117_predictor_8x8_ssse3(uint16_t *dst, ptrdiff_t stride,
const uint16_t *above,
const uint16_t *left, int bd) {
const __m128i rotrw = _mm_load_si128((const __m128i *)rotate_right_epu16);
const __m128i XABCDEFG = _mm_loadu_si128((const __m128i *)(above - 1));
const __m128i ABCDEFGH = _mm_load_si128((const __m128i *)above);
const __m128i IJKLMNOP = _mm_load_si128((const __m128i *)left);
const __m128i IXABCDEF =
_mm_alignr_epi8(XABCDEFG, _mm_slli_si128(IJKLMNOP, 14), 14);
const __m128i avg3 = avg3_epu16(&ABCDEFGH, &XABCDEFG, &IXABCDEF);
const __m128i avg2 = _mm_avg_epu16(ABCDEFGH, XABCDEFG);
const __m128i XIJKLMNO =
_mm_alignr_epi8(IJKLMNOP, _mm_slli_si128(XABCDEFG, 14), 14);
const __m128i JKLMNOP0 = _mm_srli_si128(IJKLMNOP, 2);
__m128i avg3_left = avg3_epu16(&XIJKLMNO, &IJKLMNOP, &JKLMNOP0);
__m128i rowa = avg2;
__m128i rowb = avg3;
int i;
(void)bd;
for (i = 0; i < 8; i += 2) {
_mm_store_si128((__m128i *)dst, rowa);
dst += stride;
_mm_store_si128((__m128i *)dst, rowb);
dst += stride;
rowa = _mm_alignr_epi8(rowa, rotr_epu16(&avg3_left, &rotrw), 14);
rowb = _mm_alignr_epi8(rowb, rotr_epu16(&avg3_left, &rotrw), 14);
}
}
void vpx_highbd_d117_predictor_16x16_ssse3(uint16_t *dst, ptrdiff_t stride,
const uint16_t *above,
const uint16_t *left, int bd) {
const __m128i rotrw = _mm_load_si128((const __m128i *)rotate_right_epu16);
const __m128i B0 = _mm_loadu_si128((const __m128i *)(above - 1));
const __m128i A0 = _mm_load_si128((const __m128i *)above);
const __m128i B1 = _mm_loadu_si128((const __m128i *)(above + 7));
const __m128i A1 = _mm_load_si128((const __m128i *)(above + 8));
const __m128i avg2_0 = _mm_avg_epu16(A0, B0);
const __m128i avg2_1 = _mm_avg_epu16(A1, B1);
const __m128i L0 = _mm_load_si128((const __m128i *)left);
const __m128i L1 = _mm_load_si128((const __m128i *)(left + 8));
const __m128i C0 = _mm_alignr_epi8(B0, _mm_slli_si128(L0, 14), 14);
const __m128i C1 = _mm_alignr_epi8(B1, B0, 14);
const __m128i avg3_0 = avg3_epu16(&A0, &B0, &C0);
const __m128i avg3_1 = avg3_epu16(&A1, &B1, &C1);
const __m128i XL0 = _mm_alignr_epi8(L0, _mm_slli_si128(B0, 14), 14);
const __m128i XL1 = _mm_alignr_epi8(L1, L0, 14);
const __m128i L0_ = _mm_alignr_epi8(L1, L0, 2);
const __m128i L1_ = _mm_srli_si128(L1, 2);
__m128i rowa_0 = avg2_0;
__m128i rowa_1 = avg2_1;
__m128i rowb_0 = avg3_0;
__m128i rowb_1 = avg3_1;
__m128i avg3_left[2];
int i, j;
(void)bd;
avg3_left[0] = avg3_epu16(&XL0, &L0, &L0_);
avg3_left[1] = avg3_epu16(&XL1, &L1, &L1_);
for (i = 0; i < 2; ++i) {
__m128i avg_left = avg3_left[i];
for (j = 0; j < 8; j += 2) {
_mm_store_si128((__m128i *)dst, rowa_0);
_mm_store_si128((__m128i *)(dst + 8), rowa_1);
dst += stride;
_mm_store_si128((__m128i *)dst, rowb_0);
_mm_store_si128((__m128i *)(dst + 8), rowb_1);
dst += stride;
rowa_1 = _mm_alignr_epi8(rowa_1, rowa_0, 14);
rowa_0 = _mm_alignr_epi8(rowa_0, rotr_epu16(&avg_left, &rotrw), 14);
rowb_1 = _mm_alignr_epi8(rowb_1, rowb_0, 14);
rowb_0 = _mm_alignr_epi8(rowb_0, rotr_epu16(&avg_left, &rotrw), 14);
}
}
}
void vpx_highbd_d117_predictor_32x32_ssse3(uint16_t *dst, ptrdiff_t stride,
const uint16_t *above,
const uint16_t *left, int bd) {
const __m128i rotrw = _mm_load_si128((const __m128i *)rotate_right_epu16);
const __m128i A0 = _mm_load_si128((const __m128i *)above);
const __m128i A1 = _mm_load_si128((const __m128i *)(above + 8));
const __m128i A2 = _mm_load_si128((const __m128i *)(above + 16));
const __m128i A3 = _mm_load_si128((const __m128i *)(above + 24));
const __m128i B0 = _mm_loadu_si128((const __m128i *)(above - 1));
const __m128i B1 = _mm_loadu_si128((const __m128i *)(above + 7));
const __m128i B2 = _mm_loadu_si128((const __m128i *)(above + 15));
const __m128i B3 = _mm_loadu_si128((const __m128i *)(above + 23));
const __m128i avg2_0 = _mm_avg_epu16(A0, B0);
const __m128i avg2_1 = _mm_avg_epu16(A1, B1);
const __m128i avg2_2 = _mm_avg_epu16(A2, B2);
const __m128i avg2_3 = _mm_avg_epu16(A3, B3);
const __m128i L0 = _mm_load_si128((const __m128i *)left);
const __m128i L1 = _mm_load_si128((const __m128i *)(left + 8));
const __m128i L2 = _mm_load_si128((const __m128i *)(left + 16));
const __m128i L3 = _mm_load_si128((const __m128i *)(left + 24));
const __m128i C0 = _mm_alignr_epi8(B0, _mm_slli_si128(L0, 14), 14);
const __m128i C1 = _mm_alignr_epi8(B1, B0, 14);
const __m128i C2 = _mm_alignr_epi8(B2, B1, 14);
const __m128i C3 = _mm_alignr_epi8(B3, B2, 14);
const __m128i avg3_0 = avg3_epu16(&A0, &B0, &C0);
const __m128i avg3_1 = avg3_epu16(&A1, &B1, &C1);
const __m128i avg3_2 = avg3_epu16(&A2, &B2, &C2);
const __m128i avg3_3 = avg3_epu16(&A3, &B3, &C3);
const __m128i XL0 = _mm_alignr_epi8(L0, _mm_slli_si128(B0, 14), 14);
const __m128i XL1 = _mm_alignr_epi8(L1, L0, 14);
const __m128i XL2 = _mm_alignr_epi8(L2, L1, 14);
const __m128i XL3 = _mm_alignr_epi8(L3, L2, 14);
const __m128i L0_ = _mm_alignr_epi8(L1, L0, 2);
const __m128i L1_ = _mm_alignr_epi8(L2, L1, 2);
const __m128i L2_ = _mm_alignr_epi8(L3, L2, 2);
const __m128i L3_ = _mm_srli_si128(L3, 2);
__m128i rowa_0 = avg2_0;
__m128i rowa_1 = avg2_1;
__m128i rowa_2 = avg2_2;
__m128i rowa_3 = avg2_3;
__m128i rowb_0 = avg3_0;
__m128i rowb_1 = avg3_1;
__m128i rowb_2 = avg3_2;
__m128i rowb_3 = avg3_3;
__m128i avg3_left[4];
int i, j;
(void)bd;
avg3_left[0] = avg3_epu16(&XL0, &L0, &L0_);
avg3_left[1] = avg3_epu16(&XL1, &L1, &L1_);
avg3_left[2] = avg3_epu16(&XL2, &L2, &L2_);
avg3_left[3] = avg3_epu16(&XL3, &L3, &L3_);
for (i = 0; i < 4; ++i) {
__m128i avg_left = avg3_left[i];
for (j = 0; j < 8; j += 2) {
_mm_store_si128((__m128i *)dst, rowa_0);
_mm_store_si128((__m128i *)(dst + 8), rowa_1);
_mm_store_si128((__m128i *)(dst + 16), rowa_2);
_mm_store_si128((__m128i *)(dst + 24), rowa_3);
dst += stride;
_mm_store_si128((__m128i *)dst, rowb_0);
_mm_store_si128((__m128i *)(dst + 8), rowb_1);
_mm_store_si128((__m128i *)(dst + 16), rowb_2);
_mm_store_si128((__m128i *)(dst + 24), rowb_3);
dst += stride;
rowa_3 = _mm_alignr_epi8(rowa_3, rowa_2, 14);
rowa_2 = _mm_alignr_epi8(rowa_2, rowa_1, 14);
rowa_1 = _mm_alignr_epi8(rowa_1, rowa_0, 14);
rowa_0 = _mm_alignr_epi8(rowa_0, rotr_epu16(&avg_left, &rotrw), 14);
rowb_3 = _mm_alignr_epi8(rowb_3, rowb_2, 14);
rowb_2 = _mm_alignr_epi8(rowb_2, rowb_1, 14);
rowb_1 = _mm_alignr_epi8(rowb_1, rowb_0, 14);
rowb_0 = _mm_alignr_epi8(rowb_0, rotr_epu16(&avg_left, &rotrw), 14);
}
}
}
void vpx_highbd_d153_predictor_8x8_ssse3(uint16_t *dst, ptrdiff_t stride,
const uint16_t *above,
const uint16_t *left, int bd) {
......
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