Commit 6543213e authored by Linfeng Zhang's avatar Linfeng Zhang

Refactor x86/vpx_subpixel_8t_intrin_ssse3.c

Change-Id: Id6a8c549709a3c516ed5d7b719b05117c5ef8bac
parent 0f756a30
......@@ -580,6 +580,29 @@ TEST_P(ConvolveTest, DISABLED_Avg_Speed) {
UUT_->use_highbd_ ? UUT_->use_highbd_ : 8, elapsed_time);
}
TEST_P(ConvolveTest, DISABLED_Scale_Speed) {
const uint8_t *const in = input();
uint8_t *const out = output();
const InterpKernel *const eighttap = vp9_filter_kernels[EIGHTTAP];
const int kNumTests = 5000000;
const int width = Width();
const int height = Height();
vpx_usec_timer timer;
SetConstantInput(127);
vpx_usec_timer_start(&timer);
for (int n = 0; n < kNumTests; ++n) {
UUT_->shv8_[0](in, kInputStride, out, kOutputStride, eighttap, 8, 16, 8, 16,
width, height);
}
vpx_usec_timer_mark(&timer);
const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer));
printf("convolve_scale_%dx%d_%d: %d us\n", width, height,
UUT_->use_highbd_ ? UUT_->use_highbd_ : 8, elapsed_time);
}
TEST_P(ConvolveTest, Copy) {
uint8_t *const in = input();
uint8_t *const out = output();
......
......@@ -50,7 +50,6 @@ DSP_SRCS-yes += intrapred.c
DSP_SRCS-$(HAVE_SSE) += x86/intrapred_sse2.asm
DSP_SRCS-$(HAVE_SSE2) += x86/intrapred_sse2.asm
DSP_SRCS-$(HAVE_SSSE3) += x86/intrapred_ssse3.asm
DSP_SRCS-$(HAVE_SSSE3) += x86/vpx_subpixel_8t_ssse3.asm
DSP_SRCS-$(HAVE_VSX) += ppc/intrapred_vsx.c
ifeq ($(CONFIG_VP9_HIGHBITDEPTH),yes)
......@@ -89,6 +88,7 @@ DSP_SRCS-yes += vpx_filter.h
DSP_SRCS-$(ARCH_X86)$(ARCH_X86_64) += x86/convolve.h
DSP_SRCS-$(ARCH_X86)$(ARCH_X86_64) += x86/vpx_asm_stubs.c
DSP_SRCS-$(HAVE_SSSE3) += x86/convolve_ssse3.h
DSP_SRCS-$(HAVE_SSE2) += x86/vpx_subpixel_8t_sse2.asm
DSP_SRCS-$(HAVE_SSE2) += x86/vpx_subpixel_bilinear_sse2.asm
DSP_SRCS-$(HAVE_SSSE3) += x86/vpx_subpixel_8t_ssse3.asm
......
/*
* Copyright (c) 2017 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef VPX_DSP_X86_CONVOLVE_SSSE3_H_
#define VPX_DSP_X86_CONVOLVE_SSSE3_H_
#include <tmmintrin.h> // SSSE3
#include "./vpx_config.h"
static INLINE void shuffle_filter_ssse3(const int16_t *const filter,
__m128i *const f) {
const __m128i f_values = _mm_load_si128((const __m128i *)filter);
// pack and duplicate the filter values
f[0] = _mm_shuffle_epi8(f_values, _mm_set1_epi16(0x0200u));
f[1] = _mm_shuffle_epi8(f_values, _mm_set1_epi16(0x0604u));
f[2] = _mm_shuffle_epi8(f_values, _mm_set1_epi16(0x0a08u));
f[3] = _mm_shuffle_epi8(f_values, _mm_set1_epi16(0x0e0cu));
}
static INLINE __m128i convolve8_8_ssse3(const __m128i *const s,
const __m128i *const f) {
// multiply 2 adjacent elements with the filter and add the result
const __m128i k_64 = _mm_set1_epi16(1 << 6);
const __m128i x0 = _mm_maddubs_epi16(s[0], f[0]);
const __m128i x1 = _mm_maddubs_epi16(s[1], f[1]);
const __m128i x2 = _mm_maddubs_epi16(s[2], f[2]);
const __m128i x3 = _mm_maddubs_epi16(s[3], f[3]);
// add and saturate the results together
const __m128i min_x2x1 = _mm_min_epi16(x2, x1);
const __m128i max_x2x1 = _mm_max_epi16(x2, x1);
__m128i temp = _mm_adds_epi16(x0, x3);
temp = _mm_adds_epi16(temp, min_x2x1);
temp = _mm_adds_epi16(temp, max_x2x1);
// round and shift by 7 bit each 16 bit
temp = _mm_adds_epi16(temp, k_64);
temp = _mm_srai_epi16(temp, 7);
return temp;
}
#endif // VPX_DSP_X86_CONVOLVE_SSSE3_H_
This diff is collapsed.
......@@ -327,12 +327,12 @@ cglobal filter_block1d16_%1, 6, 6, 14, LOCAL_VARS_SIZE, \
%endm
INIT_XMM ssse3
SUBPIX_HFILTER16 h8
SUBPIX_HFILTER16 h8_avg
SUBPIX_HFILTER8 h8
SUBPIX_HFILTER8 h8_avg
SUBPIX_HFILTER4 h8
SUBPIX_HFILTER4 h8_avg
SUBPIX_HFILTER16 h8 ; vpx_filter_block1d16_h8_ssse3
SUBPIX_HFILTER16 h8_avg ; vpx_filter_block1d16_h8_avg_ssse3
SUBPIX_HFILTER8 h8 ; vpx_filter_block1d8_h8_ssse3
SUBPIX_HFILTER8 h8_avg ; vpx_filter_block1d8_h8_avg_ssse3
SUBPIX_HFILTER4 h8 ; vpx_filter_block1d4_h8_ssse3
SUBPIX_HFILTER4 h8_avg ; vpx_filter_block1d4_h8_avg_ssse3
;-------------------------------------------------------------------------------
......@@ -795,9 +795,9 @@ cglobal filter_block1d16_%1, 6, NUM_GENERAL_REG_USED, 16, LOCAL_VARS_SIZE, \
%endm
INIT_XMM ssse3
SUBPIX_VFILTER16 v8
SUBPIX_VFILTER16 v8_avg
SUBPIX_VFILTER v8, 8
SUBPIX_VFILTER v8_avg, 8
SUBPIX_VFILTER v8, 4
SUBPIX_VFILTER v8_avg, 4
SUBPIX_VFILTER16 v8 ; vpx_filter_block1d16_v8_ssse3
SUBPIX_VFILTER16 v8_avg ; vpx_filter_block1d16_v8_avg_ssse3
SUBPIX_VFILTER v8, 8 ; vpx_filter_block1d8_v8_ssse3
SUBPIX_VFILTER v8_avg, 8 ; vpx_filter_block1d8_v8_avg_ssse3
SUBPIX_VFILTER v8, 4 ; vpx_filter_block1d4_v8_ssse3
SUBPIX_VFILTER v8_avg, 4 ; vpx_filter_block1d4_v8_avg_ssse3
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