| 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 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 DEFINE_int32(libyuv_flags, 0, "cpu flags for reference code. 0 = C -1 = asm"); | 29 DEFINE_int32(libyuv_flags, 0, "cpu flags for reference code. 0 = C -1 = asm"); |
| 30 DEFINE_int32(libyuv_cpu_info, -1, | 30 DEFINE_int32(libyuv_cpu_info, -1, |
| 31 "cpu flags for benchmark code. -1 = SIMD, 1 = C"); | 31 "cpu flags for benchmark code. -1 = SIMD, 1 = C"); |
| 32 | 32 |
| 33 // For quicker unittests, default is 128 x 72. But when benchmarking, | 33 // For quicker unittests, default is 128 x 72. But when benchmarking, |
| 34 // default to 720p. Allow size to specify. | 34 // default to 720p. Allow size to specify. |
| 35 // Set flags to -1 for benchmarking to avoid slower C code. | 35 // Set flags to -1 for benchmarking to avoid slower C code. |
| 36 | 36 |
| 37 LibYUVConvertTest::LibYUVConvertTest() : | 37 LibYUVConvertTest::LibYUVConvertTest() : |
| 38 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(130), | 38 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(130), |
| 39 benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) { | 39 benchmark_height_(72), disable_cpu_flags_(1), benchmark_cpu_info_(-1) { |
| 40 const char* repeat = getenv("LIBYUV_REPEAT"); | 40 const char* repeat = getenv("LIBYUV_REPEAT"); |
| 41 if (repeat) { | 41 if (repeat) { |
| 42 benchmark_iterations_ = atoi(repeat); // NOLINT | 42 benchmark_iterations_ = atoi(repeat); // NOLINT |
| 43 } | 43 } |
| 44 if (FLAGS_libyuv_repeat) { | 44 if (FLAGS_libyuv_repeat) { |
| 45 benchmark_iterations_ = FLAGS_libyuv_repeat; | 45 benchmark_iterations_ = FLAGS_libyuv_repeat; |
| 46 } | 46 } |
| 47 if (benchmark_iterations_ > 1) { | 47 if (benchmark_iterations_ > 1) { |
| 48 benchmark_width_ = 1280; | 48 benchmark_width_ = 1280; |
| 49 benchmark_height_ = 720; | 49 benchmark_height_ = 720; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 static_cast<double>(Abs(benchmark_height_)) * | 81 static_cast<double>(Abs(benchmark_height_)) * |
| 82 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); | 82 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); |
| 83 benchmark_pixels_div1280_ = static_cast<int>(( | 83 benchmark_pixels_div1280_ = static_cast<int>(( |
| 84 static_cast<double>(Abs(benchmark_width_)) * | 84 static_cast<double>(Abs(benchmark_width_)) * |
| 85 static_cast<double>(Abs(benchmark_height_)) * | 85 static_cast<double>(Abs(benchmark_height_)) * |
| 86 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); | 86 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); |
| 87 } | 87 } |
| 88 | 88 |
| 89 LibYUVColorTest::LibYUVColorTest() : | 89 LibYUVColorTest::LibYUVColorTest() : |
| 90 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), | 90 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), |
| 91 benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) { | 91 benchmark_height_(72), disable_cpu_flags_(1), benchmark_cpu_info_(-1) { |
| 92 const char* repeat = getenv("LIBYUV_REPEAT"); | 92 const char* repeat = getenv("LIBYUV_REPEAT"); |
| 93 if (repeat) { | 93 if (repeat) { |
| 94 benchmark_iterations_ = atoi(repeat); // NOLINT | 94 benchmark_iterations_ = atoi(repeat); // NOLINT |
| 95 } | 95 } |
| 96 if (FLAGS_libyuv_repeat) { | 96 if (FLAGS_libyuv_repeat) { |
| 97 benchmark_iterations_ = FLAGS_libyuv_repeat; | 97 benchmark_iterations_ = FLAGS_libyuv_repeat; |
| 98 } | 98 } |
| 99 if (benchmark_iterations_ > 1) { | 99 if (benchmark_iterations_ > 1) { |
| 100 benchmark_width_ = 1280; | 100 benchmark_width_ = 1280; |
| 101 benchmark_height_ = 720; | 101 benchmark_height_ = 720; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 static_cast<double>(Abs(benchmark_height_)) * | 133 static_cast<double>(Abs(benchmark_height_)) * |
| 134 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); | 134 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); |
| 135 benchmark_pixels_div1280_ = static_cast<int>(( | 135 benchmark_pixels_div1280_ = static_cast<int>(( |
| 136 static_cast<double>(Abs(benchmark_width_)) * | 136 static_cast<double>(Abs(benchmark_width_)) * |
| 137 static_cast<double>(Abs(benchmark_height_)) * | 137 static_cast<double>(Abs(benchmark_height_)) * |
| 138 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); | 138 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); |
| 139 } | 139 } |
| 140 | 140 |
| 141 LibYUVScaleTest::LibYUVScaleTest() : | 141 LibYUVScaleTest::LibYUVScaleTest() : |
| 142 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), | 142 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), |
| 143 benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) { | 143 benchmark_height_(72), disable_cpu_flags_(1), benchmark_cpu_info_(-1) { |
| 144 const char* repeat = getenv("LIBYUV_REPEAT"); | 144 const char* repeat = getenv("LIBYUV_REPEAT"); |
| 145 if (repeat) { | 145 if (repeat) { |
| 146 benchmark_iterations_ = atoi(repeat); // NOLINT | 146 benchmark_iterations_ = atoi(repeat); // NOLINT |
| 147 } | 147 } |
| 148 if (FLAGS_libyuv_repeat) { | 148 if (FLAGS_libyuv_repeat) { |
| 149 benchmark_iterations_ = FLAGS_libyuv_repeat; | 149 benchmark_iterations_ = FLAGS_libyuv_repeat; |
| 150 } | 150 } |
| 151 if (benchmark_iterations_ > 1) { | 151 if (benchmark_iterations_ > 1) { |
| 152 benchmark_width_ = 1280; | 152 benchmark_width_ = 1280; |
| 153 benchmark_height_ = 720; | 153 benchmark_height_ = 720; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 static_cast<double>(Abs(benchmark_height_)) * | 185 static_cast<double>(Abs(benchmark_height_)) * |
| 186 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); | 186 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); |
| 187 benchmark_pixels_div1280_ = static_cast<int>(( | 187 benchmark_pixels_div1280_ = static_cast<int>(( |
| 188 static_cast<double>(Abs(benchmark_width_)) * | 188 static_cast<double>(Abs(benchmark_width_)) * |
| 189 static_cast<double>(Abs(benchmark_height_)) * | 189 static_cast<double>(Abs(benchmark_height_)) * |
| 190 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); | 190 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); |
| 191 } | 191 } |
| 192 | 192 |
| 193 LibYUVRotateTest::LibYUVRotateTest() : | 193 LibYUVRotateTest::LibYUVRotateTest() : |
| 194 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), | 194 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), |
| 195 benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) { | 195 benchmark_height_(72), disable_cpu_flags_(1), benchmark_cpu_info_(-1) { |
| 196 const char* repeat = getenv("LIBYUV_REPEAT"); | 196 const char* repeat = getenv("LIBYUV_REPEAT"); |
| 197 if (repeat) { | 197 if (repeat) { |
| 198 benchmark_iterations_ = atoi(repeat); // NOLINT | 198 benchmark_iterations_ = atoi(repeat); // NOLINT |
| 199 } | 199 } |
| 200 if (FLAGS_libyuv_repeat) { | 200 if (FLAGS_libyuv_repeat) { |
| 201 benchmark_iterations_ = FLAGS_libyuv_repeat; | 201 benchmark_iterations_ = FLAGS_libyuv_repeat; |
| 202 } | 202 } |
| 203 if (benchmark_iterations_ > 1) { | 203 if (benchmark_iterations_ > 1) { |
| 204 benchmark_width_ = 1280; | 204 benchmark_width_ = 1280; |
| 205 benchmark_height_ = 720; | 205 benchmark_height_ = 720; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 static_cast<double>(Abs(benchmark_height_)) * | 237 static_cast<double>(Abs(benchmark_height_)) * |
| 238 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); | 238 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); |
| 239 benchmark_pixels_div1280_ = static_cast<int>(( | 239 benchmark_pixels_div1280_ = static_cast<int>(( |
| 240 static_cast<double>(Abs(benchmark_width_)) * | 240 static_cast<double>(Abs(benchmark_width_)) * |
| 241 static_cast<double>(Abs(benchmark_height_)) * | 241 static_cast<double>(Abs(benchmark_height_)) * |
| 242 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); | 242 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); |
| 243 } | 243 } |
| 244 | 244 |
| 245 LibYUVPlanarTest::LibYUVPlanarTest() : | 245 LibYUVPlanarTest::LibYUVPlanarTest() : |
| 246 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), | 246 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), |
| 247 benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) { | 247 benchmark_height_(72), disable_cpu_flags_(1), benchmark_cpu_info_(-1) { |
| 248 const char* repeat = getenv("LIBYUV_REPEAT"); | 248 const char* repeat = getenv("LIBYUV_REPEAT"); |
| 249 if (repeat) { | 249 if (repeat) { |
| 250 benchmark_iterations_ = atoi(repeat); // NOLINT | 250 benchmark_iterations_ = atoi(repeat); // NOLINT |
| 251 } | 251 } |
| 252 if (FLAGS_libyuv_repeat) { | 252 if (FLAGS_libyuv_repeat) { |
| 253 benchmark_iterations_ = FLAGS_libyuv_repeat; | 253 benchmark_iterations_ = FLAGS_libyuv_repeat; |
| 254 } | 254 } |
| 255 if (benchmark_iterations_ > 1) { | 255 if (benchmark_iterations_ > 1) { |
| 256 benchmark_width_ = 1280; | 256 benchmark_width_ = 1280; |
| 257 benchmark_height_ = 720; | 257 benchmark_height_ = 720; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 static_cast<double>(Abs(benchmark_height_)) * | 289 static_cast<double>(Abs(benchmark_height_)) * |
| 290 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); | 290 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); |
| 291 benchmark_pixels_div1280_ = static_cast<int>(( | 291 benchmark_pixels_div1280_ = static_cast<int>(( |
| 292 static_cast<double>(Abs(benchmark_width_)) * | 292 static_cast<double>(Abs(benchmark_width_)) * |
| 293 static_cast<double>(Abs(benchmark_height_)) * | 293 static_cast<double>(Abs(benchmark_height_)) * |
| 294 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); | 294 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); |
| 295 } | 295 } |
| 296 | 296 |
| 297 LibYUVBaseTest::LibYUVBaseTest() : | 297 LibYUVBaseTest::LibYUVBaseTest() : |
| 298 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), | 298 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), |
| 299 benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) { | 299 benchmark_height_(72), disable_cpu_flags_(1), benchmark_cpu_info_(-1) { |
| 300 const char* repeat = getenv("LIBYUV_REPEAT"); | 300 const char* repeat = getenv("LIBYUV_REPEAT"); |
| 301 if (repeat) { | 301 if (repeat) { |
| 302 benchmark_iterations_ = atoi(repeat); // NOLINT | 302 benchmark_iterations_ = atoi(repeat); // NOLINT |
| 303 } | 303 } |
| 304 if (FLAGS_libyuv_repeat) { | 304 if (FLAGS_libyuv_repeat) { |
| 305 benchmark_iterations_ = FLAGS_libyuv_repeat; | 305 benchmark_iterations_ = FLAGS_libyuv_repeat; |
| 306 } | 306 } |
| 307 if (benchmark_iterations_ > 1) { | 307 if (benchmark_iterations_ > 1) { |
| 308 benchmark_width_ = 1280; | 308 benchmark_width_ = 1280; |
| 309 benchmark_height_ = 720; | 309 benchmark_height_ = 720; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 } | 347 } |
| 348 | 348 |
| 349 int main(int argc, char** argv) { | 349 int main(int argc, char** argv) { |
| 350 ::testing::InitGoogleTest(&argc, argv); | 350 ::testing::InitGoogleTest(&argc, argv); |
| 351 // AllowCommandLineParsing allows us to ignore flags passed on to us by | 351 // AllowCommandLineParsing allows us to ignore flags passed on to us by |
| 352 // Chromium build bots without having to explicitly disable them. | 352 // Chromium build bots without having to explicitly disable them. |
| 353 google::AllowCommandLineReparsing(); | 353 google::AllowCommandLineReparsing(); |
| 354 google::ParseCommandLineFlags(&argc, &argv, true); | 354 google::ParseCommandLineFlags(&argc, &argv, true); |
| 355 return RUN_ALL_TESTS(); | 355 return RUN_ALL_TESTS(); |
| 356 } | 356 } |
| OLD | NEW |