[x265] [PATCH] Stress test case for luma_pp

nabajit at multicorewareinc.com nabajit at multicorewareinc.com
Mon Jan 27 13:07:19 CET 2014


# HG changeset patch
# User Nabajit Deka
# Date 1390824412 -19800
#      Mon Jan 27 17:36:52 2014 +0530
# Node ID 00c0d3e09e3e2180df8675f0a715b2bb2830b7ef
# Parent  b59b1e579f78b4c29c0c1491e6198a63ba1d597f
Stress test case for luma_pp.

diff -r b59b1e579f78 -r 00c0d3e09e3e source/test/ipfilterharness.cpp
--- a/source/test/ipfilterharness.cpp	Mon Jan 27 00:10:56 2014 -0600
+++ b/source/test/ipfilterharness.cpp	Mon Jan 27 17:36:52 2014 +0530
@@ -36,14 +36,17 @@
 IPFilterHarness::IPFilterHarness()
 {
     ipf_t_size = 200 * 200;
+
     pixel_buff = (pixel*)malloc(ipf_t_size * sizeof(pixel));     // Assuming max_height = max_width = max_srcStride = max_dstStride = 100
+    pixel_buff_min = (pixel*)malloc(ipf_t_size * sizeof(pixel));
+    pixel_buff_max = (pixel*)malloc(ipf_t_size * sizeof(pixel));
     short_buff = (int16_t*)X265_MALLOC(int16_t, ipf_t_size);
     IPF_vec_output_s = (int16_t*)malloc(ipf_t_size * sizeof(int16_t)); // Output Buffer1
     IPF_C_output_s = (int16_t*)malloc(ipf_t_size * sizeof(int16_t));   // Output Buffer2
     IPF_vec_output_p = (pixel*)malloc(ipf_t_size * sizeof(pixel)); // Output Buffer1
     IPF_C_output_p = (pixel*)malloc(ipf_t_size * sizeof(pixel));   // Output Buffer2
 
-    if (!pixel_buff || !short_buff || !IPF_vec_output_s || !IPF_vec_output_p || !IPF_C_output_s || !IPF_C_output_p)
+    if (!pixel_buff || !pixel_buff_min || !pixel_buff_max || !short_buff || !IPF_vec_output_s || !IPF_vec_output_p || !IPF_C_output_s || !IPF_C_output_p)
     {
         fprintf(stderr, "init_IPFilter_buffers: malloc failed, unable to initiate tests!\n");
         exit(-1);
@@ -62,6 +65,9 @@
         pixel_buff[i] = (pixel)(rand() &  ((1 << 8) - 1));
         short_buff[i] = (int16_t)(isPositive) * (rand() &  SHRT_MAX);
     }
+
+    memset(pixel_buff_min, PIXEL_MIN, ipf_t_size);
+    memset(pixel_buff_max, PIXEL_MAX, ipf_t_size);
 }
 
 IPFilterHarness::~IPFilterHarness()
@@ -276,7 +282,6 @@
     for (int i = 0; i <= 100; i++)
     {
         rand_coeffIdx = rand() % 3;                // Random coeffIdex in the filter
-
         rand_srcStride = rand() % 100;             // Randomly generated srcStride
         rand_dstStride = rand() % 100 + 64;        // Randomly generated dstStride
 
@@ -295,6 +300,49 @@
             return false;
     }
 
+    //Stress test for min input
+    for (int i = 0; i < 3; i++)
+    {
+        rand_coeffIdx = i;
+        rand_srcStride = rand() % 100;             // Randomly generated srcStride
+        rand_dstStride = rand() % 100 + 64;        // Randomly generated dstStride
+
+        opt(pixel_buff_min,
+            rand_srcStride,
+            IPF_vec_output_p,
+            rand_dstStride,
+            rand_coeffIdx);
+        ref(pixel_buff_min,
+            rand_srcStride,
+            IPF_C_output_p,
+            rand_dstStride,
+            rand_coeffIdx);
+
+        if (memcmp(IPF_vec_output_p, IPF_C_output_p, ipf_t_size))
+        {
+            printf("luma_pp stress test(min) failed\n");
+            return false;
+        }
+
+    //Stress test for max input
+        opt(pixel_buff_max,
+            rand_srcStride,
+            IPF_vec_output_p,
+            rand_dstStride,
+            rand_coeffIdx);
+        ref(pixel_buff_max,
+            rand_srcStride,
+            IPF_C_output_p,
+            rand_dstStride,
+            rand_coeffIdx);
+
+        if (memcmp(IPF_vec_output_p, IPF_C_output_p, ipf_t_size))
+        {
+            printf("luma_pp stress test(max) failed\n");
+            return false;
+        }
+    }
+
     return true;
 }
 
diff -r b59b1e579f78 -r 00c0d3e09e3e source/test/ipfilterharness.h
--- a/source/test/ipfilterharness.h	Mon Jan 27 00:10:56 2014 -0600
+++ b/source/test/ipfilterharness.h	Mon Jan 27 17:36:52 2014 +0530
@@ -33,7 +33,7 @@
 {
 protected:
 
-    pixel *pixel_buff;
+    pixel *pixel_buff, *pixel_buff_min, *pixel_buff_max;
     int16_t *short_buff;
 
     pixel *IPF_vec_output_p, *IPF_C_output_p;
diff -r b59b1e579f78 -r 00c0d3e09e3e source/test/testharness.h
--- a/source/test/testharness.h	Mon Jan 27 00:10:56 2014 -0600
+++ b/source/test/testharness.h	Mon Jan 27 17:36:52 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