[x265] [PATCH] added addAvg function in testbench

dnyaneshwar at multicorewareinc.com dnyaneshwar at multicorewareinc.com
Fri Nov 15 07:35:48 CET 2013


# HG changeset patch
# User Dnyaneshwar Gorade <dnyaneshwar at multicorewareinc.com>
# Date 1384496868 -19800
#      Fri Nov 15 11:57:48 2013 +0530
# Node ID c97fb07510aedb1dd680beab3cd572b7af5c9eaa
# Parent  3c396b064d578b480302e70f52dcc2bf4380f74b
added addAvg function in testbench

diff -r 3c396b064d57 -r c97fb07510ae source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Fri Nov 15 11:35:19 2013 +0530
+++ b/source/test/pixelharness.cpp	Fri Nov 15 11:57:48 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,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;
 }
 
@@ -1021,6 +1064,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]", lumaPartStr[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 3c396b064d57 -r c97fb07510ae source/test/pixelharness.h
--- a/source/test/pixelharness.h	Fri Nov 15 11:35:19 2013 +0530
+++ b/source/test/pixelharness.h	Fri Nov 15 11:57:48 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