[x265] [PATCH] unit test code for luma filter

praveen at multicorewareinc.com praveen at multicorewareinc.com
Thu Oct 17 17:30:38 CEST 2013


# HG changeset patch
# User Praveen Tiwari
# Date 1382023827 -19800
# Node ID 1481908edb21eea0225eb03de0b852921d4c209f
# Parent  b5375476fdedcce6e60c71c215ed95c923b9df43
unit test code for luma filter

diff -r b5375476fded -r 1481908edb21 source/test/ipfilterharness.cpp
--- a/source/test/ipfilterharness.cpp	Thu Oct 17 20:55:11 2013 +0530
+++ b/source/test/ipfilterharness.cpp	Thu Oct 17 21:00:27 2013 +0530
@@ -3,6 +3,7 @@
  *
  * Authors: Deepthi Devaki <deepthidevaki at multicorewareinc.com>,
  *          Rajesh Paulraj <rajesh at multicorewareinc.com>
+ *          Praveen Kumar Tiwari <praveen at multicorewareinc.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -44,6 +45,14 @@
     "2x4", "2x8", "4x2", "4x4", "4x8", "4x16", "6x8", "8x2", "8x4", "8x6", "8x8", "8x16", "8x32",
     "12x16", "16x4", "16x8", "16x12", "16x16", "16x32", "24x32", "32x8", "32x16", "32x24", "32x32"
 };
+
+const char* LumaFilterPPNames[] =
+{
+    "4x8",   "4x9",   "5x8",   "4x16",  "4x17",  "5x16",  "8x4",   "8x5",   "9x4",   "8x8",   "8x9",   "9x8",   "8x16",  "8x17"   "9x16",  "8x32",  "8x33",  "9x32", "12x16",
+    "12x17", "13x16", "16x4",  "16x5",  "17x4",  "16x8",  "16x9",  "17x8",  "16x12", "16x13", "17x12", "16x16", "16x17", "17x16", "16x32", "16x33", "17x32"  "16x64", "24x32",
+    "24x33", "25x32", "32x8",  "32x9",  "33x8",  "32x16", "32x17", "33x16", "32x24", "32x25", "33x24", "32x32", "32x33", "33x32", "32x64", "32x65", "33x64", "48x64", "64x16",
+    "64x32", "64x33", "64x32", "64x48", "64x64", "64x65", "64x64"
+};
 
 IPFilterHarness::IPFilterHarness()
 {
@@ -299,6 +308,37 @@
     return true;
 }
 
+bool IPFilterHarness::check_IPFilterLuma_primitive(filter_pp_t ref, filter_pp_t opt)
+{
+    int rand_srcStride, rand_dstStride, rand_coeffIdx;
+
+    for (int i = 0; i <= 100; i++)
+    {
+        rand_coeffIdx = rand() % 3;                // Random coeffIdex in the filter
+
+        rand_srcStride = rand() % 100;              // Randomly generated srcStride
+        rand_dstStride = rand() % 100;              // Randomly generated dstStride
+
+        opt(pixel_buff + rand_srcStride,
+            rand_srcStride,
+            IPF_vec_output_p,
+            rand_dstStride,
+            rand_coeffIdx
+            );
+        ref(pixel_buff + rand_srcStride,
+            rand_srcStride,
+            IPF_C_output_p,
+            rand_dstStride,
+           rand_coeffIdx
+            );
+
+        if (memcmp(IPF_vec_output_p, IPF_C_output_p, ipf_t_size))
+            return false;
+    }
+
+    return true;
+}
+
 bool IPFilterHarness::testCorrectness(const EncoderPrimitives& ref, const EncoderPrimitives& opt)
 {
     for (int value = 0; value < NUM_IPFILTER_P_P; value++)
@@ -367,6 +407,18 @@
         }
     }
 
+    for (int value = 0; value < NUM_LUMA_PARTITIONS; value++)
+    {
+        if (opt.luma_hpp[value])
+        {
+            if (!check_IPFilterChroma_primitive(ref.luma_hpp[value], opt.luma_hpp[value]))
+            {
+                printf("interp_8tap_horiz_pp[%s]", LumaFilterPPNames[value]);
+                return false;
+            }
+        }
+    }
+
     return true;
 }
 
@@ -431,4 +483,14 @@
                            pixel_buff + 3 * srcStride, srcStride, IPF_vec_output_p, dstStride, 1);
         }
     }
+
+    for (int value = 0; value < NUM_LUMA_PARTITIONS; value++)
+    {
+        if (opt.luma_hpp[value])
+        {
+            printf("interp_8tap_horiz_pp[%s]", LumaFilterPPNames[value]);
+            REPORT_SPEEDUP(opt.luma_hpp[value], ref.luma_hpp[value],
+                           pixel_buff + srcStride, srcStride, IPF_vec_output_p, dstStride, 1);
+        }
+    }
 }
diff -r b5375476fded -r 1481908edb21 source/test/ipfilterharness.h
--- a/source/test/ipfilterharness.h	Thu Oct 17 20:55:11 2013 +0530
+++ b/source/test/ipfilterharness.h	Thu Oct 17 21:00:27 2013 +0530
@@ -3,6 +3,7 @@
  *
  * Authors: Deepthi Devaki <deepthidevaki at multicorewareinc.com>,
  *          Rajesh Paulraj <rajesh at multicorewareinc.com>
+ *          Praveen Kumar Tiwari <praveen at multicorewareinc.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -46,6 +47,7 @@
     bool check_IPFilter_primitive(ipfilter_p2s_t ref, ipfilter_p2s_t opt);
     bool check_IPFilter_primitive(ipfilter_s2p_t ref, ipfilter_s2p_t opt);
     bool check_IPFilterChroma_primitive(filter_pp_t ref, filter_pp_t opt);
+    bool check_IPFilterLuma_primitive(filter_pp_t ref, filter_pp_t opt);
 
 public:
 


More information about the x265-devel mailing list