[x265] [PATCH] remove width arg from intra_pred_planar

dnyaneshwar at multicorewareinc.com dnyaneshwar at multicorewareinc.com
Thu Nov 21 16:23:07 CET 2013


# HG changeset patch
# User Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
# Date 1385046767 -19800
#      Thu Nov 21 20:42:47 2013 +0530
# Node ID c89e7a06076d71152bb8b3073bbf51f8c9bb9d8f
# Parent  2a7d0c62bff43cd72ef6162a8197b3046e6c175c
remove width arg from intra_pred_planar

diff -r 2a7d0c62bff4 -r c89e7a06076d source/Lib/TLibCommon/TComPrediction.cpp
--- a/source/Lib/TLibCommon/TComPrediction.cpp	Thu Nov 21 16:42:59 2013 +0530
+++ b/source/Lib/TLibCommon/TComPrediction.cpp	Thu Nov 21 20:42:47 2013 +0530
@@ -160,7 +160,7 @@
     // Create the prediction
     if (dirMode == PLANAR_IDX)
     {
-        primitives.intra_pred_planar((pixel*)refAbv + 1, (pixel*)refLft + 1, (pixel*)dst, stride, size);
+        primitives.intra_pred_planar[log2BlkSize - 2]((pixel*)refAbv + 1, (pixel*)refLft + 1, (pixel*)dst, stride);
     }
     else if (dirMode == DC_IDX)
     {
@@ -191,7 +191,7 @@
     // get starting pixel in block
     if (dirMode == PLANAR_IDX)
     {
-        primitives.intra_pred_planar((pixel*)refAbv + width - 1 + 1, (pixel*)refLft + width - 1 + 1, (pixel*)dst, stride, width);
+        primitives.intra_pred_planar[log2BlkSize - 2]((pixel*)refAbv + width - 1 + 1, (pixel*)refLft + width - 1 + 1, (pixel*)dst, stride);
     }
     else if (dirMode == DC_IDX)
     {
diff -r 2a7d0c62bff4 -r c89e7a06076d source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Thu Nov 21 16:42:59 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Thu Nov 21 20:42:47 2013 +0530
@@ -1635,7 +1635,7 @@
             }
 
             // PLANAR
-            primitives.intra_pred_planar(abovePlanar + 1, leftPlanar + 1, tmp, scaleStride, scaleWidth);
+            primitives.intra_pred_planar[log2SizeMinus2](abovePlanar + 1, leftPlanar + 1, tmp, scaleStride);
             modeCosts[PLANAR_IDX] = costMultiplier * sa8d(fenc, scaleStride, tmp, scaleStride);
 
             // Transpose NxN
diff -r 2a7d0c62bff4 -r c89e7a06076d source/common/intrapred.cpp
--- a/source/common/intrapred.cpp	Thu Nov 21 16:42:59 2013 +0530
+++ b/source/common/intrapred.cpp	Thu Nov 21 20:42:47 2013 +0530
@@ -103,7 +103,8 @@
     }
 }
 
