[x265] [PATCH 3 of 4] Test bench code for luma_hps and chroma_hps
nabajit at multicorewareinc.com
nabajit at multicorewareinc.com
Wed Dec 4 13:49:50 CET 2013
# HG changeset patch
# User Nabajit Deka
# Date 1386160833 -19800
# Wed Dec 04 18:10:33 2013 +0530
# Node ID b0602bd77013c5c590d788259b2fdd9546374d4d
# Parent 8b045312625b2ffe16dd555b6958647f105b906d
Test bench code for luma_hps and chroma_hps
diff -r 8b045312625b -r b0602bd77013 source/common/primitives.h
--- a/source/common/primitives.h Wed Dec 04 18:07:55 2013 +0530
+++ b/source/common/primitives.h Wed Dec 04 18:10:33 2013 +0530
@@ -190,6 +190,7 @@
typedef void (*plane_copy_deinterleave_t)(pixel *dstu, intptr_t dstuStride, pixel *dstv, intptr_t dstvStride, pixel *src, intptr_t srcStride, int w, int h);
typedef void (*filter_pp_t) (pixel *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx);
+typedef void (*filter_hps_t) (pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride, int coeffIdx, int isRowExt);
typedef void (*filter_ps_t) (pixel *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride, int coeffIdx);
typedef void (*filter_sp_t) (int16_t *src, intptr_t srcStride, pixel *dst, intptr_t dstStride, int coeffIdx);
typedef void (*filter_ss_t) (int16_t *src, intptr_t srcStride, int16_t *dst, intptr_t dstStride, int coeffIdx);
@@ -231,7 +232,7 @@
pixel_add_ps_t luma_add_ps[NUM_LUMA_PARTITIONS];
filter_pp_t luma_hpp[NUM_LUMA_PARTITIONS];
- filter_ps_t luma_hps[NUM_LUMA_PARTITIONS];
+ filter_hps_t luma_hps[NUM_LUMA_PARTITIONS];
filter_pp_t luma_vpp[NUM_LUMA_PARTITIONS];
filter_ps_t luma_vps[NUM_LUMA_PARTITIONS];
filter_sp_t luma_vsp[NUM_LUMA_PARTITIONS];
@@ -280,7 +281,7 @@
filter_sp_t filter_vsp[NUM_LUMA_PARTITIONS];
filter_ss_t filter_vss[NUM_LUMA_PARTITIONS];
filter_pp_t filter_hpp[NUM_LUMA_PARTITIONS];
- filter_ps_t filter_hps[NUM_LUMA_PARTITIONS];
+ filter_hps_t filter_hps[NUM_LUMA_PARTITIONS];
copy_pp_t copy_pp[NUM_LUMA_PARTITIONS];
copy_sp_t copy_sp[NUM_LUMA_PARTITIONS];
copy_ps_t copy_ps[NUM_LUMA_PARTITIONS];
diff -r 8b045312625b -r b0602bd77013 source/test/ipfilterharness.cpp
--- a/source/test/ipfilterharness.cpp Wed Dec 04 18:07:55 2013 +0530
+++ b/source/test/ipfilterharness.cpp Wed Dec 04 18:10:33 2013 +0530
@@ -316,6 +316,39 @@
return true;
}
+bool IPFilterHarness::check_IPFilterChroma_hps_primitive(filter_hps_t ref, filter_hps_t opt)
+{
+ int rand_srcStride, rand_dstStride, rand_coeffIdx, rand_isRowExt;
+
+ for (int i = 0; i <= 100; i++)
+ {
+ rand_coeffIdx = rand() % 8; // Random coeffIdex in the filter
+ rand_isRowExt = rand() % 2;
+
+ rand_srcStride = rand() % 100; // Randomly generated srcStride
+ rand_dstStride = rand() % 100; // Randomly generated dstStride
+
+ ref(pixel_buff + 3 * rand_srcStride,
+ rand_srcStride,
+ IPF_C_output_s,
+ rand_dstStride,
+ rand_coeffIdx,
+ rand_isRowExt);
+
+ opt(pixel_buff + 3 * rand_srcStride,
+ rand_srcStride,
+ IPF_vec_output_s,
+ rand_dstStride,
+ rand_coeffIdx,
+ rand_isRowExt);
+
+ if (memcmp(IPF_vec_output_s, IPF_C_output_s, ipf_t_size * sizeof(int16_t)))
+ return false;
+ }
+
+ return true;
+}
+
bool IPFilterHarness::check_IPFilterChroma_sp_primitive(filter_sp_t ref, filter_sp_t opt)
{
int rand_srcStride, rand_dstStride, rand_coeffIdx;
@@ -434,6 +467,38 @@
return true;
}
+bool IPFilterHarness::check_IPFilterLuma_hps_primitive(filter_hps_t ref, filter_hps_t opt)
+{
+ int rand_srcStride, rand_dstStride, rand_coeffIdx, rand_isRowExt;
+
+ for (int i = 0; i <= 1000; i++)
+ {
+ rand_coeffIdx = rand() % 3; // Random coeffIdex in the filter
+ rand_isRowExt = rand() % 2;
+
+ rand_srcStride = rand() % 100; // Randomly generated srcStride
+ rand_dstStride = rand() % 100 + 64; // Randomly generated dstStride
+
+ ref(pixel_buff + 3 * rand_srcStride,
+ rand_srcStride,
+ IPF_C_output_s,
+ rand_dstStride,
+ rand_coeffIdx,
+ rand_isRowExt);
+ opt(pixel_buff + 3 * rand_srcStride,
+ rand_srcStride,
+ IPF_vec_output_s,
+ rand_dstStride,
+ rand_coeffIdx,
+ rand_isRowExt);
+
+ if (memcmp(IPF_vec_output_s, IPF_C_output_s, ipf_t_size * sizeof(int16_t)))
+ return false;
+ }
+
+ return true;
+}
+
bool IPFilterHarness::check_IPFilterLuma_sp_primitive(filter_sp_t ref, filter_sp_t opt)
{
int rand_srcStride, rand_dstStride, rand_coeffIdx;
@@ -582,7 +647,7 @@
}
if (opt.luma_hps[value])
{
- if (!check_IPFilterLuma_ps_primitive(ref.luma_hps[value], opt.luma_hps[value]))
+ if (!check_IPFilterLuma_hps_primitive(ref.luma_hps[value], opt.luma_hps[value]))
{
printf("luma_hps[%s]", lumaPartStr[value]);
return false;
@@ -653,7 +718,7 @@
}
if (opt.chroma[csp].filter_hps[value])
{
- if (!check_IPFilterChroma_ps_primitive(ref.chroma[csp].filter_hps[value], opt.chroma[csp].filter_hps[value]))
+ if (!check_IPFilterChroma_hps_primitive(ref.chroma[csp].filter_hps[value], opt.chroma[csp].filter_hps[value]))
{
printf("chroma_hps[%s]", chromaPartStr[value]);
return false;
@@ -756,7 +821,7 @@
printf("luma_hps[%s]\t", lumaPartStr[value]);
REPORT_SPEEDUP(opt.luma_hps[value], ref.luma_hps[value],
pixel_buff + maxVerticalfilterHalfDistance * srcStride, srcStride,
- IPF_vec_output_s, dstStride, 1);
+ IPF_vec_output_s, dstStride, 1, 1);
}
if (opt.luma_vpp[value])
@@ -821,7 +886,7 @@
{
printf("chroma_hps[%s]", chromaPartStr[value]);
REPORT_SPEEDUP(opt.chroma[csp].filter_hps[value], ref.chroma[csp].filter_hps[value],
- pixel_buff + srcStride, srcStride, IPF_vec_output_s, dstStride, 1);
+ pixel_buff + srcStride, srcStride, IPF_vec_output_s, dstStride, 1, 1);
}
if (opt.chroma[csp].filter_vpp[value])
{
diff -r 8b045312625b -r b0602bd77013 source/test/ipfilterharness.h
--- a/source/test/ipfilterharness.h Wed Dec 04 18:07:55 2013 +0530
+++ b/source/test/ipfilterharness.h Wed Dec 04 18:10:33 2013 +0530
@@ -47,10 +47,12 @@
bool check_IPFilter_primitive(ipfilter_ss_t ref, ipfilter_ss_t opt, int isChroma);
bool check_IPFilterChroma_primitive(filter_pp_t ref, filter_pp_t opt);
bool check_IPFilterChroma_ps_primitive(filter_ps_t ref, filter_ps_t opt);
+ bool check_IPFilterChroma_hps_primitive(filter_hps_t ref, filter_hps_t opt);
bool check_IPFilterChroma_sp_primitive(filter_sp_t ref, filter_sp_t opt);
bool check_IPFilterChroma_ss_primitive(filter_ss_t ref, filter_ss_t opt);
bool check_IPFilterLuma_primitive(filter_pp_t ref, filter_pp_t opt);
bool check_IPFilterLuma_ps_primitive(filter_ps_t ref, filter_ps_t opt);
+ bool check_IPFilterLuma_hps_primitive(filter_hps_t ref, filter_hps_t opt);
bool check_IPFilterLuma_sp_primitive(filter_sp_t ref, filter_sp_t opt);
bool check_IPFilterLuma_ss_primitive(filter_ss_t ref, filter_ss_t opt);
bool check_IPFilterLumaHV_primitive(filter_hv_pp_t ref, filter_hv_pp_t opt);
More information about the x265-devel
mailing list