[x265] [PATCH 2 of 2] primitves: 8 bit : PredIntraAng4x4 function table implementation: code cleanup

mandar at multicorewareinc.com mandar at multicorewareinc.com
Thu Jun 27 09:37:06 CEST 2013


# HG changeset patch
# User Mandar Gurav
# Date 1372318556 25200
# Node ID f71a4aff1b57e57f7d7ecdea006f6e6fbe340beb
# Parent  e156dc24f05f4c2e6770fde1b46754cce640a96b
primitves: 8 bit : PredIntraAng4x4 function table implementation: code cleanup

diff -r e156dc24f05f -r f71a4aff1b57 source/common/vec/intrapred.inc
--- a/source/common/vec/intrapred.inc	Wed Jun 26 02:59:47 2013 -0700
+++ b/source/common/vec/intrapred.inc	Thu Jun 27 00:35:56 2013 -0700
@@ -34,6 +34,56 @@
 
 using namespace x265;
 
+#define PRED_INTRA_ANG4_START   \
+    Vec8s row11, row12, row21, row22, row31, row32, row41, row42;   \
+    Vec16uc tmp16_1, tmp16_2;   \
+    Vec2uq tmp2uq;  \
+    Vec8s v_deltaFract, v_deltaPos(0), thirty2(32), thirty1(31), v_ipAngle(0);  \
+    bool modeHor = (dirMode < 18);                                              
+
+
+#define PRED_INTRA_ANG4_END \
+    v_deltaFract = v_deltaPos & thirty1;    \
+    row11 = ((thirty2 - v_deltaFract) * row11 + (v_deltaFract * row12) + 16) >> 5;  \
+    /*row2*/    \
+    v_deltaPos += v_ipAngle;    \
+    v_deltaFract = v_deltaPos & thirty1;    \
+    row21 = ((thirty2 - v_deltaFract) * row21 + (v_deltaFract * row22) + 16) >> 5;  \
+    /*row3*/    \
+    v_deltaPos += v_ipAngle;    \
+    v_deltaFract = v_deltaPos & thirty1;    \
+    row31 = ((thirty2 - v_deltaFract) * row31 + (v_deltaFract * row32) + 16) >> 5;  \
+    /*row4*/    \
+    v_deltaPos += v_ipAngle;    \
+    v_deltaFract = v_deltaPos & thirty1;    \
+    row41 = ((thirty2 - v_deltaFract) * row41 + (v_deltaFract * row42) + 16) >> 5;  \
+    /* Flip the block */    \
+    if (modeHor)    \
+    {   \
+        Vec8s tmp1, tmp2, tmp3, tmp4;   \
+        tmp1 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row11, row31); \
+        tmp2 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row21, row41); \
+        tmp3 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(tmp1, tmp2);   \
+        tmp4 = blend8s<4, 12, 5, 13, 6, 14, 7, 15>(tmp1, tmp2); \
+        tmp16_1 = compress_unsafe(tmp3, tmp3);  \
+        store_partial(const_int(4), pDst, tmp16_1); \
+        tmp2uq = reinterpret_i(tmp16_1);    \
+        tmp2uq >>= 32;  \
+        store_partial(const_int(4), pDst + dstStride, tmp2uq);  \
+        tmp16_1 = compress_unsafe(tmp4, tmp4);  \
+        store_partial(const_int(4), pDst + (2 * dstStride), tmp16_1);   \
+        tmp2uq = reinterpret_i(tmp16_1);    \
+        tmp2uq >>= 32;  \
+        store_partial(const_int(4), pDst + (3 * dstStride), tmp2uq);    \
+    }   \
+    else    \
+    {   \
+        store_partial(const_int(4), pDst, compress_unsafe(row11, row11));   \
+        store_partial(const_int(4), pDst + (dstStride), compress_unsafe(row21, row21)); \
+        store_partial(const_int(4), pDst + (2 * dstStride), compress_unsafe(row31, row31)); \
+        store_partial(const_int(4), pDst + (3 * dstStride), compress_unsafe(row41, row41)); \
+    }
+
 namespace {
 const int angAP[17][64] =
 {
@@ -1673,10 +1723,9 @@
 
 #else /* if HIGH_BIT_DEPTH */
 
-void PredIntraAng4_32(pixel* pDst, int dstStride, pixel *refMain, int dirMode)
+void PredIntraAng4_32(pixel* pDst, int dstStride, pixel *refMain, int /*dirMode*/)
 {
     Vec16uc tmp16_1, tmp16_2;
-    dirMode++;
     tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain + 2);
     store_partial(const_int(4), pDst, tmp16_1);
     tmp16_2 = (Vec16uc)load_partial(const_int(8), refMain + 3);
@@ -1686,16 +1735,13 @@
     tmp16_2 = (Vec16uc)load_partial(const_int(8), refMain + 5);
     store_partial(const_int(4), pDst + 3 * dstStride, tmp16_2);
 }
+												
 
 void PredIntraAng4_26(pixel* pDst, int dstStride, pixel *refMain, int dirMode)
 {
-    Vec8s row11, row12, row21, row22, row31, row32, row41, row42;
-    Vec16uc tmp16_1, tmp16_2;
-    Vec2uq tmp2uq;
-    Vec8s v_deltaFract, v_deltaPos(0), thirty2(32), thirty1(31), v_ipAngle(0);
-    bool modeHor = (dirMode < 18);
-    tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain + 1);
-
+    PRED_INTRA_ANG4_START
+
+    tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain + 1); 
     row11 = extend_low(tmp16_1);    //offsets(0,1,2,3)
 
     tmp2uq = reinterpret_i(tmp16_1);
