aboutsummaryrefslogtreecommitdiff
path: root/unit_test/unit_test.cc
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@google.com>2015-10-14 16:58:55 -0700
committerFrank Barchard <fbarchard@google.com>2015-10-14 16:58:55 -0700
commite2417df4cbf594c4b193dd3684ea6662d89334b2 (patch)
tree2d4e5c8d58d9168d9591a3fe2667bb34e1de0c51 /unit_test/unit_test.cc
parent156ad8ee27cd4fc01d5189e56fb2e4db5bec17f2 (diff)
downloadlibyuv-e2417df4cbf594c4b193dd3684ea6662d89334b2.tar.gz
create color test category of unittests to narrow down arm bug
A hang in color conversion on arm occurs somewhere in yuv to rgb. Breaking the color test into its own category of test will help run selective tests to narrow down the issue. R=harryjin@google.com BUG=libyuv:506 Review URL: https://codereview.chromium.org/1405543003 .
Diffstat (limited to 'unit_test/unit_test.cc')
-rw-r--r--unit_test/unit_test.cc45
1 files changed, 40 insertions, 5 deletions
diff --git a/unit_test/unit_test.cc b/unit_test/unit_test.cc
index 46981f2a..83e5910b 100644
--- a/unit_test/unit_test.cc
+++ b/unit_test/unit_test.cc
@@ -20,7 +20,7 @@
int fastrand_seed = 0xfb;
-LibYUVConvertTest::LibYUVConvertTest() : rotate_max_w_(128), rotate_max_h_(128),
+LibYUVConvertTest::LibYUVConvertTest() :
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
benchmark_height_(72), disable_cpu_flags_(0) {
const char* repeat = getenv("LIBYUV_REPEAT");
@@ -55,7 +55,7 @@ LibYUVConvertTest::LibYUVConvertTest() : rotate_max_w_(128), rotate_max_h_(128),
static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0);
}
-LibYUVScaleTest::LibYUVScaleTest() : rotate_max_w_(128), rotate_max_h_(128),
+LibYUVColorTest::LibYUVColorTest() :
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
benchmark_height_(72), disable_cpu_flags_(0) {
const char* repeat = getenv("LIBYUV_REPEAT");
@@ -90,7 +90,7 @@ LibYUVScaleTest::LibYUVScaleTest() : rotate_max_w_(128), rotate_max_h_(128),
static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0);
}
-LibYUVRotateTest::LibYUVRotateTest() : rotate_max_w_(128), rotate_max_h_(128),
+LibYUVScaleTest::LibYUVScaleTest() :
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
benchmark_height_(72), disable_cpu_flags_(0) {
const char* repeat = getenv("LIBYUV_REPEAT");
@@ -125,7 +125,7 @@ LibYUVRotateTest::LibYUVRotateTest() : rotate_max_w_(128), rotate_max_h_(128),
static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0);
}
-LibYUVPlanarTest::LibYUVPlanarTest() : rotate_max_w_(128), rotate_max_h_(128),
+LibYUVRotateTest::LibYUVRotateTest() :
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
benchmark_height_(72), disable_cpu_flags_(0) {
const char* repeat = getenv("LIBYUV_REPEAT");
@@ -160,7 +160,42 @@ LibYUVPlanarTest::LibYUVPlanarTest() : rotate_max_w_(128), rotate_max_h_(128),
static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0);
}
-LibYUVBaseTest::LibYUVBaseTest() : rotate_max_w_(128), rotate_max_h_(128),
+LibYUVPlanarTest::LibYUVPlanarTest() :
+ benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
+ benchmark_height_(72), disable_cpu_flags_(0) {
+ const char* repeat = getenv("LIBYUV_REPEAT");
+ if (repeat) {
+ benchmark_iterations_ = atoi(repeat); // NOLINT
+ // For quicker unittests, default is 128 x 72. But when benchmarking,
+ // default to 720p. Allow size to specify.
+ if (benchmark_iterations_ > 1) {
+ benchmark_width_ = 1280;
+ benchmark_height_ = 720;
+ }
+ }
+ const char* width = getenv("LIBYUV_WIDTH");
+ if (width) {
+ benchmark_width_ = atoi(width); // NOLINT
+ }
+ const char* height = getenv("LIBYUV_HEIGHT");
+ if (height) {
+ benchmark_height_ = atoi(height); // NOLINT
+ }
+ const char* cpu_flags = getenv("LIBYUV_FLAGS");
+ if (cpu_flags) {
+ disable_cpu_flags_ = atoi(cpu_flags); // NOLINT
+ }
+ benchmark_pixels_div256_ = static_cast<int>((
+ static_cast<double>(Abs(benchmark_width_)) *
+ static_cast<double>(Abs(benchmark_height_)) *
+ static_cast<double>(benchmark_iterations_) + 255.0) / 256.0);
+ benchmark_pixels_div1280_ = static_cast<int>((
+ static_cast<double>(Abs(benchmark_width_)) *
+ static_cast<double>(Abs(benchmark_height_)) *
+ static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0);
+}
+
+LibYUVBaseTest::LibYUVBaseTest() :
benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128),
benchmark_height_(72), disable_cpu_flags_(0) {
const char* repeat = getenv("LIBYUV_REPEAT");