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

Side by Side Diff: unit_test/scale_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/scale_color_test.cc ('k') | unit_test/unit_test.h » ('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 25 matching lines...) Expand all
36 int src_stride_y = b * 2 + Abs(src_width); 36 int src_stride_y = b * 2 + Abs(src_width);
37 int src_stride_uv = b * 2 + src_width_uv; 37 int src_stride_uv = b * 2 + src_width_uv;
38 38
39 align_buffer_page_end(src_y, src_y_plane_size) 39 align_buffer_page_end(src_y, src_y_plane_size)
40 align_buffer_page_end(src_u, src_uv_plane_size) 40 align_buffer_page_end(src_u, src_uv_plane_size)
41 align_buffer_page_end(src_v, src_uv_plane_size) 41 align_buffer_page_end(src_v, src_uv_plane_size)
42 if (!src_y || !src_u || !src_v) { 42 if (!src_y || !src_u || !src_v) {
43 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n"); 43 printf("Skipped. Alloc failed " FILELINESTR(__FILE__, __LINE__) "\n");
44 return 0; 44 return 0;
45 } 45 }
46 srandom(time(NULL));
47 MemRandomize(src_y, src_y_plane_size); 46 MemRandomize(src_y, src_y_plane_size);
48 MemRandomize(src_u, src_uv_plane_size); 47 MemRandomize(src_u, src_uv_plane_size);
49 MemRandomize(src_v, src_uv_plane_size); 48 MemRandomize(src_v, src_uv_plane_size);
50 49
51 int dst_width_uv = (dst_width + 1) >> 1; 50 int dst_width_uv = (dst_width + 1) >> 1;
52 int dst_height_uv = (dst_height + 1) >> 1; 51 int dst_height_uv = (dst_height + 1) >> 1;
53 52
54 int64 dst_y_plane_size = (dst_width + b * 2) * (dst_height + b * 2); 53 int64 dst_y_plane_size = (dst_width + b * 2) * (dst_height + b * 2);
55 int64 dst_uv_plane_size = (dst_width_uv + b * 2) * (dst_height_uv + b * 2); 54 int64 dst_uv_plane_size = (dst_width_uv + b * 2) * (dst_height_uv + b * 2);
56 55
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 align_buffer_page_end(src_y, src_y_plane_size) 163 align_buffer_page_end(src_y, src_y_plane_size)
165 align_buffer_page_end(src_u, src_uv_plane_size) 164 align_buffer_page_end(src_u, src_uv_plane_size)
166 align_buffer_page_end(src_v, src_uv_plane_size) 165 align_buffer_page_end(src_v, src_uv_plane_size)
167 align_buffer_page_end(src_y_16, src_y_plane_size * 2) 166 align_buffer_page_end(src_y_16, src_y_plane_size * 2)
168 align_buffer_page_end(src_u_16, src_uv_plane_size * 2) 167 align_buffer_page_end(src_u_16, src_uv_plane_size * 2)
169 align_buffer_page_end(src_v_16, src_uv_plane_size * 2) 168 align_buffer_page_end(src_v_16, src_uv_plane_size * 2)
170 uint16* p_src_y_16 = reinterpret_cast<uint16*>(src_y_16); 169 uint16* p_src_y_16 = reinterpret_cast<uint16*>(src_y_16);
171 uint16* p_src_u_16 = reinterpret_cast<uint16*>(src_u_16); 170 uint16* p_src_u_16 = reinterpret_cast<uint16*>(src_u_16);
172 uint16* p_src_v_16 = reinterpret_cast<uint16*>(src_v_16); 171 uint16* p_src_v_16 = reinterpret_cast<uint16*>(src_v_16);
173 172
174 srandom(time(NULL));
175 MemRandomize(src_y, src_y_plane_size); 173 MemRandomize(src_y, src_y_plane_size);
176 MemRandomize(src_u, src_uv_plane_size); 174 MemRandomize(src_u, src_uv_plane_size);
177 MemRandomize(src_v, src_uv_plane_size); 175 MemRandomize(src_v, src_uv_plane_size);
178 176
179 for (i = b; i < src_height + b; ++i) { 177 for (i = b; i < src_height + b; ++i) {
180 for (j = b; j < src_width + b; ++j) { 178 for (j = b; j < src_width + b; ++j) {
181 p_src_y_16[(i * src_stride_y) + j] = src_y[(i * src_stride_y) + j]; 179 p_src_y_16[(i * src_stride_y) + j] = src_y[(i * src_stride_y) + j];
182 } 180 }
183 } 181 }
184 182
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 TEST_SCALETO(Scale, 1, 1) 355 TEST_SCALETO(Scale, 1, 1)
358 TEST_SCALETO(Scale, 320, 240) 356 TEST_SCALETO(Scale, 320, 240)
359 TEST_SCALETO(Scale, 352, 288) 357 TEST_SCALETO(Scale, 352, 288)
360 TEST_SCALETO(Scale, 569, 480) 358 TEST_SCALETO(Scale, 569, 480)
361 TEST_SCALETO(Scale, 640, 360) 359 TEST_SCALETO(Scale, 640, 360)
362 TEST_SCALETO(Scale, 1280, 720) 360 TEST_SCALETO(Scale, 1280, 720)
363 #undef TEST_SCALETO1 361 #undef TEST_SCALETO1
364 #undef TEST_SCALETO 362 #undef TEST_SCALETO
365 363
366 } // namespace libyuv 364 } // namespace libyuv
OLDNEW
« no previous file with comments | « unit_test/scale_color_test.cc ('k') | unit_test/unit_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698