@@ -1723,66 +1769,13 @@
     row42 = extend_low(tmp16_2);    //offsets(4,5,6,7)
 
     v_deltaPos = v_ipAngle = 26;
-
-    v_deltaFract = v_deltaPos & thirty1;
-    row11 = ((thirty2 - v_deltaFract) * row11 + (v_deltaFract * row12) + 16) >> 5;
-
-    //row2
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row21 = ((thirty2 - v_deltaFract) * row21 + (v_deltaFract * row22) + 16) >> 5;
-
-    //row3
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row31 = ((thirty2 - v_deltaFract) * row31 + (v_deltaFract * row32) + 16) >> 5;
-
-    //row4
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row41 = ((thirty2 - v_deltaFract) * row41 + (v_deltaFract * row42) + 16) >> 5;
-
-    // Flip the block
-    if (modeHor)
-    {
-        Vec8s tmp1, tmp2, tmp3, tmp4;
-
-        tmp1 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row11, row31);
-        tmp2 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row21, row41);
-
-        tmp3 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(tmp1, tmp2);
-        tmp4 = blend8s<4, 12, 5, 13, 6, 14, 7, 15>(tmp1, tmp2);
-
-        tmp16_1 = compress_unsafe(tmp3, tmp3);
-        store_partial(const_int(4), pDst, tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + dstStride, tmp2uq);
-
-        tmp16_1 = compress_unsafe(tmp4, tmp4);
-        store_partial(const_int(4), pDst + (2 * dstStride), tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + (3 * dstStride), tmp2uq);
-    }
-    else
-    {
-        store_partial(const_int(4), pDst, compress_unsafe(row11, row11));
-        store_partial(const_int(4), pDst + (dstStride), compress_unsafe(row21, row21));
-        store_partial(const_int(4), pDst + (2 * dstStride), compress_unsafe(row31, row31));
-        store_partial(const_int(4), pDst + (3 * dstStride), compress_unsafe(row41, row41));
-    }
+    
+    PRED_INTRA_ANG4_END
 }
 
 void PredIntraAng4_21(pixel* pDst, int dstStride, pixel *refMain, int dirMode) 
 {
-    Vec8s row11, row12, row21, row22, row31, row32, row41, row42;
-    Vec16uc tmp16_1, tmp16_2;
-    Vec2uq tmp2uq;
-    Vec8s v_deltaFract, v_deltaPos(0), thirty2(32), thirty1(31), v_ipAngle(0);
-    bool modeHor = (dirMode < 18);
+    PRED_INTRA_ANG4_START
 
     tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain + 1);
 
@@ -1811,65 +1804,12 @@
 
     v_deltaPos = v_ipAngle = 21;
 
-    v_deltaFract = v_deltaPos & thirty1;
-    row11 = ((thirty2 - v_deltaFract) * row11 + (v_deltaFract * row12) + 16) >> 5;
-
-    //row2
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row21 = ((thirty2 - v_deltaFract) * row21 + (v_deltaFract * row22) + 16) >> 5;
-
-    //row3
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row31 = ((thirty2 - v_deltaFract) * row31 + (v_deltaFract * row32) + 16) >> 5;
-
-    //row4
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row41 = ((thirty2 - v_deltaFract) * row41 + (v_deltaFract * row42) + 16) >> 5;
-
-    // Flip the block
-    if (modeHor)
-    {
-        Vec8s tmp1, tmp2, tmp3, tmp4;
-
-        tmp1 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row11, row31);
-        tmp2 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row21, row41);
-
-        tmp3 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(tmp1, tmp2);
-        tmp4 = blend8s<4, 12, 5, 13, 6, 14, 7, 15>(tmp1, tmp2);
-
-        tmp16_1 = compress_unsafe(tmp3, tmp3);
-        store_partial(const_int(4), pDst, tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + dstStride, tmp2uq);
-
-        tmp16_1 = compress_unsafe(tmp4, tmp4);
-        store_partial(const_int(4), pDst + (2 * dstStride), tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + (3 * dstStride), tmp2uq);
-    }
-    else
-    {
-        store_partial(const_int(4), pDst, compress_unsafe(row11, row11));
-        store_partial(const_int(4), pDst + (dstStride), compress_unsafe(row21, row21));
-        store_partial(const_int(4), pDst + (2 * dstStride), compress_unsafe(row31, row31));
-        store_partial(const_int(4), pDst + (3 * dstStride), compress_unsafe(row41, row41));
-    }
+    PRED_INTRA_ANG4_END
 }
 
 void PredIntraAng4_17(pixel* pDst, int dstStride, pixel *refMain, int dirMode) 
 {
-    Vec8s row11, row12, row21, row22, row31, row32, row41, row42;
-    Vec16uc tmp16_1, tmp16_2;
-    Vec2uq tmp2uq;
-    Vec8s v_deltaFract, v_deltaPos(0), thirty2(32), thirty1(31), v_ipAngle(0);
-    bool modeHor = (dirMode < 18);
+    PRED_INTRA_ANG4_START
 
     tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain + 1);
 
@@ -1898,68 +1838,14 @@
 
     v_deltaPos = v_ipAngle = 17;
 
