Seems Nabajit style, I don't like this style, I want to use a array or call test set style, it let us verify more case
At 2014-01-28 18:03:03,"Murugan Vairavel" <[email protected]> wrote: # HG changeset patch # User Murugan Vairavel <[email protected]> # Date 1390903129 -19800 # Tue Jan 28 15:28:49 2014 +0530 # Node ID ad69e508afdd44244a1289cd2d785a7fe0946144 # Parent 3568c1b19947f8641504c69bca6ab859ed11825e Stress test case for pixel_add_ps and pixel_sub_ps diff -r 3568c1b19947 -r ad69e508afdd source/test/pixelharness.cpp --- a/source/test/pixelharness.cppTue Jan 28 01:49:03 2014 -0600 +++ b/source/test/pixelharness.cppTue Jan 28 15:28:49 2014 +0530 @@ -45,12 +45,17 @@ pbuf2 = (pixel*)X265_MALLOC(pixel, bufsize); pbuf3 = (pixel*)X265_MALLOC(pixel, bufsize); pbuf4 = (pixel*)X265_MALLOC(pixel, bufsize); + pixel_buff_min = (pixel*)X265_MALLOC(pixel, bufsize); + pixel_buff_max = (pixel*)X265_MALLOC(pixel, bufsize); + ibuf1 = (int*)X265_MALLOC(int, bufsize); sbuf1 = (int16_t*)X265_MALLOC(int16_t, bufsize); sbuf2 = (int16_t*)X265_MALLOC(int16_t, bufsize); sbuf3 = (int16_t*)X265_MALLOC(int16_t, bufsize); + sbuff_min = (int16_t*)X265_MALLOC(int16_t, bufsize); + sbuff_max = (int16_t*)X265_MALLOC(int16_t, bufsize); if (!pbuf1 || !pbuf2 || !pbuf3 || !pbuf4 || !sbuf1 || !sbuf2 || !sbuf3 || !ibuf1) { @@ -58,6 +63,7 @@ exit(1); } +#define SMAX (1 << 12) for (int i = 0; i < bufsize; i++) { pbuf1[i] = rand() & PIXEL_MAX; @@ -65,13 +71,17 @@ pbuf3[i] = rand() & PIXEL_MAX; pbuf4[i] = rand() & PIXEL_MAX; -#define SMAX (1 << 12) sbuf1[i] = (rand() % (2 * SMAX + 1)) - SMAX - 1; //max(SHORT_MIN, min(rand(), SMAX)); sbuf2[i] = (rand() % (2 * SMAX + 1)) - SMAX - 1; //max(SHORT_MIN, min(rand(), SMAX)); ibuf1[i] = (rand() % (2 * SMAX + 1)) - SMAX - 1; sbuf3[i] = rand() % PIXEL_MAX; // for blockcopy only } + + memset(pixel_buff_min, PIXEL_MIN, bufsize); + memset(pixel_buff_max, PIXEL_MAX, bufsize); + memset(sbuff_min, SHORT_MIN, bufsize); + memset(sbuff_max, SMAX - 1, bufsize); } PixelHarness::~PixelHarness() @@ -83,6 +93,10 @@ X265_FREE(sbuf1); X265_FREE(sbuf2); X265_FREE(sbuf3); + X265_FREE(sbuff_min); + X265_FREE(sbuff_max); + X265_FREE(pixel_buff_min); + X265_FREE(pixel_buff_max); } bool PixelHarness::check_pixelcmp(pixelcmp_t ref, pixelcmp_t opt) @@ -604,6 +618,46 @@ j += INCR; } +//Stress Test for (Minimum, Maximum) + opt(opt_dest, 64, pixel_buff_min, pixel_buff_max, STRIDE, STRIDE); + ref(ref_dest, 64, pixel_buff_min,pixel_buff_max, STRIDE, STRIDE); + + if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t))) + { + printf("pixel_sub_ps stress test(Minimum, Maximum) failed\n"); + return false; + } + +//Stress Test for (Maximum, Minimum) + opt(opt_dest, 64, pixel_buff_max, pixel_buff_min, STRIDE, STRIDE); + ref(ref_dest, 64, pixel_buff_max, pixel_buff_min, STRIDE, STRIDE); + + if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t))) + { + printf("pixel_sub_ps stress test(Maximum, Minimum) failed\n"); + return false; + } + +//Stress Test for (Maximum, Maximum) + opt(opt_dest, 64, pixel_buff_max, pixel_buff_max, STRIDE, STRIDE); + ref(ref_dest, 64, pixel_buff_max, pixel_buff_max, STRIDE, STRIDE); + + if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t))) + { + printf("pixel_sub_ps stress test(Maximum, Maximum) failed\n"); + return false; + } + +//Stress Test for (Minimum, Minimum) + opt(opt_dest, 64, pixel_buff_min, pixel_buff_min, STRIDE, STRIDE); + ref(ref_dest, 64, pixel_buff_min, pixel_buff_min, STRIDE, STRIDE); + + if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(int16_t))) + { + printf("pixel_sub_ps stress test(Minimum, Minimum) failed\n"); + return false; + } + return true; } @@ -682,6 +736,62 @@ j += INCR; } +//Stress Test for (Minimum, Maximum) +#if HIGH_BIT_DEPTH + int old_depth = X265_DEPTH; + X265_DEPTH = 10; +#endif + opt(opt_dest, 64, pixel_buff_min, sbuff_max, STRIDE, STRIDE); + ref(ref_dest, 64, pixel_buff_min, sbuff_max, STRIDE, STRIDE); + + if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel))) + { + printf("pixel_add_ps stress test(Minimum, Maximum) failed\n"); +#if HIGH_BIT_DEPTH + X265_DEPTH = old_depth; +#endif + return false; + } + +//Stress Test for (Maximum, Minimum) + opt(opt_dest, 64, pixel_buff_max, sbuff_min, STRIDE, STRIDE); + ref(ref_dest, 64, pixel_buff_max, sbuff_min, STRIDE, STRIDE); + + if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel))) + { + printf("pixel_add_ps stress test(Maximum, Minimum) failed\n"); +#if HIGH_BIT_DEPTH + X265_DEPTH = old_depth; +#endif + return false; + } + +//Stress Test for (Maximum, Maximum) + opt(opt_dest, 64, pixel_buff_max, sbuff_max, STRIDE, STRIDE); + ref(ref_dest, 64, pixel_buff_max, sbuff_max, STRIDE, STRIDE); + + if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel))) + { + printf("pixel_add_ps stress test(Maximum, Maximum) failed\n"); +#if HIGH_BIT_DEPTH + X265_DEPTH = old_depth; +#endif + return false; + } + +//Stress Test for (Minimum, Minimum) + opt(opt_dest, 64, pixel_buff_min, sbuff_min, STRIDE, STRIDE); + ref(ref_dest, 64, pixel_buff_min, sbuff_min, STRIDE, STRIDE); + + if (memcmp(ref_dest, opt_dest, 64 * 64 * sizeof(pixel))) + { + printf("pixel_add_ps stress test(Minimum, Minimum) failed\n"); +#if HIGH_BIT_DEPTH + X265_DEPTH = old_depth; +#endif + return false; + } + #if HIGH_BIT_DEPTH X265_DEPTH = old_depth; #endif @@ -1297,17 +1407,6 @@ HEADER("[%s] add_ps[%s]", x265_source_csp_names[i], chromaPartStr[part]); REPORT_SPEEDUP(opt.chroma[i].add_ps[part], ref.chroma[i].add_ps[part], pbuf1, FENC_STRIDE, pbuf2, sbuf1, STRIDE, STRIDE); } - if (opt.chroma[i].addAvg[part]) - { - HEADER("[%s] add_ps[%s]", x265_source_csp_names[i], chromaPartStr[part]); - REPORT_SPEEDUP(opt.chroma[i].addAvg[part], ref.chroma[i].addAvg[part], pbuf1, STRIDE, sbuf1, STRIDE, sbuf2, STRIDE); - } - } - - 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); } #undef HEADER diff -r 3568c1b19947 -r ad69e508afdd source/test/pixelharness.h --- a/source/test/pixelharness.hTue Jan 28 01:49:03 2014 -0600 +++ b/source/test/pixelharness.hTue Jan 28 15:28:49 2014 +0530 @@ -31,11 +31,12 @@ { protected: - pixel *pbuf1, *pbuf2, *pbuf3, *pbuf4; + pixel *pbuf1, *pbuf2, *pbuf3, *pbuf4, *pixel_buff_min, *pixel_buff_max; int *ibuf1; - int16_t *sbuf1, *sbuf2, *sbuf3; + int16_t *sbuf1, *sbuf2, *sbuf3,*sbuff_min, *sbuff_max; + bool check_pixelcmp(pixelcmp_t ref, pixelcmp_t opt); bool check_pixelcmp_sp(pixelcmp_sp_t ref, pixelcmp_sp_t opt); diff -r 3568c1b19947 -r ad69e508afdd source/test/testharness.h --- a/source/test/testharness.hTue Jan 28 01:49:03 2014 -0600 +++ b/source/test/testharness.hTue Jan 28 15:28:49 2014 +0530 @@ -36,6 +36,7 @@ #define BIT_DEPTH 8 #endif #define PIXEL_MAX ((1 << BIT_DEPTH) - 1) +#define PIXEL_MIN 0 #define SHORT_MAX 32767 #define SHORT_MIN -32767
_______________________________________________ x265-devel mailing list [email protected] https://mailman.videolan.org/listinfo/x265-devel
