[x265] [PATCH] unit test code for scale1D_128to64

murugan at multicorewareinc.com murugan at multicorewareinc.com
Wed Nov 13 16:02:30 CET 2013


# HG changeset patch
# User Murugan Vairavel <murugan at multicorewareinc.com>
# Date 1384354925 -19800
#      Wed Nov 13 20:32:05 2013 +0530
# Node ID ae46503b8f94b89300c2fcd027fbc30bcc6136eb
# Parent  29f7e68d450f0b71153f6bf5794ae4d1c118ac55
unit test code for scale1D_128to64

diff -r 29f7e68d450f -r ae46503b8f94 source/common/pixel.cpp
--- a/source/common/pixel.cpp	Wed Nov 13 20:30:26 2013 +0530
+++ b/source/common/pixel.cpp	Wed Nov 13 20:32:05 2013 +0530
@@ -974,6 +974,9 @@
     p.pixeladd_ss = pixeladd_ss_c;
 
     p.scale1D_128to64 = scale1D_128to64;
+
+    p.scale_1D_128to64 = scale1D_128to64;
+
     p.scale2D_64to32 = scale2D_64to32;
     p.frame_init_lowres_core = frame_init_lowres_core;
     p.ssim_4x4x2_core = ssim_4x4x2_core;
diff -r 29f7e68d450f -r ae46503b8f94 source/common/primitives.h
--- a/source/common/primitives.h	Wed Nov 13 20:30:26 2013 +0530
+++ b/source/common/primitives.h	Wed Nov 13 20:32:05 2013 +0530
@@ -281,6 +281,9 @@
 
     scale_t         scale1D_128to64;
     scale_t         scale2D_64to32;
+
+    scale_t         scale_1D_128to64;
+
     downscale_t     frame_init_lowres_core;
     ssim_end4_t     ssim_end_4;
     var_t           var[NUM_LUMA_PARTITIONS];
diff -r 29f7e68d450f -r ae46503b8f94 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Wed Nov 13 20:30:26 2013 +0530
+++ b/source/common/x86/asm-primitives.cpp	Wed Nov 13 20:32:05 2013 +0530
@@ -411,6 +411,8 @@
         // until all partitions are coded and commit smaller patches, easier to
         // review.
 
+        p.scale_1D_128to64 = x265_scale_1D_128to64_sse2;
+
         p.chroma_copy_sp[CHROMA_4x2] = x265_blockcopy_sp_4x2_sse2;
         p.chroma_copy_sp[CHROMA_4x4] = x265_blockcopy_sp_4x4_sse2;
         p.chroma_copy_sp[CHROMA_4x8] = x265_blockcopy_sp_4x8_sse2;
diff -r 29f7e68d450f -r ae46503b8f94 source/common/x86/pixel.h
--- a/source/common/x86/pixel.h	Wed Nov 13 20:30:26 2013 +0530
+++ b/source/common/x86/pixel.h	Wed Nov 13 20:32:05 2013 +0530
@@ -117,6 +117,8 @@
 int x265_pixel_satd_16x32_sse2(pixel *, intptr_t, pixel *, intptr_t);
 int x265_pixel_satd_16x64_sse2(pixel *, intptr_t, pixel *, intptr_t);
 
+void x265_scale_1D_128to64_sse2(pixel *, pixel *, intptr_t);
+
 DECL_PIXELS(uint64_t, var, mmx2, (pixel * pix, intptr_t i_stride))
 DECL_PIXELS(uint64_t, var, sse2, (pixel * pix, intptr_t i_stride))
 DECL_PIXELS(uint64_t, var, avx,  (pixel * pix, intptr_t i_stride))
diff -r 29f7e68d450f -r ae46503b8f94 source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Wed Nov 13 20:30:26 2013 +0530
+++ b/source/test/pixelharness.cpp	Wed Nov 13 20:32:05 2013 +0530
@@ -586,6 +586,29 @@
     return true;
 }
 
+bool PixelHarness::check_scale_pixel_t(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,15 @@
             return false;
         }
     }
+
+    if (opt.scale_1D_128to64)
+    {
+        if (!check_scale_pixel_t(ref.scale_1D_128to64, opt.scale_1D_128to64))
+        {
+            printf("scale1D_128to64 failed!\n");
+            return false;
+        }
+    }
     return true;
 }
 
@@ -1093,4 +1125,10 @@
         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.scale_1D_128to64)
+    {
+        printf("scale_1D_128to64");
+        REPORT_SPEEDUP(opt.scale_1D_128to64, ref.scale_1D_128to64, pbuf2, pbuf1, 64);
+    }
 }
diff -r 29f7e68d450f -r ae46503b8f94 source/test/pixelharness.h
--- a/source/test/pixelharness.h	Wed Nov 13 20:30:26 2013 +0530
+++ b/source/test/pixelharness.h	Wed Nov 13 20:32:05 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_scale_pixel_t(scale_t ref, scale_t opt);
 public:
 
     PixelHarness();


More information about the x265-devel mailing list