Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: unit_test/rotate_test.cc

Issue 1361813002: replace random with fastrand (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: remove win32 version of random Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « unit_test/rotate_argb_test.cc ('k') | unit_test/scale_argb_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The LibYuv Project Authors. All rights reserved. 2 * Copyright 2012 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 20 matching lines...) Expand all
31 dst_width = 1; 31 dst_width = 1;
32 } 32 }
33 if (dst_height < 1) { 33 if (dst_height < 1) {
34 dst_height = 1; 34 dst_height = 1;
35 } 35 }
36 int src_i420_y_size = src_width * Abs(src_height); 36 int src_i420_y_size = src_width * Abs(src_height);
37 int src_i420_uv_size = ((src_width + 1) / 2) * ((Abs(src_height) + 1) / 2); 37 int src_i420_uv_size = ((src_width + 1) / 2) * ((Abs(src_height) + 1) / 2);
38 int src_i420_size = src_i420_y_size + src_i420_uv_size * 2; 38 int src_i420_size = src_i420_y_size + src_i420_uv_size * 2;
39 align_buffer_64(src_i420, src_i420_size); 39 align_buffer_64(src_i420, src_i420_size);
40 for (int i = 0; i < src_i420_size; ++i) { 40 for (int i = 0; i < src_i420_size; ++i) {
41 src_i420[i] = random() & 0xff; 41 src_i420[i] = fastrand() & 0xff;
42 } 42 }
43 43
44 int dst_i420_y_size = dst_width * dst_height; 44 int dst_i420_y_size = dst_width * dst_height;
45 int dst_i420_uv_size = ((dst_width + 1) / 2) * ((dst_height + 1) / 2); 45 int dst_i420_uv_size = ((dst_width + 1) / 2) * ((dst_height + 1) / 2);
46 int dst_i420_size = dst_i420_y_size + dst_i420_uv_size * 2; 46 int dst_i420_size = dst_i420_y_size + dst_i420_uv_size * 2;
47 align_buffer_64(dst_i420_c, dst_i420_size); 47 align_buffer_64(dst_i420_c, dst_i420_size);
48 align_buffer_64(dst_i420_opt, dst_i420_size); 48 align_buffer_64(dst_i420_opt, dst_i420_size);
49 memset(dst_i420_c, 2, dst_i420_size); 49 memset(dst_i420_c, 2, dst_i420_size);
50 memset(dst_i420_opt, 3, dst_i420_size); 50 memset(dst_i420_opt, 3, dst_i420_size);
51 51
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 dst_width = 1; 144 dst_width = 1;
145 } 145 }
146 if (dst_height < 1) { 146 if (dst_height < 1) {
147 dst_height = 1; 147 dst_height = 1;
148 } 148 }
149 int src_nv12_y_size = src_width * Abs(src_height); 149 int src_nv12_y_size = src_width * Abs(src_height);
150 int src_nv12_uv_size = ((src_width + 1) / 2) * ((Abs(src_height) + 1) / 2) * 2 ; 150 int src_nv12_uv_size = ((src_width + 1) / 2) * ((Abs(src_height) + 1) / 2) * 2 ;
151 int src_nv12_size = src_nv12_y_size + src_nv12_uv_size; 151 int src_nv12_size = src_nv12_y_size + src_nv12_uv_size;
152 align_buffer_64(src_nv12, src_nv12_size); 152 align_buffer_64(src_nv12, src_nv12_size);
153 for (int i = 0; i < src_nv12_size; ++i) { 153 for (int i = 0; i < src_nv12_size; ++i) {
154 src_nv12[i] = random() & 0xff; 154 src_nv12[i] = fastrand() & 0xff;
155 } 155 }
156 156
157 int dst_i420_y_size = dst_width * dst_height; 157 int dst_i420_y_size = dst_width * dst_height;
158 int dst_i420_uv_size = ((dst_width + 1) / 2) * ((dst_height + 1) / 2); 158 int dst_i420_uv_size = ((dst_width + 1) / 2) * ((dst_height + 1) / 2);
159 int dst_i420_size = dst_i420_y_size + dst_i420_uv_size * 2; 159 int dst_i420_size = dst_i420_y_size + dst_i420_uv_size * 2;
160 align_buffer_64(dst_i420_c, dst_i420_size); 160 align_buffer_64(dst_i420_c, dst_i420_size);
161 align_buffer_64(dst_i420_opt, dst_i420_size); 161 align_buffer_64(dst_i420_opt, dst_i420_size);
162 memset(dst_i420_c, 2, dst_i420_size); 162 memset(dst_i420_c, 2, dst_i420_size);
163 memset(dst_i420_opt, 3, dst_i420_size); 163 memset(dst_i420_opt, 3, dst_i420_size);
164 164
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 NV12TestRotate(benchmark_width_, -benchmark_height_, 262 NV12TestRotate(benchmark_width_, -benchmark_height_,
263 benchmark_height_, benchmark_width_, 263 benchmark_height_, benchmark_width_,
264 kRotate270, benchmark_iterations_, disable_cpu_flags_); 264 kRotate270, benchmark_iterations_, disable_cpu_flags_);
265 } 265 }
266 266
267 267
268 268
269 269
270 270
271 } // namespace libyuv 271 } // namespace libyuv
OLDNEW
« no previous file with comments | « unit_test/rotate_argb_test.cc ('k') | unit_test/scale_argb_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698