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

Side by Side Diff: unit_test/scale_argb_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, 2 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_test.cc ('k') | unit_test/scale_color_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 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 19 matching lines...) Expand all
30 const int b = 0; // 128 to test for padding/stride. 30 const int b = 0; // 128 to test for padding/stride.
31 int64 src_argb_plane_size = (Abs(src_width) + b * 2) * 31 int64 src_argb_plane_size = (Abs(src_width) + b * 2) *
32 (Abs(src_height) + b * 2) * 4LL; 32 (Abs(src_height) + b * 2) * 4LL;
33 int src_stride_argb = (b * 2 + Abs(src_width)) * 4; 33 int src_stride_argb = (b * 2 + Abs(src_width)) * 4;
34 34
35 align_buffer_page_end(src_argb, src_argb_plane_size); 35 align_buffer_page_end(src_argb, src_argb_plane_size);
36 if (!src_argb) { 36 if (!src_argb) {
37 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); 37 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
38 return 0; 38 return 0;
39 } 39 }
40 srandom(time(NULL));
41 MemRandomize(src_argb, src_argb_plane_size); 40 MemRandomize(src_argb, src_argb_plane_size);
42 41
43 int64 dst_argb_plane_size = (dst_width + b * 2) * (dst_height + b * 2) * 4LL; 42 int64 dst_argb_plane_size = (dst_width + b * 2) * (dst_height + b * 2) * 4LL;
44 int dst_stride_argb = (b * 2 + dst_width) * 4; 43 int dst_stride_argb = (b * 2 + dst_width) * 4;
45 44
46 align_buffer_page_end(dst_argb_c, dst_argb_plane_size); 45 align_buffer_page_end(dst_argb_c, dst_argb_plane_size);
47 align_buffer_page_end(dst_argb_opt, dst_argb_plane_size); 46 align_buffer_page_end(dst_argb_opt, dst_argb_plane_size);
48 if (!dst_argb_c || !dst_argb_opt) { 47 if (!dst_argb_c || !dst_argb_opt) {
49 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); 48 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
50 return 0; 49 return 0;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 align_buffer_64(src_argb, src_argb_plane_size); 149 align_buffer_64(src_argb, src_argb_plane_size);
151 if (!src_argb) { 150 if (!src_argb) {
152 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); 151 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
153 return 0; 152 return 0;
154 } 153 }
155 memset(src_argb, 1, src_argb_plane_size); 154 memset(src_argb, 1, src_argb_plane_size);
156 155
157 int64 dst_argb_plane_size = (dst_width + b * 2) * (dst_height + b * 2) * 4; 156 int64 dst_argb_plane_size = (dst_width + b * 2) * (dst_height + b * 2) * 4;
158 int dst_stride_argb = (b * 2 + dst_width) * 4; 157 int dst_stride_argb = (b * 2 + dst_width) * 4;
159 158
160 srandom(time(NULL));
161
162 int i, j; 159 int i, j;
163 for (i = b; i < (Abs(src_height) + b); ++i) { 160 for (i = b; i < (Abs(src_height) + b); ++i) {
164 for (j = b; j < (Abs(src_width) + b) * 4; ++j) { 161 for (j = b; j < (Abs(src_width) + b) * 4; ++j) {
165 src_argb[(i * src_stride_argb) + j] = (random() & 0xff); 162 src_argb[(i * src_stride_argb) + j] = (fastrand() & 0xff);
166 } 163 }
167 } 164 }
168 165
169 align_buffer_64(dst_argb_c, dst_argb_plane_size); 166 align_buffer_64(dst_argb_c, dst_argb_plane_size);
170 align_buffer_64(dst_argb_opt, dst_argb_plane_size); 167 align_buffer_64(dst_argb_opt, dst_argb_plane_size);
171 if (!dst_argb_c || !dst_argb_opt) { 168 if (!dst_argb_c || !dst_argb_opt) {
172 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); 169 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
173 return 0; 170 return 0;
174 } 171 }
175 memset(dst_argb_c, 2, dst_argb_plane_size); 172 memset(dst_argb_c, 2, dst_argb_plane_size);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 TEST_SCALETO(ARGBScale, 1, 1) 293 TEST_SCALETO(ARGBScale, 1, 1)
297 TEST_SCALETO(ARGBScale, 320, 240) 294 TEST_SCALETO(ARGBScale, 320, 240)
298 TEST_SCALETO(ARGBScale, 352, 288) 295 TEST_SCALETO(ARGBScale, 352, 288)
299 TEST_SCALETO(ARGBScale, 569, 480) 296 TEST_SCALETO(ARGBScale, 569, 480)
300 TEST_SCALETO(ARGBScale, 640, 360) 297 TEST_SCALETO(ARGBScale, 640, 360)
301 TEST_SCALETO(ARGBScale, 1280, 720) 298 TEST_SCALETO(ARGBScale, 1280, 720)
302 #undef TEST_SCALETO1 299 #undef TEST_SCALETO1
303 #undef TEST_SCALETO 300 #undef TEST_SCALETO
304 301
305 } // namespace libyuv 302 } // namespace libyuv
OLDNEW
« no previous file with comments | « unit_test/rotate_test.cc ('k') | unit_test/scale_color_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698