[x265] [PATCH 14 of 29] intrapred: updated asm and unit test code for intra_ang_8x8 mode 2 to 34

dnyaneshwar at multicorewareinc.com dnyaneshwar at multicorewareinc.com
Tue Jan 13 08:11:22 CET 2015


# HG changeset patch
# User Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
# Date 1421047616 -19800
#      Mon Jan 12 12:56:56 2015 +0530
# Node ID 9aa0b1574481b9ef18824f33837d9b1f0e554d8c
# Parent  558439d703fdc46fe47ce315c33fe982f8269a79
intrapred: updated asm and unit test code for intra_ang_8x8 mode 2 to 34

diff -r 558439d703fd -r 9aa0b1574481 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Wed Dec 24 11:23:30 2014 +0530
+++ b/source/common/x86/asm-primitives.cpp	Mon Jan 12 12:56:56 2015 +0530
@@ -951,6 +951,9 @@
     p.intra_pred[mode][BLOCK_16x16] = x265_intra_pred_ang16_ ## fno ## _ ## cpu; \
     p.intra_pred[mode][BLOCK_32x32] = x265_intra_pred_ang32_ ## fno ## _ ## cpu;
 
+#define SETUP_INTRA_ANG_COMMON_NEW(mode, fno, cpu) \
+    p.intra_pred_new[mode][BLOCK_8x8] = x265_intra_pred_ang8_ ## fno ## _new_ ## cpu; \
+
 #define SETUP_INTRA_ANG(mode, fno, cpu) \
     p.intra_pred[mode][BLOCK_8x8] = x265_intra_pred_ang8_ ## fno ## _ ## cpu; \
     p.intra_pred[mode][BLOCK_16x16] = x265_intra_pred_ang16_ ## fno ## _ ## cpu; \
@@ -967,10 +970,17 @@
     p.intra_pred[mode][BLOCK_4x4] = x265_intra_pred_ang4_ ## fno ## _ ## cpu; \
     p.intra_pred[mode][BLOCK_8x8] = x265_intra_pred_ang8_ ## fno ## _ ## cpu;
 
+#define SETUP_INTRA_ANG4_8_NEW(mode, fno, cpu) \
+    p.intra_pred_new[mode][BLOCK_8x8] = x265_intra_pred_ang8_ ## fno ## _new_ ## cpu;
+
 #define INTRA_ANG_SSSE3(cpu) \
     SETUP_INTRA_ANG_COMMON(2, 2, cpu); \
     SETUP_INTRA_ANG_COMMON(34, 2, cpu);
 
+#define INTRA_ANG_SSSE3_NEW(cpu) \
+    SETUP_INTRA_ANG_COMMON_NEW(2, 2, cpu); \
+    SETUP_INTRA_ANG_COMMON_NEW(34, 2, cpu);
+
 #define INTRA_ANG_SSE4_COMMON(cpu) \
     SETUP_INTRA_ANG_COMMON(3,  3,  cpu); \
     SETUP_INTRA_ANG_COMMON(4,  4,  cpu); \
@@ -989,6 +999,24 @@
     SETUP_INTRA_ANG_COMMON(17, 17, cpu); \
     SETUP_INTRA_ANG_COMMON(18, 18, cpu);
 
+#define INTRA_ANG_SSE4_COMMON_NEW(cpu) \
+    SETUP_INTRA_ANG_COMMON_NEW(3,  3,  cpu); \
+    SETUP_INTRA_ANG_COMMON_NEW(4,  4,  cpu); \
+    SETUP_INTRA_ANG_COMMON_NEW(5,  5,  cpu); \
+    SETUP_INTRA_ANG_COMMON_NEW(6,  6,  cpu); \
+    SETUP_INTRA_ANG_COMMON_NEW(7,  7,  cpu); \
+    SETUP_INTRA_ANG_COMMON_NEW(8,  8,  cpu); \
+    SETUP_INTRA_ANG_COMMON_NEW(9,  9,  cpu); \
+    SETUP_INTRA_ANG_COMMON_NEW(10, 10, cpu); \
+    SETUP_INTRA_ANG_COMMON_NEW(11, 11, cpu); \
+    SETUP_INTRA_ANG_COMMON_NEW(12, 12, cpu); \
+    SETUP_INTRA_ANG_COMMON_NEW(13, 13, cpu); \
+    SETUP_INTRA_ANG_COMMON_NEW(14, 14, cpu); \
+    SETUP_INTRA_ANG_COMMON_NEW(15, 15, cpu); \
+    SETUP_INTRA_ANG_COMMON_NEW(16, 16, cpu); \
+    SETUP_INTRA_ANG_COMMON_NEW(17, 17, cpu); \
+    SETUP_INTRA_ANG_COMMON_NEW(18, 18, cpu);
+
 #define INTRA_ANG_SSE4_HIGH(cpu) \
     SETUP_INTRA_ANG(19, 19, cpu); \
     SETUP_INTRA_ANG(20, 20, cpu); \
@@ -1053,6 +1081,23 @@
     SETUP_INTRA_ANG16_32(32, 32, cpu); \
     SETUP_INTRA_ANG16_32(33, 33, cpu);
 
