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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 } | 48 } |
49 #else | 49 #else |
50 static inline double get_time() { | 50 static inline double get_time() { |
51 struct timeval t; | 51 struct timeval t; |
52 struct timezone tzp; | 52 struct timezone tzp; |
53 gettimeofday(&t, &tzp); | 53 gettimeofday(&t, &tzp); |
54 return t.tv_sec + t.tv_usec * 1e-6; | 54 return t.tv_sec + t.tv_usec * 1e-6; |
55 } | 55 } |
56 #endif | 56 #endif |
57 | 57 |
58 extern int fastrand_seed; | 58 extern int fastrand_seed; |
pbos-webrtc
2016/02/02 21:11:47
Just use an unsigned int, then fastrand_seed >> 16
fbarchard1
2016/02/02 22:23:33
Done.
| |
59 inline int fastrand() { | 59 inline int fastrand() { |
60 fastrand_seed = fastrand_seed * 214013 + 2531011; | 60 fastrand_seed = static_cast<int>( |
61 static_cast<unsigned int>(fastrand_seed) * 214013u + 2531011u); | |
61 return (fastrand_seed >> 16) & 0xffff; | 62 return (fastrand_seed >> 16) & 0xffff; |
62 } | 63 } |
63 | 64 |
64 static inline void MemRandomize(uint8* dst, int64 len) { | 65 static inline void MemRandomize(uint8* dst, int64 len) { |
65 int64 i; | 66 int64 i; |
66 for (i = 0; i < len - 1; i += 2) { | 67 for (i = 0; i < len - 1; i += 2) { |
67 *reinterpret_cast<uint16*>(dst) = fastrand(); | 68 *reinterpret_cast<uint16*>(dst) = fastrand(); |
68 dst += 2; | 69 dst += 2; |
69 } | 70 } |
70 for (; i < len; ++i) { | 71 for (; i < len; ++i) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 int benchmark_iterations_; // Default 1. Use 1000 for benchmarking. | 145 int benchmark_iterations_; // Default 1. Use 1000 for benchmarking. |
145 int benchmark_width_; // Default 1280. Use 640 for benchmarking VGA. | 146 int benchmark_width_; // Default 1280. Use 640 for benchmarking VGA. |
146 int benchmark_height_; // Default 720. Use 360 for benchmarking VGA. | 147 int benchmark_height_; // Default 720. Use 360 for benchmarking VGA. |
147 int benchmark_pixels_div256_; // Total pixels to benchmark / 256. | 148 int benchmark_pixels_div256_; // Total pixels to benchmark / 256. |
148 int benchmark_pixels_div1280_; // Total pixels to benchmark / 1280. | 149 int benchmark_pixels_div1280_; // Total pixels to benchmark / 1280. |
149 int disable_cpu_flags_; // Default 1. Use -1 for benchmarking. | 150 int disable_cpu_flags_; // Default 1. Use -1 for benchmarking. |
150 int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD. | 151 int benchmark_cpu_info_; // Default -1. Use 1 to disable SIMD. |
151 }; | 152 }; |
152 | 153 |
153 #endif // UNIT_TEST_UNIT_TEST_H_ NOLINT | 154 #endif // UNIT_TEST_UNIT_TEST_H_ NOLINT |
OLD | NEW |