[x265] [PATCH] fix SMAX and SMIN in pixelharness.h and rename buffers in pixelharness.cpp

ramya at multicorewareinc.com ramya at multicorewareinc.com
Mon Sep 28 13:14:11 CEST 2015


# HG changeset patch
# User Ramya Sriraman <ramya at multicorewareinc.com>
# Date 1443437035 -19800
#      Mon Sep 28 16:13:55 2015 +0530
# Node ID 69440d394ec2682702cb1fe5479fb1ff0babf69d
# Parent  f4c267f28487161fa78c43cabb30dc4f4f82570c
fix SMAX and SMIN in pixelharness.h and rename buffers in pixelharness.cpp

diff -r f4c267f28487 -r 69440d394ec2 source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Mon Sep 28 13:38:33 2015 +0530
+++ b/source/test/pixelharness.cpp	Mon Sep 28 16:13:55 2015 +0530
@@ -35,29 +35,45 @@
      * [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
-        short_test_buff2[0][i]  = rand() % 16383;                       // for addAvg
-        int_test_buff[0][i]     = rand() % SHORT_MAX;
-        ushort_test_buff[0][i]  = rand() % ((1 << 16) - 1);
-        uchar_test_buff[0][i]   = rand() % ((1 << 8) - 1);
-
-        pixel_test_buff[1][i]   = PIXEL_MIN;
-        short_test_buff[1][i]   = SMIN;
-        short_test_buff1[1][i]  = PIXEL_MIN;
-        short_test_buff2[1][i]  = -16384;
-        int_test_buff[1][i]     = SHORT_MIN;
-        ushort_test_buff[1][i]  = PIXEL_MIN;
-        uchar_test_buff[1][i]   = PIXEL_MIN;
-
-        pixel_test_buff[2][i]   = PIXEL_MAX;
-        short_test_buff[2][i]   = SMAX;
-        short_test_buff1[2][i]  = PIXEL_MAX;
-        short_test_buff2[2][i]  = 16383;
-        int_test_buff[2][i]     = SHORT_MAX;
-        ushort_test_buff[2][i]  = ((1 << 16) - 1);
-        uchar_test_buff[2][i]   = 255;
+        pixel_test_buff[0][i] = rand() % PIXEL_MAX;
+
+        short_test_buff[0][i] = (rand() % (2 * SMAX + 1)) - SMAX - 1; // max(SMIN, min(rand(), SMAX));
+
+        /* For block copy only & copy_cnt_t; Range= 0 to 2^depth -1 ;
+        Encoder inputs - copy x265_picture into internal PicYuv instance (ref picyuv.cpp)*/
+        test_blockCopy_buffer[0][i] = rand() & PIXEL_MAX;
+
+        /*For addAvg ; Range = -2^14 to 2^14-1;
+        Encoder inputs - Luma parts of predicted yuv in biprediction (ref predict.cpp)*/
+        prediction_output_buffer[0][i] = rand() % 16383;
+
+        /*For cutree_propagate_cost (1st arg); Range = -2^15 + 1 to 2^15 - 1;
+        Encoder inputs - Different cost buffers (ref slicetype.cpp)*/
+        int_test_buff[0][i] = rand() % SHORT_MAX;
+
+        /*For cutree_propagate_cost (2nd arg) & planecopy_sp; Range= 0 to 2^16-1*/
+        ushort_test_buff[0][i] = rand() % ((1 << 16) - 1);
+
+        /* For planecopy_cp; Range= 0 to 2^8-1 ;
+        Encoder inputs - copy x265_picture into internal PicYuv instance (ref picyuv.cpp)*/
+        uchar_test_buff[0][i] = rand() % ((1 << 8) - 1);
+        
+        pixel_test_buff[1][i]           = PIXEL_MIN;
+        short_test_buff[1][i]           = SMIN;
+        test_blockCopy_buffer[1][i]     = PIXEL_MIN;
+        prediction_output_buffer[1][i]  = -16384;
+        int_test_buff[1][i]             = SHORT_MIN;
+        ushort_test_buff[1][i]          = PIXEL_MIN;
+        uchar_test_buff[1][i]           = PIXEL_MIN;
+
+        pixel_test_buff[2][i]           = PIXEL_MAX;
+        short_test_buff[2][i]           = SMAX;
+        test_blockCopy_buffer[2][i]     = PIXEL_MAX;
+        prediction_output_buffer[2][i]  = 16383;
+        int_test_buff[2][i]             = SHORT_MAX;
+        ushort_test_buff[2][i]          = ((1 << 16) - 1);
+        uchar_test_buff[2][i]           = 255;
+
 
         pbuf1[i] = rand() & PIXEL_MAX;
         pbuf2[i] = rand() & PIXEL_MAX;
@@ -424,8 +440,8 @@
     for (int i = 0; i < ITERS; i++)
     {
         int index = i % TEST_CASES;
-        int opt_cnt = (int)checked(opt, opt_dest, short_test_buff1[index] + j, stride);
-        int ref_cnt = ref(ref_dest, short_test_buff1[index] + j, stride);
+        int opt_cnt = (int)checked(opt, opt_dest, test_blockCopy_buffer[index] + j, stride);
+        int ref_cnt = ref(ref_dest,test_blockCopy_buffer[index] + j, stride);
 
         if ((ref_cnt != opt_cnt) || memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t)))
             return false;
