[x265] [PATCH] testbench: adding seperate input buffer for idct and updated qp valuue for quant

murugan at multicorewareinc.com murugan at multicorewareinc.com
Fri Feb 14 14:33:40 CET 2014


# HG changeset patch
# User Murugan Vairavel <murugan at multicorewareinc.com>
# Date 1392384133 -19800
#      Fri Feb 14 18:52:13 2014 +0530
# Node ID 423c7ff885b34a88628d32e4c26532f7664a93f7
# Parent  ed310b17ff6681f191c85341cf6efe7a50770143
testbench: adding seperate input buffer for idct and updated qp valuue for quant

diff -r ed310b17ff66 -r 423c7ff885b3 source/test/mbdstharness.cpp
--- a/source/test/mbdstharness.cpp	Fri Feb 14 02:30:52 2014 -0600
+++ b/source/test/mbdstharness.cpp	Fri Feb 14 18:52:13 2014 +0530
@@ -32,8 +32,7 @@
 
 #define ITERS  100
 #define TEST_CASES 3
-#define SMAX (1 << 12)
-#define SMIN (-1 << 12)
+#define IDCTMAX (1 << (BIT_DEPTH + 4)) - 1;
 
 using namespace x265;
 
@@ -82,8 +81,9 @@
 
     short_test_buff  = (int16_t**)X265_MALLOC(int16_t*, TEST_CASES);
     int_test_buff    = (int**)X265_MALLOC(int*, TEST_CASES);
+    int_idct_test_buff    = (int**)X265_MALLOC(int*, TEST_CASES);
 
-    if (!mbuf1 || !mbuf2 || !mbuf3 || !mbuf4 || !mbufdct || !mintbuf1 || !mintbuf2 || !mintbuf3 || !mintbuf4 || !mintbuf5 || !mintbuf6 || !mintbuf7 || !mintbuf8 || !short_test_buff || !int_test_buff)
+    if (!mbuf1 || !mbuf2 || !mbuf3 || !mbuf4 || !mbufdct || !mintbuf1 || !mintbuf2 || !mintbuf3 || !mintbuf4 || !mintbuf5 || !mintbuf6 || !mintbuf7 || !mintbuf8 || !short_test_buff || !int_test_buff || !int_idct_test_buff)
     {
         fprintf(stderr, "malloc failed, unable to initiate tests!\n");
         exit(1);
@@ -93,7 +93,8 @@
     {
         short_test_buff[i]  = (int16_t*)X265_MALLOC(int16_t, mb_t_size);
         int_test_buff[i]  = (int*)X265_MALLOC(int, mb_t_size);
-        if (!short_test_buff[i] || !int_test_buff[i])
+        int_idct_test_buff[i]  = (int*)X265_MALLOC(int, mb_t_size);
+        if (!short_test_buff[i] || !int_test_buff[i] || !int_idct_test_buff[i])
         {
             fprintf(stderr, "Init_Test_Case_buffers: malloc failed, unable to initiate tests!\n");
             exit(-1);
@@ -107,13 +108,16 @@
     for (int i = 0; i < mb_t_size; i++)
     {
         short_test_buff[0][i]   = (rand() & PIXEL_MAX) - (rand() & PIXEL_MAX);
-        int_test_buff[0][i]     = rand() % SMAX;
+        int_test_buff[0][i]     = rand() % PIXEL_MAX;
+        int_idct_test_buff[0][i]     = rand() % IDCTMAX;
 
         short_test_buff[1][i]   = -PIXEL_MAX;
-        int_test_buff[1][i]     = 0;
+        int_test_buff[1][i]     = -PIXEL_MAX;
+        int_idct_test_buff[1][i]     = 0;
 
         short_test_buff[2][i]   = PIXEL_MAX;
-        int_test_buff[2][i]     = SMAX - 1;
+        int_test_buff[2][i]     = PIXEL_MAX;
+        int_idct_test_buff[2][i]     = IDCTMAX;
     }
 
     const int idct_max = (1 << (BIT_DEPTH + 4)) - 1;
@@ -166,9 +170,11 @@
     {
         X265_FREE(short_test_buff[i]);
         X265_FREE(int_test_buff[i]);
+        X265_FREE(int_idct_test_buff[i]);
     }
     X265_FREE(short_test_buff);
     X265_FREE(int_test_buff);
+    X265_FREE(int_idct_test_buff);
 }
 
 bool MBDstHarness::check_dct_primitive(dct_t ref, dct_t opt, int width)
@@ -210,15 +216,15 @@
     for (int i = 0; i <= 100; i++)
     {
         int index = rand() % TEST_CASES;
-        ref(int_test_buff[index] + j, mbuf2, width);
-        opt(int_test_buff[index] + j, mbuf3, width);
+        ref(int_idct_test_buff[index] + j, mbuf2, width);
+        opt(int_idct_test_buff[index] + j, mbuf3, width);
 
         if (memcmp(mbuf2, mbuf3, cmp_size))
         {
 #if _DEBUG
             // redo for debug
-            ref(int_test_buff[index] + j, mbuf2, width);
-            opt(int_test_buff[index] + j, mbuf3, width);
+            ref(int_idct_test_buff[index] + j, mbuf2, width);
+            opt(int_idct_test_buff[index] + j, mbuf3, width);
 #endif
             return false;
         }
@@ -244,7 +250,7 @@
         int width = (1 << log2TrSize);
         int height = width;
 
-        int qp = rand() % 52;
+        int qp = rand() % 64;
         int per = qp / 6;
         int rem = qp % 6;
         static const int invQuantScales[6] = { 40, 45, 51, 57, 64, 72 };
diff -r ed310b17ff66 -r 423c7ff885b3 source/test/mbdstharness.h
--- a/source/test/mbdstharness.h	Fri Feb 14 02:30:52 2014 -0600
+++ b/source/test/mbdstharness.h	Fri Feb 14 18:52:13 2014 +0530
@@ -35,7 +35,7 @@
 protected:
 
     int16_t *mbuf1, *mbuf2, *mbuf3, *mbuf4, *mbufdct, **short_test_buff;
-    int *mbufidct, *mintbuf1, *mintbuf2, *mintbuf3, *mintbuf4, *mintbuf5, *mintbuf6, *mintbuf7, *mintbuf8, **int_test_buff;
+    int *mbufidct, *mintbuf1, *mintbuf2, *mintbuf3, *mintbuf4, *mintbuf5, *mintbuf6, *mintbuf7, *mintbuf8, **int_test_buff, **int_idct_test_buff;
     static const int mb_t_size = 6400;
     static const int mem_cmp_size = 32 * 32;
 


More information about the x265-devel mailing list