[x265] [PATCH] added addAvg primitive function in testbench

dnyaneshwar at multicorewareinc.com dnyaneshwar at multicorewareinc.com
Mon Nov 18 08:23:51 CET 2013


# HG changeset patch
# User Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
# Date 1384759364 -19800
#      Mon Nov 18 12:52:44 2013 +0530
# Node ID edcbee120b25496b246a6e8cb5f208860c57c153
# Parent  ee062baf96b18ab2ecd64a2e4219b2a5a3c09e5d
added addAvg primitive function in testbench

diff -r ee062baf96b1 -r edcbee120b25 source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Mon Nov 18 12:41:27 2013 +0530
+++ b/source/test/pixelharness.cpp	Mon Nov 18 12:52:44 2013 +0530
@@ -632,6 +632,30 @@
     return true;
 }
 
+bool PixelHarness::check_addAvg(addAvg_t ref, addAvg_t opt)
+{
+    ALIGN_VAR_16(pixel, ref_dest[64 * 64]);
+    ALIGN_VAR_16(pixel, opt_dest[64 * 64]);
+
+    int j = 0;
+
+    memset(ref_dest, 0xCD, sizeof(ref_dest));
+    memset(opt_dest, 0xCD, sizeof(opt_dest));
+
+    for (int i = 0; i < ITERS; i++)
+    {
+        ref(ref_dest, STRIDE, sbuf1 + j, STRIDE, sbuf2 + j, STRIDE);
+        opt(opt_dest, STRIDE, sbuf1 + j, STRIDE, sbuf2 + 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])
@@ -789,6 +813,25 @@
             return false;
         }
     }
+
+    if (opt.luma_addAvg[part])
+    {
+        if (!check_addAvg(ref.luma_addAvg[part], opt.luma_addAvg[part]))
+        {
+            printf("luma_addAvg[%s] failed\n", lumaPartStr[part]);
+            return false;
+        }
+    }
+
+    if (opt.chroma_addAvg[part])
+    {
+        if (!check_addAvg(ref.chroma_addAvg[part], opt.chroma_addAvg[part]))
+        {
+            printf("chroma_addAvg[%s] failed\n", chromaPartStr[part]);
+            return false;
+        }
+    }
+
     return true;
 }
 
@@ -1068,6 +1111,18 @@
         printf("chroma_sub_ps[%s]", chromaPartStr[part]);
         REPORT_SPEEDUP(opt.chroma_sub_ps[part], ref.chroma_sub_ps[part], (int16_t*)pbuf1, FENC_STRIDE, pbuf2, pbuf1, STRIDE, STRIDE);
     }
+
+    if (opt.luma_addAvg[part])
+    {
+        printf("luma_addAvg[%s]", lumaPartStr[part]);
+        REPORT_SPEEDUP(opt.luma_addAvg[part], ref.luma_addAvg[part], pbuf1, STRIDE, sbuf1, STRIDE, sbuf2, STRIDE);
+    }
+
+    if (opt.chroma_addAvg[part])
+    {
+        printf("chroma_addAvg[%s]", chromaPartStr[part]);
+        REPORT_SPEEDUP(opt.chroma_addAvg[part], ref.chroma_addAvg[part], pbuf1, STRIDE, sbuf1, STRIDE, sbuf2, STRIDE);
+    }
 }
 
 void PixelHarness::measureSpeed(const EncoderPrimitives& ref, const EncoderPrimitives& opt)
diff -r ee062baf96b1 -r edcbee120b25 source/test/pixelharness.h
--- a/source/test/pixelharness.h	Mon Nov 18 12:41:27 2013 +0530
+++ b/source/test/pixelharness.h	Mon Nov 18 12:52:44 2013 +0530
@@ -64,6 +64,8 @@
     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);
+
+    bool check_addAvg(addAvg_t, addAvg_t);
 public:
 
     PixelHarness();


More information about the x265-devel mailing list