summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott LaVarnway <slavarnway@google.com>2012-10-22 16:38:58 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2012-10-25 12:19:41 -0700
commitd3465a53523878052f75cc80fe7603b3fcaff2aa (patch)
treebae5ac20d3d5e896e021e515c001c868217e237b
parentbe4e7c5f77ec8413883cf250e8b1103a387261c4 (diff)
downloadlibvpx-d3465a53523878052f75cc80fe7603b3fcaff2aa.tar
libvpx-d3465a53523878052f75cc80fe7603b3fcaff2aa.tar.gz
libvpx-d3465a53523878052f75cc80fe7603b3fcaff2aa.tar.bz2
libvpx-d3465a53523878052f75cc80fe7603b3fcaff2aa.zip
Added sse2 instrinsic version of vp8_sad3x16
1.6% boost in decoder performance for the clip used. Change-Id: I91f3c4573fd3d10afbf18930f279af7ae2223e3a
-rw-r--r--vp8/common/rtcd_defs.sh2
-rw-r--r--vp8/common/x86/sadmxn_x86.c42
2 files changed, 43 insertions, 1 deletions
diff --git a/vp8/common/rtcd_defs.sh b/vp8/common/rtcd_defs.sh
index 90debf5cb..d7e5b5b25 100644
--- a/vp8/common/rtcd_defs.sh
+++ b/vp8/common/rtcd_defs.sh
@@ -182,7 +182,7 @@ prototype unsigned int vp8_sad16x3 "const unsigned char *src_ptr, int src_strid
specialize vp8_sad16x3 sse2
prototype unsigned int vp8_sad3x16 "const unsigned char *src_ptr, int src_stride, const unsigned char *ref_ptr, int ref_stride, int max_sad"
-specialize vp8_sad3x16
+specialize vp8_sad3x16 sse2
fi
#
diff --git a/vp8/common/x86/sadmxn_x86.c b/vp8/common/x86/sadmxn_x86.c
index 5057703bd..46f388247 100644
--- a/vp8/common/x86/sadmxn_x86.c
+++ b/vp8/common/x86/sadmxn_x86.c
@@ -44,6 +44,48 @@ unsigned int vp8_sad16x3_sse2(
return _mm_cvtsi128_si32(sad);
}
+
+unsigned int vp8_sad3x16_sse2(
+ const unsigned char *src_ptr,
+ int src_stride,
+ const unsigned char *ref_ptr,
+ int ref_stride,
+ int max_sad) {
+ int r;
+ __m128i s0, s1, s2, s3;
+ __m128i r0, r1, r2, r3;
+ __m128i sad = _mm_set1_epi16(0);
+ for (r = 0; r < 16; r += 4) {
+ s0 = _mm_cvtsi32_si128 (*(const int *)(src_ptr + 0 * src_stride));
+ s1 = _mm_cvtsi32_si128 (*(const int *)(src_ptr + 1 * src_stride));
+ s2 = _mm_cvtsi32_si128 (*(const int *)(src_ptr + 2 * src_stride));
+ s3 = _mm_cvtsi32_si128 (*(const int *)(src_ptr + 3 * src_stride));
+ r0 = _mm_cvtsi32_si128 (*(const int *)(ref_ptr + 0 * src_stride));
+ r1 = _mm_cvtsi32_si128 (*(const int *)(ref_ptr + 1 * src_stride));
+ r2 = _mm_cvtsi32_si128 (*(const int *)(ref_ptr + 2 * src_stride));
+ r3 = _mm_cvtsi32_si128 (*(const int *)(ref_ptr + 3 * src_stride));
+
+ s0 = _mm_unpacklo_epi8(s0, s1);
+ r0 = _mm_unpacklo_epi8(r0, r1);
+ s2 = _mm_unpacklo_epi8(s2, s3);
+ r2 = _mm_unpacklo_epi8(r2, r3);
+ s0 = _mm_unpacklo_epi64(s0, s2);
+ r0 = _mm_unpacklo_epi64(r0, r2);
+
+ // throw out byte 3
+ s0 = _mm_slli_epi64(s0, 16);
+ r0 = _mm_slli_epi64(r0, 16);
+
+ sad = _mm_add_epi16(sad, _mm_sad_epu8(s0, r0));
+
+ src_ptr += src_stride*4;
+ ref_ptr += ref_stride*4;
+ }
+
+ sad = _mm_add_epi16(sad, _mm_srli_si128(sad, 8));
+ return _mm_cvtsi128_si32(sad);
+}
+
#endif