[x265] [PATCH] unit test code for blockcopy_ps_c

praveen at multicorewareinc.com praveen at multicorewareinc.com
Mon Nov 4 16:02:13 CET 2013


# HG changeset patch
# User Praveen Tiwari
# Date 1383577321 -19800
# Node ID df03ee5e3e440a4af0429be6404142ecd9a64861
# Parent  20b712dce6c237f64ea3ca2a06fc4cb9370ad91f
unit test code for blockcopy_ps_c

diff -r 20b712dce6c2 -r df03ee5e3e44 source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Mon Nov 04 19:34:23 2013 +0530
+++ b/source/test/pixelharness.cpp	Mon Nov 04 20:32:01 2013 +0530
@@ -553,6 +553,31 @@
     return true;
 }
 
+bool PixelHarness::check_block_copy_ps(copy_ps_t ref, copy_ps_t opt)
+{
+    ALIGN_VAR_16(pixel, ref_dest[64 * 64]);
+    ALIGN_VAR_16(pixel, 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));
+
+    int j = 0;
+    for (int i = 0; i < ITERS; i++)
+    {
+        opt(opt_dest, 64, (int16_t*)pbuf2 + j, STRIDE);
+        ref(ref_dest, 64, (int16_t*)pbuf2 + j, STRIDE);
+
+        if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
+            return false;
+
+        j += INCR;
+    }
+
+    return true;
+}
+
 bool PixelHarness::testPartition(int part, const EncoderPrimitives& ref, const EncoderPrimitives& opt)
 {
     if (opt.satd[part])
@@ -653,6 +678,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;
 }
 
@@ -884,6 +927,18 @@
         printf("chroma_copy_pp[%s]", chromaPartStr[part]);
         REPORT_SPEEDUP(opt.chroma_copy_pp[part], ref.chroma_copy_pp[part], pbuf1, 64, pbuf2, 128);
     }
+
+    if (opt.luma_copy_ps[part])
+    {
+        printf("luma_copy_ps[%s]", lumaPartStr[part]);
+        REPORT_SPEEDUP(opt.luma_copy_ps[part], ref.luma_copy_ps[part], pbuf1, 64, (int16_t*)pbuf2, 128);
+    }
+
+    if (opt.chroma_copy_ps[part])
+    {
+        printf("chroma_copy_ps[%s]", chromaPartStr[part]);
+        REPORT_SPEEDUP(opt.chroma_copy_ps[part], ref.chroma_copy_ps[part], pbuf1, 64, (int16_t*)pbuf2, 128);
+    }
 }
 
 void PixelHarness::measureSpeed(const EncoderPrimitives& ref, const EncoderPrimitives& opt)
diff -r 20b712dce6c2 -r df03ee5e3e44 source/test/pixelharness.h
--- a/source/test/pixelharness.h	Mon Nov 04 19:34:23 2013 +0530
+++ b/source/test/pixelharness.h	Mon Nov 04 20:32:01 2013 +0530
@@ -58,6 +58,7 @@
     bool check_pixelavg_pp(pixelavg_pp_t ref, pixelavg_pp_t opt);
 
     bool check_block_copy_pp(copy_pp_t ref, copy_pp_t opt);
+    bool check_block_copy_ps(copy_ps_t ref, copy_ps_t opt);
 public:
 
     PixelHarness();


More information about the x265-devel mailing list