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 <rrwinterton@gmail.com>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
Frank Barchard 2019-08-15 16:10:44 -07:00 committed by Commit Bot
parent 7e7f229af9
commit f7b49c7e1a
6 changed files with 33 additions and 9 deletions

View File

@ -15,10 +15,13 @@
#include "../unit_test/unit_test.h" #include "../unit_test/unit_test.h"
#include "libyuv/basic_types.h" #include "libyuv/basic_types.h"
#include "libyuv/compare.h" #include "libyuv/compare.h"
#include "libyuv/compare_row.h" /* For HammingDistance_C */
#include "libyuv/cpu_id.h" #include "libyuv/cpu_id.h"
#include "libyuv/video_common.h" #include "libyuv/video_common.h"
#ifdef ENABLE_ROW_TESTS
#include "libyuv/compare_row.h" /* For HammingDistance_C */
#endif
namespace libyuv { namespace libyuv {
// hash seed of 5381 recommended. // hash seed of 5381 recommended.
@ -206,6 +209,7 @@ TEST_F(LibYUVCompareTest, BenchmarkARGBDetect_Unaligned) {
free_aligned_buffer_page_end(src_a); free_aligned_buffer_page_end(src_a);
} }
#ifdef ENABLE_ROW_TESTS
TEST_F(LibYUVCompareTest, BenchmarkHammingDistance_Opt) { TEST_F(LibYUVCompareTest, BenchmarkHammingDistance_Opt) {
const int kMaxWidth = 4096 * 3; const int kMaxWidth = 4096 * 3;
align_buffer_page_end(src_a, kMaxWidth); 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_a);
free_aligned_buffer_page_end(src_b); free_aligned_buffer_page_end(src_b);
} }
#endif // ENABLE_ROW_TESTS
TEST_F(LibYUVCompareTest, TestHammingDistance) { TEST_F(LibYUVCompareTest, TestHammingDistance) {
align_buffer_page_end(src_a, benchmark_width_ * benchmark_height_); align_buffer_page_end(src_a, benchmark_width_ * benchmark_height_);

View File

@ -12,8 +12,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include "libyuv/row.h" /* For ARGBToAR30Row_AVX2 */
#include "libyuv/basic_types.h" #include "libyuv/basic_types.h"
#include "libyuv/compare.h" #include "libyuv/compare.h"
#include "libyuv/convert.h" #include "libyuv/convert.h"
@ -29,6 +27,10 @@
#include "libyuv/rotate.h" #include "libyuv/rotate.h"
#include "libyuv/video_common.h" #include "libyuv/video_common.h"
#ifdef ENABLE_ROW_TESTS
#include "libyuv/row.h" /* For ARGBToAR30Row_AVX2 */
#endif
#if defined(__arm__) || defined(__aarch64__) #if defined(__arm__) || defined(__aarch64__)
// arm version subsamples by summing 4 pixels then multiplying by matrix with // arm version subsamples by summing 4 pixels then multiplying by matrix with
// 4x smaller coefficients which are rounded to nearest integer. // 4x smaller coefficients which are rounded to nearest integer.

View File

@ -16,10 +16,14 @@
#include "libyuv/basic_types.h" #include "libyuv/basic_types.h"
#include "libyuv/cpu_id.h" #include "libyuv/cpu_id.h"
#include "libyuv/scale.h" #include "libyuv/scale.h"
#ifdef ENABLE_ROW_TESTS
#include "libyuv/scale_row.h" #include "libyuv/scale_row.h"
#endif
namespace libyuv { namespace libyuv {
#ifdef ENABLE_ROW_TESTS
TEST_F(LibYUVBaseTest, TestFixedDiv) { TEST_F(LibYUVBaseTest, TestFixedDiv) {
int num[1280]; int num[1280];
int div[1280]; int div[1280];
@ -151,5 +155,6 @@ TEST_F(LibYUVBaseTest, TestFixedDiv1_Opt) {
EXPECT_NEAR(result_c[j], result_opt[j], 1); EXPECT_NEAR(result_c[j], result_opt[j], 1);
} }
} }
#endif // ENABLE_ROW_TESTS
} // namespace libyuv } // namespace libyuv

View File

@ -12,9 +12,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
// 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 "../unit_test/unit_test.h"
#include "libyuv/compare.h" #include "libyuv/compare.h"
@ -26,6 +23,12 @@
#include "libyuv/planar_functions.h" #include "libyuv/planar_functions.h"
#include "libyuv/rotate.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 { namespace libyuv {
TEST_F(LibYUVPlanarTest, TestAttenuate) { TEST_F(LibYUVPlanarTest, TestAttenuate) {
@ -2816,6 +2819,7 @@ TEST_F(LibYUVPlanarTest, Convert16To8Plane) {
free_aligned_buffer_page_end(dst_pixels_y_c); free_aligned_buffer_page_end(dst_pixels_y_c);
} }
#ifdef ENABLE_ROW_TESTS
// TODO(fbarchard): Improve test for more platforms. // TODO(fbarchard): Improve test for more platforms.
#ifdef HAS_CONVERT16TO8ROW_AVX2 #ifdef HAS_CONVERT16TO8ROW_AVX2
TEST_F(LibYUVPlanarTest, Convert16To8Row_Opt) { TEST_F(LibYUVPlanarTest, Convert16To8Row_Opt) {
@ -2861,6 +2865,7 @@ TEST_F(LibYUVPlanarTest, Convert16To8Row_Opt) {
free_aligned_buffer_page_end(dst_pixels_y_c); free_aligned_buffer_page_end(dst_pixels_y_c);
} }
#endif // HAS_CONVERT16TO8ROW_AVX2 #endif // HAS_CONVERT16TO8ROW_AVX2
#endif // ENABLE_ROW_TESTS
TEST_F(LibYUVPlanarTest, Convert8To16Plane) { TEST_F(LibYUVPlanarTest, Convert8To16Plane) {
// Round count up to multiple of 16 // Round count up to multiple of 16
@ -2896,6 +2901,7 @@ TEST_F(LibYUVPlanarTest, Convert8To16Plane) {
free_aligned_buffer_page_end(dst_pixels_y_c); free_aligned_buffer_page_end(dst_pixels_y_c);
} }
#ifdef ENABLE_ROW_TESTS
// TODO(fbarchard): Improve test for more platforms. // TODO(fbarchard): Improve test for more platforms.
#ifdef HAS_CONVERT8TO16ROW_AVX2 #ifdef HAS_CONVERT8TO16ROW_AVX2
TEST_F(LibYUVPlanarTest, Convert8To16Row_Opt) { 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(src_pixels_vu);
free_aligned_buffer_page_end(dst_pixels_uv); free_aligned_buffer_page_end(dst_pixels_uv);
} }
#endif
} // namespace libyuv } // namespace libyuv

View File

@ -259,7 +259,7 @@ static int ARGBClipTestFilter(int src_width,
TEST_FACTOR(2, 1, 2) TEST_FACTOR(2, 1, 2)
TEST_FACTOR(4, 1, 4) 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(3by4, 3, 4)
TEST_FACTOR(3by8, 3, 8) TEST_FACTOR(3by8, 3, 8)
TEST_FACTOR(3, 1, 3) TEST_FACTOR(3, 1, 3)

View File

@ -14,7 +14,10 @@
#include "../unit_test/unit_test.h" #include "../unit_test/unit_test.h"
#include "libyuv/cpu_id.h" #include "libyuv/cpu_id.h"
#include "libyuv/scale.h" #include "libyuv/scale.h"
#ifdef ENABLE_ROW_TESTS
#include "libyuv/scale_row.h" // For ScaleRowDown2Box_Odd_C #include "libyuv/scale_row.h" // For ScaleRowDown2Box_Odd_C
#endif
#define STRINGIZE(line) #line #define STRINGIZE(line) #line
#define FILELINESTR(file, line) file ":" STRINGIZE(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(2, 1, 2, 0)
TEST_FACTOR(4, 1, 4, 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(3by4, 3, 4, 1)
TEST_FACTOR(3by8, 3, 8, 1) TEST_FACTOR(3by8, 3, 8, 1)
TEST_FACTOR(3, 1, 3, 0) TEST_FACTOR(3, 1, 3, 0)
@ -622,6 +625,7 @@ TEST_SCALETO(Scale, 1920, 1080)
#undef TEST_SCALETO1 #undef TEST_SCALETO1
#undef TEST_SCALETO #undef TEST_SCALETO
#ifdef ENABLE_ROW_TESTS
#ifdef HAS_SCALEROWDOWN2_SSSE3 #ifdef HAS_SCALEROWDOWN2_SSSE3
TEST_F(LibYUVScaleTest, TestScaleRowDown2Box_Odd_SSSE3) { TEST_F(LibYUVScaleTest, TestScaleRowDown2Box_Odd_SSSE3) {
SIMD_ALIGNED(uint8_t orig_pixels[128 * 2]); 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[0], (0 + 1 + 2560 + 2561 + 2) / 4);
EXPECT_EQ(dst_pixels_c[1279], 3839); 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 // Test scaling plane with 8 bit C vs 16 bit C and return maximum pixel
// difference. // difference.
@ -893,7 +898,7 @@ static int TestPlaneFilter_16(int src_width,
TEST_FACTOR(2, 1, 2, 0) TEST_FACTOR(2, 1, 2, 0)
TEST_FACTOR(4, 1, 4, 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(3by4, 3, 4, 1)
TEST_FACTOR(3by8, 3, 8, 1) TEST_FACTOR(3by8, 3, 8, 1)
TEST_FACTOR(3, 1, 3, 0) TEST_FACTOR(3, 1, 3, 0)