Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(681)

Unified Diff: unit_test/unit_test.cc

Issue 1399523004: break up unittests into categories (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: bump version Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « unit_test/unit_test.h ('k') | unit_test/version_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: unit_test/unit_test.cc
diff --git a/unit_test/unit_test.cc b/unit_test/unit_test.cc
index 4be15536406447a353b5b5163ad9ef6ea7bd761c..46981f2a8a4d530762b14269961cd4fdd68f7a41 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");
« no previous file with comments | « unit_test/unit_test.h ('k') | unit_test/version_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698