<div dir="ltr">Ignore this patch. I will send a new one.<div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 13, 2014 at 5:34 PM, <span dir="ltr"><<a href="mailto:murugan@multicorewareinc.com" target="_blank">murugan@multicorewareinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Murugan Vairavel <<a href="mailto:murugan@multicorewareinc.com">murugan@multicorewareinc.com</a>><br>
# Date 1392291603 -19800<br>
# Thu Feb 13 17:10:03 2014 +0530<br>
# Node ID 549d67465fbf19e2a062e4530851146d6b693949<br>
# Parent df4531a24c4db893b5197180466922bccc4b2c54<br>
testbench: added stress test cases for all functions in mbdstharness.cpp<br>
<br>
diff -r df4531a24c4d -r 549d67465fbf source/test/ipfilterharness.cpp<br>
--- a/source/test/ipfilterharness.cpp Thu Feb 13 02:48:38 2014 -0600<br>
+++ b/source/test/ipfilterharness.cpp Thu Feb 13 17:10:03 2014 +0530<br>
@@ -41,12 +41,12 @@<br>
IPFilterHarness::IPFilterHarness()<br>
{<br>
ipf_t_size = 200 * 200;<br>
- pixel_buff = (pixel*)malloc(ipf_t_size * sizeof(pixel)); // Assuming max_height = max_width = max_srcStride = max_dstStride = 100<br>
+ pixel_buff = X265_MALLOC(pixel, ipf_t_size); // Assuming max_height = max_width = max_srcStride = max_dstStride = 100<br>
short_buff = X265_MALLOC(int16_t, ipf_t_size);<br>
- IPF_vec_output_s = (int16_t*)malloc(ipf_t_size * sizeof(int16_t)); // Output Buffer1<br>
- IPF_C_output_s = (int16_t*)malloc(ipf_t_size * sizeof(int16_t)); // Output Buffer2<br>
- IPF_vec_output_p = (pixel*)malloc(ipf_t_size * sizeof(pixel)); // Output Buffer1<br>
- IPF_C_output_p = (pixel*)malloc(ipf_t_size * sizeof(pixel)); // Output Buffer2<br>
+ IPF_vec_output_s = X265_MALLOC(int16_t, ipf_t_size); // Output Buffer1<br>
+ IPF_C_output_s = X265_MALLOC(int16_t, ipf_t_size); // Output Buffer2<br>
+ IPF_vec_output_p = X265_MALLOC(pixel, ipf_t_size); // Output Buffer1<br>
+ IPF_C_output_p = X265_MALLOC(pixel, ipf_t_size); // Output Buffer2<br>
<br>
/* Array of pixel buffers */<br>
pixel_test_buff = X265_MALLOC(pixel*, TEST_CASES);<br>
@@ -102,12 +102,12 @@<br>
<br>
IPFilterHarness::~IPFilterHarness()<br>
{<br>
- free(IPF_vec_output_s);<br>
- free(IPF_C_output_s);<br>
- free(IPF_vec_output_p);<br>
- free(IPF_C_output_p);<br>
+ X265_FREE(IPF_vec_output_s);<br>
+ X265_FREE(IPF_C_output_s);<br>
+ X265_FREE(IPF_vec_output_p);<br>
+ X265_FREE(IPF_C_output_p);<br>
X265_FREE(short_buff);<br>
- free(pixel_buff);<br>
+ X265_FREE(pixel_buff);<br>
for (int i = 0; i < TEST_CASES; i++)<br>
{<br>
X265_FREE(pixel_test_buff[i]);<br>
@@ -738,7 +738,7 @@<br>
{<br>
printf("luma_hv [%s]\t", lumaPartStr[value]);<br>
REPORT_SPEEDUP(opt.luma_hvpp[value], ref.luma_hvpp[value],<br>
- pixel_buff + srcStride, srcStride, IPF_vec_output_p, dstStride, 1, 3);<br>
+ pixel_buff + 3 * srcStride, srcStride, IPF_vec_output_p, srcStride, 1, 3);<br>
}<br>
}<br>
<br>
diff -r df4531a24c4d -r 549d67465fbf source/test/mbdstharness.cpp<br>
--- a/source/test/mbdstharness.cpp Thu Feb 13 02:48:38 2014 -0600<br>
+++ b/source/test/mbdstharness.cpp Thu Feb 13 17:10:03 2014 +0530<br>
@@ -30,8 +30,12 @@<br>
#include <string.h><br>
#include <stdio.h><br>
<br>
+#define ITERS 100<br>
+#define TEST_CASES 3<br>
+#define SMAX (1 << 12)<br>
+#define SMIN (-1 << 12)<br>
+<br>
using namespace x265;<br>
-#define ITERS 100<br>
<br>
struct DctConf_t<br>
{<br>
@@ -76,16 +80,40 @@<br>
mintbuf7 = X265_MALLOC(int, mem_cmp_size);<br>
mintbuf8 = X265_MALLOC(int, mem_cmp_size);<br>
<br>
- if (!mbuf1 || !mbuf2 || !mbuf3 || !mbuf4 || !mbufdct)<br>
+ short_test_buff = (int16_t**)X265_MALLOC(int16_t*, TEST_CASES);<br>
+ int_test_buff = (int**)X265_MALLOC(int*, TEST_CASES);<br>
+<br>
+ if (!mbuf1 || !mbuf2 || !mbuf3 || !mbuf4 || !mbufdct || !mintbuf1 || !mintbuf2 || !mintbuf3 || !mintbuf4 || !mintbuf5 || !mintbuf6 || !mintbuf7 || !mintbuf8 || !short_test_buff || !int_test_buff)<br>
{<br>
fprintf(stderr, "malloc failed, unable to initiate tests!\n");<br>
exit(1);<br>
}<br>
<br>
- if (!mintbuf1 || !mintbuf2 || !mintbuf3 || !mintbuf4 || !mintbuf5 || !mintbuf6 || !mintbuf7 || !mintbuf8)<br>
+ for (int i = 0; i < TEST_CASES; i++)<br>
{<br>
- fprintf(stderr, "malloc failed, unable to initiate tests!\n");<br>
- exit(1);<br>
+ short_test_buff[i] = (int16_t*)X265_MALLOC(int16_t, mb_t_size);<br>
+ int_test_buff[i] = (int*)X265_MALLOC(int, mb_t_size);<br>
+ if (!short_test_buff[i] || !int_test_buff[i])<br>
+ {<br>
+ fprintf(stderr, "Init_Test_Case_buffers: malloc failed, unable to initiate tests!\n");<br>
+ exit(-1);<br>
+ }<br>
+ }<br>
+<br>
+ /*[0] --- Random values */<br>
+ /*[1] --- Minimum */<br>
+ /*[2] --- Maximum */<br>
+<br>
+ for (int i = 0; i < mb_t_size; i++)<br>
+ {<br>
+ short_test_buff[0][i] = (rand() & PIXEL_MAX) - (rand() & PIXEL_MAX);<br>
+ int_test_buff[0][i] = rand() % SMAX;<br>
+<br>
+ short_test_buff[1][i] = -PIXEL_MAX;<br>
+ int_test_buff[1][i] = 0;<br>
+<br>
+ short_test_buff[2][i] = PIXEL_MAX;<br>
+ int_test_buff[2][i] = SMAX - 1;<br>
}<br>
<br>
const int idct_max = (1 << (BIT_DEPTH + 4)) - 1;<br>
@@ -134,6 +162,13 @@<br>
X265_FREE(mintbuf6);<br>
X265_FREE(mintbuf7);<br>
X265_FREE(mintbuf8);<br>
+ for (int i = 0; i < TEST_CASES; i++)<br>
+ {<br>
+ X265_FREE(short_test_buff[i]);<br>
+ X265_FREE(int_test_buff[i]);<br>
+ }<br>
+ X265_FREE(short_test_buff);<br>
+ X265_FREE(int_test_buff);<br>
}<br>
<br>
bool MBDstHarness::check_dct_primitive(dct_t ref, dct_t opt, int width)<br>
@@ -143,15 +178,16 @@<br>
<br>
for (int i = 0; i <= 100; i++)<br>
{<br>
- ref(mbufdct + j, mintbuf1, width);<br>
- opt(mbufdct + j, mintbuf2, width);<br>
+ int index = rand() % TEST_CASES;<br>
+ ref(short_test_buff[index] + j, mintbuf3, width);<br>
+ opt(short_test_buff[index] + j, mintbuf4, width);<br>
<br>
- if (memcmp(mintbuf1, mintbuf2, cmp_size))<br>
+ if (memcmp(mintbuf3, mintbuf4, cmp_size))<br>
{<br>
#if _DEBUG<br>
// redo for debug<br>
- ref(mbufdct + j, mintbuf1, width);<br>
- opt(mbufdct + j, mintbuf2, width);<br>
+ ref(short_test_buff[index] + j, mintbuf3, width);<br>
+ opt(short_test_buff[index] + j, mintbuf4, width);<br>
#endif<br>
return false;<br>
}<br>
@@ -173,15 +209,16 @@<br>
<br>
for (int i = 0; i <= 100; i++)<br>
{<br>
- ref(mbufidct + j, mbuf2, width);<br>
- opt(mbufidct + j, mbuf3, width);<br>
+ int index = rand() % TEST_CASES;<br>
+ ref(int_test_buff[index] + j, mbuf2, width);<br>
+ opt(int_test_buff[index] + j, mbuf3, width);<br>
<br>
if (memcmp(mbuf2, mbuf3, cmp_size))<br>
{<br>
#if _DEBUG<br>
// redo for debug<br>
- ref(mbufidct + j, mbuf2, width);<br>
- opt(mbufidct + j, mbuf3, width);<br>
+ ref(int_test_buff[index] + j, mbuf2, width);<br>
+ opt(int_test_buff[index] + j, mbuf3, width);<br>
#endif<br>
return false;<br>
}<br>
@@ -216,9 +253,10 @@<br>
int shift = QUANT_IQUANT_SHIFT - QUANT_SHIFT - transformShift;<br>
<br>
int cmp_size = sizeof(int) * height * width;<br>
+ int index = rand() % TEST_CASES;<br>
<br>
- ref(mintbuf1 + j, mintbuf3, width * height, scale, shift);<br>
- opt(mintbuf1 + j, mintbuf4, width * height, scale, shift);<br>
+ ref(int_test_buff[index] + j, mintbuf3, width * height, scale, shift);<br>
+ opt(int_test_buff[index] + j, mintbuf4, width * height, scale, shift);<br>
<br>
if (memcmp(mintbuf3, mintbuf4, cmp_size))<br>
return false;<br>
@@ -250,9 +288,11 @@<br>
int shift = QUANT_IQUANT_SHIFT - QUANT_SHIFT - transformShift;<br>
<br>
int cmp_size = sizeof(int) * height * width;<br>
+ int index1 = rand() % TEST_CASES;<br>
+ int index2 = rand() % TEST_CASES;<br>
<br>
- ref(mintbuf1 + j, mintbuf3, mintbuf2 + j, width * height, per, shift);<br>
- opt(mintbuf1 + j, mintbuf4, mintbuf2 + j, width * height, per, shift);<br>
+ ref(int_test_buff[index1] + j, mintbuf3, int_test_buff[index2] + j, width * height, per, shift);<br>
+ opt(int_test_buff[index1] + j, mintbuf4, int_test_buff[index2] + j, width * height, per, shift);<br>
<br>
if (memcmp(mintbuf3, mintbuf4, cmp_size))<br>
return false;<br>
@@ -297,8 +337,11 @@<br>
int numCoeff = height * width;<br>
int optLastPos = -1, refLastPos = -1;<br>
<br>
- refReturnValue = ref(mintbuf1 + j, mintbuf2 + j, mintbuf5, mintbuf6, bits, valueToAdd, numCoeff, &refLastPos);<br>
- optReturnValue = opt(mintbuf1 + j, mintbuf2 + j, mintbuf3, mintbuf4, bits, valueToAdd, numCoeff, &optLastPos);<br>
+ int index1 = rand() % TEST_CASES;<br>
+ int index2 = rand() % TEST_CASES;<br>
+<br>
+ refReturnValue = ref(int_test_buff[index1] + j, int_test_buff[index2] + j, mintbuf5, mintbuf6, bits, valueToAdd, numCoeff, &refLastPos);<br>
+ optReturnValue = opt(int_test_buff[index1] + j, int_test_buff[index2] + j, mintbuf3, mintbuf4, bits, valueToAdd, numCoeff, &optLastPos);<br>
<br>
if (memcmp(mintbuf3, mintbuf5, cmp_size))<br>
return false;<br>
@@ -379,7 +422,7 @@<br>
if (opt.dct[value])<br>
{<br>
printf("%s\t", DctConf_infos[value].name);<br>
- REPORT_SPEEDUP(opt.dct[value], ref.dct[value], mbuf1, mintbuf1, DctConf_infos[value].width);<br>
+ REPORT_SPEEDUP(opt.dct[value], ref.dct[value], mbuf1, mintbuf3, DctConf_infos[value].width);<br>
}<br>
}<br>
<br>
diff -r df4531a24c4d -r 549d67465fbf source/test/mbdstharness.h<br>
--- a/source/test/mbdstharness.h Thu Feb 13 02:48:38 2014 -0600<br>
+++ b/source/test/mbdstharness.h Thu Feb 13 17:10:03 2014 +0530<br>
@@ -34,9 +34,8 @@<br>
{<br>
protected:<br>
<br>
- int16_t *mbuf1, *mbuf2, *mbuf3, *mbuf4, *mbufdct;<br>
- int *mbufidct;<br>
- int *mintbuf1, *mintbuf2, *mintbuf3, *mintbuf4, *mintbuf5, *mintbuf6, *mintbuf7, *mintbuf8;<br>
+ int16_t *mbuf1, *mbuf2, *mbuf3, *mbuf4, *mbufdct, **short_test_buff;<br>
+ int *mbufidct, *mintbuf1, *mintbuf2, *mintbuf3, *mintbuf4, *mintbuf5, *mintbuf6, *mintbuf7, *mintbuf8, **int_test_buff;<br>
static const int mb_t_size = 6400;<br>
static const int mem_cmp_size = 32 * 32;<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">With Regards,<div><br></div><div>Murugan. V</div><div>+919659287478</div></div>
</div>