+#define INTRA_ANG_SSE4_NEW(cpu) \
+    SETUP_INTRA_ANG4_8_NEW(19, 17, cpu); \
+    SETUP_INTRA_ANG4_8_NEW(20, 16, cpu); \
+    SETUP_INTRA_ANG4_8_NEW(21, 15, cpu); \
+    SETUP_INTRA_ANG4_8_NEW(22, 14, cpu); \
+    SETUP_INTRA_ANG4_8_NEW(23, 13, cpu); \
+    SETUP_INTRA_ANG4_8_NEW(24, 12, cpu); \
+    SETUP_INTRA_ANG4_8_NEW(25, 11, cpu); \
+    SETUP_INTRA_ANG4_8_NEW(26, 26, cpu); \
+    SETUP_INTRA_ANG4_8_NEW(27, 9, cpu); \
+    SETUP_INTRA_ANG4_8_NEW(28, 8, cpu); \
+    SETUP_INTRA_ANG4_8_NEW(29, 7, cpu); \
+    SETUP_INTRA_ANG4_8_NEW(30, 6, cpu); \
+    SETUP_INTRA_ANG4_8_NEW(31, 5, cpu); \
+    SETUP_INTRA_ANG4_8_NEW(32, 4, cpu); \
+    SETUP_INTRA_ANG4_8_NEW(33, 3, cpu);
+
 #define SETUP_CHROMA_VERT_FUNC_DEF(W, H, cpu) \
     p.chroma[X265_CSP_I420].pu[CHROMA_ ## W ## x ## H].filter_vss = x265_interp_4tap_vert_ss_ ## W ## x ## H ## cpu; \
     p.chroma[X265_CSP_I420].pu[CHROMA_ ## W ## x ## H].filter_vpp = x265_interp_4tap_vert_pp_ ## W ## x ## H ## cpu; \
@@ -1603,6 +1648,7 @@
         PIXEL_AVG_W4(ssse3);
 
         INTRA_ANG_SSSE3(ssse3);
+        INTRA_ANG_SSSE3_NEW(ssse3);
 
         p.scale1D_128to64 = x265_scale1D_128to64_ssse3;
         p.scale2D_64to32 = x265_scale2D_64to32_ssse3;
@@ -1711,6 +1757,9 @@
         INTRA_ANG_SSE4_COMMON(sse4);
         INTRA_ANG_SSE4(sse4);
 
+        INTRA_ANG_SSE4_COMMON_NEW(sse4);
+        INTRA_ANG_SSE4_NEW(sse4);
+
         p.cu[BLOCK_8x8].dct = x265_dct8_sse4;
         p.denoiseDct = x265_denoise_dct_sse4;
         p.cu[BLOCK_4x4].psy_cost_pp = x265_psyCost_pp_4x4_sse4;
diff -r 558439d703fd -r 9aa0b1574481 source/common/x86/intrapred.h
--- a/source/common/x86/intrapred.h	Wed Dec 24 11:23:30 2014 +0530
+++ b/source/common/x86/intrapred.h	Mon Jan 12 12:56:56 2015 +0530
@@ -37,7 +37,8 @@
 void x265_intra_pred_planar32_new_sse4(pixel* dst, intptr_t dstStride, pixel* above, int, int);
 
 #define DECL_ANG(bsize, mode, cpu) \
-    void x265_intra_pred_ang ## bsize ## _ ## mode ## _ ## cpu(pixel * dst, intptr_t dstStride, pixel * refLeft, pixel * refAbove, int dirMode, int bFilter);
+    void x265_intra_pred_ang ## bsize ## _ ## mode ## _ ## cpu(pixel * dst, intptr_t dstStride, pixel * refLeft, pixel * refAbove, int dirMode, int bFilter); \
+    void x265_intra_pred_ang ## bsize ## _ ## mode ## _new_ ## cpu(pixel* dst, intptr_t dstStride, pixel* above, int dirMode, int bFilter);
 
 DECL_ANG(4, 2, ssse3);
 DECL_ANG(4, 3, sse4);
diff -r 558439d703fd -r 9aa0b1574481 source/common/x86/intrapred8.asm
--- a/source/common/x86/intrapred8.asm	Wed Dec 24 11:23:30 2014 +0530
+++ b/source/common/x86/intrapred8.asm	Mon Jan 12 12:56:56 2015 +0530
@@ -1149,6 +1149,33 @@
     movh        [r0 + r4],      m1
     RET
 
+INIT_XMM ssse3
+cglobal intra_pred_ang8_2_new, 3,5,2
+    lea         r4,             [r2 + 2]
+    add         r2,             18
+    cmp         r3m,            byte 34
+    cmove       r2,             r4
+    movu        m0,             [r2]
+    lea         r4,             [r1 * 3]
+
+    movh        [r0],           m0
+    palignr     m1,             m0, 1
+    movh        [r0 + r1],      m1
+    palignr     m1,             m0, 2
+    movh        [r0 + r1 * 2],  m1
+    palignr     m1,             m0, 3
+    movh        [r0 + r4],      m1
+    palignr     m1,             m0, 4
+    lea         r0,             [r0 + r1 * 4]
+    movh        [r0],           m1
+    palignr     m1,             m0, 5
+    movh        [r0 + r1],      m1
+    palignr     m1,             m0, 6
+    movh        [r0 + r1 * 2],  m1
+    palignr     m1,             m0, 7
+    movh        [r0 + r4],      m1
+    RET
+
 INIT_XMM sse4
 cglobal intra_pred_ang8_3, 3,5,8
     cmp         r4m,       byte 33
@@ -1236,6 +1263,94 @@
     movhps      [r0 + r1 * 4],   m1
     RET
 
+cglobal intra_pred_ang8_3_new, 3,5,8
+    lea         r4,        [r2 + 1]
+    add         r2,        17
+    cmp         r3m,       byte 33
+    cmove       r2,        r4
+    lea         r3,        [ang_table + 22 * 16]
+    lea         r4,        [ang_table +  8 * 16]
+    mova        m3,        [pw_1024]
+
+    movu        m0,        [r2]                       ; [16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1]
+    palignr     m1,        m0, 1                      ; [x 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2]
+
+    punpckhbw   m2,        m0, m1                     ; [x 16 16 15 15 14 14 13 13 12 12 11 11 10 10 9]
+    punpcklbw   m0,        m1                         ; [9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1]
+    palignr     m1,        m2, m0, 2                  ; [10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2]
+
+    pmaddubsw   m4,        m0, [r3 + 4 * 16]          ; [26]
+    pmulhrsw    m4,        m3
+    pmaddubsw   m1,        [r3 - 2 * 16]              ; [20]
+    pmulhrsw    m1,        m3
+    packuswb    m4,        m1
+
+    palignr     m5,        m2, m0, 4                  ; [11 10 10 9 9 8 8 7 7 6 6 5 5 4 4 3]
+
+    pmaddubsw   m5,        [r3 - 8 * 16]              ; [14]
+    pmulhrsw    m5,        m3
+
+    palignr     m6,        m2, m0, 6                  ; [12 11 11 10 10 9 9 8 8 7 7 6 6 5 5 4]
+
+    pmaddubsw   m6,        [r4]                       ; [ 8]
+    pmulhrsw    m6,        m3
+    packuswb    m5,        m6
+
+    palignr     m1,        m2, m0, 8                  ; [13 12 12 11 11 10 10 9 9 8 8 7 7 6 6 5]
+
+    pmaddubsw   m6,        m1, [r4 - 6 * 16]          ; [ 2]
+    pmulhrsw    m6,        m3
+
+    pmaddubsw   m1,        [r3 + 6 * 16]              ; [28]
+    pmulhrsw    m1,        m3
+    packuswb    m6,        m1
+
+    palignr     m1,        m2, m0, 10                 ; [14 13 13 12 12 11 11 10 10 9 9 8 8 7 7 6]
+
+    pmaddubsw   m1,        [r3]                       ; [22]
+    pmulhrsw    m1,        m3
+
+    palignr     m2,        m0, 12                     ; [15 14 14 13 13 12 12 11 11 10 10 9 9 8 8 7]
+
+    pmaddubsw   m2,        [r3 - 6 * 16]              ; [16]
+    pmulhrsw    m2,        m3
+    packuswb    m1,        m2
+    jmp         .transpose8x8
+
+ALIGN 16
+.transpose8x8:
+    jz         .store
+
+    ; transpose 8x8
+    punpckhbw   m0,        m4, m5
+    punpcklbw   m4,        m5
+    punpckhbw   m2,        m4, m0
+    punpcklbw   m4,        m0
+
+    punpckhbw   m0,        m6, m1
+    punpcklbw   m6,        m1
+    punpckhbw   m1,        m6, m0
+    punpcklbw   m6,        m0
+
+    punpckhdq   m5,        m4, m6
+    punpckldq   m4,        m6
+    punpckldq   m6,        m2, m1
+    punpckhdq   m2,        m1
+    mova        m1,        m2
+
+.store:
+    lea         r4,              [r1 * 3]
+    movh        [r0],            m4
+    movhps      [r0 + r1],       m4
+    movh        [r0 + r1 * 2],   m5
+    movhps      [r0 + r4],       m5
+    add         r0,              r4
+    movh        [r0 + r1],       m6
+    movhps      [r0 + r1 * 2],   m6
+    movh        [r0 + r4],       m1
+    movhps      [r0 + r1 * 4],   m1
+    RET
+
 cglobal intra_pred_ang8_4, 3,5,8
     cmp         r4m,       byte 32
     cmove       r2,        r3mp
@@ -1287,6 +1402,59 @@
     packuswb    m1,        m2
     jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3 %+ SUFFIX %+ .transpose8x8)
 
+cglobal intra_pred_ang8_4_new, 3,5,8
+    lea         r4,        [r2 + 1]
+    add         r2,        17
+    cmp         r3m,       byte 32
+    cmove       r2,        r4
+    lea         r3,        [ang_table + 24 * 16]
+    lea         r4,        [ang_table + 10 * 16]
+    mova        m3,        [pw_1024]
+
+    movu        m0,        [r2]                       ; [16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1]
+    palignr     m1,        m0, 1                      ; [x 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2]
+
+    punpckhbw   m2,        m0, m1                     ; [x 16 16 15 15 14 14 13 13 12 12 11 11 10 10 9]
+    punpcklbw   m0,        m1                         ; [9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1]
+    palignr     m1,        m2, m0, 2                  ; [10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2]
+    mova        m5,        m1
+
+    pmaddubsw   m4,        m0, [r3 - 3 * 16]          ; [21]
+    pmulhrsw    m4,        m3
+    pmaddubsw   m1,        [r4]                       ; [10]
+    pmulhrsw    m1,        m3
+    packuswb    m4,        m1
+
+    pmaddubsw   m5,        [r3 + 7 * 16]              ; [31]
+    pmulhrsw    m5,        m3
+
+    palignr     m6,        m2, m0, 4                  ; [11 10 10 9 9 8 8 7 7 6 6 5 5 4 4 3]
+
+    pmaddubsw   m6,        [r3 - 4 * 16]              ; [ 20]
+    pmulhrsw    m6,        m3
+    packuswb    m5,        m6
+
+    palignr     m1,        m2, m0, 6                  ; [12 11 11 10 10 9 9 8 8 7 7 6 6 5 5 4]
+
+    pmaddubsw   m6,        m1, [r4 - 1 * 16]          ; [ 9]
+    pmulhrsw    m6,        m3
+
+    pmaddubsw   m1,        [r3 + 6 * 16]              ; [30]
+    pmulhrsw    m1,        m3
+    packuswb    m6,        m1
+
+    palignr     m1,        m2, m0, 8                  ; [13 12 12 11 11 10 10 9 9 8 8 7 7 6 6 5]
+
+    pmaddubsw   m1,        [r3 - 5 * 16]              ; [19]
+    pmulhrsw    m1,        m3
+
+    palignr     m2,        m0, 10                     ; [14 13 13 12 12 11 11 10 10 9 9 8 8 7 7 8]
+
+    pmaddubsw   m2,        [r4 - 2 * 16]              ; [8]
+    pmulhrsw    m2,        m3
+    packuswb    m1,        m2
+    jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3_new %+ SUFFIX %+ .transpose8x8)
+
 cglobal intra_pred_ang8_5, 3,5,8
     cmp         r4m,       byte 31
     cmove       r2,        r3mp
