[x265] [PATCH 1 of 8] asm: interp_4tap_horiz_pp_2x4_sse3

dtyx265 at gmail.com dtyx265 at gmail.com
Fri Apr 17 18:47:57 CEST 2015


# HG changeset patch
# User David T Yuen <dtyx265 at gmail.com>
# Date 1429286699 25200
# Node ID 34b0ec5fbc8695afd640821f8a9aba0e30a4253a
# Parent  7be1172ec816298c32f588908e1b6f0fa214d349
asm: interp_4tap_horiz_pp_2x4_sse3

This replaces c code.

64-bit

./test/TestBench --testbench interp | grep "chroma_hpp\[  2x4\]"
chroma_hpp[  2x4]	1.83x 	 594.91   	 1089.98

32-bit

./test/TestBench --testbench interp | grep "chroma_hpp\[  2x4\]"
chroma_hpp[  2x4]	1.75x 	 739.88   	 1297.40

diff -r 7be1172ec816 -r 34b0ec5fbc86 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Thu Apr 16 11:38:32 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Fri Apr 17 09:04:59 2015 -0700
@@ -1354,6 +1354,10 @@
 
         p.planecopy_sp = x265_downShift_16_sse2;
     }
+    if (cpuMask & X265_CPU_SSE3)
+    {
+        p.chroma[X265_CSP_I420].pu[CHROMA_420_2x4].filter_hpp = x265_interp_4tap_horiz_pp_2x4_sse3;
+    }
     if (cpuMask & X265_CPU_SSSE3)
     {
         p.pu[LUMA_8x16].sad_x3 = x265_pixel_sad_x3_8x16_ssse3;
diff -r 7be1172ec816 -r 34b0ec5fbc86 source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Thu Apr 16 11:38:32 2015 +0530
+++ b/source/common/x86/ipfilter8.asm	Fri Apr 17 09:04:59 2015 -0700
@@ -71,6 +71,16 @@
                  db -4, 28, 46, -6
                  db -2, 16, 54, -4
                  db -2, 10, 58, -2
+
+tabw_ChromaCoeff: dw  0, 64,  0,  0
+                  dw -2, 58, 10, -2
+                  dw -4, 54, 16, -2
+                  dw -6, 46, 28, -4
+                  dw -4, 36, 36, -4
+                  dw -4, 28, 46, -6
+                  dw -2, 16, 54, -4
+                  dw -2, 10, 58, -2
+
 ALIGN 32
 tab_ChromaCoeff_V: times 8 db 0, 64
                    times 8 db 0,  0
@@ -298,9 +308,59 @@
 
 cextern pb_128
 cextern pw_1
+cextern pw_32
 cextern pw_512
 cextern pw_2000
 
+%macro FILTER_H4_w2_2_sse2 0
+    pxor        m3, m3
+    movd        m0, [srcq - 1]
+    movd        m2, [srcq]
+    punpckldq   m0, m2
+    punpcklbw   m0, m3
+    movd        m1, [srcq + srcstrideq - 1]
+    movd        m2, [srcq + srcstrideq]
+    punpckldq   m1, m2
+    punpcklbw   m1, m3
+    pmaddwd     m0, m4
+    pmaddwd     m1, m4
+    packssdw    m0, m1
+    pshuflw     m1, m0, q2301
+    pshufhw     m1, m1, q2301
+    paddw       m0, m1
+    psrld       m0, 16
+    packssdw    m0, m0
+    paddw       m0, m5
+    psraw       m0, 6
+    packuswb    m0, m0
+    movd        r4, m0
+    mov         [dstq], r4w
+    shr         r4, 16
+    mov         [dstq + dststrideq], r4w
+%endmacro
+
+;-----------------------------------------------------------------------------
+; void interp_4tap_horiz_pp_2x4(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx)
+;-----------------------------------------------------------------------------
+INIT_XMM sse3
+cglobal interp_4tap_horiz_pp_2x4, 4, 6, 6, src, srcstride, dst, dststride
+mov         r4d,        r4m
+mova        m5,         [pw_32]
+
+%ifdef PIC
+lea         r5,          [tabw_ChromaCoeff]
+movddup     m4,         [r5 + r4 * 8]
+%else
+movddup     m4,         [tabw_ChromaCoeff + r4 * 8]
+%endif
+
+FILTER_H4_w2_2_sse2
+lea         srcq,       [srcq + srcstrideq * 2]
+lea         dstq,       [dstq + dststrideq * 2]
+FILTER_H4_w2_2_sse2
+
+RET
+
 %macro FILTER_H4_w2_2 3
     movh        %2, [srcq - 1]
     pshufb      %2, %2, Tm0
diff -r 7be1172ec816 -r 34b0ec5fbc86 source/common/x86/ipfilter8.h
--- a/source/common/x86/ipfilter8.h	Thu Apr 16 11:38:32 2015 +0530
+++ b/source/common/x86/ipfilter8.h	Fri Apr 17 09:04:59 2015 -0700
@@ -763,6 +763,7 @@
 void x265_filterPixelToShort_64x64_avx2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
 void x265_filterPixelToShort_48x64_avx2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
 void x265_filterPixelToShort_24x32_avx2(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
+void x265_interp_4tap_horiz_pp_2x4_sse3(const pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx);
 #undef LUMA_FILTERS
 #undef LUMA_SP_FILTERS
 #undef LUMA_SS_FILTERS


More information about the x265-devel mailing list