changeset 9567:8be71cee10f3

asm-avx2: filter_vps[4x4]: improve 201c->156c
author Divya Manivannan <divya@multicorewareinc.com>
date Tue, 24 Feb 2015 17:26:37 +0530
parents 8994b1ec22d1
children 8d5f9b7b4733
files source/common/x86/asm-primitives.cpp source/common/x86/const-a.asm source/common/x86/ipfilter8.asm
diffstat 3 files changed, 20 insertions(+-), 8 deletions(-) [+]
line wrap: on
line diff
--- a/source/common/x86/asm-primitives.cpp	Tue Feb 24 17:11:03 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Tue Feb 24 17:26:37 2015 +0530
@@ -1800,11 +1800,10 @@ void setupAssemblyPrimitives(EncoderPrim
         p.chroma[X265_CSP_I420].pu[CHROMA_420_8x8].filter_vpp = x265_interp_4tap_vert_pp_8x8_avx2;
         p.chroma[X265_CSP_I420].pu[CHROMA_420_2x4].filter_vpp = x265_interp_4tap_vert_pp_2x4_avx2;
         p.chroma[X265_CSP_I420].pu[CHROMA_420_8x4].filter_vpp = x265_interp_4tap_vert_pp_8x4_avx2;
-
         p.chroma[X265_CSP_I420].pu[CHROMA_420_2x4].filter_vps = x265_interp_4tap_vert_ps_2x4_avx2;
+        p.chroma[X265_CSP_I420].pu[CHROMA_420_4x4].filter_vps = x265_interp_4tap_vert_ps_4x4_avx2;
         p.chroma[X265_CSP_I420].pu[CHROMA_420_8x4].filter_vps = x265_interp_4tap_vert_ps_8x4_avx2;
         p.chroma[X265_CSP_I420].pu[CHROMA_420_8x8].filter_vps = x265_interp_4tap_vert_ps_8x8_avx2;
-
         // color space i422
         p.chroma[X265_CSP_I422].pu[CHROMA_422_4x4].filter_vpp = x265_interp_4tap_vert_pp_4x4_avx2;
 
--- a/source/common/x86/const-a.asm	Tue Feb 24 17:11:03 2015 +0530
+++ b/source/common/x86/const-a.asm	Tue Feb 24 17:26:37 2015 +0530
@@ -73,7 +73,7 @@ const pw_64,       times 8 dw 64
 const pw_256,      times 8 dw 256
 const pw_32_0,     times 4 dw 32,
                    times 4 dw 0
-const pw_2000,     times 8 dw 0x2000
+const pw_2000,     times 16 dw 0x2000
 const pw_8000,     times 8 dw 0x8000
 const pw_3fff,     times 8 dw 0x3fff
 const pw_ppppmmmm, dw 1,1,1,1,-1,-1,-1,-1
--- a/source/common/x86/ipfilter8.asm	Tue Feb 24 17:11:03 2015 +0530
+++ b/source/common/x86/ipfilter8.asm	Tue Feb 24 17:26:37 2015 +0530
@@ -2552,11 +2552,10 @@ pextrd      [r2 + r3], m2, 1
 lea         r2,        [r2 + 2 * r3]
 pextrd      [r2],      m2, 2
 pextrd      [r2 + r3], m2, 3
-
 RET
-
+%macro FILTER_VER_CHROMA_AVX2_4x4 1
 INIT_YMM avx2
-cglobal interp_4tap_vert_pp_4x4, 4, 6, 3
+cglobal interp_4tap_vert_%1_4x4, 4, 6, 3
     mov             r4d, r4m
     shl             r4d, 6
     sub             r0, r1
@@ -2590,6 +2589,7 @@ cglobal interp_4tap_vert_pp_4x4, 4, 6, 3
     pmaddubsw       m0, [r5]
     pmaddubsw       m1, [r5 + mmsize]
     paddw           m0, m1                                  ; m0 = WORD ROW[3 2 1 0]
+%ifidn %1,pp
     pmulhrsw        m0, [pw_512]
     vextracti128    xm1, m0, 1
     packuswb        xm0, xm1
@@ -2598,8 +2598,21 @@ cglobal interp_4tap_vert_pp_4x4, 4, 6, 3
     pextrd          [r2 + r3], xm0, 1
     pextrd          [r2 + r3 * 2], xm0, 2
     pextrd          [r2 + r5], xm0, 3
-    RET
-
+%else
+    add             r3d, r3d
+    psubw           m0, [pw_2000]
+    vextracti128    xm1, m0, 1
+    lea             r5, [r3 * 3]
+    movq            [r2], xm0
+    movhps          [r2 + r3], xm0
+    movq            [r2 + r3 * 2], xm1
+    movhps          [r2 + r5], xm1
+%endif
+    RET
+%endmacro
+
+FILTER_VER_CHROMA_AVX2_4x4 pp
+FILTER_VER_CHROMA_AVX2_4x4 ps
 ;-----------------------------------------------------------------------------
 ; void interp_4tap_vert_pp_%1x%2(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx)
 ;-----------------------------------------------------------------------------