@@ -1338,6 +1506,59 @@
     packuswb    m1,        m2
     jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3 %+ SUFFIX %+ .transpose8x8)
 
+cglobal intra_pred_ang8_5_new, 3,5,8
+    lea         r4,        [r2 + 1]
+    add         r2,        17
+    cmp         r3m,       byte 31
+    cmove       r2,        r4
+    lea         r3,        [ang_table + 17 * 16]
+    lea         r4,        [ang_table +  2 * 16]
+    mova        m3,        [pw_1024]
+
+    movu        m0,        [r2]                       ; [16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1]
+    palignr     m1,        m0, 1                      ; [x 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2]
+
+    punpckhbw   m2,        m0, m1                     ; [x 16 16 15 15 14 14 13 13 12 12 11 11 10 10 9]
+    punpcklbw   m0,        m1                         ; [9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1]
+    palignr     m1,        m2, m0, 2                  ; [10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2]
+    mova        m5,        m1
+
+    pmaddubsw   m4,        m0, [r3]                   ; [17]
+    pmulhrsw    m4,        m3
+    pmaddubsw   m1,        [r4]                       ; [2]
+    pmulhrsw    m1,        m3
+    packuswb    m4,        m1
+
+    pmaddubsw   m5,        [r3 + 2 * 16]              ; [19]
+    pmulhrsw    m5,        m3
+
+    palignr     m6,        m2, m0, 4                  ; [11 10 10 9 9 8 8 7 7 6 6 5 5 4 4 3]
+    mova        m1,        m6
+
+    pmaddubsw   m1,        [r4 + 2 * 16]              ; [4]
+    pmulhrsw    m1,        m3
+    packuswb    m5,        m1
+
+    pmaddubsw   m6,        [r3 + 4 * 16]              ; [21]
+    pmulhrsw    m6,        m3
+
+    palignr     m1,        m2, m0, 6                  ; [12 11 11 10 10 9 9 8 8 7 7 6 6 5 5 4]
+
+    mova        m7,        m1
+    pmaddubsw   m7,        [r4 + 4 * 16]              ; [6]
+    pmulhrsw    m7,        m3
+    packuswb    m6,        m7
+
+    pmaddubsw   m1,        [r3 + 6 * 16]              ; [23]
+    pmulhrsw    m1,        m3
+
+    palignr     m2,        m0, 8                      ; [13 12 12 11 11 10 10 9 9 8 8 7 7 8 8 9]
+
+    pmaddubsw   m2,        [r4 + 6 * 16]              ; [8]
+    pmulhrsw    m2,        m3
+    packuswb    m1,        m2
+    jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3_new %+ SUFFIX %+ .transpose8x8)
+
 cglobal intra_pred_ang8_6, 3,5,8
     cmp         r4m,       byte 30
     cmove       r2,        r3mp
@@ -1387,6 +1608,57 @@
     packuswb    m1,        m2
     jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3 %+ SUFFIX %+ .transpose8x8)
 
+cglobal intra_pred_ang8_6_new, 3,5,8
+    lea         r4,        [r2 + 1]
+    add         r2,        17
+    cmp         r3m,       byte 30
+    cmove       r2,        r4
+    lea         r3,        [ang_table + 20 * 16]
+    lea         r4,        [ang_table +  8 * 16]
+    mova        m7,        [pw_1024]
+
+    movu        m0,        [r2]                       ; [16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1]
+    palignr     m1,        m0, 1                      ; [x 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2]
+
+    punpckhbw   m2,        m0, m1                     ; [x 16 16 15 15 14 14 13 13 12 12 11 11 10 10 9]
+    punpcklbw   m0,        m1                         ; [9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1]
+    mova        m1,        m0
+
+    pmaddubsw   m4,        m0, [r3 - 7 * 16]          ; [13]
+    pmulhrsw    m4,        m7
+    pmaddubsw   m1,        [r3 + 6 * 16]              ; [26]
+    pmulhrsw    m1,        m7
+    packuswb    m4,        m1
+
+    palignr     m6,        m2, m0, 2                  ; [10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2]
+
+    pmaddubsw   m5,        m6, [r4 - 1 * 16]          ; [7]
+    pmulhrsw    m5,        m7
+
+    pmaddubsw   m6,        [r3]                       ; [20]
+    pmulhrsw    m6,        m7
+    packuswb    m5,        m6
+
+    palignr     m1,        m2, m0, 4                  ; [11 10 10 9 9 8 8 7 7 6 6 5 5 4 4 3]
+
+    pmaddubsw   m6,        m1, [r4 - 7 * 16]          ; [1]
+    pmulhrsw    m6,        m7
+
+    mova        m3,        m1
+    pmaddubsw   m3,        [r3 - 6 * 16]              ; [14]
+    pmulhrsw    m3,        m7
+    packuswb    m6,        m3
+
+    pmaddubsw   m1,        [r3 + 7 * 16]              ; [27]
+    pmulhrsw    m1,        m7
+
+    palignr     m2,        m0, 6                      ; [12 11 11 10 10 9 9 8 8 7 7 6 6 5 5 4]
+
+    pmaddubsw   m2,        [r4]                       ; [8]
+    pmulhrsw    m2,        m7
+    packuswb    m1,        m2
+    jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3_new %+ SUFFIX %+ .transpose8x8)
+
 cglobal intra_pred_ang8_7, 3,5,8
     cmp         r4m,       byte 29
     cmove       r2,        r3mp
