diff options
author | Frank Barchard <fbarchard@google.com> | 2015-10-13 16:01:07 -0700 |
---|---|---|
committer | Frank Barchard <fbarchard@google.com> | 2015-10-13 16:01:07 -0700 |
commit | 26db4de2aeb94450a8ed5b6d7863126ae47480ee (patch) | |
tree | 8246c86d1f6255e0be9b631ddb4b8ae7dbc675cd /unit_test/unit_test.cc | |
parent | be4d445e8c24d5c3a7c8c6d07f9ca7b9e06b096f (diff) | |
download | libyuv-26db4de2aeb94450a8ed5b6d7863126ae47480ee.tar.gz |
break up unittests into categories
R=harryjin@google.com
BUG=none
Review URL: https://codereview.chromium.org/1399523004 .
Diffstat (limited to 'unit_test/unit_test.cc')
-rw-r--r-- | unit_test/unit_test.cc | 142 |
1 files changed, 141 insertions, 1 deletions
diff --git a/unit_test/unit_test.cc b/unit_test/unit_test.cc index 4be15536..46981f2a 100644 --- a/unit_test/unit_test.cc +++ b/unit_test/unit_test.cc @@ -20,7 +20,147 @@ int fastrand_seed = 0xfb; -libyuvTest::libyuvTest() : rotate_max_w_(128), rotate_max_h_(128), +LibYUVConvertTest::LibYUVConvertTest() : rotate_max_w_(128), rotate_max_h_(128), + 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); +} + +LibYUVScaleTest::LibYUVScaleTest() : rotate_max_w_(128), rotate_max_h_(128), + 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); +} + +LibYUVRotateTest::LibYUVRotateTest() : rotate_max_w_(128), rotate_max_h_(128), + 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); +} + +LibYUVPlanarTest::LibYUVPlanarTest() : rotate_max_w_(128), rotate_max_h_(128), + 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() : rotate_max_w_(128), rotate_max_h_(128), benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), benchmark_height_(72), disable_cpu_flags_(0) { const char* repeat = getenv("LIBYUV_REPEAT"); |