-    v_deltaFract = v_deltaPos & thirty1;
-    row11 = ((thirty2 - v_deltaFract) * row11 + (v_deltaFract * row12) + 16) >> 5;
-
-    //row2
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row21 = ((thirty2 - v_deltaFract) * row21 + (v_deltaFract * row22) + 16) >> 5;
-
-    //row3
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row31 = ((thirty2 - v_deltaFract) * row31 + (v_deltaFract * row32) + 16) >> 5;
-
-    //row4
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row41 = ((thirty2 - v_deltaFract) * row41 + (v_deltaFract * row42) + 16) >> 5;
-
-    // Flip the block
-    if (modeHor)
-    {
-        Vec8s tmp1, tmp2, tmp3, tmp4;
-
-        tmp1 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row11, row31);
-        tmp2 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row21, row41);
-
-        tmp3 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(tmp1, tmp2);
-        tmp4 = blend8s<4, 12, 5, 13, 6, 14, 7, 15>(tmp1, tmp2);
-
-        tmp16_1 = compress_unsafe(tmp3, tmp3);
-        store_partial(const_int(4), pDst, tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + dstStride, tmp2uq);
-
-        tmp16_1 = compress_unsafe(tmp4, tmp4);
-        store_partial(const_int(4), pDst + (2 * dstStride), tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + (3 * dstStride), tmp2uq);
-    }
-    else
-    {
-        store_partial(const_int(4), pDst, compress_unsafe(row11, row11));
-        store_partial(const_int(4), pDst + (dstStride), compress_unsafe(row21, row21));
-        store_partial(const_int(4), pDst + (2 * dstStride), compress_unsafe(row31, row31));
-        store_partial(const_int(4), pDst + (3 * dstStride), compress_unsafe(row41, row41));
-    }
+    PRED_INTRA_ANG4_END
 }
 
 void PredIntraAng4_13(pixel* pDst, int dstStride, pixel *refMain, int dirMode) 
 {
-    Vec8s row11, row12, row21, row22, row31, row32, row41, row42;
-    Vec16uc tmp16_1, tmp16_2;
-    Vec2uq tmp2uq;
-    Vec8s v_deltaFract, v_deltaPos(0), thirty2(32), thirty1(31), v_ipAngle(0);
-    bool modeHor = (dirMode < 18);
+    PRED_INTRA_ANG4_START
 
     tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain + 1);
-
     row11 = extend_low(tmp16_1);    //offsets(0,1,2,3)
 
     tmp2uq = reinterpret_i(tmp16_1);
@@ -1981,65 +1867,12 @@
 
     v_deltaPos = v_ipAngle = 13;
 
-    v_deltaFract = v_deltaPos & thirty1;
-    row11 = ((thirty2 - v_deltaFract) * row11 + (v_deltaFract * row12) + 16) >> 5;
-
-    //row2
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row21 = ((thirty2 - v_deltaFract) * row21 + (v_deltaFract * row22) + 16) >> 5;
-
-    //row3
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row31 = ((thirty2 - v_deltaFract) * row31 + (v_deltaFract * row32) + 16) >> 5;
-
-    //row4
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row41 = ((thirty2 - v_deltaFract) * row41 + (v_deltaFract * row42) + 16) >> 5;
-
-    // Flip the block
-    if (modeHor)
-    {
-        Vec8s tmp1, tmp2, tmp3, tmp4;
-
-        tmp1 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row11, row31);
-        tmp2 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row21, row41);
-
-        tmp3 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(tmp1, tmp2);
-        tmp4 = blend8s<4, 12, 5, 13, 6, 14, 7, 15>(tmp1, tmp2);
-
-        tmp16_1 = compress_unsafe(tmp3, tmp3);
-        store_partial(const_int(4), pDst, tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + dstStride, tmp2uq);
-
-        tmp16_1 = compress_unsafe(tmp4, tmp4);
-        store_partial(const_int(4), pDst + (2 * dstStride), tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + (3 * dstStride), tmp2uq);
-    }
-    else
-    {
-        store_partial(const_int(4), pDst, compress_unsafe(row11, row11));
-        store_partial(const_int(4), pDst + (dstStride), compress_unsafe(row21, row21));
-        store_partial(const_int(4), pDst + (2 * dstStride), compress_unsafe(row31, row31));
-        store_partial(const_int(4), pDst + (3 * dstStride), compress_unsafe(row41, row41));
-    }
+    PRED_INTRA_ANG4_END
 }
 
 void PredIntraAng4_9(pixel* pDst, int dstStride, pixel *refMain, int dirMode) 
 {
-    Vec8s row11, row12, row21, row22, row31, row32, row41, row42;
-    Vec16uc tmp16_1, tmp16_2;
-    Vec2uq tmp2uq;
-    Vec8s v_deltaFract, v_deltaPos(0), thirty2(32), thirty1(31), v_ipAngle(0);
-    bool modeHor = (dirMode < 18);
+    PRED_INTRA_ANG4_START
 
     tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain + 1);
     row11 = extend_low(tmp16_1);    //offsets(0,1,2,3)
@@ -2059,65 +1892,12 @@
 
     v_deltaPos = v_ipAngle = 9;
 