-void PredIntraPlanar(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, int width)
+template<int width>
+void PredIntraPlanar(pixel* above, pixel* left, pixel* dst, intptr_t dstStride)
 {
     //assert(width == height);
 
@@ -305,7 +306,13 @@
     p.intra_pred_dc[BLOCK_8x8] = PredIntraDC<8>;
     p.intra_pred_dc[BLOCK_16x16] = PredIntraDC<16>;
     p.intra_pred_dc[BLOCK_32x32] = PredIntraDC<32>;
-    p.intra_pred_planar = PredIntraPlanar;
+
+    p.intra_pred_planar[BLOCK_4x4] = PredIntraPlanar<4>;
+    p.intra_pred_planar[BLOCK_8x8] = PredIntraPlanar<8>;
+    p.intra_pred_planar[BLOCK_16x16] = PredIntraPlanar<16>;
+    p.intra_pred_planar[BLOCK_32x32] = PredIntraPlanar<32>;
+    p.intra_pred_planar[BLOCK_64x64] = PredIntraPlanar<64>;
+
     p.intra_pred_ang = PredIntraAngBufRef;
     p.intra_pred_allangs[0] = PredIntraAngs_C<4>;
     p.intra_pred_allangs[1] = PredIntraAngs_C<8>;
diff -r 2a7d0c62bff4 -r c89e7a06076d source/common/primitives.h
--- a/source/common/primitives.h	Thu Nov 21 16:42:59 2013 +0530
+++ b/source/common/primitives.h	Thu Nov 21 20:42:47 2013 +0530
@@ -164,7 +164,7 @@
 typedef void (*blockfill_s_t)(int16_t *dst, intptr_t dstride, int16_t val);
 
 typedef void (*intra_dc_t)(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, int bFilter);
-typedef void (*intra_planar_t)(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, int width);
+typedef void (*intra_planar_t)(pixel* above, pixel* left, pixel* dst, intptr_t dstStride);
 typedef void (*intra_ang_t)(pixel* dst, int dstStride, int width, int dirMode, bool bFilter, pixel *refLeft, pixel *refAbove);
 typedef void (*intra_allangs_t)(pixel *dst, pixel *above0, pixel *left0, pixel *above1, pixel *left1, bool bLuma);
 
@@ -252,7 +252,7 @@
     pixelavg_pp_t   pixelavg_pp[NUM_LUMA_PARTITIONS];
 
     intra_dc_t      intra_pred_dc[NUM_SQUARE_BLOCKS];
-    intra_planar_t  intra_pred_planar;
+    intra_planar_t  intra_pred_planar[NUM_SQUARE_BLOCKS];
     intra_ang_t     intra_pred_ang;
     intra_allangs_t intra_pred_allangs[NUM_SQUARE_BLOCKS];
     scale_t         scale1D_128to64;
diff -r 2a7d0c62bff4 -r c89e7a06076d source/common/vec/intra-sse41.cpp
--- a/source/common/vec/intra-sse41.cpp	Thu Nov 21 16:42:59 2013 +0530
+++ b/source/common/vec/intra-sse41.cpp	Thu Nov 21 20:42:47 2013 +0530
@@ -603,23 +603,6 @@
 #undef COMP_PRED_PLANAR_ROW
 }
 
-typedef void intra_pred_planar_t (pixel* above, pixel* left, pixel* dst, intptr_t dstStride);
-intra_pred_planar_t *intraPlanarN[] =
-{
-    intra_pred_planar4_sse4,
-    intra_pred_planar8_sse4,
-    intra_pred_planar16_sse4,
-    intra_pred_planar32_sse4,
-    intra_pred_planar64_sse4,
-};
-
-void intra_pred_planar(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, int width)
-{
-    int nLog2Size = g_convertToBit[width] + 2;
-
-    intraPlanarN[nLog2Size - 2](above, left, dst, dstStride);
-}
-
 ALIGN_VAR_32(static const unsigned char, tab_angle_0[][16]) =
 {
     { 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8 },         //  0
@@ -8707,7 +8690,12 @@
 #else
     initFileStaticVars();
 
-    p.intra_pred_planar = intra_pred_planar;
+    p.intra_pred_planar[BLOCK_4x4]   = intra_pred_planar4_sse4;
+    p.intra_pred_planar[BLOCK_8x8]   = intra_pred_planar8_sse4;
+    p.intra_pred_planar[BLOCK_16x16] = intra_pred_planar16_sse4;
+    p.intra_pred_planar[BLOCK_32x32] = intra_pred_planar32_sse4;
+    p.intra_pred_planar[BLOCK_64x64] = intra_pred_planar64_sse4;
+
     p.intra_pred_dc[BLOCK_4x4] = intra_pred_dc<4>;
     p.intra_pred_dc[BLOCK_8x8] = intra_pred_dc<8>;
     p.intra_pred_dc[BLOCK_16x16] = intra_pred_dc<16>;
diff -r 2a7d0c62bff4 -r c89e7a06076d source/encoder/compress.cpp
--- a/source/encoder/compress.cpp	Thu Nov 21 16:42:59 2013 +0530
+++ b/source/encoder/compress.cpp	Thu Nov 21 20:42:47 2013 +0530
@@ -161,7 +161,7 @@
     }
 
     // PLANAR
-    primitives.intra_pred_planar(abovePlanar + 1, leftPlanar + 1, tmp, scaleStride, scaleWidth);
+    primitives.intra_pred_planar[log2SizeMinus2](abovePlanar + 1, leftPlanar + 1, tmp, scaleStride);
     sad = costMultiplier * sa8d(fenc, scaleStride, tmp, scaleStride);
     mode = PLANAR_IDX;
     bits = m_search->xModeBitsIntra(cu, mode, partOffset, depth, initTrDepth);
