[x265] [PATCH] testbench: stress test support for Check_transpose

murugan at multicorewareinc.com murugan at multicorewareinc.com
Wed Jan 29 12:49:12 CET 2014


# HG changeset patch
# User Murugan Vairavel <murugan at multicorewareinc.com>
# Date 1390996123 -19800
#      Wed Jan 29 17:18:43 2014 +0530
# Node ID 5d30fc1639b71ed9f410123125ce4a7fb683875d
# Parent  8552e8cc1a3c60ddcab85e7421229c9a86d4785f
testbench: stress test support for Check_transpose

diff -r 8552e8cc1a3c -r 5d30fc1639b7 source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Tue Jan 28 08:49:01 2014 -0600
+++ b/source/test/pixelharness.cpp	Wed Jan 29 17:18:43 2014 +0530
@@ -33,12 +33,34 @@
 #define INCR   32
 #define STRIDE 64
 #define ITERS  100
+#define MAX_HEIGHT 64
+#define PAD_ROWS   64
+#define BUFFSIZE STRIDE * (MAX_HEIGHT + PAD_ROWS) + INCR * ITERS
+#define TEST_CASES 3
 
 PixelHarness::PixelHarness()
 {
-    int maxheight = 64;
-    int padrows = 64;
-    int bufsize = STRIDE * (maxheight + padrows) + INCR * ITERS;
+    int bufsize = STRIDE * (MAX_HEIGHT + PAD_ROWS) + INCR * ITERS;
+
+    /*pixel buff array */
+    pixel_test_buff = (pixel**)X265_MALLOC(pixel, TEST_CASES);
+    for (int i = 0; i < TEST_CASES; i++)
+    {
+        pixel_test_buff[i] = (pixel*)X265_MALLOC(pixel, BUFFSIZE);
+    }
+
+    /*[0] --- Random values  */
+    for (int i = 0; i < bufsize; i++)
+    {
+        pixel_test_buff[0][i] = rand() & PIXEL_MAX;
+    }
+
+    /*[1] --- Minimum       */
+    memset(pixel_test_buff[1], PIXEL_MIN, BUFFSIZE);
+
+    /*[2] --- Maximum       */
+    memset(pixel_test_buff[2], PIXEL_MAX, BUFFSIZE);
+
 
     /* 64 pixels wide, 2k deep */
     pbuf1 = (pixel*)X265_MALLOC(pixel, bufsize);
@@ -641,8 +663,9 @@
     int j = 0;
     for (int i = 0; i < ITERS; i++)
     {
-        opt(opt_dest, pbuf1 + j, STRIDE);
-        ref(ref_dest, pbuf1 + j, STRIDE);
+        int index = i % TEST_CASES;
+        opt(opt_dest, pixel_test_buff[index] + j, STRIDE);
+        ref(ref_dest, pixel_test_buff[index] + j, STRIDE);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
             return false;
diff -r 8552e8cc1a3c -r 5d30fc1639b7 source/test/pixelharness.h
--- a/source/test/pixelharness.h	Tue Jan 28 08:49:01 2014 -0600
+++ b/source/test/pixelharness.h	Wed Jan 29 17:18:43 2014 +0530
@@ -31,11 +31,11 @@
 {
 protected:
 
-    pixel *pbuf1, *pbuf2, *pbuf3, *pbuf4;
+    pixel *pbuf1, *pbuf2, *pbuf3, *pbuf4, **pixel_test_buff;
 
     int *ibuf1;
 
-    int16_t *sbuf1, *sbuf2, *sbuf3;
+    int16_t *sbuf1, *sbuf2, *sbuf3, **short_test_buff;
 
     bool check_pixelcmp(pixelcmp_t ref, pixelcmp_t opt);
     bool check_pixelcmp_sp(pixelcmp_sp_t ref, pixelcmp_sp_t opt);
diff -r 8552e8cc1a3c -r 5d30fc1639b7 source/test/testharness.h
--- a/source/test/testharness.h	Tue Jan 28 08:49:01 2014 -0600
+++ b/source/test/testharness.h	Wed Jan 29 17:18:43 2014 +0530
@@ -36,6 +36,7 @@
 #define BIT_DEPTH 8
 #endif
 #define PIXEL_MAX ((1 << BIT_DEPTH) - 1)
+#define PIXEL_MIN 0
 #define SHORT_MAX  32767
 #define SHORT_MIN -32767
 


More information about the x265-devel mailing list