[x265] [PATCH] testbench: stress test support for all pixelharness functions
murugan at multicorewareinc.com
murugan at multicorewareinc.com
Mon Feb 3 13:29:37 CET 2014
# HG changeset patch
# User Murugan Vairavel <murugan at multicorewareinc.com>
# Date 1391430556 -19800
# Mon Feb 03 17:59:16 2014 +0530
# Node ID f8884c624aef2d904b91605e95912eb5b52caf79
# Parent aab88ed133647b779b0a1ca33a1e20584103ef7d
testbench: stress test support for all pixelharness functions
diff -r aab88ed13364 -r f8884c624aef source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp Sun Feb 02 13:09:26 2014 -0600
+++ b/source/test/pixelharness.cpp Mon Feb 03 17:59:16 2014 +0530
@@ -33,12 +33,31 @@
#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;
+
+ /* Array for test case selection */
+ test_case_selection = (int*)X265_MALLOC(int, TEST_CASES * TEST_CASES * 2);
+ int k=0, j=0;
+ for(int i = 0; i<TEST_CASES*TEST_CASES*2; i+=2)
+ {
+ test_case_selection[i] = k;
+ test_case_selection[i + 1] = j;
+ j++;
+ if(j == TEST_CASES)
+ {
+ k++;
+ j=0;
+ }
+ }
/* 64 pixels wide, 2k deep */
pbuf1 = (pixel*)X265_MALLOC(pixel, bufsize);
@@ -52,20 +71,64 @@
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 */
+ 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;
+ }
+
+ /*[1] --- Minimum */
+ memset(pixel_test_buff[1], PIXEL_MIN, sizeof(pixel) * BUFFSIZE);
+ memset(short_test_buff1[1], PIXEL_MIN, sizeof(int16_t) * BUFFSIZE);
+ short_test_buff[1][0] = SMIN;
+ memcpy(&short_test_buff[1][1], &short_test_buff[1][0], sizeof(int16_t) * BUFFSIZE - 2);
+ int_test_buff[1][0] = SHORT_MIN;
+ memcpy(&int_test_buff[1][1], &int_test_buff[1][0], sizeof(int) * BUFFSIZE - 2);
+
+ /*[2] --- Maximum */
+ memset(pixel_test_buff[2], PIXEL_MAX, sizeof(pixel) * BUFFSIZE);
+ short_test_buff[2][0] = SMAX;
+ memcpy(&short_test_buff[2][1], &short_test_buff[2][0], sizeof(int16_t) * BUFFSIZE - 2);
+ short_test_buff1[2][0] = PIXEL_MAX;
+ memcpy(&short_test_buff1[2][1], &short_test_buff1[2][0], sizeof(int16_t) * BUFFSIZE - 2);
+ int_test_buff[2][0] = SHORT_MAX;
+ memcpy(&int_test_buff[2][1], &int_test_buff[2][0], sizeof(int) * BUFFSIZE - 2);
+
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 +146,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 +165,11 @@
for (int i = 0; i < ITERS; i++)
{
- int vres = opt(pbuf1, STRIDE, pbuf2 + j, STRIDE);
- int cres = ref(pbuf1, STRIDE, pbuf2 + j, STRIDE);
+ int index = i % (TEST_CASES * TEST_CASES);
+ int vres = opt(pixel_test_buff[test_case_selection[2*index]],STRIDE,
+ pixel_test_buff[test_case_selection[2*index + 1]] + j, STRIDE);
+ int cres = ref(pixel_test_buff[test_case_selection[2*index]], STRIDE,
+ pixel_test_buff[test_case_selection[2*index + 1]] + j, STRIDE);
if (vres != cres)
return false;
@@ -108,8 +185,11 @@
for (int i = 0; i < ITERS; i++)
{
- int vres = opt(sbuf1, STRIDE, pbuf2 + j, STRIDE);
- int cres = ref(sbuf1, STRIDE, pbuf2 + j, STRIDE);
+ int index = i % (TEST_CASES * TEST_CASES);
+ int vres = opt(short_test_buff[test_case_selection[2*index]], STRIDE,
+ pixel_test_buff[test_case_selection[2*index + 1]] + j, STRIDE);
+ int cres = ref(short_test_buff[test_case_selection[2*index]], STRIDE,
+ pixel_test_buff[test_case_selection[2*index + 1]] + j, STRIDE);
if (vres != cres)
return false;
@@ -125,8 +205,11 @@
for (int i = 0; i < ITERS; i++)
{
- int vres = opt(sbuf1, STRIDE, sbuf2 + j, STRIDE);
- int cres = ref(sbuf1, STRIDE, sbuf2 + j, STRIDE);
+ int index = i % (TEST_CASES * TEST_CASES);
+ int vres = opt(short_test_buff[test_case_selection[2*index]], STRIDE,
+ short_test_buff[test_case_selection[2*index + 1]] + j, STRIDE);
+ int cres = ref(short_test_buff[test_case_selection[2*index]], STRIDE,
+ short_test_buff[test_case_selection[2*index + 1]] + j, STRIDE);
if (vres != cres)
return false;
@@ -143,9 +226,15 @@
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 index = i % (TEST_CASES * TEST_CASES);
+ opt(pixel_test_buff[test_case_selection[2*index]],
+ pixel_test_buff[test_case_selection[2*index + 1]] + j,
+ pixel_test_buff[test_case_selection[2*index + 1]] + j + 1,
+ pixel_test_buff[test_case_selection[2*index + 1]] + j + 2, FENC_STRIDE - 5, &vres[0]);
+ ref(pixel_test_buff[test_case_selection[2*index]],
+ pixel_test_buff[test_case_selection[2*index + 1]] + j,
+ pixel_test_buff[test_case_selection[2*index + 1]] + j + 1,
+ pixel_test_buff[test_case_selection[2*index + 1]] + j + 2, FENC_STRIDE - 5, &cres[0]);
if ((vres[0] != cres[0]) || ((vres[1] != cres[1])) || ((vres[2] != cres[2])))
return false;
@@ -162,8 +251,17 @@
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 index = i % (TEST_CASES * TEST_CASES);
+ opt(pixel_test_buff[test_case_selection[2*index]],
+ pixel_test_buff[test_case_selection[2*index + 1]] + j,
+ pixel_test_buff[test_case_selection[2*index + 1]] + j + 1,
+ pixel_test_buff[test_case_selection[2*index + 1]] + j + 2,
+ pixel_test_buff[test_case_selection[2*index + 1]] + j + 3, FENC_STRIDE - 5, &vres[0]);
+ ref(pixel_test_buff[test_case_selection[2*index]],
+ pixel_test_buff[test_case_selection[2*index + 1]] + j,
+ pixel_test_buff[test_case_selection[2*index + 1]] + j + 1,
+ pixel_test_buff[test_case_selection[2*index + 1]] + j + 2,
+ pixel_test_buff[test_case_selection[2*index + 1]] + 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 +281,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 +305,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 +330,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 +369,13 @@
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 index = i % (TEST_CASES * TEST_CASES);
+ ref(pixel_test_buff[test_case_selection[2*index]] + j,
+ short_test_buff[test_case_selection[2*index + 1]] + j,
+ ref_reco, ref_recq, ref_pred, stride, stride, stride);
+ opt(pixel_test_buff[test_case_selection[2*index]] + j,
+ short_test_buff[test_case_selection[2*index + 1]] + j,
+ opt_reco, opt_recq, opt_pred, stride, stride, stride);
if (memcmp(ref_recq, opt_recq, 64 * 64 * sizeof(int16_t)))
{
@@ -295,7 +401,6 @@
j += INCR;
}
-
#if HIGH_BIT_DEPTH
X265_DEPTH = old_depth;
#endif
@@ -318,8 +423,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 +452,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 +474,11 @@
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 index = i % (TEST_CASES * TEST_CASES);
+ opt(bx, by, opt_dest, STRIDE, short_test_buff[test_case_selection[2*index]] + j,
+ short_test_buff[test_case_selection[2*index + 1]] + j, STRIDE, STRIDE);
+ ref(bx, by, ref_dest, STRIDE, short_test_buff[test_case_selection[2*index]] + j,
+ short_test_buff[test_case_selection[2*index + 1]] + j, STRIDE, STRIDE);
if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t)))
return false;
@@ -402,8 +512,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 +543,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 +566,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 +591,11 @@
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 index = i % (TEST_CASES * TEST_CASES);
+ ref(ref_dest, STRIDE, pixel_test_buff[test_case_selection[2*index]] + j,
+ STRIDE, pixel_test_buff[test_case_selection[2*index + 1]] + j, STRIDE, 32);
+ opt(opt_dest, STRIDE, pixel_test_buff[test_case_selection[2*index]] + j,
+ STRIDE, pixel_test_buff[test_case_selection[2*index + 1]] + j, STRIDE, 32);
if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
return false;
@@ -501,8 +619,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 +645,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 = 2;//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 +671,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 +717,11 @@
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 index = i % (TEST_CASES * TEST_CASES);
+ opt(opt_dest, 64, pixel_test_buff[test_case_selection[2*index]] + j,
+ pixel_test_buff[test_case_selection[2*index + 1]] + j, STRIDE, STRIDE);
+ ref(ref_dest, 64, pixel_test_buff[test_case_selection[2*index]] + j,
+ pixel_test_buff[test_case_selection[2*index + 1]] + j, STRIDE, STRIDE);
if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t)))
return false;
@@ -619,8 +743,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 +767,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 +796,11 @@
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 index = i % (TEST_CASES * TEST_CASES);
+ opt(opt_dest, 64, pixel_test_buff[test_case_selection[2*index]] + j,
+ short_test_buff[test_case_selection[2*index + 1]] + j, STRIDE, STRIDE);
+ ref(ref_dest, 64, pixel_test_buff[test_case_selection[2*index]] + j,
+ short_test_buff[test_case_selection[2*index + 1]] + j, STRIDE, STRIDE);
if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
{
@@ -695,8 +824,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 +844,11 @@
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 index = i % (TEST_CASES * TEST_CASES);
+ ref(pixel_test_buff[test_case_selection[2*index]] + i, stride,
+ pixel_test_buff[test_case_selection[2*index + 1]] + i, stride, sum0);
+ opt(pixel_test_buff[test_case_selection[2*index]] + i, stride,
+ pixel_test_buff[test_case_selection[2*index + 1]] + i, stride, sum1);
if (memcmp(sum0, sum1, sizeof(sum0)))
return false;
@@ -776,8 +909,11 @@
for (int i = 0; i < ITERS; i++)
{
- ref(ref_dest, STRIDE, sbuf1 + j, STRIDE, sbuf2 + j, STRIDE);
- opt(opt_dest, STRIDE, sbuf1 + j, STRIDE, sbuf2 + j, STRIDE);
+ int index = i % (TEST_CASES * TEST_CASES);
+ ref(ref_dest, STRIDE, short_test_buff[test_case_selection[2*index]] + j,
+ STRIDE, short_test_buff[test_case_selection[2*index + 1]] + j, STRIDE);
+ opt(opt_dest, STRIDE, short_test_buff[test_case_selection[2*index]] + j,
+ STRIDE, short_test_buff[test_case_selection[2*index + 1]] + j, STRIDE);
if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
return false;
diff -r aab88ed13364 -r f8884c624aef source/test/pixelharness.h
--- a/source/test/pixelharness.h Sun Feb 02 13:09:26 2014 -0600
+++ b/source/test/pixelharness.h Mon Feb 03 17:59:16 2014 +0530
@@ -31,11 +31,11 @@
{
protected:
- pixel *pbuf1, *pbuf2, *pbuf3, *pbuf4;
+ pixel *pbuf1, *pbuf2, *pbuf3, *pbuf4, **pixel_test_buff;
- int *ibuf1;
+ int *ibuf1, *test_case_selection, **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