| 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 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 // Change this to 1000 for benchmarking. | 20 // Change this to 1000 for benchmarking. |
| 21 // TODO(fbarchard): Add command line parsing to pass this as option. | 21 // TODO(fbarchard): Add command line parsing to pass this as option. |
| 22 #define BENCHMARK_ITERATIONS 1 | 22 #define BENCHMARK_ITERATIONS 1 |
| 23 | 23 |
| 24 int fastrand_seed = 0xfb; | 24 int fastrand_seed = 0xfb; |
| 25 | 25 |
| 26 DEFINE_int32(libyuv_width, 0, "width of test image."); | 26 DEFINE_int32(libyuv_width, 0, "width of test image."); |
| 27 DEFINE_int32(libyuv_height, 0, "height of test image."); | 27 DEFINE_int32(libyuv_height, 0, "height of test image."); |
| 28 DEFINE_int32(libyuv_repeat, 0, "number of times to repeat test."); | 28 DEFINE_int32(libyuv_repeat, 0, "number of times to repeat test."); |
| 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, |
| 31 "cpu flags for benchmark code. -1 = SIMD, 1 = C"); |
| 30 | 32 |
| 31 // For quicker unittests, default is 128 x 72. But when benchmarking, | 33 // For quicker unittests, default is 128 x 72. But when benchmarking, |
| 32 // default to 720p. Allow size to specify. | 34 // default to 720p. Allow size to specify. |
| 33 // Set flags to -1 for benchmarking to avoid slower C code. | 35 // Set flags to -1 for benchmarking to avoid slower C code. |
| 34 | 36 |
| 35 LibYUVConvertTest::LibYUVConvertTest() : | 37 LibYUVConvertTest::LibYUVConvertTest() : |
| 36 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(130), | 38 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(130), |
| 37 benchmark_height_(72), disable_cpu_flags_(0) { | 39 benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) { |
| 38 const char* repeat = getenv("LIBYUV_REPEAT"); | 40 const char* repeat = getenv("LIBYUV_REPEAT"); |
| 39 if (repeat) { | 41 if (repeat) { |
| 40 benchmark_iterations_ = atoi(repeat); // NOLINT | 42 benchmark_iterations_ = atoi(repeat); // NOLINT |
| 41 } | 43 } |
| 42 if (FLAGS_libyuv_repeat) { | 44 if (FLAGS_libyuv_repeat) { |
| 43 benchmark_iterations_ = FLAGS_libyuv_repeat; | 45 benchmark_iterations_ = FLAGS_libyuv_repeat; |
| 44 } | 46 } |
| 45 if (benchmark_iterations_ > 1) { | 47 if (benchmark_iterations_ > 1) { |
| 46 benchmark_width_ = 1280; | 48 benchmark_width_ = 1280; |
| 47 benchmark_height_ = 720; | 49 benchmark_height_ = 720; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 60 if (FLAGS_libyuv_height) { | 62 if (FLAGS_libyuv_height) { |
| 61 benchmark_height_ = FLAGS_libyuv_height; | 63 benchmark_height_ = FLAGS_libyuv_height; |
| 62 } | 64 } |
| 63 const char* cpu_flags = getenv("LIBYUV_FLAGS"); | 65 const char* cpu_flags = getenv("LIBYUV_FLAGS"); |
| 64 if (cpu_flags) { | 66 if (cpu_flags) { |
| 65 disable_cpu_flags_ = atoi(cpu_flags); // NOLINT | 67 disable_cpu_flags_ = atoi(cpu_flags); // NOLINT |
| 66 } | 68 } |
| 67 if (FLAGS_libyuv_flags) { | 69 if (FLAGS_libyuv_flags) { |
| 68 disable_cpu_flags_ = FLAGS_libyuv_flags; | 70 disable_cpu_flags_ = FLAGS_libyuv_flags; |
| 69 } | 71 } |
| 72 const char* cpu_info = getenv("LIBYUV_CPU_INFO"); |
| 73 if (cpu_info) { |
| 74 benchmark_cpu_info_ = atoi(cpu_flags); // NOLINT |
| 75 } |
| 76 if (FLAGS_libyuv_cpu_info) { |
| 77 benchmark_cpu_info_ = FLAGS_libyuv_cpu_info; |
| 78 } |
| 70 benchmark_pixels_div256_ = static_cast<int>(( | 79 benchmark_pixels_div256_ = static_cast<int>(( |
| 71 static_cast<double>(Abs(benchmark_width_)) * | 80 static_cast<double>(Abs(benchmark_width_)) * |
| 72 static_cast<double>(Abs(benchmark_height_)) * | 81 static_cast<double>(Abs(benchmark_height_)) * |
| 73 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); | 82 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); |
| 74 benchmark_pixels_div1280_ = static_cast<int>(( | 83 benchmark_pixels_div1280_ = static_cast<int>(( |
| 75 static_cast<double>(Abs(benchmark_width_)) * | 84 static_cast<double>(Abs(benchmark_width_)) * |
| 76 static_cast<double>(Abs(benchmark_height_)) * | 85 static_cast<double>(Abs(benchmark_height_)) * |
| 77 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); | 86 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); |
| 78 } | 87 } |
| 79 | 88 |
| 80 LibYUVColorTest::LibYUVColorTest() : | 89 LibYUVColorTest::LibYUVColorTest() : |
| 81 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), | 90 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), |
| 82 benchmark_height_(72), disable_cpu_flags_(0) { | 91 benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) { |
| 83 const char* repeat = getenv("LIBYUV_REPEAT"); | 92 const char* repeat = getenv("LIBYUV_REPEAT"); |
| 84 if (repeat) { | 93 if (repeat) { |
| 85 benchmark_iterations_ = atoi(repeat); // NOLINT | 94 benchmark_iterations_ = atoi(repeat); // NOLINT |
| 86 } | 95 } |
| 87 if (FLAGS_libyuv_repeat) { | 96 if (FLAGS_libyuv_repeat) { |
| 88 benchmark_iterations_ = FLAGS_libyuv_repeat; | 97 benchmark_iterations_ = FLAGS_libyuv_repeat; |
| 89 } | 98 } |
| 90 if (benchmark_iterations_ > 1) { | 99 if (benchmark_iterations_ > 1) { |
| 91 benchmark_width_ = 1280; | 100 benchmark_width_ = 1280; |
| 92 benchmark_height_ = 720; | 101 benchmark_height_ = 720; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 105 if (FLAGS_libyuv_height) { | 114 if (FLAGS_libyuv_height) { |
| 106 benchmark_height_ = FLAGS_libyuv_height; | 115 benchmark_height_ = FLAGS_libyuv_height; |
| 107 } | 116 } |
| 108 const char* cpu_flags = getenv("LIBYUV_FLAGS"); | 117 const char* cpu_flags = getenv("LIBYUV_FLAGS"); |
| 109 if (cpu_flags) { | 118 if (cpu_flags) { |
| 110 disable_cpu_flags_ = atoi(cpu_flags); // NOLINT | 119 disable_cpu_flags_ = atoi(cpu_flags); // NOLINT |
| 111 } | 120 } |
| 112 if (FLAGS_libyuv_flags) { | 121 if (FLAGS_libyuv_flags) { |
| 113 disable_cpu_flags_ = FLAGS_libyuv_flags; | 122 disable_cpu_flags_ = FLAGS_libyuv_flags; |
| 114 } | 123 } |
| 124 const char* cpu_info = getenv("LIBYUV_CPU_INFO"); |
| 125 if (cpu_info) { |
| 126 benchmark_cpu_info_ = atoi(cpu_flags); // NOLINT |
| 127 } |
| 128 if (FLAGS_libyuv_cpu_info) { |
| 129 benchmark_cpu_info_ = FLAGS_libyuv_cpu_info; |
| 130 } |
| 115 benchmark_pixels_div256_ = static_cast<int>(( | 131 benchmark_pixels_div256_ = static_cast<int>(( |
| 116 static_cast<double>(Abs(benchmark_width_)) * | 132 static_cast<double>(Abs(benchmark_width_)) * |
| 117 static_cast<double>(Abs(benchmark_height_)) * | 133 static_cast<double>(Abs(benchmark_height_)) * |
| 118 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); | 134 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); |
| 119 benchmark_pixels_div1280_ = static_cast<int>(( | 135 benchmark_pixels_div1280_ = static_cast<int>(( |
| 120 static_cast<double>(Abs(benchmark_width_)) * | 136 static_cast<double>(Abs(benchmark_width_)) * |
| 121 static_cast<double>(Abs(benchmark_height_)) * | 137 static_cast<double>(Abs(benchmark_height_)) * |
| 122 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); | 138 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); |
| 123 } | 139 } |
| 124 | 140 |
| 125 LibYUVScaleTest::LibYUVScaleTest() : | 141 LibYUVScaleTest::LibYUVScaleTest() : |
| 126 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), | 142 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), |
| 127 benchmark_height_(72), disable_cpu_flags_(0) { | 143 benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) { |
| 128 const char* repeat = getenv("LIBYUV_REPEAT"); | 144 const char* repeat = getenv("LIBYUV_REPEAT"); |
| 129 if (repeat) { | 145 if (repeat) { |
| 130 benchmark_iterations_ = atoi(repeat); // NOLINT | 146 benchmark_iterations_ = atoi(repeat); // NOLINT |
| 131 } | 147 } |
| 132 if (FLAGS_libyuv_repeat) { | 148 if (FLAGS_libyuv_repeat) { |
| 133 benchmark_iterations_ = FLAGS_libyuv_repeat; | 149 benchmark_iterations_ = FLAGS_libyuv_repeat; |
| 134 } | 150 } |
| 135 if (benchmark_iterations_ > 1) { | 151 if (benchmark_iterations_ > 1) { |
| 136 benchmark_width_ = 1280; | 152 benchmark_width_ = 1280; |
| 137 benchmark_height_ = 720; | 153 benchmark_height_ = 720; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 150 if (FLAGS_libyuv_height) { | 166 if (FLAGS_libyuv_height) { |
| 151 benchmark_height_ = FLAGS_libyuv_height; | 167 benchmark_height_ = FLAGS_libyuv_height; |
| 152 } | 168 } |
| 153 const char* cpu_flags = getenv("LIBYUV_FLAGS"); | 169 const char* cpu_flags = getenv("LIBYUV_FLAGS"); |
| 154 if (cpu_flags) { | 170 if (cpu_flags) { |
| 155 disable_cpu_flags_ = atoi(cpu_flags); // NOLINT | 171 disable_cpu_flags_ = atoi(cpu_flags); // NOLINT |
| 156 } | 172 } |
| 157 if (FLAGS_libyuv_flags) { | 173 if (FLAGS_libyuv_flags) { |
| 158 disable_cpu_flags_ = FLAGS_libyuv_flags; | 174 disable_cpu_flags_ = FLAGS_libyuv_flags; |
| 159 } | 175 } |
| 176 const char* cpu_info = getenv("LIBYUV_CPU_INFO"); |
| 177 if (cpu_info) { |
| 178 benchmark_cpu_info_ = atoi(cpu_flags); // NOLINT |
| 179 } |
| 180 if (FLAGS_libyuv_cpu_info) { |
| 181 benchmark_cpu_info_ = FLAGS_libyuv_cpu_info; |
| 182 } |
| 160 benchmark_pixels_div256_ = static_cast<int>(( | 183 benchmark_pixels_div256_ = static_cast<int>(( |
| 161 static_cast<double>(Abs(benchmark_width_)) * | 184 static_cast<double>(Abs(benchmark_width_)) * |
| 162 static_cast<double>(Abs(benchmark_height_)) * | 185 static_cast<double>(Abs(benchmark_height_)) * |
| 163 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); | 186 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); |
| 164 benchmark_pixels_div1280_ = static_cast<int>(( | 187 benchmark_pixels_div1280_ = static_cast<int>(( |
| 165 static_cast<double>(Abs(benchmark_width_)) * | 188 static_cast<double>(Abs(benchmark_width_)) * |
| 166 static_cast<double>(Abs(benchmark_height_)) * | 189 static_cast<double>(Abs(benchmark_height_)) * |
| 167 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); | 190 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); |
| 168 } | 191 } |
| 169 | 192 |
| 170 LibYUVRotateTest::LibYUVRotateTest() : | 193 LibYUVRotateTest::LibYUVRotateTest() : |
| 171 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), | 194 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), |
| 172 benchmark_height_(72), disable_cpu_flags_(0) { | 195 benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) { |
| 173 const char* repeat = getenv("LIBYUV_REPEAT"); | 196 const char* repeat = getenv("LIBYUV_REPEAT"); |
| 174 if (repeat) { | 197 if (repeat) { |
| 175 benchmark_iterations_ = atoi(repeat); // NOLINT | 198 benchmark_iterations_ = atoi(repeat); // NOLINT |
| 176 } | 199 } |
| 177 if (FLAGS_libyuv_repeat) { | 200 if (FLAGS_libyuv_repeat) { |
| 178 benchmark_iterations_ = FLAGS_libyuv_repeat; | 201 benchmark_iterations_ = FLAGS_libyuv_repeat; |
| 179 } | 202 } |
| 180 if (benchmark_iterations_ > 1) { | 203 if (benchmark_iterations_ > 1) { |
| 181 benchmark_width_ = 1280; | 204 benchmark_width_ = 1280; |
| 182 benchmark_height_ = 720; | 205 benchmark_height_ = 720; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 195 if (FLAGS_libyuv_height) { | 218 if (FLAGS_libyuv_height) { |
| 196 benchmark_height_ = FLAGS_libyuv_height; | 219 benchmark_height_ = FLAGS_libyuv_height; |
| 197 } | 220 } |
| 198 const char* cpu_flags = getenv("LIBYUV_FLAGS"); | 221 const char* cpu_flags = getenv("LIBYUV_FLAGS"); |
| 199 if (cpu_flags) { | 222 if (cpu_flags) { |
| 200 disable_cpu_flags_ = atoi(cpu_flags); // NOLINT | 223 disable_cpu_flags_ = atoi(cpu_flags); // NOLINT |
| 201 } | 224 } |
| 202 if (FLAGS_libyuv_flags) { | 225 if (FLAGS_libyuv_flags) { |
| 203 disable_cpu_flags_ = FLAGS_libyuv_flags; | 226 disable_cpu_flags_ = FLAGS_libyuv_flags; |
| 204 } | 227 } |
| 228 const char* cpu_info = getenv("LIBYUV_CPU_INFO"); |
| 229 if (cpu_info) { |
| 230 benchmark_cpu_info_ = atoi(cpu_flags); // NOLINT |
| 231 } |
| 232 if (FLAGS_libyuv_cpu_info) { |
| 233 benchmark_cpu_info_ = FLAGS_libyuv_cpu_info; |
| 234 } |
| 205 benchmark_pixels_div256_ = static_cast<int>(( | 235 benchmark_pixels_div256_ = static_cast<int>(( |
| 206 static_cast<double>(Abs(benchmark_width_)) * | 236 static_cast<double>(Abs(benchmark_width_)) * |
| 207 static_cast<double>(Abs(benchmark_height_)) * | 237 static_cast<double>(Abs(benchmark_height_)) * |
| 208 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); | 238 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); |
| 209 benchmark_pixels_div1280_ = static_cast<int>(( | 239 benchmark_pixels_div1280_ = static_cast<int>(( |
| 210 static_cast<double>(Abs(benchmark_width_)) * | 240 static_cast<double>(Abs(benchmark_width_)) * |
| 211 static_cast<double>(Abs(benchmark_height_)) * | 241 static_cast<double>(Abs(benchmark_height_)) * |
| 212 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); | 242 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); |
| 213 } | 243 } |
| 214 | 244 |
| 215 LibYUVPlanarTest::LibYUVPlanarTest() : | 245 LibYUVPlanarTest::LibYUVPlanarTest() : |
| 216 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), | 246 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), |
| 217 benchmark_height_(72), disable_cpu_flags_(0) { | 247 benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) { |
| 218 const char* repeat = getenv("LIBYUV_REPEAT"); | 248 const char* repeat = getenv("LIBYUV_REPEAT"); |
| 219 if (repeat) { | 249 if (repeat) { |
| 220 benchmark_iterations_ = atoi(repeat); // NOLINT | 250 benchmark_iterations_ = atoi(repeat); // NOLINT |
| 221 } | 251 } |
| 222 if (FLAGS_libyuv_repeat) { | 252 if (FLAGS_libyuv_repeat) { |
| 223 benchmark_iterations_ = FLAGS_libyuv_repeat; | 253 benchmark_iterations_ = FLAGS_libyuv_repeat; |
| 224 } | 254 } |
| 225 if (benchmark_iterations_ > 1) { | 255 if (benchmark_iterations_ > 1) { |
| 226 benchmark_width_ = 1280; | 256 benchmark_width_ = 1280; |
| 227 benchmark_height_ = 720; | 257 benchmark_height_ = 720; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 240 if (FLAGS_libyuv_height) { | 270 if (FLAGS_libyuv_height) { |
| 241 benchmark_height_ = FLAGS_libyuv_height; | 271 benchmark_height_ = FLAGS_libyuv_height; |
| 242 } | 272 } |
| 243 const char* cpu_flags = getenv("LIBYUV_FLAGS"); | 273 const char* cpu_flags = getenv("LIBYUV_FLAGS"); |
| 244 if (cpu_flags) { | 274 if (cpu_flags) { |
| 245 disable_cpu_flags_ = atoi(cpu_flags); // NOLINT | 275 disable_cpu_flags_ = atoi(cpu_flags); // NOLINT |
| 246 } | 276 } |
| 247 if (FLAGS_libyuv_flags) { | 277 if (FLAGS_libyuv_flags) { |
| 248 disable_cpu_flags_ = FLAGS_libyuv_flags; | 278 disable_cpu_flags_ = FLAGS_libyuv_flags; |
| 249 } | 279 } |
| 280 const char* cpu_info = getenv("LIBYUV_CPU_INFO"); |
| 281 if (cpu_info) { |
| 282 benchmark_cpu_info_ = atoi(cpu_flags); // NOLINT |
| 283 } |
| 284 if (FLAGS_libyuv_cpu_info) { |
| 285 benchmark_cpu_info_ = FLAGS_libyuv_cpu_info; |
| 286 } |
| 250 benchmark_pixels_div256_ = static_cast<int>(( | 287 benchmark_pixels_div256_ = static_cast<int>(( |
| 251 static_cast<double>(Abs(benchmark_width_)) * | 288 static_cast<double>(Abs(benchmark_width_)) * |
| 252 static_cast<double>(Abs(benchmark_height_)) * | 289 static_cast<double>(Abs(benchmark_height_)) * |
| 253 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); | 290 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); |
| 254 benchmark_pixels_div1280_ = static_cast<int>(( | 291 benchmark_pixels_div1280_ = static_cast<int>(( |
| 255 static_cast<double>(Abs(benchmark_width_)) * | 292 static_cast<double>(Abs(benchmark_width_)) * |
| 256 static_cast<double>(Abs(benchmark_height_)) * | 293 static_cast<double>(Abs(benchmark_height_)) * |
| 257 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); | 294 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); |
| 258 } | 295 } |
| 259 | 296 |
| 260 LibYUVBaseTest::LibYUVBaseTest() : | 297 LibYUVBaseTest::LibYUVBaseTest() : |
| 261 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), | 298 benchmark_iterations_(BENCHMARK_ITERATIONS), benchmark_width_(128), |
| 262 benchmark_height_(72), disable_cpu_flags_(0) { | 299 benchmark_height_(72), disable_cpu_flags_(0), benchmark_cpu_info_(-1) { |
| 263 const char* repeat = getenv("LIBYUV_REPEAT"); | 300 const char* repeat = getenv("LIBYUV_REPEAT"); |
| 264 if (repeat) { | 301 if (repeat) { |
| 265 benchmark_iterations_ = atoi(repeat); // NOLINT | 302 benchmark_iterations_ = atoi(repeat); // NOLINT |
| 266 } | 303 } |
| 267 if (FLAGS_libyuv_repeat) { | 304 if (FLAGS_libyuv_repeat) { |
| 268 benchmark_iterations_ = FLAGS_libyuv_repeat; | 305 benchmark_iterations_ = FLAGS_libyuv_repeat; |
| 269 } | 306 } |
| 270 if (benchmark_iterations_ > 1) { | 307 if (benchmark_iterations_ > 1) { |
| 271 benchmark_width_ = 1280; | 308 benchmark_width_ = 1280; |
| 272 benchmark_height_ = 720; | 309 benchmark_height_ = 720; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 285 if (FLAGS_libyuv_height) { | 322 if (FLAGS_libyuv_height) { |
| 286 benchmark_height_ = FLAGS_libyuv_height; | 323 benchmark_height_ = FLAGS_libyuv_height; |
| 287 } | 324 } |
| 288 const char* cpu_flags = getenv("LIBYUV_FLAGS"); | 325 const char* cpu_flags = getenv("LIBYUV_FLAGS"); |
| 289 if (cpu_flags) { | 326 if (cpu_flags) { |
| 290 disable_cpu_flags_ = atoi(cpu_flags); // NOLINT | 327 disable_cpu_flags_ = atoi(cpu_flags); // NOLINT |
| 291 } | 328 } |
| 292 if (FLAGS_libyuv_flags) { | 329 if (FLAGS_libyuv_flags) { |
| 293 disable_cpu_flags_ = FLAGS_libyuv_flags; | 330 disable_cpu_flags_ = FLAGS_libyuv_flags; |
| 294 } | 331 } |
| 332 const char* cpu_info = getenv("LIBYUV_CPU_INFO"); |
| 333 if (cpu_info) { |
| 334 benchmark_cpu_info_ = atoi(cpu_flags); // NOLINT |
| 335 } |
| 336 if (FLAGS_libyuv_cpu_info) { |
| 337 benchmark_cpu_info_ = FLAGS_libyuv_cpu_info; |
| 338 } |
| 295 benchmark_pixels_div256_ = static_cast<int>(( | 339 benchmark_pixels_div256_ = static_cast<int>(( |
| 296 static_cast<double>(Abs(benchmark_width_)) * | 340 static_cast<double>(Abs(benchmark_width_)) * |
| 297 static_cast<double>(Abs(benchmark_height_)) * | 341 static_cast<double>(Abs(benchmark_height_)) * |
| 298 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); | 342 static_cast<double>(benchmark_iterations_) + 255.0) / 256.0); |
| 299 benchmark_pixels_div1280_ = static_cast<int>(( | 343 benchmark_pixels_div1280_ = static_cast<int>(( |
| 300 static_cast<double>(Abs(benchmark_width_)) * | 344 static_cast<double>(Abs(benchmark_width_)) * |
| 301 static_cast<double>(Abs(benchmark_height_)) * | 345 static_cast<double>(Abs(benchmark_height_)) * |
| 302 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); | 346 static_cast<double>(benchmark_iterations_) + 1279.0) / 1280.0); |
| 303 } | 347 } |
| 304 | 348 |
| 305 int main(int argc, char** argv) { | 349 int main(int argc, char** argv) { |
| 306 ::testing::InitGoogleTest(&argc, argv); | 350 ::testing::InitGoogleTest(&argc, argv); |
| 307 // AllowCommandLineParsing allows us to ignore flags passed on to us by | 351 // AllowCommandLineParsing allows us to ignore flags passed on to us by |
| 308 // Chromium build bots without having to explicitly disable them. | 352 // Chromium build bots without having to explicitly disable them. |
| 309 google::AllowCommandLineReparsing(); | 353 google::AllowCommandLineReparsing(); |
| 310 google::ParseCommandLineFlags(&argc, &argv, true); | 354 google::ParseCommandLineFlags(&argc, &argv, true); |
| 311 return RUN_ALL_TESTS(); | 355 return RUN_ALL_TESTS(); |
| 312 } | 356 } |
| OLD | NEW |