[x265] [PATCH Review Only] ASM routine for luma filter for 64x64 block

nabajit at multicorewareinc.com nabajit at multicorewareinc.com
Tue Oct 8 14:25:36 CEST 2013


# HG changeset patch
# User Nabajit Deka
# Date 1381235115 -19800
#      Tue Oct 08 17:55:15 2013 +0530
# Node ID 88faed2963e4c9a85f66f2c37b32507ded30dd63
# Parent  9b3a427a1009d1853bbdc30abe1fd891864e6b38
ASM routine for luma filter for 64x64 block

diff -r 9b3a427a1009 -r 88faed2963e4 source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Tue Oct 08 11:12:12 2013 +0530
+++ b/source/common/x86/ipfilter8.asm	Tue Oct 08 17:55:15 2013 +0530
@@ -130,3 +130,161 @@
     RET
 
 %endif  ; ARCH_X86_64 == 0
+
+SECTION_RODATA 32
+
+tab_Tm8:    db 0, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8
+            db 2, 3, 4, 5, 6, 7, 8, 9, 3, 4, 5, 6, 7, 8, 9, 10
+            db 4, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 12
+            db 6, 7, 8, 9, 10, 11, 12, 13, 7, 8, 9, 10, 11, 12, 13, 14
+
+tab_c_512:  times 8 dw 512
+
+SECTION .text
+
+%macro FILTER_H8 4
+    movu        %1, [r0 - 3]
+    pshufb      %2, %1, [tab_Tm8]
+    pmaddubsw   %2, m3
+    pshufb      m7, %1, [tab_Tm8 + 16]
+    pmaddubsw   m7, m3
+    phaddw      %2, m7
+    pshufb      m7, %1, [tab_Tm8 + 32]
+    pmaddubsw   m7, m3
+    pshufb      %1, %1, [tab_Tm8 + 48]
+    pmaddubsw   %1, m3
+    phaddw      m7, %1
+    phaddw      %2, m7
+    pmulhrsw    %2, %3
+
+    movu        %1, [r0 + 5]
+    pshufb      %4, %1, [tab_Tm8]
+    pmaddubsw   %4, m3
+    pshufb      m7, %1, [tab_Tm8 + 16]
+    pmaddubsw   m7, m3
+    phaddw      %4, m7
+    pshufb      m7, %1, [tab_Tm8 + 32]
+    pmaddubsw   m7, m3
+    pshufb      %1, %1, [tab_Tm8 + 48]
+    pmaddubsw   %1, m3
+    phaddw      m7, %1
+    phaddw      %4, m7
+    pmulhrsw    %4, %3
+    packuswb    %2, %4
+    movu        [r2], %2
+
+    movu        %1, [r0 + 13]
+    pshufb      %2, %1, [tab_Tm8]
+    pmaddubsw   %2, m3
+    pshufb      m7, %1, [tab_Tm8 + 16]
+    pmaddubsw   m7, m3
+    phaddw      %2, m7
+    pshufb      m7, %1, [tab_Tm8 + 32]
+    pmaddubsw   m7, m3
+    pshufb      %1, %1, [tab_Tm8 + 48]
+    pmaddubsw   %1, m3
+    phaddw      m7, %1
+    phaddw      %2, m7
+    pmulhrsw    %2, %3
+
+    movu        %1, [r0 + 21]
+    pshufb      %4, %1, [tab_Tm8]
+    pmaddubsw   %4, m3
+    pshufb      m7, %1, [tab_Tm8 + 16]
+    pmaddubsw   m7, m3
+    phaddw      %4, m7
+    pshufb      m7, %1, [tab_Tm8 + 32]
+    pmaddubsw   m7, m3
+    pshufb      %1, %1, [tab_Tm8 + 48]
+    pmaddubsw   %1, m3
+    phaddw      m7, %1
+    phaddw      %4, m7
+    pmulhrsw    %4, %3
+    packuswb    %2, %4
+    movu        [r2 + 16], %2
+
+    movu        %1, [r0 + 29]
+    pshufb      %2, %1, [tab_Tm8]
+    pmaddubsw   %2, m3
+    pshufb      m7, %1, [tab_Tm8 + 16]
+    pmaddubsw   m7, m3
+    phaddw      %2, m7
+    pshufb      m7, %1, [tab_Tm8 + 32]
+    pmaddubsw   m7, m3
+    pshufb      %1, %1, [tab_Tm8 + 48]
+    pmaddubsw   %1, m3
+    phaddw      m7, %1
+    phaddw      %2, m7
+    pmulhrsw    %2, %3
+
+    movu        %1, [r0 + 37]
+    pshufb      %4, %1, [tab_Tm8]
+    pmaddubsw   %4, m3
+    pshufb      m7, %1, [tab_Tm8 + 16]
+    pmaddubsw   m7, m3
+    phaddw      %4, m7
+    pshufb      m7, %1, [tab_Tm8 + 32]
+    pmaddubsw   m7, m3
+    pshufb      %1, %1, [tab_Tm8 + 48]
+    pmaddubsw   %1, m3
+    phaddw      m7, %1
+    phaddw      %4, m7
+    pmulhrsw    %4, %3
+    packuswb    %2, %4
+    movu        [r2 + 32], %2
+
+    movu        %1, [r0 + 45]
+    pshufb      %2, %1, [tab_Tm8]
+    pmaddubsw   %2, m3
+    pshufb      m7, %1, [tab_Tm8 + 16]
+    pmaddubsw   m7, m3
+    phaddw      %2, m7
+    pshufb      m7, %1, [tab_Tm8 + 32]
+    pmaddubsw   m7, m3
+    pshufb      %1, %1, [tab_Tm8 + 48]
+    pmaddubsw   %1, m3
+    phaddw      m7, %1
+    phaddw      %2, m7
+    pmulhrsw    %2, %3
+
+    movu        %1, [r0 + 53]
+    pshufb      %4, %1, [tab_Tm8]
+    pmaddubsw   %4, m3
+    pshufb      m7, %1, [tab_Tm8 + 16]
+    pmaddubsw   m7, m3
+    phaddw      %4, m7
+    pshufb      m7, %1, [tab_Tm8 + 32]
+    pmaddubsw   m7, m3
+    pshufb      %1, %1, [tab_Tm8 + 48]
+    pmaddubsw   %1, m3
+    phaddw      m7, %1
+    phaddw      %4, m7
+    pmulhrsw    %4, %3
+    packuswb    %2, %4
+    movu        [r2 + 48], %2
+%endmacro
+
+;-----------------------------------------------------------------------------
+; void filterHorizontal_p_p_8(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int width, int height, short const *coeff)
+;-----------------------------------------------------------------------------
+INIT_XMM sse4
+cglobal filterHorizontal_p_p_8, 4, 5, 6
+
+    mov       r4, r6m
+    movu      m3, [r4]
+    packsswb  m3, m3
+
+    mov       r4, r5m
+
+    mova      m2, [tab_c_512]
+
+.loop
+    FILTER_H8 m0, m1, m2, m4
+          
+    add       r0, r1
+    add       r2, r3
+
+    dec       r4d
+    jnz       .loop
+
+    RET


More information about the x265-devel mailing list