@@ -566,8 +582,8 @@
     for (int i = 0; i < ITERS; i++)
     {
         int index = i % TEST_CASES;
-        checked(opt, opt_dest, stride1, short_test_buff1[index] + j, stride2);
-        ref(ref_dest, stride1, short_test_buff1[index] + j, stride2);
+        checked(opt, opt_dest, stride1, test_blockCopy_buffer[index] + j, stride2);
+        ref(ref_dest, stride1, test_blockCopy_buffer[index] + j, stride2);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
             return false;
@@ -622,8 +638,8 @@
     for (int i = 0; i < ITERS; i++)
     {
         int index = i % TEST_CASES;
-        checked(opt, opt_dest, stride, short_test_buff1[index] + j, stride);
-        ref(ref_dest, stride, short_test_buff1[index] + j, stride);
+        checked(opt, opt_dest, stride, test_blockCopy_buffer[index] + j, stride);
+        ref(ref_dest, stride, test_blockCopy_buffer[index] + j, stride);
 
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t)))
             return false;
@@ -879,8 +895,8 @@
     {
         int index1 = rand() % TEST_CASES;
         int index2 = rand() % TEST_CASES;
-        ref(short_test_buff2[index1] + j, short_test_buff2[index2] + j, ref_dest, stride, stride, stride);
-        checked(opt, short_test_buff2[index1] + j, short_test_buff2[index2] + j, opt_dest, stride, stride, stride);
+        ref(prediction_output_buffer[index1] + j, prediction_output_buffer[index2] + j, ref_dest, stride, stride, stride);
+        checked(opt, prediction_output_buffer[index1] + j, prediction_output_buffer[index2] + j, opt_dest, stride, stride, stride);
         if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
             return false;
 
diff -r f4c267f28487 -r 69440d394ec2 source/test/pixelharness.h
--- a/source/test/pixelharness.h	Mon Sep 28 13:38:33 2015 +0530
+++ b/source/test/pixelharness.h	Mon Sep 28 16:13:55 2015 +0530
@@ -39,9 +39,8 @@
     enum { PAD_ROWS = 64 };
     enum { BUFFSIZE = STRIDE * (MAX_HEIGHT + PAD_ROWS) + INCR * ITERS };
     enum { TEST_CASES = 3 };
-    enum { SMAX = 1 << 12 };
-    enum { SMIN = -1 << 12 };
-
+    enum { SMAX = (1 << (X265_DEPTH - 1)) -1 };
+    enum { SMIN = -1 << (X265_DEPTH - 1) };
     ALIGN_VAR_32(pixel, pbuf1[BUFFSIZE]);
     pixel    pbuf2[BUFFSIZE];
     pixel    pbuf3[BUFFSIZE];
@@ -59,8 +58,8 @@
 
     pixel    pixel_test_buff[TEST_CASES][BUFFSIZE];
     int16_t  short_test_buff[TEST_CASES][BUFFSIZE];
-    int16_t  short_test_buff1[TEST_CASES][BUFFSIZE];
-    int16_t  short_test_buff2[TEST_CASES][BUFFSIZE];
+    int16_t  test_blockCopy_buffer[TEST_CASES][BUFFSIZE];
+    int16_t  prediction_output_buffer[TEST_CASES][BUFFSIZE];
     int      int_test_buff[TEST_CASES][BUFFSIZE];
     uint16_t ushort_test_buff[TEST_CASES][BUFFSIZE];
     uint8_t  uchar_test_buff[TEST_CASES][BUFFSIZE];


More information about the x265-devel mailing list