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

murugan at multicorewareinc.com murugan at multicorewareinc.com
Mon Feb 17 13:29:35 CET 2014


# HG changeset patch
# User Murugan Vairavel <murugan at multicorewareinc.com>
# Date 1392639372 -19800
#      Mon Feb 17 17:46:12 2014 +0530
# Node ID 85be97320422ca9682272a81f31733b3884efa02
# Parent  314cd7999ba9740c25fad0df91988979650bece6
testbench: adding seperate input buffer for idct and updated qp value for quant

diff -r 314cd7999ba9 -r 85be97320422 source/test/mbdstharness.cpp
--- a/source/test/mbdstharness.cpp	Mon Feb 17 13:13:38 2014 +0530
+++ b/source/test/mbdstharness.cpp	Mon Feb 17 17:46:12 2014 +0530
@@ -29,14 +29,10 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
-
 #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;
-
 struct DctConf_t
 {
     const char *name;
@@ -79,11 +75,10 @@
     mintbuf6 = X265_MALLOC(int, mem_cmp_size);
     mintbuf7 = X265_MALLOC(int, mem_cmp_size);
     mintbuf8 = X265_MALLOC(int, mem_cmp_size);
-
     short_test_buff  = (int16_t**)X265_MALLOC(int16_t*, TEST_CASES);
     int_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)
+    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 || !int_idct_test_buff)
     {
         fprintf(stderr, "malloc failed, unable to initiate tests!\n");
         exit(1);
@@ -93,7 +88,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,15 +103,15 @@
     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;
     for (int i = 0; i < mb_t_size; i++)
     {
@@ -166,10 +162,12 @@
     {
         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)
@@ -211,15 +209,14 @@
     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,8 +241,11 @@
 
         int width = (1 << log2TrSize);
         int height = width;
-
-        int qp = rand() % 52;
+#if HIGH_BIT_DEPTH
+        int qp = rand() % 64;
+#else
+        int qp = rand() % 51;
+#endif
         int per = qp / 6;
         int rem = qp % 6;
         static const int invQuantScales[6] = { 40, 45, 51, 57, 64, 72 };
diff -r 314cd7999ba9 -r 85be97320422 source/test/mbdstharness.h
--- a/source/test/mbdstharness.h	Mon Feb 17 13:13:38 2014 +0530
+++ b/source/test/mbdstharness.h	Mon Feb 17 17:46:12 2014 +0530
@@ -33,9 +33,8 @@
 class MBDstHarness : public TestHarness
 {
 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