@@ -1433,6 +1705,54 @@
     packuswb    m1,        m2
     jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3 %+ SUFFIX %+ .transpose8x8)
 
+cglobal intra_pred_ang8_7_new, 3,5,8
+    lea         r4,        [r2 + 1]
+    add         r2,        17
+    cmp         r3m,       byte 29
+    cmove       r2,        r4
+    lea         r3,        [ang_table + 24 * 16]
+    lea         r4,        [ang_table +  6 * 16]
+    mova        m7,        [pw_1024]
+
+    movu        m0,        [r2]                       ; [16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1]
+    palignr     m1,        m0, 1                      ; [x 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2]
+
+    punpckhbw   m2,        m0, m1                     ; [x 16 16 15 15 14 14 13 13 12 12 11 11 10 10 9]
+    punpcklbw   m0,        m1                         ; [9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1]
+
+    pmaddubsw   m4,        m0, [r4 + 3 * 16]          ; [9]
+    pmulhrsw    m4,        m7
+    pmaddubsw   m3,        m0, [r3 - 6 * 16]          ; [18]
+    pmulhrsw    m3,        m7
+    packuswb    m4,        m3
+
+    pmaddubsw   m5,        m0, [r3 + 3 * 16]          ; [27]
+    pmulhrsw    m5,        m7
+
+    palignr     m1,        m2, m0, 2                  ; [10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2]
+
+    pmaddubsw   m6,        m1, [r4 - 2 * 16]          ; [4]
+    pmulhrsw    m6,        m7
+    packuswb    m5,        m6
+
+    pmaddubsw   m6,        m1, [r4 + 7 * 16]          ; [13]
+    pmulhrsw    m6,        m7
+
+    mova        m3,        m1
+    pmaddubsw   m3,        [r3 - 2 * 16]              ; [22]
+    pmulhrsw    m3,        m7
+    packuswb    m6,        m3
+
+    pmaddubsw   m1,        [r3 + 7 * 16]              ; [31]
+    pmulhrsw    m1,        m7
+
+    palignr     m2,        m0, 4                      ; [11 10 10 9 9 8 8 7 7 6 6 5 5 4 4 3]
+
+    pmaddubsw   m2,        [r4 + 2 * 16]              ; [8]
+    pmulhrsw    m2,        m7
+    packuswb    m1,        m2
+    jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3_new %+ SUFFIX %+ .transpose8x8)
+
 cglobal intra_pred_ang8_8, 3,5,8
     cmp         r4m,       byte 28
     cmove       r2,        r3mp
@@ -1475,6 +1795,50 @@
     packuswb    m1,        m2
     jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3 %+ SUFFIX %+ .transpose8x8)
 
+cglobal intra_pred_ang8_8_new, 3,5,8
+    lea         r4,        [r2 + 1]
+    add         r2,        17
+    cmp         r3m,       byte 28
+    cmove       r2,        r4
+    lea         r3,        [ang_table + 23 * 16]
+    lea         r4,        [ang_table +  8 * 16]
+    mova        m7,        [pw_1024]
+
+    movu        m0,        [r2]                       ; [16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1]
+    palignr     m1,        m0, 1                      ; [x 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2]
+
+    punpckhbw   m2,        m0, m1                     ; [x 16 16 15 15 14 14 13 13 12 12 11 11 10 10 9]
+    punpcklbw   m0,        m1                         ; [9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1]
+    palignr     m2,        m0, 2                      ; [10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2]
+
+    pmaddubsw   m4,        m0, [r4 - 3 * 16]          ; [5]
+    pmulhrsw    m4,        m7
+    pmaddubsw   m3,        m0, [r4 + 2 * 16]          ; [10]
+    pmulhrsw    m3,        m7
+    packuswb    m4,        m3
+
+    pmaddubsw   m5,        m0, [r3 - 8 * 16]          ; [15]
+    pmulhrsw    m5,        m7
+
+    pmaddubsw   m6,        m0, [r3 - 3 * 16]          ; [20]
+    pmulhrsw    m6,        m7
+    packuswb    m5,        m6
+
+    pmaddubsw   m6,        m0, [r3 + 2 * 16]          ; [25]
+    pmulhrsw    m6,        m7
+
+    pmaddubsw   m0,        [r3 + 7 * 16]              ; [30]
+    pmulhrsw    m0,        m7
+    packuswb    m6,        m0
+
+    pmaddubsw   m1,        m2, [r4 - 5 * 16]          ; [3]
+    pmulhrsw    m1,        m7
+
+    pmaddubsw   m2,        [r4]                       ; [8]
+    pmulhrsw    m2,        m7
+    packuswb    m1,        m2
+    jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3_new %+ SUFFIX %+ .transpose8x8)
+
 cglobal intra_pred_ang8_9, 3,5,8
     cmp         r4m,       byte 27
     cmove       r2,        r3mp
@@ -1514,6 +1878,47 @@
     packuswb    m1,        m0
     jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3 %+ SUFFIX %+ .transpose8x8)
 
+cglobal intra_pred_ang8_9_new, 3,5,8
+    lea         r4,        [r2 + 1]
+    add         r2,        17
+    cmp         r3m,       byte 27
+    cmove       r2,        r4
+    lea         r3,        [ang_table + 10 * 16]
+    mova        m7,        [pw_1024]
+
+    movu        m0,        [r2]                       ; [16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1]
+    palignr     m1,        m0, 1                      ; [x 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2]
+
+    punpcklbw   m0,        m1                         ; [9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1]
+
+    pmaddubsw   m4,        m0, [r3 - 8 * 16]          ; [2]
+    pmulhrsw    m4,        m7
+    pmaddubsw   m3,        m0, [r3 - 6 * 16]          ; [4]
+    pmulhrsw    m3,        m7
+    packuswb    m4,        m3
+
+    pmaddubsw   m5,        m0, [r3 - 4 * 16]          ; [6]
+    pmulhrsw    m5,        m7
+
+    pmaddubsw   m6,        m0, [r3 - 2 * 16]          ; [8]
+    pmulhrsw    m6,        m7
+    packuswb    m5,        m6
+
+    pmaddubsw   m6,        m0, [r3]                   ; [10]
+    pmulhrsw    m6,        m7
+
+    pmaddubsw   m2,        m0, [r3 + 2 * 16]          ; [12]
+    pmulhrsw    m2,        m7
+    packuswb    m6,        m2
+
+    pmaddubsw   m1,        m0, [r3 + 4 * 16]          ; [14]
+    pmulhrsw    m1,        m7
+
+    pmaddubsw   m0,        [r3 + 6 * 16]              ; [16]
+    pmulhrsw    m0,        m7
+    packuswb    m1,        m0
+    jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3_new %+ SUFFIX %+ .transpose8x8)
+
 cglobal intra_pred_ang8_10, 4,5,5
     movh        m0,        [r2 + 1]
     mova        m4,        [pb_unpackbq]
