[x265] [PATCH] unit test code for pixel_add_ps
praveen at multicorewareinc.com
praveen at multicorewareinc.com
Wed Nov 20 08:28:12 CET 2013
# HG changeset patch
# User Praveen Tiwari
# Date 1384932477 -19800
# Node ID a7fb47a7eddf18634449a5ac898f7c2d029048e9
# Parent ac2997ec873a64a5c27a6e94b18c5d7879ffdaf0
unit test code for pixel_add_ps
diff -r ac2997ec873a -r a7fb47a7eddf source/test/pixelharness.cpp
--- a/source/test/pixelharness.cpp Wed Nov 20 12:55:28 2013 +0530
+++ b/source/test/pixelharness.cpp Wed Nov 20 12:57:57 2013 +0530
@@ -655,6 +655,29 @@
return true;
}
+bool PixelHarness::check_pixel_add_ps(pixel_add_ps_t ref, pixel_add_ps_t opt)
+{
+ ALIGN_VAR_16(pixel, ref_dest[64 * 64]);
+ ALIGN_VAR_16(pixel, opt_dest[64 * 64]);
+
+ memset(ref_dest, 0xCD, sizeof(ref_dest));
+ memset(opt_dest, 0xCD, sizeof(opt_dest));
+
+ int j = 0;
+ for (int i = 0; i < ITERS; i++)
+ {
+ opt(opt_dest, 64, pbuf1 + j, sbuf1 + j, STRIDE, STRIDE);
+ ref(ref_dest, 64, pbuf1 + j, sbuf1 + j, STRIDE, 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])
@@ -815,6 +838,27 @@
}
}
}
+
+ if (opt.luma_add_ps[part])
+ {
+ if (!check_pixel_add_ps(ref.luma_add_ps[part], opt.luma_add_ps[part]))
+ {
+ printf("luma_add_ps[%s] failed\n", lumaPartStr[part]);
+ return false;
+ }
+ }
+
+ for(int i = 0; i < NUM_CSP; i++)
+ {
+ if (opt.chroma_add_ps[i][part])
+ {
+ if (!check_pixel_add_ps(ref.chroma_add_ps[i][part], opt.chroma_add_ps[i][part]))
+ {
+ printf("chroma_add_ps[%s][%s] failed\n", colorSpaceNames[i], chromaPartStr[part]);
+ return false;
+ }
+ }
+ }
return true;
}
@@ -1105,6 +1149,21 @@
REPORT_SPEEDUP(opt.chroma_sub_ps[i][part], ref.chroma_sub_ps[i][part], (int16_t*)pbuf1, FENC_STRIDE, pbuf2, pbuf1, STRIDE, STRIDE);
}
}
+
+ if (opt.luma_add_ps[part])
+ {
+ printf("luma_add_ps[%s]", lumaPartStr[part]);
+ REPORT_SPEEDUP(opt.luma_add_ps[part], ref.luma_add_ps[part], pbuf1, FENC_STRIDE, pbuf2, sbuf1, STRIDE, STRIDE);
+ }
+
+ for (int i = 0; i < NUM_CSP; i++)
+ {
+ if (opt.chroma_add_ps[i][part])
+ {
+ printf("chroma_add_ps[%s][%s]", colorSpaceNames[i], chromaPartStr[part]);
+ REPORT_SPEEDUP(opt.chroma_add_ps[i][part], ref.chroma_add_ps[i][part], pbuf1, FENC_STRIDE, pbuf2, sbuf1, STRIDE, STRIDE);
+ }
+ }
}
void PixelHarness::measureSpeed(const EncoderPrimitives& ref, const EncoderPrimitives& opt)
diff -r ac2997ec873a -r a7fb47a7eddf source/test/pixelharness.h
--- a/source/test/pixelharness.h Wed Nov 20 12:55:28 2013 +0530
+++ b/source/test/pixelharness.h Wed Nov 20 12:57:57 2013 +0530
@@ -62,6 +62,7 @@
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_pixel_add_ps(pixel_add_ps_t ref, pixel_add_ps_t opt);
bool check_pixel_scale_pp(scale_t ref, scale_t opt);
bool check_transpose(transpose_t ref, transpose_t opt);
More information about the x265-devel
mailing list