-    v_deltaFract = v_deltaPos & thirty1;
-    row11 = ((thirty2 - v_deltaFract) * row11 + (v_deltaFract * row12) + 16) >> 5;
-
-    //row2
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row21 = ((thirty2 - v_deltaFract) * row21 + (v_deltaFract * row22) + 16) >> 5;
-
-    //row3
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row31 = ((thirty2 - v_deltaFract) * row31 + (v_deltaFract * row32) + 16) >> 5;
-
-    //row4
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row41 = ((thirty2 - v_deltaFract) * row41 + (v_deltaFract * row42) + 16) >> 5;
-
-    // Flip the block
-    if (modeHor)
-    {
-        Vec8s tmp1, tmp2, tmp3, tmp4;
-
-        tmp1 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row11, row31);
-        tmp2 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row21, row41);
-
-        tmp3 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(tmp1, tmp2);
-        tmp4 = blend8s<4, 12, 5, 13, 6, 14, 7, 15>(tmp1, tmp2);
-
-        tmp16_1 = compress_unsafe(tmp3, tmp3);
-        store_partial(const_int(4), pDst, tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + dstStride, tmp2uq);
-
-        tmp16_1 = compress_unsafe(tmp4, tmp4);
-        store_partial(const_int(4), pDst + (2 * dstStride), tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + (3 * dstStride), tmp2uq);
-    }
-    else
-    {
-        store_partial(const_int(4), pDst, compress_unsafe(row11, row11));
-        store_partial(const_int(4), pDst + (dstStride), compress_unsafe(row21, row21));
-        store_partial(const_int(4), pDst + (2 * dstStride), compress_unsafe(row31, row31));
-        store_partial(const_int(4), pDst + (3 * dstStride), compress_unsafe(row41, row41));
-    }
+    PRED_INTRA_ANG4_END
 }
 
 void PredIntraAng4_5(pixel* pDst, int dstStride, pixel *refMain, int dirMode) 
 {
-    Vec8s row11, row12, row21, row22, row31, row32, row41, row42;
-    Vec16uc tmp16_1, tmp16_2;
-    Vec2uq tmp2uq;
-    Vec8s v_deltaFract, v_deltaPos(0), thirty2(32), thirty1(31), v_ipAngle(0);
-    bool modeHor = (dirMode < 18);
+    PRED_INTRA_ANG4_START
 
     tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain + 1);
     row11 = extend_low(tmp16_1);    //offsets(0,1,2,3)
@@ -2134,65 +1914,12 @@
 
     v_deltaPos = v_ipAngle = 5;
 
-    v_deltaFract = v_deltaPos & thirty1;
-    row11 = ((thirty2 - v_deltaFract) * row11 + (v_deltaFract * row12) + 16) >> 5;
-
-    //row2
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row21 = ((thirty2 - v_deltaFract) * row21 + (v_deltaFract * row22) + 16) >> 5;
-
-    //row3
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row31 = ((thirty2 - v_deltaFract) * row31 + (v_deltaFract * row32) + 16) >> 5;
-
-    //row4
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row41 = ((thirty2 - v_deltaFract) * row41 + (v_deltaFract * row42) + 16) >> 5;
-
-    // Flip the block
-    if (modeHor)
-    {
-        Vec8s tmp1, tmp2, tmp3, tmp4;
-
-        tmp1 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row11, row31);
-        tmp2 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row21, row41);
-
-        tmp3 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(tmp1, tmp2);
-        tmp4 = blend8s<4, 12, 5, 13, 6, 14, 7, 15>(tmp1, tmp2);
-
-        tmp16_1 = compress_unsafe(tmp3, tmp3);
-        store_partial(const_int(4), pDst, tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + dstStride, tmp2uq);
-
-        tmp16_1 = compress_unsafe(tmp4, tmp4);
-        store_partial(const_int(4), pDst + (2 * dstStride), tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + (3 * dstStride), tmp2uq);
-    }
-    else
-    {
-        store_partial(const_int(4), pDst, compress_unsafe(row11, row11));
-        store_partial(const_int(4), pDst + (dstStride), compress_unsafe(row21, row21));
-        store_partial(const_int(4), pDst + (2 * dstStride), compress_unsafe(row31, row31));
-        store_partial(const_int(4), pDst + (3 * dstStride), compress_unsafe(row41, row41));
-    }
+    PRED_INTRA_ANG4_END
 }
 
 void PredIntraAng4_2(pixel* pDst, int dstStride, pixel *refMain, int dirMode) 
 {
-    Vec8s row11, row12, row21, row22, row31, row32, row41, row42;
-    Vec16uc tmp16_1, tmp16_2;
-    Vec2uq tmp2uq;
-    Vec8s v_deltaFract, v_deltaPos(0), thirty2(32), thirty1(31), v_ipAngle(0);
-    bool modeHor = (dirMode < 18);
+    PRED_INTRA_ANG4_START
 
     tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain + 1);
     row11 = extend_low(tmp16_1);    //offsets(0,1,2,3)
@@ -2209,65 +1936,12 @@
 
     v_deltaPos = v_ipAngle = 2;
 
