<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 27, 2013 at 7:30 AM, <span dir="ltr"><<a href="mailto:praveen@multicorewareinc.com" target="_blank">praveen@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 praveentiwari<br>
# Date 1372336213 -19800<br>
# Node ID 636817b0f2b65010fcdc4d29a8a077652573784b<br>
# Parent 2e227fd23fe25e9fe6dfcca2f1dac21474f4a7a0<br>
Test code for xCalQuantCoefEAdp<br></blockquote><div><br></div><div style>I would push this one except the function names need to be sanitized</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
diff -r 2e227fd23fe2 -r 636817b0f2b6 source/test/mbdstharness.cpp<br>
--- a/source/test/mbdstharness.cpp Thu Jun 27 17:57:42 2013 +0530<br>
+++ b/source/test/mbdstharness.cpp Thu Jun 27 18:00:13 2013 +0530<br>
@@ -68,6 +68,10 @@<br>
mintbuf2 = (int*)TestHarness::alignedMalloc(sizeof(int), mb_t_size, 32);<br>
mintbuf3 = (int*)TestHarness::alignedMalloc(sizeof(int), mem_cmp_size, 32);<br>
mintbuf4 = (int*)TestHarness::alignedMalloc(sizeof(int), mem_cmp_size, 32);<br>
+ mintbuf5 = (int*)TestHarness::alignedMalloc(sizeof(int), mem_cmp_size, 32);<br>
+ mintbuf6 = (int*)TestHarness::alignedMalloc(sizeof(int), mem_cmp_size, 32);<br>
+ mintbuf7 = (int*)TestHarness::alignedMalloc(sizeof(int), mem_cmp_size, 32);<br>
+ mintbuf8 = (int*)TestHarness::alignedMalloc(sizeof(int), mem_cmp_size, 32);<br>
<br>
if (!mbuf1 || !mbuf2 || !mbuf3 || !mbuf4 || !mbufdct)<br>
{<br>
@@ -75,7 +79,7 @@<br>
exit(1);<br>
}<br>
<br>
- if (!mintbuf1 || !mintbuf2 || !mintbuf3 || !mintbuf4)<br>
+ if (!mintbuf1 || !mintbuf2 || !mintbuf3 || !mintbuf4 || !mintbuf5 || !mintbuf6 || !mintbuf7 || !mintbuf8)<br>
{<br>
fprintf(stderr, "malloc failed, unable to initiate tests!\n");<br>
exit(1);<br>
@@ -103,7 +107,11 @@<br>
<br>
memset(mintbuf3, 0, mem_cmp_size);<br>
memset(mintbuf4, 0, mem_cmp_size);<br>
-#endif<br>
+ memset(mintbuf5, 0, mem_cmp_size);<br>
+ memset(mintbuf6, 0, mem_cmp_size);<br>
+ memset(mintbuf7, 0, mem_cmp_size);<br>
+ memset(mintbuf8, 0, mem_cmp_size);<br>
+#endif // if _DEBUG<br>
}<br>
<br>
MBDstHarness::~MBDstHarness()<br>
@@ -119,6 +127,10 @@<br>
TestHarness::alignedFree(mintbuf2);<br>
TestHarness::alignedFree(mintbuf3);<br>
TestHarness::alignedFree(mintbuf4);<br>
+ TestHarness::alignedFree(mintbuf5);<br>
+ TestHarness::alignedFree(mintbuf6);<br>
+ TestHarness::alignedFree(mintbuf7);<br>
+ TestHarness::alignedFree(mintbuf8);<br>
}<br>
<br>
bool MBDstHarness::check_dct_primitive(dct_t ref, dct_t opt, int width)<br>
@@ -221,6 +233,59 @@<br>
return true;<br>
}<br>
<br>
+bool MBDstHarness::check_xCalQuantCoefEAdp_primitive(quantCoefEAdp ref, quantCoefEAdp opt)<br>
+{<br>
+ int j = 0;<br>
+<br>
+ for (int i = 0; i <= 5; i++)<br>
+ {<br>
+ int iWidth = (rand() % 4 + 1) * 4;<br>
+<br>
+ if (iWidth == 12)<br>
+ {<br>
+ iWidth = 32;<br>
+ }<br>
+ int iHeight = iWidth;<br>
+<br>
+ unsigned int tmp1 = 0;<br>
+ unsigned int tmp2 = 0;<br>
+<br>
+ int iQBitsC = rand() % 15;<br>
+ int iQBits = rand() % 23;<br>
+ int iAdd = rand() % 2147483647;<br>
+ int cmp_size = sizeof(int) * iWidth * iWidth;<br>
+ int numCoeff = iHeight * iWidth;<br>
+<br>
+ tmp1 = opt(mintbuf1 + j, mintbuf2 + j, mintbuf3, mintbuf4, mintbuf5, iQBitsC, iQBits, iAdd, numCoeff);<br>
+ tmp2 = ref(mintbuf1 + j, mintbuf2 + j, mintbuf6, mintbuf7, mintbuf8, iQBitsC, iQBits, iAdd, numCoeff);<br>
+<br>
+ if (memcmp(mintbuf3, mintbuf6, cmp_size))<br>
+ return false;<br>
+<br>
+ if (memcmp(mintbuf4, mintbuf7, cmp_size))<br>
+ return false;<br>
+<br>
+ if (memcmp(mintbuf5, mintbuf8, cmp_size))<br>
+ return false;<br>
+<br>
+ if (tmp1 != tmp2)<br>
+ return false;<br>
+<br>
+ j += 16;<br>
+<br>
+#if _DEBUG<br>
+ memset(mintbuf3, 0, mem_cmp_size);<br>
+ memset(mintbuf4, 0, mem_cmp_size);<br>
+ memset(mintbuf5, 0, mem_cmp_size);<br>
+ memset(mintbuf6, 0, mem_cmp_size);<br>
+ memset(mintbuf7, 0, mem_cmp_size);<br>
+ memset(mintbuf8, 0, mem_cmp_size);<br>
+#endif<br>
+ }<br>
+<br>
+ return true;<br>
+}<br>
+<br>
bool MBDstHarness::testCorrectness(const EncoderPrimitives& ref, const EncoderPrimitives& opt)<br>
{<br>
for (int i = 0; i < NUM_DCTS; i++)<br>
@@ -256,6 +321,15 @@<br>
}<br>
}<br>
<br>
+ if (opt.calQuantCoefEAdp)<br>
+ {<br>
+ if (!check_xCalQuantCoefEAdp_primitive(ref.calQuantCoefEAdp, opt.calQuantCoefEAdp))<br>
+ {<br>
+ printf("xCalQuantCoefEAdp: Failed!\n");<br>
+ return false;<br>
+ }<br>
+ }<br>
+<br>
return true;<br>
}<br>
<br>
@@ -284,4 +358,10 @@<br>
printf("xDeQuant\t\t");<br>
REPORT_SPEEDUP(opt.deQuant, ref.deQuant, 8, mintbuf1, mintbuf3, 32, 32, 5, 2, false, 5, mintbuf2);<br>
}<br>
+<br>
+ if (opt.calQuantCoefEAdp)<br>
+ {<br>
+ printf("xCalQuantCoefEAdp\t");<br>
+ REPORT_SPEEDUP(ref.calQuantCoefEAdp, opt.calQuantCoefEAdp, mintbuf1, mintbuf2, mintbuf3, mintbuf4, mintbuf5, 15, 23, 23785, 32 * 32);<br>
+ }<br>
}<br>
diff -r 2e227fd23fe2 -r 636817b0f2b6 source/test/mbdstharness.h<br>
--- a/source/test/mbdstharness.h Thu Jun 27 17:57:42 2013 +0530<br>
+++ b/source/test/mbdstharness.h Thu Jun 27 18:00:13 2013 +0530<br>
@@ -34,11 +34,12 @@<br>
<br>
short *mbuf1, *mbuf2, *mbuf3, *mbuf4, *mbufdct;<br>
int *mbufidct;<br>
- int *mintbuf1, *mintbuf2, *mintbuf3, *mintbuf4;<br>
+ int *mintbuf1, *mintbuf2, *mintbuf3, *mintbuf4, *mintbuf5, *mintbuf6, *mintbuf7, *mintbuf8;<br>
static const int mb_t_size = 6400;<br>
static const int mem_cmp_size = 32 * 32;<br>
<br>
bool check_xdequant_primitive(x265::quant ref, x265::quant opt);<br>
+ bool check_xCalQuantCoefEAdp_primitive(x265::quantCoefEAdp ref, x265::quantCoefEAdp opt);<br>
bool check_dct_primitive(x265::dct_t ref, x265::dct_t opt, int width);<br>
bool check_idct_primitive(x265::idct_t ref, x265::idct_t opt, int width);<br>
<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="http://mailman.videolan.org/listinfo/x265-devel" target="_blank">http://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>