[x265] [PATCH] asm: avx2 code for add_ps[8x8] for 8bpp -- 22x

sumalatha at multicorewareinc.com sumalatha at multicorewareinc.com
Thu Mar 5 10:31:34 CET 2015


# HG changeset patch
# User Sumalatha Polureddy<sumalatha at multicorewareinc.com>
# Date 1425547841 -19800
# Node ID b12a6a607b55ac1a347ca9c0026d9eabefe5ed80
# Parent  ea9bdb10353fcb06cea1045ba0186c22c448df63
asm: avx2 code for add_ps[8x8] for 8bpp -- 22x

add_ps[  8x8]  22.34x   320.31          7154.80

diff -r ea9bdb10353f -r b12a6a607b55 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Wed Mar 04 13:20:55 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Thu Mar 05 15:00:41 2015 +0530
@@ -1376,6 +1376,7 @@
         ASSIGN_SSE_SS(avx);
         LUMA_VAR(avx);
 
+        p.pu[LUMA_8x8].sad_x3 = x265_pixel_sad_x3_8x8_avx;
         p.pu[LUMA_12x16].sad_x3 = x265_pixel_sad_x3_12x16_avx;
         p.pu[LUMA_16x4].sad_x3  = x265_pixel_sad_x3_16x4_avx;
         HEVC_SAD_X3(avx);
@@ -1432,6 +1433,7 @@
     }
     if (cpuMask & X265_CPU_AVX2)
     {
+        p.cu[BLOCK_8x8].add_ps = x265_pixel_add_ps_8x8_avx2;
         p.cu[BLOCK_16x16].add_ps = x265_pixel_add_ps_16x16_avx2;
         p.cu[BLOCK_32x32].add_ps = x265_pixel_add_ps_32x32_avx2;
         p.cu[BLOCK_64x64].add_ps = x265_pixel_add_ps_64x64_avx2;
diff -r ea9bdb10353f -r b12a6a607b55 source/common/x86/pixel.h
--- a/source/common/x86/pixel.h	Wed Mar 04 13:20:55 2015 +0530
+++ b/source/common/x86/pixel.h	Thu Mar 05 15:00:41 2015 +0530
@@ -251,6 +251,7 @@
 void x265_pixel_avg_64x32_avx2(pixel* dst, intptr_t dstride, const pixel* src0, intptr_t sstride0, const pixel* src1, intptr_t sstride1, int);
 void x265_pixel_avg_64x16_avx2(pixel* dst, intptr_t dstride, const pixel* src0, intptr_t sstride0, const pixel* src1, intptr_t sstride1, int);
 
+void x265_pixel_add_ps_8x8_avx2(pixel* a, intptr_t dstride, const pixel* b0, const int16_t* b1, intptr_t sstride0, intptr_t sstride1);
 void x265_pixel_add_ps_16x16_avx2(pixel* a, intptr_t dstride, const pixel* b0, const int16_t* b1, intptr_t sstride0, intptr_t sstride1);
 void x265_pixel_add_ps_32x32_avx2(pixel* a, intptr_t dstride, const pixel* b0, const int16_t* b1, intptr_t sstride0, intptr_t sstride1);
 void x265_pixel_add_ps_64x64_avx2(pixel* a, intptr_t dstride, const pixel* b0, const int16_t* b1, intptr_t sstride0, intptr_t sstride1);
diff -r ea9bdb10353f -r b12a6a607b55 source/common/x86/pixeladd8.asm
--- a/source/common/x86/pixeladd8.asm	Wed Mar 04 13:20:55 2015 +0530
+++ b/source/common/x86/pixeladd8.asm	Thu Mar 05 15:00:41 2015 +0530
@@ -267,6 +267,63 @@
 
     jnz         .loop
     RET
+
+INIT_YMM avx2
+cglobal pixel_add_ps_8x%2, 6, 7, 5, dest, destride, src0, scr1, srcStride0, srcStride1
+
+    mov         r6d,        %2/4
+    add         r5,         r5
+.loop:
+
+    movq        xm2,        [r2]        ; row 0 of src0
+    movhps      xm2,        [r2 + r4]   ; row 1 of src0
+    pmovzxbw    m0,         xm2
+
+
+    movu        xm1,        [r3]        ; row 0 of src1
+    movu        xm2,        [r3 + r5]   ; row 1 of src1
+    vinserti128 m1, m1, xm2, 1
+
+    lea         r2,         [r2 + r4 * 2]
+    lea         r3,         [r3 + r5 * 2]
+
+    movq        xm3,        [r2]        ; row 2 of src0
+    movhps      xm3,        [r2 + r4]   ; row 3 of src0
+    pmovzxbw    m2,         xm3
+
+    movu        xm3,        [r3]        ; row 2 of src1
+    movu        xm4,        [r3 + r5]   ; row 3 of src1
+    vinserti128 m3, m3, xm4, 1
+
+    lea         r2,         [r2 + r4 * 2]
+    lea         r3,         [r3 + r5 * 2]
+
+    paddw       m0,         m1
+    paddw       m2,         m3
+    packuswb    m0,         m2
+
+    ;movq        [r0],       xm0         ; row 0 of dst
+    ;vextracti128 xm3, m0, 1
+    ;movq        [r0 + r1],  xm3         ; row 1 of dst
+    ;lea         r0,         [r0 + r1 * 2]
+    ;movq        [r0],       xm2         ; row 2 of dst
+    ;vextracti128 xm3, m2, 1
+    ;movq        [r0 + r1],  xm3         ; row 3 of dst
+
+    vpermq      m0, m0, 11011000b
+    movq        [r0],      xm0           ; row 0 of dst
+    movhps      [r0 + r1], xm0           ; row 1 of dst
+    lea         r0,         [r0 + r1 * 2]
+    vextracti128 xm3, m0, 1
+    movq        [r0], xm3           ; row 2 of dst
+    movhps      [r0 + r1], xm3      ; row 3 of dst
+
+    lea         r0,         [r0 + r1 * 2]
+
+    dec         r6d
+    jnz         .loop
+    RET
+
 %endif
 %endmacro
 


More information about the x265-devel mailing list