From f7b49c7e1ab7c7d5ea6ad46849f4111a98984f85 Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Thu, 15 Aug 2019 16:10:44 -0700 Subject: [PATCH] Disable tests via macro that refer to row.h This is to resolve issues when the library is compiled with different compiler and/or flags than the tests. BUG=libyuv:836 Change-Id: I80727bfbd2fe1e02c842a7dba68a3deac941e23e Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/1757114 Reviewed-by: richard winterton Commit-Queue: Frank Barchard --- unit_test/compare_test.cc | 7 ++++++- unit_test/convert_test.cc | 6 ++++-- unit_test/math_test.cc | 5 +++++ unit_test/planar_test.cc | 13 ++++++++++--- unit_test/scale_argb_test.cc | 2 +- unit_test/scale_test.cc | 9 +++++++-- 6 files changed, 33 insertions(+), 9 deletions(-) diff --git a/unit_test/compare_test.cc b/unit_test/compare_test.cc index 136254e16..bd99cdd3a 100644 --- a/unit_test/compare_test.cc +++ b/unit_test/compare_test.cc @@ -15,10 +15,13 @@ #include "../unit_test/unit_test.h" #include "libyuv/basic_types.h" #include "libyuv/compare.h" -#include "libyuv/compare_row.h" /* For HammingDistance_C */ #include "libyuv/cpu_id.h" #include "libyuv/video_common.h" +#ifdef ENABLE_ROW_TESTS +#include "libyuv/compare_row.h" /* For HammingDistance_C */ +#endif + namespace libyuv { // hash seed of 5381 recommended. @@ -206,6 +209,7 @@ TEST_F(LibYUVCompareTest, BenchmarkARGBDetect_Unaligned) { free_aligned_buffer_page_end(src_a); } +#ifdef ENABLE_ROW_TESTS TEST_F(LibYUVCompareTest, BenchmarkHammingDistance_Opt) { const int kMaxWidth = 4096 * 3; align_buffer_page_end(src_a, kMaxWidth); @@ -403,6 +407,7 @@ TEST_F(LibYUVCompareTest, TestHammingDistance_Opt) { free_aligned_buffer_page_end(src_a); free_aligned_buffer_page_end(src_b); } +#endif // ENABLE_ROW_TESTS TEST_F(LibYUVCompareTest, TestHammingDistance) { align_buffer_page_end(src_a, benchmark_width_ * benchmark_height_); diff --git a/unit_test/convert_test.cc b/unit_test/convert_test.cc index f85f6124b..b676954b2 100644 --- a/unit_test/convert_test.cc +++ b/unit_test/convert_test.cc @@ -12,8 +12,6 @@ #include #include -#include "libyuv/row.h" /* For ARGBToAR30Row_AVX2 */ - #include "libyuv/basic_types.h" #include "libyuv/compare.h" #include "libyuv/convert.h" @@ -29,6 +27,10 @@ #include "libyuv/rotate.h" #include "libyuv/video_common.h" +#ifdef ENABLE_ROW_TESTS +#include "libyuv/row.h" /* For ARGBToAR30Row_AVX2 */ +#endif + #if defined(__arm__) || defined(__aarch64__) // arm version subsamples by summing 4 pixels then multiplying by matrix with // 4x smaller coefficients which are rounded to nearest integer. diff --git a/unit_test/math_test.cc b/unit_test/math_test.cc index 0abbad513..a1544c122 100644 --- a/unit_test/math_test.cc +++ b/unit_test/math_test.cc @@ -16,10 +16,14 @@ #include "libyuv/basic_types.h" #include "libyuv/cpu_id.h" #include "libyuv/scale.h" + +#ifdef ENABLE_ROW_TESTS #include "libyuv/scale_row.h" +#endif namespace libyuv { +#ifdef ENABLE_ROW_TESTS TEST_F(LibYUVBaseTest, TestFixedDiv) { int num[1280]; int div[1280]; @@ -151,5 +155,6 @@ TEST_F(LibYUVBaseTest, TestFixedDiv1_Opt) { EXPECT_NEAR(result_c[j], result_opt[j], 1); } } +#endif // ENABLE_ROW_TESTS } // namespace libyuv diff --git a/unit_test/planar_test.cc b/unit_test/planar_test.cc index cb9994a49..19232b6fe 100644 --- a/unit_test/planar_test.cc +++ b/unit_test/planar_test.cc @@ -12,9 +12,6 @@ #include #include -// row.h defines SIMD_ALIGNED, overriding unit_test.h -// TODO(fbarchard): Remove row.h from unittests. Test public functions. -#include "libyuv/row.h" /* For ScaleSumSamples_Neon */ #include "../unit_test/unit_test.h" #include "libyuv/compare.h" @@ -26,6 +23,12 @@ #include "libyuv/planar_functions.h" #include "libyuv/rotate.h" +#ifdef ENABLE_ROW_TESTS +// row.h defines SIMD_ALIGNED, overriding unit_test.h +// TODO(fbarchard): Remove row.h from unittests. Test public functions. +#include "libyuv/row.h" /* For ScaleSumSamples_Neon */ +#endif + namespace libyuv { TEST_F(LibYUVPlanarTest, TestAttenuate) { @@ -2816,6 +2819,7 @@ TEST_F(LibYUVPlanarTest, Convert16To8Plane) { free_aligned_buffer_page_end(dst_pixels_y_c); } +#ifdef ENABLE_ROW_TESTS // TODO(fbarchard): Improve test for more platforms. #ifdef HAS_CONVERT16TO8ROW_AVX2 TEST_F(LibYUVPlanarTest, Convert16To8Row_Opt) { @@ -2861,6 +2865,7 @@ TEST_F(LibYUVPlanarTest, Convert16To8Row_Opt) { free_aligned_buffer_page_end(dst_pixels_y_c); } #endif // HAS_CONVERT16TO8ROW_AVX2 +#endif // ENABLE_ROW_TESTS TEST_F(LibYUVPlanarTest, Convert8To16Plane) { // Round count up to multiple of 16 @@ -2896,6 +2901,7 @@ TEST_F(LibYUVPlanarTest, Convert8To16Plane) { free_aligned_buffer_page_end(dst_pixels_y_c); } +#ifdef ENABLE_ROW_TESTS // TODO(fbarchard): Improve test for more platforms. #ifdef HAS_CONVERT8TO16ROW_AVX2 TEST_F(LibYUVPlanarTest, Convert8To16Row_Opt) { @@ -3340,5 +3346,6 @@ TEST_F(LibYUVPlanarTest, SwapUVRow) { free_aligned_buffer_page_end(src_pixels_vu); free_aligned_buffer_page_end(dst_pixels_uv); } +#endif } // namespace libyuv diff --git a/unit_test/scale_argb_test.cc b/unit_test/scale_argb_test.cc index 94aef60e2..93b77f56a 100644 --- a/unit_test/scale_argb_test.cc +++ b/unit_test/scale_argb_test.cc @@ -259,7 +259,7 @@ static int ARGBClipTestFilter(int src_width, TEST_FACTOR(2, 1, 2) TEST_FACTOR(4, 1, 4) -TEST_FACTOR(8, 1, 8) +// TEST_FACTOR(8, 1, 8) Disable for benchmark performance. TEST_FACTOR(3by4, 3, 4) TEST_FACTOR(3by8, 3, 8) TEST_FACTOR(3, 1, 3) diff --git a/unit_test/scale_test.cc b/unit_test/scale_test.cc index 811b2d049..94a785900 100644 --- a/unit_test/scale_test.cc +++ b/unit_test/scale_test.cc @@ -14,7 +14,10 @@ #include "../unit_test/unit_test.h" #include "libyuv/cpu_id.h" #include "libyuv/scale.h" + +#ifdef ENABLE_ROW_TESTS #include "libyuv/scale_row.h" // For ScaleRowDown2Box_Odd_C +#endif #define STRINGIZE(line) #line #define FILELINESTR(file, line) file ":" STRINGIZE(line) @@ -541,7 +544,7 @@ static int I444TestFilter_16(int src_width, TEST_FACTOR(2, 1, 2, 0) TEST_FACTOR(4, 1, 4, 0) -TEST_FACTOR(8, 1, 8, 0) +// TEST_FACTOR(8, 1, 8, 0) Disable for benchmark performance. Takes 90 seconds. TEST_FACTOR(3by4, 3, 4, 1) TEST_FACTOR(3by8, 3, 8, 1) TEST_FACTOR(3, 1, 3, 0) @@ -622,6 +625,7 @@ TEST_SCALETO(Scale, 1920, 1080) #undef TEST_SCALETO1 #undef TEST_SCALETO +#ifdef ENABLE_ROW_TESTS #ifdef HAS_SCALEROWDOWN2_SSSE3 TEST_F(LibYUVScaleTest, TestScaleRowDown2Box_Odd_SSSE3) { SIMD_ALIGNED(uint8_t orig_pixels[128 * 2]); @@ -803,6 +807,7 @@ TEST_F(LibYUVScaleTest, TestScaleRowDown2Box_16) { EXPECT_EQ(dst_pixels_c[0], (0 + 1 + 2560 + 2561 + 2) / 4); EXPECT_EQ(dst_pixels_c[1279], 3839); } +#endif // ENABLE_ROW_TESTS // Test scaling plane with 8 bit C vs 16 bit C and return maximum pixel // difference. @@ -893,7 +898,7 @@ static int TestPlaneFilter_16(int src_width, TEST_FACTOR(2, 1, 2, 0) TEST_FACTOR(4, 1, 4, 0) -TEST_FACTOR(8, 1, 8, 0) +// TEST_FACTOR(8, 1, 8, 0) Disable for benchmark performance. Takes 90 seconds. TEST_FACTOR(3by4, 3, 4, 1) TEST_FACTOR(3by8, 3, 8, 1) TEST_FACTOR(3, 1, 3, 0)