[x265] [PATCH] unit test code for blockfil_s_c function

praveen at multicorewareinc.com praveen at multicorewareinc.com
Thu Nov 7 13:46:39 CET 2013


# HG changeset patch
# User Praveen Tiwari
# Date 1383828382 -19800
# Node ID d71f86b1c58b4fc9f8a3ffeaaef45c60f8bcc468
# Parent  6de480fbbfb94a709adb18dcd3fbef9169de7a97
unit test code for blockfil_s_c function

diff -r 6de480fbbfb9 -r d71f86b1c58b source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Thu Nov 07 13:10:44 2013 +0530
+++ b/source/test/pixelharness.cpp	Thu Nov 07 18:16:22 2013 +0530
@@ -604,6 +604,31 @@
     return true;
 }
 
+bool PixelHarness::check_blockfil_s(blockfill_s_t ref, blockfill_s_t opt)
+{
+    ALIGN_VAR_16(int16_t, ref_dest[64 * 64]);
+    ALIGN_VAR_16(int16_t, opt_dest[64 * 64]);
+
+    // we don't know the partition size so we are checking the entire output buffer so
+    // we must initialize the buffers
+    memset(ref_dest, 0, sizeof(ref_dest));
+    memset(opt_dest, 0, sizeof(opt_dest));
+
+    int16_t value = (rand() % SHORT_MAX) + 1;
+
+    for (int i = 0; i < ITERS; i++)
+    {
+        opt(opt_dest, 64, value);
+        ref(ref_dest, 64, value);
+
+        if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t)))
+            return false;
+
+    }
+
+    return true;
+}
+
 bool PixelHarness::testPartition(int part, const EncoderPrimitives& ref, const EncoderPrimitives& opt)
 {
     if (opt.satd[part])
@@ -798,6 +823,15 @@
                 return false;
             }
         }
+
+        if (opt.blockfill_s[i])
+        {
+            if (!check_blockfil_s(ref.blockfill_s[i], opt.blockfill_s[i]))
+            {
+                printf("blockfil_s[%dx%d]: failed!\n", 4 << i, 4 << i);
+                return false;
+            }
+        }
     }
 
     if (opt.cvt32to16_shr)
@@ -1044,6 +1078,12 @@
             printf("recon[%dx%d]", 4 << i, 4 << i);
             REPORT_SPEEDUP(opt.calcrecon[i], ref.calcrecon[i], pbuf1, sbuf1, pbuf2, sbuf1, pbuf1, 64, 64, 64);
         }
+
+        if (opt.blockfill_s[i])
+        {
+            printf("blockfill_s[%dx%d]", 4 << i, 4 << i);
+            REPORT_SPEEDUP(opt.blockfill_s[i], ref.blockfill_s[i], sbuf1, 64, SHORT_MAX);
+        }
     }
 
     if (opt.cvt32to16_shr)
diff -r 6de480fbbfb9 -r d71f86b1c58b source/test/pixelharness.h
--- a/source/test/pixelharness.h	Thu Nov 07 13:10:44 2013 +0530
+++ b/source/test/pixelharness.h	Thu Nov 07 18:16:22 2013 +0530
@@ -62,6 +62,7 @@
     bool check_block_copy_pp(copy_pp_t ref, copy_pp_t opt);
     bool check_block_copy_sp(copy_sp_t ref, copy_sp_t opt);
 
+    bool check_blockfil_s(blockfill_s_t ref, blockfill_s_t opt);
 public:
 
     PixelHarness();


More information about the x265-devel mailing list