diff -r 2a7d0c62bff4 -r c89e7a06076d source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Thu Nov 21 16:42:59 2013 +0530
+++ b/source/encoder/slicetype.cpp	Thu Nov 21 20:42:47 2013 +0530
@@ -569,7 +569,7 @@
         primitives.intra_pred_dc[nLog2SizeMinus2](pAbove0 + 1, pLeft0 + 1, predictions, cuSize, (cuSize <= 16));
         pixel *above = (cuSize >= 8) ? pAbove1 : pAbove0;
         pixel *left  = (cuSize >= 8) ? pLeft1 : pLeft0;
-        primitives.intra_pred_planar((pixel*)above + 1, (pixel*)left + 1, predictions + predsize, cuSize, cuSize);
+        primitives.intra_pred_planar[nLog2SizeMinus2]((pixel*)above + 1, (pixel*)left + 1, predictions + predsize, cuSize);
         primitives.intra_pred_allangs[nLog2SizeMinus2](predictions + 2 * predsize, pAbove0, pLeft0, pAbove1, pLeft1, (cuSize <= 16));
 
         // calculate 35 satd costs, keep least cost
diff -r 2a7d0c62bff4 -r c89e7a06076d source/test/intrapredharness.cpp
--- a/source/test/intrapredharness.cpp	Thu Nov 21 16:42:59 2013 +0530
+++ b/source/test/intrapredharness.cpp	Thu Nov 21 20:42:47 2013 +0530
@@ -127,16 +127,16 @@
             memset(pixel_out_vec, 0xCD, out_size);
             memset(pixel_out_c, 0xCD, out_size);
 #endif
-            ref(pixel_buff + j - ADI_BUF_STRIDE, left + 1, pixel_out_c,   FENC_STRIDE, width);
-            opt(pixel_buff + j - ADI_BUF_STRIDE, left + 1, pixel_out_vec, FENC_STRIDE, width);
+            ref(pixel_buff + j - ADI_BUF_STRIDE, left + 1, pixel_out_c,   FENC_STRIDE);
+            opt(pixel_buff + j - ADI_BUF_STRIDE, left + 1, pixel_out_vec, FENC_STRIDE);
 
             for (int k = 0; k < width; k++)
             {
                 if (memcmp(pixel_out_vec + k * FENC_STRIDE, pixel_out_c + k * FENC_STRIDE, width))
                 {
 #if _DEBUG
-                    ref(pixel_buff + j - ADI_BUF_STRIDE, left + 1, pixel_out_c,   FENC_STRIDE, width);
-                    opt(pixel_buff + j - ADI_BUF_STRIDE, left + 1, pixel_out_vec, FENC_STRIDE, width);
+                    ref(pixel_buff + j - ADI_BUF_STRIDE, left + 1, pixel_out_c,   FENC_STRIDE);
+                    opt(pixel_buff + j - ADI_BUF_STRIDE, left + 1, pixel_out_vec, FENC_STRIDE);
 #endif
                     return false;
                 }
@@ -257,12 +257,16 @@
             }
         }
     }
-    if (opt.intra_pred_planar)
+    for (int i = 0; i < NUM_SQUARE_BLOCKS; i++)
     {
-        if (!check_planar_primitive(ref.intra_pred_planar, opt.intra_pred_planar))
+        if (opt.intra_pred_planar[i])
         {
-            printf("intra_planar failed\n");
-            return false;
+            const int size = (1 << (i + 2));
+            if (!check_planar_primitive(ref.intra_pred_planar[i], opt.intra_pred_planar[i]))
+            {
+                printf("intra_planar %dx%d failed\n", size, size);
+                return false;
+            }
         }
     }
     if (opt.intra_pred_ang)
@@ -306,14 +310,14 @@
             }
         }
     }
-    if (opt.intra_pred_planar)
+    for(int i = 0; i < NUM_SQUARE_BLOCKS; i++)
     {
-        for (int ii = 4; ii <= 64; ii <<= 1)
+        if (opt.intra_pred_planar[i])
         {
-            width = ii;
-            printf("intra_planar%2dx%d", ii, ii);
-            REPORT_SPEEDUP(opt.intra_pred_planar, ref.intra_pred_planar,
-                           pixel_buff + srcStride, pixel_buff, pixel_out_vec, FENC_STRIDE, width);
+            const int size = (1 << (i + 2));
+            printf("intra_planar %2dx%d", size, size);
+            REPORT_SPEEDUP(opt.intra_pred_planar[i], ref.intra_pred_planar[i],
+                        pixel_buff + srcStride, pixel_buff, pixel_out_vec, FENC_STRIDE);
         }
     }
     if (opt.intra_pred_ang)


More information about the x265-devel mailing list