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

praveen at multicorewareinc.com praveen at multicorewareinc.com
Mon Nov 11 08:00:45 CET 2013


# HG changeset patch
# User Praveen Tiwari
# Date 1384153232 -19800
# Node ID be34513fdc32ca1215dbc5dc9ec6b42f7d254827
# Parent  e21aad3dd866f16281b27e8c743065de835e205d
unit test code for block_copy_ps function

diff -r e21aad3dd866 -r be34513fdc32 source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Mon Nov 11 11:41:51 2013 +0530
+++ b/source/test/pixelharness.cpp	Mon Nov 11 12:30:32 2013 +0530
@@ -536,6 +536,31 @@
     return true;
 }
 
+bool PixelHarness::check_block_copy_ps(copy_ps_t ref, copy_ps_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, 0xCD, sizeof(ref_dest));
+    memset(opt_dest, 0xCD, sizeof(opt_dest));
+
+    int j = 0;
+    for (int i = 0; i < ITERS; i++)
+    {
+        opt(opt_dest, STRIDE, pbuf2 + j, STRIDE);
+        ref(ref_dest, STRIDE, pbuf2 + j, STRIDE);
+
+        if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t)))
+            return false;
+
+        j += INCR;
+    }
+
+    return true;
+}
+
 bool PixelHarness::check_blockfill_s(blockfill_s_t ref, blockfill_s_t opt)
 {
     ALIGN_VAR_16(int16_t, ref_dest[64 * 64]);
@@ -676,6 +701,24 @@
             return false;
         }
     }
+
+    if (opt.luma_copy_ps[part])
+    {
+        if (!check_block_copy_ps(ref.luma_copy_ps[part], opt.luma_copy_ps[part]))
+        {
+            printf("luma_copy_ps[%s] failed\n", lumaPartStr[part]);
+            return false;
+        }
+    }
+
+    if (opt.chroma_copy_ps[part])
+    {
+        if (!check_block_copy_ps(ref.chroma_copy_ps[part], opt.chroma_copy_ps[part]))
+        {
+            printf("chroma_copy_ps[%s] failed\n", chromaPartStr[part]);
+            return false;
+        }
+    }
     return true;
 }
 
@@ -910,6 +953,18 @@
         printf("ccpy_sp[%s]", chromaPartStr[part]);
         REPORT_SPEEDUP(opt.chroma_copy_sp[part], ref.chroma_copy_sp[part], pbuf1, 64, sbuf3, 128);
     }
+
+    if (opt.luma_copy_ps[part])
+    {
+        printf("lcpy_ps[%s]", lumaPartStr[part]);
+        REPORT_SPEEDUP(opt.luma_copy_ps[part], ref.luma_copy_ps[part], sbuf1, 64, pbuf1, 128);
+    }
+
+    if (opt.chroma_copy_ps[part])
+    {
+        printf("ccpy_ps[%s]", chromaPartStr[part]);
+        REPORT_SPEEDUP(opt.chroma_copy_ps[part], ref.chroma_copy_ps[part], sbuf1, 64, pbuf1, 128);
+    }
 }
 
 void PixelHarness::measureSpeed(const EncoderPrimitives& ref, const EncoderPrimitives& opt)
diff -r e21aad3dd866 -r be34513fdc32 source/test/pixelharness.h
--- a/source/test/pixelharness.h	Mon Nov 11 11:41:51 2013 +0530
+++ b/source/test/pixelharness.h	Mon Nov 11 12:30:32 2013 +0530
@@ -57,6 +57,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_block_copy_ps(copy_ps_t ref, copy_ps_t opt);
 
     bool check_blockfill_s(blockfill_s_t ref, blockfill_s_t opt);
 public:


More information about the x265-devel mailing list