[x265] [PATCH] asm: assembly code for pixel_sa8d_8x16 and pixel_sa8d_16x8

yuvaraj at multicorewareinc.com yuvaraj at multicorewareinc.com
Thu Nov 21 12:15:26 CET 2013


# HG changeset patch
# User Yuvaraj Venkatesh <yuvaraj at multicorewareinc.com>
# Date 1385032470 -19800
#      Thu Nov 21 16:44:30 2013 +0530
# Node ID c108b3e1cb1bdf0aea843e3b06549261664fe911
# Parent  184896d5cd2086e0f6a3017b1a88d5605255405c
asm: assembly code for pixel_sa8d_8x16 and pixel_sa8d_16x8

diff -r 184896d5cd20 -r c108b3e1cb1b source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Thu Nov 21 13:52:01 2013 +0530
+++ b/source/common/x86/asm-primitives.cpp	Thu Nov 21 16:44:30 2013 +0530
@@ -87,17 +87,15 @@
     p.sse_pp[LUMA_32x64] = x265_pixel_ssd_32x64_ ## cpu; \
     p.sse_pp[LUMA_16x64] = x265_pixel_ssd_16x64_ ## cpu
 
-#define SA8D_INTER_FROM_BLOCK8(cpu) \
-    p.sa8d_inter[LUMA_16x8]  = cmp<16, 8, 8, 8, x265_pixel_sa8d_8x8_ ## cpu>; \
-    p.sa8d_inter[LUMA_8x16]  = cmp<8, 16, 8, 8, x265_pixel_sa8d_8x8_ ## cpu>; \
+#define SA8D_INTER_FROM_BLOCK(cpu) \
+    p.sa8d[BLOCK_32x32] = x265_pixel_sa8d_32x32_ ## cpu; \
+    p.sa8d[BLOCK_64x64] = x265_pixel_sa8d_64x64_ ## cpu; \
+    p.sa8d_inter[LUMA_16x8]  = x265_pixel_sa8d_16x8_ ## cpu; \
+    p.sa8d_inter[LUMA_8x16]  = x265_pixel_sa8d_8x16_ ## cpu; \
     p.sa8d_inter[LUMA_32x24] = cmp<32, 24, 8, 8, x265_pixel_sa8d_8x8_ ## cpu>; \
     p.sa8d_inter[LUMA_24x32] = cmp<24, 32, 8, 8, x265_pixel_sa8d_8x8_ ## cpu>; \
     p.sa8d_inter[LUMA_32x8]  = cmp<32, 8, 8, 8, x265_pixel_sa8d_8x8_ ## cpu>; \
-    p.sa8d_inter[LUMA_8x32]  = cmp<8, 32, 8, 8, x265_pixel_sa8d_8x8_ ## cpu>
-#define SA8D_INTER_FROM_BLOCK(cpu) \
-    SA8D_INTER_FROM_BLOCK8(cpu); \
-    p.sa8d[BLOCK_32x32] = x265_pixel_sa8d_32x32_ ## cpu; \
-    p.sa8d[BLOCK_64x64] = x265_pixel_sa8d_64x64_ ## cpu; \
+    p.sa8d_inter[LUMA_8x32]  = cmp<8, 32, 8, 8, x265_pixel_sa8d_8x8_ ## cpu>; \
     p.sa8d_inter[LUMA_32x32] = x265_pixel_sa8d_32x32_ ## cpu; \
     p.sa8d_inter[LUMA_32x16] = x265_pixel_sa8d_32x16_ ## cpu; \
     p.sa8d_inter[LUMA_16x32] = x265_pixel_sa8d_16x32_ ## cpu; \
@@ -721,7 +719,12 @@
         INIT4(satd, _avx2);
         INIT2_NAME(sse_pp, ssd, _avx2);
         p.sa8d[BLOCK_8x8] = x265_pixel_sa8d_8x8_avx2;
-        SA8D_INTER_FROM_BLOCK8(avx2);
+        p.sa8d_inter[LUMA_16x8]  = cmp<16, 8, 8, 8, x265_pixel_sa8d_8x8_avx2>;
+        p.sa8d_inter[LUMA_8x16]  = cmp<8, 16, 8, 8, x265_pixel_sa8d_8x8_avx2>;
+        p.sa8d_inter[LUMA_32x24] = cmp<32, 24, 8, 8, x265_pixel_sa8d_8x8_avx2>;
+        p.sa8d_inter[LUMA_24x32] = cmp<24, 32, 8, 8, x265_pixel_sa8d_8x8_avx2>;
+        p.sa8d_inter[LUMA_32x8]  = cmp<32, 8, 8, 8, x265_pixel_sa8d_8x8_avx2>;
+        p.sa8d_inter[LUMA_8x32]  = cmp<8, 32, 8, 8, x265_pixel_sa8d_8x8_avx2>;
         p.satd[LUMA_32x32] = cmp<32, 32, 16, 16, x265_pixel_satd_16x16_avx2>;
         p.satd[LUMA_24x32] = cmp<24, 32, 8, 16, x265_pixel_satd_8x16_avx2>;
         p.satd[LUMA_64x64] = cmp<64, 64, 16, 16, x265_pixel_satd_16x16_avx2>;
