[x265] [PATCH] asm: ssse3 8bpp code for luma_p2s[8xN], luma_p2s[16xN]

rajesh at multicorewareinc.com rajesh at multicorewareinc.com
Mon Mar 30 07:45:05 CEST 2015


# HG changeset patch
# User Rajesh Paulraj<rajesh at multicorewareinc.com>
# Date 1427693424 -19800
#      Mon Mar 30 11:00:24 2015 +0530
# Node ID 43db7eea858762f24b52f1002fdc32ef2ec5e233
# Parent  8797b42373debaab0ef1a2a1f4f8776a69916cfb
asm: ssse3 8bpp code for luma_p2s[8xN],luma_p2s[16xN]

     luma_p2s[8x4](4.15x), luma_p2s[8x8](4.87x), luma_p2s[8x16](5.57x),
     luma_p2s[8x32](5.71x), luma_p2s[16x4](9.48x),luma_p2s[16x8](11.68x),
     luma_p2s[16x12](12.47x), luma_p2s[16x16](12.77x),luma_p2s[16x32](13.26x),
     luma_p2s[16x64](12.68x)

diff -r 8797b42373de -r 43db7eea8587 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Wed Mar 25 19:39:35 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Mon Mar 30 11:00:24 2015 +0530
@@ -1247,6 +1247,16 @@
         p.cu[BLOCK_4x4].sse_pp = x265_pixel_ssd_4x4_ssse3;
         p.chroma[X265_CSP_I422].cu[BLOCK_422_4x8].sse_pp = x265_pixel_ssd_4x8_ssse3;
 
+        p.pu[LUMA_8x4].luma_p2s = x265_filterPixelToShort_8x4_ssse3;
+        p.pu[LUMA_8x8].luma_p2s = x265_filterPixelToShort_8x8_ssse3;
+        p.pu[LUMA_8x16].luma_p2s = x265_filterPixelToShort_8x16_ssse3;
+        p.pu[LUMA_8x32].luma_p2s = x265_filterPixelToShort_8x32_ssse3;
+        p.pu[LUMA_16x4].luma_p2s = x265_filterPixelToShort_16x4_ssse3;
+        p.pu[LUMA_16x8].luma_p2s = x265_filterPixelToShort_16x8_ssse3;
+        p.pu[LUMA_16x12].luma_p2s = x265_filterPixelToShort_16x12_ssse3;
+        p.pu[LUMA_16x16].luma_p2s = x265_filterPixelToShort_16x16_ssse3;
+        p.pu[LUMA_16x32].luma_p2s = x265_filterPixelToShort_16x32_ssse3;
+        p.pu[LUMA_16x64].luma_p2s = x265_filterPixelToShort_16x64_ssse3;
 
         p.dst4x4 = x265_dst4_ssse3;
         p.cu[BLOCK_8x8].idct = x265_idct8_ssse3;
diff -r 8797b42373de -r 43db7eea8587 source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Wed Mar 25 19:39:35 2015 +0530
+++ b/source/common/x86/ipfilter8.asm	Mon Mar 30 11:00:24 2015 +0530
@@ -7741,6 +7741,135 @@
 FILTER_V4_W16n_H2 48, 64
 FILTER_V4_W16n_H2 64, 16
 