-    v_deltaFract = v_deltaPos & thirty1;
-    row11 = ((thirty2 - v_deltaFract) * row11 + (v_deltaFract * row12) + 16) >> 5;
-
-    //row2
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row21 = ((thirty2 - v_deltaFract) * row21 + (v_deltaFract * row22) + 16) >> 5;
-
-    //row3
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row31 = ((thirty2 - v_deltaFract) * row31 + (v_deltaFract * row32) + 16) >> 5;
-
-    //row4
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row41 = ((thirty2 - v_deltaFract) * row41 + (v_deltaFract * row42) + 16) >> 5;
-
-    // Flip the block
-    if (modeHor)
-    {
-        Vec8s tmp1, tmp2, tmp3, tmp4;
-
-        tmp1 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row11, row31);
-        tmp2 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row21, row41);
-
-        tmp3 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(tmp1, tmp2);
-        tmp4 = blend8s<4, 12, 5, 13, 6, 14, 7, 15>(tmp1, tmp2);
-
-        tmp16_1 = compress_unsafe(tmp3, tmp3);
-        store_partial(const_int(4), pDst, tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + dstStride, tmp2uq);
-
-        tmp16_1 = compress_unsafe(tmp4, tmp4);
-        store_partial(const_int(4), pDst + (2 * dstStride), tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + (3 * dstStride), tmp2uq);
-    }
-    else
-    {
-        store_partial(const_int(4), pDst, compress_unsafe(row11, row11));
-        store_partial(const_int(4), pDst + (dstStride), compress_unsafe(row21, row21));
-        store_partial(const_int(4), pDst + (2 * dstStride), compress_unsafe(row31, row31));
-        store_partial(const_int(4), pDst + (3 * dstStride), compress_unsafe(row41, row41));
-    }
+    PRED_INTRA_ANG4_END
 }
 
 void PredIntraAng4_m_2(pixel* pDst, int dstStride, pixel *refMain, int dirMode) 
 {
-    Vec8s row11, row12, row21, row22, row31, row32, row41, row42;
-    Vec16uc tmp16_1, tmp16_2;
-    Vec2uq tmp2uq;
-    Vec8s v_deltaFract, v_deltaPos(0), thirty2(32), thirty1(31), v_ipAngle(0);
-    bool modeHor = (dirMode < 18);
+   PRED_INTRA_ANG4_START
 
     tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain);
     row11 = extend_low(tmp16_1);    //offsets(0,1,2,3)
@@ -2284,65 +1958,12 @@
 
     v_deltaPos = v_ipAngle = -2;
 
-    v_deltaFract = v_deltaPos & thirty1;
-    row11 = ((thirty2 - v_deltaFract) * row11 + (v_deltaFract * row12) + 16) >> 5;
-
-    //row2
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row21 = ((thirty2 - v_deltaFract) * row21 + (v_deltaFract * row22) + 16) >> 5;
-
-    //row3
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row31 = ((thirty2 - v_deltaFract) * row31 + (v_deltaFract * row32) + 16) >> 5;
-
-    //row4
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row41 = ((thirty2 - v_deltaFract) * row41 + (v_deltaFract * row42) + 16) >> 5;
-
-    // Flip the block
-    if (modeHor)
-    {
-        Vec8s tmp1, tmp2, tmp3, tmp4;
-
-        tmp1 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row11, row31);
-        tmp2 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row21, row41);
-
-        tmp3 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(tmp1, tmp2);
-        tmp4 = blend8s<4, 12, 5, 13, 6, 14, 7, 15>(tmp1, tmp2);
-
-        tmp16_1 = compress_unsafe(tmp3, tmp3);
-        store_partial(const_int(4), pDst, tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + dstStride, tmp2uq);
-
-        tmp16_1 = compress_unsafe(tmp4, tmp4);
-        store_partial(const_int(4), pDst + (2 * dstStride), tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + (3 * dstStride), tmp2uq);
-    }
-    else
-    {
-        store_partial(const_int(4), pDst, compress_unsafe(row11, row11));
-        store_partial(const_int(4), pDst + (dstStride), compress_unsafe(row21, row21));
-        store_partial(const_int(4), pDst + (2 * dstStride), compress_unsafe(row31, row31));
-        store_partial(const_int(4), pDst + (3 * dstStride), compress_unsafe(row41, row41));
-    }
+    PRED_INTRA_ANG4_END
 }
 
 void PredIntraAng4_m_5(pixel* pDst, int dstStride, pixel *refMain, int dirMode) 
 {
-    Vec8s row11, row12, row21, row22, row31, row32, row41, row42;
-    Vec16uc tmp16_1, tmp16_2;
-    Vec2uq tmp2uq;
-    Vec8s v_deltaFract, v_deltaPos(0), thirty2(32), thirty1(31), v_ipAngle(0);
-    bool modeHor = (dirMode < 18);
+    PRED_INTRA_ANG4_START
 
     tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain);
     row11 = extend_low(tmp16_1);    //offsets(0,1,2,3)
@@ -2359,65 +1980,12 @@
 
     v_deltaPos = v_ipAngle = -5;
 
