[x265] [PATCH Review Only] added pixelavg_pp fuction to testbench

dnyaneshwar at multicorewareinc.com dnyaneshwar at multicorewareinc.com
Thu Oct 17 17:06:29 CEST 2013


# HG changeset patch
# User Dnyaneshwar Gorade <dnyaneshwar at multicorewareinc.com>
# Date 1382022288 -19800
#      Thu Oct 17 20:34:48 2013 +0530
# Node ID f6d04c660b9bb1b0cf6274faf514be77148aa312
# Parent  dfae391107c3d2823adabe284f1c08278669d8f0
added pixelavg_pp fuction to testbench.

diff -r dfae391107c3 -r f6d04c660b9b source/common/vec/pixel-sse41.cpp
--- a/source/common/vec/pixel-sse41.cpp	Thu Oct 17 16:05:37 2013 +0530
+++ b/source/common/vec/pixel-sse41.cpp	Thu Oct 17 20:34:48 2013 +0530
@@ -5586,6 +5586,22 @@
     __m128i sum1  = _mm_hadd_epi32(sum, sum);
     return _mm_cvtsi128_si32(_mm_hadd_epi32(sum1, sum1));
 }
+
+template<int lx, int ly>
+void pixelavg_pp(pixel* dst, intptr_t dstride, pixel* src0, intptr_t sstride0, pixel* src1, intptr_t sstride1, int)
+{
+    for (int y = 0; y < ly; y++)
+    {
+        for (int x = 0; x < lx; x++)
+        {
+            dst[x] = (src0[x] + src1[x] + 1) >> 1;
+        }
+
+        src0 += sstride0;
+        src1 += sstride1;
+        dst += dstride;
+    }
+}
 }
 
 namespace x265 {
@@ -5645,6 +5661,26 @@
     SETUP_NONSAD(4, 4); // 4x4 SAD covered by assembly
     /* 4x4 is too small for any sub partitions */
 
+#define SET_FUNC_PRIMITIVE_TABLE_C_SUBSET2(FUNC_PREFIX, WIDTH) \
+    p.FUNC_PREFIX[PARTITION_ ## WIDTH ## x4]  = FUNC_PREFIX<WIDTH,  4>; \
+    p.FUNC_PREFIX[PARTITION_ ## WIDTH ## x8]  = FUNC_PREFIX<WIDTH,  8>; \
+    p.FUNC_PREFIX[PARTITION_ ## WIDTH ## x12] = FUNC_PREFIX<WIDTH, 12>; \
+    p.FUNC_PREFIX[PARTITION_ ## WIDTH ## x16] = FUNC_PREFIX<WIDTH, 16>; \
+    p.FUNC_PREFIX[PARTITION_ ## WIDTH ## x24] = FUNC_PREFIX<WIDTH, 24>; \
+    p.FUNC_PREFIX[PARTITION_ ## WIDTH ## x32] = FUNC_PREFIX<WIDTH, 32>; \
+    p.FUNC_PREFIX[PARTITION_ ## WIDTH ## x48] = FUNC_PREFIX<WIDTH, 48>; \
+    p.FUNC_PREFIX[PARTITION_ ## WIDTH ## x64] = FUNC_PREFIX<WIDTH, 64>;
+
+#define SET_FUNC_PRIMITIVE_TABLE_C2(FUNC_PREFIX) \
+    SET_FUNC_PRIMITIVE_TABLE_C_SUBSET2(FUNC_PREFIX,  4) \
+    SET_FUNC_PRIMITIVE_TABLE_C_SUBSET2(FUNC_PREFIX,  8) \
+    SET_FUNC_PRIMITIVE_TABLE_C_SUBSET2(FUNC_PREFIX, 12) \
+    SET_FUNC_PRIMITIVE_TABLE_C_SUBSET2(FUNC_PREFIX, 16) \
+    SET_FUNC_PRIMITIVE_TABLE_C_SUBSET2(FUNC_PREFIX, 24) \
+    SET_FUNC_PRIMITIVE_TABLE_C_SUBSET2(FUNC_PREFIX, 32) \
+    SET_FUNC_PRIMITIVE_TABLE_C_SUBSET2(FUNC_PREFIX, 48) \
+    SET_FUNC_PRIMITIVE_TABLE_C_SUBSET2(FUNC_PREFIX, 64) \
+
 #if HIGH_BIT_DEPTH
     Setup_Vec_Pixel16Primitives_sse41(p);
 #else
@@ -5661,6 +5697,9 @@
 
     p.weightpUniPixel = weightUnidirPixel;
     p.weightpUni = weightUnidir;
+
+    SET_FUNC_PRIMITIVE_TABLE_C2(pixelavg_pp)
+
 #endif /* !HIGH_BIT_DEPTH */
 }
 }
diff -r dfae391107c3 -r f6d04c660b9b source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Thu Oct 17 16:05:37 2013 +0530
+++ b/source/test/pixelharness.cpp	Thu Oct 17 20:34:48 2013 +0530
@@ -494,6 +494,29 @@
     return true;
 }
 
+bool PixelHarness::check_pixelavg_pp(pixelavg_pp_t ref, pixelavg_pp_t opt)
+{
+    ALIGN_VAR_16(pixel, ref_dest[64 * 64]);
+    ALIGN_VAR_16(pixel, opt_dest[64 * 64]);
+
+    memset(ref_dest, 0, 64 * 64 * sizeof(pixel));
+    memset(opt_dest, 0, 64 * 64 * sizeof(pixel));
+
+    int j = 0;
+
+    for (int i = 0; i < ITERS; i++)
+    {
+        opt(opt_dest, STRIDE, pbuf1 + j, STRIDE, pbuf2 + j, STRIDE, 32);
+        ref(ref_dest, STRIDE, pbuf1 + j, STRIDE, pbuf2 + j, STRIDE, 32);
+
+        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])
@@ -567,7 +590,14 @@
             return false;
         }
     }
-
+    if(opt.pixelavg_pp[part])
+    {
+        if (!check_pixelavg_pp(ref.pixelavg_pp[part], opt.pixelavg_pp[part]))
+        {
+            printf("pixelavg_pp[%s]: failed!\n", FuncNames[part]);
+            return false;
+        }
+    }
     return true;
 }
 
@@ -626,6 +656,14 @@
                 return false;
             }
         }
+        if(opt.pixelavg_pp[i])
+        {
+            if (!check_pixelavg_pp(ref.pixelavg_pp[i], opt.pixelavg_pp[i]))
+            {
+                printf("pixelavg_pp[%s]: failed!\n", FuncNames[i]);
+                return false;
+            }
+        }
     }
 
     if (opt.blockcpy_pp)
diff -r dfae391107c3 -r f6d04c660b9b source/test/pixelharness.h
--- a/source/test/pixelharness.h	Thu Oct 17 16:05:37 2013 +0530
+++ b/source/test/pixelharness.h	Thu Oct 17 20:34:48 2013 +0530
@@ -52,6 +52,7 @@
     bool check_pixeladd_ss(pixeladd_ss_t ref, pixeladd_ss_t opt);
     bool check_pixeladd_pp(pixeladd_pp_t ref, pixeladd_pp_t opt);
     bool check_downscale_t(downscale_t ref, downscale_t opt);
+    bool check_pixelavg_pp(pixelavg_pp_t ref, pixelavg_pp_t opt);
 
 public:
 


More information about the x265-devel mailing list