diff -r 184896d5cd20 -r c108b3e1cb1b source/common/x86/pixel-a.asm
--- a/source/common/x86/pixel-a.asm	Thu Nov 21 13:52:01 2013 +0530
+++ b/source/common/x86/pixel-a.asm	Thu Nov 21 16:44:30 2013 +0530
@@ -3471,6 +3471,18 @@
 %endif ; HIGH_BIT_DEPTH
 %endmacro
 
+%macro SA8D_8x8 0
+    call pixel_sa8d_8x8_internal
+%if HIGH_BIT_DEPTH
+    HADDUW m0, m1
+%else
+    HADDW m0, m1
+%endif ; HIGH_BIT_DEPTH
+    paddd  m0, [pd_1]
+    psrld  m0, 1
+    paddd  m12, m0
+%endmacro
+
 %macro SA8D_16x16 0
     call pixel_sa8d_8x8_internal ; pix[0]
     add  r2, 8*SIZEOF_PIXEL
@@ -3583,6 +3595,36 @@
     shr  eax, 1
     RET
 
+cglobal pixel_sa8d_8x16, 4,8,12
+    FIX_STRIDES r1, r3
+    lea  r4, [3*r1]
+    lea  r5, [3*r3]
+    pxor m12, m12
+%if vertical == 0
+    mova m7, [hmul_8p]
+%endif
+    SA8D_8x8
+    lea r0, [r0 + 8*r1]
+    lea r2, [r2 + 8*r3]
+    SA8D_8x8
+    movd eax, m12
+    RET
+
+cglobal pixel_sa8d_16x8, 4,8,12
+    FIX_STRIDES r1, r3
+    lea  r4, [3*r1]
+    lea  r5, [3*r3]
+    pxor m12, m12
+%if vertical == 0
+    mova m7, [hmul_8p]
+%endif
+    SA8D_8x8
+    add r0, 8
+    add r2, 8
+    SA8D_8x8
+    movd eax, m12
+    RET
+
 cglobal pixel_sa8d_16x32, 4,8,12
     FIX_STRIDES r1, r3
     lea  r4, [3*r1]
@@ -4306,6 +4348,66 @@
     mov  esp, r6
     RET
 
+cglobal pixel_sa8d_8x16, 4,7,8
+    FIX_STRIDES r1, r3
+    mov  r6, esp
+    and  esp, ~15
+    sub  esp, 64
+
+    lea  r4, [r1 + 2*r1]
+    lea  r5, [r3 + 2*r3]
+    call pixel_sa8d_8x8_internal2
+    HADDUW m0, m1
+    movd r4d, m0
+    add  r4d, 1
+    shr  r4d, 1
+    mov dword [esp+36], r4d
+
+    mov  r0, [r6+20]
+    mov  r2, [r6+28]
+    lea  r0, [r0 + r1*8]
+    lea  r2, [r2 + r3*8]
+    lea  r4, [r1 + 2*r1]
+    call pixel_sa8d_8x8_internal2
+    HADDUW m0, m1
+    movd r4d, m0
+    add  r4d, 1
+    shr  r4d, 1
+    add r4d, dword [esp+36]
+    mov eax, r4d
+    mov esp, r6
+    RET
+
+cglobal pixel_sa8d_16x8, 4,7,8
+    FIX_STRIDES r1, r3
+    mov  r6, esp
+    and  esp, ~15
+    sub  esp, 64
+
+    lea  r4, [r1 + 2*r1]
+    lea  r5, [r3 + 2*r3]
+    call pixel_sa8d_8x8_internal2
+    HADDUW m0, m1
+    movd r4d, m0
+    add  r4d, 1
+    shr  r4d, 1
+    mov dword [esp+36], r4d
+
+    mov  r0, [r6+20]
+    mov  r2, [r6+28]
+    add  r0, 8*SIZEOF_PIXEL
+    add  r2, 8*SIZEOF_PIXEL
+    lea  r4, [r1 + 2*r1]
+    call pixel_sa8d_8x8_internal2
+    HADDUW m0, m1
+    movd r4d, m0
+    add  r4d, 1
+    shr  r4d, 1
+    add r4d, dword [esp+36]
+    mov eax, r4d
+    mov esp, r6
+    RET
+
 cglobal pixel_sa8d_16x32, 4,7,8
     FIX_STRIDES r1, r3
     mov  r6, esp


More information about the x265-devel mailing list