[x265] [PATCH] changed naming convention and added unit test code for blockcopy_sp function

praveen at multicorewareinc.com praveen at multicorewareinc.com
Tue Nov 5 10:43:51 CET 2013


# HG changeset patch
# User Praveen Tiwari
# Date 1383644622 -19800
# Node ID 33486d409515d5f9fd451818f7623a92690a219d
# Parent  c57ed1fd7bd568b8662ba5f2ffb94eb01c3a0157
changed naming convention and added unit test code for blockcopy_sp function

diff -r c57ed1fd7bd5 -r 33486d409515 source/common/pixel.cpp
--- a/source/common/pixel.cpp	Tue Nov 05 00:39:00 2013 -0600
+++ b/source/common/pixel.cpp	Tue Nov 05 15:13:42 2013 +0530
@@ -775,7 +775,7 @@
 }
 
 template<int bx, int by>
-void blockcopy_ps_c(pixel *a, intptr_t stridea, int16_t *b, intptr_t strideb)
+void blockcopy_sp_c(pixel *a, intptr_t stridea, int16_t *b, intptr_t strideb)
 {
     for (int y = 0; y < by; y++)
     {
@@ -830,10 +830,10 @@
 
 #define CHROMA(W, H) \
     p.chroma_copy_pp[CHROMA_ ## W ## x ## H] = blockcopy_pp_c<W, H>;\
-    p.chroma_copy_ps[CHROMA_ ## W ## x ## H] = blockcopy_ps_c<W, H>;
+    p.chroma_copy_sp[CHROMA_ ## W ## x ## H] = blockcopy_sp_c<W, H>;
 #define LUMA(W, H) \
     p.luma_copy_pp[LUMA_ ## W ## x ## H] = blockcopy_pp_c<W, H>;\
-    p.luma_copy_ps[LUMA_ ## W ## x ## H] = blockcopy_ps_c<W, H>;
+    p.luma_copy_sp[LUMA_ ## W ## x ## H] = blockcopy_sp_c<W, H>;
 
     LUMA(4, 4);
     LUMA(8, 8);   CHROMA(4, 4);
diff -r c57ed1fd7bd5 -r 33486d409515 source/common/primitives.h
--- a/source/common/primitives.h	Tue Nov 05 00:39:00 2013 -0600
+++ b/source/common/primitives.h	Tue Nov 05 15:13:42 2013 +0530
@@ -213,7 +213,7 @@
 typedef void (*filter_p2s_t)(pixel *src, intptr_t srcStride, int16_t *dst, int width, int height);
 
 typedef void (*copy_pp_t)(pixel *dst, intptr_t dstride, pixel *src, intptr_t sstride); // dst is aligned
-typedef void (*copy_ps_t)(pixel *dst, intptr_t dstStride, int16_t *src, intptr_t srcStride);
+typedef void (*copy_sp_t)(pixel *dst, intptr_t dstStride, int16_t *src, intptr_t srcStride);
 
 /* Define a structure containing function pointers to optimized encoder
  * primitives.  Each pointer can reference either an assembly routine,
@@ -241,8 +241,8 @@
 
     copy_pp_t       luma_copy_pp[NUM_LUMA_PARTITIONS];
     copy_pp_t       chroma_copy_pp[NUM_CHROMA_PARTITIONS];
-    copy_ps_t       luma_copy_ps[NUM_LUMA_PARTITIONS];
-    copy_ps_t       chroma_copy_ps[NUM_CHROMA_PARTITIONS];
+    copy_sp_t       luma_copy_sp[NUM_LUMA_PARTITIONS];
+    copy_sp_t       chroma_copy_sp[NUM_CHROMA_PARTITIONS];
 
     ipfilter_pp_t   ipfilter_pp[NUM_IPFILTER_P_P];
     ipfilter_ps_t   ipfilter_ps[NUM_IPFILTER_P_S];
diff -r c57ed1fd7bd5 -r 33486d409515 source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Tue Nov 05 00:39:00 2013 -0600
+++ b/source/test/pixelharness.cpp	Tue Nov 05 15:13:42 2013 +0530
@@ -553,6 +553,31 @@
     return true;
 }
 
+bool PixelHarness::check_block_copy_sp(copy_sp_t ref, copy_sp_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, sbuf1 + j, STRIDE);
+        ref(ref_dest, 64, sbuf1 + 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_sp[part])
+    {
+        if (!check_block_copy_sp(ref.luma_copy_sp[part], opt.luma_copy_sp[part]))
+        {
+            printf("luma_copy_sp[%s] failed\n", lumaPartStr[part]);
+            return false;
+        }
+    }
+
+    if (opt.chroma_copy_sp[part])
+    {
+        if (!check_block_copy_sp(ref.chroma_copy_sp[part], opt.chroma_copy_sp[part]))
+        {
+            printf("chroma_copy_sp[%s] failed\n", chromaPartStr[part]);
+            return false;
+        }
+    }
     return true;
 }
 
@@ -884,6 +927,18 @@
         printf("ccpy_pp[%s]", chromaPartStr[part]);
         REPORT_SPEEDUP(opt.chroma_copy_pp[part], ref.chroma_copy_pp[part], pbuf1, 64, pbuf2, 128);
     }
+
+    if (opt.luma_copy_sp[part])
+    {
+        printf("lcpy_sp[%s]", lumaPartStr[part]);
+        REPORT_SPEEDUP(opt.luma_copy_sp[part], ref.luma_copy_sp[part], pbuf1, 64, sbuf1, 128);
+    }
+
+    if (opt.chroma_copy_sp[part])
+    {
+        printf("ccpy_sp[%s]", chromaPartStr[part]);
+        REPORT_SPEEDUP(opt.chroma_copy_sp[part], ref.chroma_copy_sp[part], pbuf1, 64, sbuf1, 128);
+    }
 }
 
 void PixelHarness::measureSpeed(const EncoderPrimitives& ref, const EncoderPrimitives& opt)
diff -r c57ed1fd7bd5 -r 33486d409515 source/test/pixelharness.h
--- a/source/test/pixelharness.h	Tue Nov 05 00:39:00 2013 -0600
+++ b/source/test/pixelharness.h	Tue Nov 05 15:13:42 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_sp(copy_sp_t ref, copy_sp_t opt);
 public:
 
     PixelHarness();


More information about the x265-devel mailing list