[x265] [PATCH] testbench: stress test support for all pixelharness functions

murugan at multicorewareinc.com murugan at multicorewareinc.com
Wed Feb 5 10:15:09 CET 2014


# HG changeset patch
# User Murugan Vairavel <murugan at multicorewareinc.com>
# Date 1391587174 -19800
#      Wed Feb 05 13:29:34 2014 +0530
# Node ID a1340841f9ecd35e11e66ba2bf0808ac3baeecb7
# Parent  1374f1168c5cbb97a893172e37bd9f5c6ed5690c
testbench: stress test support for all pixelharness functions

diff -r 1374f1168c5c -r a1340841f9ec source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Wed Feb 05 12:59:57 2014 +0530
+++ b/source/test/pixelharness.cpp	Wed Feb 05 13:29:34 2014 +0530
@@ -33,39 +33,84 @@
 #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
+#define SMAX (1 << 12)
+#define SMIN (-1 << 12)
 
 PixelHarness::PixelHarness()
 {
-    int maxheight = 64;
-    int padrows = 64;
-    int bufsize = STRIDE * (maxheight + padrows) + INCR * ITERS;
+    int bufsize = STRIDE * (MAX_HEIGHT + PAD_ROWS) + INCR * ITERS;
 
     /* 64 pixels wide, 2k deep */
-    pbuf1 = X265_MALLOC(pixel, bufsize);
-    pbuf2 = X265_MALLOC(pixel, bufsize);
-    pbuf3 = X265_MALLOC(pixel, bufsize);
-    pbuf4 = X265_MALLOC(pixel, bufsize);
+    pbuf1 = (pixel*)X265_MALLOC(pixel, bufsize);
+    pbuf2 = (pixel*)X265_MALLOC(pixel, bufsize);
+    pbuf3 = (pixel*)X265_MALLOC(pixel, bufsize);
+    pbuf4 = (pixel*)X265_MALLOC(pixel, bufsize);
 
-    ibuf1 = X265_MALLOC(int, bufsize);
+    ibuf1 = (int*)X265_MALLOC(int, bufsize);
 
-    sbuf1 = X265_MALLOC(int16_t, bufsize);
-    sbuf2 = X265_MALLOC(int16_t, bufsize);
-    sbuf3 = X265_MALLOC(int16_t, bufsize);
+    sbuf1 = (int16_t*)X265_MALLOC(int16_t, bufsize);
+    sbuf2 = (int16_t*)X265_MALLOC(int16_t, bufsize);
+    sbuf3 = (int16_t*)X265_MALLOC(int16_t, bufsize);
 
-    if (!pbuf1 || !pbuf2 || !pbuf3 || !pbuf4 || !sbuf1 || !sbuf2 || !sbuf3 || !ibuf1)
+    /*Test Case buffer array */
+    pixel_test_buff  = (pixel**)X265_MALLOC(pixel*, TEST_CASES);
+    short_test_buff  = (int16_t**)X265_MALLOC(int16_t*, TEST_CASES);
+    short_test_buff1 = (int16_t**)X265_MALLOC(int16_t*, TEST_CASES);
+    int_test_buff    = (int**)X265_MALLOC(int*, TEST_CASES);
+
+    if (!pbuf1 || !pbuf2 || !pbuf3 || !pbuf4 || !sbuf1 || !sbuf2 || !sbuf3 || !ibuf1 ||
+        !pixel_test_buff || !short_test_buff || !int_test_buff || !short_test_buff1)
     {
         fprintf(stderr, "malloc failed, unable to initiate tests!\n");
         exit(1);
     }
 
+    for (int i = 0; i < TEST_CASES; i++)
+    {
+        pixel_test_buff[i]  = (pixel*)X265_MALLOC(pixel, BUFFSIZE);
+        short_test_buff[i]  = (int16_t*)X265_MALLOC(int16_t, BUFFSIZE);
+        short_test_buff1[i] = (int16_t*)X265_MALLOC(int16_t, BUFFSIZE);
+        int_test_buff[i]    = (int*)X265_MALLOC(int, BUFFSIZE);
+        if (!pixel_test_buff[i] || !short_test_buff[i] || !int_test_buff[i] || !short_test_buff1[i])
+        {
+            fprintf(stderr, "Init_Test_Case_buffers: malloc failed, unable to initiate tests!\n");
+            exit(-1);
+        }
+    }
+
+    /*[0] --- Random values  */
+    /*[1] --- Minimum        */
+    /*[2] --- Maximum        */
+
+    for (int i = 0; i < BUFFSIZE; i++)
+    {
+        pixel_test_buff[0][i]   = rand() % PIXEL_MAX;
+        short_test_buff[0][i]   = (rand() % (2 * SMAX + 1)) - SMAX - 1; //max(SHORT_MIN, min(rand(), SMAX));
+        short_test_buff1[0][i]  = rand() & PIXEL_MAX;                  //For block copy only
+        int_test_buff[0][i]     = rand() % INT32_MAX;
+
+        pixel_test_buff[1][i]   = PIXEL_MIN;
+        short_test_buff[1][i]   = SMIN;
+        short_test_buff1[1][i]  = PIXEL_MIN;
+        int_test_buff[1][i]     = SHORT_MIN;
+
+        pixel_test_buff[2][i]   = PIXEL_MAX;
+        short_test_buff[2][i]   = SMAX;
+        short_test_buff1[2][i]  = PIXEL_MAX;
+        int_test_buff[2][i]     = SHORT_MAX;
+    }
+
+
     for (int i = 0; i < bufsize; i++)
     {
         pbuf1[i] = rand() & PIXEL_MAX;
         pbuf2[i] = rand() & PIXEL_MAX;
         pbuf3[i] = rand() & PIXEL_MAX;
         pbuf4[i] = rand() & PIXEL_MAX;
-
-#define SMAX (1 << 12)
         sbuf1[i] = (rand() % (2 * SMAX + 1)) - SMAX - 1; //max(SHORT_MIN, min(rand(), SMAX));
         sbuf2[i] = (rand() % (2 * SMAX + 1)) - SMAX - 1; //max(SHORT_MIN, min(rand(), SMAX));
         ibuf1[i] = (rand() % (2 * SMAX + 1)) - SMAX - 1;
@@ -83,6 +128,17 @@
     X265_FREE(sbuf1);
     X265_FREE(sbuf2);
     X265_FREE(sbuf3);
+    for (int i = 0; i < TEST_CASES; i++)
+    {
+        X265_FREE(pixel_test_buff[i]);
+        X265_FREE(short_test_buff[i]);
+        X265_FREE(short_test_buff1[i]);
+        X265_FREE(int_test_buff[i]);
+    }
+    X265_FREE(pixel_test_buff);
+    X265_FREE(short_test_buff);
+    X265_FREE(short_test_buff1);
+    X265_FREE(int_test_buff);
 }
 
 bool PixelHarness::check_pixelcmp(pixelcmp_t ref, pixelcmp_t opt)
@@ -91,8 +147,10 @@
 
     for (int i = 0; i < ITERS; i++)
     {
-        int vres = opt(pbuf1, STRIDE, pbuf2 + j, STRIDE);
-        int cres = ref(pbuf1, STRIDE, pbuf2 + j, STRIDE);
+        int index1 = rand() % TEST_CASES;
+        int index2 = rand() % TEST_CASES;
+        int vres = opt(pixel_test_buff[index1], STRIDE, pixel_test_buff[index2] + j, STRIDE);
+        int cres = ref(pixel_test_buff[index1], STRIDE, pixel_test_buff[index2] + j, STRIDE);
         if (vres != cres)
             return false;
 
@@ -108,8 +166,10 @@
 
     for (int i = 0; i < ITERS; i++)
     {
-        int vres = opt(sbuf1, STRIDE, pbuf2 + j, STRIDE);
-        int cres = ref(sbuf1, STRIDE, pbuf2 + j, STRIDE);
+        int index1 = rand() % TEST_CASES;
+        int index2 = rand() % TEST_CASES;
+        int vres = opt(short_test_buff[index1], STRIDE,pixel_test_buff[index2] + j, STRIDE);
+        int cres = ref(short_test_buff[index1], STRIDE,pixel_test_buff[index2] + j, STRIDE);
         if (vres != cres)
             return false;
 
@@ -125,8 +185,10 @@
 
     for (int i = 0; i < ITERS; i++)
     {
-        int vres = opt(sbuf1, STRIDE, sbuf2 + j, STRIDE);
-        int cres = ref(sbuf1, STRIDE, sbuf2 + j, STRIDE);
+        int index1 = rand() % TEST_CASES;
+        int index2 = rand() % TEST_CASES;
+        int vres = opt(short_test_buff[index1], STRIDE,short_test_buff[index2] + j, STRIDE);
+        int cres = ref(short_test_buff[index1], STRIDE,short_test_buff[index2] + j, STRIDE);
         if (vres != cres)
             return false;
 
@@ -143,9 +205,16 @@
     int j = 0;
     for (int i = 0; i < ITERS; i++)
     {
-        opt(pbuf1, pbuf2 + j, pbuf2 + j + 1, pbuf2 + j + 2, FENC_STRIDE - 5, &vres[0]);
-        ref(pbuf1, pbuf2 + j, pbuf2 + j + 1, pbuf2 + j + 2, FENC_STRIDE - 5, &cres[0]);
-
+        int index1 = rand() % TEST_CASES;
+        int index2 = rand() % TEST_CASES;
+        opt(pixel_test_buff[index1],
+            pixel_test_buff[index2] + j,
+            pixel_test_buff[index2] + j + 1,
+            pixel_test_buff[index2] + j + 2, FENC_STRIDE - 5, &vres[0]);
+        ref(pixel_test_buff[index1],
+            pixel_test_buff[index2] + j,
+            pixel_test_buff[index2] + j + 1,
+            pixel_test_buff[index2] + j + 2, FENC_STRIDE - 5, &cres[0]);
         if ((vres[0] != cres[0]) || ((vres[1] != cres[1])) || ((vres[2] != cres[2])))
             return false;
 
@@ -162,8 +231,18 @@
     int j = 0;
     for (int i = 0; i < ITERS; i++)
     {
-        opt(pbuf1, pbuf2 + j, pbuf2 + j + 1, pbuf2 + j + 2, pbuf2 + j + 3, FENC_STRIDE - 5, &vres[0]);
-        ref(pbuf1, pbuf2 + j, pbuf2 + j + 1, pbuf2 + j + 2, pbuf2 + j + 3, FENC_STRIDE - 5, &cres[0]);
+        int index1 = rand() % TEST_CASES;
+        int index2 = rand() % TEST_CASES;
+        opt(pixel_test_buff[index1],
+            pixel_test_buff[index2] + j,
+            pixel_test_buff[index2] + j + 1,
+            pixel_test_buff[index2] + j + 2,
+            pixel_test_buff[index2] + j + 3, FENC_STRIDE - 5, &vres[0]);
+        ref(pixel_test_buff[index1],
+            pixel_test_buff[index2] + j,
+            pixel_test_buff[index2] + j + 1,
+            pixel_test_buff[index2] + j + 2,
+            pixel_test_buff[index2] + j + 3, FENC_STRIDE - 5, &cres[0]);
 
         if ((vres[0] != cres[0]) || ((vres[1] != cres[1])) || ((vres[2] != cres[2])) || ((vres[3] != cres[3])))
             return false;
@@ -183,8 +262,9 @@
     int j = 0;
     for (int i = 0; i < ITERS; i++)
     {
-        opt(bx, by, opt_dest, 64, pbuf2 + j, 128);
-        ref(bx, by, ref_dest, 64, pbuf2 + j, 128);
+        int index = i % TEST_CASES;
+        opt(bx, by, opt_dest, 64, pixel_test_buff[index] + j, 128);
+        ref(bx, by, ref_dest, 64, pixel_test_buff[index] + j, 128);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
             return false;
@@ -206,8 +286,9 @@
     int j = 0;
     for (int i = 0; i < ITERS; i++)
     {
-        opt(bx, by, opt_dest, 64, (int16_t*)sbuf3 + j, STRIDE);
-        ref(bx, by, ref_dest, 64, (int16_t*)sbuf3 + j, STRIDE);
+        int index = i % TEST_CASES;
+        opt(bx, by, opt_dest, 64, short_test_buff1[index] + j, STRIDE);
+        ref(bx, by, ref_dest, 64, short_test_buff1[index] + j, STRIDE);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
             return false;
@@ -230,8 +311,9 @@
     int j = 0;
     for (int i = 0; i < ITERS; i++)
     {
-        opt(pbuf1 + j, pbuf2 + j, opt_dest, STRIDE);
-        ref(pbuf1 + j, pbuf2 + j, ref_dest, STRIDE);
+        int index = i % TEST_CASES;
+        opt(pbuf1 + j, pixel_test_buff[index] + j, opt_dest, STRIDE);
+        ref(pbuf1 + j, pixel_test_buff[index] + j, ref_dest, STRIDE);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t)))
             return false;
@@ -268,8 +350,12 @@
     for (int i = 0; i < ITERS; i++)
     {
         int stride = STRIDE;
-        ref(pbuf1 + j, sbuf1 + j, ref_reco, ref_recq, ref_pred, stride, stride, stride);
-        opt(pbuf1 + j, sbuf1 + j, opt_reco, opt_recq, opt_pred, stride, stride, stride);
+        int index1 = rand() % TEST_CASES;
+        int index2 = rand() % TEST_CASES;
+        ref(pixel_test_buff[index1] + j,short_test_buff[index2] + j,
+            ref_reco, ref_recq, ref_pred, stride, stride, stride);
+        opt(pixel_test_buff[index1] + j,short_test_buff[index2] + j,
+            opt_reco, opt_recq, opt_pred, stride, stride, stride);
 
         if (memcmp(ref_recq, opt_recq, 64 * 64 * sizeof(int16_t)))
         {
@@ -295,7 +381,6 @@
 
         j += INCR;
     }
-
 #if HIGH_BIT_DEPTH
     X265_DEPTH = old_depth;
 #endif
@@ -318,8 +403,9 @@
     int offset = (rand() % 256) - 128;
     for (int i = 0; i < ITERS; i++)
     {
-        opt((int16_t*)sbuf1 + j, opt_dest, 64, 64, width, height, w0, round, shift, offset);
-        ref((int16_t*)sbuf1 + j, ref_dest, 64, 64, width, height, w0, round, shift, offset);
+        int index = i % TEST_CASES;
+        opt(short_test_buff[index] + j, opt_dest, 64, 64, width, height, w0, round, shift, offset);
+        ref(short_test_buff[index] + j, ref_dest, 64, 64, width, height, w0, round, shift, offset);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
             return false;
@@ -346,8 +432,9 @@
     int offset = (rand() % 256) - 128;
     for (int i = 0; i < ITERS; i++)
     {
-        opt(pbuf1 + j, opt_dest, 64, 64, width, height, w0, round, shift, offset);
-        ref(pbuf1 + j, ref_dest, 64, 64, width, height, w0, round, shift, offset);
+        int index = i % TEST_CASES;
+        opt(pixel_test_buff[index] + j, opt_dest, 64, 64, width, height, w0, round, shift, offset);
+        ref(pixel_test_buff[index] + j, ref_dest, 64, 64, width, height, w0, round, shift, offset);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
             return false;
@@ -367,8 +454,12 @@
     int j = 0;
     for (int i = 0; i < ITERS; i++)
     {
-        opt(bx, by, opt_dest, STRIDE, sbuf2 + j, sbuf1 + j, STRIDE, STRIDE);
-        ref(bx, by, ref_dest, STRIDE, sbuf2 + j, sbuf1 + j, STRIDE, STRIDE);
+        int index1 = rand() % TEST_CASES;
+        int index2 = rand() % TEST_CASES;
+        opt(bx, by, opt_dest, STRIDE, short_test_buff[index1] + j,
+            short_test_buff[index2] + j, STRIDE, STRIDE);
+        ref(bx, by, ref_dest, STRIDE, short_test_buff[index1] + j,
+            short_test_buff[index2] + j, STRIDE, STRIDE);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t)))
             return false;
@@ -402,8 +493,11 @@
     int j = 0;
     for (int i = 0; i < ITERS; i++)
     {
-        ref(pbuf2 + j, ref_destf, ref_desth, ref_destv, ref_destc, src_stride, dst_stride, bx, by);
-        opt(pbuf2 + j, opt_destf, opt_desth, opt_destv, opt_destc, src_stride, dst_stride, bx, by);
+        int index = i % TEST_CASES;
+        ref(pixel_test_buff[index] + j, ref_destf, ref_desth, ref_destv,
+            ref_destc, src_stride, dst_stride, bx, by);
+        opt(pixel_test_buff[index] + j, opt_destf, opt_desth, opt_destv,
+            opt_destc, src_stride, dst_stride, bx, by);
 
         if (memcmp(ref_destf, opt_destf, 32 * 32 * sizeof(pixel)))
             return false;
@@ -430,8 +524,9 @@
     {
         int shift = (rand() % 7 + 1);
 
-        opt(opt_dest, ibuf1 + j, STRIDE, shift, STRIDE);
-        ref(ref_dest, ibuf1 + j, STRIDE, shift, STRIDE);
+        int index = i % TEST_CASES;
+        opt(opt_dest, int_test_buff[index] + j, STRIDE, shift, STRIDE);
+        ref(ref_dest, int_test_buff[index] + j, STRIDE, shift, STRIDE);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t)))
             return false;
@@ -452,8 +547,9 @@
     {
         int shift = (rand() % 7 + 1);
 
-        opt(opt_dest, sbuf1 + j, STRIDE, shift, STRIDE);
-        ref(ref_dest, sbuf1 + j, STRIDE, shift, STRIDE);
+        int index = i % TEST_CASES;
+        opt(opt_dest, short_test_buff[index] + j, STRIDE, shift, STRIDE);
+        ref(ref_dest, short_test_buff[index] + j, STRIDE, shift, STRIDE);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int32_t)))
             return false;
@@ -476,8 +572,12 @@
 
     for (int i = 0; i < ITERS; i++)
     {
-        ref(ref_dest, STRIDE, pbuf1 + j, STRIDE, pbuf2 + j, STRIDE, 32);
-        opt(opt_dest, STRIDE, pbuf1 + j, STRIDE, pbuf2 + j, STRIDE, 32);
+        int index1 = rand() % TEST_CASES;
+        int index2 = rand() % TEST_CASES;
+        ref(ref_dest, STRIDE, pixel_test_buff[index1] + j,
+            STRIDE, pixel_test_buff[index2] + j, STRIDE, 32);
+        opt(opt_dest, STRIDE, pixel_test_buff[index1] + j,
+            STRIDE, pixel_test_buff[index2] + j, STRIDE, 32);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
             return false;
@@ -501,8 +601,9 @@
     int j = 0;
     for (int i = 0; i < ITERS; i++)
     {
-        opt(opt_dest, STRIDE, pbuf2 + j, STRIDE);
-        ref(ref_dest, STRIDE, pbuf2 + j, STRIDE);
+        int index = i % TEST_CASES;
+        opt(opt_dest, STRIDE, pixel_test_buff[index] + j, STRIDE);
+        ref(ref_dest, STRIDE, pixel_test_buff[index] + j, STRIDE);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
             return false;
@@ -526,8 +627,9 @@
     int j = 0;
     for (int i = 0; i < ITERS; i++)
     {
-        opt(opt_dest, 64, sbuf3 + j, STRIDE);
-        ref(ref_dest, 64, sbuf3 + j, STRIDE);
+        int index = i % TEST_CASES;
+        opt(opt_dest, 64, short_test_buff1[index] + j, STRIDE);
+        ref(ref_dest, 64, short_test_buff1[index] + j, STRIDE);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
             return false;
@@ -551,8 +653,9 @@
     int j = 0;
     for (int i = 0; i < ITERS; i++)
     {
-        opt(opt_dest, STRIDE, pbuf2 + j, STRIDE);
-        ref(ref_dest, STRIDE, pbuf2 + j, STRIDE);
+        int index = i % TEST_CASES;
+        opt(opt_dest, STRIDE, pixel_test_buff[index] + j, STRIDE);
+        ref(ref_dest, STRIDE, pixel_test_buff[index] + j, STRIDE);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t)))
             return false;
@@ -596,8 +699,12 @@
     int j = 0;
     for (int i = 0; i < 1; i++)
     {
-        opt(opt_dest, 64, pbuf2 + j, pbuf1 + j, STRIDE, STRIDE);
-        ref(ref_dest, 64, pbuf2 + j, pbuf1 + j, STRIDE, STRIDE);
+        int index1 = rand() % TEST_CASES;
+        int index2 = rand() % TEST_CASES;
+        opt(opt_dest, 64, pixel_test_buff[index1] + j,
+            pixel_test_buff[index2] + j, STRIDE, STRIDE);
+        ref(ref_dest, 64, pixel_test_buff[index1] + j,
+            pixel_test_buff[index2] + j, STRIDE, STRIDE);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t)))
             return false;
@@ -619,8 +726,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;
@@ -642,8 +750,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;
@@ -670,8 +779,10 @@
     int j = 0;
     for (int i = 0; i < ITERS; i++)
     {
-        opt(opt_dest, 64, pbuf1 + j, sbuf1 + j, STRIDE, STRIDE);
-        ref(ref_dest, 64, pbuf1 + j, sbuf1 + j, STRIDE, STRIDE);
+        int index1 = rand() % TEST_CASES;
+        int index2 = rand() % TEST_CASES;
+        opt(opt_dest, 64, pixel_test_buff[index1] + j, short_test_buff[index2] + j, STRIDE, STRIDE);
+        ref(ref_dest, 64, pixel_test_buff[index1] + j, short_test_buff[index2] + j, STRIDE, STRIDE);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
         {
@@ -695,8 +806,9 @@
 
     for (int i = 0; i < ITERS; i++)
     {
-        uint64_t vres = opt(pbuf1, STRIDE);
-        uint64_t cres = ref(pbuf1, STRIDE);
+        int index = i % TEST_CASES;
+        uint64_t vres = opt(pixel_test_buff[index], STRIDE);
+        uint64_t cres = ref(pixel_test_buff[index], STRIDE);
         if (vres != cres)
             return false;
 
@@ -714,8 +826,10 @@
     for (int i = 0; i < ITERS; i++)
     {
         int stride = rand() % 64;
-        ref(pbuf1 + i, stride, pbuf2 + i, stride, sum0);
-        opt(pbuf1 + i, stride, pbuf2 + i, stride, sum1);
+        int index1 = rand() % TEST_CASES;
+        int index2 = rand() % TEST_CASES;
+        ref(pixel_test_buff[index1] + i, stride, pixel_test_buff[index2] + i, stride, sum0);
+        opt(pixel_test_buff[index1] + i, stride, pixel_test_buff[index2] + i, stride, sum1);
 
         if (memcmp(sum0, sum1, sizeof(sum0)))
             return false;
@@ -776,8 +890,10 @@
 
     for (int i = 0; i < ITERS; i++)
     {
-        ref(sbuf1 + j, sbuf2 + j, ref_dest, STRIDE, STRIDE, STRIDE);
-        opt(sbuf1 + j, sbuf2 + j, opt_dest, STRIDE, STRIDE, STRIDE);
+        int index1 = rand() % TEST_CASES;
+        int index2 = rand() % TEST_CASES;
+        ref(short_test_buff[index1] + j, short_test_buff[index2] + j, ref_dest, STRIDE, STRIDE, STRIDE);
+        opt(short_test_buff[index1] + j, short_test_buff[index2] + j, opt_dest, STRIDE, STRIDE, STRIDE);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
             return false;
diff -r 1374f1168c5c -r a1340841f9ec source/test/pixelharness.h
--- a/source/test/pixelharness.h	Wed Feb 05 12:59:57 2014 +0530
+++ b/source/test/pixelharness.h	Wed Feb 05 13:29:34 2014 +0530
@@ -31,11 +31,11 @@
 {
 protected:
 
-    pixel *pbuf1, *pbuf2, *pbuf3, *pbuf4;
+    pixel *pbuf1, *pbuf2, *pbuf3, *pbuf4, **pixel_test_buff;
 
-    int *ibuf1;
+    int *ibuf1, **int_test_buff;
 
-    int16_t *sbuf1, *sbuf2, *sbuf3;
+    int16_t *sbuf1, *sbuf2, *sbuf3, **short_test_buff, **short_test_buff1;
 
     bool check_pixelcmp(pixelcmp_t ref, pixelcmp_t opt);
     bool check_pixelcmp_sp(pixelcmp_sp_t ref, pixelcmp_sp_t opt);


More information about the x265-devel mailing list