+;-----------------------------------------------------------------------------
+; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, int16_t dstStride)
+;-----------------------------------------------------------------------------
+%macro P2S_H_8xN 1
+INIT_XMM ssse3
+cglobal filterPixelToShort_8x%1, 3, 7, 6
+    mov         r3d, r3m
+    add         r3d, r3d
+    lea         r5, [r1 * 3]
+    lea         r6, [r3 * 3]
+
+    ; load height
+    mov         r4d, %1/4
+
+    ; load constant
+    mova        m4, [pb_128]
+    mova        m5, [tab_c_64_n64]
+
+.loop
+    movh        m0, [r0]
+    punpcklbw   m0, m4
+    pmaddubsw   m0, m5
+
+    movh        m1, [r0 + r1]
+    punpcklbw   m1, m4
+    pmaddubsw   m1, m5
+
+    movh        m2, [r0 + r1 * 2]
+    punpcklbw   m2, m4
+    pmaddubsw   m2, m5
+
+    movh        m3, [r0 + r5]
+    punpcklbw   m3, m4
+    pmaddubsw   m3, m5
+
+    movu        [r2 + r3 * 0], m0
+    movu        [r2 + r3 * 1], m1
+    movu        [r2 + r3 * 2], m2
+    movu        [r2 + r6 ], m3
+
+    lea         r0, [r0 + r1 * 4]
+    lea         r2, [r2 + r3 * 4]
+
+    dec         r4d
+    jnz         .loop
+    RET
+%endmacro
+P2S_H_8xN 8
+P2S_H_8xN 4
+P2S_H_8xN 16
+P2S_H_8xN 32
+
+;-----------------------------------------------------------------------------
+; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, int16_t dstStride)
+;-----------------------------------------------------------------------------
+%macro P2S_H_16xN 1
+INIT_XMM ssse3
+cglobal filterPixelToShort_16x%1, 3, 7, 6
+    mov         r3d, r3m
+    add         r3d, r3d
+    lea         r4, [r3 * 3]
+    lea         r5, [r1 * 3]
+
+   ; load height
+    mov         r6d, %1/4
+
+    ; load constant
+    mova        m4, [pb_128]
+    mova        m5, [tab_c_64_n64]
+
+.loop:
+    movh        m0, [r0]
+    punpcklbw   m0, m4
+    pmaddubsw   m0, m5
+
+    movh        m1, [r0 + r1]
+    punpcklbw   m1, m4
+    pmaddubsw   m1, m5
+
+    movh        m2, [r0 + r1 * 2]
+    punpcklbw   m2, m4
+    pmaddubsw   m2, m5
+
+    movh        m3, [r0 + r5]
+    punpcklbw   m3, m4
+    pmaddubsw   m3, m5
+
+    movu        [r2 + r3 * 0], m0
+    movu        [r2 + r3 * 1], m1
+    movu        [r2 + r3 * 2], m2
+    movu        [r2 + r4], m3
+
+    lea         r0, [r0 + 8]
+
+    movh        m0, [r0]
+    punpcklbw   m0, m4
+    pmaddubsw   m0, m5
+
+    movh        m1, [r0 + r1]
+    punpcklbw   m1, m4
+    pmaddubsw   m1, m5
+
+    movh        m2, [r0 + r1 * 2]
+    punpcklbw   m2, m4
+    pmaddubsw   m2, m5
+
+    movh        m3, [r0 + r5]
+    punpcklbw   m3, m4
+    pmaddubsw   m3, m5
+
+    movu        [r2 + r3 * 0 + 16], m0
+    movu        [r2 + r3 * 1 + 16], m1
+    movu        [r2 + r3 * 2 + 16], m2
+    movu        [r2 + r4 + 16], m3
+
+    lea         r0, [r0 + r1 * 4 - 8]
+    lea         r2, [r2 + r3 * 4]
+
+    dec         r6d
+    jnz         .loop
+    RET
+%endmacro
+P2S_H_16xN 16
+P2S_H_16xN 4
+P2S_H_16xN 8
+P2S_H_16xN 12
+P2S_H_16xN 32
+P2S_H_16xN 64
+
 %macro PROCESS_LUMA_W4_4R 0
     movd        m0, [r0]
     movd        m1, [r0 + r1]
diff -r 8797b42373de -r 43db7eea8587 source/common/x86/ipfilter8.h
--- a/source/common/x86/ipfilter8.h	Wed Mar 25 19:39:35 2015 +0530
+++ b/source/common/x86/ipfilter8.h	Mon Mar 30 11:00:24 2015 +0530
@@ -622,6 +622,16 @@
 LUMA_SP_FILTERS(_avx2);
 LUMA_SS_FILTERS(_avx2);
 void x265_interp_8tap_hv_pp_8x8_sse4(const pixel* src, intptr_t srcStride, pixel* dst, intptr_t dstStride, int idxX, int idxY);
+void x265_filterPixelToShort_8x4_ssse3(const pixel* src, intptr_t srcStride, int16_t* dst, int16_t dstStride);
+void x265_filterPixelToShort_8x8_ssse3(const pixel* src, intptr_t srcStride, int16_t* dst, int16_t dstStride);
+void x265_filterPixelToShort_8x16_ssse3(const pixel* src, intptr_t srcStride, int16_t* dst, int16_t dstStride);
+void x265_filterPixelToShort_8x32_ssse3(const pixel* src, intptr_t srcStride, int16_t* dst, int16_t dstStride);
+void x265_filterPixelToShort_16x4_ssse3(const pixel* src, intptr_t srcStride, int16_t* dst, int16_t dstStride);
+void x265_filterPixelToShort_16x8_ssse3(const pixel* src, intptr_t srcStride, int16_t* dst, int16_t dstStride);
+void x265_filterPixelToShort_16x12_ssse3(const pixel* src, intptr_t srcStride, int16_t* dst, int16_t dstStride);
+void x265_filterPixelToShort_16x16_ssse3(const pixel* src, intptr_t srcStride, int16_t* dst, int16_t dstStride);
+void x265_filterPixelToShort_16x32_ssse3(const pixel* src, intptr_t srcStride, int16_t* dst, int16_t dstStride);
+void x265_filterPixelToShort_16x64_ssse3(const pixel* src, intptr_t srcStride, int16_t* dst, int16_t dstStride);
 #undef LUMA_FILTERS
 #undef LUMA_SP_FILTERS
 #undef LUMA_SS_FILTERS


More information about the x265-devel mailing list