| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 } | 84 } |
| 85 #else | 85 #else |
| 86 static inline double get_time() { | 86 static inline double get_time() { |
| 87 struct timeval t; | 87 struct timeval t; |
| 88 struct timezone tzp; | 88 struct timezone tzp; |
| 89 gettimeofday(&t, &tzp); | 89 gettimeofday(&t, &tzp); |
| 90 return t.tv_sec + t.tv_usec * 1e-6; | 90 return t.tv_sec + t.tv_usec * 1e-6; |
| 91 } | 91 } |
| 92 #endif | 92 #endif |
| 93 | 93 |
| 94 #ifndef SIMD_ALIGNED |
| 95 #if defined(_MSC_VER) && !defined(__CLR_VER) |
| 96 #define SIMD_ALIGNED(var) __declspec(align(16)) var |
| 97 #elif defined(__GNUC__) && !defined(__pnacl__) |
| 98 #define SIMD_ALIGNED(var) var __attribute__((aligned(16))) |
| 99 #else |
| 100 #define SIMD_ALIGNED(var) var |
| 101 #endif |
| 102 #endif |
| 103 |
| 94 extern unsigned int fastrand_seed; | 104 extern unsigned int fastrand_seed; |
| 95 inline int fastrand() { | 105 inline int fastrand() { |
| 96 fastrand_seed = fastrand_seed * 214013u + 2531011u; | 106 fastrand_seed = fastrand_seed * 214013u + 2531011u; |
| 97 return static_cast<int>((fastrand_seed >> 16) & 0xffff); | 107 return static_cast<int>((fastrand_seed >> 16) & 0xffff); |
| 98 } | 108 } |
| 99 | 109 |
| 100 static inline void MemRandomize(uint8* dst, int64 len) { | 110 static inline void MemRandomize(uint8* dst, int64 len) { |
| 101 int64 i; | 111 int64 i; |
| 102 for (i = 0; i < len - 1; i += 2) { | 112 for (i = 0; i < len - 1; i += 2) { |
| 103 *reinterpret_cast<uint16*>(dst) = fastrand(); | 113 *reinterpret_cast<uint16*>(dst) = fastrand(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 int benchmark_iterations_; // Default 1. Use 1000 for benchmarking. | 190 int benchmark_iterations_; // Default 1. Use 1000 for benchmarking. |
| 181 int benchmark_width_; // Default 1280. Use 640 for benchmarking VGA. | 191 int benchmark_width_; // Default 1280. Use 640 for benchmarking VGA. |
| 182 int benchmark_height_; // Default 720. Use 360 for benchmarking VGA. | 192 int benchmark_height_; // Default 720. Use 360 for benchmarking VGA. |
| 183 int benchmark_pixels_div256_; // Total pixels to benchmark / 256. | 193 int benchmark_pixels_div256_; // Total pixels to benchmark / 256. |
| 184 int benchmark_pixels_div1280_; // Total pixels to benchmark / 1280. | 194 int benchmark_pixels_div1280_; // Total pixels to benchmark / 1280. |
| 185 int disable_cpu_flags_; // Default 1. Use -1 for benchmarking. | 195 int disable_cpu_flags_; // Default 1. Use -1 for benchmarking. |
| 186 int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD. | 196 int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD. |
| 187 }; | 197 }; |
| 188 | 198 |
| 189 #endif // UNIT_TEST_UNIT_TEST_H_ NOLINT | 199 #endif // UNIT_TEST_UNIT_TEST_H_ NOLINT |
| OLD | NEW |