[x265] [PATCH] testBench code for all_angs_intra_pred

praveen at multicorewareinc.com praveen at multicorewareinc.com
Tue Nov 26 11:20:01 CET 2013


# HG changeset patch
# User Praveen Tiwari
# Date 1385461191 -19800
# Node ID 77d3fbfa18109964f6171fcff15132b174a7da5b
# Parent  59256f18147627323fdc7c3edd5c39bf2d93abec
testBench code for all_angs_intra_pred

diff -r 59256f181476 -r 77d3fbfa1810 source/test/intrapredharness.cpp
--- a/source/test/intrapredharness.cpp	Tue Nov 26 15:19:54 2013 +0530
+++ b/source/test/intrapredharness.cpp	Tue Nov 26 15:49:51 2013 +0530
@@ -243,6 +243,56 @@
     return true;
 }
 
+bool IntraPredHarness::check_allangs_intra_primitive(const allAngsIntraPred_t ref[], const allAngsIntraPred_t opt[])
+{
+    int j = ADI_BUF_STRIDE;
+
+    bool isLuma;
+
+    for (int size = 2; size <= 5; size++)
+    {
+        if (opt[size - 2] == NULL) continue;
+
+        const int width = (1 << size);
+
+        for (int i = 0; i <= 100; i++)
+        {
+            isLuma = (width <= 16) && (rand() % 2);
+
+            pixel * refAbove0 = pixel_buff + j;
+            pixel * refLeft0 = refAbove0 + 3 * width;
+
+            pixel * refAbove1 = pixel_buff + j + 3 * FENC_STRIDE;   // keep this offset, since vector code may broken input buffer range [-(width-1), 0]
+            pixel * refLeft1 = refAbove1 + 3 * width + FENC_STRIDE;
+            refLeft0[0] = refAbove0[0] = refLeft1[0] = refAbove1[0];
+
+#if _DEBUG
+            memset(pixel_out_33_vec, 0xCD, out_size_33);
+            memset(pixel_out_33_c, 0xCD, out_size_33);
+#endif
+
+            ref[size - 2](pixel_out_33_c,   refAbove0, refLeft0, refAbove1, refLeft1, isLuma);
+            opt[size - 2](pixel_out_33_vec, refAbove0, refLeft0, refAbove1, refLeft1, isLuma);
+            for (int p = 2 - 2; p <= 34 - 2; p++)
+            {
+                for (int k = 0; k < width; k++)
+                {
+                    if (memcmp(pixel_out_33_c + p * (width * width) + k * width, pixel_out_33_vec + p * (width * width) + k * width, width))
+                    {
+                        printf("\nFailed: (%dx%d) Mode(%2d), Line[%2d], bfilter=%d\n", width, width, p + 2, k, isLuma);
+                        opt[size - 2](pixel_out_33_vec, refAbove0, refLeft0, refAbove1, refLeft1, isLuma);
+                        return false;
+                    }
+                }
+            }
+
+            j += FENC_STRIDE;
+        }
+    }
+
+    return true;
+}
+
 bool IntraPredHarness::testCorrectness(const EncoderPrimitives& ref, const EncoderPrimitives& opt)
 {
     for(int i = 0; i < NUM_SQUARE_BLOCKS; i++)
@@ -285,6 +335,14 @@
             return false;
         }
     }
+    if (opt.allAngsIntraPred[0])
+    {
+        if (!check_allangs_intra_primitive(ref.allAngsIntraPred, opt.allAngsIntraPred))
+        {
+            printf("allAngsIntraPred failed\n");
+            return false;
+        }
+    }
 
     return true;
 }
@@ -355,4 +413,21 @@
             }
         }
     }
+    for (int size = 2; size <= 6; size++)
+    {
+        if (opt.allAngsIntraPred[size - 2])
+        {
+            for (int ii = 4; ii <= 4; ii <<= 1)
+            {
+                width = ii;
+                bool bFilter  = (width <= 16);
+                pixel * refAbove = pixel_buff + srcStride;
+                pixel * refLeft = refAbove + 3 * width;
+                refLeft[0] = refAbove[0];
+                printf("allAngsIntraPred%dx%d", 1 << size, 1 << size);
+                REPORT_SPEEDUP(opt.allAngsIntraPred[size - 2], ref.allAngsIntraPred[size - 2],
+                               pixel_out_33_vec, refAbove, refLeft, refAbove, refLeft, bFilter);
+            }
+        }
+    }
 }
diff -r 59256f181476 -r 77d3fbfa1810 source/test/intrapredharness.h
--- a/source/test/intrapredharness.h	Tue Nov 26 15:19:54 2013 +0530
+++ b/source/test/intrapredharness.h	Tue Nov 26 15:49:51 2013 +0530
@@ -47,6 +47,7 @@
     bool check_planar_primitive(intra_planar_t ref, intra_planar_t opt);
     bool check_angular_primitive(intra_ang_t ref, intra_ang_t opt);
     bool check_allangs_primitive(const intra_allangs_t ref[], const intra_allangs_t opt[]);
+    bool check_allangs_intra_primitive(const allAngsIntraPred_t ref[], const allAngsIntraPred_t opt[]);
 
 public:
 


More information about the x265-devel mailing list