[x265] [PATCH 1 of 1] pixel.inc: Modified sse_ss4 intrinsic function. Removed redundancy using comman macro PROCESS_SSE_SS4x1

dnyaneshwar at multicorewareinc.com dnyaneshwar at multicorewareinc.com
Wed Oct 9 15:07:47 CEST 2013


# HG changeset patch
# User Dnyaneshwar Gorade <dnyaneshwar at multicorewareinc.com>
# Date 1381323893 -19800
#      Wed Oct 09 18:34:53 2013 +0530
# Node ID dcd7432686e2c9cbe41aa9d9f74482e1d3f1ab47
# Parent  ea905eb4f7a43370e60447cbca0eaf1a7046ec78
pixel.inc: Modified sse_ss4 intrinsic function. Removed redundancy using comman macro PROCESS_SSE_SS4x1.

diff -r ea905eb4f7a4 -r dcd7432686e2 source/common/vec/sse.inc
--- a/source/common/vec/sse.inc	Wed Oct 09 18:23:16 2013 +0530
+++ b/source/common/vec/sse.inc	Wed Oct 09 18:34:53 2013 +0530
@@ -63,22 +63,19 @@
 int sse_ss4(short* fenc, intptr_t strideFenc, short* fref, intptr_t strideFref)
 {
     int rows = ly;
+    __m128i diff;
+    __m128i sum  = _mm_setzero_si128();
+    __m128i m1, n1, sign1, sign2, tmp1, tmp2;
 
-    Vec4i diff(0);
-    Vec8s m1, n1;
-    Vec4i sum(0);
     for (; rows != 0; rows--)
     {
-        m1.load(fenc);
-        n1.load(fref);
-        diff = extend_low(m1) - extend_low(n1);
-        diff = diff * diff;
-        sum += diff;
+        PROCESS_SSE_SS4x1(0);
+
         fenc += strideFenc;
         fref += strideFref;
     }
-
-    return horizontal_add(sum);
+    __m128i sum1  = _mm_hadd_epi32(sum, sum);         // horizontally add 4 elements
+    return _mm_cvtsi128_si32(_mm_hadd_epi32(sum1, sum1));
 }
 
 template<int ly>


More information about the x265-devel mailing list