[x265] [PATCH] sse_pp32: Better performance result
praveen at multicorewareinc.com
praveen at multicorewareinc.com
Thu Aug 8 13:49:49 CEST 2013
# HG changeset patch
# User praveentiwari
# Date 1375962578 -19800
# Node ID c33014023b43c20a8c1a41be008c1036b19476e9
# Parent 3d199230cab10e4f96d14adc086b1055ddd2cbd9
sse_pp32: Better performance result
diff -r 3d199230cab1 -r c33014023b43 source/common/vec/sse.inc
--- a/source/common/vec/sse.inc Thu Aug 08 17:10:26 2013 +0530
+++ b/source/common/vec/sse.inc Thu Aug 08 17:19:38 2013 +0530
@@ -185,7 +185,8 @@
int sse_pp32(pixel* Org, intptr_t strideOrg, pixel* Cur, intptr_t strideCur)
{
int rows = ly;
- __m128i sum = _mm_set1_epi32(0);
+ __m128i sum = _mm_setzero_si128();
+ __m128i zero = _mm_setzero_si128();
for (; rows != 0; rows--)
{
@@ -193,12 +194,10 @@
__m128i n1 = _mm_loadu_si128((__m128i const*)(Cur));
__m128i m1lo = _mm_cvtepu8_epi16(m1);
- __m128i m1hi = _mm_srli_si128(m1, 8);
- m1hi = _mm_cvtepu8_epi16(m1hi);
+ __m128i m1hi = _mm_unpackhi_epi8(m1, zero);
__m128i n1lo = _mm_cvtepu8_epi16(n1);
- __m128i n1hi = _mm_srli_si128(n1, 8);
- n1hi = _mm_cvtepu8_epi16(n1hi);
+ __m128i n1hi = _mm_unpackhi_epi8(n1, zero);
__m128i diff = _mm_sub_epi16(m1lo, n1lo);
sum = _mm_add_epi32(sum, _mm_madd_epi16(diff, diff));
@@ -210,12 +209,10 @@
n1 = _mm_loadu_si128((__m128i const*)(Cur + 16));
m1lo = _mm_cvtepu8_epi16(m1);
- m1hi = _mm_srli_si128(m1, 8);
- m1hi = _mm_cvtepu8_epi16(m1hi);
+ m1hi = _mm_unpackhi_epi8(m1, zero);
n1lo = _mm_cvtepu8_epi16(n1);
- n1hi = _mm_srli_si128(n1, 8);
- n1hi = _mm_cvtepu8_epi16(n1hi);
+ n1hi = _mm_unpackhi_epi8(n1, zero);
diff = _mm_sub_epi16(m1lo, n1lo);
sum = _mm_add_epi32(sum, _mm_madd_epi16(diff, diff));
@@ -227,8 +224,8 @@
Cur += strideCur;
}
- sum = _mm_add_epi32(sum, _mm_srli_si128(sum, 8));
- sum = _mm_add_epi32(sum, _mm_srli_si128(sum, 4));
+ sum = _mm_hadd_epi32(sum, sum);
+ sum = _mm_hadd_epi32(sum, sum);
return _mm_cvtsi128_si32(sum);
}
More information about the x265-devel
mailing list