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

praveen at multicorewareinc.com praveen at multicorewareinc.com
Thu Nov 7 08:40:55 CET 2013


# HG changeset patch
# User Praveen Tiwari
# Date 1383810044 -19800
# Node ID 6de480fbbfb94a709adb18dcd3fbef9169de7a97
# Parent  34ba8955747b66dcf3471fa216d15b97a3b07e0c
unit test code for pixelsub_ps function

diff -r 34ba8955747b -r 6de480fbbfb9 source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Thu Nov 07 12:31:35 2013 +0530
+++ b/source/test/pixelharness.cpp	Thu Nov 07 13:10:44 2013 +0530
@@ -578,6 +578,32 @@
     return true;
 }
 
+bool PixelHarness::check_pixelsub_ps(pixelsub_ps_t ref, pixelsub_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, 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, pbuf2 + j, pbuf1 + j, STRIDE, STRIDE);
+        ref(ref_dest, 64, pbuf2 + j, pbuf1 + j, STRIDE, STRIDE);
+
+        if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t)))
+            return false;
+
+        j += INCR;
+
+    }
+
+    return true;
+}
+
 bool PixelHarness::testPartition(int part, const EncoderPrimitives& ref, const EncoderPrimitives& opt)
 {
     if (opt.satd[part])
@@ -696,6 +722,24 @@
             return false;
         }
     }
+
+    if (opt.luma_pixelsub_ps[part])
+    {
+        if (!check_pixelsub_ps(ref.luma_pixelsub_ps[part], opt.luma_pixelsub_ps[part]))
+        {
+            printf("luma_pixelsub_ps[%s] failed\n", lumaPartStr[part]);
+            return false;
+        }
+    }
+
+    if (opt.chroma_pixelsub_ps[part])
+    {
+        if (!check_pixelsub_ps(ref.chroma_pixelsub_ps[part], opt.chroma_pixelsub_ps[part]))
+        {
+            printf("chroma_pixelsub_ps[%s] failed\n", chromaPartStr[part]);
+            return false;
+        }
+    }
     return true;
 }
 
@@ -939,6 +983,18 @@
         printf("ccpy_sp[%s]", chromaPartStr[part]);
         REPORT_SPEEDUP(opt.chroma_copy_sp[part], ref.chroma_copy_sp[part], pbuf1, 64, sbuf1, 128);
     }
+
+    if (opt.luma_pixelsub_ps[part])
+    {
+        printf("lpixelsub_ps[%s]", lumaPartStr[part]);
+        REPORT_SPEEDUP(opt.luma_pixelsub_ps[part], ref.luma_pixelsub_ps[part], sbuf1, FENC_STRIDE, pbuf2, pbuf1, STRIDE, STRIDE);
+    }
+
+    if (opt.chroma_pixelsub_ps[part])
+    {
+        printf("cpixelsub_ps[%s]", chromaPartStr[part]);
+        REPORT_SPEEDUP(opt.chroma_pixelsub_ps[part], ref.chroma_pixelsub_ps[part], sbuf1, FENC_STRIDE, pbuf2, pbuf1, STRIDE, STRIDE);
+    }
 }
 
 void PixelHarness::measureSpeed(const EncoderPrimitives& ref, const EncoderPrimitives& opt)
diff -r 34ba8955747b -r 6de480fbbfb9 source/test/pixelharness.h
--- a/source/test/pixelharness.h	Thu Nov 07 12:31:35 2013 +0530
+++ b/source/test/pixelharness.h	Thu Nov 07 13:10:44 2013 +0530
@@ -57,6 +57,8 @@
     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_pixelsub_ps(pixelsub_ps_t ref, pixelsub_ps_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);
 


More information about the x265-devel mailing list