[x265] [PATCH] testbench support for addAvg primitive

dnyaneshwar at multicorewareinc.com dnyaneshwar at multicorewareinc.com
Sat Jan 18 07:32:25 CET 2014


# HG changeset patch
# User Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
# Date 1390026704 -19800
#      Sat Jan 18 12:01:44 2014 +0530
# Node ID 2e4e32a50cd6d80dbcf96338c934e5e5e1f05be5
# Parent  be1a797c72e868f09fa15efb47d3450f1506ff77
testbench support for addAvg primitive

diff -r be1a797c72e8 -r 2e4e32a50cd6 source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Fri Jan 17 12:18:25 2014 +0530
+++ b/source/test/pixelharness.cpp	Sat Jan 18 12:01:44 2014 +0530
@@ -763,6 +763,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])
@@ -935,6 +959,24 @@
         }
     }
 
+    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;
 }
 
@@ -1258,6 +1300,18 @@
         }
     }
 
+    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);
+    }
+
 #undef HEADER
 }
 
diff -r be1a797c72e8 -r 2e4e32a50cd6 source/test/pixelharness.h
--- a/source/test/pixelharness.h	Fri Jan 17 12:18:25 2014 +0530
+++ b/source/test/pixelharness.h	Sat Jan 18 12:01:44 2014 +0530
@@ -64,6 +64,7 @@
     bool check_pixel_var(var_t ref, var_t opt);
     bool check_ssim_4x4x2_core(ssim_4x4x2_core_t ref, ssim_4x4x2_core_t opt);
     bool check_ssim_end(ssim_end4_t ref, ssim_end4_t opt);
+    bool check_addAvg(addAvg_t, addAvg_t);
 
 public:
 


More information about the x265-devel mailing list