[x265] [PATCH Review Only] Generic Luma filter macro to generate necessary code for any width and height

nabajit at multicorewareinc.com nabajit at multicorewareinc.com
Fri Oct 11 17:43:08 CEST 2013


# HG changeset patch
# User Nabajit Deka
# Date 1381506174 -19800
#      Fri Oct 11 21:12:54 2013 +0530
# Node ID edc41b0972547e4493898ddf021248d8c204e200
# Parent  6054812606c2d45306824a30298f87410f2994e3
Generic Luma filter macro to generate necessary code for any width and height.

diff -r 6054812606c2 -r edc41b097254 source/common/x86/ipfilter8.asm
--- a/source/common/x86/ipfilter8.asm	Fri Oct 11 20:53:15 2013 +0530
+++ b/source/common/x86/ipfilter8.asm	Fri Oct 11 21:12:54 2013 +0530
@@ -1406,3 +1406,108 @@
     dec         r4d
     jnz         .loop
     RET
+
+SECTION_RODATA 32
+
+tab_Tm:    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_W8 3
+    movu        %1, [r0 - 3 + r5]
+    pshufb      %2, %1, [tab_Tm]
+    pmaddubsw   %2, m3
+    pshufb      m7, %1, [tab_Tm + 16]
+    pmaddubsw   m7, m3
+    phaddw      %2, m7
+    pshufb      m7, %1, [tab_Tm + 32]
+    pmaddubsw   m7, m3
+    pshufb      %1, %1, [tab_Tm + 48]
+    pmaddubsw   %1, m3
+    phaddw      m7, %1
+    phaddw      %2, m7
+    pmulhrsw    %2, %3
+    packuswb    %2, %2
+    movh        [r2 + r5], %2
+%endmacro
+
+%macro FILTER_H8_W4 3
+    movu        %1, [r0 - 3 + r5]
+    pshufb      %2, %1, [tab_Tm]
+    pmaddubsw   %2, m3
+    pshufb      m7, %1, [tab_Tm + 16]
+    pmaddubsw   m7, m3
+    phaddw      %2, m7
+    phaddw      %2, %2
+    pmulhrsw    %2, %3
+    packuswb    %2, %2
+    movd       [r2 + r5], %2
+%endmacro
+
+%macro FILTER_H8_W1 3
+    movu        %1, [r0 - 3 + r5]
+    pshufb      %2, %1, [tab_Tm]
+    pmaddubsw   %2, m3
+    phaddw      %2, %2
+    phaddw      %2, %2
+    pmulhrsw    %2, %3
+    packuswb    %2, %2
+    pextrb      [r2 + r5], %2, 0
+%endmacro
+
+;-----------------------------------------------------------------------------
+; void filterHorizontal_p_p_luma_%1x%2(pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int width, int height, short const *coeff)
+;-----------------------------------------------------------------------------
+%macro IPFILTER_LUMA 2
+cglobal filterHorizontal_p_p_luma_%1x%2, 4, 6, 5
+    mov       r4, r6m
+    movu      m3, [r4]
+    packsswb  m3, m3
+    mova      m2, [tab_c_512]
+    mov       r4, %2
+
+.loop
+    xor r5, r5
+%rep %1 / 8 
+    FILTER_H8_W8  m0, m1, m2
+    add           r5, 8
+%endrep
+
+%rep (%1 % 8) / 4
+    FILTER_H8_W4  m0, m1, m2
+    add           r5, 8
+%endrep
+
+ %rep(%1 % 4)
+    FILTER_H8_W1  m0, m1, m2
+ %endrep
+
+    add          r0, r1
+    add          r2, r3
+
+    dec          r4d
+    jnz         .loop
+    RET
+%endmacro
+
+IPFILTER_LUMA 12, 16
+IPFILTER_LUMA 12, 17
+IPFILTER_LUMA 13, 16
+IPFILTER_LUMA 16, 12
+IPFILTER_LUMA 16, 13
+IPFILTER_LUMA 16, 16
+IPFILTER_LUMA 16, 17
+IPFILTER_LUMA 16, 32
+IPFILTER_LUMA 16, 33
+IPFILTER_LUMA 16, 4
+IPFILTER_LUMA 16, 5
+IPFILTER_LUMA 16, 64
+IPFILTER_LUMA 16, 8
+IPFILTER_LUMA 16, 9
+IPFILTER_LUMA 64, 64
+IPFILTER_LUMA 32, 32


More information about the x265-devel mailing list