@@ -1554,6 +1959,46 @@
     movh        [r0],      m0
     RET
 
+cglobal intra_pred_ang8_10_new, 3,5,5
+    movh        m0,        [r2 + 17]
+    mova        m4,        [pb_unpackbq]
+    palignr     m1,        m0, 2
+    pshufb      m1,        m4
+    palignr     m2,        m0, 4
+    pshufb      m2,        m4
+    palignr     m3,        m0, 6
+    pshufb      m3,        m4
+    pshufb      m0,        m4
+
+    lea         r5,             [r1 * 3]
+    movhps      [r0 + r1],      m0
+    movh        [r0 + r1 * 2],  m1
+    movhps      [r0 + r5],      m1
+    lea         r3,             [r0 + r1 * 4]
+    movh        [r3],           m2
+    movhps      [r3 + r1],      m2
+    movh        [r3 + r1 * 2],  m3
+    movhps      [r3 + r5],      m3
+
+; filter
+    cmp         r4m, byte 0
+    jz         .quit
+
+    pmovzxbw    m0,        m0
+    movu        m1,        [r2]
+    palignr     m2,        m1, 1
+    pshufb      m1,        m4
+    pmovzxbw    m1,        m1
+    pmovzxbw    m2,        m2
+    psubw       m2,        m1
+    psraw       m2,        1
+    paddw       m0,        m2
+    packuswb    m0,        m0
+
+.quit:
+    movh        [r0],      m0
+    RET
+
 cglobal intra_pred_ang8_26, 4,5,3
     movh        m0,        [r3 + 1]
 
@@ -1595,6 +2040,45 @@
 .quit:
     RET
 
+cglobal intra_pred_ang8_26_new, 3,6,3
+    movu        m2,             [r2]
+    palignr     m0,             m2, 1
+    lea         r5,             [r1 * 3]
+    movh        [r0],           m0
+    movh        [r0 + r1],      m0
+    movh        [r0 + r1 * 2],  m0
+    movh        [r0 + r5],      m0
+    lea         r3,             [r0 + r1 * 4]
+    movh        [r3],           m0
+    movh        [r3 + r1],      m0
+    movh        [r3 + r1 * 2],  m0
+    movh        [r3 + r5],      m0
+
+; filter
+    cmp         r4m, byte 0
+    jz         .quit
+
+    pshufb      m2,        [pb_unpackbq]
+    movhlps     m1,        m2
+    pmovzxbw    m2,        m2
+    movu        m0,        [r2 + 17]
+    pmovzxbw    m1,        m1
+    pmovzxbw    m0,        m0
+    psubw       m0,        m2
+    psraw       m0,        1
+    paddw       m1,        m0
+    packuswb    m1,        m1
+    pextrb      [r0],          m1, 0
+    pextrb      [r0 + r1],     m1, 1
+    pextrb      [r0 + r1 * 2], m1, 2
+    pextrb      [r0 + r5],     m1, 3
+    pextrb      [r3],          m1, 4
+    pextrb      [r3 + r1],     m1, 5
+    pextrb      [r3 + r1 * 2], m1, 6
+    pextrb      [r3 + r5],     m1, 7
+.quit:
+    RET
+
 cglobal intra_pred_ang8_11, 3,5,8
     cmp         r4m,       byte 25
     cmove       r2,        r3mp
@@ -1634,6 +2118,48 @@
     packuswb    m1,        m0
     jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3 %+ SUFFIX %+ .transpose8x8)
 
+cglobal intra_pred_ang8_11_new, 3,6,8
+    mov         r4,        16
+    mov         r5,        0
+    cmp         r3m,       byte 25
+    cmove       r4,        r5
+    lea         r3,        [ang_table + 23 * 16]
+    mova        m7,        [pw_1024]
+
+    movu        m0,        [r2 + r4]                  ; [15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0]
+    pinsrb      m0,        [r2], 0
+    palignr     m1,        m0, 1                      ; [x 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1]
+
+    punpcklbw   m0,        m1                         ; [8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 0]
+
+    pmaddubsw   m4,        m0, [r3 + 7 * 16]          ; [30]
+    pmulhrsw    m4,        m7
+    pmaddubsw   m3,        m0, [r3 + 5 * 16]          ; [28]
+    pmulhrsw    m3,        m7
+    packuswb    m4,        m3
+
+    pmaddubsw   m5,        m0, [r3 + 3 * 16]          ; [26]
+    pmulhrsw    m5,        m7
+
+    pmaddubsw   m6,        m0, [r3 + 1 * 16]          ; [24]
+    pmulhrsw    m6,        m7
+    packuswb    m5,        m6
+
+    pmaddubsw   m6,        m0, [r3 - 1 * 16]          ; [22]
+    pmulhrsw    m6,        m7
+
+    pmaddubsw   m2,        m0, [r3 - 3 * 16]          ; [20]
+    pmulhrsw    m2,        m7
+    packuswb    m6,        m2
+
+    pmaddubsw   m1,        m0, [r3 - 5 * 16]          ; [18]
+    pmulhrsw    m1,        m7
+
+    pmaddubsw   m0,        [r3 - 7 * 16]              ; [16]
+    pmulhrsw    m0,        m7
+    packuswb    m1,        m0
+    jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3_new %+ SUFFIX %+ .transpose8x8)
+
 cglobal intra_pred_ang8_12, 4,5,8
     cmp         r4m,       byte 24
     mov         r4,        r2
@@ -1679,6 +2205,55 @@
     packuswb    m6,        m2
     jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3 %+ SUFFIX %+ .transpose8x8)
 
+cglobal intra_pred_ang8_12_new, 4,6,8
+    mov         r4,        16
+    mov         r5,        0
+    cmp         r3m,       byte 24
+    mov         r3,        16
+    cmove       r4,        r5
+    cmove       r5,        r3
+
+    movu        m1,        [r2 + r4]                  ; [15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0]
+    pinsrb      m1,        [r2], 0
+    pslldq      m0,        m1, 1                      ; [14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 a]
+    pinsrb      m0,        [r2 + r5 + 6], 0
+
+    lea         r4,        [ang_table + 22 * 16]
+    mova        m7,        [pw_1024]
+
+    punpckhbw   m2,        m0, m1                     ; [15 14 14 13 13 12 12 11 11 10 10 9 9 8 8 7]
+    punpcklbw   m0,        m1                         ; [7 6 6 5 5 4 4 3 3 2 2 1 1 0 0 a]
+    palignr     m2,        m0, 2                      ; [8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 0]
+
+    pmaddubsw   m4,        m2, [r4 + 5 * 16]          ; [27]
+    pmulhrsw    m4,        m7
+    pmaddubsw   m3,        m2, [r4]                   ; [22]
+    pmulhrsw    m3,        m7
+    packuswb    m4,        m3
+
+    pmaddubsw   m1,        m0, [r4 + 7 * 16]          ; [29]
+    pmulhrsw    m1,        m7
+
+    pmaddubsw   m0,        [r4 + 2 * 16]              ; [24]
+    pmulhrsw    m0,        m7
+    packuswb    m1,        m0
+
+    pmaddubsw   m5,        m2, [r4 - 5 * 16]          ; [17]
+    pmulhrsw    m5,        m7
+
+    lea         r4,        [ang_table + 7 * 16]
+    pmaddubsw   m6,        m2, [r4 + 5 * 16]          ; [12]
+    pmulhrsw    m6,        m7
+    packuswb    m5,        m6
+
+    pmaddubsw   m6,        m2, [r4]                   ; [7]
+    pmulhrsw    m6,        m7
+
+    pmaddubsw   m2,        [r4 - 5 * 16]              ; [2]
+    pmulhrsw    m2,        m7
+    packuswb    m6,        m2
+    jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3_new %+ SUFFIX %+ .transpose8x8)
+
 cglobal intra_pred_ang8_13, 4,5,8
     cmp         r4m,       byte 23
     mov         r4,        r2
