| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "../unit_test/unit_test.h" | 11 #include "../unit_test/unit_test.h" |
| 12 | 12 |
| 13 #include <stdlib.h> // For getenv() | 13 #include <stdlib.h> // For getenv() |
| 14 | 14 |
| 15 #include <cstring> | 15 #include <cstring> |
| 16 | 16 |
| 17 // Change this to 1000 for benchmarking. | 17 // Change this to 1000 for benchmarking. |
| 18 // TODO(fbarchard): Add command line parsing to pass this as option. | 18 // TODO(fbarchard): Add command line parsing to pass this as option. |
| 19 #define BENCHMARK_ITERATIONS 1 | 19 #define BENCHMARK_ITERATIONS 1 |
| 20 | 20 |
| 21 int fastrand_seed = 0xfb; |
| 22 |
| 21 libyuvTest::libyuvTest() : rotate_max_w_(128), rotate_max_h_(128), | 23 libyuvTest::libyuvTest() : rotate_max_w_(128), rotate_max_h_(128), |
| 22 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), | 24 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), |
| 23 benchmark_height_(72), disable_cpu_flags_(0) { | 25 benchmark_height_(72), disable_cpu_flags_(0) { |
| 24 const char* repeat = getenv("LIBYUV_REPEAT"); | 26 const char* repeat = getenv("LIBYUV_REPEAT"); |
| 25 if (repeat) { | 27 if (repeat) { |
| 26 benchmark_iterations_ = atoi(repeat); // NOLINT | 28 benchmark_iterations_ = atoi(repeat); // NOLINT |
| 27 // For quicker unittests, default is 128 x 72. But when benchmarking, | 29 // For quicker unittests, default is 128 x 72. But when benchmarking, |
| 28 // default to 720p. Allow size to specify. | 30 // default to 720p. Allow size to specify. |
| 29 if (benchmark_iterations_ > 1) { | 31 if (benchmark_iterations_ > 1) { |
| 30 benchmark_width_ = 1280; | 32 benchmark_width_ = 1280; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 50 benchmark_pixels_div1280_ = static_cast<int>(( | 52 benchmark_pixels_div1280_ = static_cast<int>(( |
| 51 static_cast<double>(Abs(benchmark_width_)) * | 53 static_cast<double>(Abs(benchmark_width_)) * |
| 52 static_cast<double>(Abs(benchmark_height_)) * | 54 static_cast<double>(Abs(benchmark_height_)) * |
| 53 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); | 55 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); |
| 54 } | 56 } |
| 55 | 57 |
| 56 int main(int argc, char** argv) { | 58 int main(int argc, char** argv) { |
| 57 ::testing::InitGoogleTest(&argc, argv); | 59 ::testing::InitGoogleTest(&argc, argv); |
| 58 return RUN_ALL_TESTS(); | 60 return RUN_ALL_TESTS(); |
| 59 } | 61 } |
| OLD | NEW |