aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@google.com>2021-09-29 10:33:11 -0700
committerFrank Barchard <fbarchard@chromium.org>2021-09-30 18:08:20 +0000
commitd13d9d5972ec99e9f923ec5ca2afb8c1d21b8e5a (patch)
tree12ed590be3ff7c88f5655f862e60b995795a4b8b
parentb9bd1b553767bf1a5a3e56910d417a9a6ed0aff8 (diff)
downloadlibyuv-d13d9d5972ec99e9f923ec5ca2afb8c1d21b8e5a.tar.gz
Disable slow and redundant scaling tests
- Filter None and Filter Linear disabled - Filter Box disabled in UV and ARGB scaling - Tests are only disabled if DISABLE_SLOW_TESTS macro is set. Bug: b/197551385 Change-Id: If0a357541412dc762e61c98ef0d80a2c86292177 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3194126 Reviewed-by: Mirko Bonadei <mbonadei@chromium.org>
-rw-r--r--README.chromium2
-rw-r--r--include/libyuv/version.h2
-rw-r--r--unit_test/scale_argb_test.cc46
-rw-r--r--unit_test/scale_test.cc32
-rw-r--r--unit_test/scale_uv_test.cc25
5 files changed, 84 insertions, 23 deletions
diff --git a/README.chromium b/README.chromium
index af67d505..5811eeae 100644
--- a/README.chromium
+++ b/README.chromium
@@ -1,6 +1,6 @@
Name: libyuv
URL: http://code.google.com/p/libyuv/
-Version: 1793
+Version: 1794
License: BSD
License File: LICENSE
diff --git a/include/libyuv/version.h b/include/libyuv/version.h
index 3c6a5a9b..1f6096e6 100644
--- a/include/libyuv/version.h
+++ b/include/libyuv/version.h
@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_
#define INCLUDE_LIBYUV_VERSION_H_
-#define LIBYUV_VERSION 1793
+#define LIBYUV_VERSION 1794
#endif // INCLUDE_LIBYUV_VERSION_H_ \ No newline at end of file
diff --git a/unit_test/scale_argb_test.cc b/unit_test/scale_argb_test.cc
index e6554c7e..f6ca1f54 100644
--- a/unit_test/scale_argb_test.cc
+++ b/unit_test/scale_argb_test.cc
@@ -22,6 +22,12 @@ namespace libyuv {
#define STRINGIZE(line) #line
#define FILELINESTR(file, line) file ":" STRINGIZE(line)
+#if !defined(DISABLE_SLOW_TESTS) || defined(__x86_64__) || defined(__i386__)
+// SLOW TESTS are those that are unoptimized C code.
+// FULL TESTS are optimized but test many variations of the same code.
+#define ENABLE_FULL_TESTS
+#endif
+
// Test scaling with C vs Opt and return maximum pixel difference. 0 = exact.
static int ARGBTestFilter(int src_width,
int src_height,
@@ -252,22 +258,29 @@ static int ARGBClipTestFilter(int src_width,
// Test a scale factor with all 4 filters. Expect unfiltered to be exact, but
// filtering is different fixed point implementations for SSSE3, Neon and C.
#ifndef DISABLE_SLOW_TESTS
-#define TEST_FACTOR(name, nom, denom) \
+#define TEST_FACTOR(name, nom, denom) \
TEST_FACTOR1(, name, None, nom, denom, 0) \
TEST_FACTOR1(, name, Linear, nom, denom, 3) \
TEST_FACTOR1(, name, Bilinear, nom, denom, 3) \
TEST_FACTOR1(, name, Box, nom, denom, 3)
#else
-#define TEST_FACTOR(name, nom, denom) \
+#if defined(ENABLE_FULL_TESTS)
+#define TEST_FACTOR(name, nom, denom) \
TEST_FACTOR1(DISABLED_, name, None, nom, denom, 0) \
TEST_FACTOR1(DISABLED_, name, Linear, nom, denom, 3) \
TEST_FACTOR1(DISABLED_, name, Bilinear, nom, denom, 3) \
TEST_FACTOR1(DISABLED_, name, Box, nom, denom, 3)
+#else
+#define TEST_FACTOR(name, nom, denom) \
+ TEST_FACTOR1(DISABLED_, name, Bilinear, nom, denom, 3)
+#endif
#endif
TEST_FACTOR(2, 1, 2)
TEST_FACTOR(4, 1, 4)
-// TEST_FACTOR(8, 1, 8) Disable for benchmark performance.
+#ifndef DISABLE_SLOW_TESTS
+TEST_FACTOR(8, 1, 8)
+#endif
TEST_FACTOR(3by4, 3, 4)
TEST_FACTOR(3by8, 3, 8)
TEST_FACTOR(3, 1, 3)
@@ -305,22 +318,26 @@ TEST_FACTOR(3, 1, 3)
EXPECT_LE(diff, max_diff); \
}
-/// Test scale to a specified size with all 4 filters.
#ifndef DISABLE_SLOW_TESTS
-#define TEST_SCALETO(name, width, height) \
- TEST_SCALETO1(, name, width, height, None, 0) \
- TEST_SCALETO1(, name, width, height, Linear, 3) \
+// Test scale to a specified size with all 4 filters.
+#define TEST_SCALETO(name, width, height) \
+ TEST_SCALETO1(, name, width, height, None, 0) \
+ TEST_SCALETO1(, name, width, height, Linear, 3) \
TEST_SCALETO1(, name, width, height, Bilinear, 3)
#else
-#define TEST_SCALETO(name, width, height) \
- TEST_SCALETO1(DISABLED_, name, width, height, None, 0) \
- TEST_SCALETO1(DISABLED_, name, width, height, Linear, 3) \
+#if defined(ENABLE_FULL_TESTS)
+#define TEST_SCALETO(name, width, height) \
+ TEST_SCALETO1(DISABLED_, name, width, height, None, 0) \
+ TEST_SCALETO1(DISABLED_, name, width, height, Linear, 3) \
+ TEST_SCALETO1(DISABLED_, name, width, height, Bilinear, 3)
+#else
+#define TEST_SCALETO(name, width, height) \
TEST_SCALETO1(DISABLED_, name, width, height, Bilinear, 3)
#endif
+#endif
TEST_SCALETO(ARGBScale, 1, 1)
-// TODO(https://bugs.chromium.org/p/libyuv/issues/detail?id=905): Investigate.
-// TEST_SCALETO(ARGBScale, 256, 144) /* 128x72 * 2 */
+//TEST_SCALETO(ARGBScale, 256, 144) /* 128x72 * 2 */
TEST_SCALETO(ARGBScale, 320, 240)
TEST_SCALETO(ARGBScale, 569, 480)
TEST_SCALETO(ARGBScale, 640, 360)
@@ -328,7 +345,6 @@ TEST_SCALETO(ARGBScale, 640, 360)
TEST_SCALETO(ARGBScale, 1280, 720)
TEST_SCALETO(ARGBScale, 1920, 1080)
#endif // DISABLE_SLOW_TESTS
-
#undef TEST_SCALETO1
#undef TEST_SCALETO
@@ -341,10 +357,14 @@ TEST_SCALETO(ARGBScale, 1920, 1080)
EXPECT_LE(diff, max_diff); \
}
+#if defined(ENABLE_FULL_TESTS)
// Test scale with swapped width and height with all 3 filters.
TEST_SCALESWAPXY1(ARGBScale, None, 0)
TEST_SCALESWAPXY1(ARGBScale, Linear, 0)
TEST_SCALESWAPXY1(ARGBScale, Bilinear, 0)
+#else
+TEST_SCALESWAPXY1(ARGBScale, Bilinear, 0)
+#endif
#undef TEST_SCALESWAPXY1
// Scale with YUV conversion to ARGB and clipping.
diff --git a/unit_test/scale_test.cc b/unit_test/scale_test.cc
index 6842fb50..ba4e0943 100644
--- a/unit_test/scale_test.cc
+++ b/unit_test/scale_test.cc
@@ -22,6 +22,12 @@
#define STRINGIZE(line) #line
#define FILELINESTR(file, line) file ":" STRINGIZE(line)
+#if !defined(DISABLE_SLOW_TESTS) || defined(__x86_64__) || defined(__i386__)
+// SLOW TESTS are those that are unoptimized C code.
+// FULL TESTS are optimized but test many variations of the same code.
+#define ENABLE_FULL_TESTS
+#endif
+
namespace libyuv {
// Test scaling with C vs Opt and return maximum pixel difference. 0 = exact.
@@ -889,16 +895,24 @@ static int NV12TestFilter(int src_width,
TEST_FACTOR1(, name, Bilinear, nom, denom, 3) \
TEST_FACTOR1(, name, Box, nom, denom, boxdiff)
#else
+#if defined(ENABLE_FULL_TESTS)
#define TEST_FACTOR(name, nom, denom, boxdiff) \
TEST_FACTOR1(DISABLED_, name, None, nom, denom, 0) \
TEST_FACTOR1(DISABLED_, name, Linear, nom, denom, 3) \
TEST_FACTOR1(DISABLED_, name, Bilinear, nom, denom, 3) \
TEST_FACTOR1(DISABLED_, name, Box, nom, denom, boxdiff)
+#else
+#define TEST_FACTOR(name, nom, denom, boxdiff) \
+ TEST_FACTOR1(DISABLED_, name, Bilinear, nom, denom, 3) \
+ TEST_FACTOR1(DISABLED_, name, Box, nom, denom, boxdiff)
+#endif
#endif
TEST_FACTOR(2, 1, 2, 0)
TEST_FACTOR(4, 1, 4, 0)
-// TEST_FACTOR(8, 1, 8, 0) Disable for benchmark performance. Takes 90 seconds.
+#ifndef DISABLE_SLOW_TESTS
+TEST_FACTOR(8, 1, 8, 0)
+#endif
TEST_FACTOR(3by4, 3, 4, 1)
TEST_FACTOR(3by8, 3, 8, 1)
TEST_FACTOR(3, 1, 3, 0)
@@ -1016,17 +1030,21 @@ TEST_FACTOR(3, 1, 3, 0)
TEST_SCALETO1(, name, width, height, Bilinear, 3) \
TEST_SCALETO1(, name, width, height, Box, 3)
#else
-// Test scale to a specified size with all 4 filters.
+#if defined(ENABLE_FULL_TESTS)
#define TEST_SCALETO(name, width, height) \
TEST_SCALETO1(DISABLED_, name, width, height, None, 0) \
TEST_SCALETO1(DISABLED_, name, width, height, Linear, 3) \
TEST_SCALETO1(DISABLED_, name, width, height, Bilinear, 3) \
TEST_SCALETO1(DISABLED_, name, width, height, Box, 3)
+#else
+#define TEST_SCALETO(name, width, height) \
+ TEST_SCALETO1(DISABLED_, name, width, height, Bilinear, 3) \
+ TEST_SCALETO1(DISABLED_, name, width, height, Box, 3)
+#endif
#endif
TEST_SCALETO(Scale, 1, 1)
-// TODO(https://bugs.chromium.org/p/libyuv/issues/detail?id=905): Investigate.
-// TEST_SCALETO(Scale, 256, 144) /* 128x72 * 2 */
+//TEST_SCALETO(Scale, 256, 144) /* 128x72 * 2 */
TEST_SCALETO(Scale, 320, 240)
TEST_SCALETO(Scale, 569, 480)
TEST_SCALETO(Scale, 640, 360)
@@ -1034,7 +1052,6 @@ TEST_SCALETO(Scale, 640, 360)
TEST_SCALETO(Scale, 1280, 720)
TEST_SCALETO(Scale, 1920, 1080)
#endif // DISABLE_SLOW_TESTS
-
#undef TEST_SCALETO1
#undef TEST_SCALETO
@@ -1096,10 +1113,15 @@ TEST_SCALESWAPXY1(, Scale, Linear, 3)
TEST_SCALESWAPXY1(, Scale, Bilinear, 3)
TEST_SCALESWAPXY1(, Scale, Box, 3)
#else
+#if defined(ENABLE_FULL_TESTS)
TEST_SCALESWAPXY1(DISABLED_, Scale, None, 0)
TEST_SCALESWAPXY1(DISABLED_, Scale, Linear, 3)
TEST_SCALESWAPXY1(DISABLED_, Scale, Bilinear, 3)
TEST_SCALESWAPXY1(DISABLED_, Scale, Box, 3)
+#else
+TEST_SCALESWAPXY1(DISABLED_, Scale, Bilinear, 3)
+TEST_SCALESWAPXY1(DISABLED_, Scale, Box, 3)
+#endif
#endif
#undef TEST_SCALESWAPXY1
diff --git a/unit_test/scale_uv_test.cc b/unit_test/scale_uv_test.cc
index 064f7a55..b53411bc 100644
--- a/unit_test/scale_uv_test.cc
+++ b/unit_test/scale_uv_test.cc
@@ -20,6 +20,12 @@ namespace libyuv {
#define STRINGIZE(line) #line
#define FILELINESTR(file, line) file ":" STRINGIZE(line)
+#if !defined(DISABLE_SLOW_TESTS) || defined(__x86_64__) || defined(__i386__)
+// SLOW TESTS are those that are unoptimized C code.
+// FULL TESTS are optimized but test many variations of the same code.
+#define ENABLE_FULL_TESTS
+#endif
+
// Test scaling with C vs Opt and return maximum pixel difference. 0 = exact.
static int UVTestFilter(int src_width,
int src_height,
@@ -125,6 +131,7 @@ static int UVTestFilter(int src_width,
EXPECT_LE(diff, max_diff); \
}
+#if defined(ENABLE_FULL_TESTS)
// Test a scale factor with all 4 filters. Expect unfiltered to be exact, but
// filtering is different fixed point implementations for SSSE3, Neon and C.
#define TEST_FACTOR(name, nom, denom) \
@@ -132,6 +139,11 @@ static int UVTestFilter(int src_width,
TEST_FACTOR1(name, Linear, nom, denom, 3) \
TEST_FACTOR1(name, Bilinear, nom, denom, 3) \
TEST_FACTOR1(name, Box, nom, denom, 3)
+#else
+// Test a scale factor with Bilinear.
+#define TEST_FACTOR(name, nom, denom) \
+ TEST_FACTOR1(name, Bilinear, nom, denom, 3)
+#endif
TEST_FACTOR(2, 1, 2)
TEST_FACTOR(4, 1, 4)
@@ -159,15 +171,19 @@ TEST_FACTOR(3, 1, 3)
EXPECT_LE(diff, max_diff); \
}
+#if defined(ENABLE_FULL_TESTS)
/// Test scale to a specified size with all 4 filters.
#define TEST_SCALETO(name, width, height) \
TEST_SCALETO1(name, width, height, None, 0) \
TEST_SCALETO1(name, width, height, Linear, 3) \
TEST_SCALETO1(name, width, height, Bilinear, 3)
+#else
+#define TEST_SCALETO(name, width, height) \
+ TEST_SCALETO1(name, width, height, Bilinear, 3)
+#endif
TEST_SCALETO(UVScale, 1, 1)
-// TODO(https://bugs.chromium.org/p/libyuv/issues/detail?id=905): Investigate.
-// TEST_SCALETO(UVScale, 256, 144) /* 128x72 * 2 */
+//TEST_SCALETO(UVScale, 256, 144) /* 128x72 * 2 */
TEST_SCALETO(UVScale, 320, 240)
TEST_SCALETO(UVScale, 569, 480)
TEST_SCALETO(UVScale, 640, 360)
@@ -175,7 +191,6 @@ TEST_SCALETO(UVScale, 640, 360)
TEST_SCALETO(UVScale, 1280, 720)
TEST_SCALETO(UVScale, 1920, 1080)
#endif // DISABLE_SLOW_TESTS
-
#undef TEST_SCALETO1
#undef TEST_SCALETO
@@ -188,10 +203,14 @@ TEST_SCALETO(UVScale, 1920, 1080)
EXPECT_LE(diff, max_diff); \
}
+#if defined(ENABLE_FULL_TESTS)
// Test scale with swapped width and height with all 3 filters.
TEST_SCALESWAPXY1(UVScale, None, 0)
TEST_SCALESWAPXY1(UVScale, Linear, 0)
TEST_SCALESWAPXY1(UVScale, Bilinear, 0)
+#else
+TEST_SCALESWAPXY1(UVScale, Bilinear, 0)
+#endif
#undef TEST_SCALESWAPXY1
TEST_F(LibYUVScaleTest, UVTest3x) {