@@ -1728,6 +2303,58 @@
     packuswb    m1,        m0
     jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3 %+ SUFFIX %+ .transpose8x8)
 
+cglobal intra_pred_ang8_13_new, 4,6,8
+    mov         r4,        16
+    mov         r5,        0
+    cmp         r3m,       byte 23
+    mov         r3,        16
+    cmove       r4,        r5
+    cmove       r5,        r3
+
+    movu        m1,        [r2 +  r4]                 ; [15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0]
+    pinsrb      m1,        [r2], 0
+    pslldq      m1,        1                          ; [14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 a]
+    pinsrb      m1,        [r2 + r5 + 4], 0
+    pslldq      m0,        m1, 1                      ; [13 12 11 10 9 8 7 6 5 4 3 2 1 0 a b]
+    pinsrb      m0,        [r2 + r5 + 7], 0
+    punpckhbw   m5,        m0, m1                     ; [14 13 13 12 12 11 11 10 10 9 9 8 8 7 7 6]
+    punpcklbw   m0,        m1                         ; [6 5 5 4 4 3 3 2 2 1 1 0 0 a a b]
+    palignr     m1,        m5, m0, 2                  ; [7 6 6 5 5 4 4 3 3 2 2 1 1 0 0 a]
+    palignr     m5,        m0, 4                      ; [8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 0]
+
+    lea         r4,        [ang_table + 24 * 16]
+    mova        m7,        [pw_1024]
+
+    pmaddubsw   m4,        m5, [r4 - 1 * 16]          ; [23]
+    pmulhrsw    m4,        m7
+
+    pmaddubsw   m6,        m1, [r4 + 4 * 16]          ; [28]
+    pmulhrsw    m6,        m7
+
+    pmaddubsw   m0,        [r4]                       ; [24]
+    pmulhrsw    m0,        m7
+
+    lea         r4,        [ang_table + 13 * 16]
+    pmaddubsw   m3,        m5, [r4 + 1 * 16]          ; [14]
+    pmulhrsw    m3,        m7
+    packuswb    m4,        m3
+
+    pmaddubsw   m5,        [r4 - 8 * 16]              ; [5]
+    pmulhrsw    m5,        m7
+    packuswb    m5,        m6
+
+    pmaddubsw   m6,        m1, [r4 + 6 * 16]          ; [19]
+    pmulhrsw    m6,        m7
+
+    pmaddubsw   m2,        m1, [r4 - 3 * 16]          ; [10]
+    pmulhrsw    m2,        m7
+    packuswb    m6,        m2
+
+    pmaddubsw   m1,        [r4 - 12 * 16]             ; [1]
+    pmulhrsw    m1,        m7
+    packuswb    m1,        m0
+    jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3_new %+ SUFFIX %+ .transpose8x8)
+
 cglobal intra_pred_ang8_14, 4,5,8
     cmp         r4m,       byte 22
     mov         r4,        r2
@@ -1778,6 +2405,59 @@
     packuswb    m1,        m0
     jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3 %+ SUFFIX %+ .transpose8x8)
 
+cglobal intra_pred_ang8_14_new, 4,6,8
+    mov         r4,        16
+    mov         r5,        0
+    cmp         r3m,       byte 22
+    mov         r3,        16
+    cmove       r4,        r5
+    cmove       r5,        r3
+
+    movu        m1,        [r2 + r4 - 2]              ; [13 12 11 10 9 8 7 6 5 4 3 2 1 0 a b]
+    pinsrb      m1,        [r2], 2
+    pinsrb      m1,        [r2 + r5 + 2], 1
+    pinsrb      m1,        [r2 + r5 + 5], 0
+    pslldq      m0,        m1, 1                      ; [12 11 10 9 8 7 6 5 4 3 2 1 0 a b c]
+    pinsrb      m0,        [r2 + r5 + 7], 0
+    punpckhbw   m2,        m0, m1                     ; [13 12 12 11 11 10 10 9 9 8 8 7 7 6 6 5]
+    punpcklbw   m0,        m1                         ; [5 4 4 3 3 2 2 1 1 0 0 a a b b c]
+    palignr     m1,        m2, m0, 2                  ; [6 5 5 4 4 3 3 2 2 1 1 0 0 a a b]
+    palignr     m6,        m2, m0, 4                  ; [7 6 6 5 5 4 4 3 3 2 2 1 1 0 0 a]
+    palignr     m2,        m0, 6                      ; [8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 0]
+
+    lea         r4,        [ang_table + 24 * 16]
+    mova        m3,        [pw_1024]
+
+    pmaddubsw   m4,        m2, [r4 - 5 * 16]          ; [19]
+    pmulhrsw    m4,        m3
+
+    pmaddubsw   m0,        [r4]                       ; [24]
+    pmulhrsw    m0,        m3
+
+    pmaddubsw   m5,        m6, [r4 + 1 * 16]          ; [25]
+    pmulhrsw    m5,        m3
+
+    lea         r4,        [ang_table + 12 * 16]
+    pmaddubsw   m6,        [r4]                       ; [12]
+    pmulhrsw    m6,        m3
+    packuswb    m5,        m6
+
+    pmaddubsw   m6,        m1, [r4 + 19 * 16]         ; [31]
+    pmulhrsw    m6,        m3
+
+    pmaddubsw   m2,        [r4 - 6 * 16]              ; [6]
+    pmulhrsw    m2,        m3
+    packuswb    m4,        m2
+
+    pmaddubsw   m2,        m1, [r4 + 6 * 16]          ; [18]
+    pmulhrsw    m2,        m3
+    packuswb    m6,        m2
+
+    pmaddubsw   m1,        [r4 - 7 * 16]              ; [5]
+    pmulhrsw    m1,        m3
+    packuswb    m1,        m0
+    jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3_new %+ SUFFIX %+ .transpose8x8)
+
 cglobal intra_pred_ang8_15, 4,5,8
     cmp         r4m,       byte 21
     mov         r4,        r2
@@ -1830,6 +2510,61 @@
     packuswb    m1,        m0
     jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3 %+ SUFFIX %+ .transpose8x8)
 
