[x265] [PATCH] testbench: update for blockcopy, these function use dynamic range [0, 255]

Min Chen chenm003 at 163.com
Fri Nov 8 08:00:30 CET 2013


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1383894022 -28800
# Node ID 2bcf52ff55e649eabaff8a54ff940cdbdda60a5d
# Parent  fd721a5ba06302858fa39739b4adc67ae86f7be3
testbench: update for blockcopy, these function use dynamic range [0,255]

diff -r fd721a5ba063 -r 2bcf52ff55e6 source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Thu Nov 07 21:27:45 2013 -0600
+++ b/source/test/pixelharness.cpp	Fri Nov 08 15:00:22 2013 +0800
@@ -49,8 +49,9 @@
 
     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 || !ibuf1)
+    if (!pbuf1 || !pbuf2 || !pbuf3 || !pbuf4 || !sbuf1 || !sbuf2 || !sbuf3 || !ibuf1)
     {
         fprintf(stderr, "malloc failed, unable to initiate tests!\n");
         exit(1);
@@ -67,6 +68,8 @@
         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;
+
+        sbuf3[i] = rand() % PIXEL_MAX; // for blockcopy only
     }
 }
 
@@ -78,6 +81,7 @@
     X265_FREE(pbuf4);
     X265_FREE(sbuf1);
     X265_FREE(sbuf2);
+    X265_FREE(sbuf3);
 }
 
 bool PixelHarness::check_pixelcmp(pixelcmp_t ref, pixelcmp_t opt)
@@ -224,8 +228,8 @@
     int j = 0;
     for (int i = 0; i < ITERS; i++)
     {
-        opt(bx, by, opt_dest, 64, (int16_t*)pbuf2 + j, STRIDE);
-        ref(bx, by, ref_dest, 64, (int16_t*)pbuf2 + j, STRIDE);
+        opt(bx, by, opt_dest, 64, (int16_t*)sbuf3 + j, STRIDE);
+        ref(bx, by, ref_dest, 64, (int16_t*)sbuf3 + j, STRIDE);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
             return false;
@@ -537,14 +541,14 @@
 
     // we don't know the partition size so we are checking the entire output buffer so
     // we must initialize the buffers
-    memset(ref_dest, 0, sizeof(ref_dest));
-    memset(opt_dest, 0, sizeof(opt_dest));
+    memset(ref_dest, 0xCD, sizeof(ref_dest));
+    memset(opt_dest, 0xCD, sizeof(opt_dest));
 
     int j = 0;
     for (int i = 0; i < ITERS; i++)
     {
-        opt(opt_dest, 64, sbuf1 + j, STRIDE);
-        ref(ref_dest, 64, sbuf1 + j, STRIDE);
+        opt(opt_dest, 64, sbuf3 + j, STRIDE);
+        ref(ref_dest, 64, sbuf3 + j, STRIDE);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
             return false;
diff -r fd721a5ba063 -r 2bcf52ff55e6 source/test/pixelharness.h
--- a/source/test/pixelharness.h	Thu Nov 07 21:27:45 2013 -0600
+++ b/source/test/pixelharness.h	Fri Nov 08 15:00:22 2013 +0800
@@ -35,7 +35,7 @@
 
     int *ibuf1;
 
-    int16_t *sbuf1, *sbuf2;
+    int16_t *sbuf1, *sbuf2, *sbuf3;
 
     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