[x265] [PATCH] Unit test code for Pixel scaling

murugan at multicorewareinc.com murugan at multicorewareinc.com
Thu Nov 14 11:58:33 CET 2013


# HG changeset patch
# User Murugan Vairavel <murugan at multicorewareinc.com>
# Date 1384421320 -19800
#      Thu Nov 14 14:58:40 2013 +0530
# Node ID 4c91093ffb3fc596ce5894d7855b1f4e8b7912ce
# Parent  481cdfc251de0f99ef0a3c4fd53c786b79b5f182
Unit test code for Pixel scaling

diff -r 481cdfc251de -r 4c91093ffb3f source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Wed Nov 13 12:46:07 2013 +0530
+++ b/source/test/pixelharness.cpp	Thu Nov 14 14:58:40 2013 +0530
@@ -586,6 +586,29 @@
     return true;
 }
 
+bool PixelHarness::check_pixel_scale_pp(scale_t ref, scale_t opt)
+{
+    ALIGN_VAR_16(pixel, ref_dest[64 * 64]);
+    ALIGN_VAR_16(pixel, opt_dest[64 * 64]);
+
+    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, pbuf1 + j, STRIDE);
+        ref(ref_dest, pbuf1 + 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])
@@ -880,6 +903,24 @@
             return false;
         }
     }
+
+    if (opt.scale1D_128to64)
+    {
+        if (!check_pixel_scale_pp(ref.scale1D_128to64, opt.scale1D_128to64))
+        {
+            printf("scale1D_128to64 failed!\n");
+            return false;
+        }
+    }
+
+    if (opt.scale2D_64to32)
+    {
+        if (!check_pixel_scale_pp(ref.scale2D_64to32, opt.scale2D_64to32))
+        {
+            printf("scale2D_64to32 failed!\n");
+            return false;
+        }
+    }
     return true;
 }
 
@@ -1093,4 +1134,16 @@
         printf("downscale");
         REPORT_SPEEDUP(opt.frame_init_lowres_core, ref.frame_init_lowres_core, pbuf2, pbuf1, pbuf2, pbuf3, pbuf4, 64, 64, 64, 64);
     }
+
+    if (opt.scale1D_128to64)
+    {
+        printf("scale1D_128to64");
+        REPORT_SPEEDUP(opt.scale1D_128to64, ref.scale1D_128to64, pbuf2, pbuf1, 64);
+    }
+
+    if (opt.scale2D_64to32)
+    {
+        printf("scale2D_64to32");
+        REPORT_SPEEDUP(opt.scale2D_64to32, ref.scale2D_64to32, pbuf2, pbuf1, 64);
+    }
 }
diff -r 481cdfc251de -r 4c91093ffb3f source/test/pixelharness.h
--- a/source/test/pixelharness.h	Wed Nov 13 12:46:07 2013 +0530
+++ b/source/test/pixelharness.h	Thu Nov 14 14:58:40 2013 +0530
@@ -61,6 +61,8 @@
     bool check_blockfill_s(blockfill_s_t ref, blockfill_s_t opt);
 
     bool check_pixel_sub_ps(pixel_sub_ps_t ref, pixel_sub_ps_t opt);
+
+    bool check_pixel_scale_pp(scale_t ref, scale_t opt);
 public:
 
     PixelHarness();


More information about the x265-devel mailing list