[x265] [PATCH] asm: testbench code for costCoeffRemain()

sumalatha at multicorewareinc.com sumalatha at multicorewareinc.com
Thu Jul 23 14:44:59 CEST 2015


# HG changeset patch
# User Sumalatha Polureddy
# Date 1437655489 -19800
# Node ID cdb3b781436110b0d287ff7156de53c93e8707b1
# Parent  42bc8575020b73d129d0bcef70c7cbe80a8b51df
asm: testbench code for costCoeffRemain()

diff -r 42bc8575020b -r cdb3b7814361 source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp	Wed Jul 22 12:56:34 2015 -0500
+++ b/source/common/x86/asm-primitives.cpp	Thu Jul 23 18:14:49 2015 +0530
@@ -2557,7 +2557,7 @@
         p.costCoeffNxN = PFX(costCoeffNxN_sse4);
 #endif
         // TODO: it is passed smoke test, but we need testbench to active it, so temporary disable
-        //p.costCoeffRemain = x265_costCoeffRemain_sse4;
+        p.costCoeffRemain = x265_costCoeffRemain_sse4;
     }
     if (cpuMask & X265_CPU_AVX)
     {
diff -r 42bc8575020b -r cdb3b7814361 source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp	Wed Jul 22 12:56:34 2015 -0500
+++ b/source/test/pixelharness.cpp	Thu Jul 23 18:14:49 2015 +0530
@@ -1698,6 +1698,37 @@
     }
     return true;
 }
+bool PixelHarness::check_costCoeffRemain(costCoeffRemain_t ref, costCoeffRemain_t opt)
+{
+    ALIGN_VAR_32(uint16_t, absCoeff[1 << MLS_CG_SIZE]);
+
+    for (int i = 0; i < (1 << MLS_CG_SIZE); i++)
+    {
+        absCoeff[i] = rand() & SHORT_MAX;
+        // more coeff with value one
+        if (absCoeff[i] < SHORT_MAX * 2 / 3)
+            absCoeff[i] = 1;
+    }
+    for (int i = 0; i < ITERS; i++)
+    {
+        uint32_t firstC2Idx = 0;
+        int k = 0;
+        int numNonZero = rand() % 17; //can be random, range[1, 16]
+        for (k = 0; k < C1FLAG_NUMBER; k++)
+        {
+            if (absCoeff[k] >= 2)
+            {
+                break;
+            }
+        }
+        firstC2Idx = k; // it is index of exact first coeff that value more than 2
+        int ref_sum = ref(absCoeff, numNonZero, firstC2Idx);
+        int opt_sum = (int)checked(opt, absCoeff, numNonZero, firstC2Idx);
+        if (ref_sum != opt_sum)
+            return false;
+    }
+    return true;
+}
 
 bool PixelHarness::testPU(int part, const EncoderPrimitives& ref, const EncoderPrimitives& opt)
 {
@@ -2318,6 +2349,14 @@
             return false;
         }
     }
+    if (opt.costCoeffRemain)
+    {
+        if (!check_costCoeffRemain(ref.costCoeffRemain, opt.costCoeffRemain))
+        {
+            printf("costCoeffRemain failed!\n");
+            return false;
+        }
+    }
 
     return true;
 }
@@ -2781,4 +2820,12 @@
 
         REPORT_SPEEDUP(opt.costCoeffNxN, ref.costCoeffNxN, g_scan4x4[SCAN_DIAG], coefBuf, 32, tmpOut, ctxSig, 0xFFFF, ctx, 1, 15, 32);
     }
+    if (opt.costCoeffRemain)
+    {
+        HEADER0("costCoeffRemain");
+        uint16_t abscoefBuf[32 * 32];
+        memset(abscoefBuf, 0, sizeof(abscoefBuf));
+        memset(abscoefBuf + 32 * 31, 1, 32 * sizeof(uint16_t));
+        REPORT_SPEEDUP(opt.costCoeffRemain, ref.costCoeffRemain, abscoefBuf, 16, 3);
+    }
 }
diff -r 42bc8575020b -r cdb3b7814361 source/test/pixelharness.h
--- a/source/test/pixelharness.h	Wed Jul 22 12:56:34 2015 -0500
+++ b/source/test/pixelharness.h	Thu Jul 23 18:14:49 2015 +0530
@@ -114,7 +114,7 @@
     bool check_scanPosLast(scanPosLast_t ref, scanPosLast_t opt);
     bool check_findPosFirstLast(findPosFirstLast_t ref, findPosFirstLast_t opt);
     bool check_costCoeffNxN(costCoeffNxN_t ref, costCoeffNxN_t opt);
-
+    bool check_costCoeffRemain(costCoeffRemain_t ref, costCoeffRemain_t opt);
 
 public:
 


More information about the x265-devel mailing list