| 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 #include "gflags/gflags.h" | 17 #include "gflags/gflags.h" |
| 18 | 18 |
| 19 // Change this to 1000 for benchmarking. | 19 // Change this to 1000 for benchmarking. |
| 20 // TODO(fbarchard): Add command line parsing to pass this as option. | 20 // TODO(fbarchard): Add command line parsing to pass this as option. |
| 21 #define BENCHMARK_ITERATIONS 1 | 21 #define BENCHMARK_ITERATIONS 1 |
| 22 | 22 |
| 23 unsigned int fastrand_seed = 0xfb; | 23 unsigned int fastrand_seed = 0xfb; |
| 24 | 24 |
| 25 DEFINE_int32(libyuv_width, 0, "width of test image."); | 25 DEFINE_int32(libyuv_width, 0, "width of test image."); |
| 26 DEFINE_int32(libyuv_height, 0, "height of test image."); | 26 DEFINE_int32(libyuv_height, 0, "height of test image."); |
| 27 DEFINE_int32(libyuv_repeat, 0, "number of times to repeat test."); | 27 DEFINE_int32(libyuv_repeat, 0, "number of times to repeat test."); |
| 28 DEFINE_int32(libyuv_flags, 0, "cpu flags for reference code. 0 = C -1 = asm"); | 28 DEFINE_int32(libyuv_flags, 0, |
| 29 DEFINE_int32(libyuv_cpu_info, -1, | 29 "cpu flags for reference code. 1 = C, -1 = SIMD"); |
| 30 "cpu flags for benchmark code. -1 = SIMD, 1 = C"); | 30 DEFINE_int32(libyuv_cpu_info, 0, |
| 31 "cpu flags for benchmark code. 1 = C, -1 = SIMD"); |
| 31 | 32 |
| 32 // For quicker unittests, default is 128 x 72. But when benchmarking, | 33 // For quicker unittests, default is 128 x 72. But when benchmarking, |
| 33 // default to 720p. Allow size to specify. | 34 // default to 720p. Allow size to specify. |
| 34 // Set flags to -1 for benchmarking to avoid slower C code. | 35 // Set flags to -1 for benchmarking to avoid slower C code. |
| 35 | 36 |
| 36 LibYUVConvertTest::LibYUVConvertTest() : | 37 LibYUVConvertTest::LibYUVConvertTest() : |
| 37 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), | 38 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), |
| 38 benchmark_height_(72), disable_cpu_flags_(1), benchmark_cpu_info_(-1) { | 39 benchmark_height_(72), disable_cpu_flags_(1), benchmark_cpu_info_(-1) { |
| 39 const char* repeat = getenv("LIBYUV_REPEAT"); | 40 const char* repeat = getenv("LIBYUV_REPEAT"); |
| 40 if (repeat) { | 41 if (repeat) { |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 } | 347 } |
| 347 | 348 |
| 348 int main(int argc, char** argv) { | 349 int main(int argc, char** argv) { |
| 349 ::testing::InitGoogleTest(&argc, argv); | 350 ::testing::InitGoogleTest(&argc, argv); |
| 350 // AllowCommandLineParsing allows us to ignore flags passed on to us by | 351 // AllowCommandLineParsing allows us to ignore flags passed on to us by |
| 351 // Chromium build bots without having to explicitly disable them. | 352 // Chromium build bots without having to explicitly disable them. |
| 352 google::AllowCommandLineReparsing(); | 353 google::AllowCommandLineReparsing(); |
| 353 google::ParseCommandLineFlags(&argc, &argv, true); | 354 google::ParseCommandLineFlags(&argc, &argv, true); |
| 354 return RUN_ALL_TESTS(); | 355 return RUN_ALL_TESTS(); |
| 355 } | 356 } |
| OLD | NEW |