-    v_deltaFract = v_deltaPos & thirty1;
-    row11 = ((thirty2 - v_deltaFract) * row11 + (v_deltaFract * row12) + 16) >> 5;
-
-    //row2
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row21 = ((thirty2 - v_deltaFract) * row21 + (v_deltaFract * row22) + 16) >> 5;
-
-    //row3
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row31 = ((thirty2 - v_deltaFract) * row31 + (v_deltaFract * row32) + 16) >> 5;
-
-    //row4
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row41 = ((thirty2 - v_deltaFract) * row41 + (v_deltaFract * row42) + 16) >> 5;
-
-    // Flip the block
-    if (modeHor)
-    {
-        Vec8s tmp1, tmp2, tmp3, tmp4;
-
-        tmp1 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row11, row31);
-        tmp2 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row21, row41);
-
-        tmp3 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(tmp1, tmp2);
-        tmp4 = blend8s<4, 12, 5, 13, 6, 14, 7, 15>(tmp1, tmp2);
-
-        tmp16_1 = compress_unsafe(tmp3, tmp3);
-        store_partial(const_int(4), pDst, tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + dstStride, tmp2uq);
-
-        tmp16_1 = compress_unsafe(tmp4, tmp4);
-        store_partial(const_int(4), pDst + (2 * dstStride), tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + (3 * dstStride), tmp2uq);
-    }
-    else
-    {
-        store_partial(const_int(4), pDst, compress_unsafe(row11, row11));
-        store_partial(const_int(4), pDst + (dstStride), compress_unsafe(row21, row21));
-        store_partial(const_int(4), pDst + (2 * dstStride), compress_unsafe(row31, row31));
-        store_partial(const_int(4), pDst + (3 * dstStride), compress_unsafe(row41, row41));
-    }
+    PRED_INTRA_ANG4_END
 }
 
 void PredIntraAng4_m_9(pixel* pDst, int dstStride, pixel *refMain, int dirMode) 
 {
-    Vec8s row11, row12, row21, row22, row31, row32, row41, row42;
-    Vec16uc tmp16_1, tmp16_2;
-    Vec2uq tmp2uq;
-    Vec8s v_deltaFract, v_deltaPos(0), thirty2(32), thirty1(31), v_ipAngle(0);
-    bool modeHor = (dirMode < 18);
+    PRED_INTRA_ANG4_START
 
     tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain - 1);
     row41 = extend_low(tmp16_1);    //offsets(-2,-1,0,1)
@@ -2439,65 +2007,12 @@
 
     v_deltaPos = v_ipAngle = -9;
 
-    v_deltaFract = v_deltaPos & thirty1;
-    row11 = ((thirty2 - v_deltaFract) * row11 + (v_deltaFract * row12) + 16) >> 5;
-
-    //row2
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row21 = ((thirty2 - v_deltaFract) * row21 + (v_deltaFract * row22) + 16) >> 5;
-
-    //row3
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row31 = ((thirty2 - v_deltaFract) * row31 + (v_deltaFract * row32) + 16) >> 5;
-
-    //row4
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row41 = ((thirty2 - v_deltaFract) * row41 + (v_deltaFract * row42) + 16) >> 5;
-
-    // Flip the block
-    if (modeHor)
-    {
-        Vec8s tmp1, tmp2, tmp3, tmp4;
-
-        tmp1 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row11, row31);
-        tmp2 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row21, row41);
-
-        tmp3 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(tmp1, tmp2);
-        tmp4 = blend8s<4, 12, 5, 13, 6, 14, 7, 15>(tmp1, tmp2);
-
-        tmp16_1 = compress_unsafe(tmp3, tmp3);
-        store_partial(const_int(4), pDst, tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + dstStride, tmp2uq);
-
-        tmp16_1 = compress_unsafe(tmp4, tmp4);
-        store_partial(const_int(4), pDst + (2 * dstStride), tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + (3 * dstStride), tmp2uq);
-    }
-    else
-    {
-        store_partial(const_int(4), pDst, compress_unsafe(row11, row11));
-        store_partial(const_int(4), pDst + (dstStride), compress_unsafe(row21, row21));
-        store_partial(const_int(4), pDst + (2 * dstStride), compress_unsafe(row31, row31));
-        store_partial(const_int(4), pDst + (3 * dstStride), compress_unsafe(row41, row41));
-    }
+    PRED_INTRA_ANG4_END
 }
 
 void PredIntraAng4_m_13(pixel* pDst, int dstStride, pixel *refMain, int dirMode) 
 {
-    Vec8s row11, row12, row21, row22, row31, row32, row41, row42;
-    Vec16uc tmp16_1, tmp16_2;
-    Vec2uq tmp2uq;
-    Vec8s v_deltaFract, v_deltaPos(0), thirty2(32), thirty1(31), v_ipAngle(0);
-    bool modeHor = (dirMode < 18);
+    PRED_INTRA_ANG4_START
 
     tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain - 1);
     row41 = extend_low(tmp16_1);    //offsets(-2,-1,0,1)
@@ -2519,65 +2034,12 @@
 
     v_deltaPos = v_ipAngle = -13;
 
-    v_deltaFract = v_deltaPos & thirty1;
-    row11 = ((thirty2 - v_deltaFract) * row11 + (v_deltaFract * row12) + 16) >> 5;
-
-    //row2
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row21 = ((thirty2 - v_deltaFract) * row21 + (v_deltaFract * row22) + 16) >> 5;
-
-    //row3
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row31 = ((thirty2 - v_deltaFract) * row31 + (v_deltaFract * row32) + 16) >> 5;
-
-    //row4
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row41 = ((thirty2 - v_deltaFract) * row41 + (v_deltaFract * row42) + 16) >> 5;
-
-    // Flip the block
-    if (modeHor)
-    {
-        Vec8s tmp1, tmp2, tmp3, tmp4;
-
-        tmp1 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row11, row31);
-        tmp2 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row21, row41);
-
-        tmp3 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(tmp1, tmp2);
-        tmp4 = blend8s<4, 12, 5, 13, 6, 14, 7, 15>(tmp1, tmp2);
-
-        tmp16_1 = compress_unsafe(tmp3, tmp3);
-        store_partial(const_int(4), pDst, tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + dstStride, tmp2uq);
-
-        tmp16_1 = compress_unsafe(tmp4, tmp4);
-        store_partial(const_int(4), pDst + (2 * dstStride), tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + (3 * dstStride), tmp2uq);
-    }
-    else
-    {
-        store_partial(const_int(4), pDst, compress_unsafe(row11, row11));
-        store_partial(const_int(4), pDst + (dstStride), compress_unsafe(row21, row21));
-        store_partial(const_int(4), pDst + (2 * dstStride), compress_unsafe(row31, row31));
-        store_partial(const_int(4), pDst + (3 * dstStride), compress_unsafe(row41, row41));
-    }
+    PRED_INTRA_ANG4_END
 }
 
 void PredIntraAng4_m_17(pixel* pDst, int dstStride, pixel *refMain, int dirMode) 
 {
-    Vec8s row11, row12, row21, row22, row31, row32, row41, row42;
-    Vec16uc tmp16_1, tmp16_2;
-    Vec2uq tmp2uq;
-    Vec8s v_deltaFract, v_deltaPos(0), thirty2(32), thirty1(31), v_ipAngle(0);
-    bool modeHor = (dirMode < 18);
+    PRED_INTRA_ANG4_START
 
     tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain - 2);
     row41 = extend_low(tmp16_1);    //offsets(-3,-2,-1,0)
