michael@0: /* michael@0: * Copyright 2011 The LibYuv Project Authors. All rights reserved. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license michael@0: * that can be found in the LICENSE file in the root of the source michael@0: * tree. An additional intellectual property rights grant can be found michael@0: * in the file PATENTS. All contributing project authors may michael@0: * be found in the AUTHORS file in the root of the source tree. michael@0: */ michael@0: michael@0: #include "../unit_test/unit_test.h" michael@0: michael@0: #include // For getenv() michael@0: michael@0: #include michael@0: michael@0: // Change this to 1000 for benchmarking. michael@0: // TODO(fbarchard): Add command line parsing to pass this as option. michael@0: #define BENCHMARK_ITERATIONS 1 michael@0: michael@0: libyuvTest::libyuvTest() : rotate_max_w_(128), rotate_max_h_(128), michael@0: benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), michael@0: benchmark_height_(72) { michael@0: const char* repeat = getenv("LIBYUV_REPEAT"); michael@0: if (repeat) { michael@0: benchmark_iterations_ = atoi(repeat); // NOLINT michael@0: // For quicker unittests, default is 128 x 72. But when benchmarking, michael@0: // default to 720p. Allow size to specify. michael@0: if (benchmark_iterations_ > 1) { michael@0: benchmark_width_ = 1280; michael@0: benchmark_height_ = 720; michael@0: } michael@0: } michael@0: const char* width = getenv("LIBYUV_WIDTH"); michael@0: if (width) { michael@0: benchmark_width_ = atoi(width); // NOLINT michael@0: } michael@0: const char* height = getenv("LIBYUV_HEIGHT"); michael@0: if (height) { michael@0: benchmark_height_ = atoi(height); // NOLINT michael@0: } michael@0: benchmark_pixels_div256_ = static_cast(( michael@0: static_cast(Abs(benchmark_width_)) * michael@0: static_cast(Abs(benchmark_height_)) * michael@0: static_cast(benchmark_iterations_) + 255.0) / 256.0); michael@0: benchmark_pixels_div1280_ = static_cast(( michael@0: static_cast(Abs(benchmark_width_)) * michael@0: static_cast(Abs(benchmark_height_)) * michael@0: static_cast(benchmark_iterations_) + 1279.0) / 1280.0); michael@0: } michael@0: michael@0: int main(int argc, char** argv) { michael@0: ::testing::InitGoogleTest(&argc, argv); michael@0: return RUN_ALL_TESTS(); michael@0: }