[x265] [PATCH] added addAvg function in testbench

dnyaneshwar at multicorewareinc.com dnyaneshwar at multicorewareinc.com
Wed Nov 13 13:08:07 CET 2013


# HG changeset patch
# User Dnyaneshwar Gorade <dnyaneshwar at multicorewareinc.com>
# Date 1384344170 -19800
#      Wed Nov 13 17:32:50 2013 +0530
# Node ID 68ef53252a0a819a90fd311e391e8874dd98106f
# Parent  c14e25a6ad035ac664548d6ada3e2e6e244bb3ce
added addAvg function in testbench

diff -r c14e25a6ad03 -r 68ef53252a0a source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Wed Nov 13 17:05:56 2013 +0530
+++ b/source/test/pixelharness.cpp	Wed Nov 13 17:32:50 2013 +0530
@@ -609,6 +609,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])
@@ -763,6 +787,15 @@
             return false;
         }
     }
+
+    if (opt.addAvg[part])
+    {
+        if (!check_addAvg(ref.addAvg[part], opt.addAvg[part]))
+        {
+            printf("addAvg[%s] failed\n", lumaPartStr[part]);
+            return false;
+        }
+    }
     return true;
 }
 
@@ -1021,6 +1054,12 @@
         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.addAvg[part])
+    {
+        printf("addAvg[%s]", lumaPartStr[part]);
+        REPORT_SPEEDUP(opt.addAvg[part], ref.addAvg[part], pbuf1, STRIDE, sbuf1, STRIDE, sbuf2, STRIDE);
+    }
 }
 
 void PixelHarness::measureSpeed(const EncoderPrimitives& ref, const EncoderPrimitives& opt)
diff -r c14e25a6ad03 -r 68ef53252a0a source/test/pixelharness.h
--- a/source/test/pixelharness.h	Wed Nov 13 17:05:56 2013 +0530
+++ b/source/test/pixelharness.h	Wed Nov 13 17:32:50 2013 +0530
@@ -62,6 +62,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_addAvg(addAvg_t, addAvg_t);
 public:
 
     PixelHarness();


More information about the x265-devel mailing list