@@ -2602,65 +2064,13 @@
     row12 = extend_low(tmp16_2);    //offsets(-1,0,1,2)
 
     v_deltaPos = v_ipAngle = -17;
-    v_deltaFract = v_deltaPos & thirty1;
-    row11 = ((thirty2 - v_deltaFract) * row11 + (v_deltaFract * row12) + 16) >> 5;
-
-    //row2
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row21 = ((thirty2 - v_deltaFract) * row21 + (v_deltaFract * row22) + 16) >> 5;
-
-    //row3
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row31 = ((thirty2 - v_deltaFract) * row31 + (v_deltaFract * row32) + 16) >> 5;
-
-    //row4
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row41 = ((thirty2 - v_deltaFract) * row41 + (v_deltaFract * row42) + 16) >> 5;
-
-    // Flip the block
-    if (modeHor)
-    {
-        Vec8s tmp1, tmp2, tmp3, tmp4;
-
-        tmp1 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row11, row31);
-        tmp2 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row21, row41);
-
-        tmp3 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(tmp1, tmp2);
-        tmp4 = blend8s<4, 12, 5, 13, 6, 14, 7, 15>(tmp1, tmp2);
-
-        tmp16_1 = compress_unsafe(tmp3, tmp3);
-        store_partial(const_int(4), pDst, tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + dstStride, tmp2uq);
-
-        tmp16_1 = compress_unsafe(tmp4, tmp4);
-        store_partial(const_int(4), pDst + (2 * dstStride), tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + (3 * dstStride), tmp2uq);
-    }
-    else
-    {
-        store_partial(const_int(4), pDst, compress_unsafe(row11, row11));
-        store_partial(const_int(4), pDst + (dstStride), compress_unsafe(row21, row21));
-        store_partial(const_int(4), pDst + (2 * dstStride), compress_unsafe(row31, row31));
-        store_partial(const_int(4), pDst + (3 * dstStride), compress_unsafe(row41, row41));
-    }
+    
+    PRED_INTRA_ANG4_END
 }
 
 void PredIntraAng4_m_21(pixel* pDst, int dstStride, pixel *refMain, int dirMode) 
 {
-    Vec8s row11, row12, row21, row22, row31, row32, row41, row42;
-    Vec16uc tmp16_1, tmp16_2;
-    Vec2uq tmp2uq;
-    Vec8s v_deltaFract, v_deltaPos(0), thirty2(32), thirty1(31), v_ipAngle(0);
-    bool modeHor = (dirMode < 18);
+    PRED_INTRA_ANG4_START
 
     tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain - 2);
     row41 = extend_low(tmp16_1);    //offsets(-3,-2,-1,0)
@@ -2686,65 +2096,12 @@
 
     v_deltaPos = v_ipAngle = -21;
 
-    v_deltaFract = v_deltaPos & thirty1;
-    row11 = ((thirty2 - v_deltaFract) * row11 + (v_deltaFract * row12) + 16) >> 5;
-
-    //row2
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row21 = ((thirty2 - v_deltaFract) * row21 + (v_deltaFract * row22) + 16) >> 5;
-
-    //row3
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row31 = ((thirty2 - v_deltaFract) * row31 + (v_deltaFract * row32) + 16) >> 5;
-
-    //row4
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row41 = ((thirty2 - v_deltaFract) * row41 + (v_deltaFract * row42) + 16) >> 5;
-
-    // Flip the block
-    if (modeHor)
-    {
-        Vec8s tmp1, tmp2, tmp3, tmp4;
-
-        tmp1 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row11, row31);
-        tmp2 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row21, row41);
-
-        tmp3 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(tmp1, tmp2);
-        tmp4 = blend8s<4, 12, 5, 13, 6, 14, 7, 15>(tmp1, tmp2);
-
-        tmp16_1 = compress_unsafe(tmp3, tmp3);
-        store_partial(const_int(4), pDst, tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + dstStride, tmp2uq);
-
-        tmp16_1 = compress_unsafe(tmp4, tmp4);
-        store_partial(const_int(4), pDst + (2 * dstStride), tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + (3 * dstStride), tmp2uq);
-    }
-    else
-    {
-        store_partial(const_int(4), pDst, compress_unsafe(row11, row11));
-        store_partial(const_int(4), pDst + (dstStride), compress_unsafe(row21, row21));
-        store_partial(const_int(4), pDst + (2 * dstStride), compress_unsafe(row31, row31));
-        store_partial(const_int(4), pDst + (3 * dstStride), compress_unsafe(row41, row41));
-    }
+    PRED_INTRA_ANG4_END
 }
 
 void PredIntraAng4_m_26(pixel* pDst, int dstStride, pixel *refMain, int dirMode) 
 {
-    Vec8s row11, row12, row21, row22, row31, row32, row41, row42;
-    Vec16uc tmp16_1, tmp16_2;
-    Vec2uq tmp2uq;
-    Vec8s v_deltaFract, v_deltaPos(0), thirty2(32), thirty1(31), v_ipAngle(0);
-    bool modeHor = (dirMode < 18);
+    PRED_INTRA_ANG4_START
 
     tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain - 3);
     row41 = extend_low(tmp16_1);    //offsets(-4,-3,-2,-1)
