[x265] [PATCH] added test code for blockcopy_pp function

praveen at multicorewareinc.com praveen at multicorewareinc.com
Wed Oct 30 16:00:32 CET 2013


# HG changeset patch
# User Praveen Tiwari
# Date 1383145217 -19800
# Node ID 7cd172183c573220828fe04d2958b5a3ff8842af
# Parent  ad7f9c9a0c89b413f8a2e0da4d1a7f90139c297e
added test code for blockcopy_pp function

diff -r ad7f9c9a0c89 -r 7cd172183c57 source/common/primitives.h
--- a/source/common/primitives.h	Wed Oct 30 20:23:37 2013 +0530
+++ b/source/common/primitives.h	Wed Oct 30 20:30:17 2013 +0530
@@ -211,6 +211,8 @@
 typedef void (*filter_pp_t) (pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx);
 typedef void (*filter_hv_pp_t) (pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int idxX, int idxY);
 
+typedef void (*copy_pp_t)(pixel *dst, intptr_t dstride, pixel *src, intptr_t sstride); // dst is aligned
+
 /* Define a structure containing function pointers to optimized encoder
  * primitives.  Each pointer can reference either an assembly routine,
  * a vectorized primitive, or a C function. */
@@ -235,6 +237,8 @@
     cvt16to16_shl_t cvt16to16_shl;
     cvt32to16_shr_t cvt32to16_shr;
 
+    copy_pp_t       copy_chromaPartion_pp[NUM_CHROMA_PARTITIONS];
+
     ipfilter_pp_t   ipfilter_pp[NUM_IPFILTER_P_P];
     ipfilter_ps_t   ipfilter_ps[NUM_IPFILTER_P_S];
     ipfilter_sp_t   ipfilter_sp[NUM_IPFILTER_S_P];
diff -r ad7f9c9a0c89 -r 7cd172183c57 source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Wed Oct 30 20:23:37 2013 +0530
+++ b/source/test/pixelharness.cpp	Wed Oct 30 20:30:17 2013 +0530
@@ -528,6 +528,27 @@
     return true;
 }
 
+bool PixelHarness::check_block_copy_pp(copy_pp_t ref, copy_pp_t opt)
+{
+    ALIGN_VAR_16(pixel, ref_dest[64 * 64]);
+    ALIGN_VAR_16(pixel, opt_dest[64 * 64]);
+
+    int j = 0;
+    for (int i = 0; i < ITERS; i++)
+    {
+        opt(opt_dest, 64, pbuf2 + j, 128);
+        ref(ref_dest, 64, pbuf2 + j, 128);
+
+        if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel)))
+            return false;
+
+        j += 4;
+
+    }
+
+    return true;
+}
+
 bool PixelHarness::testPartition(int part, const EncoderPrimitives& ref, const EncoderPrimitives& opt)
 {
     if (opt.satd[part])
@@ -769,6 +790,19 @@
             return false;
         }
     }
+
+   for (int value = 0; value < NUM_CHROMA_PARTITIONS; value++)
+    {
+        if (opt.copy_chromaPartion_pp[value])
+        {
+            if (!check_block_copy_pp(ref.copy_chromaPartion_pp[value], opt.copy_chromaPartion_pp[value]))
+            {
+                printf("copy_chroma_pp[%s]", chromaPartStr[value]);
+                return false;
+            }
+        }
+   }
+
     return true;
 }
 
@@ -946,4 +980,14 @@
         printf("downscale");
         REPORT_SPEEDUP(opt.frame_init_lowres_core, ref.frame_init_lowres_core, pbuf2, pbuf1, pbuf2, pbuf3, pbuf4, 64, 64, 64, 64);
     }
+
+    for (int value = 0; value < NUM_CHROMA_PARTITIONS; value++)
+    {
+        if (opt.copy_chromaPartion_pp[value])
+        {
+            printf("copy_chroma_pp[%s]", chromaPartStr[value]);
+            REPORT_SPEEDUP(opt.copy_chromaPartion_pp[value], ref.copy_chromaPartion_pp[value],
+                           pbuf1, 64, pbuf2, 128);
+        }
+    }
 }
diff -r ad7f9c9a0c89 -r 7cd172183c57 source/test/pixelharness.h
--- a/source/test/pixelharness.h	Wed Oct 30 20:23:37 2013 +0530
+++ b/source/test/pixelharness.h	Wed Oct 30 20:30:17 2013 +0530
@@ -57,6 +57,7 @@
     bool check_cvt32to16_shr_t(cvt32to16_shr_t ref, cvt32to16_shr_t opt);
     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);
 public:
 
     PixelHarness();


More information about the x265-devel mailing list