[x265] [PATCH] asm: sse4 8bpp code for chroma_p2s[6xN] for i420, i422

rajesh at multicorewareinc.com rajesh at multicorewareinc.com
Mon Apr 6 16:25:43 CEST 2015


# HG changeset patch
# User Rajesh Paulraj<rajesh at multicorewareinc.com>
# Date 1428312966 -19800
#      Mon Apr 06 15:06:06 2015 +0530
# Node ID e7890da101691cc902ef6df66ee71351c613250e
# Parent  325cd099704f76392ffe6cd1bb4a45bd9d310b5b
asm: sse4 8bpp code for chroma_p2s[6xN] for i420, i422

          chroma_p2s[6x8][i420](2.75x), chroma_p2s[6x16][i422](2.96x)

diff -r 325cd099704f -r e7890da10169 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Mon Apr 06 15:02:05 2015 +0530
+++ b/source/common/x86/asm-primitives.cpp	Mon Apr 06 15:06:06 2015 +0530
@@ -1434,9 +1434,11 @@
         p.chroma[X265_CSP_I420].pu[CHROMA_420_4x4].p2s = x265_filterPixelToShort_4x4_sse4;
         p.chroma[X265_CSP_I420].pu[CHROMA_420_4x8].p2s = x265_filterPixelToShort_4x8_sse4;
         p.chroma[X265_CSP_I420].pu[CHROMA_420_4x16].p2s = x265_filterPixelToShort_4x16_sse4;
+        p.chroma[X265_CSP_I420].pu[CHROMA_420_6x8].p2s = x265_filterPixelToShort_6x8_sse4;
         p.chroma[X265_CSP_I422].pu[CHROMA_422_4x4].p2s = x265_filterPixelToShort_4x4_sse4;
         p.chroma[X265_CSP_I422].pu[CHROMA_422_4x8].p2s = x265_filterPixelToShort_4x8_sse4;
         p.chroma[X265_CSP_I422].pu[CHROMA_422_4x16].p2s = x265_filterPixelToShort_4x16_sse4;
+        p.chroma[X265_CSP_I422].pu[CHROMA_422_6x16].p2s = x265_filterPixelToShort_6x16_sse4;
 
 #if X86_64
         ALL_LUMA_CU(psy_cost_pp, psyCost_pp, sse4);
diff -r 325cd099704f -r e7890da10169 source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Mon Apr 06 15:02:05 2015 +0530
+++ b/source/common/x86/ipfilter8.asm	Mon Apr 06 15:06:06 2015 +0530
@@ -7787,6 +7787,60 @@
 ;-----------------------------------------------------------------------------
 ; void filterPixelToShort(pixel *src, intptr_t srcStride, int16_t *dst, int16_t dstStride)
 ;-----------------------------------------------------------------------------
+%macro P2S_H_6xN 1
+INIT_XMM sse4
+cglobal filterPixelToShort_6x%1, 3, 7, 6
+    mov         r3d, r3m
+    add         r3d, r3d
+    lea         r4, [r1 * 3]
+    lea         r5, [r3 * 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 + r4]
+    punpcklbw   m3, m4
+    pmaddubsw   m3, m5
+
+    movh        [r2 + r3 * 0], m0
+    pextrd      [r2 + r3 * 0 + 8], m0, 2
+    movh        [r2 + r3 * 1], m1
+    pextrd      [r2 + r3 * 1 + 8], m1, 2
+    movh        [r2 + r3 * 2], m2
+    pextrd      [r2 + r3 * 2 + 8], m2, 2
+    movh        [r2 + r5], m3
+    pextrd      [r2 + r5 + 8], m3, 2
+
+    lea         r0, [r0 + r1 * 4]
+    lea         r2, [r2 + r3 * 4]
+
+    dec         r6d
+    jnz         .loop
+    RET
+%endmacro
+P2S_H_6xN 8
+P2S_H_6xN 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
diff -r 325cd099704f -r e7890da10169 source/common/x86/ipfilter8.h
--- a/source/common/x86/ipfilter8.h	Mon Apr 06 15:02:05 2015 +0530
+++ b/source/common/x86/ipfilter8.h	Mon Apr 06 15:06:06 2015 +0530
@@ -570,14 +570,18 @@
     SETUP_CHROMA_SS_FUNC_DEF(64, 16, cpu); \
     SETUP_CHROMA_SS_FUNC_DEF(16, 64, cpu);
 
-#define SETUP_CHROMA_420_P2S_FUNC_DEF(W, H, cpu) \
+#define SETUP_CHROMA_P2S_FUNC_DEF(W, H, cpu) \
     void x265_filterPixelToShort_ ## W ## x ## H ## cpu(const pixel* src, intptr_t srcStride, int16_t* dst, intptr_t dstStride);
 
 #define CHROMA_420_P2S_FILTERS_SSE4(cpu) \
-    SETUP_CHROMA_420_P2S_FUNC_DEF(4, 2, cpu);
+    SETUP_CHROMA_P2S_FUNC_DEF(4, 2, cpu); \
+    SETUP_CHROMA_P2S_FUNC_DEF(6, 8, cpu); 
 
 #define CHROMA_420_P2S_FILTERS_SSSE3(cpu) \
-    SETUP_CHROMA_420_P2S_FUNC_DEF(8, 2, cpu);
+    SETUP_CHROMA_P2S_FUNC_DEF(8, 2, cpu);
+
+#define CHROMA_422_P2S_FILTERS_SSE4(cpu) \
+    SETUP_CHROMA_P2S_FUNC_DEF(6, 16, cpu);
 
 CHROMA_420_FILTERS(_sse4);
 CHROMA_420_FILTERS(_avx2);
@@ -598,6 +602,7 @@
 CHROMA_422_SP_FILTERS_SSE4(_sse4);
 CHROMA_422_SS_FILTERS(_sse2);
 CHROMA_422_SS_FILTERS_SSE4(_sse4);
+CHROMA_422_P2S_FILTERS_SSE4(_sse4);
 
 CHROMA_444_FILTERS(_sse4);
 CHROMA_444_SP_FILTERS(_sse4);


More information about the x265-devel mailing list