@@ -2773,62 +2130,12 @@
 
     v_deltaPos = v_ipAngle = -26;
 
-    v_deltaFract = v_deltaPos & thirty1;
-    row11 = ((thirty2 - v_deltaFract) * row11 + (v_deltaFract * row12) + 16) >> 5;
-
-    //row2
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row21 = ((thirty2 - v_deltaFract) * row21 + (v_deltaFract * row22) + 16) >> 5;
-
-    //row3
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row31 = ((thirty2 - v_deltaFract) * row31 + (v_deltaFract * row32) + 16) >> 5;
-
-    //row4
-    v_deltaPos += v_ipAngle;
-    v_deltaFract = v_deltaPos & thirty1;
-    row41 = ((thirty2 - v_deltaFract) * row41 + (v_deltaFract * row42) + 16) >> 5;
-
-    // Flip the block
-    if (modeHor)
-    {
-        Vec8s tmp1, tmp2, tmp3, tmp4;
-
-        tmp1 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row11, row31);
-        tmp2 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(row21, row41);
-
-        tmp3 = blend8s<0, 8, 1, 9, 2, 10, 3, 11>(tmp1, tmp2);
-        tmp4 = blend8s<4, 12, 5, 13, 6, 14, 7, 15>(tmp1, tmp2);
-
-        tmp16_1 = compress_unsafe(tmp3, tmp3);
-        store_partial(const_int(4), pDst, tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + dstStride, tmp2uq);
-
-        tmp16_1 = compress_unsafe(tmp4, tmp4);
-        store_partial(const_int(4), pDst + (2 * dstStride), tmp16_1);
-
-        tmp2uq = reinterpret_i(tmp16_1);
-        tmp2uq >>= 32;
-        store_partial(const_int(4), pDst + (3 * dstStride), tmp2uq);
-    }
-    else
-    {
-        store_partial(const_int(4), pDst, compress_unsafe(row11, row11));
-        store_partial(const_int(4), pDst + (dstStride), compress_unsafe(row21, row21));
-        store_partial(const_int(4), pDst + (2 * dstStride), compress_unsafe(row31, row31));
-        store_partial(const_int(4), pDst + (3 * dstStride), compress_unsafe(row41, row41));
-    }
+    PRED_INTRA_ANG4_END
 }
 
-void PredIntraAng4_m_32(pixel* pDst, int dstStride, pixel *refMain, int dirMode) 
+void PredIntraAng4_m_32(pixel* pDst, int dstStride, pixel *refMain, int /*dirMode*/) 
 {
     Vec16uc tmp16_1, tmp16_2;
-    dirMode++;
     tmp16_1 = (Vec16uc)load_partial(const_int(8), refMain);    //-1,0,1,2
     store_partial(const_int(4), pDst, tmp16_1);
     tmp16_2 = (Vec16uc)load_partial(const_int(8), refMain - 1); //-2,-1,0,1
@@ -2879,8 +2186,8 @@
 void xPredIntraAng4x4(int /*bitDepth*/, pixel* pDst, int dstStride, int width, int dirMode, pixel *refLeft, pixel *refAbove, bool bFilter = true)
 {
     assert(dirMode > 1); //no planar and dc
-    int mode_to_angle_table[] = {32, 26, 21, 17, 13, 9, 5, 2, 0, -2, -5, -9, -13, -17, -21, -26, -32, -26, -21, -17, -13, -9, -5, -2, 0, 2, 5, 9, 13, 17, 21, 26, 32};
-    int mode_to_invAng_table[] = {256, 315, 390, 482, 630, 910, 1638, 4096, 0, 4096, 1638, 910, 630, 482, 390, 315, 256, 315, 390, 482, 630, 910, 1638, 4096, 0, 4096, 1638, 910, 630, 482, 390, 315, 256};
+    static const int mode_to_angle_table[] = {32, 26, 21, 17, 13, 9, 5, 2, 0, -2, -5, -9, -13, -17, -21, -26, -32, -26, -21, -17, -13, -9, -5, -2, 0, 2, 5, 9, 13, 17, 21, 26, 32};
+    static const int mode_to_invAng_table[] = {256, 315, 390, 482, 630, 910, 1638, 4096, 0, 4096, 1638, 910, 630, 482, 390, 315, 256, 315, 390, 482, 630, 910, 1638, 4096, 0, 4096, 1638, 910, 630, 482, 390, 315, 256};
     int intraPredAngle = mode_to_angle_table[dirMode-2];
     int invAngle       = mode_to_invAng_table[dirMode-2];
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xhevc_workspace1-2.patch
Type: text/x-patch
Size: 39148 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20130627/6ba3957e/attachment-0001.bin>


More information about the x265-devel mailing list