+cglobal intra_pred_ang8_15_new, 4,6,8
+    mov         r4,        16
+    mov         r5,        0
+    cmp         r3m,       byte 21
+    mov         r3,        16
+    cmove       r4,        r5
+    cmove       r5,        r3
+
+    movu        m1,        [r2 + r4]                  ; [15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0]
+    pinsrb      m1,        [r2], 0
+    movu        m2,        [r2 + r5]
+    pshufb      m2,        [c_mode16_15]
+    palignr     m1,        m2, 13                     ; [12 11 10 9 8 7 6 5 4 3 2 1 0 a b c]
+    pslldq      m0,        m1, 1                      ; [11 10 9 8 7 6 5 4 3 2 1 0 a b c d]
+    pinsrb      m0,        [r2 + r5 + 8], 0
+    punpckhbw   m4,        m0, m1                     ; [12 11 11 10 10 9 9 8 8 7 7 6 6 5 5 4]
+    punpcklbw   m0,        m1                         ; [4 3 3 2 2 1 1 0 0 a a b b c c d]
+    palignr     m1,        m4, m0, 2                  ; [5 4 4 3 3 2 2 1 1 0 0 a a b b c]
+    palignr     m6,        m4, m0, 4                  ; [6 5 5 4 4 3 3 2 2 1 1 0 0 a a b]
+    palignr     m5,        m4, m0, 6                  ; [7 6 6 5 5 4 4 3 3 2 2 1 1 0 0 a]
+    palignr     m4,        m0, 8                      ; [8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 0]
+
+    lea         r4,        [ang_table + 23 * 16]
+    mova        m3,        [pw_1024]
+
+    pmaddubsw   m4,        [r4 - 8 * 16]              ; [15]
+    pmulhrsw    m4,        m3
+
+    pmaddubsw   m2,        m5, [r4 + 7 * 16]          ; [30]
+    pmulhrsw    m2,        m3
+    packuswb    m4,        m2
+
+    pmaddubsw   m5,        [r4 - 10 * 16]             ; [13]
+    pmulhrsw    m5,        m3
+
+    pmaddubsw   m2,        m6, [r4 + 5 * 16]          ; [28]
+    pmulhrsw    m2,        m3
+    packuswb    m5,        m2
+
+    pmaddubsw   m2,        m1, [r4 + 3 * 16]          ; [26]
+    pmulhrsw    m2,        m3
+
+    pmaddubsw   m0,        [r4 + 1 * 16]              ; [24]
+    pmulhrsw    m0,        m3
+
+    lea         r4,        [ang_table + 11 * 16]
+    pmaddubsw   m6,        [r4]                       ; [11]
+    pmulhrsw    m6,        m3
+    packuswb    m6,        m2
+
+    pmaddubsw   m1,        [r4 - 2 * 16]              ; [9]
+    pmulhrsw    m1,        m3
+    packuswb    m1,        m0
+    jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3_new %+ SUFFIX %+ .transpose8x8)
+
 cglobal intra_pred_ang8_16, 4,5,8
     cmp         r4m,       byte 20
     mov         r4,        r2
@@ -1885,6 +2620,64 @@
     packuswb    m1,        m0
     jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3 %+ SUFFIX %+ .transpose8x8)
 
+cglobal intra_pred_ang8_16_new, 4,6,8
+    mov         r4,        16
+    mov         r5,        0
+    cmp         r3m,       byte 20
+    mov         r3,        16
+    cmove       r4,        r5
+    cmove       r5,        r3
+
+    movu        m1,        [r2 + r4]                  ; [15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0]
+    pinsrb      m1,        [r2], 0
+    movu        m2,        [r2 + r5]
+    pshufb      m2,        [c_mode16_16]
+    palignr     m1,        m2, 12                     ; [11 10 9 8 7 6 5 4 3 2 1 0 a b c d]
+    pslldq      m0,        m1, 1                      ; [10 9 8 7 6 5 4 3 2 1 0 a b c d e]
+    pinsrb      m0,        [r2 + r5 + 8], 0
+    punpckhbw   m4,        m0, m1                     ; [11 10 10 9 9 8 8 7 7 6 6 5 5 4 4 3]
+    punpcklbw   m0,        m1                         ; [3 2 2 1 1 0 0 a a b b c c d d e]
+    palignr     m1,        m4, m0, 2                  ; [4 3 3 2 2 1 1 0 0 a a b b c c d]
+    palignr     m6,        m4, m0, 4                  ; [5 4 4 3 3 2 2 1 1 0 0 a a b b c]
+    palignr     m2,        m4, m0, 6                  ; [6 5 5 4 4 3 3 2 2 1 1 0 0 a a b]
+    palignr     m5,        m4, m0, 8                  ; [7 6 6 5 5 4 4 3 3 2 2 1 1 0 0 a]
+    palignr     m4,        m0, 10                     ; [8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 0]
+
+    lea         r4,        [ang_table + 22 * 16]
+    mova        m7,        [pw_1024]
+
+    pmaddubsw   m3,        m5, [r4]                   ; [22]
+    pmulhrsw    m3,        m7
+
+    pmaddubsw   m0,        [r4 + 2 * 16]              ; [24]
+    pmulhrsw    m0,        m7
+
+    lea         r4,        [ang_table + 9 * 16]
+
+    pmaddubsw   m4,        [r4 + 2 * 16]              ; [11]
+    pmulhrsw    m4,        m7
+    packuswb    m4,        m3
+
+    pmaddubsw   m2,        [r4 + 3 * 16]              ; [12]
+    pmulhrsw    m2,        m7
+
+    pmaddubsw   m5,        [r4 - 8 * 16]              ; [1]
+    pmulhrsw    m5,        m7
+    packuswb    m5,        m2
+
+    mova        m2,        m6
+    pmaddubsw   m6,        [r4 + 14 * 16]             ; [23]
+    pmulhrsw    m6,        m7
+
+    pmaddubsw   m2,        [r4 -  7 * 16]             ; [2]
+    pmulhrsw    m2,        m7
+    packuswb    m6,        m2
+
+    pmaddubsw   m1,        [r4 + 4 * 16]              ; [13]
+    pmulhrsw    m1,        m7
+    packuswb    m1,        m0
+    jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3_new %+ SUFFIX %+ .transpose8x8)
+
 cglobal intra_pred_ang8_17, 4,5,8
     cmp         r4m,       byte 19
     mov         r4,        r2
@@ -1941,6 +2734,64 @@
     packuswb    m1,        m0
     jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3 %+ SUFFIX %+ .transpose8x8)
 
+cglobal intra_pred_ang8_17_new, 4,6,8
+    mov         r4,        16
+    mov         r5,        0
+    cmp         r3m,       byte 19
+    mov         r3,        16
+    cmove       r4,        r5
+    cmove       r5,        r3
+
+    movu        m2,        [r2 + r4]                  ; [15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0]
+    pinsrb      m2,        [r2], 0
+    movu        m1,        [r2 + r5]
+    pshufb      m1,        [c_mode16_17]
+    palignr     m2,        m1, 11                     ; [10 9 8 7 6 5 4 3 2 1 0 a b c d e]
+    pslldq      m0,        m2, 1                      ; [9 8 7 6 5 4 3 2 1 0 a b c d e f]
+    pinsrb      m0,        [r2 + r5 + 7], 0
+    punpckhbw   m1,        m0, m2                     ; [10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2]
+    punpcklbw   m0,        m2                         ; [2 1 1 0 0 a a b b c c d d e e f]
+
+    palignr     m5,        m1, m0, 8                  ; [6 5 5 4 4 3 3 2 2 1 1 0 0 a a b]
+    palignr     m2,        m1, m0, 10                 ; [7 6 6 5 5 4 4 3 3 2 2 1 1 0 0 a]
+    palignr     m4,        m1, m0, 12                 ; [8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 0]
+
+    lea         r4,        [ang_table + 17 * 16]
+    mova        m3,        [pw_1024]
+
+    pmaddubsw   m2,        [r4 - 5 * 16]              ; [12]
+    pmulhrsw    m2,        m3
+
+    pmaddubsw   m4,        [r4 - 11 * 16]             ; [6]
+    pmulhrsw    m4,        m3
+    packuswb    m4,        m2
+
+    pmaddubsw   m5,        [r4 + 1 * 16]              ; [18]
+    pmulhrsw    m5,        m3
+
+    palignr     m2,        m1, m0, 6                  ; [5 4 4 3 3 2 2 1 1 0 0 a a b b c]
+    pmaddubsw   m2,        [r4 + 7 * 16]              ; [24]
+    pmulhrsw    m2,        m3
+    packuswb    m5,        m2
+
+    palignr     m6,        m1, m0, 4                  ; [4 3 3 2 2 1 1 0 0 a a b b c c d]
+    mova        m2,        m6
+    pmaddubsw   m6,        [r4 + 13 * 16]             ; [30]
+    pmulhrsw    m6,        m3
+
+    pmaddubsw   m2,        [r4 - 13 * 16]             ; [4]
+    pmulhrsw    m2,        m3
+    packuswb    m6,        m2
+
+    palignr     m1,        m0, 2                      ; [3 2 2 1 1 0 0 a a b b c c d d e]
+    pmaddubsw   m1,        [r4 - 7 * 16]              ; [10]
+    pmulhrsw    m1,        m3
+
+    pmaddubsw   m0,        [r4 - 1 * 16]              ; [16]
+    pmulhrsw    m0,        m3
+    packuswb    m1,        m0
+    jmp         mangle(private_prefix %+ _ %+ intra_pred_ang8_3_new %+ SUFFIX %+ .transpose8x8)
+
 cglobal intra_pred_ang8_18, 4,4,1
     movu        m0, [r2]
     pshufb      m0, [pb_swap8]
@@ -1964,6 +2815,29 @@
     movh        [r0], m0
     RET
 
+cglobal intra_pred_ang8_18_new, 4,4,1
+    movu        m0, [r2 + 16]
+    pinsrb      m0, [r2], 0
+    pshufb      m0, [pb_swap8]
+    movhps      m0, [r2 + 1]
+    lea         r2, [r0 + r1 * 4]
+    lea         r3, [r1 * 3]
+    movh        [r2 + r3], m0
+    psrldq      m0, 1
+    movh        [r2 + r1 * 2], m0
+    psrldq      m0, 1
+    movh        [r2 + r1], m0
+    psrldq      m0, 1
+    movh        [r2], m0
+    psrldq      m0, 1
+    movh        [r0 + r3], m0
+    psrldq      m0, 1
+    movh        [r0 + r1 * 2], m0
+    psrldq      m0, 1
+    movh        [r0 + r1], m0
+    psrldq      m0, 1
+    movh        [r0], m0
+    RET
 
 ;-----------------------------------------------------------------------------
 ; void intraPredAng16(pixel* dst, intptr_t dstStride, pixel *refLeft, pixel *refAbove, int dirMode, int bFilter)
diff -r 558439d703fd -r 9aa0b1574481 source/test/intrapredharness.cpp
--- a/source/test/intrapredharness.cpp	Wed Dec 24 11:23:30 2014 +0530
+++ b/source/test/intrapredharness.cpp	Mon Jan 12 12:56:56 2015 +0530
@@ -137,6 +137,46 @@
     return true;
 }
 
+bool IntraPredHarness::check_angular_primitive(const intra_pred_new_t ref[][NUM_TR_SIZE], const intra_pred_new_t opt[][NUM_TR_SIZE])
+{
+    int j = Predict::ADI_BUF_STRIDE;
+    intptr_t stride = FENC_STRIDE;
+
+#if _DEBUG
+    memset(pixel_out_vec, 0xCD, OUTPUT_SIZE);
+    memset(pixel_out_c, 0xCD, OUTPUT_SIZE);
+#endif
+
+    for (int size = 2; size <= 5; size++)
+    {
+        int width = (1 << size);
+        for (int i = 0; i <= 100; i++)
+        {
+            int bFilter = (width <= 16) && (rand() % 2);
+            for (int pmode = 2; pmode <= 34; pmode++)
+            {
+                if (!opt[pmode][size - 2])
+                    continue;
+
+                checked(opt[pmode][size - 2], pixel_out_vec, stride, pixel_buff + j, pmode, bFilter);
+                ref[pmode][size - 2](pixel_out_c, stride, pixel_buff + j, pmode, bFilter);
+
+                for (int k = 0; k < width; k++)
+                {
+                    if (memcmp(pixel_out_vec + k * FENC_STRIDE, pixel_out_c + k * FENC_STRIDE, width * sizeof(pixel)))
+                        return false;
+                }
+
+                reportfail();
+            }
+
+            j += FENC_STRIDE;
+        }
+    }
+
+    return true;
+}
+
 bool IntraPredHarness::check_allangs_primitive(const intra_allangs_t ref[], const intra_allangs_t opt[])
 {
     int j = Predict::ADI_BUF_STRIDE;
@@ -219,6 +259,12 @@
         return false;
     }
 
+    if (!check_angular_primitive(ref.intra_pred_new, opt.intra_pred_new))
+    {
+        printf("intra_angular failed\n");
+        return false;
+    }
+
     if (opt.intra_pred_allangs[0])
     {
         if (!check_allangs_primitive(ref.intra_pred_allangs, opt.intra_pred_allangs))
@@ -287,4 +333,23 @@
             }
         }
     }
+
+    for (int ii = 2; ii <= 5; ii++)
+    {
+        for (int p = 2; p <= 34; p += 1)
+        {
+            int pmode = p;  //(rand()%33)+2;
+            if (opt.intra_pred_new[pmode][ii - 2])
+            {
+                width = (1 << ii);
+                bool bFilter = (width <= 16);
+                pixel * refAbove = pixel_buff + srcStride;
+                pixel * refLeft = refAbove + 3 * width;
+                refLeft[0] = refAbove[0];
+                printf("intra_ang_new_%dx%d[%2d]", width, width, pmode);
+                REPORT_SPEEDUP(opt.intra_pred_new[pmode][ii - 2], ref.intra_pred_new[pmode][ii - 2],
+                               pixel_out_vec, FENC_STRIDE, pixel_buff + srcStride, pmode, bFilter);
+            }
+        }
+    }
 }
diff -r 558439d703fd -r 9aa0b1574481 source/test/intrapredharness.h
--- a/source/test/intrapredharness.h	Wed Dec 24 11:23:30 2014 +0530
+++ b/source/test/intrapredharness.h	Mon Jan 12 12:56:56 2015 +0530
@@ -44,6 +44,7 @@
     bool check_dc_primitive(intra_pred_new_t ref, intra_pred_new_t opt, int width);
     bool check_planar_primitive(intra_pred_new_t ref, intra_pred_new_t opt, int width);
     bool check_angular_primitive(const intra_pred_t ref[][NUM_TR_SIZE], const intra_pred_t opt[][NUM_TR_SIZE]);
+    bool check_angular_primitive(const intra_pred_new_t ref[][NUM_TR_SIZE], const intra_pred_new_t opt[][NUM_TR_SIZE]);
     bool check_allangs_primitive(const intra_allangs_t ref[], const intra_allangs_t opt[]);
 
 public:



More information about the x265-devel mailing list